public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] Exynos4412: pinmux: disable pull for MMC pins
@ 2015-10-28 14:41 Przemyslaw Marczak
  2015-10-28 14:41 ` [U-Boot] [PATCH 2/2] s5p sdhci: call pinmux for card's gpio pins before use them Przemyslaw Marczak
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Przemyslaw Marczak @ 2015-10-28 14:41 UTC (permalink / raw)
  To: u-boot

There are 8 pins for SD card in Exynos, but the MUX was configured
only for 7, since the one was used for card detection.
This caused the pin's pull wrong configuration.

This commit fixes this and the card detect can work properly,
after call this function.

Tested-on: Odroid U3 and Odroid X2.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Guillaume GARDET <guillaume.gardet@free.fr>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Simon Glass <sjg@chromium.org>
---
 arch/arm/mach-exynos/pinmux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-exynos/pinmux.c b/arch/arm/mach-exynos/pinmux.c
index 179b294..925bd0a 100644
--- a/arch/arm/mach-exynos/pinmux.c
+++ b/arch/arm/mach-exynos/pinmux.c
@@ -737,10 +737,10 @@ static int exynos4x12_mmc_config(int peripheral, int flags)
 		return -1;
 	}
 	for (i = start; i < (start + 7); i++) {
+		gpio_set_pull(i, S5P_GPIO_PULL_NONE);
 		if (i == (start + 2))
 			continue;
 		gpio_cfg_pin(i,  func);
-		gpio_set_pull(i, S5P_GPIO_PULL_NONE);
 		gpio_set_drv(i, S5P_GPIO_DRV_4X);
 	}
 	if (flags & PINMUX_FLAG_8BIT_MODE) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2] s5p sdhci: call pinmux for card's gpio pins before use them
  2015-10-28 14:41 [U-Boot] [PATCH 1/2] Exynos4412: pinmux: disable pull for MMC pins Przemyslaw Marczak
@ 2015-10-28 14:41 ` Przemyslaw Marczak
  2015-10-29  7:29   ` Jaehoon Chung
                     ` (2 more replies)
  2015-10-29  7:29 ` [U-Boot] [PATCH 1/2] Exynos4412: pinmux: disable pull for MMC pins Jaehoon Chung
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 8+ messages in thread
From: Przemyslaw Marczak @ 2015-10-28 14:41 UTC (permalink / raw)
  To: u-boot

The SD card detection depends on checking one pin state.
But the pin was configured after card was detected, which is wrong.

This commit fixes this, by moving call to pinmux before use the pin.

Tested-on: Odroid U3 and Odroid X2.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Guillaume GARDET <guillaume.gardet@free.fr>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Simon Glass <sjg@chromium.org>
---
 drivers/mmc/s5p_sdhci.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index 15ecfee..44353c7 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -106,6 +106,12 @@ static int do_sdhci_init(struct sdhci_host *host)
 	flag = host->bus_width == 8 ? PINMUX_FLAG_8BIT_MODE : PINMUX_FLAG_NONE;
 	dev_id = host->index + PERIPH_ID_SDMMC0;
 
+	ret = exynos_pinmux_config(dev_id, flag);
+	if (ret) {
+		printf("external SD not configured\n");
+		return ret;
+	}
+
 	if (dm_gpio_is_valid(&host->pwr_gpio)) {
 		dm_gpio_set_value(&host->pwr_gpio, 1);
 		ret = exynos_pinmux_config(dev_id, flag);
@@ -121,12 +127,6 @@ static int do_sdhci_init(struct sdhci_host *host)
 			debug("no SD card detected (%d)\n", ret);
 			return -ENODEV;
 		}
-
-		ret = exynos_pinmux_config(dev_id, flag);
-		if (ret) {
-			printf("external SD not configured\n");
-			return ret;
-		}
 	}
 
 	return s5p_sdhci_core_init(host);
@@ -193,7 +193,7 @@ static int process_nodes(const void *blob, int node_list[], int count)
 		}
 
 		ret = do_sdhci_init(host);
-		if (ret) {
+		if (ret && ret != -ENODEV) {
 			printf("%s: failed to initialize dev %d (%d)\n", __func__, i, ret);
 			failed++;
 		}
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/2] Exynos4412: pinmux: disable pull for MMC pins
  2015-10-28 14:41 [U-Boot] [PATCH 1/2] Exynos4412: pinmux: disable pull for MMC pins Przemyslaw Marczak
  2015-10-28 14:41 ` [U-Boot] [PATCH 2/2] s5p sdhci: call pinmux for card's gpio pins before use them Przemyslaw Marczak
