]> Git Repo - J-u-boot.git/blobdiff - drivers/spi/nxp_fspi.c
dm: treewide: Rename 'platdata' variables to just 'plat'
[J-u-boot.git] / drivers / spi / nxp_fspi.c
index a2fab7ad0a255bdc909a4fc994008315a2ac35d0..f41134172cc8541b887b859a351744deea3d27f3 100644 (file)
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <clk.h>
+#include <dm.h>
+#include <dm/device_compat.h>
 #include <malloc.h>
 #include <spi.h>
 #include <spi-mem.h>
-#include <dm.h>
-#include <clk.h>
+#include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/kernel.h>
 #include <linux/sizes.h>
 #include <linux/iopoll.h>
 #include <linux/bug.h>
+#include <linux/err.h>
 
 /*
  * The driver only uses one single LUT entry, that is updated on
@@ -420,7 +423,7 @@ static bool nxp_fspi_supports_op(struct spi_slave *slave,
        return true;
 }
 
-/* Instead of busy looping invoke readl_poll_timeout functionality. */
+/* Instead of busy looping invoke readl_poll_sleep_timeout functionality. */
 static int fspi_readl_poll_tout(struct nxp_fspi *f, void __iomem *base,
                                u32 mask, u32 delay_us,
                                u32 timeout_us, bool c)
@@ -431,11 +434,11 @@ static int fspi_readl_poll_tout(struct nxp_fspi *f, void __iomem *base,
                mask = (u32)cpu_to_be32(mask);
 
        if (c)
-               return readl_poll_timeout(base, reg, (reg & mask),
-                                         timeout_us);
+               return readl_poll_sleep_timeout(base, reg, (reg & mask),
+                                               delay_us, timeout_us);
        else
-               return readl_poll_timeout(base, reg, !(reg & mask),
-                                         timeout_us);
+               return readl_poll_sleep_timeout(base, reg, !(reg & mask),
+                                               delay_us, timeout_us);
 }
 
 /*
@@ -518,7 +521,7 @@ static void nxp_fspi_prepare_lut(struct nxp_fspi *f,
        fspi_writel(f, FSPI_LCKER_LOCK, f->iobase + FSPI_LCKCR);
 }
 
-#if CONFIG_IS_ENABLED(CONFIG_CLK)
+#if CONFIG_IS_ENABLED(CLK)
 static int nxp_fspi_clk_prep_enable(struct nxp_fspi *f)
 {
        int ret;
@@ -806,7 +809,7 @@ static int nxp_fspi_default_setup(struct nxp_fspi *f)
        int ret, i;
        u32 reg;
 
-#if CONFIG_IS_ENABLED(CONFIG_CLK)
+#if CONFIG_IS_ENABLED(CLK)
        /* disable and unprepare clock to avoid glitch pass to controller */
        nxp_fspi_clk_disable_unprep(f);
 
@@ -884,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_platdata *slave_plat = dev_get_parent_plat(dev);
 
        bus = dev->parent;
        f = dev_get_priv(bus);
@@ -896,7 +899,7 @@ static int nxp_fspi_claim_bus(struct udevice *dev)
 
 static int nxp_fspi_set_speed(struct udevice *bus, uint speed)
 {
-#if CONFIG_IS_ENABLED(CONFIG_CLK)
+#if CONFIG_IS_ENABLED(CLK)
        struct nxp_fspi *f = dev_get_priv(bus);
        int ret;
 
@@ -922,7 +925,7 @@ static int nxp_fspi_set_mode(struct udevice *bus, uint mode)
 static int nxp_fspi_ofdata_to_platdata(struct udevice *bus)
 {
        struct nxp_fspi *f = dev_get_priv(bus);
-#if CONFIG_IS_ENABLED(CONFIG_CLK)
+#if CONFIG_IS_ENABLED(CLK)
        int ret;
 #endif
 
@@ -948,7 +951,7 @@ static int nxp_fspi_ofdata_to_platdata(struct udevice *bus)
        f->ahb_addr = map_physmem(ahb_addr, ahb_size, MAP_NOCACHE);
        f->memmap_phy_size = ahb_size;
 
-#if CONFIG_IS_ENABLED(CONFIG_CLK)
+#if CONFIG_IS_ENABLED(CLK)
        ret = clk_get_by_name(bus, "fspi_en", &f->clk_en);
        if (ret) {
                dev_err(bus, "failed to get fspi_en clock\n");
@@ -991,6 +994,6 @@ U_BOOT_DRIVER(nxp_fspi) = {
        .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),
+       .priv_auto      = sizeof(struct nxp_fspi),
        .probe  = nxp_fspi_probe,
 };
This page took 0.030213 seconds and 4 git commands to generate.