diff options
author | Jagan Teki <jagan@amarulasolutions.com> | 2018-03-15 17:03:22 +0530 |
---|---|---|
committer | Jagan Teki <jagan@amarulasolutions.com> | 2018-08-03 11:09:53 +0530 |
commit | f5ff46f6e5f88e1ee276963105d328a1bda6269a (patch) | |
tree | 1a62ce322718f2cab69acb6732761a174be23cdb /drivers/spi/kirkwood_spi.c | |
parent | 04d57b1d588aeda00f308028aad6239467f24923 (diff) | |
download | u-boot-f5ff46f6e5f88e1ee276963105d328a1bda6269a.tar.gz |
spi: kirkwood: Get drvdata in .ofdata_to_platdata
Get the is_errata_50mhz_ac in .ofdata_to_platdata, and
reuse it in .set_mode this can eventually initialized
dt code at once and adding room to add platdata.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Diffstat (limited to 'drivers/spi/kirkwood_spi.c')
-rw-r--r-- | drivers/spi/kirkwood_spi.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c index d6944af7e7..4aa2c5481e 100644 --- a/drivers/spi/kirkwood_spi.c +++ b/drivers/spi/kirkwood_spi.c @@ -248,6 +248,7 @@ struct mvebu_spi_dev { struct mvebu_spi_platdata { struct kwspi_registers *spireg; + bool is_errata_50mhz_ac; }; struct mvebu_spi_priv { @@ -309,7 +310,6 @@ static int mvebu_spi_set_mode(struct udevice *bus, uint mode) { struct mvebu_spi_platdata *plat = dev_get_platdata(bus); struct kwspi_registers *reg = plat->spireg; - const struct mvebu_spi_dev *drvdata; u32 data = readl(®->cfg); data &= ~(KWSPI_CPHA | KWSPI_CPOL | KWSPI_RXLSBF | KWSPI_TXLSBF); @@ -323,8 +323,7 @@ static int mvebu_spi_set_mode(struct udevice *bus, uint mode) writel(data, ®->cfg); - drvdata = (struct mvebu_spi_dev *)dev_get_driver_data(bus); - if (drvdata->is_errata_50mhz_ac) + if (plat->is_errata_50mhz_ac) mvebu_spi_50mhz_ac_timing_erratum(bus, mode); return 0; @@ -367,8 +366,11 @@ static int mvebu_spi_probe(struct udevice *bus) static int mvebu_spi_ofdata_to_platdata(struct udevice *bus) { struct mvebu_spi_platdata *plat = dev_get_platdata(bus); + const struct mvebu_spi_dev *drvdata = + (struct mvebu_spi_dev *)dev_get_driver_data(bus); plat->spireg = (struct kwspi_registers *)devfdt_get_addr(bus); + plat->is_errata_50mhz_ac = drvdata->is_errata_50mhz_ac; return 0; } |