svn commit: r310158 - in stable/11/sys: arm/lpc mips/atheros mips/mediatek mips/rt305x
Emmanuel Vadot
manu at FreeBSD.org
Fri Dec 16 15:45:11 UTC 2016
Author: manu
Date: Fri Dec 16 15:45:09 2016
New Revision: 310158
URL: https://svnweb.freebsd.org/changeset/base/310158
Log:
MFC r309935:
Use the spibus accessor when applicable.
Modified:
stable/11/sys/arm/lpc/lpc_spi.c
stable/11/sys/mips/atheros/ar71xx_spi.c
stable/11/sys/mips/mediatek/mtk_spi_v1.c
stable/11/sys/mips/mediatek/mtk_spi_v2.c
stable/11/sys/mips/rt305x/rt305x_spi.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/arm/lpc/lpc_spi.c
==============================================================================
--- stable/11/sys/arm/lpc/lpc_spi.c Fri Dec 16 15:37:18 2016 (r310157)
+++ stable/11/sys/arm/lpc/lpc_spi.c Fri Dec 16 15:45:09 2016 (r310158)
@@ -141,12 +141,14 @@ static int
lpc_spi_transfer(device_t dev, device_t child, struct spi_command *cmd)
{
struct lpc_spi_softc *sc = device_get_softc(dev);
- struct spibus_ivar *devi = SPIBUS_IVAR(child);
+ uint32_t cs;
uint8_t *in_buf, *out_buf;
int i;
+ spibus_get_cs(child, &cs);
+
/* Set CS active */
- lpc_gpio_set_state(child, devi->cs, 0);
+ lpc_gpio_set_state(child, cs, 0);
/* Wait for FIFO to be ready */
while ((lpc_spi_read_4(sc, LPC_SSP_SR) & LPC_SSP_SR_TNF) == 0);
@@ -168,7 +170,7 @@ lpc_spi_transfer(device_t dev, device_t
}
/* Set CS inactive */
- lpc_gpio_set_state(child, devi->cs, 1);
+ lpc_gpio_set_state(child, cs, 1);
return (0);
}
Modified: stable/11/sys/mips/atheros/ar71xx_spi.c
==============================================================================
--- stable/11/sys/mips/atheros/ar71xx_spi.c Fri Dec 16 15:37:18 2016 (r310157)
+++ stable/11/sys/mips/atheros/ar71xx_spi.c Fri Dec 16 15:45:09 2016 (r310158)
@@ -204,13 +204,15 @@ static int
ar71xx_spi_transfer(device_t dev, device_t child, struct spi_command *cmd)
{
struct ar71xx_spi_softc *sc;
+ uint32_t cs;
uint8_t *buf_in, *buf_out;
- struct spibus_ivar *devi = SPIBUS_IVAR(child);
int i;
sc = device_get_softc(dev);
- ar71xx_spi_chip_activate(sc, devi->cs);
+ spibus_get_cs(child, &cs);
+
+ ar71xx_spi_chip_activate(sc, cs);
KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz,
("TX/RX command sizes should be equal"));
@@ -223,7 +225,7 @@ ar71xx_spi_transfer(device_t dev, device
buf_out = (uint8_t *)cmd->tx_cmd;
buf_in = (uint8_t *)cmd->rx_cmd;
for (i = 0; i < cmd->tx_cmd_sz; i++)
- buf_in[i] = ar71xx_spi_txrx(sc, devi->cs, buf_out[i]);
+ buf_in[i] = ar71xx_spi_txrx(sc, cs, buf_out[i]);
/*
* Receive/transmit data (depends on command)
@@ -231,9 +233,9 @@ ar71xx_spi_transfer(device_t dev, device
buf_out = (uint8_t *)cmd->tx_data;
buf_in = (uint8_t *)cmd->rx_data;
for (i = 0; i < cmd->tx_data_sz; i++)
- buf_in[i] = ar71xx_spi_txrx(sc, devi->cs, buf_out[i]);
+ buf_in[i] = ar71xx_spi_txrx(sc, cs, buf_out[i]);
- ar71xx_spi_chip_deactivate(sc, devi->cs);
+ ar71xx_spi_chip_deactivate(sc, cs);
return (0);
}
Modified: stable/11/sys/mips/mediatek/mtk_spi_v1.c
==============================================================================
--- stable/11/sys/mips/mediatek/mtk_spi_v1.c Fri Dec 16 15:37:18 2016 (r310157)
+++ stable/11/sys/mips/mediatek/mtk_spi_v1.c Fri Dec 16 15:45:09 2016 (r310158)
@@ -224,12 +224,14 @@ mtk_spi_transfer(device_t dev, device_t
{
struct mtk_spi_softc *sc;
uint8_t *buf, byte, *tx_buf;
- struct spibus_ivar *devi = SPIBUS_IVAR(child);
+ uint32_t cs;
int i, sz, error = 0, write = 0;
sc = device_get_softc(dev);
- if (devi->cs != 0)
+ spibus_get_cs(child, &cs);
+
+ if (cs != 0)
/* Only 1 CS */
return (ENXIO);
Modified: stable/11/sys/mips/mediatek/mtk_spi_v2.c
==============================================================================
--- stable/11/sys/mips/mediatek/mtk_spi_v2.c Fri Dec 16 15:37:18 2016 (r310157)
+++ stable/11/sys/mips/mediatek/mtk_spi_v2.c Fri Dec 16 15:45:09 2016 (r310158)
@@ -229,12 +229,14 @@ mtk_spi_transfer(device_t dev, device_t
{
struct mtk_spi_softc *sc;
uint8_t *buf, byte, *tx_buf;
- struct spibus_ivar *devi = SPIBUS_IVAR(child);
+ uint32_t cs;
int i, sz, error, write = 0;
sc = device_get_softc(dev);
- if (devi->cs != 0)
+ spibus_get_cs(child, &cs);
+
+ if (cs != 0)
/* Only 1 CS */
return (ENXIO);
Modified: stable/11/sys/mips/rt305x/rt305x_spi.c
==============================================================================
--- stable/11/sys/mips/rt305x/rt305x_spi.c Fri Dec 16 15:37:18 2016 (r310157)
+++ stable/11/sys/mips/rt305x/rt305x_spi.c Fri Dec 16 15:45:09 2016 (r310158)
@@ -218,13 +218,15 @@ static int
rt305x_spi_transfer(device_t dev, device_t child, struct spi_command *cmd)
{
struct rt305x_spi_softc *sc;
+ uint32_t cs;
uint8_t *buf, byte, *tx_buf;
- struct spibus_ivar *devi = SPIBUS_IVAR(child);
int i, sz, error = 0, write = 0;
sc = device_get_softc(dev);
- if (devi->cs != 0)
+ spibus_get_cs(child, &cs);
+
+ if (cs != 0)
/* Only 1 CS */
return (ENXIO);
More information about the svn-src-stable
mailing list