]> Git Repo - J-u-boot.git/blobdiff - drivers/spi/pic32_spi.c
Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""
[J-u-boot.git] / drivers / spi / pic32_spi.c
index 78d78bc54bad97bf99aa544d12cd7d64bfe793d5..45f07f083da8f9576c7eb2f897507b7eb4d5d6fb 100644 (file)
@@ -1,15 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Microchip PIC32 SPI controller driver.
  *
  * Copyright (c) 2015, Microchip Technology Inc.
  *      Purna Chandra Mandal <[email protected]>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
+#include <asm/global_data.h>
+#include <linux/bitops.h>
 #include <linux/compat.h>
 #include <malloc.h>
 #include <spi.h>
@@ -235,7 +237,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;
@@ -243,10 +245,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);
 
@@ -383,7 +385,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;
@@ -414,7 +416,7 @@ static int pic32_spi_probe(struct udevice *bus)
         * of the ongoing transfer. To avoid this sort of error we will drive
         * /CS manually by toggling cs-gpio pins.
         */
-       ret = gpio_request_by_name_nodev(gd->fdt_blob, node, "cs-gpios", 0,
+       ret = gpio_request_by_name_nodev(offset_to_ofnode(node), "cs-gpios", 0,
                                         &priv->cs_gpio, GPIOD_IS_OUT);
        if (ret) {
                printf("pic32-spi: error, cs-gpios not found\n");
@@ -443,6 +445,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,
 };
This page took 0.028488 seconds and 4 git commands to generate.