@ 2015-10-29  7:29 ` Jaehoon Chung
  2015-10-29 17:12 ` Lukasz Majewski
  2015-11-02  5:37 ` Minkyu Kang
  3 siblings, 0 replies; 8+ messages in thread
From: Jaehoon Chung @ 2015-10-29  7:29 UTC (permalink / raw)
  To: u-boot

Hi,

Looks good to me.

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

On 10/28/2015 11:41 PM, Przemyslaw Marczak wrote:
> There are 8 pins for SD card in Exynos, but the MUX was configured
> only for 7, since the one was used for card detection.
> This caused the pin's pull wrong configuration.
> 
> This commit fixes this and the card detect can work properly,
> after call this function.
> 
> Tested-on: Odroid U3 and Odroid X2.
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Guillaume GARDET <guillaume.gardet@free.fr>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  arch/arm/mach-exynos/pinmux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-exynos/pinmux.c b/arch/arm/mach-exynos/pinmux.c
> index 179b294..925bd0a 100644
> --- a/arch/arm/mach-exynos/pinmux.c
> +++ b/arch/arm/mach-exynos/pinmux.c
> @@ -737,10 +737,10 @@ static int exynos4x12_mmc_config(int peripheral, int flags)
>  		return -1;
>  	}
>  	for (i = start; i < (start + 7); i++) {
> +		gpio_set_pull(i, S5P_GPIO_PULL_NONE);
>  		if (i == (start + 2))
>  			continue;
>  		gpio_cfg_pin(i,  func);
> -		gpio_set_pull(i, S5P_GPIO_PULL_NONE);
>  		gpio_set_drv(i, S5P_GPIO_DRV_4X);
>  	}
>  	if (flags & PINMUX_FLAG_8BIT_MODE) {
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2] s5p sdhci: call pinmux for card's gpio pins before use them
  2015-10-28 14:41 ` [U-Boot] [PATCH 2/2] s5p sdhci: call pinmux for card's gpio pins before use them Przemyslaw Marczak
