* [U-Boot] [PATCH] imx: mx6quq7: add sd card detection
@ 2016-02-05 12:41 Julien Corjon
2016-02-05 14:17 ` Boris Brezillon
0 siblings, 1 reply; 7+ messages in thread
From: Julien Corjon @ 2016-02-05 12:41 UTC (permalink / raw)
To: u-boot
Add board_mmc_getcd function and declare CD_GPIO for
SDCard.
Signed-off-by: Julien Corjon <corjon.j@ecagroup.com>
---
board/seco/mx6quq7/mx6quq7.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/board/seco/mx6quq7/mx6quq7.c b/board/seco/mx6quq7/mx6quq7.c
index ea1d4b8..d70c6bc 100644
--- a/board/seco/mx6quq7/mx6quq7.c
+++ b/board/seco/mx6quq7/mx6quq7.c
@@ -91,11 +91,30 @@ int board_eth_init(bd_t *bis)
return ret;
}
+#define USDHC4_CD_GPIO IMX_GPIO_NR(2, 6)
+
static struct fsl_esdhc_cfg usdhc_cfg[2] = {
- {USDHC3_BASE_ADDR},
- {USDHC2_BASE_ADDR},
+ {USDHC3_BASE_ADDR, 0, 4},
+ {USDHC4_BASE_ADDR, 0, 4},
};
+int board_mmc_getcd(struct mmc *mmc)
+{
+ struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
+ int ret = 0;
+
+ switch (cfg->esdhc_base) {
+ case USDHC3_BASE_ADDR:
+ ret = 1; /* Assume eMMC is always present */
+ break;
+ case USDHC4_BASE_ADDR:
+ ret = !gpio_get_value(USDHC4_CD_GPIO);
+ break;
+ }
+
+ return ret;
+}
+
int board_mmc_init(bd_t *bis)
{
u32 index = 0;
@@ -112,14 +131,12 @@ int board_mmc_init(bd_t *bis)
case 0:
seco_mx6_setup_usdhc_iomux(3);
usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
- usdhc_cfg[0].max_bus_width = 4;
break;
case 1:
seco_mx6_setup_usdhc_iomux(4);
+ gpio_direction_input(USDHC4_CD_GPIO);
usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
- usdhc_cfg[1].max_bus_width = 4;
break;
-
default:
printf("Warning: %d exceed maximum number of SD ports %d\n",
index + 1, CONFIG_SYS_FSL_USDHC_NUM);
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] imx: mx6quq7: add sd card detection
2016-02-05 12:41 [U-Boot] [PATCH] imx: mx6quq7: add sd card detection Julien Corjon
@ 2016-02-05 14:17 ` Boris Brezillon
2016-02-05 15:19 ` [U-Boot] [PATCH v2 1/3] imx: mx6quq7: fix USDHC4 declaration Julien Corjon
0 siblings, 1 reply; 7+ messages in thread
From: Boris Brezillon @ 2016-02-05 14:17 UTC (permalink / raw)
To: u-boot
Hi Julien,
On Fri, 5 Feb 2016 13:41:29 +0100
Julien Corjon <corjon.j@ecagroup.com> wrote:
> Add board_mmc_getcd function and declare CD_GPIO for
> SDCard.
This looks good to me, but can you split the changes in 3 different
patches:
1/ remove USDHC2
2/ specify max_bus_width directly in usdhc_cfg static definition
instead of tweaking it in the board_mmc_init() function.
3/ add USDHC4 + MMC detect
>
> Signed-off-by: Julien Corjon <corjon.j@ecagroup.com>
> ---
> board/seco/mx6quq7/mx6quq7.c | 27 ++++++++++++++++++++++-----
> 1 file changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/board/seco/mx6quq7/mx6quq7.c b/board/seco/mx6quq7/mx6quq7.c
> index ea1d4b8..d70c6bc 100644
> --- a/board/seco/mx6quq7/mx6quq7.c
> +++ b/board/seco/mx6quq7/mx6quq7.c
> @@ -91,11 +91,30 @@ int board_eth_init(bd_t *bis)
> return ret;
> }
>
> +#define USDHC4_CD_GPIO IMX_GPIO_NR(2, 6)
> +
> static struct fsl_esdhc_cfg usdhc_cfg[2] = {
> - {USDHC3_BASE_ADDR},
> - {USDHC2_BASE_ADDR},
> + {USDHC3_BASE_ADDR, 0, 4},
> + {USDHC4_BASE_ADDR, 0, 4},
> };
>
> +int board_mmc_getcd(struct mmc *mmc)
> +{
> + struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
> + int ret = 0;
> +
> + switch (cfg->esdhc_base) {
> + case USDHC3_BASE_ADDR:
> + ret = 1; /* Assume eMMC is always present */
> + break;
> + case USDHC4_BASE_ADDR:
> + ret = !gpio_get_value(USDHC4_CD_GPIO);
> + break;
Please use tabs instead of spaces (scripts/checkpatch.sh should complain
about that).
> + }
> +
> + return ret;
> +}
> +
> int board_mmc_init(bd_t *bis)
> {
> u32 index = 0;
> @@ -112,14 +131,12 @@ int board_mmc_init(bd_t *bis)
> case 0:
> seco_mx6_setup_usdhc_iomux(3);
> usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
> - usdhc_cfg[0].max_bus_width = 4;
> break;
> case 1:
> seco_mx6_setup_usdhc_iomux(4);
> + gpio_direction_input(USDHC4_CD_GPIO);
> usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
> - usdhc_cfg[1].max_bus_width = 4;
> break;
> -
> default:
> printf("Warning: %d exceed maximum number of SD ports %d\n",
> index + 1, CONFIG_SYS_FSL_USDHC_NUM);
Thanks,
Boris
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v2 1/3] imx: mx6quq7: fix USDHC4 declaration
2016-02-05 14:17 ` Boris Brezillon
@ 2016-02-05 15:19 ` Julien Corjon
2016-02-05 15:19 ` [U-Boot] [PATCH v2 2/3] imx: mx6quq7: specify max_bus_witdh directly in usdhc_cfg Julien Corjon
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Julien Corjon @ 2016-02-05 15:19 UTC (permalink / raw)
To: u-boot
USDHC2 does not exist on mx6quq7 board, as USDHC4 was already been
declared this is probably a typo.
Signed-off-by: Julien Corjon <corjon.j@ecagroup.com>
---
v1 -> v2
- Split patch (suggested by Boris)
- Replace spaces with tab (suggested by Boris)
board/seco/mx6quq7/mx6quq7.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/seco/mx6quq7/mx6quq7.c b/board/seco/mx6quq7/mx6quq7.c
index ea1d4b8..3743a9e 100644
--- a/board/seco/mx6quq7/mx6quq7.c
+++ b/board/seco/mx6quq7/mx6quq7.c
@@ -93,7 +93,7 @@ int board_eth_init(bd_t *bis)
static struct fsl_esdhc_cfg usdhc_cfg[2] = {
{USDHC3_BASE_ADDR},
- {USDHC2_BASE_ADDR},
+ {USDHC4_BASE_ADDR},
};
int board_mmc_init(bd_t *bis)
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v2 2/3] imx: mx6quq7: specify max_bus_witdh directly in usdhc_cfg
2016-02-05 15:19 ` [U-Boot] [PATCH v2 1/3] imx: mx6quq7: fix USDHC4 declaration Julien Corjon
@ 2016-02-05 15:19 ` Julien Corjon
2016-02-05 15:19 ` [U-Boot] [PATCH v2 3/3] imx: mx6quq7: add sd card detection Julien Corjon
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Julien Corjon @ 2016-02-05 15:19 UTC (permalink / raw)
To: u-boot
Specify max_bus_width directly in usdhc_cfg static definition instead
of tweaking it in the board_mmc_init() function.
Signed-off-by: Julien Corjon <corjon.j@ecagroup.com>
---
v1 -> v2
- Split patch (suggested by Boris)
- Replace spaces with tab (suggested by Boris)
board/seco/mx6quq7/mx6quq7.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/board/seco/mx6quq7/mx6quq7.c b/board/seco/mx6quq7/mx6quq7.c
index 3743a9e..89ae70d 100644
--- a/board/seco/mx6quq7/mx6quq7.c
+++ b/board/seco/mx6quq7/mx6quq7.c
@@ -92,8 +92,8 @@ int board_eth_init(bd_t *bis)
}
static struct fsl_esdhc_cfg usdhc_cfg[2] = {
- {USDHC3_BASE_ADDR},
- {USDHC4_BASE_ADDR},
+ {USDHC3_BASE_ADDR, 0, 4},
+ {USDHC4_BASE_ADDR, 0, 4},
};
int board_mmc_init(bd_t *bis)
@@ -112,12 +112,10 @@ int board_mmc_init(bd_t *bis)
case 0:
seco_mx6_setup_usdhc_iomux(3);
usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
- usdhc_cfg[0].max_bus_width = 4;
break;
case 1:
seco_mx6_setup_usdhc_iomux(4);
usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
- usdhc_cfg[1].max_bus_width = 4;
break;
default:
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v2 3/3] imx: mx6quq7: add sd card detection
2016-02-05 15:19 ` [U-Boot] [PATCH v2 1/3] imx: mx6quq7: fix USDHC4 declaration Julien Corjon
2016-02-05 15:19 ` [U-Boot] [PATCH v2 2/3] imx: mx6quq7: specify max_bus_witdh directly in usdhc_cfg Julien Corjon
@ 2016-02-05 15:19 ` Julien Corjon
2016-02-05 15:26 ` [U-Boot] [PATCH v2 1/3] imx: mx6quq7: fix USDHC4 declaration Boris Brezillon
2016-02-21 10:37 ` Stefano Babic
3 siblings, 0 replies; 7+ messages in thread
From: Julien Corjon @ 2016-02-05 15:19 UTC (permalink / raw)
To: u-boot
Add board_mmc_getcd function and declare CD_GPIO for SDCard.
Signed-off-by: Julien Corjon <corjon.j@ecagroup.com>
---
v1 -> v2
- Split patch (suggested by Boris)
- Replace spaces with tab (suggested by Boris)
board/seco/mx6quq7/mx6quq7.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/board/seco/mx6quq7/mx6quq7.c b/board/seco/mx6quq7/mx6quq7.c
index 89ae70d..6be0b98 100644
--- a/board/seco/mx6quq7/mx6quq7.c
+++ b/board/seco/mx6quq7/mx6quq7.c
@@ -91,11 +91,30 @@ int board_eth_init(bd_t *bis)
return ret;
}
+#define USDHC4_CD_GPIO IMX_GPIO_NR(2, 6)
+
static struct fsl_esdhc_cfg usdhc_cfg[2] = {
{USDHC3_BASE_ADDR, 0, 4},
{USDHC4_BASE_ADDR, 0, 4},
};
+int board_mmc_getcd(struct mmc *mmc)
+{
+ struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
+ int ret = 0;
+
+ switch (cfg->esdhc_base) {
+ case USDHC3_BASE_ADDR:
+ ret = 1; /* Assume eMMC is always present */
+ break;
+ case USDHC4_BASE_ADDR:
+ ret = !gpio_get_value(USDHC4_CD_GPIO);
+ break;
+ }
+
+ return ret;
+}
+
int board_mmc_init(bd_t *bis)
{
u32 index = 0;
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v2 1/3] imx: mx6quq7: fix USDHC4 declaration
2016-02-05 15:19 ` [U-Boot] [PATCH v2 1/3] imx: mx6quq7: fix USDHC4 declaration Julien Corjon
2016-02-05 15:19 ` [U-Boot] [PATCH v2 2/3] imx: mx6quq7: specify max_bus_witdh directly in usdhc_cfg Julien Corjon
2016-02-05 15:19 ` [U-Boot] [PATCH v2 3/3] imx: mx6quq7: add sd card detection Julien Corjon
@ 2016-02-05 15:26 ` Boris Brezillon
2016-02-21 10:37 ` Stefano Babic
3 siblings, 0 replies; 7+ messages in thread
From: Boris Brezillon @ 2016-02-05 15:26 UTC (permalink / raw)
To: u-boot
On Fri, 5 Feb 2016 16:19:31 +0100
Julien Corjon <corjon.j@ecagroup.com> wrote:
> USDHC2 does not exist on mx6quq7 board, as USDHC4 was already been
> declared this is probably a typo.
>
> Signed-off-by: Julien Corjon <corjon.j@ecagroup.com>
For the whole series:
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Thanks,
Boris
> ---
> v1 -> v2
> - Split patch (suggested by Boris)
> - Replace spaces with tab (suggested by Boris)
>
> board/seco/mx6quq7/mx6quq7.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/board/seco/mx6quq7/mx6quq7.c b/board/seco/mx6quq7/mx6quq7.c
> index ea1d4b8..3743a9e 100644
> --- a/board/seco/mx6quq7/mx6quq7.c
> +++ b/board/seco/mx6quq7/mx6quq7.c
> @@ -93,7 +93,7 @@ int board_eth_init(bd_t *bis)
>
> static struct fsl_esdhc_cfg usdhc_cfg[2] = {
> {USDHC3_BASE_ADDR},
> - {USDHC2_BASE_ADDR},
> + {USDHC4_BASE_ADDR},
> };
>
> int board_mmc_init(bd_t *bis)
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v2 1/3] imx: mx6quq7: fix USDHC4 declaration
2016-02-05 15:19 ` [U-Boot] [PATCH v2 1/3] imx: mx6quq7: fix USDHC4 declaration Julien Corjon
` (2 preceding siblings ...)
2016-02-05 15:26 ` [U-Boot] [PATCH v2 1/3] imx: mx6quq7: fix USDHC4 declaration Boris Brezillon
@ 2016-02-21 10:37 ` Stefano Babic
3 siblings, 0 replies; 7+ messages in thread
From: Stefano Babic @ 2016-02-21 10:37 UTC (permalink / raw)
To: u-boot
On 05/02/2016 16:19, Julien Corjon wrote:
> USDHC2 does not exist on mx6quq7 board, as USDHC4 was already been
> declared this is probably a typo.
>
> Signed-off-by: Julien Corjon <corjon.j@ecagroup.com>
> ---
> v1 -> v2
> - Split patch (suggested by Boris)
> - Replace spaces with tab (suggested by Boris)
>
> board/seco/mx6quq7/mx6quq7.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/board/seco/mx6quq7/mx6quq7.c b/board/seco/mx6quq7/mx6quq7.c
> index ea1d4b8..3743a9e 100644
> --- a/board/seco/mx6quq7/mx6quq7.c
> +++ b/board/seco/mx6quq7/mx6quq7.c
> @@ -93,7 +93,7 @@ int board_eth_init(bd_t *bis)
>
> static struct fsl_esdhc_cfg usdhc_cfg[2] = {
> {USDHC3_BASE_ADDR},
> - {USDHC2_BASE_ADDR},
> + {USDHC4_BASE_ADDR},
> };
>
> int board_mmc_init(bd_t *bis)
>
Applied (whole series) to u-boot-imx, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-02-21 10:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-05 12:41 [U-Boot] [PATCH] imx: mx6quq7: add sd card detection Julien Corjon
2016-02-05 14:17 ` Boris Brezillon
2016-02-05 15:19 ` [U-Boot] [PATCH v2 1/3] imx: mx6quq7: fix USDHC4 declaration Julien Corjon
2016-02-05 15:19 ` [U-Boot] [PATCH v2 2/3] imx: mx6quq7: specify max_bus_witdh directly in usdhc_cfg Julien Corjon
2016-02-05 15:19 ` [U-Boot] [PATCH v2 3/3] imx: mx6quq7: add sd card detection Julien Corjon
2016-02-05 15:26 ` [U-Boot] [PATCH v2 1/3] imx: mx6quq7: fix USDHC4 declaration Boris Brezillon
2016-02-21 10:37 ` Stefano Babic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox