sunxi: board: Add H616 MMC2 pins
authorAndre Przywara <andre.przywara@arm.com>
Sun, 25 Apr 2021 23:38:04 +0000 (00:38 +0100)
committerAndre Przywara <andre.przywara@arm.com>
Sat, 10 Jul 2021 00:22:09 +0000 (01:22 +0100)
We hardcode the pinctrl setting for the MMC controllers in boards.c,
since we need them also in the SPL, where there is no DT yet.

Add the respective setting for the H616 SoC, to enable eMMC on boards
with this SoC as well.
Also to make diagnosing this problem easier, print a warning if a board
tries to setup MMC2 pins without a respective SoC setting being defined.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan at amarulasolutions.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec at siol.net>
board/sunxi/board.c

index 21651a1..67acc01 100644 (file)
@@ -555,6 +555,17 @@ static void mmc_pinmux_setup(int sdc)
                        sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
                        sunxi_gpio_set_drv(pin, 2);
                }
+#elif defined(CONFIG_MACH_SUN50I_H616)
+               /* SDC2: PC0-PC1, PC5-PC6, PC8-PC11, PC13-PC16 */
+               for (pin = SUNXI_GPC(0); pin <= SUNXI_GPC(16); pin++) {
+                       if (pin > SUNXI_GPC(1) && pin < SUNXI_GPC(5))
+                               continue;
+                       if (pin == SUNXI_GPC(7) || pin == SUNXI_GPC(12))
+                               continue;
+                       sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2);
+                       sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
+                       sunxi_gpio_set_drv(pin, 3);
+               }
 #elif defined(CONFIG_MACH_SUN9I)
                /* SDC2: PC6-PC16 */
                for (pin = SUNXI_GPC(6); pin <= SUNXI_GPC(16); pin++) {
@@ -562,6 +573,8 @@ static void mmc_pinmux_setup(int sdc)
                        sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
                        sunxi_gpio_set_drv(pin, 2);
                }
+#else
+               puts("ERROR: No pinmux setup defined for MMC2!\n");
 #endif
                break;