]> git.sur5r.net Git - u-boot/blobdiff - drivers/gpio/mxc_gpio.c
cfi_flash: Fix whitespace with casting
[u-boot] / drivers / gpio / mxc_gpio.c
index 2012f994c8cda7dda9ffc7d4d64cd6c3d536df97..cfa620bceb3fe382d9b7846d033c568d19718c7d 100644 (file)
@@ -40,16 +40,22 @@ static unsigned long gpio_ports[] = {
        [1] = GPIO2_BASE_ADDR,
        [2] = GPIO3_BASE_ADDR,
 #if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX51) || \
-               defined(CONFIG_MX53) || defined(CONFIG_MX6)
+               defined(CONFIG_MX53) || defined(CONFIG_MX6) || \
+               defined(CONFIG_MX7)
        [3] = GPIO4_BASE_ADDR,
 #endif
-#if defined(CONFIG_MX27) || defined(CONFIG_MX53) || defined(CONFIG_MX6)
+#if defined(CONFIG_MX27) || defined(CONFIG_MX53) || defined(CONFIG_MX6) || \
+               defined(CONFIG_MX7)
        [4] = GPIO5_BASE_ADDR,
+#if !(defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL))
        [5] = GPIO6_BASE_ADDR,
 #endif
-#if defined(CONFIG_MX53) || defined(CONFIG_MX6)
+#endif
+#if defined(CONFIG_MX53) || defined(CONFIG_MX6) || defined(CONFIG_MX7)
+#if !(defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL))
        [6] = GPIO7_BASE_ADDR,
 #endif
+#endif
 };
 
 static int mxc_gpio_direction(unsigned int gpio,
@@ -296,15 +302,20 @@ static int mxc_gpio_bind(struct udevice *dev)
        if (plat)
                return 0;
 
-       addr = dev_get_addr(dev);
+       addr = devfdt_get_addr(dev);
        if (addr == FDT_ADDR_T_NONE)
-               return -ENODEV;
+               return -EINVAL;
 
        /*
         * TODO:
         * When every board is converted to driver model and DT is supported,
         * this can be done by auto-alloc feature, but not using calloc
         * to alloc memory for platdata.
+        *
+        * For example mxc_plat below uses platform data rather than device
+        * tree.
+        *
+        * NOTE: DO NOT COPY this code if you are using device tree.
         */
        plat = calloc(1, sizeof(*plat));
        if (!plat)
@@ -332,7 +343,7 @@ U_BOOT_DRIVER(gpio_mxc) = {
        .bind   = mxc_gpio_bind,
 };
 
-#ifndef CONFIG_OF_CONTROL
+#if !CONFIG_IS_ENABLED(OF_CONTROL)
 static const struct mxc_gpio_plat mxc_plat[] = {
        { 0, (struct gpio_regs *)GPIO1_BASE_ADDR },
        { 1, (struct gpio_regs *)GPIO2_BASE_ADDR },