public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] mpc85xx gpio related header files changes to compile common cmd_gpio.c
@ 2015-03-26 21:16 Oleksandr G Zhadan
  2015-03-26 21:20 ` York Sun
  2015-03-27  0:26 ` Joakim Tjernlund
  0 siblings, 2 replies; 8+ messages in thread
From: Oleksandr G Zhadan @ 2015-03-26 21:16 UTC (permalink / raw)
  To: u-boot

From: Oleksandr Zhadan <oleks@arcturusnetworks.com>

Signed-off-by: Oleksandr Zhadan <oleks@arcturusnetworks.com>
Signed-off-by: Michael Durrant <mdurrant@arcturusnetworks.com>
---

  arch/powerpc/include/asm/arch-mpc85xx/gpio.h |    2 ++
  arch/powerpc/include/asm/mpc85xx_gpio.h      |    6 ++++--
  2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/arch-mpc85xx/gpio.h 
b/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
index 8beed30..71794a8 100644
--- a/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
+++ b/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
@@ -12,4 +12,6 @@
  #ifndef __ASM_ARCH_MX85XX_GPIO_H
  #define __ASM_ARCH_MX85XX_GPIO_H

+#include <asm/mpc85xx_gpio.h>
+
  #endif
diff --git a/arch/powerpc/include/asm/mpc85xx_gpio.h 
b/arch/powerpc/include/asm/mpc85xx_gpio.h
index 87bb4a0..1d0dad4 100644
--- a/arch/powerpc/include/asm/mpc85xx_gpio.h
+++ b/arch/powerpc/include/asm/mpc85xx_gpio.h
@@ -72,9 +72,10 @@ static inline int gpio_request(unsigned gpio, const 
char *label)
      return 0;
  }

-static inline void gpio_free(unsigned gpio)
+static inline int gpio_free(unsigned gpio)
  {
      /* Compatibility shim */
+    return 0;
  }

  static inline int gpio_direction_input(unsigned gpio)
@@ -97,12 +98,13 @@ static inline int gpio_get_value(unsigned gpio)
      return !!mpc85xx_gpio_get(1U << gpio);
  }

-static inline void gpio_set_value(unsigned gpio, int value)
+static inline int gpio_set_value(unsigned gpio, int value)
  {
      if (value)
          mpc85xx_gpio_set_high(1U << gpio);
      else
          mpc85xx_gpio_set_low(1U << gpio);
+    return 0;
  }

  static inline int gpio_is_valid(int gpio)

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

* [U-Boot] [PATCH 1/2] mpc85xx gpio related header files changes to compile common cmd_gpio.c
  2015-03-26 21:16 [U-Boot] [PATCH 1/2] mpc85xx gpio related header files changes to compile common cmd_gpio.c Oleksandr G Zhadan
@ 2015-03-26 21:20 ` York Sun
  2015-03-27 18:27   ` Oleksandr G Zhadan
  2015-03-27  0:26 ` Joakim Tjernlund
  1 sibling, 1 reply; 8+ messages in thread
From: York Sun @ 2015-03-26 21:20 UTC (permalink / raw)
  To: u-boot



On 03/26/2015 02:16 PM, Oleksandr G Zhadan wrote:
> From: Oleksandr Zhadan <oleks@arcturusnetworks.com>

Please add commit message to explain why and what you are changing.

> 
> Signed-off-by: Oleksandr Zhadan <oleks@arcturusnetworks.com>
> Signed-off-by: Michael Durrant <mdurrant@arcturusnetworks.com>
> ---

If you resend the same patch, please add a comment under the --- line.
If you make a new version, please add change log.

York

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

* [U-Boot] [PATCH 1/2] mpc85xx gpio related header files changes to compile common cmd_gpio.c
  2015-03-26 21:16 [U-Boot] [PATCH 1/2] mpc85xx gpio related header files changes to compile common cmd_gpio.c Oleksandr G Zhadan
  2015-03-26 21:20 ` York Sun
@ 2015-03-27  0:26 ` Joakim Tjernlund
  2015-03-27 14:51   ` Oleksandr G Zhadan
  1 sibling, 1 reply; 8+ messages in thread
From: Joakim Tjernlund @ 2015-03-27  0:26 UTC (permalink / raw)
  To: u-boot

