Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/sunxi Switch to fdtbus_attach_spibus(), so spi ...
details: https://anonhg.NetBSD.org/src/rev/99ec147b748b
branches: trunk
changeset: 454234:99ec147b748b
user: bouyer <bouyer%NetBSD.org@localhost>
date: Wed Sep 11 15:03:52 2019 +0000
description:
Switch to fdtbus_attach_spibus(), so spi slaves defined in the device tree
have a chance to be found.
diffstat:
sys/arch/arm/sunxi/sun4i_spi.c | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)
diffs (66 lines):
diff -r 6ea1ce8e8520 -r 99ec147b748b sys/arch/arm/sunxi/sun4i_spi.c
--- a/sys/arch/arm/sunxi/sun4i_spi.c Wed Sep 11 14:56:25 2019 +0000
+++ b/sys/arch/arm/sunxi/sun4i_spi.c Wed Sep 11 15:03:52 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sun4i_spi.c,v 1.4 2019/08/13 17:03:10 tnn Exp $ */
+/* $NetBSD: sun4i_spi.c,v 1.5 2019/09/11 15:03:52 bouyer Exp $ */
/*
* Copyright (c) 2019 Tobias Nygren
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sun4i_spi.c,v 1.4 2019/08/13 17:03:10 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sun4i_spi.c,v 1.5 2019/09/11 15:03:52 bouyer Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -65,6 +65,7 @@
#define SPIREG_WRITE(sc, reg, val) \
bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
+static struct spi_controller * sun4i_spi_get_controller(device_t);
static int sun4ispi_match(device_t, cfdata_t, void *);
static void sun4ispi_attach(device_t, device_t, void *);
@@ -81,6 +82,18 @@
CFATTACH_DECL_NEW(sun4i_spi, sizeof(struct sun4ispi_softc),
sun4ispi_match, sun4ispi_attach, NULL, NULL);
+static const struct fdtbus_spi_controller_func sun4i_spi_funcs = {
+ .get_controller = sun4i_spi_get_controller
+};
+
+static struct spi_controller *
+sun4i_spi_get_controller(device_t dev)
+{
+ struct sun4ispi_softc * const sc = device_private(dev);
+
+ return &sc->sc_spi;
+}
+
static int
sun4ispi_match(device_t parent, cfdata_t cf, void *aux)
{
@@ -99,7 +112,6 @@
bus_size_t size;
struct clk *clk, *modclk;
char intrstr[128];
- struct spibus_attach_args sba;
sc->sc_dev = self;
sc->sc_bst = faa->faa_bst;
@@ -151,10 +163,8 @@
sc->sc_spi.sct_configure = sun4ispi_configure;
sc->sc_spi.sct_transfer = sun4ispi_transfer;
(void) of_getprop_uint32(phandle, "num-cs", &sc->sc_spi.sct_nslaves);
- memset(&sba, 0, sizeof(sba));
- sba.sba_controller = &sc->sc_spi;
-
- (void) config_found_ia(self, "spibus", &sba, spibus_print);
+ fdtbus_register_spi_controller(self, phandle, &sun4i_spi_funcs);
+ (void) fdtbus_attach_spibus(self, phandle, spibus_print);
}
static int
Home |
Main Index |
Thread Index |
Old Index