diff mbox

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

Message ID 1414165510-10383-16-git-send-email-p.marczak@samsung.com
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Przemyslaw Marczak Oct. 24, 2014, 3:45 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 | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Comments

Simon Glass Oct. 28, 2014, 1:13 a.m. UTC | #1
Hi,

On 24 October 2014 09:45, 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 | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
> index 5edb250..5ce8e9f 100644
> --- a/board/samsung/odroid/odroid.c
> +++ b/board/samsung/odroid/odroid.c
> @@ -355,22 +355,36 @@ static void board_clock_init(void)
>
>  static void board_gpio_init(void)
>  {
> +       char buf[16];
> +
>         /* eMMC Reset Pin */
> +       sprintf(buf, "eMMC Reset");
> +       gpio_request(EXYNOS4X12_GPIO_K12, buf);

You can use:

gpio_request(EXYNOS4X12_GPIO_K12, "eMMC Reset");

Same below.

> +
>         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) */
> +       sprintf(buf, "FAN Control");
> +       gpio_request(EXYNOS4X12_GPIO_D00, buf);
> +
>         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+) */
> +       sprintf(buf, "OTG Vbus");
> +       gpio_request(EXYNOS4X12_GPIO_L20, buf);
> +
>         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+) */
> +       sprintf(buf, "OTG INT");
> +       gpio_request(EXYNOS4X12_GPIO_X31, buf);
> +
>         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 +417,6 @@ static void board_init_i2c(void)
>  int exynos_early_init_f(void)
>  {
>         board_clock_init();
> -       board_gpio_init();
>
>         return 0;
>  }
> @@ -414,6 +427,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
Przemyslaw Marczak Oct. 28, 2014, 7:27 a.m. UTC | #2
Hello,

On 10/28/2014 02:13 AM, Simon Glass wrote:
> Hi,
>
> On 24 October 2014 09:45, 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 | 17 ++++++++++++++++-
>>   1 file changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
>> index 5edb250..5ce8e9f 100644
>> --- a/board/samsung/odroid/odroid.c
>> +++ b/board/samsung/odroid/odroid.c
>> @@ -355,22 +355,36 @@ static void board_clock_init(void)
>>
>>   static void board_gpio_init(void)
>>   {
>> +       char buf[16];
>> +
>>          /* eMMC Reset Pin */
>> +       sprintf(buf, "eMMC Reset");
>> +       gpio_request(EXYNOS4X12_GPIO_K12, buf);
>
> You can use:
>
> gpio_request(EXYNOS4X12_GPIO_K12, "eMMC Reset");
>
> Same below.
>

Ops, right! This was to easy:)

>> +
>>          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) */
>> +       sprintf(buf, "FAN Control");
>> +       gpio_request(EXYNOS4X12_GPIO_D00, buf);
>> +
>>          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+) */
>> +       sprintf(buf, "OTG Vbus");
>> +       gpio_request(EXYNOS4X12_GPIO_L20, buf);
>> +
>>          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+) */
>> +       sprintf(buf, "OTG INT");
>> +       gpio_request(EXYNOS4X12_GPIO_X31, buf);
>> +
>>          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 +417,6 @@ static void board_init_i2c(void)
>>   int exynos_early_init_f(void)
>>   {
>>          board_clock_init();
>> -       board_gpio_init();
>>
>>          return 0;
>>   }
>> @@ -414,6 +427,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
>

Best regards,
diff mbox

Patch

diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
index 5edb250..5ce8e9f 100644
--- a/board/samsung/odroid/odroid.c
+++ b/board/samsung/odroid/odroid.c
@@ -355,22 +355,36 @@  static void board_clock_init(void)
 
 static void board_gpio_init(void)
 {
+	char buf[16];
+
 	/* eMMC Reset Pin */
+	sprintf(buf, "eMMC Reset");
+	gpio_request(EXYNOS4X12_GPIO_K12, buf);
+
 	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) */
+	sprintf(buf, "FAN Control");
+	gpio_request(EXYNOS4X12_GPIO_D00, buf);
+
 	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+) */
+	sprintf(buf, "OTG Vbus");
+	gpio_request(EXYNOS4X12_GPIO_L20, buf);
+
 	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+) */
+	sprintf(buf, "OTG INT");
+	gpio_request(EXYNOS4X12_GPIO_X31, buf);
+
 	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 +417,6 @@  static void board_init_i2c(void)
 int exynos_early_init_f(void)
 {
 	board_clock_init();
-	board_gpio_init();
 
 	return 0;
 }
@@ -414,6 +427,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;
 }