@ 2015-10-29  7:29   ` Jaehoon Chung
  2015-10-29 17:13   ` Lukasz Majewski
  2015-11-02  5:37   ` Minkyu Kang
  2 siblings, 0 replies; 8+ messages in thread
From: Jaehoon Chung @ 2015-10-29  7:29 UTC (permalink / raw)
  To: u-boot

Hi,

Looks good to me.

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

On 10/28/2015 11:41 PM, Przemyslaw Marczak wrote:
> The SD card detection depends on checking one pin state.
> But the pin was configured after card was detected, which is wrong.
> 
> This commit fixes this, by moving call to pinmux before use the pin.
> 
> Tested-on: Odroid U3 and Odroid X2.
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Guillaume GARDET <guillaume.gardet@free.fr>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  drivers/mmc/s5p_sdhci.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
> index 15ecfee..44353c7 100644
> --- a/drivers/mmc/s5p_sdhci.c
> +++ b/drivers/mmc/s5p_sdhci.c
> @@ -106,6 +106,12 @@ static int do_sdhci_init(struct sdhci_host *host)
>  	flag = host->bus_width == 8 ? PINMUX_FLAG_8BIT_MODE : PINMUX_FLAG_NONE;
>  	dev_id = host->index + PERIPH_ID_SDMMC0;
>  
> +	ret = exynos_pinmux_config(dev_id, flag);
> +	if (ret) {
> +		printf("external SD not configured\n");
> +		return ret;
> +	}
> +
>  	if (dm_gpio_is_valid(&host->pwr_gpio)) {
>  		dm_gpio_set_value(&host->pwr_gpio, 1);
>  		ret = exynos_pinmux_config(dev_id, flag);
> @@ -121,12 +127,6 @@ static int do_sdhci_init(struct sdhci_host *host)
>  			debug("no SD card detected (%d)\n", ret);
>  			return -ENODEV;
>  		}
> -
> -		ret = exynos_pinmux_config(dev_id, flag);
> -		if (ret) {
> -			printf("external SD not configured\n");
> -			return ret;
> -		}
>  	}
>  
>  	return s5p_sdhci_core_init(host);
> @@ -193,7 +193,7 @@ static int process_nodes(const void *blob, int node_list[], int count)
>  		}
>  
>  		ret = do_sdhci_init(host);
> -		if (ret) {
> +		if (ret && ret != -ENODEV) {
>  			printf("%s: failed to initialize dev %d (%d)\n", __func__, i, ret);
>  			failed++;
>  		}
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/2] Exynos4412: pinmux: disable pull for MMC pins
  2015-10-28 14:41 [U-Boot] [PATCH 1/2] Exynos4412: pinmux: disable pull for MMC pins Przemyslaw Marczak
  2015-10-28 14:41 ` [U-Boot] [PATCH 2/2] s5p sdhci: call pinmux for card's gpio pins before use them Przemyslaw Marczak
  2015-10-29  7:29 ` [U-Boot] [PATCH 1/2] Exynos4412: pinmux: disable pull for MMC pins Jaehoon Chung
@ 2015-10-29 17:12 ` Lukasz Majewski
  2015-11-02  5:37 ` Minkyu Kang
  3 siblings, 0 replies; 8+ messages in thread
From: Lukasz Majewski @ 2015-10-29 17:12 UTC (permalink / raw)
  To: u-boot

Hi Przemyslaw,

> There are 8 pins for SD card in Exynos, but the MUX was configured
> only for 7, since the one was used for card detection.
> This caused the pin's pull wrong configuration.
> 
> This commit fixes this and the card detect can work properly,
> after call this function.
> 
> Tested-on: Odroid U3 and Odroid X2.
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Guillaume GARDET <guillaume.gardet@free.fr>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  arch/arm/mach-exynos/pinmux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-exynos/pinmux.c
> b/arch/arm/mach-exynos/pinmux.c index 179b294..925bd0a 100644
> --- a/arch/arm/mach-exynos/pinmux.c
> +++ b/arch/arm/mach-exynos/pinmux.c
> @@ -737,10 +737,10 @@ static int exynos4x12_mmc_config(int
> peripheral, int flags) return -1;
>  	}
>  	for (i = start; i < (start + 7); i++) {
> +		gpio_set_pull(i, S5P_GPIO_PULL_NONE);
>  		if (i == (start + 2))
>  			continue;
>  		gpio_cfg_pin(i,  func);
> -		gpio_set_pull(i, S5P_GPIO_PULL_NONE);
>  		gpio_set_drv(i, S5P_GPIO_DRV_4X);
>  	}
>  	if (flags & PINMUX_FLAG_8BIT_MODE) {


Tested-by: Lukasz Majewski <l.majewski@samsung.com>

Test HW: Exynos 4210 - Trats board.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2] s5p sdhci: call pinmux for card's gpio pins before use them
  2015-10-28 14:41 ` [U-Boot] [PATCH 2/2] s5p sdhci: call pinmux for card's gpio pins before use them Przemyslaw Marczak
  2015-10-29  7:29   ` Jaehoon Chung
@ 2015-10-29 17:13   ` Lukasz Majewski
  2015-11-02  5:37   ` Minkyu Kang
  2 siblings, 0 replies; 8+ messages in thread
From: Lukasz Majewski @ 2015-10-29 17:13 UTC (permalink / raw)
  To: u-boot

Hi Przemyslaw,

> The SD card detection depends on checking one pin state.
> But the pin was configured after card was detected, which is wrong.
> 
> This commit fixes this, by moving call to pinmux before use the pin.
> 
> Tested-on: Odroid U3 and Odroid X2.
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Guillaume GARDET <guillaume.gardet@free.fr>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  drivers/mmc/s5p_sdhci.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
> index 15ecfee..44353c7 100644
> --- a/drivers/mmc/s5p_sdhci.c
> +++ b/drivers/mmc/s5p_sdhci.c
> @@ -106,6 +106,12 @@ static int do_sdhci_init(struct sdhci_host *host)
>  	flag = host->bus_width == 8 ? PINMUX_FLAG_8BIT_MODE :
> PINMUX_FLAG_NONE; dev_id = host->index + PERIPH_ID_SDMMC0;
>  
> +	ret = exynos_pinmux_config(dev_id, flag);
> +	if (ret) {
> +		printf("external SD not configured\n");
> +		return ret;
> +	}
> +
>  	if (dm_gpio_is_valid(&host->pwr_gpio)) {
>  		dm_gpio_set_value(&host->pwr_gpio, 1);
>  		ret = exynos_pinmux_config(dev_id, flag);
> @@ -121,12 +127,6 @@ static int do_sdhci_init(struct sdhci_host *host)
>  			debug("no SD card detected (%d)\n", ret);
>  			return -ENODEV;
>  		}
> -
> -		ret = exynos_pinmux_config(dev_id, flag);
> -		if (ret) {
> -			printf("external SD not configured\n");
> -			return ret;
> -		}
>  	}
>  
>  	return s5p_sdhci_core_init(host);
> @@ -193,7 +193,7 @@ static int process_nodes(const void *blob, int
> node_list[], int count) }
>  
>  		ret = do_sdhci_init(host);
> -		if (ret) {
> +		if (ret && ret != -ENODEV) {
>  			printf("%s: failed to initialize dev %d
> (%d)\n", __func__, i, ret); failed++;
>  		}


Tested-by: Lukasz Majewski <l.majewski@samsung.com>

Test HW: Exynos 4210 - Trats board.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/2] Exynos4412: pinmux: disable pull for MMC pins
  2015-10-28 14:41 [U-Boot] [PATCH 1/2] Exynos4412: pinmux: disable pull for MMC pins Przemyslaw Marczak
                   ` (2 preceding siblings ...)
  2015-10-29 17:12 ` Lukasz Majewski
@ 2015-11-02  5:37 ` Minkyu Kang
  3 siblings, 0 replies; 8+ messages in thread
