diff mbox series

[1/3] ARM: imx: vining2000: Clean up uSDHC4 setup

Message ID 20200115102732.167211-1-marex@denx.de
State Accepted
Commit 625bbd38a6cc4aa7a3e445c46bbd8a0eef0ceaba
Headers show
Series [1/3] ARM: imx: vining2000: Clean up uSDHC4 setup | expand

Commit Message

Marek Vasut Jan. 15, 2020, 10:27 a.m. UTC
Simplify the uSDHC4 eMMC controller setup. This is the only eMMC
present on the system and only controller that is used, so drop
the extra logic.

Signed-off-by: Marek Vasut <marex at denx.de>
Cc: Fabio Estevam <fabio.estevam at nxp.com>
Cc: Silvio Fricke <silvio.fricke at softing.com>
Cc: Stefano Babic <sbabic at denx.de>
---
 board/softing/vining_2000/vining_2000.c | 27 ++++---------------------
 1 file changed, 4 insertions(+), 23 deletions(-)

Comments

Stefano Babic Jan. 15, 2020, 12:40 p.m. UTC | #1
On 15/01/20 11:27, Marek Vasut wrote:
> Simplify the uSDHC4 eMMC controller setup. This is the only eMMC
> present on the system and only controller that is used, so drop
> the extra logic.
> 
> Signed-off-by: Marek Vasut <marex at denx.de>
> Cc: Fabio Estevam <fabio.estevam at nxp.com>
> Cc: Silvio Fricke <silvio.fricke at softing.com>
> Cc: Stefano Babic <sbabic at denx.de>
> ---
>  board/softing/vining_2000/vining_2000.c | 27 ++++---------------------
>  1 file changed, 4 insertions(+), 23 deletions(-)
> 
> diff --git a/board/softing/vining_2000/vining_2000.c b/board/softing/vining_2000/vining_2000.c
> index ef914b13a1..6dc3fc8b50 100644
> --- a/board/softing/vining_2000/vining_2000.c
> +++ b/board/softing/vining_2000/vining_2000.c
> @@ -427,8 +427,6 @@ void board_preboot_os(void)
>  #include <spl.h>
>  #include <asm/arch/mx6-ddr.h>
>  
> -static struct fsl_esdhc_cfg usdhc_cfg = { USDHC4_BASE_ADDR };
> -
>  static iomux_v3_cfg_t const pcie_pads[] = {
>  	MX6_PAD_NAND_DATA02__GPIO4_IO_6 | MUX_PAD_CTRL(GPIO_PAD_CTRL),
>  };
> @@ -461,30 +459,13 @@ static void vining2000_spl_setup_iomux_uart(void)
>  	imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads));
>  }
>  
> +static struct fsl_esdhc_cfg usdhc_cfg = { USDHC4_BASE_ADDR };
> +
>  int board_mmc_init(bd_t *bis)
>  {
> -	struct src *src_regs = (struct src *)SRC_BASE_ADDR;
> -	u32 val;
> -	u32 port;
> -
> -	val = readl(&src_regs->sbmr1);
> -
> -	if ((val & 0xc0) != 0x40) {
> -		printf("Not boot from USDHC!\n");
> -		return -EINVAL;
> -	}
> -
> -	port = (val >> 11) & 0x3;
> -	printf("port %d\n", port);
> -	switch (port) {
> -	case 3:
> -		imx_iomux_v3_setup_multiple_pads(
> -			usdhc4_pads, ARRAY_SIZE(usdhc4_pads));
> -		usdhc_cfg.sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
> -		usdhc_cfg.esdhc_base = USDHC4_BASE_ADDR;
> -		break;
> -	}
> +	imx_iomux_v3_setup_multiple_pads(usdhc4_pads, ARRAY_SIZE(usdhc4_pads));
>  
> +	usdhc_cfg.sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
>  	gd->arch.sdhc_clk = usdhc_cfg.sdhc_clk;
>  	return fsl_esdhc_initialize(bis, &usdhc_cfg);
>  }
> 

Reviewed-by: Stefano Babic <sbabic at denx.de>

Best regards,
Stefano Babic
Stefano Babic Jan. 20, 2020, 8:17 p.m. UTC | #2
> Simplify the uSDHC4 eMMC controller setup. This is the only eMMC
> present on the system and only controller that is used, so drop
> the extra logic.
> Signed-off-by: Marek Vasut <marex at denx.de>
> Cc: Fabio Estevam <fabio.estevam at nxp.com>
> Cc: Silvio Fricke <silvio.fricke at softing.com>
> Cc: Stefano Babic <sbabic at denx.de>
> Reviewed-by: Stefano Babic <sbabic at denx.de>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/board/softing/vining_2000/vining_2000.c b/board/softing/vining_2000/vining_2000.c
index ef914b13a1..6dc3fc8b50 100644
--- a/board/softing/vining_2000/vining_2000.c
+++ b/board/softing/vining_2000/vining_2000.c
@@ -427,8 +427,6 @@  void board_preboot_os(void)
 #include <spl.h>
 #include <asm/arch/mx6-ddr.h>
 
-static struct fsl_esdhc_cfg usdhc_cfg = { USDHC4_BASE_ADDR };
-
 static iomux_v3_cfg_t const pcie_pads[] = {
 	MX6_PAD_NAND_DATA02__GPIO4_IO_6 | MUX_PAD_CTRL(GPIO_PAD_CTRL),
 };
@@ -461,30 +459,13 @@  static void vining2000_spl_setup_iomux_uart(void)
 	imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads));
 }
 
+static struct fsl_esdhc_cfg usdhc_cfg = { USDHC4_BASE_ADDR };
+
 int board_mmc_init(bd_t *bis)
 {
-	struct src *src_regs = (struct src *)SRC_BASE_ADDR;
-	u32 val;
-	u32 port;
-
-	val = readl(&src_regs->sbmr1);
-
-	if ((val & 0xc0) != 0x40) {
-		printf("Not boot from USDHC!\n");
-		return -EINVAL;
-	}
-
-	port = (val >> 11) & 0x3;
-	printf("port %d\n", port);
-	switch (port) {
-	case 3:
-		imx_iomux_v3_setup_multiple_pads(
-			usdhc4_pads, ARRAY_SIZE(usdhc4_pads));
-		usdhc_cfg.sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
-		usdhc_cfg.esdhc_base = USDHC4_BASE_ADDR;
-		break;
-	}
+	imx_iomux_v3_setup_multiple_pads(usdhc4_pads, ARRAY_SIZE(usdhc4_pads));
 
+	usdhc_cfg.sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
 	gd->arch.sdhc_clk = usdhc_cfg.sdhc_clk;
 	return fsl_esdhc_initialize(bis, &usdhc_cfg);
 }