From: Jagan Teki Date: Thu, 15 Mar 2018 11:33:22 +0000 (+0530) Subject: spi: kirkwood: Get drvdata in .ofdata_to_platdata X-Git-Tag: v2018.09-rc2~69^2~2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f5ff46f6e5f88e1ee276963105d328a1bda6269a;p=oweals%2Fu-boot.git 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 --- 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; }