[U-Boot] [PATCH v2 4/4] mmc: meson: add MMC support in Odroid C2 board init / config
Heiner Kallweit
hkallweit1 at gmail.com
Wed Jan 25 20:54:13 CET 2017
Add MMC support in Odroid C2 board init code and config.
Signed-off-by: Heiner Kallweit <hkallweit1 at gmail.com>
---
v2:
- move GXBB_PINMUX definition from patch 3 to this one
---
arch/arm/include/asm/arch-meson/gxbb.h | 2 ++
board/amlogic/odroid-c2/odroid-c2.c | 27 +++++++++++++++++++++++++++
configs/odroid-c2_defconfig | 6 +++++-
3 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/arch-meson/gxbb.h b/arch/arm/include/asm/arch-meson/gxbb.h
index ce41349..af21222 100644
--- a/arch/arm/include/asm/arch-meson/gxbb.h
+++ b/arch/arm/include/asm/arch-meson/gxbb.h
@@ -20,6 +20,8 @@
#define GXBB_GPIO_IN(n) GXBB_PERIPHS_ADDR(_GXBB_GPIO_OFF(n) + 1)
#define GXBB_GPIO_OUT(n) GXBB_PERIPHS_ADDR(_GXBB_GPIO_OFF(n) + 2)
+#define GXBB_PINMUX(n) GXBB_PERIPHS_ADDR(0x2c + (n))
+
#define GXBB_ETH_REG_0 GXBB_PERIPHS_ADDR(0x50)
#define GXBB_ETH_REG_1 GXBB_PERIPHS_ADDR(0x51)
diff --git a/board/amlogic/odroid-c2/odroid-c2.c b/board/amlogic/odroid-c2/odroid-c2.c
index b61daaa..b559c71 100644
--- a/board/amlogic/odroid-c2/odroid-c2.c
+++ b/board/amlogic/odroid-c2/odroid-c2.c
@@ -8,6 +8,7 @@
#include <asm/io.h>
#include <asm/arch/gxbb.h>
#include <asm/arch/sm.h>
+#include <asm/arch/sd_emmc.h>
#include <dm/platdata.h>
#include <phy.h>
@@ -52,3 +53,29 @@ int misc_init_r(void)
return 0;
}
+
+static void meson_mmc_pinmux_setup(unsigned int port)
+{
+ switch (port) {
+ case SDIO_PORT_A:
+ setbits_le32(GXBB_PINMUX(8), 0x3f);
+ break;
+ case SDIO_PORT_B:
+ setbits_le32(GXBB_PINMUX(2), 0x3f << 10);
+ break;
+ case SDIO_PORT_C:
+ clrbits_le32(GXBB_PINMUX(2), 0x1f << 22);
+ setbits_le32(GXBB_PINMUX(4), (0x3 << 18) | (3 << 30));
+ break;
+ default:
+ printf("meson: invalid MMC port %d for pinmux setup\n", port);
+ break;
+ }
+}
+
+int board_mmc_init(bd_t *bis)
+{
+ meson_mmc_pinmux_setup(CONFIG_MMC_MESON_GX_SD_PORT);
+
+ return 0;
+}
diff --git a/configs/odroid-c2_defconfig b/configs/odroid-c2_defconfig
index 7d0b2b1..b4e3277 100644
--- a/configs/odroid-c2_defconfig
+++ b/configs/odroid-c2_defconfig
@@ -3,7 +3,10 @@ CONFIG_ARCH_MESON=y
CONFIG_MESON_GXBB=y
CONFIG_TARGET_ODROID_C2=y
CONFIG_IDENT_STRING=" odroid-c2"
-# CONFIG_MMC is not set
+CONFIG_MMC=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_MMC_MESON_GX_SD_PORT=1
CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-odroidc2"
# CONFIG_DISPLAY_CPUINFO is not set
# CONFIG_DISPLAY_BOARDINFO is not set
@@ -15,6 +18,7 @@ CONFIG_HUSH_PARSER=y
# CONFIG_CMD_FPGA is not set
# CONFIG_CMD_SOURCE is not set
# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_MMC=y
CONFIG_OF_CONTROL=y
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_DM_ETH=y
--
2.11.0
More information about the U-Boot
mailing list