aboutsummaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/altera_spi.c18
-rw-r--r--drivers/spi/atcspi200_spi.c8
-rw-r--r--drivers/spi/ath79_spi.c4
-rw-r--r--drivers/spi/atmel-quadspi.c2
-rw-r--r--drivers/spi/atmel_spi.c20
-rw-r--r--drivers/spi/bcm63xx_hsspi.c8
-rw-r--r--drivers/spi/bcm63xx_spi.c8
-rw-r--r--drivers/spi/bcmstb_spi.c14
-rw-r--r--drivers/spi/cadence_qspi.c20
-rw-r--r--drivers/spi/cadence_qspi.h12
-rw-r--r--drivers/spi/cadence_qspi_apb.c18
-rw-r--r--drivers/spi/cf_spi.c34
-rw-r--r--drivers/spi/davinci_spi.c18
-rw-r--r--drivers/spi/designware_spi.c16
-rw-r--r--drivers/spi/exynos_spi.c20
-rw-r--r--drivers/spi/fsl_dspi.c46
-rw-r--r--drivers/spi/fsl_espi.c16
-rw-r--r--drivers/spi/fsl_qspi.c8
-rw-r--r--drivers/spi/ich.c47
-rw-r--r--drivers/spi/ich.h11
-rw-r--r--drivers/spi/kirkwood_spi.c24
-rw-r--r--drivers/spi/meson_spifc.c2
-rw-r--r--drivers/spi/mpc8xxx_spi.c22
-rw-r--r--drivers/spi/mscc_bb_spi.c4
-rw-r--r--drivers/spi/mt7621_spi.c2
-rw-r--r--drivers/spi/mtk_snfi_spi.c2
-rw-r--r--drivers/spi/mvebu_a3700_spi.c24
-rw-r--r--drivers/spi/mxc_spi.c16
-rw-r--r--drivers/spi/mxs_spi.c16
-rw-r--r--drivers/spi/nxp_fspi.c8
-rw-r--r--drivers/spi/octeon_spi.c6
-rw-r--r--drivers/spi/omap3_spi.c16
-rw-r--r--drivers/spi/pic32_spi.c10
-rw-r--r--drivers/spi/pl022_spi.c12
-rw-r--r--drivers/spi/renesas_rpc_spi.c14
-rw-r--r--drivers/spi/rk_spi.c29
-rw-r--r--drivers/spi/sandbox_spi.c60
-rw-r--r--drivers/spi/sh_qspi.c12
-rw-r--r--drivers/spi/soft_spi.c24
-rw-r--r--drivers/spi/spi-qup.c4
-rw-r--r--drivers/spi/spi-sifive.c10
-rw-r--r--drivers/spi/spi-sunxi.c18
-rw-r--r--drivers/spi/spi-uclass.c50
-rw-r--r--drivers/spi/stm32_qspi.c4
-rw-r--r--drivers/spi/stm32_spi.c6
-rw-r--r--drivers/spi/tegra114_spi.c20
-rw-r--r--drivers/spi/tegra20_sflash.c20
-rw-r--r--drivers/spi/tegra20_slink.c20
-rw-r--r--drivers/spi/tegra210_qspi.c22
-rw-r--r--drivers/spi/tegra_spi.h2
-rw-r--r--drivers/spi/ti_qspi.c16
-rw-r--r--drivers/spi/uniphier_spi.c20
-rw-r--r--drivers/spi/xilinx_spi.c8
-rw-r--r--drivers/spi/zynq_qspi.c20
-rw-r--r--drivers/spi/zynq_spi.c24
-rw-r--r--drivers/spi/zynqmp_gqspi.c24
56 files changed, 483 insertions, 456 deletions
diff --git a/drivers/spi/altera_spi.c b/drivers/spi/altera_spi.c
index 61372c5..fadc9f3 100644
--- a/drivers/spi/altera_spi.c
+++ b/drivers/spi/altera_spi.c
@@ -32,7 +32,7 @@ struct altera_spi_regs {
u32 slave_sel;
};
-struct altera_spi_platdata {
+struct altera_spi_plat {
struct altera_spi_regs *regs;
};
@@ -89,7 +89,7 @@ static int altera_spi_xfer(struct udevice *dev, unsigned int bitlen,
struct udevice *bus = dev->parent;
struct altera_spi_priv *priv = dev_get_priv(bus);
struct altera_spi_regs *const regs = priv->regs;
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
/* assume spi core configured to do 8 bit transfers */
unsigned int bytes = bitlen / 8;
@@ -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;
@@ -161,7 +161,7 @@ static int altera_spi_set_mode(struct udevice *bus, uint mode)
static int altera_spi_probe(struct udevice *bus)
{
- struct altera_spi_platdata *plat = dev_get_platdata(bus);
+ struct altera_spi_plat *plat = dev_get_plat(bus);
struct altera_spi_priv *priv = dev_get_priv(bus);
priv->regs = plat->regs;
@@ -169,9 +169,9 @@ static int altera_spi_probe(struct udevice *bus)
return 0;
}
-static int altera_spi_ofdata_to_platdata(struct udevice *bus)
+static int altera_spi_of_to_plat(struct udevice *bus)
{
- struct altera_spi_platdata *plat = dev_get_platdata(bus);
+ struct altera_spi_plat *plat = dev_get_plat(bus);
plat->regs = map_physmem(dev_read_addr(bus),
sizeof(struct altera_spi_regs),
@@ -202,8 +202,8 @@ U_BOOT_DRIVER(altera_spi) = {
.id = UCLASS_SPI,
.of_match = altera_spi_ids,
.ops = &altera_spi_ops,
- .ofdata_to_platdata = altera_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct altera_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct altera_spi_priv),
+ .of_to_plat = altera_spi_of_to_plat,
+ .plat_auto = sizeof(struct altera_spi_plat),
+ .priv_auto = sizeof(struct altera_spi_priv),
.probe = altera_spi_probe,
};
diff --git a/drivers/spi/atcspi200_spi.c b/drivers/spi/atcspi200_spi.c
index 39c6e22..0f05158 100644
--- a/drivers/spi/atcspi200_spi.c
+++ b/drivers/spi/atcspi200_spi.c
@@ -309,8 +309,8 @@ static int atcspi200_spi_set_mode(struct udevice *bus, uint mode)
static int atcspi200_spi_claim_bus(struct udevice *dev)
{
- struct dm_spi_slave_platdata *slave_plat =
- dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat =
+ dev_get_parent_plat(dev);
struct udevice *bus = dev->parent;
struct nds_spi_slave *ns = dev_get_priv(bus);
@@ -408,7 +408,7 @@ U_BOOT_DRIVER(atcspi200_spi) = {
.id = UCLASS_SPI,
.of_match = atcspi200_spi_ids,
.ops = &atcspi200_spi_ops,
- .ofdata_to_platdata = atcspi200_ofdata_to_platadata,
- .priv_auto_alloc_size = sizeof(struct nds_spi_slave),
+ .of_to_plat = atcspi200_ofdata_to_platadata,
+ .priv_auto = sizeof(struct nds_spi_slave),
.probe = atcspi200_spi_probe,
};
diff --git a/drivers/spi/ath79_spi.c b/drivers/spi/ath79_spi.c
index 70bedc7..205567e 100644
--- a/drivers/spi/ath79_spi.c
+++ b/drivers/spi/ath79_spi.c
@@ -59,7 +59,7 @@ static int ath79_spi_xfer(struct udevice *dev, unsigned int bitlen,
{
struct udevice *bus = dev_get_parent(dev);
struct ath79_spi_priv *priv = dev_get_priv(bus);
- struct dm_spi_slave_platdata *slave = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave = dev_get_parent_plat(dev);
u8 *rx = din;
const u8 *tx = dout;
u8 curbyte, curbitlen, restbits;
@@ -224,6 +224,6 @@ U_BOOT_DRIVER(ath79_spi) = {
.id = UCLASS_SPI,
.of_match = ath79_spi_ids,
.ops = &ath79_spi_ops,
- .priv_auto_alloc_size = sizeof(struct ath79_spi_priv),
+ .priv_auto = sizeof(struct ath79_spi_priv),
.probe = ath79_spi_probe,
};
diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c
index 9320a8b..b1a3aa9 100644
--- a/drivers/spi/atmel-quadspi.c
+++ b/drivers/spi/atmel-quadspi.c
@@ -624,6 +624,6 @@ U_BOOT_DRIVER(atmel_qspi) = {
.id = UCLASS_SPI,
.of_match = atmel_qspi_ids,
.ops = &atmel_qspi_ops,
- .priv_auto_alloc_size = sizeof(struct atmel_qspi),
+ .priv_auto = sizeof(struct atmel_qspi),
.probe = atmel_qspi_probe,
};
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index c65733c..702e225 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -105,7 +105,7 @@
#define spi_writel(as, reg, value) \
writel(value, as->regs + ATMEL_SPI_##reg)
-struct atmel_spi_platdata {
+struct atmel_spi_plat {
struct at91_spi *regs;
};
@@ -121,9 +121,9 @@ struct atmel_spi_priv {
static int atmel_spi_claim_bus(struct udevice *dev)
{
struct udevice *bus = dev_get_parent(dev);
- struct atmel_spi_platdata *bus_plat = dev_get_platdata(bus);
+ struct atmel_spi_plat *bus_plat = dev_get_plat(bus);
struct atmel_spi_priv *priv = dev_get_priv(bus);
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
struct at91_spi *reg_base = bus_plat->regs;
u32 cs = slave_plat->cs;
u32 freq = priv->freq;
@@ -161,7 +161,7 @@ static int atmel_spi_claim_bus(struct udevice *dev)
static int atmel_spi_release_bus(struct udevice *dev)
{
struct udevice *bus = dev_get_parent(dev);
- struct atmel_spi_platdata *bus_plat = dev_get_platdata(bus);
+ struct atmel_spi_plat *bus_plat = dev_get_plat(bus);
writel(ATMEL_SPI_CR_SPIDIS, &bus_plat->regs->cr);
@@ -173,7 +173,7 @@ static void atmel_spi_cs_activate(struct udevice *dev)
#if CONFIG_IS_ENABLED(DM_GPIO)
struct udevice *bus = dev_get_parent(dev);
struct atmel_spi_priv *priv = dev_get_priv(bus);
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
u32 cs = slave_plat->cs;
if (!dm_gpio_is_valid(&priv->cs_gpios[cs]))
@@ -188,7 +188,7 @@ static void atmel_spi_cs_deactivate(struct udevice *dev)
#if CONFIG_IS_ENABLED(DM_GPIO)
struct udevice *bus = dev_get_parent(dev);
struct atmel_spi_priv *priv = dev_get_priv(bus);
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
u32 cs = slave_plat->cs;
if (!dm_gpio_is_valid(&priv->cs_gpios[cs]))
@@ -202,7 +202,7 @@ static int atmel_spi_xfer(struct udevice *dev, unsigned int bitlen,
const void *dout, void *din, unsigned long flags)
{
struct udevice *bus = dev_get_parent(dev);
- struct atmel_spi_platdata *bus_plat = dev_get_platdata(bus);
+ struct atmel_spi_plat *bus_plat = dev_get_plat(bus);
struct at91_spi *reg_base = bus_plat->regs;
u32 len_tx, len_rx, len;
@@ -344,7 +344,7 @@ static int atmel_spi_enable_clk(struct udevice *bus)
static int atmel_spi_probe(struct udevice *bus)
{
- struct atmel_spi_platdata *bus_plat = dev_get_platdata(bus);
+ struct atmel_spi_plat *bus_plat = dev_get_plat(bus);
int ret;
ret = atmel_spi_enable_clk(bus);
@@ -388,7 +388,7 @@ U_BOOT_DRIVER(atmel_spi) = {
.id = UCLASS_SPI,
.of_match = atmel_spi_ids,
.ops = &atmel_spi_ops,
- .platdata_auto_alloc_size = sizeof(struct atmel_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct atmel_spi_priv),
+ .plat_auto = sizeof(struct atmel_spi_plat),
+ .priv_auto = sizeof(struct atmel_spi_priv),
.probe = atmel_spi_probe,
};
diff --git a/drivers/spi/bcm63xx_hsspi.c b/drivers/spi/bcm63xx_hsspi.c
index f30a8a4..85108df 100644
--- a/drivers/spi/bcm63xx_hsspi.c
+++ b/drivers/spi/bcm63xx_hsspi.c
@@ -140,7 +140,7 @@ static int bcm63xx_hsspi_set_speed(struct udevice *bus, uint speed)
}
static void bcm63xx_hsspi_activate_cs(struct bcm63xx_hsspi_priv *priv,
- struct dm_spi_slave_platdata *plat)
+ struct dm_spi_slave_plat *plat)
{
uint32_t clr, set;
@@ -217,7 +217,7 @@ static int bcm63xx_hsspi_xfer(struct udevice *dev, unsigned int bitlen,
const void *dout, void *din, unsigned long flags)
{
struct bcm63xx_hsspi_priv *priv = dev_get_priv(dev->parent);
- struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev);
size_t data_bytes = bitlen / 8;
size_t step_size = HSSPI_FIFO_SIZE;
uint16_t opcode = 0;
@@ -316,7 +316,7 @@ static const struct udevice_id bcm63xx_hsspi_ids[] = {
static int bcm63xx_hsspi_child_pre_probe(struct udevice *dev)
{
struct bcm63xx_hsspi_priv *priv = dev_get_priv(dev->parent);
- struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev);
/* check cs */
if (plat->cs >= priv->num_cs) {
@@ -403,7 +403,7 @@ U_BOOT_DRIVER(bcm63xx_hsspi) = {
.id = UCLASS_SPI,
.of_match = bcm63xx_hsspi_ids,
.ops = &bcm63xx_hsspi_ops,
- .priv_auto_alloc_size = sizeof(struct bcm63xx_hsspi_priv),
+ .priv_auto = sizeof(struct bcm63xx_hsspi_priv),
.child_pre_probe = bcm63xx_hsspi_child_pre_probe,
.probe = bcm63xx_hsspi_probe,
};
diff --git a/drivers/spi/bcm63xx_spi.c b/drivers/spi/bcm63xx_spi.c
index acc1a49..dd5e62b 100644
--- a/drivers/spi/bcm63xx_spi.c
+++ b/drivers/spi/bcm63xx_spi.c
@@ -236,8 +236,8 @@ static int bcm63xx_spi_xfer(struct udevice *dev, unsigned int bitlen,
}
if (flags & SPI_XFER_END) {
- struct dm_spi_slave_platdata *plat =
- dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *plat =
+ dev_get_parent_plat(dev);
uint16_t val, cmd;
int ret;
@@ -351,7 +351,7 @@ static int bcm63xx_spi_child_pre_probe(struct udevice *dev)
struct bcm63xx_spi_priv *priv = dev_get_priv(dev->parent);
const unsigned long *regs = priv->regs;
struct spi_slave *slave = dev_get_parent_priv(dev);
- struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev);
/* check cs */
if (plat->cs >= priv->num_cs) {
@@ -422,7 +422,7 @@ U_BOOT_DRIVER(bcm63xx_spi) = {
.id = UCLASS_SPI,
.of_match = bcm63xx_spi_ids,
.ops = &bcm63xx_spi_ops,
- .priv_auto_alloc_size = sizeof(struct bcm63xx_spi_priv),
+ .priv_auto = sizeof(struct bcm63xx_spi_priv),
.child_pre_probe = bcm63xx_spi_child_pre_probe,
.probe = bcm63xx_spi_probe,
};
diff --git a/drivers/spi/bcmstb_spi.c b/drivers/spi/bcmstb_spi.c
index fb1dc46..dc4fdac 100644
--- a/drivers/spi/bcmstb_spi.c
+++ b/drivers/spi/bcmstb_spi.c
@@ -76,7 +76,7 @@ enum bcmstb_base_type {
BASE_LAST,
};
-struct bcmstb_spi_platdata {
+struct bcmstb_spi_plat {
void *base[4];
};
@@ -94,9 +94,9 @@ struct bcmstb_spi_priv {
void *saved_din_addr;
};
-static int bcmstb_spi_ofdata_to_platdata(struct udevice *bus)
+static int bcmstb_spi_of_to_plat(struct udevice *bus)
{
- struct bcmstb_spi_platdata *plat = dev_get_platdata(bus);
+ struct bcmstb_spi_plat *plat = dev_get_plat(bus);
const void *fdt = gd->fdt_blob;
int node = dev_of_offset(bus);
int ret = 0;
@@ -159,7 +159,7 @@ static void bcmstb_spi_clear_interrupt(void *base, u32 mask)
static int bcmstb_spi_probe(struct udevice *bus)
{
- struct bcmstb_spi_platdata *plat = dev_get_platdata(bus);
+ struct bcmstb_spi_plat *plat = dev_get_plat(bus);
struct bcmstb_spi_priv *priv = dev_get_priv(bus);
priv->regs = plat->base[HIF_MSPI];
@@ -432,8 +432,8 @@ U_BOOT_DRIVER(bcmstb_spi) = {
.id = UCLASS_SPI,
.of_match = bcmstb_spi_id,
.ops = &bcmstb_spi_ops,
- .ofdata_to_platdata = bcmstb_spi_ofdata_to_platdata,
+ .of_to_plat = bcmstb_spi_of_to_plat,
.probe = bcmstb_spi_probe,
- .platdata_auto_alloc_size = sizeof(struct bcmstb_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct bcmstb_spi_priv),
+ .plat_auto = sizeof(struct bcmstb_spi_plat),
+ .priv_auto = sizeof(struct bcmstb_spi_priv),
};
diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
index 1e85749..6798043 100644
--- a/drivers/spi/cadence_qspi.c
+++ b/drivers/spi/cadence_qspi.c
@@ -27,7 +27,7 @@
static int cadence_spi_write_speed(struct udevice *bus, uint hz)
{
- struct cadence_spi_platdata *plat = bus->platdata;
+ struct cadence_spi_plat *plat = dev_get_plat(bus);
struct cadence_spi_priv *priv = dev_get_priv(bus);
cadence_qspi_apb_config_baudrate_div(priv->regbase,
@@ -130,7 +130,7 @@ static int spi_calibration(struct udevice *bus, uint hz)
static int cadence_spi_set_speed(struct udevice *bus, uint hz)
{
- struct cadence_spi_platdata *plat = bus->platdata;
+ struct cadence_spi_plat *plat = dev_get_plat(bus);
struct cadence_spi_priv *priv = dev_get_priv(bus);
int err;
@@ -165,7 +165,7 @@ static int cadence_spi_set_speed(struct udevice *bus, uint hz)
static int cadence_spi_probe(struct udevice *bus)
{
- struct cadence_spi_platdata *plat = bus->platdata;
+ struct cadence_spi_plat *plat = dev_get_plat(bus);
struct cadence_spi_priv *priv = dev_get_priv(bus);
struct clk clk;
int ret;
@@ -212,7 +212,7 @@ static int cadence_spi_remove(struct udevice *dev)
static int cadence_spi_set_mode(struct udevice *bus, uint mode)
{
- struct cadence_spi_platdata *plat = bus->platdata;
+ struct cadence_spi_plat *plat = dev_get_plat(bus);
struct cadence_spi_priv *priv = dev_get_priv(bus);
/* Disable QSPI */
@@ -235,7 +235,7 @@ static int cadence_spi_mem_exec_op(struct spi_slave *spi,
const struct spi_mem_op *op)
{
struct udevice *bus = spi->dev->parent;
- struct cadence_spi_platdata *plat = bus->platdata;
+ struct cadence_spi_plat *plat = dev_get_plat(bus);
struct cadence_spi_priv *priv = dev_get_priv(bus);
void *base = priv->regbase;
int err = 0;
@@ -282,9 +282,9 @@ static int cadence_spi_mem_exec_op(struct spi_slave *spi,
return err;
}
-static int cadence_spi_ofdata_to_platdata(struct udevice *bus)
+static int cadence_spi_of_to_plat(struct udevice *bus)
{
- struct cadence_spi_platdata *plat = bus->platdata;
+ struct cadence_spi_plat *plat = dev_get_plat(bus);
ofnode subnode;
plat->regbase = (void *)devfdt_get_addr_index(bus, 0);
@@ -353,9 +353,9 @@ U_BOOT_DRIVER(cadence_spi) = {
.id = UCLASS_SPI,
.of_match = cadence_spi_ids,
.ops = &cadence_spi_ops,
- .ofdata_to_platdata = cadence_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct cadence_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct cadence_spi_priv),
+ .of_to_plat = cadence_spi_of_to_plat,
+ .plat_auto = sizeof(struct cadence_spi_plat),
+ .priv_auto = sizeof(struct cadence_spi_priv),
.probe = cadence_spi_probe,
.remove = cadence_spi_remove,
.flags = DM_FLAG_OS_PREPARE,
diff --git a/drivers/spi/cadence_qspi.h b/drivers/spi/cadence_qspi.h
index ae459c7..64c5867 100644
--- a/drivers/spi/cadence_qspi.h
+++ b/drivers/spi/cadence_qspi.h
@@ -15,7 +15,7 @@
#define CQSPI_DECODER_MAX_CS 16
#define CQSPI_READ_CAPTURE_MAX_DELAY 16
-struct cadence_spi_platdata {
+struct cadence_spi_plat {
unsigned int ref_clk_hz;
unsigned int max_hz;
void *regbase;
@@ -52,7 +52,7 @@ struct cadence_spi_priv {
};
/* Functions call declaration */
-void cadence_qspi_apb_controller_init(struct cadence_spi_platdata *plat);
+void cadence_qspi_apb_controller_init(struct cadence_spi_plat *plat);
void cadence_qspi_apb_controller_enable(void *reg_base_addr);
void cadence_qspi_apb_controller_disable(void *reg_base_addr);
void cadence_qspi_apb_dac_mode_enable(void *reg_base);
@@ -62,13 +62,13 @@ int cadence_qspi_apb_command_read(void *reg_base_addr,
int cadence_qspi_apb_command_write(void *reg_base_addr,
const struct spi_mem_op *op);
-int cadence_qspi_apb_read_setup(struct cadence_spi_platdata *plat,
+int cadence_qspi_apb_read_setup(struct cadence_spi_plat *plat,
const struct spi_mem_op *op);
-int cadence_qspi_apb_read_execute(struct cadence_spi_platdata *plat,
+int cadence_qspi_apb_read_execute(struct cadence_spi_plat *plat,
const struct spi_mem_op *op);
-int cadence_qspi_apb_write_setup(struct cadence_spi_platdata *plat,
+int cadence_qspi_apb_write_setup(struct cadence_spi_plat *plat,
const struct spi_mem_op *op);
-int cadence_qspi_apb_write_execute(struct cadence_spi_platdata *plat,
+int cadence_qspi_apb_write_execute(struct cadence_spi_plat *plat,
const struct spi_mem_op *op);
void cadence_qspi_apb_chipselect(void *reg_base,
diff --git a/drivers/spi/cadence_qspi_apb.c b/drivers/spi/cadence_qspi_apb.c
index f9675f7..b051f46 100644
--- a/drivers/spi/cadence_qspi_apb.c
+++ b/drivers/spi/cadence_qspi_apb.c
@@ -377,7 +377,7 @@ void cadence_qspi_apb_delay(void *reg_base,
cadence_qspi_apb_controller_enable(reg_base);
}
-void cadence_qspi_apb_controller_init(struct cadence_spi_platdata *plat)
+void cadence_qspi_apb_controller_init(struct cadence_spi_plat *plat)
{
unsigned reg;
@@ -526,7 +526,7 @@ int cadence_qspi_apb_command_write(void *reg_base, const struct spi_mem_op *op)
}
/* Opcode + Address (3/4 bytes) + dummy bytes (0-4 bytes) */
-int cadence_qspi_apb_read_setup(struct cadence_spi_platdata *plat,
+int cadence_qspi_apb_read_setup(struct cadence_spi_plat *plat,
const struct spi_mem_op *op)
{
unsigned int reg;
@@ -572,14 +572,14 @@ int cadence_qspi_apb_read_setup(struct cadence_spi_platdata *plat,
return 0;
}
-static u32 cadence_qspi_get_rd_sram_level(struct cadence_spi_platdata *plat)
+static u32 cadence_qspi_get_rd_sram_level(struct cadence_spi_plat *plat)
{
u32 reg = readl(plat->regbase + CQSPI_REG_SDRAMLEVEL);
reg >>= CQSPI_REG_SDRAMLEVEL_RD_LSB;
return reg & CQSPI_REG_SDRAMLEVEL_RD_MASK;
}
-static int cadence_qspi_wait_for_data(struct cadence_spi_platdata *plat)
+static int cadence_qspi_wait_for_data(struct cadence_spi_plat *plat)
{
unsigned int timeout = 10000;
u32 reg;
@@ -595,7 +595,7 @@ static int cadence_qspi_wait_for_data(struct cadence_spi_platdata *plat)
}
static int
-cadence_qspi_apb_indirect_read_execute(struct cadence_spi_platdata *plat,
+cadence_qspi_apb_indirect_read_execute(struct cadence_spi_plat *plat,
unsigned int n_rx, u8 *rxbuf)
{
unsigned int remaining = n_rx;
@@ -657,7 +657,7 @@ failrd:
return ret;
}
-int cadence_qspi_apb_read_execute(struct cadence_spi_platdata *plat,
+int cadence_qspi_apb_read_execute(struct cadence_spi_plat *plat,
const struct spi_mem_op *op)
{
u64 from = op->addr.val;
@@ -678,7 +678,7 @@ int cadence_qspi_apb_read_execute(struct cadence_spi_platdata *plat,
}
/* Opcode + Address (3/4 bytes) */
-int cadence_qspi_apb_write_setup(struct cadence_spi_platdata *plat,
+int cadence_qspi_apb_write_setup(struct cadence_spi_plat *plat,
const struct spi_mem_op *op)
{
unsigned int reg;
@@ -701,7 +701,7 @@ int cadence_qspi_apb_write_setup(struct cadence_spi_platdata *plat,
}
static int
-cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat,
+cadence_qspi_apb_indirect_write_execute(struct cadence_spi_plat *plat,
unsigned int n_tx, const u8 *txbuf)
{
unsigned int page_size = plat->page_size;
@@ -774,7 +774,7 @@ failwr:
return ret;
}
-int cadence_qspi_apb_write_execute(struct cadence_spi_platdata *plat,
+int cadence_qspi_apb_write_execute(struct cadence_spi_plat *plat,
const struct spi_mem_op *op)
{
u32 to = op->addr.val;
diff --git a/drivers/spi/cf_spi.c b/drivers/spi/cf_spi.c
index 8fa6d35..298f350 100644
--- a/drivers/spi/cf_spi.c
+++ b/drivers/spi/cf_spi.c
@@ -114,8 +114,8 @@ static int coldfire_spi_claim_bus(struct udevice *dev)
struct udevice *bus = dev->parent;
struct coldfire_spi_priv *cfspi = dev_get_priv(bus);
struct dspi *dspi = cfspi->regs;
- struct dm_spi_slave_platdata *slave_plat =
- dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat =
+ dev_get_parent_plat(dev);
if ((in_be32(&dspi->sr) & DSPI_SR_TXRXS) != DSPI_SR_TXRXS)
return -1;
@@ -133,8 +133,8 @@ static int coldfire_spi_release_bus(struct udevice *dev)
struct udevice *bus = dev->parent;
struct coldfire_spi_priv *cfspi = dev_get_priv(bus);
struct dspi *dspi = cfspi->regs;
- struct dm_spi_slave_platdata *slave_plat =
- dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat =
+ dev_get_parent_plat(dev);
/* Clear FIFO */
clrbits_be32(&dspi->mcr, DSPI_MCR_CTXF | DSPI_MCR_CRXF);
@@ -150,7 +150,7 @@ static int coldfire_spi_xfer(struct udevice *dev, unsigned int bitlen,
{
struct udevice *bus = dev_get_parent(dev);
struct coldfire_spi_priv *cfspi = dev_get_priv(bus);
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
u16 *spi_rd16 = NULL, *spi_wr16 = NULL;
u8 *spi_rd = NULL, *spi_wr = NULL;
static u32 ctrl;
@@ -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,21 +329,21 @@ 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;
}
static int coldfire_spi_probe(struct udevice *bus)
{
- struct coldfire_spi_platdata *plat = dev_get_platdata(bus);
+ struct coldfire_spi_plat *plat = dev_get_plat(bus);
struct coldfire_spi_priv *cfspi = dev_get_priv(bus);
struct dspi *dspi = cfspi->regs;
int i;
@@ -384,10 +384,10 @@ static int coldfire_spi_probe(struct udevice *bus)
}
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
-static int coldfire_dspi_ofdata_to_platdata(struct udevice *bus)
+static int coldfire_dspi_of_to_plat(struct udevice *bus)
{
fdt_addr_t addr;
- struct coldfire_spi_platdata *plat = bus->platdata;
+ struct coldfire_spi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
int *ctar, len;
@@ -451,10 +451,10 @@ U_BOOT_DRIVER(coldfire_spi) = {
.id = UCLASS_SPI,
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
.of_match = coldfire_spi_ids,
- .ofdata_to_platdata = coldfire_dspi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct coldfire_spi_platdata),
+ .of_to_plat = coldfire_dspi_of_to_plat,
+ .plat_auto = sizeof(struct coldfire_spi_plat),
#endif
.probe = coldfire_spi_probe,
.ops = &coldfire_spi_ops,
- .priv_auto_alloc_size = sizeof(struct coldfire_spi_priv),
+ .priv_auto = sizeof(struct coldfire_spi_priv),
};
diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c
index a11433d..53a791e 100644
--- a/drivers/spi/davinci_spi.c
+++ b/drivers/spi/davinci_spi.c
@@ -333,8 +333,8 @@ static int davinci_spi_set_mode(struct udevice *bus, uint mode)
static int davinci_spi_claim_bus(struct udevice *dev)
{
- struct dm_spi_slave_platdata *slave_plat =
- dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat =
+ dev_get_parent_plat(dev);
struct udevice *bus = dev->parent;
struct davinci_spi_slave *ds = dev_get_priv(bus);
@@ -358,8 +358,8 @@ static int davinci_spi_xfer(struct udevice *dev, unsigned int bitlen,
const void *dout, void *din,
unsigned long flags)
{
- struct dm_spi_slave_platdata *slave =
- dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave =
+ dev_get_parent_plat(dev);
struct udevice *bus = dev->parent;
struct davinci_spi_slave *ds = dev_get_priv(bus);
@@ -383,7 +383,7 @@ static const struct dm_spi_ops davinci_spi_ops = {
static int davinci_spi_probe(struct udevice *bus)
{
struct davinci_spi_slave *ds = dev_get_priv(bus);
- struct davinci_spi_platdata *plat = bus->platdata;
+ struct davinci_spi_plat *plat = dev_get_plat(bus);
ds->regs = plat->regs;
ds->num_cs = plat->num_cs;
@@ -393,7 +393,7 @@ static int davinci_spi_probe(struct udevice *bus)
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
static int davinci_ofdata_to_platadata(struct udevice *bus)
{
- struct davinci_spi_platdata *plat = bus->platdata;
+ struct davinci_spi_plat *plat = dev_get_plat(bus);
fdt_addr_t addr;
addr = dev_read_addr(bus);
@@ -419,10 +419,10 @@ U_BOOT_DRIVER(davinci_spi) = {
.id = UCLASS_SPI,
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
.of_match = davinci_spi_ids,
- .ofdata_to_platdata = davinci_ofdata_to_platadata,
- .platdata_auto_alloc_size = sizeof(struct davinci_spi_platdata),
+ .of_to_plat = davinci_ofdata_to_platadata,
+ .plat_auto = sizeof(struct davinci_spi_plat),
#endif
.probe = davinci_spi_probe,
.ops = &davinci_spi_ops,
- .priv_auto_alloc_size = sizeof(struct davinci_spi_slave),
+ .priv_auto = sizeof(struct davinci_spi_slave),
};
diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c
index ce74ac0..7421211 100644
--- a/drivers/spi/designware_spi.c
+++ b/drivers/spi/designware_spi.c
@@ -113,7 +113,7 @@
#define RX_TIMEOUT 1000 /* timeout in ms */
-struct dw_spi_platdata {
+struct dw_spi_plat {
s32 frequency; /* Default clock frequency, -1 for none */
void __iomem *regs;
};
@@ -228,9 +228,9 @@ static int request_gpio_cs(struct udevice *bus)
return 0;
}
-static int dw_spi_ofdata_to_platdata(struct udevice *bus)
+static int dw_spi_of_to_plat(struct udevice *bus)
{
- struct dw_spi_platdata *plat = bus->platdata;
+ struct dw_spi_plat *plat = dev_get_plat(bus);
plat->regs = dev_read_addr_ptr(bus);
if (!plat->regs)
@@ -342,7 +342,7 @@ typedef int (*dw_spi_init_t)(struct udevice *bus, struct dw_spi_priv *priv);
static int dw_spi_probe(struct udevice *bus)
{
dw_spi_init_t init = (dw_spi_init_t)dev_get_driver_data(bus);
- struct dw_spi_platdata *plat = dev_get_platdata(bus);
+ struct dw_spi_plat *plat = dev_get_plat(bus);
struct dw_spi_priv *priv = dev_get_priv(bus);
int ret;
u32 version;
@@ -665,7 +665,7 @@ static const struct spi_controller_mem_ops dw_spi_mem_ops = {
static int dw_spi_set_speed(struct udevice *bus, uint speed)
{
- struct dw_spi_platdata *plat = dev_get_platdata(bus);
+ struct dw_spi_plat *plat = dev_get_plat(bus);
struct dw_spi_priv *priv = dev_get_priv(bus);
u16 clk_div;
@@ -774,9 +774,9 @@ U_BOOT_DRIVER(dw_spi) = {
.id = UCLASS_SPI,
.of_match = dw_spi_ids,
.ops = &dw_spi_ops,
- .ofdata_to_platdata = dw_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct dw_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct dw_spi_priv),
+ .of_to_plat = dw_spi_of_to_plat,
+ .plat_auto = sizeof(struct dw_spi_plat),
+ .priv_auto = sizeof(struct dw_spi_priv),
.probe = dw_spi_probe,
.remove = dw_spi_remove,
};
diff --git a/drivers/spi/exynos_spi.c b/drivers/spi/exynos_spi.c
index d338ff5..30b1a77 100644
--- a/drivers/spi/exynos_spi.c
+++ b/drivers/spi/exynos_spi.c
@@ -23,7 +23,7 @@
DECLARE_GLOBAL_DATA_PTR;
-struct exynos_spi_platdata {
+struct exynos_spi_plat {
enum periph_id periph_id;
s32 frequency; /* Default clock frequency, -1 for none */
struct exynos_spi *regs;
@@ -213,7 +213,7 @@ static int spi_rx_tx(struct exynos_spi_priv *priv, int todo,
static void spi_cs_activate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct exynos_spi_platdata *pdata = dev_get_platdata(bus);
+ struct exynos_spi_plat *pdata = dev_get_plat(bus);
struct exynos_spi_priv *priv = dev_get_priv(bus);
/* If it's too soon to do another transaction, wait */
@@ -239,7 +239,7 @@ static void spi_cs_activate(struct udevice *dev)
static void spi_cs_deactivate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct exynos_spi_platdata *pdata = dev_get_platdata(bus);
+ struct exynos_spi_plat *pdata = dev_get_plat(bus);
struct exynos_spi_priv *priv = dev_get_priv(bus);
setbits_le32(&priv->regs->cs_reg, SPI_SLAVE_SIG_INACT);
@@ -251,9 +251,9 @@ static void spi_cs_deactivate(struct udevice *dev)
debug("Deactivate CS, bus '%s'\n", bus->name);
}
-static int exynos_spi_ofdata_to_platdata(struct udevice *bus)
+static int exynos_spi_of_to_plat(struct udevice *bus)
{
- struct exynos_spi_platdata *plat = bus->platdata;
+ struct exynos_spi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
@@ -280,7 +280,7 @@ static int exynos_spi_ofdata_to_platdata(struct udevice *bus)
static int exynos_spi_probe(struct udevice *bus)
{
- struct exynos_spi_platdata *plat = dev_get_platdata(bus);
+ struct exynos_spi_plat *plat = dev_get_plat(bus);
struct exynos_spi_priv *priv = dev_get_priv(bus);
priv->regs = plat->regs;
@@ -368,7 +368,7 @@ static int exynos_spi_xfer(struct udevice *dev, unsigned int bitlen,
static int exynos_spi_set_speed(struct udevice *bus, uint speed)
{
- struct exynos_spi_platdata *plat = bus->platdata;
+ struct exynos_spi_plat *plat = dev_get_plat(bus);
struct exynos_spi_priv *priv = dev_get_priv(bus);
int ret;
@@ -426,8 +426,8 @@ U_BOOT_DRIVER(exynos_spi) = {
.id = UCLASS_SPI,
.of_match = exynos_spi_ids,
.ops = &exynos_spi_ops,
- .ofdata_to_platdata = exynos_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct exynos_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct exynos_spi_priv),
+ .of_to_plat = exynos_spi_of_to_plat,
+ .plat_auto = sizeof(struct exynos_spi_plat),
+ .priv_auto = sizeof(struct exynos_spi_priv),
.probe = exynos_spi_probe,
};
diff --git a/drivers/spi/fsl_dspi.c b/drivers/spi/fsl_dspi.c
index b22c9b3..c17a552 100644
--- a/drivers/spi/fsl_dspi.c
+++ b/drivers/spi/fsl_dspi.c
@@ -31,7 +31,7 @@
DECLARE_GLOBAL_DATA_PTR;
-/* fsl_dspi_platdata flags */
+/* fsl_dspi_plat flags */
#define DSPI_FLAG_REGMAP_ENDIAN_BIG BIT(0)
/* idle data value */
@@ -65,14 +65,14 @@ DECLARE_GLOBAL_DATA_PTR;
DSPI_CTAR_DT(15))
/**
- * struct fsl_dspi_platdata - platform data for Freescale DSPI
+ * struct fsl_dspi_plat - platform data for Freescale DSPI
*
* @flags: Flags for DSPI DSPI_FLAG_...
* @speed_hz: Default SCK frequency
* @num_chipselect: Number of DSPI chipselect signals
* @regs_addr: Base address of DSPI registers
*/
-struct fsl_dspi_platdata {
+struct fsl_dspi_plat {
uint flags;
uint speed_hz;
uint num_chipselect;
@@ -448,7 +448,7 @@ static int fsl_dspi_cfg_speed(struct fsl_dspi_priv *priv, uint speed)
static int fsl_dspi_child_pre_probe(struct udevice *dev)
{
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
struct fsl_dspi_priv *priv = dev_get_priv(dev->parent);
u32 cs_sck_delay = 0, sck_cs_delay = 0;
unsigned char pcssck = 0, cssck = 0;
@@ -460,8 +460,10 @@ static int fsl_dspi_child_pre_probe(struct udevice *dev)
return -EINVAL;
}
- ofnode_read_u32(dev->node, "fsl,spi-cs-sck-delay", &cs_sck_delay);
- ofnode_read_u32(dev->node, "fsl,spi-sck-cs-delay", &sck_cs_delay);
+ ofnode_read_u32(dev_ofnode(dev), "fsl,spi-cs-sck-delay",
+ &cs_sck_delay);
+ ofnode_read_u32(dev_ofnode(dev), "fsl,spi-sck-cs-delay",
+ &sck_cs_delay);
/* Set PCS to SCK delay scale values */
ns_delay_scale(&pcssck, &cssck, cs_sck_delay, priv->bus_clk);
@@ -481,12 +483,12 @@ static int fsl_dspi_child_pre_probe(struct udevice *dev)
static int fsl_dspi_probe(struct udevice *bus)
{
- struct fsl_dspi_platdata *plat = dev_get_platdata(bus);
+ struct fsl_dspi_plat *plat = dev_get_plat(bus);
struct fsl_dspi_priv *priv = dev_get_priv(bus);
struct dm_spi_bus *dm_spi_bus;
uint mcr_cfg_val;
- dm_spi_bus = bus->uclass_priv;
+ dm_spi_bus = dev_get_uclass_priv(bus);
/* cpu speical pin muxing configure */
cpu_dspi_port_conf();
@@ -511,7 +513,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;
}
@@ -521,13 +523,13 @@ static int fsl_dspi_claim_bus(struct udevice *dev)
uint sr_val;
struct fsl_dspi_priv *priv;
struct udevice *bus = dev->parent;
- struct dm_spi_slave_platdata *slave_plat =
- dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat =
+ dev_get_parent_plat(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);
@@ -552,14 +554,14 @@ static int fsl_dspi_release_bus(struct udevice *dev)
{
struct udevice *bus = dev->parent;
struct fsl_dspi_priv *priv = dev_get_priv(bus);
- struct dm_spi_slave_platdata *slave_plat =
- dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat =
+ dev_get_parent_plat(dev);
/* halt module */
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;
}
@@ -569,14 +571,14 @@ static int fsl_dspi_release_bus(struct udevice *dev)
*/
static int fsl_dspi_bind(struct udevice *bus)
{
- debug("%s assigned req_seq %d.\n", bus->name, bus->req_seq);
+ debug("%s assigned seq %d.\n", bus->name, dev_seq(bus));
return 0;
}
-static int fsl_dspi_ofdata_to_platdata(struct udevice *bus)
+static int fsl_dspi_of_to_plat(struct udevice *bus)
{
fdt_addr_t addr;
- struct fsl_dspi_platdata *plat = bus->platdata;
+ struct fsl_dspi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
@@ -608,7 +610,7 @@ static int fsl_dspi_xfer(struct udevice *dev, unsigned int bitlen,
const void *dout, void *din, unsigned long flags)
{
struct fsl_dspi_priv *priv;
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
struct udevice *bus;
bus = dev->parent;
@@ -659,9 +661,9 @@ U_BOOT_DRIVER(fsl_dspi) = {
.id = UCLASS_SPI,
.of_match = fsl_dspi_ids,
.ops = &fsl_dspi_ops,
- .ofdata_to_platdata = fsl_dspi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct fsl_dspi_platdata),
- .priv_auto_alloc_size = sizeof(struct fsl_dspi_priv),
+ .of_to_plat = fsl_dspi_of_to_plat,
+ .plat_auto = sizeof(struct fsl_dspi_plat),
+ .priv_auto = sizeof(struct fsl_dspi_priv),
.probe = fsl_dspi_probe,
.child_pre_probe = fsl_dspi_child_pre_probe,
.bind = fsl_dspi_bind,
diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c
index 5c76fd9..abc28e3 100644
--- a/drivers/spi/fsl_espi.c
+++ b/drivers/spi/fsl_espi.c
@@ -508,7 +508,7 @@ static int fsl_espi_set_mode(struct udevice *bus, uint mode)
static int fsl_espi_child_pre_probe(struct udevice *dev)
{
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
struct udevice *bus = dev->parent;
struct fsl_spi_slave *fsl = dev_get_priv(bus);
@@ -520,14 +520,14 @@ static int fsl_espi_child_pre_probe(struct udevice *dev)
static int fsl_espi_probe(struct udevice *bus)
{
- struct fsl_espi_platdata *plat = dev_get_platdata(bus);
+ struct fsl_espi_plat *plat = dev_get_plat(bus);
struct fsl_spi_slave *fsl = dev_get_priv(bus);
fsl->espi = (ccsr_espi_t *)((u32)plat->regs_addr);
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;
}
@@ -541,10 +541,10 @@ static const struct dm_spi_ops fsl_espi_ops = {
};
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
-static int fsl_espi_ofdata_to_platdata(struct udevice *bus)
+static int fsl_espi_of_to_plat(struct udevice *bus)
{
fdt_addr_t addr;
- struct fsl_espi_platdata *plat = bus->platdata;
+ struct fsl_espi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
@@ -573,11 +573,11 @@ U_BOOT_DRIVER(fsl_espi) = {
.id = UCLASS_SPI,
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
.of_match = fsl_espi_ids,
- .ofdata_to_platdata = fsl_espi_ofdata_to_platdata,
+ .of_to_plat = fsl_espi_of_to_plat,
#endif
.ops = &fsl_espi_ops,
- .platdata_auto_alloc_size = sizeof(struct fsl_espi_platdata),
- .priv_auto_alloc_size = sizeof(struct fsl_spi_slave),
+ .plat_auto = sizeof(struct fsl_espi_plat),
+ .priv_auto = sizeof(struct fsl_spi_slave),
.probe = fsl_espi_probe,
.child_pre_probe = fsl_espi_child_pre_probe,
};
diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
index 128f958..8bc7038 100644
--- a/drivers/spi/fsl_qspi.c
+++ b/drivers/spi/fsl_qspi.c
@@ -515,8 +515,8 @@ static void fsl_qspi_invalidate(struct fsl_qspi *q)
static void fsl_qspi_select_mem(struct fsl_qspi *q, struct spi_slave *slave)
{
- struct dm_spi_slave_platdata *plat =
- dev_get_parent_platdata(slave->dev);
+ struct dm_spi_slave_plat *plat =
+ dev_get_parent_plat(slave->dev);
if (q->selected == plat->cs)
return;
@@ -795,7 +795,7 @@ static const struct spi_controller_mem_ops fsl_qspi_mem_ops = {
static int fsl_qspi_probe(struct udevice *bus)
{
- struct dm_spi_bus *dm_bus = bus->uclass_priv;
+ struct dm_spi_bus *dm_bus = dev_get_uclass_priv(bus);
struct fsl_qspi *q = dev_get_priv(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
@@ -887,6 +887,6 @@ U_BOOT_DRIVER(fsl_qspi) = {
.id = UCLASS_SPI,
.of_match = fsl_qspi_ids,
.ops = &fsl_qspi_ops,
- .priv_auto_alloc_size = sizeof(struct fsl_qspi),
+ .priv_auto = sizeof(struct fsl_qspi),
.probe = fsl_qspi_probe,
};
diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
index a91cb78..1cd4104 100644
--- a/drivers/spi/ich.c
+++ b/drivers/spi/ich.c
@@ -38,17 +38,6 @@
#define debug_trace(x, args...)
#endif
-struct ich_spi_platdata {
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
- struct dtd_intel_fast_spi dtplat;
-#endif
- enum ich_version ich_version; /* Controller version, 7 or 9 */
- bool lockdown; /* lock down controller settings? */
- ulong mmio_base; /* Base of MMIO registers */
- pci_dev_t bdf; /* PCI address used by of-platdata */
- bool hwseq; /* Use hardware sequencing (not s/w) */
-};
-
static u8 ich_readb(struct ich_spi_priv *priv, int reg)
{
u8 value = readb(priv->base + reg);
@@ -139,7 +128,7 @@ static bool ich9_can_do_33mhz(struct udevice *dev)
return speed == 1;
}
-static void spi_lock_down(struct ich_spi_platdata *plat, void *sbase)
+static void spi_lock_down(struct ich_spi_plat *plat, void *sbase)
{
if (plat->ich_version == ICHV_7) {
struct ich7_spi_regs *ich7_spi = sbase;
@@ -152,7 +141,7 @@ static void spi_lock_down(struct ich_spi_platdata *plat, void *sbase)
}
}
-static bool spi_lock_status(struct ich_spi_platdata *plat, void *sbase)
+static bool spi_lock_status(struct ich_spi_plat *plat, void *sbase)
{
int lock = 0;
@@ -264,7 +253,7 @@ static int ich_spi_exec_op_swseq(struct spi_slave *slave,
const struct spi_mem_op *op)
{
struct udevice *bus = dev_get_parent(slave->dev);
- struct ich_spi_platdata *plat = dev_get_platdata(bus);
+ struct ich_spi_plat *plat = dev_get_plat(bus);
struct ich_spi_priv *ctlr = dev_get_priv(bus);
uint16_t control;
int16_t opcode_index;
@@ -602,7 +591,7 @@ static int ich_spi_exec_op_hwseq(struct spi_slave *slave,
static int ich_spi_exec_op(struct spi_slave *slave, const struct spi_mem_op *op)
{
struct udevice *bus = dev_get_parent(slave->dev);
- struct ich_spi_platdata *plat = dev_get_platdata(bus);
+ struct ich_spi_plat *plat = dev_get_plat(bus);
int ret;
bootstage_start(BOOTSTAGE_ID_ACCUM_SPI, "fast_spi");
@@ -667,7 +656,7 @@ static int ich_spi_get_basics(struct udevice *bus, bool can_probe,
* 1. Using of-platdata, in which case we have the BDF and can access the
* registers by reading the BAR
* 2. Not using of-platdata, but still with a SPI controller that is on its own
- * PCI PDF. In this case we read the BDF from the parent platdata and again get
+ * PCI PDF. In this case we read the BDF from the parent plat and again get
* the registers by reading the BAR
* 3. Using a SPI controller that is a child of the PCH, in which case we try
* to find the registers by asking the PCH. This only works if the PCH has
@@ -685,9 +674,9 @@ static int ich_get_mmap_bus(struct udevice *bus, ulong *map_basep,
pci_dev_t spi_bdf;
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
if (device_is_on_pci_bus(bus)) {
- struct pci_child_platdata *pplat;
+ struct pci_child_plat *pplat;
- pplat = dev_get_parent_platdata(bus);
+ pplat = dev_get_parent_plat(bus);
spi_bdf = pplat->devfn;
} else {
enum ich_version ich_version;
@@ -706,7 +695,7 @@ static int ich_get_mmap_bus(struct udevice *bus, ulong *map_basep,
offsetp);
}
#else
- struct ich_spi_platdata *plat = dev_get_platdata(bus);
+ struct ich_spi_plat *plat = dev_get_plat(bus);
/*
* We cannot rely on plat->bdf being set up yet since this method can
@@ -758,7 +747,7 @@ static int ich_spi_adjust_size(struct spi_slave *slave, struct spi_mem_op *op)
static int ich_protect_lockdown(struct udevice *dev)
{
- struct ich_spi_platdata *plat = dev_get_platdata(dev);
+ struct ich_spi_plat *plat = dev_get_plat(dev);
struct ich_spi_priv *priv = dev_get_priv(dev);
int ret = -ENOSYS;
@@ -788,11 +777,11 @@ static int ich_protect_lockdown(struct udevice *dev)
}
static int ich_init_controller(struct udevice *dev,
- struct ich_spi_platdata *plat,
+ struct ich_spi_plat *plat,
struct ich_spi_priv *ctlr)
{
if (spl_phase() == PHASE_TPL) {
- struct ich_spi_platdata *plat = dev_get_platdata(dev);
+ struct ich_spi_plat *plat = dev_get_plat(dev);
int ret;
ret = fast_spi_early_init(plat->bdf, plat->mmio_base);
@@ -871,7 +860,7 @@ static int ich_cache_bios_region(struct udevice *dev)
static int ich_spi_probe(struct udevice *dev)
{
- struct ich_spi_platdata *plat = dev_get_platdata(dev);
+ struct ich_spi_plat *plat = dev_get_plat(dev);
struct ich_spi_priv *priv = dev_get_priv(dev);
int ret;
@@ -924,7 +913,7 @@ static int ich_spi_set_mode(struct udevice *bus, uint mode)
static int ich_spi_child_pre_probe(struct udevice *dev)
{
struct udevice *bus = dev_get_parent(dev);
- struct ich_spi_platdata *plat = dev_get_platdata(bus);
+ struct ich_spi_plat *plat = dev_get_plat(bus);
struct ich_spi_priv *priv = dev_get_priv(bus);
struct spi_slave *slave = dev_get_parent_priv(dev);
@@ -945,9 +934,9 @@ static int ich_spi_child_pre_probe(struct udevice *dev)
return 0;
}
-static int ich_spi_ofdata_to_platdata(struct udevice *dev)
+static int ich_spi_of_to_plat(struct udevice *dev)
{
- struct ich_spi_platdata *plat = dev_get_platdata(dev);
+ struct ich_spi_plat *plat = dev_get_plat(dev);
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
struct ich_spi_priv *priv = dev_get_priv(dev);
@@ -1004,9 +993,9 @@ U_BOOT_DRIVER(intel_fast_spi) = {
.id = UCLASS_SPI,
.of_match = ich_spi_ids,
.ops = &ich_spi_ops,
- .ofdata_to_platdata = ich_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct ich_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct ich_spi_priv),
+ .of_to_plat = ich_spi_of_to_plat,
+ .plat_auto = sizeof(struct ich_spi_plat),
+ .priv_auto = sizeof(struct ich_spi_priv),
.child_pre_probe = ich_spi_child_pre_probe,
.probe = ich_spi_probe,
.remove = ich_spi_remove,
diff --git a/drivers/spi/ich.h b/drivers/spi/ich.h
index 23c7827..8fd150d 100644
--- a/drivers/spi/ich.h
+++ b/drivers/spi/ich.h
@@ -230,4 +230,15 @@ struct ich_spi_priv {
struct udevice *pch; /* PCH, used to control SPI access */
};
+struct ich_spi_plat {
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+ struct dtd_intel_fast_spi dtplat;
+#endif
+ enum ich_version ich_version; /* Controller version, 7 or 9 */
+ bool lockdown; /* lock down controller settings? */
+ ulong mmio_base; /* Base of MMIO registers */
+ pci_dev_t bdf; /* PCI address used by of-platdata */
+ bool hwseq; /* Use hardware sequencing (not s/w) */
+};
+
#endif /* _ICH_H_ */
diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c
index dc7d2bc..43812da 100644
--- a/drivers/spi/kirkwood_spi.c
+++ b/drivers/spi/kirkwood_spi.c
@@ -23,7 +23,7 @@ struct mvebu_spi_dev {
bool is_errata_50mhz_ac;
};
-struct mvebu_spi_platdata {
+struct mvebu_spi_plat {
struct kwspi_registers *spireg;
bool is_errata_50mhz_ac;
};
@@ -109,7 +109,7 @@ static int _spi_xfer(struct kwspi_registers *reg, unsigned int bitlen,
static int mvebu_spi_set_speed(struct udevice *bus, uint hz)
{
- struct mvebu_spi_platdata *plat = dev_get_platdata(bus);
+ struct mvebu_spi_plat *plat = dev_get_plat(bus);
struct kwspi_registers *reg = plat->spireg;
u32 data;
@@ -127,7 +127,7 @@ static int mvebu_spi_set_speed(struct udevice *bus, uint hz)
static void mvebu_spi_50mhz_ac_timing_erratum(struct udevice *bus, uint mode)
{
- struct mvebu_spi_platdata *plat = dev_get_platdata(bus);
+ struct mvebu_spi_plat *plat = dev_get_plat(bus);
struct kwspi_registers *reg = plat->spireg;
u32 data;
@@ -160,7 +160,7 @@ static void mvebu_spi_50mhz_ac_timing_erratum(struct udevice *bus, uint mode)
static int mvebu_spi_set_mode(struct udevice *bus, uint mode)
{
- struct mvebu_spi_platdata *plat = dev_get_platdata(bus);
+ struct mvebu_spi_plat *plat = dev_get_plat(bus);
struct kwspi_registers *reg = plat->spireg;
u32 data = readl(&reg->cfg);
@@ -185,7 +185,7 @@ static int mvebu_spi_xfer(struct udevice *dev, unsigned int bitlen,
const void *dout, void *din, unsigned long flags)
{
struct udevice *bus = dev->parent;
- struct mvebu_spi_platdata *plat = dev_get_platdata(bus);
+ struct mvebu_spi_plat *plat = dev_get_plat(bus);
return _spi_xfer(plat->spireg, bitlen, dout, din, flags);
}
@@ -198,7 +198,7 @@ __attribute__((weak)) int mvebu_board_spi_claim_bus(struct udevice *dev)
static int mvebu_spi_claim_bus(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct mvebu_spi_platdata *plat = dev_get_platdata(bus);
+ struct mvebu_spi_plat *plat = dev_get_plat(bus);
/* Configure the chip-select in the CTRL register */
clrsetbits_le32(&plat->spireg->ctrl,
@@ -220,7 +220,7 @@ static int mvebu_spi_release_bus(struct udevice *dev)
static int mvebu_spi_probe(struct udevice *bus)
{
- struct mvebu_spi_platdata *plat = dev_get_platdata(bus);
+ struct mvebu_spi_plat *plat = dev_get_plat(bus);
struct kwspi_registers *reg = plat->spireg;
writel(KWSPI_SMEMRDY, &reg->ctrl);
@@ -230,9 +230,9 @@ static int mvebu_spi_probe(struct udevice *bus)
return 0;
}
-static int mvebu_spi_ofdata_to_platdata(struct udevice *bus)
+static int mvebu_spi_of_to_plat(struct udevice *bus)
{
- struct mvebu_spi_platdata *plat = dev_get_platdata(bus);
+ struct mvebu_spi_plat *plat = dev_get_plat(bus);
const struct mvebu_spi_dev *drvdata =
(struct mvebu_spi_dev *)dev_get_driver_data(bus);
@@ -295,8 +295,8 @@ U_BOOT_DRIVER(mvebu_spi) = {
.id = UCLASS_SPI,
.of_match = mvebu_spi_ids,
.ops = &mvebu_spi_ops,
- .ofdata_to_platdata = mvebu_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct mvebu_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct mvebu_spi_priv),
+ .of_to_plat = mvebu_spi_of_to_plat,
+ .plat_auto = sizeof(struct mvebu_spi_plat),
+ .priv_auto = sizeof(struct mvebu_spi_priv),
.probe = mvebu_spi_probe,
};
diff --git a/drivers/spi/meson_spifc.c b/drivers/spi/meson_spifc.c
index 2cdc018..d99a151 100644
--- a/drivers/spi/meson_spifc.c
+++ b/drivers/spi/meson_spifc.c
@@ -318,5 +318,5 @@ U_BOOT_DRIVER(meson_spifc) = {
.of_match = meson_spifc_ids,
.ops = &meson_spifc_ops,
.probe = meson_spifc_probe,
- .priv_auto_alloc_size = sizeof(struct meson_spifc_priv),
+ .priv_auto = sizeof(struct meson_spifc_priv),
};
diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c
index ec39c12..6869d60 100644
--- a/drivers/spi/mpc8xxx_spi.c
+++ b/drivers/spi/mpc8xxx_spi.c
@@ -48,7 +48,7 @@ struct mpc8xxx_priv {
#define SPI_TIMEOUT 1000
-static int mpc8xxx_spi_ofdata_to_platdata(struct udevice *dev)
+static int mpc8xxx_spi_of_to_plat(struct udevice *dev)
{
struct mpc8xxx_priv *priv = dev_get_priv(dev);
struct clk clk;
@@ -107,17 +107,17 @@ static int mpc8xxx_spi_probe(struct udevice *dev)
static void mpc8xxx_spi_cs_activate(struct udevice *dev)
{
struct mpc8xxx_priv *priv = dev_get_priv(dev->parent);
- struct dm_spi_slave_platdata *platdata = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev);
- dm_gpio_set_value(&priv->gpios[platdata->cs], 1);
+ dm_gpio_set_value(&priv->gpios[plat->cs], 1);
}
static void mpc8xxx_spi_cs_deactivate(struct udevice *dev)
{
struct mpc8xxx_priv *priv = dev_get_priv(dev->parent);
- struct dm_spi_slave_platdata *platdata = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev);
- dm_gpio_set_value(&priv->gpios[platdata->cs], 0);
+ dm_gpio_set_value(&priv->gpios[plat->cs], 0);
}
static int mpc8xxx_spi_xfer(struct udevice *dev, uint bitlen,
@@ -126,16 +126,16 @@ static int mpc8xxx_spi_xfer(struct udevice *dev, uint bitlen,
struct udevice *bus = dev->parent;
struct mpc8xxx_priv *priv = dev_get_priv(bus);
spi8xxx_t *spi = priv->spi;
- struct dm_spi_slave_platdata *platdata = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev);
u32 tmpdin = 0, tmpdout = 0, n;
const u8 *cout = dout;
u8 *cin = din;
debug("%s: slave %s:%u dout %08X din %08X bitlen %u\n", __func__,
- bus->name, platdata->cs, (uint)dout, (uint)din, bitlen);
- if (platdata->cs >= priv->cs_count) {
+ bus->name, plat->cs, (uint)dout, (uint)din, bitlen);
+ if (plat->cs >= priv->cs_count) {
dev_err(dev, "chip select index %d too large (cs_count=%d)\n",
- platdata->cs, priv->cs_count);
+ plat->cs, priv->cs_count);
return -EINVAL;
}
if (bitlen % 8) {
@@ -279,7 +279,7 @@ U_BOOT_DRIVER(mpc8xxx_spi) = {
.id = UCLASS_SPI,
.of_match = mpc8xxx_spi_ids,
.ops = &mpc8xxx_spi_ops,
- .ofdata_to_platdata = mpc8xxx_spi_ofdata_to_platdata,
+ .of_to_plat = mpc8xxx_spi_of_to_plat,
.probe = mpc8xxx_spi_probe,
- .priv_auto_alloc_size = sizeof(struct mpc8xxx_priv),
+ .priv_auto = sizeof(struct mpc8xxx_priv),
};
diff --git a/drivers/spi/mscc_bb_spi.c b/drivers/spi/mscc_bb_spi.c
index e77447b..2a01ea0 100644
--- a/drivers/spi/mscc_bb_spi.c
+++ b/drivers/spi/mscc_bb_spi.c
@@ -117,7 +117,7 @@ int mscc_bb_spi_xfer(struct udevice *dev, unsigned int bitlen,
const void *dout, void *din, unsigned long flags)
{
struct udevice *bus = dev_get_parent(dev);
- struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev);
struct mscc_bb_priv *priv = dev_get_priv(bus);
u32 i, count;
const u8 *txd = dout;
@@ -232,6 +232,6 @@ U_BOOT_DRIVER(mscc_bb) = {
.id = UCLASS_SPI,
.of_match = mscc_bb_ids,
.ops = &mscc_bb_ops,
- .priv_auto_alloc_size = sizeof(struct mscc_bb_priv),
+ .priv_auto = sizeof(struct mscc_bb_priv),
.probe = mscc_bb_spi_probe,
};
diff --git a/drivers/spi/mt7621_spi.c b/drivers/spi/mt7621_spi.c
index 3a0738e..eb09317 100644
--- a/drivers/spi/mt7621_spi.c
+++ b/drivers/spi/mt7621_spi.c
@@ -304,6 +304,6 @@ U_BOOT_DRIVER(mt7621_spi) = {
.id = UCLASS_SPI,
.of_match = mt7621_spi_ids,
.ops = &mt7621_spi_ops,
- .priv_auto_alloc_size = sizeof(struct mt7621_spi),
+ .priv_auto = sizeof(struct mt7621_spi),
.probe = mt7621_spi_probe,
};
diff --git a/drivers/spi/mtk_snfi_spi.c b/drivers/spi/mtk_snfi_spi.c
index c30c8f4..b6ab5fa 100644
--- a/drivers/spi/mtk_snfi_spi.c
+++ b/drivers/spi/mtk_snfi_spi.c
@@ -313,6 +313,6 @@ U_BOOT_DRIVER(mtk_snfi_spi) = {
.id = UCLASS_SPI,
.of_match = mtk_snfi_spi_ids,
.ops = &mtk_snfi_spi_ops,
- .priv_auto_alloc_size = sizeof(struct mtk_snfi_priv),
+ .priv_auto = sizeof(struct mtk_snfi_priv),
.probe = mtk_snfi_spi_probe,
};
diff --git a/drivers/spi/mvebu_a3700_spi.c b/drivers/spi/mvebu_a3700_spi.c
index eb13cf3..c40d7d1 100644
--- a/drivers/spi/mvebu_a3700_spi.c
+++ b/drivers/spi/mvebu_a3700_spi.c
@@ -38,13 +38,13 @@ struct spi_reg {
u32 din; /* 0x1060c */
};
-struct mvebu_spi_platdata {
+struct mvebu_spi_plat {
struct spi_reg *spireg;
struct clk clk;
struct gpio_desc cs_gpios[MAX_CS_COUNT];
};
-static void spi_cs_activate(struct mvebu_spi_platdata *plat, int cs)
+static void spi_cs_activate(struct mvebu_spi_plat *plat, int cs)
{
if (CONFIG_IS_ENABLED(DM_GPIO) && dm_gpio_is_valid(&plat->cs_gpios[cs]))
dm_gpio_set_value(&plat->cs_gpios[cs], 1);
@@ -52,7 +52,7 @@ static void spi_cs_activate(struct mvebu_spi_platdata *plat, int cs)
setbits_le32(&plat->spireg->ctrl, MVEBU_SPI_A3700_SPI_EN_0 << cs);
}
-static void spi_cs_deactivate(struct mvebu_spi_platdata *plat, int cs)
+static void spi_cs_deactivate(struct mvebu_spi_plat *plat, int cs)
{
if (CONFIG_IS_ENABLED(DM_GPIO) && dm_gpio_is_valid(&plat->cs_gpios[cs]))
dm_gpio_set_value(&plat->cs_gpios[cs], 0);
@@ -146,7 +146,7 @@ static int mvebu_spi_xfer(struct udevice *dev, unsigned int bitlen,
const void *dout, void *din, unsigned long flags)
{
struct udevice *bus = dev->parent;
- struct mvebu_spi_platdata *plat = dev_get_platdata(bus);
+ struct mvebu_spi_plat *plat = dev_get_plat(bus);
struct spi_reg *reg = plat->spireg;
unsigned int bytelen;
int ret;
@@ -186,7 +186,7 @@ static int mvebu_spi_xfer(struct udevice *dev, unsigned int bitlen,
static int mvebu_spi_set_speed(struct udevice *bus, uint hz)
{
- struct mvebu_spi_platdata *plat = dev_get_platdata(bus);
+ struct mvebu_spi_plat *plat = dev_get_plat(bus);
struct spi_reg *reg = plat->spireg;
u32 data, prescale;
@@ -207,7 +207,7 @@ static int mvebu_spi_set_speed(struct udevice *bus, uint hz)
static int mvebu_spi_set_mode(struct udevice *bus, uint mode)
{
- struct mvebu_spi_platdata *plat = dev_get_platdata(bus);
+ struct mvebu_spi_plat *plat = dev_get_plat(bus);
struct spi_reg *reg = plat->spireg;
/*
@@ -229,7 +229,7 @@ static int mvebu_spi_set_mode(struct udevice *bus, uint mode)
static int mvebu_spi_probe(struct udevice *bus)
{
- struct mvebu_spi_platdata *plat = dev_get_platdata(bus);
+ struct mvebu_spi_plat *plat = dev_get_plat(bus);
struct spi_reg *reg = plat->spireg;
u32 data;
int ret;
@@ -279,9 +279,9 @@ static int mvebu_spi_probe(struct udevice *bus)
return 0;
}
-static int mvebu_spi_ofdata_to_platdata(struct udevice *bus)
+static int mvebu_spi_of_to_plat(struct udevice *bus)
{
- struct mvebu_spi_platdata *plat = dev_get_platdata(bus);
+ struct mvebu_spi_plat *plat = dev_get_plat(bus);
int ret;
plat->spireg = dev_read_addr_ptr(bus);
@@ -297,7 +297,7 @@ static int mvebu_spi_ofdata_to_platdata(struct udevice *bus)
static int mvebu_spi_remove(struct udevice *bus)
{
- struct mvebu_spi_platdata *plat = dev_get_platdata(bus);
+ struct mvebu_spi_plat *plat = dev_get_plat(bus);
clk_free(&plat->clk);
@@ -324,8 +324,8 @@ U_BOOT_DRIVER(mvebu_spi) = {
.id = UCLASS_SPI,
.of_match = mvebu_spi_ids,
.ops = &mvebu_spi_ops,
- .ofdata_to_platdata = mvebu_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct mvebu_spi_platdata),
+ .of_to_plat = mvebu_spi_of_to_plat,
+ .plat_auto = sizeof(struct mvebu_spi_plat),
.probe = mvebu_spi_probe,
.remove = mvebu_spi_remove,
};
diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index e90a06a..c5ffad8 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -69,7 +69,7 @@ static void mxc_spi_cs_activate(struct mxc_spi_slave *mxcs)
{
#if CONFIG_IS_ENABLED(DM_SPI)
struct udevice *dev = mxcs->dev;
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
u32 cs = slave_plat->cs;
@@ -87,7 +87,7 @@ static void mxc_spi_cs_deactivate(struct mxc_spi_slave *mxcs)
{
#if CONFIG_IS_ENABLED(DM_SPI)
struct udevice *dev = mxcs->dev;
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
u32 cs = slave_plat->cs;
@@ -512,7 +512,7 @@ void spi_release_bus(struct spi_slave *slave)
static int mxc_spi_probe(struct udevice *bus)
{
- struct mxc_spi_slave *mxcs = dev_get_platdata(bus);
+ struct mxc_spi_slave *mxcs = dev_get_plat(bus);
int node = dev_of_offset(bus);
const void *blob = gd->fdt_blob;
int ret;
@@ -550,7 +550,7 @@ static int mxc_spi_probe(struct udevice *bus)
static int mxc_spi_xfer(struct udevice *dev, unsigned int bitlen,
const void *dout, void *din, unsigned long flags)
{
- struct mxc_spi_slave *mxcs = dev_get_platdata(dev->parent);
+ struct mxc_spi_slave *mxcs = dev_get_plat(dev->parent);
return mxc_spi_xfer_internal(mxcs, bitlen, dout, din, flags);
@@ -558,8 +558,8 @@ static int mxc_spi_xfer(struct udevice *dev, unsigned int bitlen,
static int mxc_spi_claim_bus(struct udevice *dev)
{
- struct mxc_spi_slave *mxcs = dev_get_platdata(dev->parent);
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct mxc_spi_slave *mxcs = dev_get_plat(dev->parent);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
mxcs->dev = dev;
@@ -579,7 +579,7 @@ static int mxc_spi_set_speed(struct udevice *bus, uint speed)
static int mxc_spi_set_mode(struct udevice *bus, uint mode)
{
- struct mxc_spi_slave *mxcs = dev_get_platdata(bus);
+ struct mxc_spi_slave *mxcs = dev_get_plat(bus);
mxcs->mode = mode;
mxcs->ss_pol = (mode & SPI_CS_HIGH) ? 1 : 0;
@@ -605,7 +605,7 @@ U_BOOT_DRIVER(mxc_spi) = {
.id = UCLASS_SPI,
.of_match = mxc_spi_ids,
.ops = &mxc_spi_ops,
- .platdata_auto_alloc_size = sizeof(struct mxc_spi_slave),
+ .plat_auto = sizeof(struct mxc_spi_slave),
.probe = mxc_spi_probe,
};
#endif
diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
index fb0af02..d41352a 100644
--- a/drivers/spi/mxs_spi.c
+++ b/drivers/spi/mxs_spi.c
@@ -41,7 +41,7 @@
#define MXS_SSP_IMX23_CLKID_SSP0 33
#define MXS_SSP_IMX28_CLKID_SSP0 46
-struct mxs_spi_platdata {
+struct mxs_spi_plat {
#if CONFIG_IS_ENABLED(OF_PLATDATA)
struct dtd_fsl_imx23_spi dtplat;
#endif
@@ -311,7 +311,7 @@ int mxs_spi_xfer(struct udevice *dev, unsigned int bitlen,
static int mxs_spi_probe(struct udevice *bus)
{
- struct mxs_spi_platdata *plat = dev_get_platdata(bus);
+ struct mxs_spi_plat *plat = dev_get_plat(bus);
struct mxs_spi_priv *priv = dev_get_priv(bus);
int ret;
@@ -441,9 +441,9 @@ static const struct dm_spi_ops mxs_spi_ops = {
};
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
-static int mxs_ofdata_to_platdata(struct udevice *bus)
+static int mxs_of_to_plat(struct udevice *bus)
{
- struct mxs_spi_platdata *plat = bus->platdata;
+ struct mxs_spi_plat *plat = dev_get_plat(bus);
u32 prop[2];
int ret;
@@ -485,12 +485,12 @@ U_BOOT_DRIVER(fsl_imx23_spi) = {
.id = UCLASS_SPI,
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
.of_match = mxs_spi_ids,
- .ofdata_to_platdata = mxs_ofdata_to_platdata,
+ .of_to_plat = mxs_of_to_plat,
#endif
- .platdata_auto_alloc_size = sizeof(struct mxs_spi_platdata),
+ .plat_auto = sizeof(struct mxs_spi_plat),
.ops = &mxs_spi_ops,
- .priv_auto_alloc_size = sizeof(struct mxs_spi_priv),
+ .priv_auto = sizeof(struct mxs_spi_priv),
.probe = mxs_spi_probe,
};
-U_BOOT_DRIVER_ALIAS(fsl_imx23_spi, fsl_imx28_spi)
+DM_DRIVER_ALIAS(fsl_imx23_spi, fsl_imx28_spi)
diff --git a/drivers/spi/nxp_fspi.c b/drivers/spi/nxp_fspi.c
index 9661e9e..006dd04 100644
--- a/drivers/spi/nxp_fspi.c
+++ b/drivers/spi/nxp_fspi.c
@@ -887,7 +887,7 @@ static int nxp_fspi_claim_bus(struct udevice *dev)
{
struct nxp_fspi *f;
struct udevice *bus;
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
bus = dev->parent;
f = dev_get_priv(bus);
@@ -922,7 +922,7 @@ static int nxp_fspi_set_mode(struct udevice *bus, uint mode)
return 0;
}
-static int nxp_fspi_ofdata_to_platdata(struct udevice *bus)
+static int nxp_fspi_of_to_plat(struct udevice *bus)
{
struct nxp_fspi *f = dev_get_priv(bus);
#if CONFIG_IS_ENABLED(CLK)
@@ -993,7 +993,7 @@ U_BOOT_DRIVER(nxp_fspi) = {
.id = UCLASS_SPI,
.of_match = nxp_fspi_ids,
.ops = &nxp_fspi_ops,
- .ofdata_to_platdata = nxp_fspi_ofdata_to_platdata,
- .priv_auto_alloc_size = sizeof(struct nxp_fspi),
+ .of_to_plat = nxp_fspi_of_to_plat,
+ .priv_auto = sizeof(struct nxp_fspi),
.probe = nxp_fspi_probe,
};
diff --git a/drivers/spi/octeon_spi.c b/drivers/spi/octeon_spi.c
index 7e88e55..6ac66d2 100644
--- a/drivers/spi/octeon_spi.c
+++ b/drivers/spi/octeon_spi.c
@@ -81,7 +81,7 @@ struct octeon_spi {
static u64 octeon_spi_set_mpicfg(struct udevice *dev)
{
- struct dm_spi_slave_platdata *slave = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave = dev_get_parent_plat(dev);
struct udevice *bus = dev_get_parent(dev);
struct octeon_spi *priv = dev_get_priv(bus);
u64 mpi_cfg;
@@ -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;
}
@@ -611,6 +611,6 @@ U_BOOT_DRIVER(octeon_spi) = {
.id = UCLASS_SPI,
.of_match = octeon_spi_ids,
.probe = octeon_spi_probe,
- .priv_auto_alloc_size = sizeof(struct octeon_spi),
+ .priv_auto = sizeof(struct octeon_spi),
.ops = &octeon_spi_ops,
};
diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c
index 56cb217..78e2a25 100644
--- a/drivers/spi/omap3_spi.c
+++ b/drivers/spi/omap3_spi.c
@@ -378,7 +378,7 @@ static int omap3_spi_claim_bus(struct udevice *dev)
{
struct udevice *bus = dev->parent;
struct omap3_spi_priv *priv = dev_get_priv(bus);
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
priv->cs = slave_plat->cs;
priv->freq = slave_plat->max_hz;
@@ -402,7 +402,7 @@ static int omap3_spi_set_wordlen(struct udevice *dev, unsigned int wordlen)
{
struct udevice *bus = dev->parent;
struct omap3_spi_priv *priv = dev_get_priv(bus);
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
priv->cs = slave_plat->cs;
priv->wordlen = wordlen;
@@ -414,7 +414,7 @@ static int omap3_spi_set_wordlen(struct udevice *dev, unsigned int wordlen)
static int omap3_spi_probe(struct udevice *dev)
{
struct omap3_spi_priv *priv = dev_get_priv(dev);
- struct omap3_spi_plat *plat = dev_get_platdata(dev);
+ struct omap3_spi_plat *plat = dev_get_plat(dev);
priv->regs = plat->regs;
priv->pin_dir = plat->pin_dir;
@@ -478,11 +478,11 @@ static struct omap2_mcspi_platform_config omap4_pdata = {
.regs_offset = OMAP4_MCSPI_REG_OFFSET,
};
-static int omap3_spi_ofdata_to_platdata(struct udevice *dev)
+static int omap3_spi_of_to_plat(struct udevice *dev)
{
struct omap2_mcspi_platform_config *data =
(struct omap2_mcspi_platform_config *)dev_get_driver_data(dev);
- struct omap3_spi_plat *plat = dev_get_platdata(dev);
+ struct omap3_spi_plat *plat = dev_get_plat(dev);
plat->regs = (struct mcspi *)(dev_read_addr(dev) + data->regs_offset);
@@ -506,10 +506,10 @@ U_BOOT_DRIVER(omap3_spi) = {
.flags = DM_FLAG_PRE_RELOC,
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
.of_match = omap3_spi_ids,
- .ofdata_to_platdata = omap3_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct omap3_spi_plat),
+ .of_to_plat = omap3_spi_of_to_plat,
+ .plat_auto = sizeof(struct omap3_spi_plat),
#endif
.probe = omap3_spi_probe,
.ops = &omap3_spi_ops,
- .priv_auto_alloc_size = sizeof(struct omap3_spi_priv),
+ .priv_auto = sizeof(struct omap3_spi_priv),
};
diff --git a/drivers/spi/pic32_spi.c b/drivers/spi/pic32_spi.c
index 52e9eff..34d7d3e 100644
--- a/drivers/spi/pic32_spi.c
+++ b/drivers/spi/pic32_spi.c
@@ -236,7 +236,7 @@ static int pic32_spi_xfer(struct udevice *slave, unsigned int bitlen,
const void *tx_buf, void *rx_buf,
unsigned long flags)
{
- struct dm_spi_slave_platdata *slave_plat;
+ struct dm_spi_slave_plat *slave_plat;
struct udevice *bus = slave->parent;
struct pic32_spi_priv *priv;
int len = bitlen / 8;
@@ -244,10 +244,10 @@ static int pic32_spi_xfer(struct udevice *slave, unsigned int bitlen,
ulong tbase;
priv = dev_get_priv(bus);
- slave_plat = dev_get_parent_platdata(slave);
+ 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;
@@ -444,6 +444,6 @@ U_BOOT_DRIVER(pic32_spi) = {
.id = UCLASS_SPI,
.of_match = pic32_spi_ids,
.ops = &pic32_spi_ops,
- .priv_auto_alloc_size = sizeof(struct pic32_spi_priv),
+ .priv_auto = sizeof(struct pic32_spi_priv),
.probe = pic32_spi_probe,
};
diff --git a/drivers/spi/pl022_spi.c b/drivers/spi/pl022_spi.c
index 32bb8c8..133363e 100644
--- a/drivers/spi/pl022_spi.c
+++ b/drivers/spi/pl022_spi.c
@@ -89,7 +89,7 @@ static int pl022_is_supported(struct pl022_spi_slave *ps)
static int pl022_spi_probe(struct udevice *bus)
{
- struct pl022_spi_pdata *plat = dev_get_platdata(bus);
+ struct pl022_spi_pdata *plat = dev_get_plat(bus);
struct pl022_spi_slave *ps = dev_get_priv(bus);
ps->base = ioremap(plat->addr, plat->size);
@@ -286,9 +286,9 @@ static const struct dm_spi_ops pl022_spi_ops = {
};
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
-static int pl022_spi_ofdata_to_platdata(struct udevice *bus)
+static int pl022_spi_of_to_plat(struct udevice *bus)
{
- struct pl022_spi_pdata *plat = bus->platdata;
+ struct pl022_spi_pdata *plat = dev_get_plat(bus);
const void *fdt = gd->fdt_blob;
int node = dev_of_offset(bus);
struct clk clkdev;
@@ -316,10 +316,10 @@ U_BOOT_DRIVER(pl022_spi) = {
.id = UCLASS_SPI,
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
.of_match = pl022_spi_ids,
- .ofdata_to_platdata = pl022_spi_ofdata_to_platdata,
+ .of_to_plat = pl022_spi_of_to_plat,
#endif
.ops = &pl022_spi_ops,
- .platdata_auto_alloc_size = sizeof(struct pl022_spi_pdata),
- .priv_auto_alloc_size = sizeof(struct pl022_spi_slave),
+ .plat_auto = sizeof(struct pl022_spi_pdata),
+ .priv_auto = sizeof(struct pl022_spi_slave),
.probe = pl022_spi_probe,
};
diff --git a/drivers/spi/renesas_rpc_spi.c b/drivers/spi/renesas_rpc_spi.c
index d0ff918..1057651 100644
--- a/drivers/spi/renesas_rpc_spi.c
+++ b/drivers/spi/renesas_rpc_spi.c
@@ -156,7 +156,7 @@
DECLARE_GLOBAL_DATA_PTR;
-struct rpc_spi_platdata {
+struct rpc_spi_plat {
fdt_addr_t regs;
fdt_addr_t extr;
s32 freq; /* Default clock freq, -1 for none */
@@ -406,7 +406,7 @@ static int rpc_spi_bind(struct udevice *parent)
static int rpc_spi_probe(struct udevice *dev)
{
- struct rpc_spi_platdata *plat = dev_get_platdata(dev);
+ struct rpc_spi_plat *plat = dev_get_plat(dev);
struct rpc_spi_priv *priv = dev_get_priv(dev);
priv->regs = plat->regs;
@@ -417,9 +417,9 @@ static int rpc_spi_probe(struct udevice *dev)
return 0;
}
-static int rpc_spi_ofdata_to_platdata(struct udevice *bus)
+static int rpc_spi_of_to_plat(struct udevice *bus)
{
- struct rpc_spi_platdata *plat = dev_get_platdata(bus);
+ struct rpc_spi_plat *plat = dev_get_plat(bus);
plat->regs = dev_read_addr_index(bus, 0);
plat->extr = dev_read_addr_index(bus, 1);
@@ -463,9 +463,9 @@ U_BOOT_DRIVER(rpc_spi) = {
.id = UCLASS_SPI,
.of_match = rpc_spi_ids,
.ops = &rpc_spi_ops,
- .ofdata_to_platdata = rpc_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct rpc_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct rpc_spi_priv),
+ .of_to_plat = rpc_spi_of_to_plat,
+ .plat_auto = sizeof(struct rpc_spi_plat),
+ .priv_auto = sizeof(struct rpc_spi_priv),
.bind = rpc_spi_bind,
.probe = rpc_spi_probe,
};
diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c
index c5363c2..40bd885 100644
--- a/drivers/spi/rk_spi.c
+++ b/drivers/spi/rk_spi.c
@@ -40,7 +40,7 @@ struct rockchip_spi_params {
bool master_manages_fifo;
};
-struct rockchip_spi_platdata {
+struct rockchip_spi_plat {
#if CONFIG_IS_ENABLED(OF_PLATDATA)
struct dtd_rockchip_rk3288_spi of_plat;
#endif
@@ -135,7 +135,7 @@ static int rkspi_wait_till_not_busy(struct rockchip_spi *regs)
static void spi_cs_activate(struct udevice *dev, uint cs)
{
struct udevice *bus = dev->parent;
- struct rockchip_spi_platdata *plat = bus->platdata;
+ struct rockchip_spi_plat *plat = dev_get_plat(bus);
struct rockchip_spi_priv *priv = dev_get_priv(bus);
struct rockchip_spi *regs = priv->regs;
@@ -161,7 +161,7 @@ static void spi_cs_activate(struct udevice *dev, uint cs)
static void spi_cs_deactivate(struct udevice *dev, uint cs)
{
struct udevice *bus = dev->parent;
- struct rockchip_spi_platdata *plat = bus->platdata;
+ struct rockchip_spi_plat *plat = dev_get_plat(bus);
struct rockchip_spi_priv *priv = dev_get_priv(bus);
struct rockchip_spi *regs = priv->regs;
@@ -174,9 +174,9 @@ static void spi_cs_deactivate(struct udevice *dev, uint cs)
}
#if CONFIG_IS_ENABLED(OF_PLATDATA)
-static int conv_of_platdata(struct udevice *dev)
+static int conv_of_plat(struct udevice *dev)
{
- struct rockchip_spi_platdata *plat = dev->platdata;
+ struct rockchip_spi_plat *plat = dev_get_plat(dev);
struct dtd_rockchip_rk3288_spi *dtplat = &plat->of_plat;
struct rockchip_spi_priv *priv = dev_get_priv(dev);
int ret;
@@ -186,16 +186,15 @@ static int conv_of_platdata(struct udevice *dev)
ret = clk_get_by_driver_info(dev, dtplat->clocks, &priv->clk);
if (ret < 0)
return ret;
- dev->req_seq = 0;
return 0;
}
#endif
-static int rockchip_spi_ofdata_to_platdata(struct udevice *bus)
+static int rockchip_spi_of_to_plat(struct udevice *bus)
{
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
- struct rockchip_spi_platdata *plat = dev_get_platdata(bus);
+ struct rockchip_spi_plat *plat = dev_get_plat(bus);
struct rockchip_spi_priv *priv = dev_get_priv(bus);
int ret;
@@ -253,13 +252,13 @@ static int rockchip_spi_calc_modclk(ulong max_freq)
static int rockchip_spi_probe(struct udevice *bus)
{
- struct rockchip_spi_platdata *plat = dev_get_platdata(bus);
+ struct rockchip_spi_plat *plat = dev_get_plat(bus);
struct rockchip_spi_priv *priv = dev_get_priv(bus);
int ret;
debug("%s: probe\n", __func__);
#if CONFIG_IS_ENABLED(OF_PLATDATA)
- ret = conv_of_platdata(bus);
+ ret = conv_of_plat(bus);
if (ret)
return ret;
#endif
@@ -432,7 +431,7 @@ static int rockchip_spi_xfer(struct udevice *dev, unsigned int bitlen,
struct udevice *bus = dev->parent;
struct rockchip_spi_priv *priv = dev_get_priv(bus);
struct rockchip_spi *regs = priv->regs;
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
int len = bitlen >> 3;
const u8 *out = dout;
u8 *in = din;
@@ -560,10 +559,10 @@ U_BOOT_DRIVER(rockchip_rk3288_spi) = {
.id = UCLASS_SPI,
.of_match = rockchip_spi_ids,
.ops = &rockchip_spi_ops,
- .ofdata_to_platdata = rockchip_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct rockchip_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct rockchip_spi_priv),
+ .of_to_plat = rockchip_spi_of_to_plat,
+ .plat_auto = sizeof(struct rockchip_spi_plat),
+ .priv_auto = sizeof(struct rockchip_spi_priv),
.probe = rockchip_spi_probe,
};
-U_BOOT_DRIVER_ALIAS(rockchip_rk3288_spi, rockchip_rk3368_spi)
+DM_DRIVER_ALIAS(rockchip_rk3288_spi, rockchip_rk3368_spi)
diff --git a/drivers/spi/sandbox_spi.c b/drivers/spi/sandbox_spi.c
index 755f176..0564d8b 100644
--- a/drivers/spi/sandbox_spi.c
+++ b/drivers/spi/sandbox_spi.c
@@ -28,21 +28,22 @@
# define CONFIG_SPI_IDLE_VAL 0xFF
#endif
-const char *sandbox_spi_parse_spec(const char *arg, unsigned long *bus,
- unsigned long *cs)
-{
- char *endp;
-
- *bus = simple_strtoul(arg, &endp, 0);
- if (*endp != ':' || *bus >= CONFIG_SANDBOX_SPI_MAX_BUS)
- return NULL;
-
- *cs = simple_strtoul(endp + 1, &endp, 0);
- if (*endp != ':' || *cs >= CONFIG_SANDBOX_SPI_MAX_CS)
- return NULL;
-
- return endp + 1;
-}
+/**
+ * struct sandbox_spi_priv - Sandbox SPI private data
+ *
+ * Helper struct to keep track of the sandbox SPI bus internal state. It is
+ * used in unit tests to verify that dm spi functions update the bus
+ * speed/mode properly (for instance, when jumping back and forth between spi
+ * slaves claiming the bus, we need to make sure that the bus speed is updated
+ * accordingly for each slave).
+ *
+ * @speed: Current bus speed.
+ * @mode: Current bus mode.
+ */
+struct sandbox_spi_priv {
+ uint speed;
+ uint mode;
+};
__weak int sandbox_spi_get_emul(struct sandbox_state *state,
struct udevice *bus, struct udevice *slave,
@@ -51,6 +52,20 @@ __weak int sandbox_spi_get_emul(struct sandbox_state *state,
return -ENOENT;
}
+uint sandbox_spi_get_speed(struct udevice *dev)
+{
+ struct sandbox_spi_priv *priv = dev_get_priv(dev);
+
+ return priv->speed;
+}
+
+uint sandbox_spi_get_mode(struct udevice *dev)
+{
+ struct sandbox_spi_priv *priv = dev_get_priv(dev);
+
+ return priv->mode;
+}
+
static int sandbox_spi_xfer(struct udevice *slave, unsigned int bitlen,
const void *dout, void *din, unsigned long flags)
{
@@ -72,7 +87,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) {
@@ -106,19 +121,27 @@ static int sandbox_spi_xfer(struct udevice *slave, unsigned int bitlen,
static int sandbox_spi_set_speed(struct udevice *bus, uint speed)
{
+ struct sandbox_spi_priv *priv = dev_get_priv(bus);
+
+ priv->speed = speed;
+
return 0;
}
static int sandbox_spi_set_mode(struct udevice *bus, uint mode)
{
+ struct sandbox_spi_priv *priv = dev_get_priv(bus);
+
+ priv->mode = mode;
+
return 0;
}
static int sandbox_cs_info(struct udevice *bus, uint cs,
struct spi_cs_info *info)
{
- /* Always allow activity on CS 0 */
- if (cs >= 1)
+ /* Always allow activity on CS 0, CS 1 */
+ if (cs >= 2)
return -EINVAL;
return 0;
@@ -152,4 +175,5 @@ U_BOOT_DRIVER(sandbox_spi) = {
.id = UCLASS_SPI,
.of_match = sandbox_spi_ids,
.ops = &sandbox_spi_ops,
+ .priv_auto = sizeof(struct sandbox_spi_priv),
};
diff --git a/drivers/spi/sh_qspi.c b/drivers/spi/sh_qspi.c
index aa1c030..5ba8a8e 100644
--- a/drivers/spi/sh_qspi.c
+++ b/drivers/spi/sh_qspi.c
@@ -302,7 +302,7 @@ static int sh_qspi_xfer(struct udevice *dev, unsigned int bitlen,
const void *dout, void *din, unsigned long flags)
{
struct udevice *bus = dev->parent;
- struct sh_qspi_slave *ss = dev_get_platdata(bus);
+ struct sh_qspi_slave *ss = dev_get_plat(bus);
return sh_qspi_xfer_common(ss, bitlen, dout, din, flags);
}
@@ -321,16 +321,16 @@ static int sh_qspi_set_mode(struct udevice *dev, uint mode)
static int sh_qspi_probe(struct udevice *dev)
{
- struct sh_qspi_slave *ss = dev_get_platdata(dev);
+ struct sh_qspi_slave *ss = dev_get_plat(dev);
sh_qspi_init(ss);
return 0;
}
-static int sh_qspi_ofdata_to_platdata(struct udevice *dev)
+static int sh_qspi_of_to_plat(struct udevice *dev)
{
- struct sh_qspi_slave *plat = dev_get_platdata(dev);
+ struct sh_qspi_slave *plat = dev_get_plat(dev);
plat->regs = (struct sh_qspi_regs *)dev_read_addr(dev);
@@ -353,8 +353,8 @@ U_BOOT_DRIVER(sh_qspi) = {
.id = UCLASS_SPI,
.of_match = sh_qspi_ids,
.ops = &sh_qspi_ops,
- .ofdata_to_platdata = sh_qspi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct sh_qspi_slave),
+ .of_to_plat = sh_qspi_of_to_plat,
+ .plat_auto = sizeof(struct sh_qspi_slave),
.probe = sh_qspi_probe,
};
#endif
diff --git a/drivers/spi/soft_spi.c b/drivers/spi/soft_spi.c
index 153bbf8..3425d99 100644
--- a/drivers/spi/soft_spi.c
+++ b/drivers/spi/soft_spi.c
@@ -22,7 +22,7 @@
DECLARE_GLOBAL_DATA_PTR;
-struct soft_spi_platdata {
+struct soft_spi_plat {
struct gpio_desc cs;
struct gpio_desc sclk;
struct gpio_desc mosi;
@@ -41,7 +41,7 @@ struct soft_spi_priv {
static int soft_spi_scl(struct udevice *dev, int bit)
{
struct udevice *bus = dev_get_parent(dev);
- struct soft_spi_platdata *plat = dev_get_platdata(bus);
+ struct soft_spi_plat *plat = dev_get_plat(bus);
dm_gpio_set_value(&plat->sclk, bit);
@@ -51,7 +51,7 @@ static int soft_spi_scl(struct udevice *dev, int bit)
static int soft_spi_sda(struct udevice *dev, int bit)
{
struct udevice *bus = dev_get_parent(dev);
- struct soft_spi_platdata *plat = dev_get_platdata(bus);
+ struct soft_spi_plat *plat = dev_get_plat(bus);
dm_gpio_set_value(&plat->mosi, bit);
@@ -62,7 +62,7 @@ static int soft_spi_cs_activate(struct udevice *dev)
{
struct udevice *bus = dev_get_parent(dev);
struct soft_spi_priv *priv = dev_get_priv(bus);
- struct soft_spi_platdata *plat = dev_get_platdata(bus);
+ struct soft_spi_plat *plat = dev_get_plat(bus);
int cidle = !!(priv->mode & SPI_CPOL);
dm_gpio_set_value(&plat->cs, 0);
@@ -75,7 +75,7 @@ static int soft_spi_cs_activate(struct udevice *dev)
static int soft_spi_cs_deactivate(struct udevice *dev)
{
struct udevice *bus = dev_get_parent(dev);
- struct soft_spi_platdata *plat = dev_get_platdata(bus);
+ struct soft_spi_plat *plat = dev_get_plat(bus);
dm_gpio_set_value(&plat->cs, 0);
@@ -117,7 +117,7 @@ static int soft_spi_xfer(struct udevice *dev, unsigned int bitlen,
{
struct udevice *bus = dev_get_parent(dev);
struct soft_spi_priv *priv = dev_get_priv(bus);
- struct soft_spi_platdata *plat = dev_get_platdata(bus);
+ struct soft_spi_plat *plat = dev_get_plat(bus);
uchar tmpdin = 0;
uchar tmpdout = 0;
const u8 *txd = dout;
@@ -226,9 +226,9 @@ static const struct dm_spi_ops soft_spi_ops = {
.set_mode = soft_spi_set_mode,
};
-static int soft_spi_ofdata_to_platdata(struct udevice *dev)
+static int soft_spi_of_to_plat(struct udevice *dev)
{
- struct soft_spi_platdata *plat = dev->platdata;
+ struct soft_spi_plat *plat = dev_get_plat(dev);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(dev);
@@ -240,7 +240,7 @@ static int soft_spi_ofdata_to_platdata(struct udevice *dev)
static int soft_spi_probe(struct udevice *dev)
{
struct spi_slave *slave = dev_get_parent_priv(dev);
- struct soft_spi_platdata *plat = dev->platdata;
+ struct soft_spi_plat *plat = dev_get_plat(dev);
int cs_flags, clk_flags;
int ret;
@@ -280,8 +280,8 @@ U_BOOT_DRIVER(soft_spi) = {
.id = UCLASS_SPI,
.of_match = soft_spi_ids,
.ops = &soft_spi_ops,
- .ofdata_to_platdata = soft_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct soft_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct soft_spi_priv),
+ .of_to_plat = soft_spi_of_to_plat,
+ .plat_auto = sizeof(struct soft_spi_plat),
+ .priv_auto = sizeof(struct soft_spi_priv),
.probe = soft_spi_probe,
};
diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index 6f8df55..cdea540 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -701,7 +701,7 @@ static int qup_spi_xfer(struct udevice *dev, unsigned int bitlen,
const void *dout, void *din, unsigned long flags)
{
struct udevice *bus = dev_get_parent(dev);
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
unsigned int len;
const u8 *txp = dout;
u8 *rxp = din;
@@ -798,6 +798,6 @@ U_BOOT_DRIVER(spi_qup) = {
.id = UCLASS_SPI,
.of_match = qup_spi_ids,
.ops = &qup_spi_ops,
- .priv_auto_alloc_size = sizeof(struct qup_spi_priv),
+ .priv_auto = sizeof(struct qup_spi_priv),
.probe = qup_spi_probe,
};
diff --git a/drivers/spi/spi-sifive.c b/drivers/spi/spi-sifive.c
index c7345d9..0a00df0 100644
--- a/drivers/spi/spi-sifive.c
+++ b/drivers/spi/spi-sifive.c
@@ -105,7 +105,7 @@ struct sifive_spi {
};
static void sifive_spi_prep_device(struct sifive_spi *spi,
- struct dm_spi_slave_platdata *slave_plat)
+ struct dm_spi_slave_plat *slave_plat)
{
/* Update the chip select polarity */
if (slave_plat->mode & SPI_CS_HIGH)
@@ -119,7 +119,7 @@ static void sifive_spi_prep_device(struct sifive_spi *spi,
}
static int sifive_spi_set_cs(struct sifive_spi *spi,
- struct dm_spi_slave_platdata *slave_plat)
+ struct dm_spi_slave_plat *slave_plat)
{
u32 cs_mode = SIFIVE_SPI_CSMODE_MODE_HOLD;
@@ -137,7 +137,7 @@ static void sifive_spi_clear_cs(struct sifive_spi *spi)
}
static void sifive_spi_prep_transfer(struct sifive_spi *spi,
- struct dm_spi_slave_platdata *slave_plat,
+ struct dm_spi_slave_plat *slave_plat,
u8 *rx_ptr)
{
u32 cr;
@@ -212,7 +212,7 @@ static int sifive_spi_xfer(struct udevice *dev, unsigned int bitlen,
{
struct udevice *bus = dev->parent;
struct sifive_spi *spi = dev_get_priv(bus);
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
const u8 *tx_ptr = dout;
u8 *rx_ptr = din;
u32 remaining_len;
@@ -475,6 +475,6 @@ U_BOOT_DRIVER(sifive_spi) = {
.id = UCLASS_SPI,
.of_match = sifive_spi_ids,
.ops = &sifive_spi_ops,
- .priv_auto_alloc_size = sizeof(struct sifive_spi),
+ .priv_auto = sizeof(struct sifive_spi),
.probe = sifive_spi_probe,
};
diff --git a/drivers/spi/spi-sunxi.c b/drivers/spi/spi-sunxi.c
index 0844a5a..1145380 100644
--- a/drivers/spi/spi-sunxi.c
+++ b/drivers/spi/spi-sunxi.c
@@ -122,7 +122,7 @@ struct sun4i_spi_variant {
bool has_burst_ctl;
};
-struct sun4i_spi_platdata {
+struct sun4i_spi_plat {
struct sun4i_spi_variant *variant;
u32 base;
u32 max_hz;
@@ -339,7 +339,7 @@ static int sun4i_spi_xfer(struct udevice *dev, unsigned int bitlen,
{
struct udevice *bus = dev->parent;
struct sun4i_spi_priv *priv = dev_get_priv(bus);
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
u32 len = bitlen / 8;
u32 rx_fifocnt;
@@ -407,7 +407,7 @@ static int sun4i_spi_xfer(struct udevice *dev, unsigned int bitlen,
static int sun4i_spi_set_speed(struct udevice *dev, uint speed)
{
- struct sun4i_spi_platdata *plat = dev_get_platdata(dev);
+ struct sun4i_spi_plat *plat = dev_get_plat(dev);
struct sun4i_spi_priv *priv = dev_get_priv(dev);
unsigned int div;
u32 reg;
@@ -483,7 +483,7 @@ static const struct dm_spi_ops sun4i_spi_ops = {
static int sun4i_spi_probe(struct udevice *bus)
{
- struct sun4i_spi_platdata *plat = dev_get_platdata(bus);
+ struct sun4i_spi_plat *plat = dev_get_plat(bus);
struct sun4i_spi_priv *priv = dev_get_priv(bus);
int ret;
@@ -514,9 +514,9 @@ static int sun4i_spi_probe(struct udevice *bus)
return 0;
}
-static int sun4i_spi_ofdata_to_platdata(struct udevice *bus)
+static int sun4i_spi_of_to_plat(struct udevice *bus)
{
- struct sun4i_spi_platdata *plat = dev_get_platdata(bus);
+ struct sun4i_spi_plat *plat = dev_get_plat(bus);
int node = dev_of_offset(bus);
plat->base = dev_read_addr(bus);
@@ -630,8 +630,8 @@ U_BOOT_DRIVER(sun4i_spi) = {
.id = UCLASS_SPI,
.of_match = sun4i_spi_ids,
.ops = &sun4i_spi_ops,
- .ofdata_to_platdata = sun4i_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct sun4i_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct sun4i_spi_priv),
+ .of_to_plat = sun4i_spi_of_to_plat,
+ .plat_auto = sizeof(struct sun4i_spi_plat),
+ .priv_auto = sizeof(struct sun4i_spi_priv),
.probe = sun4i_spi_probe,
};
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index d5a1e3a..3fe351f 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -54,23 +54,28 @@ int dm_spi_claim_bus(struct udevice *dev)
struct dm_spi_ops *ops = spi_get_ops(bus);
struct dm_spi_bus *spi = dev_get_uclass_priv(bus);
struct spi_slave *slave = dev_get_parent_priv(dev);
- int speed;
+ uint speed, mode;
speed = slave->max_hz;
+ mode = slave->mode;
+
if (spi->max_hz) {
if (speed)
- speed = min(speed, (int)spi->max_hz);
+ speed = min(speed, spi->max_hz);
else
speed = spi->max_hz;
}
if (!speed)
speed = SPI_DEFAULT_SPEED_HZ;
- if (speed != slave->speed) {
+
+ if (speed != spi->speed || mode != spi->mode) {
int ret = spi_set_speed_mode(bus, speed, slave->mode);
if (ret)
return log_ret(ret);
- slave->speed = speed;
+
+ spi->speed = speed;
+ spi->mode = mode;
}
return log_ret(ops->claim_bus ? ops->claim_bus(dev) : 0);
@@ -158,12 +163,12 @@ int spi_write_then_read(struct spi_slave *slave, const u8 *opcode,
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
static int spi_child_post_bind(struct udevice *dev)
{
- struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev);
- if (!dev_of_valid(dev))
+ if (!dev_has_ofnode(dev))
return 0;
- return spi_slave_ofdata_to_platdata(dev, plat);
+ return spi_slave_of_to_plat(dev, plat);
}
#endif
@@ -202,7 +207,7 @@ static int spi_post_probe(struct udevice *bus)
static int spi_child_pre_probe(struct udevice *dev)
{
- struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev);
struct spi_slave *slave = dev_get_parent_priv(dev);
/*
@@ -223,7 +228,7 @@ static int spi_child_pre_probe(struct udevice *dev)
int spi_chip_select(struct udevice *dev)
{
- struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev);
return plat ? plat->cs : -ENOENT;
}
@@ -259,9 +264,9 @@ int spi_find_chip_select(struct udevice *bus, int cs, struct udevice **devp)
for (device_find_first_child(bus, &dev); dev;
device_find_next_child(&dev)) {
- struct dm_spi_slave_platdata *plat;
+ struct dm_spi_slave_plat *plat;
- plat = dev_get_parent_platdata(dev);
+ plat = dev_get_parent_plat(dev);
dev_dbg(bus, "%s: plat=%p, cs=%d\n", __func__, plat, plat->cs);
if (plat->cs == cs) {
*devp = dev;
@@ -278,7 +283,7 @@ int spi_cs_is_valid(unsigned int busnum, unsigned int cs)
struct udevice *bus;
int ret;
- ret = uclass_find_device_by_seq(UCLASS_SPI, busnum, false, &bus);
+ ret = uclass_find_device_by_seq(UCLASS_SPI, busnum, &bus);
if (ret) {
log_debug("%s: No bus %d\n", __func__, busnum);
return ret;
@@ -307,7 +312,7 @@ int spi_find_bus_and_cs(int busnum, int cs, struct udevice **busp,
struct udevice *bus, *dev;
int ret;
- ret = uclass_find_device_by_seq(UCLASS_SPI, busnum, false, &bus);
+ ret = uclass_find_device_by_seq(UCLASS_SPI, busnum, &bus);
if (ret) {
log_debug("%s: No bus %d\n", __func__, busnum);
return ret;
@@ -328,7 +333,8 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
struct udevice **busp, struct spi_slave **devp)
{
struct udevice *bus, *dev;
- struct dm_spi_slave_platdata *plat;
+ struct dm_spi_slave_plat *plat;
+ struct dm_spi_bus *bus_data;
struct spi_slave *slave;
bool created = false;
int ret;
@@ -358,7 +364,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
__func__, ret);
return ret;
}
- plat = dev_get_parent_platdata(dev);
+ plat = dev_get_parent_plat(dev);
plat->cs = cs;
if (speed) {
plat->max_hz = speed;
@@ -386,12 +392,13 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
}
slave = dev_get_parent_priv(dev);
+ bus_data = dev_get_uclass_priv(bus);
/*
* In case the operation speed is not yet established by
* dm_spi_claim_bus() ensure the bus is configured properly.
*/
- if (!slave->speed) {
+ if (!bus_data->speed) {
ret = spi_claim_bus(slave);
if (ret)
goto err;
@@ -433,11 +440,9 @@ struct spi_slave *spi_setup_slave(unsigned int busnum, unsigned int cs,
void spi_free_slave(struct spi_slave *slave)
{
device_remove(slave->dev, DM_REMOVE_NORMAL);
- slave->dev = NULL;
}
-int spi_slave_ofdata_to_platdata(struct udevice *dev,
- struct dm_spi_slave_platdata *plat)
+int spi_slave_of_to_plat(struct udevice *dev, struct dm_spi_slave_plat *plat)
{
int mode = 0;
int value;
@@ -507,10 +512,9 @@ UCLASS_DRIVER(spi) = {
#endif
.post_probe = spi_post_probe,
.child_pre_probe = spi_child_pre_probe,
- .per_device_auto_alloc_size = sizeof(struct dm_spi_bus),
- .per_child_auto_alloc_size = sizeof(struct spi_slave),
- .per_child_platdata_auto_alloc_size =
- sizeof(struct dm_spi_slave_platdata),
+ .per_device_auto = sizeof(struct dm_spi_bus),
+ .per_child_auto = sizeof(struct spi_slave),
+ .per_child_plat_auto = sizeof(struct dm_spi_slave_plat),
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
.child_post_bind = spi_child_post_bind,
#endif
diff --git a/drivers/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c
index a53b941..4400857 100644
--- a/drivers/spi/stm32_qspi.c
+++ b/drivers/spi/stm32_qspi.c
@@ -400,7 +400,7 @@ static int stm32_qspi_probe(struct udevice *bus)
static int stm32_qspi_claim_bus(struct udevice *dev)
{
struct stm32_qspi_priv *priv = dev_get_priv(dev->parent);
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
int slave_cs = slave_plat->cs;
if (slave_cs >= STM32_QSPI_MAX_CHIP)
@@ -541,6 +541,6 @@ U_BOOT_DRIVER(stm32_qspi) = {
.id = UCLASS_SPI,
.of_match = stm32_qspi_ids,
.ops = &stm32_qspi_ops,
- .priv_auto_alloc_size = sizeof(struct stm32_qspi_priv),
+ .priv_auto = sizeof(struct stm32_qspi_priv),
.probe = stm32_qspi_probe,
};
diff --git a/drivers/spi/stm32_spi.c b/drivers/spi/stm32_spi.c
index 4a0833b..720103d 100644
--- a/drivers/spi/stm32_spi.c
+++ b/drivers/spi/stm32_spi.c
@@ -362,7 +362,7 @@ static int stm32_spi_xfer(struct udevice *slave, unsigned int bitlen,
const void *dout, void *din, unsigned long flags)
{
struct udevice *bus = dev_get_parent(slave);
- struct dm_spi_slave_platdata *slave_plat;
+ struct dm_spi_slave_plat *slave_plat;
struct stm32_spi_priv *priv = dev_get_priv(bus);
u32 sr;
u32 ifcr = 0;
@@ -407,7 +407,7 @@ static int stm32_spi_xfer(struct udevice *slave, unsigned int bitlen,
debug("%s: priv->tx_len=%d priv->rx_len=%d\n", __func__,
priv->tx_len, priv->rx_len);
- slave_plat = dev_get_parent_platdata(slave);
+ slave_plat = dev_get_parent_plat(slave);
if (flags & SPI_XFER_BEGIN)
stm32_spi_set_cs(bus, slave_plat->cs, false);
@@ -615,7 +615,7 @@ U_BOOT_DRIVER(stm32_spi) = {
.id = UCLASS_SPI,
.of_match = stm32_spi_ids,
.ops = &stm32_spi_ops,
- .priv_auto_alloc_size = sizeof(struct stm32_spi_priv),
+ .priv_auto = sizeof(struct stm32_spi_priv),
.probe = stm32_spi_probe,
.remove = stm32_spi_remove,
};
diff --git a/drivers/spi/tegra114_spi.c b/drivers/spi/tegra114_spi.c
index 0e8198c..f0256d8 100644
--- a/drivers/spi/tegra114_spi.c
+++ b/drivers/spi/tegra114_spi.c
@@ -97,9 +97,9 @@ struct tegra114_spi_priv {
int last_transaction_us;
};
-static int tegra114_spi_ofdata_to_platdata(struct udevice *bus)
+static int tegra114_spi_of_to_plat(struct udevice *bus)
{
- struct tegra_spi_platdata *plat = bus->platdata;
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
plat->base = dev_read_addr(bus);
plat->periph_id = clock_decode_periph_id(bus);
@@ -124,7 +124,7 @@ static int tegra114_spi_ofdata_to_platdata(struct udevice *bus)
static int tegra114_spi_probe(struct udevice *bus)
{
- struct tegra_spi_platdata *plat = dev_get_platdata(bus);
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
struct tegra114_spi_priv *priv = dev_get_priv(bus);
struct spi_regs *regs;
ulong rate;
@@ -181,7 +181,7 @@ static int tegra114_spi_probe(struct udevice *bus)
static void spi_cs_activate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct tegra_spi_platdata *pdata = dev_get_platdata(bus);
+ struct tegra_spi_plat *pdata = dev_get_plat(bus);
struct tegra114_spi_priv *priv = dev_get_priv(bus);
/* If it's too soon to do another transaction, wait */
@@ -205,7 +205,7 @@ static void spi_cs_activate(struct udevice *dev)
static void spi_cs_deactivate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct tegra_spi_platdata *pdata = dev_get_platdata(bus);
+ struct tegra_spi_plat *pdata = dev_get_plat(bus);
struct tegra114_spi_priv *priv = dev_get_priv(bus);
setbits_le32(&priv->regs->command1, SPI_CMD1_CS_SW_VAL);
@@ -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;
@@ -352,7 +352,7 @@ static int tegra114_spi_xfer(struct udevice *dev, unsigned int bitlen,
static int tegra114_spi_set_speed(struct udevice *bus, uint speed)
{
- struct tegra_spi_platdata *plat = bus->platdata;
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
struct tegra114_spi_priv *priv = dev_get_priv(bus);
if (speed > plat->frequency)
@@ -393,8 +393,8 @@ U_BOOT_DRIVER(tegra114_spi) = {
.id = UCLASS_SPI,
.of_match = tegra114_spi_ids,
.ops = &tegra114_spi_ops,
- .ofdata_to_platdata = tegra114_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct tegra_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct tegra114_spi_priv),
+ .of_to_plat = tegra114_spi_of_to_plat,
+ .plat_auto = sizeof(struct tegra_spi_plat),
+ .priv_auto = sizeof(struct tegra114_spi_priv),
.probe = tegra114_spi_probe,
};
diff --git a/drivers/spi/tegra20_sflash.c b/drivers/spi/tegra20_sflash.c
index 771744d..4384a48 100644
--- a/drivers/spi/tegra20_sflash.c
+++ b/drivers/spi/tegra20_sflash.c
@@ -87,9 +87,9 @@ int tegra20_sflash_cs_info(struct udevice *bus, unsigned int cs,
return 0;
}
-static int tegra20_sflash_ofdata_to_platdata(struct udevice *bus)
+static int tegra20_sflash_of_to_plat(struct udevice *bus)
{
- struct tegra_spi_platdata *plat = bus->platdata;
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
@@ -116,7 +116,7 @@ static int tegra20_sflash_ofdata_to_platdata(struct udevice *bus)
static int tegra20_sflash_probe(struct udevice *bus)
{
- struct tegra_spi_platdata *plat = dev_get_platdata(bus);
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
struct tegra20_sflash_priv *priv = dev_get_priv(bus);
priv->regs = (struct spi_regs *)plat->base;
@@ -173,7 +173,7 @@ static int tegra20_sflash_claim_bus(struct udevice *dev)
static void spi_cs_activate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct tegra_spi_platdata *pdata = dev_get_platdata(bus);
+ struct tegra_spi_plat *pdata = dev_get_plat(bus);
struct tegra20_sflash_priv *priv = dev_get_priv(bus);
/* If it's too soon to do another transaction, wait */
@@ -192,7 +192,7 @@ static void spi_cs_activate(struct udevice *dev)
static void spi_cs_deactivate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct tegra_spi_platdata *pdata = dev_get_platdata(bus);
+ struct tegra_spi_plat *pdata = dev_get_plat(bus);
struct tegra20_sflash_priv *priv = dev_get_priv(bus);
/* CS is negated on Tegra, so drive a 0 to get a 1 */
@@ -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;
@@ -314,7 +314,7 @@ static int tegra20_sflash_xfer(struct udevice *dev, unsigned int bitlen,
static int tegra20_sflash_set_speed(struct udevice *bus, uint speed)
{
- struct tegra_spi_platdata *plat = bus->platdata;
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
struct tegra20_sflash_priv *priv = dev_get_priv(bus);
if (speed > plat->frequency)
@@ -353,8 +353,8 @@ U_BOOT_DRIVER(tegra20_sflash) = {
.id = UCLASS_SPI,
.of_match = tegra20_sflash_ids,
.ops = &tegra20_sflash_ops,
- .ofdata_to_platdata = tegra20_sflash_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct tegra_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct tegra20_sflash_priv),
+ .of_to_plat = tegra20_sflash_of_to_plat,
+ .plat_auto = sizeof(struct tegra_spi_plat),
+ .priv_auto = sizeof(struct tegra20_sflash_priv),
.probe = tegra20_sflash_probe,
};
diff --git a/drivers/spi/tegra20_slink.c b/drivers/spi/tegra20_slink.c
index f9846ee..3057fe1 100644
--- a/drivers/spi/tegra20_slink.c
+++ b/drivers/spi/tegra20_slink.c
@@ -93,9 +93,9 @@ struct tegra_spi_slave {
struct tegra30_spi_priv *ctrl;
};
-static int tegra30_spi_ofdata_to_platdata(struct udevice *bus)
+static int tegra30_spi_of_to_plat(struct udevice *bus)
{
- struct tegra_spi_platdata *plat = bus->platdata;
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
@@ -122,7 +122,7 @@ static int tegra30_spi_ofdata_to_platdata(struct udevice *bus)
static int tegra30_spi_probe(struct udevice *bus)
{
- struct tegra_spi_platdata *plat = dev_get_platdata(bus);
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
struct tegra30_spi_priv *priv = dev_get_priv(bus);
priv->regs = (struct spi_regs *)plat->base;
@@ -167,7 +167,7 @@ static int tegra30_spi_claim_bus(struct udevice *dev)
static void spi_cs_activate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct tegra_spi_platdata *pdata = dev_get_platdata(bus);
+ struct tegra_spi_plat *pdata = dev_get_plat(bus);
struct tegra30_spi_priv *priv = dev_get_priv(bus);
/* If it's too soon to do another transaction, wait */
@@ -186,7 +186,7 @@ static void spi_cs_activate(struct udevice *dev)
static void spi_cs_deactivate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct tegra_spi_platdata *pdata = dev_get_platdata(bus);
+ struct tegra_spi_plat *pdata = dev_get_plat(bus);
struct tegra30_spi_priv *priv = dev_get_priv(bus);
/* CS is negated on Tegra, so drive a 0 to get a 1 */
@@ -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;
@@ -314,7 +314,7 @@ static int tegra30_spi_xfer(struct udevice *dev, unsigned int bitlen,
static int tegra30_spi_set_speed(struct udevice *bus, uint speed)
{
- struct tegra_spi_platdata *plat = bus->platdata;
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
struct tegra30_spi_priv *priv = dev_get_priv(bus);
if (speed > plat->frequency)
@@ -372,8 +372,8 @@ U_BOOT_DRIVER(tegra30_spi) = {
.id = UCLASS_SPI,
.of_match = tegra30_spi_ids,
.ops = &tegra30_spi_ops,
- .ofdata_to_platdata = tegra30_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct tegra_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct tegra30_spi_priv),
+ .of_to_plat = tegra30_spi_of_to_plat,
+ .plat_auto = sizeof(struct tegra_spi_plat),
+ .priv_auto = sizeof(struct tegra30_spi_priv),
.probe = tegra30_spi_probe,
};
diff --git a/drivers/spi/tegra210_qspi.c b/drivers/spi/tegra210_qspi.c
index ae16b45..b464b9c 100644
--- a/drivers/spi/tegra210_qspi.c
+++ b/drivers/spi/tegra210_qspi.c
@@ -97,9 +97,9 @@ struct tegra210_qspi_priv {
int last_transaction_us;
};
-static int tegra210_qspi_ofdata_to_platdata(struct udevice *bus)
+static int tegra210_qspi_of_to_plat(struct udevice *bus)
{
- struct tegra_spi_platdata *plat = bus->platdata;
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
plat->base = dev_read_addr(bus);
plat->periph_id = clock_decode_periph_id(bus);
@@ -125,7 +125,7 @@ static int tegra210_qspi_ofdata_to_platdata(struct udevice *bus)
static int tegra210_qspi_probe(struct udevice *bus)
{
- struct tegra_spi_platdata *plat = dev_get_platdata(bus);
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
struct tegra210_qspi_priv *priv = dev_get_priv(bus);
priv->regs = (struct qspi_regs *)plat->base;
@@ -174,7 +174,7 @@ static int tegra210_qspi_claim_bus(struct udevice *dev)
static void spi_cs_activate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct tegra_spi_platdata *pdata = dev_get_platdata(bus);
+ struct tegra_spi_plat *pdata = dev_get_plat(bus);
struct tegra210_qspi_priv *priv = dev_get_priv(bus);
/* If it's too soon to do another transaction, wait */
@@ -198,7 +198,7 @@ static void spi_cs_activate(struct udevice *dev)
static void spi_cs_deactivate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct tegra_spi_platdata *pdata = dev_get_platdata(bus);
+ struct tegra_spi_plat *pdata = dev_get_plat(bus);
struct tegra210_qspi_priv *priv = dev_get_priv(bus);
setbits_le32(&priv->regs->command1, QSPI_CMD1_CS_SW_VAL);
@@ -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;
@@ -380,7 +380,7 @@ static int tegra210_qspi_xfer(struct udevice *dev, unsigned int bitlen,
static int tegra210_qspi_set_speed(struct udevice *bus, uint speed)
{
- struct tegra_spi_platdata *plat = bus->platdata;
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
struct tegra210_qspi_priv *priv = dev_get_priv(bus);
if (speed > plat->frequency)
@@ -422,9 +422,9 @@ U_BOOT_DRIVER(tegra210_qspi) = {
.id = UCLASS_SPI,
.of_match = tegra210_qspi_ids,
.ops = &tegra210_qspi_ops,
- .ofdata_to_platdata = tegra210_qspi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct tegra_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct tegra210_qspi_priv),
- .per_child_auto_alloc_size = sizeof(struct spi_slave),
+ .of_to_plat = tegra210_qspi_of_to_plat,
+ .plat_auto = sizeof(struct tegra_spi_plat),
+ .priv_auto = sizeof(struct tegra210_qspi_priv),
+ .per_child_auto = sizeof(struct spi_slave),
.probe = tegra210_qspi_probe,
};
diff --git a/drivers/spi/tegra_spi.h b/drivers/spi/tegra_spi.h
index e997d66..ab69ea4 100644
--- a/drivers/spi/tegra_spi.h
+++ b/drivers/spi/tegra_spi.h
@@ -3,7 +3,7 @@
* (C) Copyright 2014 Google, Inc
*/
-struct tegra_spi_platdata {
+struct tegra_spi_plat {
enum periph_id periph_id;
int frequency; /* Default clock frequency, -1 for none */
ulong base;
diff --git a/drivers/spi/ti_qspi.c b/drivers/spi/ti_qspi.c
index 5fdbb49..7c3b1f7 100644
--- a/drivers/spi/ti_qspi.c
+++ b/drivers/spi/ti_qspi.c
@@ -154,7 +154,7 @@ static void ti_qspi_ctrl_mode_mmap(void *ctrl_mod_mmap, int cs, bool enable)
static int ti_qspi_xfer(struct udevice *dev, unsigned int bitlen,
const void *dout, void *din, unsigned long flags)
{
- struct dm_spi_slave_platdata *slave = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave = dev_get_parent_plat(dev);
struct ti_qspi_priv *priv;
struct udevice *bus;
uint words = bitlen >> 3; /* fixed 8-bit word length */
@@ -323,7 +323,7 @@ static int ti_qspi_set_mode(struct udevice *bus, uint mode)
static int ti_qspi_exec_mem_op(struct spi_slave *slave,
const struct spi_mem_op *op)
{
- struct dm_spi_slave_platdata *slave_plat;
+ struct dm_spi_slave_plat *slave_plat;
struct ti_qspi_priv *priv;
struct udevice *bus;
u32 from = 0;
@@ -331,7 +331,7 @@ static int ti_qspi_exec_mem_op(struct spi_slave *slave,
bus = slave->dev->parent;
priv = dev_get_priv(bus);
- slave_plat = dev_get_parent_platdata(slave->dev);
+ slave_plat = dev_get_parent_plat(slave->dev);
/* Only optimize read path. */
if (!op->data.nbytes || op->data.dir != SPI_MEM_DATA_IN ||
@@ -355,7 +355,7 @@ static int ti_qspi_exec_mem_op(struct spi_slave *slave,
static int ti_qspi_claim_bus(struct udevice *dev)
{
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
struct ti_qspi_priv *priv;
struct udevice *bus;
@@ -384,7 +384,7 @@ static int ti_qspi_claim_bus(struct udevice *dev)
static int ti_qspi_release_bus(struct udevice *dev)
{
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
struct ti_qspi_priv *priv;
struct udevice *bus;
@@ -452,7 +452,7 @@ static void *map_syscon_chipselects(struct udevice *bus)
#endif
}
-static int ti_qspi_ofdata_to_platdata(struct udevice *bus)
+static int ti_qspi_of_to_plat(struct udevice *bus)
{
struct ti_qspi_priv *priv = dev_get_priv(bus);
const void *blob = gd->fdt_blob;
@@ -504,7 +504,7 @@ U_BOOT_DRIVER(ti_qspi) = {
.id = UCLASS_SPI,
.of_match = ti_qspi_ids,
.ops = &ti_qspi_ops,
- .ofdata_to_platdata = ti_qspi_ofdata_to_platdata,
- .priv_auto_alloc_size = sizeof(struct ti_qspi_priv),
+ .of_to_plat = ti_qspi_of_to_plat,
+ .priv_auto = sizeof(struct ti_qspi_priv),
.probe = ti_qspi_probe,
};
diff --git a/drivers/spi/uniphier_spi.c b/drivers/spi/uniphier_spi.c
index b645668..e47ed5b 100644
--- a/drivers/spi/uniphier_spi.c
+++ b/drivers/spi/uniphier_spi.c
@@ -68,7 +68,7 @@ DECLARE_GLOBAL_DATA_PTR;
#define SSI_CLK 50000000 /* internal I/O clock: 50MHz */
-struct uniphier_spi_platdata {
+struct uniphier_spi_plat {
void __iomem *base;
u32 frequency; /* input frequency */
u32 speed_hz;
@@ -113,7 +113,7 @@ static void uniphier_spi_regdump(struct uniphier_spi_priv *priv)
static void spi_cs_activate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct uniphier_spi_platdata *plat = bus->platdata;
+ struct uniphier_spi_plat *plat = dev_get_plat(bus);
struct uniphier_spi_priv *priv = dev_get_priv(bus);
ulong delay_us; /* The delay completed so far */
u32 val;
@@ -139,7 +139,7 @@ static void spi_cs_activate(struct udevice *dev)
static void spi_cs_deactivate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct uniphier_spi_platdata *plat = bus->platdata;
+ struct uniphier_spi_plat *plat = dev_get_plat(bus);
struct uniphier_spi_priv *priv = dev_get_priv(bus);
u32 val;
@@ -279,7 +279,7 @@ static int uniphier_spi_xfer(struct udevice *dev, unsigned int bitlen,
static int uniphier_spi_set_speed(struct udevice *bus, uint speed)
{
- struct uniphier_spi_platdata *plat = bus->platdata;
+ struct uniphier_spi_plat *plat = dev_get_plat(bus);
struct uniphier_spi_priv *priv = dev_get_priv(bus);
u32 val, ckdiv;
@@ -362,9 +362,9 @@ static int uniphier_spi_set_mode(struct udevice *bus, uint mode)
return 0;
}
-static int uniphier_spi_ofdata_to_platdata(struct udevice *bus)
+static int uniphier_spi_of_to_plat(struct udevice *bus)
{
- struct uniphier_spi_platdata *plat = bus->platdata;
+ struct uniphier_spi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
@@ -383,7 +383,7 @@ static int uniphier_spi_ofdata_to_platdata(struct udevice *bus)
static int uniphier_spi_probe(struct udevice *bus)
{
- struct uniphier_spi_platdata *plat = dev_get_platdata(bus);
+ struct uniphier_spi_plat *plat = dev_get_plat(bus);
struct uniphier_spi_priv *priv = dev_get_priv(bus);
priv->base = plat->base;
@@ -411,8 +411,8 @@ U_BOOT_DRIVER(uniphier_spi) = {
.id = UCLASS_SPI,
.of_match = uniphier_spi_ids,
.ops = &uniphier_spi_ops,
- .ofdata_to_platdata = uniphier_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct uniphier_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct uniphier_spi_priv),
+ .of_to_plat = uniphier_spi_of_to_plat,
+ .plat_auto = sizeof(struct uniphier_spi_plat),
+ .priv_auto = sizeof(struct uniphier_spi_priv),
.probe = uniphier_spi_probe,
};
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index 47a5571..0274afd 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -211,7 +211,7 @@ static void xilinx_spi_startup_block(struct udevice *dev, unsigned int bytes,
struct udevice *bus = dev_get_parent(dev);
struct xilinx_spi_priv *priv = dev_get_priv(bus);
struct xilinx_spi_regs *regs = priv->regs;
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
const unsigned char *txp = dout;
unsigned char *rxp = din;
u32 reg;
@@ -244,7 +244,7 @@ static int xilinx_spi_xfer(struct udevice *dev, unsigned int bitlen,
struct udevice *bus = dev_get_parent(dev);
struct xilinx_spi_priv *priv = dev_get_priv(bus);
struct xilinx_spi_regs *regs = priv->regs;
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
/* assume spi core configured to do 8 bit transfers */
unsigned int bytes = bitlen / XILSPI_MAX_XFER_BITS;
const unsigned char *txp = dout;
@@ -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;
@@ -364,6 +364,6 @@ U_BOOT_DRIVER(xilinx_spi) = {
.id = UCLASS_SPI,
.of_match = xilinx_spi_ids,
.ops = &xilinx_spi_ops,
- .priv_auto_alloc_size = sizeof(struct xilinx_spi_priv),
+ .priv_auto = sizeof(struct xilinx_spi_priv),
.probe = xilinx_spi_probe,
};
diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c
index f2eddec..845f2d2 100644
--- a/drivers/spi/zynq_qspi.c
+++ b/drivers/spi/zynq_qspi.c
@@ -76,7 +76,7 @@ struct zynq_qspi_regs {
};
/* zynq qspi platform data */
-struct zynq_qspi_platdata {
+struct zynq_qspi_plat {
struct zynq_qspi_regs *regs;
u32 frequency; /* input frequency */
u32 speed_hz;
@@ -98,9 +98,9 @@ struct zynq_qspi_priv {
unsigned cs_change:1;
};
-static int zynq_qspi_ofdata_to_platdata(struct udevice *bus)
+static int zynq_qspi_of_to_plat(struct udevice *bus)
{
- struct zynq_qspi_platdata *plat = bus->platdata;
+ struct zynq_qspi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
@@ -171,7 +171,7 @@ static void zynq_qspi_init_hw(struct zynq_qspi_priv *priv)
static int zynq_qspi_probe(struct udevice *bus)
{
- struct zynq_qspi_platdata *plat = dev_get_platdata(bus);
+ struct zynq_qspi_plat *plat = dev_get_plat(bus);
struct zynq_qspi_priv *priv = dev_get_priv(bus);
struct clk clk;
unsigned long clock;
@@ -560,7 +560,7 @@ static int zynq_qspi_xfer(struct udevice *dev, unsigned int bitlen,
{
struct udevice *bus = dev->parent;
struct zynq_qspi_priv *priv = dev_get_priv(bus);
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
priv->cs = slave_plat->cs;
priv->tx_buf = dout;
@@ -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.
@@ -592,7 +592,7 @@ static int zynq_qspi_xfer(struct udevice *dev, unsigned int bitlen,
static int zynq_qspi_set_speed(struct udevice *bus, uint speed)
{
- struct zynq_qspi_platdata *plat = bus->platdata;
+ struct zynq_qspi_plat *plat = dev_get_plat(bus);
struct zynq_qspi_priv *priv = dev_get_priv(bus);
struct zynq_qspi_regs *regs = priv->regs;
uint32_t confr;
@@ -666,8 +666,8 @@ U_BOOT_DRIVER(zynq_qspi) = {
.id = UCLASS_SPI,
.of_match = zynq_qspi_ids,
.ops = &zynq_qspi_ops,
- .ofdata_to_platdata = zynq_qspi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct zynq_qspi_platdata),
- .priv_auto_alloc_size = sizeof(struct zynq_qspi_priv),
+ .of_to_plat = zynq_qspi_of_to_plat,
+ .plat_auto = sizeof(struct zynq_qspi_plat),
+ .priv_auto = sizeof(struct zynq_qspi_priv),
.probe = zynq_qspi_probe,
};
diff --git a/drivers/spi/zynq_spi.c b/drivers/spi/zynq_spi.c
index cb911c3..2971e55 100644
--- a/drivers/spi/zynq_spi.c
+++ b/drivers/spi/zynq_spi.c
@@ -55,7 +55,7 @@ struct zynq_spi_regs {
/* zynq spi platform data */
-struct zynq_spi_platdata {
+struct zynq_spi_plat {
struct zynq_spi_regs *regs;
u32 frequency; /* input frequency */
u32 speed_hz;
@@ -73,9 +73,9 @@ struct zynq_spi_priv {
u32 freq; /* required frequency */
};
-static int zynq_spi_ofdata_to_platdata(struct udevice *bus)
+static int zynq_spi_of_to_plat(struct udevice *bus)
{
- struct zynq_spi_platdata *plat = bus->platdata;
+ struct zynq_spi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
@@ -121,7 +121,7 @@ static void zynq_spi_init_hw(struct zynq_spi_priv *priv)
static int zynq_spi_probe(struct udevice *bus)
{
- struct zynq_spi_platdata *plat = dev_get_platdata(bus);
+ struct zynq_spi_plat *plat = dev_get_plat(bus);
struct zynq_spi_priv *priv = dev_get_priv(bus);
struct clk clk;
unsigned long clock;
@@ -162,7 +162,7 @@ static int zynq_spi_probe(struct udevice *bus)
static void spi_cs_activate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct zynq_spi_platdata *plat = bus->platdata;
+ struct zynq_spi_plat *plat = dev_get_plat(bus);
struct zynq_spi_priv *priv = dev_get_priv(bus);
struct zynq_spi_regs *regs = priv->regs;
u32 cr;
@@ -193,7 +193,7 @@ static void spi_cs_activate(struct udevice *dev)
static void spi_cs_deactivate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct zynq_spi_platdata *plat = bus->platdata;
+ struct zynq_spi_plat *plat = dev_get_plat(bus);
struct zynq_spi_priv *priv = dev_get_priv(bus);
struct zynq_spi_regs *regs = priv->regs;
@@ -234,7 +234,7 @@ static int zynq_spi_xfer(struct udevice *dev, unsigned int bitlen,
struct udevice *bus = dev->parent;
struct zynq_spi_priv *priv = dev_get_priv(bus);
struct zynq_spi_regs *regs = priv->regs;
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+ struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
u32 len = bitlen / 8;
u32 tx_len = len, rx_len = len, tx_tvl;
const u8 *tx_buf = dout;
@@ -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");
@@ -296,7 +296,7 @@ static int zynq_spi_xfer(struct udevice *dev, unsigned int bitlen,
static int zynq_spi_set_speed(struct udevice *bus, uint speed)
{
- struct zynq_spi_platdata *plat = bus->platdata;
+ struct zynq_spi_plat *plat = dev_get_plat(bus);
struct zynq_spi_priv *priv = dev_get_priv(bus);
struct zynq_spi_regs *regs = priv->regs;
uint32_t confr;
@@ -371,8 +371,8 @@ U_BOOT_DRIVER(zynq_spi) = {
.id = UCLASS_SPI,
.of_match = zynq_spi_ids,
.ops = &zynq_spi_ops,
- .ofdata_to_platdata = zynq_spi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct zynq_spi_platdata),
- .priv_auto_alloc_size = sizeof(struct zynq_spi_priv),
+ .of_to_plat = zynq_spi_of_to_plat,
+ .plat_auto = sizeof(struct zynq_spi_plat),
+ .priv_auto = sizeof(struct zynq_spi_priv),
.probe = zynq_spi_probe,
};
diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c
index e0e6687..efcbd05 100644
--- a/drivers/spi/zynqmp_gqspi.c
+++ b/drivers/spi/zynqmp_gqspi.c
@@ -156,7 +156,7 @@ struct zynqmp_qspi_dma_regs {
DECLARE_GLOBAL_DATA_PTR;
-struct zynqmp_qspi_platdata {
+struct zynqmp_qspi_plat {
struct zynqmp_qspi_regs *regs;
struct zynqmp_qspi_dma_regs *dma_regs;
u32 frequency;
@@ -175,9 +175,9 @@ struct zynqmp_qspi_priv {
unsigned int cs_change:1;
};
-static int zynqmp_qspi_ofdata_to_platdata(struct udevice *bus)
+static int zynqmp_qspi_of_to_plat(struct udevice *bus)
{
- struct zynqmp_qspi_platdata *plat = bus->platdata;
+ struct zynqmp_qspi_plat *plat = dev_get_plat(bus);
debug("%s\n", __func__);
@@ -255,7 +255,7 @@ static void zynqmp_qspi_chipselect(struct zynqmp_qspi_priv *priv, int is_on)
void zynqmp_qspi_set_tapdelay(struct udevice *bus, u32 baudrateval)
{
- struct zynqmp_qspi_platdata *plat = bus->platdata;
+ struct zynqmp_qspi_plat *plat = dev_get_plat(bus);
struct zynqmp_qspi_priv *priv = dev_get_priv(bus);
struct zynqmp_qspi_regs *regs = priv->regs;
u32 tapdlybypass = 0, lpbkdlyadj = 0, datadlyadj = 0, clk_rate;
@@ -295,7 +295,7 @@ void zynqmp_qspi_set_tapdelay(struct udevice *bus, u32 baudrateval)
static int zynqmp_qspi_set_speed(struct udevice *bus, uint speed)
{
- struct zynqmp_qspi_platdata *plat = bus->platdata;
+ struct zynqmp_qspi_plat *plat = dev_get_plat(bus);
struct zynqmp_qspi_priv *priv = dev_get_priv(bus);
struct zynqmp_qspi_regs *regs = priv->regs;
u32 confr;
@@ -333,7 +333,7 @@ static int zynqmp_qspi_set_speed(struct udevice *bus, uint speed)
static int zynqmp_qspi_probe(struct udevice *bus)
{
- struct zynqmp_qspi_platdata *plat = dev_get_platdata(bus);
+ struct zynqmp_qspi_plat *plat = dev_get_plat(bus);
struct zynqmp_qspi_priv *priv = dev_get_priv(bus);
struct clk clk;
unsigned long clock;
@@ -429,10 +429,8 @@ static int zynqmp_qspi_fill_tx_fifo(struct zynqmp_qspi_priv *priv, u32 size)
data |= GENMASK(31, 16);
break;
case 3:
- data = *((u16 *)buf);
- buf += 2;
- data |= (*((u8 *)buf) << 16);
- buf += 1;
+ data = *buf;
+ buf += 3;
data |= GENMASK(31, 24);
break;
}
@@ -727,8 +725,8 @@ U_BOOT_DRIVER(zynqmp_qspi) = {
.id = UCLASS_SPI,
.of_match = zynqmp_qspi_ids,
.ops = &zynqmp_qspi_ops,
- .ofdata_to_platdata = zynqmp_qspi_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct zynqmp_qspi_platdata),
- .priv_auto_alloc_size = sizeof(struct zynqmp_qspi_priv),
+ .of_to_plat = zynqmp_qspi_of_to_plat,
+ .plat_auto = sizeof(struct zynqmp_qspi_plat),
+ .priv_auto = sizeof(struct zynqmp_qspi_priv),
.probe = zynqmp_qspi_probe,
};