diff mbox

[U-Boot,3/3] odroid: adjust gpio calls to dm gpio api

Message ID 1414513867-23680-3-git-send-email-p.marczak@samsung.com
State Accepted
Delegated to: Minkyu Kang
Headers show

Commit Message

Przemyslaw Marczak Oct. 28, 2014, 4:31 p.m. UTC
Setting gpio value before dm gpio init has no effect,
so now, odroid gpio settings are moved after the gpio uclass init.

Using non-requested gpio pin cases printing error messages.
To avoid this, gpio_request() is added for those gpios.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
 board/samsung/odroid/odroid.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Simon Glass Oct. 29, 2014, 2:58 a.m. UTC | #1
Hi,

On 28 October 2014 10:31, Przemyslaw Marczak <p.marczak@samsung.com> wrote:
> Setting gpio value before dm gpio init has no effect,
> so now, odroid gpio settings are moved after the gpio uclass init.
>
> Using non-requested gpio pin cases printing error messages.
> To avoid this, gpio_request() is added for those gpios.
>
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> ---
>  board/samsung/odroid/odroid.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
> index 5edb250..33003ee 100644
> --- a/board/samsung/odroid/odroid.c
> +++ b/board/samsung/odroid/odroid.c
> @@ -356,21 +356,29 @@ static void board_clock_init(void)
>  static void board_gpio_init(void)
>  {
>         /* eMMC Reset Pin */
> +       gpio_request(EXYNOS4X12_GPIO_K12, "eMMC Reset");

It occurred to me that we should perhaps avoid spaces in the label
since Stephen Warren is talking about enhancing the gpio command to
handle these labels. But I think we can always address this later if
needed.

Acked-by: Simon Glass <sjg@chromium.org>

> +
>         gpio_cfg_pin(EXYNOS4X12_GPIO_K12, S5P_GPIO_FUNC(0x1));
>         gpio_set_pull(EXYNOS4X12_GPIO_K12, S5P_GPIO_PULL_NONE);
>         gpio_set_drv(EXYNOS4X12_GPIO_K12, S5P_GPIO_DRV_4X);
>
>         /* Enable FAN (Odroid U3) */
> +       gpio_request(EXYNOS4X12_GPIO_D00, "FAN Control");
> +
>         gpio_set_pull(EXYNOS4X12_GPIO_D00, S5P_GPIO_PULL_UP);
>         gpio_set_drv(EXYNOS4X12_GPIO_D00, S5P_GPIO_DRV_4X);
>         gpio_direction_output(EXYNOS4X12_GPIO_D00, 1);
>
>         /* OTG Vbus output (Odroid U3+) */
> +       gpio_request(EXYNOS4X12_GPIO_L20, "OTG Vbus");
> +
>         gpio_set_pull(EXYNOS4X12_GPIO_L20, S5P_GPIO_PULL_NONE);
>         gpio_set_drv(EXYNOS4X12_GPIO_L20, S5P_GPIO_DRV_4X);
>         gpio_direction_output(EXYNOS4X12_GPIO_L20, 0);
>
>         /* OTG INT (Odroid U3+) */
> +       gpio_request(EXYNOS4X12_GPIO_X31, "OTG INT");
> +
>         gpio_set_pull(EXYNOS4X12_GPIO_X31, S5P_GPIO_PULL_UP);
>         gpio_set_drv(EXYNOS4X12_GPIO_X31, S5P_GPIO_DRV_4X);
>         gpio_direction_input(EXYNOS4X12_GPIO_X31);
> @@ -403,7 +411,6 @@ static void board_init_i2c(void)
>  int exynos_early_init_f(void)
>  {
>         board_clock_init();
> -       board_gpio_init();
>
>         return 0;
>  }
> @@ -414,6 +421,8 @@ int exynos_init(void)
>         gd->ram_size -= SZ_1M;
>         gd->bd->bi_dram[CONFIG_NR_DRAM_BANKS - 1].size -= SZ_1M;
>
> +       board_gpio_init();
> +
>         return 0;
>  }
>
> --
> 1.9.1
>

Regards,
Simon
Minkyu Kang Oct. 30, 2014, 1:54 p.m. UTC | #2
On 29/10/14 01:31, Przemyslaw Marczak wrote:
> Setting gpio value before dm gpio init has no effect,
> so now, odroid gpio settings are moved after the gpio uclass init.
> 
> Using non-requested gpio pin cases printing error messages.
> To avoid this, gpio_request() is added for those gpios.
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> ---
>  board/samsung/odroid/odroid.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 


applied to u-boot-samsung.

Thanks,
Minkyu Kang.
diff mbox

Patch

diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
index 5edb250..33003ee 100644
--- a/board/samsung/odroid/odroid.c
+++ b/board/samsung/odroid/odroid.c
@@ -356,21 +356,29 @@  static void board_clock_init(void)
 static void board_gpio_init(void)
 {
 	/* eMMC Reset Pin */
+	gpio_request(EXYNOS4X12_GPIO_K12, "eMMC Reset");
+
 	gpio_cfg_pin(EXYNOS4X12_GPIO_K12, S5P_GPIO_FUNC(0x1));
 	gpio_set_pull(EXYNOS4X12_GPIO_K12, S5P_GPIO_PULL_NONE);
 	gpio_set_drv(EXYNOS4X12_GPIO_K12, S5P_GPIO_DRV_4X);
 
 	/* Enable FAN (Odroid U3) */
+	gpio_request(EXYNOS4X12_GPIO_D00, "FAN Control");
+
 	gpio_set_pull(EXYNOS4X12_GPIO_D00, S5P_GPIO_PULL_UP);
 	gpio_set_drv(EXYNOS4X12_GPIO_D00, S5P_GPIO_DRV_4X);
 	gpio_direction_output(EXYNOS4X12_GPIO_D00, 1);
 
 	/* OTG Vbus output (Odroid U3+) */
+	gpio_request(EXYNOS4X12_GPIO_L20, "OTG Vbus");
+
 	gpio_set_pull(EXYNOS4X12_GPIO_L20, S5P_GPIO_PULL_NONE);
 	gpio_set_drv(EXYNOS4X12_GPIO_L20, S5P_GPIO_DRV_4X);
 	gpio_direction_output(EXYNOS4X12_GPIO_L20, 0);
 
 	/* OTG INT (Odroid U3+) */
+	gpio_request(EXYNOS4X12_GPIO_X31, "OTG INT");
+
 	gpio_set_pull(EXYNOS4X12_GPIO_X31, S5P_GPIO_PULL_UP);
 	gpio_set_drv(EXYNOS4X12_GPIO_X31, S5P_GPIO_DRV_4X);
 	gpio_direction_input(EXYNOS4X12_GPIO_X31);
@@ -403,7 +411,6 @@  static void board_init_i2c(void)
 int exynos_early_init_f(void)
 {
 	board_clock_init();
-	board_gpio_init();
 
 	return 0;
 }
@@ -414,6 +421,8 @@  int exynos_init(void)
 	gd->ram_size -= SZ_1M;
 	gd->bd->bi_dram[CONFIG_NR_DRAM_BANKS - 1].size -= SZ_1M;
 
+	board_gpio_init();
+
 	return 0;
 }