On Thu, 2015-03-26 at 17:16 -0400, Oleksandr G Zhadan wrote:
> From: Oleksandr Zhadan <oleks@arcturusnetworks.com>
> 
> Signed-off-by: Oleksandr Zhadan <oleks@arcturusnetworks.com>
> Signed-off-by: Michael Durrant <mdurrant@arcturusnetworks.com>
> ---
> 
>   arch/powerpc/include/asm/arch-mpc85xx/gpio.h |    2 ++
>   arch/powerpc/include/asm/mpc85xx_gpio.h      |    6 ++++--
>   2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/arch-mpc85xx/gpio.h 
> b/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
> index 8beed30..71794a8 100644
> --- a/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
> +++ b/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
> @@ -12,4 +12,6 @@
>   #ifndef __ASM_ARCH_MX85XX_GPIO_H
>   #define __ASM_ARCH_MX85XX_GPIO_H
> 
> +#include <asm/mpc85xx_gpio.h>
> +
>   #endif
> diff --git a/arch/powerpc/include/asm/mpc85xx_gpio.h 
> b/arch/powerpc/include/asm/mpc85xx_gpio.h
> index 87bb4a0..1d0dad4 100644
> --- a/arch/powerpc/include/asm/mpc85xx_gpio.h
> +++ b/arch/powerpc/include/asm/mpc85xx_gpio.h
> @@ -72,9 +72,10 @@ static inline int gpio_request(unsigned gpio, const 
> char *label)
>       return 0;
>   }
> 
> -static inline void gpio_free(unsigned gpio)
> +static inline int gpio_free(unsigned gpio)
>   {
>       /* Compatibility shim */
> +    return 0;
>   }
> 
>   static inline int gpio_direction_input(unsigned gpio)
> @@ -97,12 +98,13 @@ static inline int gpio_get_value(unsigned gpio)
>       return !!mpc85xx_gpio_get(1U << gpio);
>   }
> 
> -static inline void gpio_set_value(unsigned gpio, int value)
> +static inline int gpio_set_value(unsigned gpio, int value)
>   {
>       if (value)
>           mpc85xx_gpio_set_high(1U << gpio);
>       else
>           mpc85xx_gpio_set_low(1U << gpio);
> +    return 0;
>   }

mpc85xx_gpio_xxx really needs an extra bank argument such as:
static inline void my_mpc85xx_gpio_set(unsigned int bank, unsigned int mask,
                                       unsigned int dir, unsigned int val)
{
        ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR +
                                     bank * 0x1000);
....

so one can choose which GPIO bank to use

 Jocke

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

* [U-Boot] [PATCH 1/2] mpc85xx gpio related header files changes to compile common cmd_gpio.c
  2015-03-27  0:26 ` Joakim Tjernlund
@ 2015-03-27 14:51   ` Oleksandr G Zhadan
  2015-03-27 15:46     ` Joakim Tjernlund
  0 siblings, 1 reply; 8+ messages in thread
From: Oleksandr G Zhadan @ 2015-03-27 14:51 UTC (permalink / raw)
  To: u-boot

Extra gpio bank argument at low level may be discussable, but IMPO we 
should not brake standard int gpio_set_value(unsigned gpio, int value) 
definition.

And the reason of this patch is to fix:

1. Incompatibility in functions gpio_free() and gpio_set_value() 
definitions between <asm/gpio.h> and <asm-generic/gpio.h> (void vs int)

2. Compilation error when build common/cmd_gpio.c for mpc85xx (p1020)

On 03/26/2015 08:26 PM, Joakim Tjernlund wrote:
> On Thu, 2015-03-26 at 17:16 -0400, Oleksandr G Zhadan wrote:
>> From: Oleksandr Zhadan <oleks@arcturusnetworks.com>
>>
>> Signed-off-by: Oleksandr Zhadan <oleks@arcturusnetworks.com>
>> Signed-off-by: Michael Durrant <mdurrant@arcturusnetworks.com>
>> ---
>>
>>    arch/powerpc/include/asm/arch-mpc85xx/gpio.h |    2 ++
>>    arch/powerpc/include/asm/mpc85xx_gpio.h      |    6 ++++--
>>    2 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
>> b/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
>> index 8beed30..71794a8 100644
>> --- a/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
>> +++ b/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
>> @@ -12,4 +12,6 @@
>>    #ifndef __ASM_ARCH_MX85XX_GPIO_H
>>    #define __ASM_ARCH_MX85XX_GPIO_H
>>
>> +#include <asm/mpc85xx_gpio.h>
>> +
>>    #endif
>> diff --git a/arch/powerpc/include/asm/mpc85xx_gpio.h
>> b/arch/powerpc/include/asm/mpc85xx_gpio.h
>> index 87bb4a0..1d0dad4 100644
>> --- a/arch/powerpc/include/asm/mpc85xx_gpio.h
>> +++ b/arch/powerpc/include/asm/mpc85xx_gpio.h
>> @@ -72,9 +72,10 @@ static inline int gpio_request(unsigned gpio, const
>> char *label)
>>        return 0;
>>    }
>>
>> -static inline void gpio_free(unsigned gpio)
>> +static inline int gpio_free(unsigned gpio)
>>    {
>>        /* Compatibility shim */
>> +    return 0;
>>    }
>>
>>    static inline int gpio_direction_input(unsigned gpio)
>> @@ -97,12 +98,13 @@ static inline int gpio_get_value(unsigned gpio)
>>        return !!mpc85xx_gpio_get(1U << gpio);
>>    }
>>
>> -static inline void gpio_set_value(unsigned gpio, int value)
>> +static inline int gpio_set_value(unsigned gpio, int value)
>>    {
>>        if (value)
>>            mpc85xx_gpio_set_high(1U << gpio);
>>        else
>>            mpc85xx_gpio_set_low(1U << gpio);
>> +    return 0;
>>    }
>
> mpc85xx_gpio_xxx really needs an extra bank argument such as:
> static inline void my_mpc85xx_gpio_set(unsigned int bank, unsigned int mask,
>                                         unsigned int dir, unsigned int val)
> {
>          ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR +
>                                       bank * 0x1000);
> ....
>
> so one can choose which GPIO bank to use
>
>   Jocke
>
>


-- 
Oleksandr Zhadan
Arcturus Networks
T 416 621-0125 x235
F 416 621-0190

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

* [U-Boot] [PATCH 1/2] mpc85xx gpio related header files changes to compile common cmd_gpio.c
  2015-03-27 14:51   ` Oleksandr G Zhadan
