Module Name: src
Committed By: thorpej
Date: Tue May 18 23:30:56 UTC 2021
Modified Files:
src/sys/arch/arm/at91 [thorpej-i2c-spi-conf]: at91spi.c
src/sys/arch/arm/broadcom [thorpej-i2c-spi-conf]: bcm2835_spi.c
src/sys/arch/arm/imx [thorpej-i2c-spi-conf]: imxspi.c
src/sys/arch/arm/sunxi [thorpej-i2c-spi-conf]: sun6i_spi.c
src/sys/arch/mips/alchemy/dev [thorpej-i2c-spi-conf]: auspi.c
src/sys/arch/mips/atheros/dev [thorpej-i2c-spi-conf]: arspi.c
src/sys/dev/marvell [thorpej-i2c-spi-conf]: mvspi.c
Log Message:
Pass the controller devhandle along to the "spi" instance.
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/at91/at91spi.c
cvs rdiff -u -r1.10 -r1.10.2.1 src/sys/arch/arm/broadcom/bcm2835_spi.c
cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/arch/arm/imx/imxspi.c
cvs rdiff -u -r1.9 -r1.9.2.1 src/sys/arch/arm/sunxi/sun6i_spi.c
cvs rdiff -u -r1.10 -r1.10.2.1 src/sys/arch/mips/alchemy/dev/auspi.c
cvs rdiff -u -r1.14 -r1.14.2.1 src/sys/arch/mips/atheros/dev/arspi.c
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/dev/marvell/mvspi.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/at91/at91spi.c
diff -u src/sys/arch/arm/at91/at91spi.c:1.6 src/sys/arch/arm/at91/at91spi.c:1.6.2.1
--- src/sys/arch/arm/at91/at91spi.c:1.6 Sat Apr 24 23:36:26 2021
+++ src/sys/arch/arm/at91/at91spi.c Tue May 18 23:30:55 2021
@@ -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
Index: src/sys/arch/arm/broadcom/bcm2835_spi.c
diff -u src/sys/arch/arm/broadcom/bcm2835_spi.c:1.10 src/sys/arch/arm/broadcom/bcm2835_spi.c:1.10.2.1
--- src/sys/arch/arm/broadcom/bcm2835_spi.c:1.10 Sat Apr 24 23:36:26 2021
+++ src/sys/arch/arm/broadcom/bcm2835_spi.c Tue May 18 23:30:55 2021
@@ -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
Index: src/sys/arch/arm/imx/imxspi.c
diff -u src/sys/arch/arm/imx/imxspi.c:1.8 src/sys/arch/arm/imx/imxspi.c:1.8.2.1
--- src/sys/arch/arm/imx/imxspi.c:1.8 Sat Apr 24 23:36:27 2021
+++ src/sys/arch/arm/imx/imxspi.c Tue May 18 23:30:55 2021
@@ -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;
Index: src/sys/arch/arm/sunxi/sun6i_spi.c
diff -u src/sys/arch/arm/sunxi/sun6i_spi.c:1.9 src/sys/arch/arm/sunxi/sun6i_spi.c:1.9.2.1
--- src/sys/arch/arm/sunxi/sun6i_spi.c:1.9 Sat Apr 24 23:36:28 2021
+++ src/sys/arch/arm/sunxi/sun6i_spi.c Tue May 18 23:30:56 2021
@@ -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
Index: src/sys/arch/mips/alchemy/dev/auspi.c
diff -u src/sys/arch/mips/alchemy/dev/auspi.c:1.10 src/sys/arch/mips/alchemy/dev/auspi.c:1.10.2.1
--- src/sys/arch/mips/alchemy/dev/auspi.c:1.10 Sat Apr 24 23:36:42 2021
+++ src/sys/arch/mips/alchemy/dev/auspi.c Tue May 18 23:30:56 2021
@@ -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
Index: src/sys/arch/mips/atheros/dev/arspi.c
diff -u src/sys/arch/mips/atheros/dev/arspi.c:1.14 src/sys/arch/mips/atheros/dev/arspi.c:1.14.2.1
--- src/sys/arch/mips/atheros/dev/arspi.c:1.14 Sat Apr 24 23:36:42 2021
+++ src/sys/arch/mips/atheros/dev/arspi.c Tue May 18 23:30:56 2021
@@ -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
Index: src/sys/dev/marvell/mvspi.c
diff -u src/sys/dev/marvell/mvspi.c:1.6 src/sys/dev/marvell/mvspi.c:1.6.2.1
--- src/sys/dev/marvell/mvspi.c:1.6 Sat Apr 24 23:36:56 2021
+++ src/sys/dev/marvell/mvspi.c Tue May 18 23:30:56 2021
@@ -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