[U-Boot] [PATCH v2 4/4] mmc: meson: add MMC support in Odroid C2 board init / config

Andreas Färber afaerber at suse.de
Fri Jan 27 00:24:56 CET 2017


Am 25.01.2017 um 20:54 schrieb Heiner Kallweit:
> Add MMC support in Odroid C2 board init code and config.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1 at gmail.com>

This looks very much like Carlo's and my patches, so this is missing
Signed-off-bys.

> ---
> 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;
> +       }
> +}

I think this function is misplaced here, it seems generic GXBB. But see
below.

> +
> +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

I know I refactored this one into a Kconfig option, but I believe it was
wrong. The only usage is in odroid-c2.c, so it can be hardcoded there.
But actually the pinctrl info should be in the device tree if updated
properly, and Beniamino's pinctrl driver seemed to get merged, so why do
we need the above code in odroid-c2.c at all?

>  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

Anyway, thanks for giving this a shot!

Regards,
Andreas

P.S. For the second time already only patches 2-4 are threaded together
- please double-check your scripts.

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)


More information about the U-Boot mailing list