Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/thorpej-i2c-spi-conf]: src/sys/dev/marvell Pass the controller devhandle...



details:   https://anonhg.NetBSD.org/src/rev/87423d810603
branches:  thorpej-i2c-spi-conf
changeset: 378794:87423d810603
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue May 18 23:30:55 2021 +0000

description:
Pass the controller devhandle along to the "spi" instance.

diffstat:

 sys/arch/arm/at91/at91spi.c         |  17 +++++++++--------
 sys/arch/arm/broadcom/bcm2835_spi.c |  15 ++++++++-------
 sys/arch/arm/imx/imxspi.c           |  18 +++++++++---------
 sys/arch/arm/sunxi/sun6i_spi.c      |  15 ++++++++-------
 sys/arch/mips/alchemy/dev/auspi.c   |  15 ++++++++-------
 sys/arch/mips/atheros/dev/arspi.c   |  14 ++++++++------
 sys/dev/marvell/mvspi.c             |  10 ++++++----
 7 files changed, 56 insertions(+), 48 deletions(-)

diffs (297 lines):

diff -r 9c7759f4fa64 -r 87423d810603 sys/arch/arm/at91/at91spi.c
--- a/sys/arch/arm/at91/at91spi.c       Tue May 18 23:26:46 2021 +0000
+++ b/sys/arch/arm/at91/at91spi.c       Tue May 18 23:30:55 2021 +0000
@@ -1,5 +1,5 @@
-/*     $Id: at91spi.c,v 1.6 2021/04/24 23:36:26 thorpej Exp $  */
-/*     $NetBSD: at91spi.c,v 1.6 2021/04/24 23:36:26 thorpej Exp $      */
+/*     $Id: at91spi.c,v 1.6.2.1 2021/05/18 23:30:55 thorpej Exp $      */
+/*     $NetBSD: at91spi.c,v 1.6.2.1 2021/05/18 23:30:55 thorpej Exp $  */
 
 /*-
  * Copyright (c) 2007 Embedtronics Oy. All rights reserved.
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at91spi.c,v 1.6 2021/04/24 23:36:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at91spi.c,v 1.6.2.1 2021/05/18 23:30:55 thorpej Exp $");
 
 #include "locators.h"
 
@@ -105,7 +105,6 @@ at91spi_attach_common(device_t parent, d
 {
        struct at91spi_softc *sc = device_private(self);
        struct at91bus_attach_args *sa = aux;
-       struct spibus_attach_args sba;
        bus_dma_segment_t segs;
        int rsegs, err;
 
@@ -155,9 +154,6 @@ at91spi_attach_common(device_t parent, d
                aprint_error("%s: no slaves!\n", device_xname(sc->sc_dev));
        }
 
-       memset(&sba, 0, sizeof(sba));
-       sba.sba_controller = &sc->sc_spi;
-
        /* initialize the queue */
        SIMPLEQ_INIT(&sc->sc_q);
 
@@ -193,7 +189,12 @@ at91spi_attach_common(device_t parent, d
        PUTREG(sc, SPI_PDC_BASE + PDC_PTCR, PDC_PTCR_TXTEN | PDC_PTCR_RXTEN);
 
        /* attach slave devices */
-       config_found(sc->sc_dev, &sba, spibus_print, CFARG_EOL);
+       struct spibus_attach_args sba = {
+               .sba_controller = &sc->sc_spi,
+       };
+       config_found(sc->sc_dev, &sba, spibus_print,
+           CFARG_DEVHANDLE, device_handle(sc->sc_dev),
+           CFARG_EOL);
 }
 
 int
