Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/rockchip rk_spi: register controller with fdt
details: https://anonhg.NetBSD.org/src/rev/550a9133bd03
branches: trunk
changeset: 463227:550a9133bd03
user: tnn <tnn%NetBSD.org@localhost>
date: Tue Aug 13 17:15:55 2019 +0000
description:
rk_spi: register controller with fdt
diffstat:
sys/arch/arm/rockchip/rk_spi.c | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
diffs (68 lines):
diff -r 9340f59f7c9f -r 550a9133bd03 sys/arch/arm/rockchip/rk_spi.c
--- a/sys/arch/arm/rockchip/rk_spi.c Tue Aug 13 17:11:32 2019 +0000
+++ b/sys/arch/arm/rockchip/rk_spi.c Tue Aug 13 17:15:55 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_spi.c,v 1.2 2019/08/13 17:03:10 tnn Exp $ */
+/* $NetBSD: rk_spi.c,v 1.3 2019/08/13 17:15:55 tnn Exp $ */
/*
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rk_spi.c,v 1.2 2019/08/13 17:03:10 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_spi.c,v 1.3 2019/08/13 17:15:55 tnn Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -170,6 +170,7 @@
#define SPIREG_WRITE(sc, reg, val) \
bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
+static struct spi_controller *rk_spi_get_controller(device_t);
static int rk_spi_match(device_t, cfdata_t, void *);
static void rk_spi_attach(device_t, device_t, void *);
@@ -186,6 +187,18 @@
CFATTACH_DECL_NEW(rk_spi, sizeof(struct rk_spi_softc),
rk_spi_match, rk_spi_attach, NULL, NULL);
+static const struct fdtbus_spi_controller_func rk_spi_funcs = {
+ .get_controller = rk_spi_get_controller
+};
+
+static struct spi_controller *
+rk_spi_get_controller(device_t dev)
+{
+ struct rk_spi_softc * const sc = device_private(dev);
+
+ return &sc->sc_spi;
+}
+
static int
rk_spi_match(device_t parent, cfdata_t cf, void *aux)
{
@@ -204,8 +217,7 @@
bus_size_t size;
struct clk *sclk, *pclk;
char intrstr[128];
- struct spibus_attach_args sba;
-
+
sc->sc_dev = self;
sc->sc_bst = faa->faa_bst;
SIMPLEQ_INIT(&sc->sc_q);
@@ -253,10 +265,8 @@
sc->sc_spi.sct_transfer = rk_spi_transfer;
sc->sc_spi.sct_nslaves = 2;
- 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, &rk_spi_funcs);
+ (void) fdtbus_attach_spibus(self, phandle, spibus_print);
}
static int
Home |
Main Index |
Thread Index |
Old Index