aboutsummaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorSimon Glass2020-12-16 21:20:07 -0700
committerSimon Glass2020-12-18 20:32:21 -0700
commit8b85dfc675f12de8d04126c07f3c796965b990c2 (patch)
tree9b8d6df956b02734a1b910b0a4c072e1e80b672a /drivers/spi
parent0b2fa98aa5e5dbdac4f5e2b2f67a34cc34dcc6b8 (diff)
dm: Avoid accessing seq directly
At present various drivers etc. access the device's 'seq' member directly. This makes it harder to change the meaning of that member. Change access to go through a function instead. The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/altera_spi.c2
-rw-r--r--drivers/spi/cf_spi.c12
-rw-r--r--drivers/spi/fsl_dspi.c6
-rw-r--r--drivers/spi/fsl_espi.c2
-rw-r--r--drivers/spi/octeon_spi.c2
-rw-r--r--drivers/spi/pic32_spi.c4
-rw-r--r--drivers/spi/sandbox_spi.c2
-rw-r--r--drivers/spi/tegra114_spi.c2
-rw-r--r--drivers/spi/tegra20_sflash.c2
-rw-r--r--drivers/spi/tegra20_slink.c2
-rw-r--r--drivers/spi/tegra210_qspi.c2
-rw-r--r--drivers/spi/xilinx_spi.c2
-rw-r--r--drivers/spi/zynq_qspi.c2
-rw-r--r--drivers/spi/zynq_spi.c2
14 files changed, 22 insertions, 22 deletions
diff --git a/drivers/spi/altera_spi.c b/drivers/spi/altera_spi.c
index fd01c8e33ba..fadc9f39657 100644
--- a/drivers/spi/altera_spi.c
+++ b/drivers/spi/altera_spi.c
@@ -98,7 +98,7 @@ static int altera_spi_xfer(struct udevice *dev, unsigned int bitlen,
uint32_t reg, data, start;
debug("%s: bus:%i cs:%i bitlen:%i bytes:%i flags:%lx\n", __func__,
- bus->seq, slave_plat->cs, bitlen, bytes, flags);
+ dev_seq(bus), slave_plat->cs, bitlen, bytes, flags);
if (bitlen == 0)
goto done;
diff --git a/drivers/spi/cf_spi.c b/drivers/spi/cf_spi.c
index cc934d18a65..8adff63edc6 100644
--- a/drivers/spi/cf_spi.c
+++ b/drivers/spi/cf_spi.c
@@ -240,7 +240,7 @@ static int coldfire_spi_set_speed(struct udevice *bus, uint max_hz)
cfspi->baudrate = max_hz;
/* Read current setup */
- bus_setup = readl(&dspi->ctar[bus->seq]);
+ bus_setup = readl(&dspi->ctar[dev_seq(bus)]);
tmp = (prescaler[3] * scaler[15]);
/* Maximum and minimum baudrate it can handle */
@@ -294,7 +294,7 @@ static int coldfire_spi_set_speed(struct udevice *bus, uint max_hz)
bus_setup &= ~(DSPI_CTAR_PBR(0x03) | DSPI_CTAR_BR(0x0f));
bus_setup |= (DSPI_CTAR_PBR(best_i) | DSPI_CTAR_BR(best_j));
- writel(bus_setup, &dspi->ctar[bus->seq]);
+ writel(bus_setup, &dspi->ctar[dev_seq(bus)]);
return 0;
}
@@ -318,7 +318,7 @@ static int coldfire_spi_set_mode(struct udevice *bus, uint mode)
if (cfspi->mode & SPI_MODE_MOD) {
if ((cfspi->mode & SPI_MODE_XFER_SZ_MASK) == 0)
bus_setup |=
- readl(&dspi->ctar[bus->seq]) & MCF_FRM_SZ_16BIT;
+ readl(&dspi->ctar[dev_seq(bus)]) & MCF_FRM_SZ_16BIT;
else
bus_setup |=
((cfspi->mode & SPI_MODE_XFER_SZ_MASK) >> 1);
@@ -329,14 +329,14 @@ static int coldfire_spi_set_mode(struct udevice *bus, uint mode)
bus_setup |= (cfspi->mode & SPI_MODE_DLY_SCA_MASK) >> 4;
} else {
bus_setup |=
- (readl(&dspi->ctar[bus->seq]) & MCF_CTAR_MODE_MASK);
+ (readl(&dspi->ctar[dev_seq(bus)]) & MCF_CTAR_MODE_MASK);
}
cfspi->charbit =
- ((readl(&dspi->ctar[bus->seq]) & MCF_FRM_SZ_16BIT) ==
+ ((readl(&dspi->ctar[dev_seq(bus)]) & MCF_FRM_SZ_16BIT) ==
MCF_FRM_SZ_16BIT) ? 16 : 8;
- setbits_be32(&dspi->ctar[bus->seq], bus_setup);
+ setbits_be32(&dspi->ctar[dev_seq(bus)], bus_setup);
return 0;
}
diff --git a/drivers/spi/fsl_dspi.c b/drivers/spi/fsl_dspi.c
index fcaf2baecf3..c5e8e2a1cb4 100644
--- a/drivers/spi/fsl_dspi.c
+++ b/drivers/spi/fsl_dspi.c
@@ -511,7 +511,7 @@ static int fsl_dspi_probe(struct udevice *bus)
DSPI_MCR_CRXF | DSPI_MCR_CTXF;
fsl_dspi_init_mcr(priv, mcr_cfg_val);
- debug("%s probe done, bus-num %d.\n", bus->name, bus->seq);
+ debug("%s probe done, bus-num %d.\n", bus->name, dev_seq(bus));
return 0;
}
@@ -527,7 +527,7 @@ static int fsl_dspi_claim_bus(struct udevice *dev)
priv = dev_get_priv(bus);
/* processor special preparation work */
- cpu_dspi_claim_bus(bus->seq, slave_plat->cs);
+ cpu_dspi_claim_bus(dev_seq(bus), slave_plat->cs);
/* configure transfer mode */
fsl_dspi_cfg_ctar_mode(priv, slave_plat->cs, priv->mode);
@@ -559,7 +559,7 @@ static int fsl_dspi_release_bus(struct udevice *dev)
dspi_halt(priv, 1);
/* processor special release work */
- cpu_dspi_release_bus(bus->seq, slave_plat->cs);
+ cpu_dspi_release_bus(dev_seq(bus), slave_plat->cs);
return 0;
}
diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c
index 8545461ed72..e9e7ffd6b53 100644
--- a/drivers/spi/fsl_espi.c
+++ b/drivers/spi/fsl_espi.c
@@ -527,7 +527,7 @@ static int fsl_espi_probe(struct udevice *bus)
fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
fsl->speed_hz = plat->speed_hz;
- debug("%s probe done, bus-num %d.\n", bus->name, bus->seq);
+ debug("%s probe done, bus-num %d.\n", bus->name, dev_seq(bus));
return 0;
}
diff --git a/drivers/spi/octeon_spi.c b/drivers/spi/octeon_spi.c
index 6e02a99c9b3..6ac66d2f9a2 100644
--- a/drivers/spi/octeon_spi.c
+++ b/drivers/spi/octeon_spi.c
@@ -593,7 +593,7 @@ static int octeon_spi_probe(struct udevice *dev)
if (ret)
return ret;
- debug("SPI bus %s %d at %p\n", dev->name, dev->seq, priv->base);
+ debug("SPI bus %s %d at %p\n", dev->name, dev_seq(dev), priv->base);
return 0;
}
diff --git a/drivers/spi/pic32_spi.c b/drivers/spi/pic32_spi.c
index cd83c113045..34d7d3e2ac3 100644
--- a/drivers/spi/pic32_spi.c
+++ b/drivers/spi/pic32_spi.c
@@ -247,7 +247,7 @@ static int pic32_spi_xfer(struct udevice *slave, unsigned int bitlen,
slave_plat = dev_get_parent_plat(slave);
debug("spi_xfer: bus:%i cs:%i flags:%lx\n",
- bus->seq, slave_plat->cs, flags);
+ dev_seq(bus), slave_plat->cs, flags);
debug("msg tx %p, rx %p submitted of %d byte(s)\n",
tx_buf, rx_buf, len);
@@ -384,7 +384,7 @@ static int pic32_spi_probe(struct udevice *bus)
fdt_size_t size;
int ret;
- debug("%s: %d, bus: %i\n", __func__, __LINE__, bus->seq);
+ debug("%s: %d, bus: %i\n", __func__, __LINE__, dev_seq(bus));
addr = fdtdec_get_addr_size(gd->fdt_blob, node, "reg", &size);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;
diff --git a/drivers/spi/sandbox_spi.c b/drivers/spi/sandbox_spi.c
index 755f1768614..3c780bae71b 100644
--- a/drivers/spi/sandbox_spi.c
+++ b/drivers/spi/sandbox_spi.c
@@ -72,7 +72,7 @@ static int sandbox_spi_xfer(struct udevice *slave, unsigned int bitlen,
return -EINVAL;
}
- busnum = bus->seq;
+ busnum = dev_seq(bus);
cs = spi_chip_select(slave);
if (busnum >= CONFIG_SANDBOX_SPI_MAX_BUS ||
cs >= CONFIG_SANDBOX_SPI_MAX_CS) {
diff --git a/drivers/spi/tegra114_spi.c b/drivers/spi/tegra114_spi.c
index 2bfa2624e10..e1fd82bdfa3 100644
--- a/drivers/spi/tegra114_spi.c
+++ b/drivers/spi/tegra114_spi.c
@@ -231,7 +231,7 @@ static int tegra114_spi_xfer(struct udevice *dev, unsigned int bitlen,
int ret;
debug("%s: slave %u:%u dout %p din %p bitlen %u\n",
- __func__, bus->seq, spi_chip_select(dev), dout, din, bitlen);
+ __func__, dev_seq(bus), spi_chip_select(dev), dout, din, bitlen);
if (bitlen % 8)
return -1;
num_bytes = bitlen / 8;
diff --git a/drivers/spi/tegra20_sflash.c b/drivers/spi/tegra20_sflash.c
index ad19a4efbb7..d38606100d0 100644
--- a/drivers/spi/tegra20_sflash.c
+++ b/drivers/spi/tegra20_sflash.c
@@ -217,7 +217,7 @@ static int tegra20_sflash_xfer(struct udevice *dev, unsigned int bitlen,
int ret;
debug("%s: slave %u:%u dout %p din %p bitlen %u\n",
- __func__, bus->seq, spi_chip_select(dev), dout, din, bitlen);
+ __func__, dev_seq(bus), spi_chip_select(dev), dout, din, bitlen);
if (bitlen % 8)
return -1;
num_bytes = bitlen / 8;
diff --git a/drivers/spi/tegra20_slink.c b/drivers/spi/tegra20_slink.c
index 57994d24de2..b99ef38a143 100644
--- a/drivers/spi/tegra20_slink.c
+++ b/drivers/spi/tegra20_slink.c
@@ -211,7 +211,7 @@ static int tegra30_spi_xfer(struct udevice *dev, unsigned int bitlen,
int ret;
debug("%s: slave %u:%u dout %p din %p bitlen %u\n",
- __func__, bus->seq, spi_chip_select(dev), dout, din, bitlen);
+ __func__, dev_seq(bus), spi_chip_select(dev), dout, din, bitlen);
if (bitlen % 8)
return -1;
num_bytes = bitlen / 8;
diff --git a/drivers/spi/tegra210_qspi.c b/drivers/spi/tegra210_qspi.c
index 2baa2ce0e9f..a2a7f4614cb 100644
--- a/drivers/spi/tegra210_qspi.c
+++ b/drivers/spi/tegra210_qspi.c
@@ -223,7 +223,7 @@ static int tegra210_qspi_xfer(struct udevice *dev, unsigned int bitlen,
int num_bytes, tm, ret;
debug("%s: slave %u:%u dout %p din %p bitlen %u\n",
- __func__, bus->seq, spi_chip_select(dev), dout, din, bitlen);
+ __func__, dev_seq(bus), spi_chip_select(dev), dout, din, bitlen);
if (bitlen % 8)
return -1;
num_bytes = bitlen / 8;
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index b32cdac5c3c..0274afdc6e0 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -255,7 +255,7 @@ static int xilinx_spi_xfer(struct udevice *dev, unsigned int bitlen,
int ret;
debug("spi_xfer: bus:%i cs:%i bitlen:%i bytes:%i flags:%lx\n",
- bus->seq, slave_plat->cs, bitlen, bytes, flags);
+ dev_seq(bus), slave_plat->cs, bitlen, bytes, flags);
if (bitlen == 0)
goto done;
diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c
index c2ae4e935e8..2fc28b6bee2 100644
--- a/drivers/spi/zynq_qspi.c
+++ b/drivers/spi/zynq_qspi.c
@@ -568,7 +568,7 @@ static int zynq_qspi_xfer(struct udevice *dev, unsigned int bitlen,
priv->len = bitlen / 8;
debug("zynq_qspi_xfer: bus:%i cs:%i bitlen:%i len:%i flags:%lx\n",
- bus->seq, slave_plat->cs, bitlen, priv->len, flags);
+ dev_seq(bus), slave_plat->cs, bitlen, priv->len, flags);
/*
* Festering sore.
diff --git a/drivers/spi/zynq_spi.c b/drivers/spi/zynq_spi.c
index 281db4541fd..a6efa4a1c83 100644
--- a/drivers/spi/zynq_spi.c
+++ b/drivers/spi/zynq_spi.c
@@ -242,7 +242,7 @@ static int zynq_spi_xfer(struct udevice *dev, unsigned int bitlen,
u32 ts, status;
debug("spi_xfer: bus:%i cs:%i bitlen:%i len:%i flags:%lx\n",
- bus->seq, slave_plat->cs, bitlen, len, flags);
+ dev_seq(bus), slave_plat->cs, bitlen, len, flags);
if (bitlen % 8) {
debug("spi_xfer: Non byte aligned SPI transfer\n");