diff -r 9c7759f4fa64 -r 87423d810603 sys/arch/arm/broadcom/bcm2835_spi.c
--- a/sys/arch/arm/broadcom/bcm2835_spi.c       Tue May 18 23:26:46 2021 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_spi.c       Tue May 18 23:30:55 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_spi.c,v 1.10 2021/04/24 23:36:26 thorpej Exp $ */
+/*     $NetBSD: bcm2835_spi.c,v 1.10.2.1 2021/05/18 23:30:55 thorpej Exp $     */
 
 /*
  * Copyright (c) 2012 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_spi.c,v 1.10 2021/04/24 23:36:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_spi.c,v 1.10.2.1 2021/05/18 23:30:55 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -95,7 +95,6 @@ bcmspi_attach(device_t parent, device_t 
 {
        struct bcmspi_softc * const sc = device_private(self);
        struct fdt_attach_args * const faa = aux;
-       struct spibus_attach_args sba;
 
        aprint_naive("\n");
        aprint_normal(": SPI\n");
@@ -138,10 +137,12 @@ bcmspi_attach(device_t parent, device_t 
        sc->sc_spi.sct_transfer = bcmspi_transfer;
        sc->sc_spi.sct_nslaves = 3;
 
-       memset(&sba, 0, sizeof(sba));
-       sba.sba_controller = &sc->sc_spi;
-
-       config_found(self, &sba, spibus_print, CFARG_EOL);
+       struct spibus_attach_args sba = {
+               .sba_controller = &sc->sc_spi,
+       };
+       config_found(self, &sba, spibus_print,
+           CFARG_DEVHANDLE, device_handle(self),
+           CFARG_EOL);
 }
 
 static int
diff -r 9c7759f4fa64 -r 87423d810603 sys/arch/arm/imx/imxspi.c
--- a/sys/arch/arm/imx/imxspi.c Tue May 18 23:26:46 2021 +0000
+++ b/sys/arch/arm/imx/imxspi.c Tue May 18 23:30:55 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: imxspi.c,v 1.8 2021/04/24 23:36:27 thorpej Exp $       */
+/*     $NetBSD: imxspi.c,v 1.8.2.1 2021/05/18 23:30:55 thorpej Exp $   */
 
 /*-
  * Copyright (c) 2014  Genetec Corporation.  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imxspi.c,v 1.8 2021/04/24 23:36:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imxspi.c,v 1.8.2.1 2021/05/18 23:30:55 thorpej Exp $");
 
 #include "opt_imxspi.h"
 #include "opt_fdt.h"
@@ -141,14 +141,14 @@ imxspi_attach_common(device_t self)
        KASSERT(sc->sc_phandle != 0);
 
        fdtbus_register_spi_controller(self, sc->sc_phandle, &imxspi_funcs);
-       (void) fdtbus_attach_spibus(self, sc->sc_phandle, spibus_print);
+       fdtbus_attach_spibus(self, sc->sc_phandle, spibus_print);
 #else
-       struct spibus_attach_args sba;
-       memset(&sba, 0, sizeof(sba));
-       sba.sba_controller = &sc->sc_spi;
-
-       /* attach slave devices */
-       config_found(sc->sc_dev, &sba, spibus_print, CFARG_EOL);
+       struct spibus_attach_args sba = {
+               .sba_controller = &sc->sc_spi,
+       };
+       config_found(sc->sc_dev, &sba, spibus_print,
+           CFARG_DEVHANDLE, device_handle(self),
+           CFARG_EOL);
 #endif
 
        return 0;
diff -r 9c7759f4fa64 -r 87423d810603 sys/arch/arm/sunxi/sun6i_spi.c
--- a/sys/arch/arm/sunxi/sun6i_spi.c    Tue May 18 23:26:46 2021 +0000
+++ b/sys/arch/arm/sunxi/sun6i_spi.c    Tue May 18 23:30:55 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sun6i_spi.c,v 1.9 2021/04/24 23:36:28 thorpej Exp $    */
+/*     $NetBSD: sun6i_spi.c,v 1.9.2.1 2021/05/18 23:30:56 thorpej Exp $        */
 
 /*
  * Copyright (c) 2019 Tobias Nygren
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sun6i_spi.c,v 1.9 2021/04/24 23:36:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sun6i_spi.c,v 1.9.2.1 2021/05/18 23:30:56 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -102,7 +102,6 @@ sun6ispi_attach(device_t parent, device_
 {
        struct sun6ispi_softc * const sc = device_private(self);
        struct fdt_attach_args * const faa = aux;
-       struct spibus_attach_args sba;
        const int phandle = faa->faa_phandle;
        bus_addr_t addr;
        bus_size_t size;
@@ -185,10 +184,12 @@ sun6ispi_attach(device_t parent, device_
        sc->sc_spi.sct_transfer = sun6ispi_transfer;
        sc->sc_spi.sct_nslaves = 4;
 
-       memset(&sba, 0, sizeof(sba));
-       sba.sba_controller = &sc->sc_spi;
-
-       (void) config_found(self, &sba, spibus_print, CFARG_EOL);
+       struct spibus_attach_args sba = {
+               .sba_controller = &sc->sc_spi,
+       };
+       config_found(self, &sba, spibus_print,
+           CFARG_DEVHANDLE, device_handle(self),
+           CFARG_EOL);
 }
 
 static int
diff -r 9c7759f4fa64 -r 87423d810603 sys/arch/mips/alchemy/dev/auspi.c
--- a/sys/arch/mips/alchemy/dev/auspi.c Tue May 18 23:26:46 2021 +0000
+++ b/sys/arch/mips/alchemy/dev/auspi.c Tue May 18 23:30:55 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: auspi.c,v 1.10 2021/04/24 23:36:42 thorpej Exp $ */
+/* $NetBSD: auspi.c,v 1.10.2.1 2021/05/18 23:30:56 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auspi.c,v 1.10 2021/04/24 23:36:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auspi.c,v 1.10.2.1 2021/05/18 23:30:56 thorpej Exp $");
 
 #include "locators.h"
 
@@ -124,7 +124,6 @@ auspi_attach(device_t parent, device_t s
 {
        struct auspi_softc *sc = device_private(self);
        struct aupsc_attach_args *aa = aux;
-       struct spibus_attach_args sba;
        const struct auspi_machdep *md;
 
        sc->sc_dev = self;
@@ -147,9 +146,6 @@ auspi_attach(device_t parent, device_t s
        /* fix this! */
        sc->sc_spi.sct_nslaves = sc->sc_md.am_nslaves;
 
