spi: cadence_qspi: Add support for Versal NET platform
[platform/kernel/u-boot.git] / drivers / spi / bcm63xx_spi.c
index 4d19e03..0600d56 100644 (file)
@@ -10,6 +10,8 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
+#include <malloc.h>
 #include <spi.h>
 #include <reset.h>
 #include <wait_bit.h>
@@ -130,7 +132,7 @@ static int bcm63xx_spi_cs_info(struct udevice *bus, uint cs,
 
        if (cs >= priv->num_cs) {
                printf("no cs %u\n", cs);
-               return -ENODEV;
+               return -EINVAL;
        }
 
        return 0;
@@ -234,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;
 
@@ -349,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) {
@@ -389,9 +391,7 @@ static int bcm63xx_spi_probe(struct udevice *dev)
        if (ret < 0)
                return ret;
 
-       ret = clk_free(&clk);
-       if (ret < 0)
-               return ret;
+       clk_free(&clk);
 
        /* perform reset */
        ret = reset_get_by_index(dev, 0, &rst_ctl);
@@ -420,7 +420,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,
 };