Sat Aug 3 19:56:42 2019 UTC ()
make function prototype consistent


(tnn)
diff -r1.1 -r1.2 src/sys/arch/arm/sunxi/sun4i_spi.c

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

--- src/sys/arch/arm/sunxi/sun4i_spi.c 2019/08/03 13:28:42 1.1
+++ src/sys/arch/arm/sunxi/sun4i_spi.c 2019/08/03 19:56:42 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sun4i_spi.c,v 1.1 2019/08/03 13:28:42 tnn Exp $ */ 1/* $NetBSD: sun4i_spi.c,v 1.2 2019/08/03 19:56:42 tnn Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2019 Tobias Nygren 4 * Copyright (c) 2019 Tobias Nygren
5 * Copyright (c) 2018 Jonathan A. Kollasch 5 * Copyright (c) 2018 Jonathan A. Kollasch
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 26 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30#include <sys/cdefs.h> 30#include <sys/cdefs.h>
31__KERNEL_RCSID(0, "$NetBSD: sun4i_spi.c,v 1.1 2019/08/03 13:28:42 tnn Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: sun4i_spi.c,v 1.2 2019/08/03 19:56:42 tnn Exp $");
32 32
33#include <sys/param.h> 33#include <sys/param.h>
34#include <sys/device.h> 34#include <sys/device.h>
35#include <sys/systm.h> 35#include <sys/systm.h>
36#include <sys/bus.h> 36#include <sys/bus.h>
37#include <sys/intr.h> 37#include <sys/intr.h>
38#include <sys/kernel.h> 38#include <sys/kernel.h>
39#include <sys/bitops.h> 39#include <sys/bitops.h>
40#include <dev/spi/spivar.h> 40#include <dev/spi/spivar.h>
41#include <arm/sunxi/sun4i_spireg.h> 41#include <arm/sunxi/sun4i_spireg.h>
42#include <dev/fdt/fdtvar.h> 42#include <dev/fdt/fdtvar.h>
43 43
44static const char * const compatible[] = { 44static const char * const compatible[] = {
@@ -63,27 +63,27 @@ struct sun4ispi_softc { @@ -63,27 +63,27 @@ struct sun4ispi_softc {
63#define SPIREG_READ(sc, reg) \ 63#define SPIREG_READ(sc, reg) \
64 bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg)) 64 bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg))
65#define SPIREG_WRITE(sc, reg, val) \ 65#define SPIREG_WRITE(sc, reg, val) \
66 bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val)) 66 bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
67 67
68static int sun4ispi_match(device_t, cfdata_t, void *); 68static int sun4ispi_match(device_t, cfdata_t, void *);
69static void sun4ispi_attach(device_t, device_t, void *); 69static void sun4ispi_attach(device_t, device_t, void *);
70 70
71static int sun4ispi_configure(void *, int, int, int); 71static int sun4ispi_configure(void *, int, int, int);
72static int sun4ispi_transfer(void *, struct spi_transfer *); 72static int sun4ispi_transfer(void *, struct spi_transfer *);
73 73
74static void sun4ispi_txfifo_fill(struct sun4ispi_softc * const, size_t); 74static void sun4ispi_txfifo_fill(struct sun4ispi_softc * const, size_t);
75static void sun4ispi_rxfifo_drain(struct sun4ispi_softc * const, size_t); 75static void sun4ispi_rxfifo_drain(struct sun4ispi_softc * const, size_t);
76static void sun4ispi_rxtx(struct sun4ispi_softc *); 76static void sun4ispi_rxtx(struct sun4ispi_softc * const);
77static void sun4ispi_set_interrupt_mask(struct sun4ispi_softc * const); 77static void sun4ispi_set_interrupt_mask(struct sun4ispi_softc * const);
78static void sun4ispi_start(struct sun4ispi_softc * const); 78static void sun4ispi_start(struct sun4ispi_softc * const);
79static int sun4ispi_intr(void *); 79static int sun4ispi_intr(void *);
80 80
81CFATTACH_DECL_NEW(sun4i_spi, sizeof(struct sun4ispi_softc), 81CFATTACH_DECL_NEW(sun4i_spi, sizeof(struct sun4ispi_softc),
82 sun4ispi_match, sun4ispi_attach, NULL, NULL); 82 sun4ispi_match, sun4ispi_attach, NULL, NULL);
83 83
84static int 84static int
85sun4ispi_match(device_t parent, cfdata_t cf, void *aux) 85sun4ispi_match(device_t parent, cfdata_t cf, void *aux)
86{ 86{
87 struct fdt_attach_args * const faa = aux; 87 struct fdt_attach_args * const faa = aux;
88 88
89 return of_match_compatible(faa->faa_phandle, compatible); 89 return of_match_compatible(faa->faa_phandle, compatible);
@@ -129,27 +129,27 @@ sun4ispi_attach(device_t parent, device_ @@ -129,27 +129,27 @@ sun4ispi_attach(device_t parent, device_
129 | SPI_CTL_TF_RST | SPI_CTL_MODE); 129 | SPI_CTL_TF_RST | SPI_CTL_MODE);
130 SPIREG_WRITE(sc, SPI_DMACTL, 0); 130 SPIREG_WRITE(sc, SPI_DMACTL, 0);
131 SPIREG_WRITE(sc, SPI_WAIT, 0); 131 SPIREG_WRITE(sc, SPI_WAIT, 0);
132 SPIREG_WRITE(sc, SPI_INTCTL, 0); 132 SPIREG_WRITE(sc, SPI_INTCTL, 0);
133 SPIREG_WRITE(sc, SPI_INT_STA, ~0); 133 SPIREG_WRITE(sc, SPI_INT_STA, ~0);
134 134
135 if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) { 135 if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) {
136 aprint_error(": failed to decode interrupt\n"); 136 aprint_error(": failed to decode interrupt\n");
137 return; 137 return;
138 } 138 }
139 139
140 sc->sc_intrh = fdtbus_intr_establish(phandle, 0, IPL_VM, 0, sun4ispi_intr, sc); 140 sc->sc_intrh = fdtbus_intr_establish(phandle, 0, IPL_VM, 0, sun4ispi_intr, sc);
141 if (sc->sc_intrh == NULL) { 141 if (sc->sc_intrh == NULL) {
142 aprint_error("unable to establish interrupt\n"); 142 aprint_error(": unable to establish interrupt\n");
143 return; 143 return;
144 } 144 }
145 145
146 aprint_naive("\n"); 146 aprint_naive("\n");
147 aprint_normal(": SPI\n"); 147 aprint_normal(": SPI\n");
148 aprint_normal_dev(self, "interrupting on %s\n", intrstr); 148 aprint_normal_dev(self, "interrupting on %s\n", intrstr);
149 149
150 sc->sc_spi.sct_cookie = sc; 150 sc->sc_spi.sct_cookie = sc;
151 sc->sc_spi.sct_configure = sun4ispi_configure; 151 sc->sc_spi.sct_configure = sun4ispi_configure;
152 sc->sc_spi.sct_transfer = sun4ispi_transfer; 152 sc->sc_spi.sct_transfer = sun4ispi_transfer;
153 (void) of_getprop_uint32(phandle, "num-cs", &sc->sc_spi.sct_nslaves); 153 (void) of_getprop_uint32(phandle, "num-cs", &sc->sc_spi.sct_nslaves);
154 sba.sba_controller = &sc->sc_spi; 154 sba.sba_controller = &sc->sc_spi;
155 155