From: Minkyu Kang @ 2015-11-02  5:37 UTC (permalink / raw)
  To: u-boot

On 28/10/15 23:41, Przemyslaw Marczak wrote:
> There are 8 pins for SD card in Exynos, but the MUX was configured
> only for 7, since the one was used for card detection.
> This caused the pin's pull wrong configuration.
> 
> This commit fixes this and the card detect can work properly,
> after call this function.
> 
> Tested-on: Odroid U3 and Odroid X2.
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Guillaume GARDET <guillaume.gardet@free.fr>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  arch/arm/mach-exynos/pinmux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

applied to u-boot-samsung.

Thanks,
Minkyu Kang.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2] s5p sdhci: call pinmux for card's gpio pins before use them
  2015-10-28 14:41 ` [U-Boot] [PATCH 2/2] s5p sdhci: call pinmux for card's gpio pins before use them Przemyslaw Marczak
  2015-10-29  7:29   ` Jaehoon Chung
  2015-10-29 17:13   ` Lukasz Majewski
@ 2015-11-02  5:37   ` Minkyu Kang
  2 siblings, 0 replies; 8+ messages in thread
From: Minkyu Kang @ 2015-11-02  5:37 UTC (permalink / raw)
  To: u-boot

On 28/10/15 23:41, Przemyslaw Marczak wrote:
> The SD card detection depends on checking one pin state.
> But the pin was configured after card was detected, which is wrong.
> 
> This commit fixes this, by moving call to pinmux before use the pin.
> 
> Tested-on: Odroid U3 and Odroid X2.
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Guillaume GARDET <guillaume.gardet@free.fr>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  drivers/mmc/s5p_sdhci.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 

applied to u-boot-samsung.

Thanks,
Minkyu Kang.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-11-02  5:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-28 14:41 [U-Boot] [PATCH 1/2] Exynos4412: pinmux: disable pull for MMC pins Przemyslaw Marczak
2015-10-28 14:41 ` [U-Boot] [PATCH 2/2] s5p sdhci: call pinmux for card's gpio pins before use them Przemyslaw Marczak
2015-10-29  7:29   ` Jaehoon Chung
2015-10-29 17:13   ` Lukasz Majewski
2015-11-02  5:37   ` Minkyu Kang
2015-10-29  7:29 ` [U-Boot] [PATCH 1/2] Exynos4412: pinmux: disable pull for MMC pins Jaehoon Chung
2015-10-29 17:12 ` Lukasz Majewski
2015-11-02  5:37 ` Minkyu Kang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox