Thu Jun 29 17:05:27 2017 UTC ()
Rename a variable, NFC.


(jmcneill)
diff -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_com.c

cvs diff -r1.1 -r1.2 src/sys/arch/arm/sunxi/Attic/sunxi_com.c (expand / switch to unified diff)

--- src/sys/arch/arm/sunxi/Attic/sunxi_com.c 2017/06/28 23:51:29 1.1
+++ src/sys/arch/arm/sunxi/Attic/sunxi_com.c 2017/06/29 17:05:26 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sunxi_com.c,v 1.1 2017/06/28 23:51:29 jmcneill Exp $ */ 1/* $NetBSD: sunxi_com.c,v 1.2 2017/06/29 17:05:26 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30 30
31__KERNEL_RCSID(1, "$NetBSD: sunxi_com.c,v 1.1 2017/06/28 23:51:29 jmcneill Exp $"); 31__KERNEL_RCSID(1, "$NetBSD: sunxi_com.c,v 1.2 2017/06/29 17:05:26 jmcneill Exp $");
32 32
33#include <sys/param.h> 33#include <sys/param.h>
34#include <sys/bus.h> 34#include <sys/bus.h>
35#include <sys/device.h> 35#include <sys/device.h>
36#include <sys/intr.h> 36#include <sys/intr.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/time.h> 38#include <sys/time.h>
39#include <sys/termios.h> 39#include <sys/termios.h>
40 40
41#include <dev/ic/comvar.h> 41#include <dev/ic/comvar.h>
42 42
43#include <dev/fdt/fdtvar.h> 43#include <dev/fdt/fdtvar.h>
44 44
@@ -62,28 +62,28 @@ CFATTACH_DECL_NEW(sunxi_com, sizeof(stru @@ -62,28 +62,28 @@ CFATTACH_DECL_NEW(sunxi_com, sizeof(stru
62 sunxi_com_match, sunxi_com_attach, NULL, NULL); 62 sunxi_com_match, sunxi_com_attach, NULL, NULL);
63 63
64static int 64static int
65sunxi_com_match(device_t parent, cfdata_t cf, void *aux) 65sunxi_com_match(device_t parent, cfdata_t cf, void *aux)
66{ 66{
67 struct fdt_attach_args * const faa = aux; 67 struct fdt_attach_args * const faa = aux;
68 68
69 return of_match_compatible(faa->faa_phandle, compatible); 69 return of_match_compatible(faa->faa_phandle, compatible);
70} 70}
71 71
72static void 72static void
73sunxi_com_attach(device_t parent, device_t self, void *aux) 73sunxi_com_attach(device_t parent, device_t self, void *aux)
74{ 74{
75 struct sunxi_com_softc * const tsc = device_private(self); 75 struct sunxi_com_softc * const ssc = device_private(self);
76 struct com_softc * const sc = &tsc->ssc_sc; 76 struct com_softc * const sc = &ssc->ssc_sc;
77 struct fdt_attach_args * const faa = aux; 77 struct fdt_attach_args * const faa = aux;
78 bus_space_handle_t bsh; 78 bus_space_handle_t bsh;
79 bus_space_tag_t bst; 79 bus_space_tag_t bst;
80 char intrstr[128]; 80 char intrstr[128];
81 bus_addr_t addr; 81 bus_addr_t addr;
82 bus_size_t size; 82 bus_size_t size;
83 u_int reg_shift; 83 u_int reg_shift;
84 int error; 84 int error;
85 85
86 if (fdtbus_get_reg(faa->faa_phandle, 0, &addr, &size) != 0) { 86 if (fdtbus_get_reg(faa->faa_phandle, 0, &addr, &size) != 0) {
87 aprint_error(": couldn't get registers\n"); 87 aprint_error(": couldn't get registers\n");
88 return; 88 return;
89 } 89 }
@@ -95,56 +95,56 @@ sunxi_com_attach(device_t parent, device @@ -95,56 +95,56 @@ sunxi_com_attach(device_t parent, device
95 if (reg_shift == 2) { 95 if (reg_shift == 2) {
96 bst = faa->faa_a4x_bst; 96 bst = faa->faa_a4x_bst;
97 } else if (reg_shift == 0) { 97 } else if (reg_shift == 0) {
98 bst = faa->faa_bst; 98 bst = faa->faa_bst;
99 } else { 99 } else {
100 aprint_error(": unsupported reg-shift value %d\n", 100 aprint_error(": unsupported reg-shift value %d\n",
101 reg_shift); 101 reg_shift);
102 return; 102 return;
103 } 103 }
104 } 104 }
105 105
106 sc->sc_dev = self; 106 sc->sc_dev = self;
107 107
108 tsc->ssc_clk = fdtbus_clock_get_index(faa->faa_phandle, 0); 108 ssc->ssc_clk = fdtbus_clock_get_index(faa->faa_phandle, 0);
109 tsc->ssc_rst = fdtbus_reset_get_index(faa->faa_phandle, 0); 109 ssc->ssc_rst = fdtbus_reset_get_index(faa->faa_phandle, 0);
110 110
111 if (tsc->ssc_clk == NULL) { 111 if (ssc->ssc_clk == NULL) {
112 aprint_error(": couldn't get frequency\n"); 112 aprint_error(": couldn't get frequency\n");
113 return; 113 return;
114 } 114 }
115 115
116 sc->sc_frequency = clk_get_rate(tsc->ssc_clk); 116 sc->sc_frequency = clk_get_rate(ssc->ssc_clk);
117 sc->sc_type = COM_TYPE_NORMAL; 117 sc->sc_type = COM_TYPE_NORMAL;
118 118
119 error = bus_space_map(bst, addr, size, 0, &bsh); 119 error = bus_space_map(bst, addr, size, 0, &bsh);
120 if (error) { 120 if (error) {
121 aprint_error(": couldn't map %#llx: %d", (uint64_t)addr, error); 121 aprint_error(": couldn't map %#llx: %d", (uint64_t)addr, error);
122 return; 122 return;
123 } 123 }
124 124
125 COM_INIT_REGS(sc->sc_regs, bst, bsh, addr); 125 COM_INIT_REGS(sc->sc_regs, bst, bsh, addr);
126 126
127 com_attach_subr(sc); 127 com_attach_subr(sc);
128 aprint_naive("\n"); 128 aprint_naive("\n");
129 129
130 if (!fdtbus_intr_str(faa->faa_phandle, 0, intrstr, sizeof(intrstr))) { 130 if (!fdtbus_intr_str(faa->faa_phandle, 0, intrstr, sizeof(intrstr))) {
131 aprint_error_dev(self, "failed to decode interrupt\n"); 131 aprint_error_dev(self, "failed to decode interrupt\n");
132 return; 132 return;
133 } 133 }
134 134
135 tsc->ssc_ih = fdtbus_intr_establish(faa->faa_phandle, 0, IPL_SERIAL, 135 ssc->ssc_ih = fdtbus_intr_establish(faa->faa_phandle, 0, IPL_SERIAL,
136 FDT_INTR_MPSAFE, comintr, sc); 136 FDT_INTR_MPSAFE, comintr, sc);
137 if (tsc->ssc_ih == NULL) { 137 if (ssc->ssc_ih == NULL) {
138 aprint_error_dev(self, "failed to establish interrupt on %s\n", 138 aprint_error_dev(self, "failed to establish interrupt on %s\n",
139 intrstr); 139 intrstr);
140 } 140 }
141 aprint_normal_dev(self, "interrupting on %s\n", intrstr); 141 aprint_normal_dev(self, "interrupting on %s\n", intrstr);
142} 142}
143 143
144/* 144/*
145 * Console support 145 * Console support
146 */ 146 */
147 147
148static int 148static int
149sunxi_com_console_match(int phandle) 149sunxi_com_console_match(int phandle)
150{ 150{