-       memset(&sba, 0, sizeof(sba));
-       sba.sba_controller = &sc->sc_spi;
-
        /* enable SPI mode */
        sc->sc_psc.psc_enable(sc, AUPSC_SEL_SPI);
 
@@ -163,7 +159,12 @@ auspi_attach(device_t parent, device_t s
        sc->sc_ih = au_intr_establish(aa->aupsc_irq, 0, IPL_BIO, IST_LEVEL,
            auspi_intr, sc);
 
-       config_found(self, &sba, spibus_print, CFARG_EOL);
+       struct spibus_attach_args sba = {
+               .sba_controller = &sc->sc_spi,
+       };
+       config_found(self, &sba, spibus_print,
+           CFARG_DEVHANDLE, device_handle(self),
+           CFARG_EOL);
 }
 
 int
diff -r 9c7759f4fa64 -r 87423d810603 sys/arch/mips/atheros/dev/arspi.c
--- a/sys/arch/mips/atheros/dev/arspi.c Tue May 18 23:26:46 2021 +0000
+++ b/sys/arch/mips/atheros/dev/arspi.c Tue May 18 23:30:55 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arspi.c,v 1.14 2021/04/24 23:36:42 thorpej Exp $ */
+/* $NetBSD: arspi.c,v 1.14.2.1 2021/05/18 23:30:56 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arspi.c,v 1.14 2021/04/24 23:36:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arspi.c,v 1.14.2.1 2021/05/18 23:30:56 thorpej Exp $");
 
 #include "locators.h"
 
@@ -146,7 +146,6 @@ void
 arspi_attach(device_t parent, device_t self, void *aux)
 {
        struct arspi_softc *sc = device_private(self);
-       struct spibus_attach_args sba;
        struct arbus_attach_args *aa = aux;
 
        /*
@@ -191,9 +190,12 @@ arspi_attach(device_t parent, device_t s
        /*
         * Initialize and attach bus attach.
         */
-       memset(&sba, 0, sizeof(sba));
-       sba.sba_controller = &sc->sc_spi;
-       config_found(self, &sba, spibus_print, CFARG_EOL);
+       struct spibus_attach_args sba = {
+               .sba_controller = &sc->sc_spi,
+       };
+       config_found(self, &sba, spibus_print,
+           CFARG_DEVHANDLE, device_handle(self),
+           CFARG_EOL);
 }
 
 void
diff -r 9c7759f4fa64 -r 87423d810603 sys/dev/marvell/mvspi.c
--- a/sys/dev/marvell/mvspi.c   Tue May 18 23:26:46 2021 +0000
+++ b/sys/dev/marvell/mvspi.c   Tue May 18 23:30:55 2021 +0000
@@ -105,7 +105,6 @@ mvspi_attach(struct device *parent, stru
 {
        struct mvspi_softc *sc =  device_private(self);
        struct marvell_attach_args *mva = aux;
-       struct spibus_attach_args sba;
        int ctl;
 
        aprint_normal(": Marvell SPI controller\n");
@@ -148,9 +147,12 @@ mvspi_attach(struct device *parent, stru
        /*
         * Initialize and attach bus attach.
         */
-       memset(&sba, 0, sizeof(sba));
-       sba.sba_controller = &sc->sc_spi;
-       config_found(self, &sba, spibus_print, CFARG_EOL);
+       struct spibus_attach_args sba = {
+               .sba_controller = &sc->sc_spi,
+       };
+       config_found(self, &sba, spibus_print,
+           CFARG_DEVHANDLE, device_handle(self),
+           CFARG_EOL);
 }
     
 int



Home | Main Index | Thread Index | Old Index