@ 2015-03-27 15:46     ` Joakim Tjernlund
  2015-03-27 16:09       ` Oleksandr G Zhadan
  0 siblings, 1 reply; 8+ messages in thread
From: Joakim Tjernlund @ 2015-03-27 15:46 UTC (permalink / raw)
  To: u-boot

On Fri, 2015-03-27 at 10:51 -0400, Oleksandr G Zhadan wrote:
> Extra gpio bank argument at low level may be discussable, but IMPO we 
> should not brake standard int gpio_set_value(unsigned gpio, int value) 
> definition.
> 
> And the reason of this patch is to fix:
> 
> 1. Incompatibility in functions gpio_free() and gpio_set_value() 
> definitions between <asm/gpio.h> and <asm-generic/gpio.h> (void vs int)
> 
> 2. Compilation error when build common/cmd_gpio.c for mpc85xx (p1020)

Sure, when I saw "mpc85xx gpio .." I remembered seeing this flaw so I figured
I point it out before I forget again.

This also makes me remember, drivers/spi/fsl_espi.c is broken for anything
but reading an EEPROM.

  Jocke   

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

* [U-Boot] [PATCH 1/2] mpc85xx gpio related header files changes to compile common cmd_gpio.c
  2015-03-27 15:46     ` Joakim Tjernlund
@ 2015-03-27 16:09       ` Oleksandr G Zhadan
  0 siblings, 0 replies; 8+ messages in thread
From: Oleksandr G Zhadan @ 2015-03-27 16:09 UTC (permalink / raw)
  To: u-boot

Yes, here locally we have some additional changes/fixes in some places 
as well. And if talk about mpc85xx gpio support it's better to have 
driver in drivers/gpio vs static definitions in header file and I have 
it. But currently I need this minimal patch to be accepted to send our 
board support patch based on this one.

Oleks

On 03/27/2015 11:46 AM, Joakim Tjernlund wrote:
> On Fri, 2015-03-27 at 10:51 -0400, Oleksandr G Zhadan wrote:
>> Extra gpio bank argument at low level may be discussable, but IMPO we
>> should not brake standard int gpio_set_value(unsigned gpio, int value)
>> definition.
>>
>> And the reason of this patch is to fix:
>>
>> 1. Incompatibility in functions gpio_free() and gpio_set_value()
>> definitions between <asm/gpio.h> and <asm-generic/gpio.h> (void vs int)
>>
>> 2. Compilation error when build common/cmd_gpio.c for mpc85xx (p1020)
>
> Sure, when I saw "mpc85xx gpio .." I remembered seeing this flaw so I figured
> I point it out before I forget again.
>
> This also makes me remember, drivers/spi/fsl_espi.c is broken for anything
> but reading an EEPROM.
>
>    Jocke
>

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

* [U-Boot] [PATCH 1/2] mpc85xx gpio related header files changes to compile common cmd_gpio.c
  2015-03-26 21:20 ` York Sun
@ 2015-03-27 18:27   ` Oleksandr G Zhadan
  2015-03-27 18:44     ` York Sun
  0 siblings, 1 reply; 8+ messages in thread
From: Oleksandr G Zhadan @ 2015-03-27 18:27 UTC (permalink / raw)
  To: u-boot

Hi York,

I add explanation and re-send the same patch.

On 03/26/2015 05:20 PM, York Sun wrote:
>
>
> On 03/26/2015 02:16 PM, Oleksandr G Zhadan wrote:
>> From: Oleksandr Zhadan <oleks@arcturusnetworks.com>
>
> Please add commit message to explain why and what you are changing.
>
>>
>> Signed-off-by: Oleksandr Zhadan <oleks@arcturusnetworks.com>
>> Signed-off-by: Michael Durrant <mdurrant@arcturusnetworks.com>
>> ---
>
> If you resend the same patch, please add a comment under the --- line.
> If you make a new version, please add change log.
>
> York
>
>
From: Oleksandr Zhadan <oleks@arcturusnetworks.com>

1. Fix Incompatibility in functions gpio_free() and gpio_set_value() 
definitions between <asm/gpio.h> and <asm-generic/gpio.h> (void vs int)

2. Fix Compilation error when build common/cmd_gpio.c for mpc85xx (p1020)

Signed-off-by: Oleksandr Zhadan <oleks@arcturusnetworks.com>
Signed-off-by: Michael Durrant <mdurrant@arcturusnetworks.com>
---

  arch/powerpc/include/asm/arch-mpc85xx/gpio.h |    2 ++
  arch/powerpc/include/asm/mpc85xx_gpio.h      |    6 ++++--
  2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/arch-mpc85xx/gpio.h 
b/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
index 8beed30..71794a8 100644
--- a/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
+++ b/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
@@ -12,4 +12,6 @@
  #ifndef __ASM_ARCH_MX85XX_GPIO_H
  #define __ASM_ARCH_MX85XX_GPIO_H

+#include <asm/mpc85xx_gpio.h>
+
  #endif
diff --git a/arch/powerpc/include/asm/mpc85xx_gpio.h 
b/arch/powerpc/include/asm/mpc85xx_gpio.h
index 87bb4a0..1d0dad4 100644
--- a/arch/powerpc/include/asm/mpc85xx_gpio.h
+++ b/arch/powerpc/include/asm/mpc85xx_gpio.h
@@ -72,9 +72,10 @@ static inline int gpio_request(unsigned gpio, const 
char *label)
      return 0;
  }

-static inline void gpio_free(unsigned gpio)
+static inline int gpio_free(unsigned gpio)
  {
      /* Compatibility shim */
+    return 0;
  }

  static inline int gpio_direction_input(unsigned gpio)
@@ -97,12 +98,13 @@ static inline int gpio_get_value(unsigned gpio)
      return !!mpc85xx_gpio_get(1U << gpio);
  }

-static inline void gpio_set_value(unsigned gpio, int value)
+static inline int gpio_set_value(unsigned gpio, int value)
  {
      if (value)
          mpc85xx_gpio_set_high(1U << gpio);
      else
          mpc85xx_gpio_set_low(1U << gpio);
+    return 0;
  }

  static inline int gpio_is_valid(int gpio)

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

* [U-Boot] [PATCH 1/2] mpc85xx gpio related header files changes to compile common cmd_gpio.c
  2015-03-27 18:27   ` Oleksandr G Zhadan
@ 2015-03-27 18:44     ` York Sun
  0 siblings, 0 replies; 8+ messages in thread
From: York Sun @ 2015-03-27 18:44 UTC (permalink / raw)
  To: u-boot



On 03/27/2015 11:27 AM, Oleksandr G Zhadan wrote:
> Hi York,
> 
> I add explanation and re-send the same patch.


Whenever you make changes to the patch, please add a change log under the ---
line. Please also see my comments on previous patch sent 5 minutes before this.

York

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

end of thread, other threads:[~2015-03-27 18:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-26 21:16 [U-Boot] [PATCH 1/2] mpc85xx gpio related header files changes to compile common cmd_gpio.c Oleksandr G Zhadan
2015-03-26 21:20 ` York Sun
2015-03-27 18:27   ` Oleksandr G Zhadan
2015-03-27 18:44     ` York Sun
2015-03-27  0:26 ` Joakim Tjernlund
2015-03-27 14:51   ` Oleksandr G Zhadan
2015-03-27 15:46     ` Joakim Tjernlund
2015-03-27 16:09       ` Oleksandr G Zhadan

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