Skip to contentSkip to conversation

imx: Add GPIO_TO_PORT macro

PATCH New Vikram Narayanan 3 participants 7 messages Apr 4, 2012 – Apr 10, 2012 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 imx: Add GPIO_TO_PORT macro

imx: Add GPIO_TO_PORT macro

---
 arch/arm/include/asm/arch-mx5/gpio.h |    2 ++
 arch/arm/include/asm/arch-mx6/gpio.h |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

50.0% arch/arm/include/asm/arch-mx5/
50.0% arch/arm/include/asm/arch-mx6/

arch/arm/include/asm/arch-mx5/gpio.h +2 -0
index 1dc34e9..bcb5edb 100644
@@ -25,6 +25,8 @@
 #ifndef __ASM_ARCH_MX5_GPIO_H
 #define __ASM_ARCH_MX5_GPIO_H
 
+#define GPIO_TO_PORT(number)		(number/32)
+
 /* GPIO registers */
 struct gpio_regs {
 	u32	gpio_dr;
arch/arm/include/asm/arch-mx6/gpio.h +2 -0
index 20c4e57..385d12d 100644
@@ -25,6 +25,8 @@
 #ifndef __ASM_ARCH_MX6_GPIO_H
 #define __ASM_ARCH_MX6_GPIO_H
 
+#define GPIO_TO_PORT(number)		(number/32)
+
 /* GPIO registers */
 struct gpio_regs {
 	u32	gpio_dr;
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/3 imx: Add GPIO_TO_PORT macro

Quoted 3 lines · Vikram Narayanan

imx: Add GPIO_TO_PORT macro

Hi,

Quoted 25 lines
---
 arch/arm/include/asm/arch-mx5/gpio.h |    2 ++
 arch/arm/include/asm/arch-mx6/gpio.h |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

50.0% arch/arm/include/asm/arch-mx5/
50.0% arch/arm/include/asm/arch-mx6/

arch/arm/include/asm/arch-mx5/gpio.h +2 -0
index 1dc34e9..bcb5edb 100644
@@ -25,6 +25,8 @@
 #ifndef __ASM_ARCH_MX5_GPIO_H
 #define __ASM_ARCH_MX5_GPIO_H
 
+#define GPIO_TO_PORT(number)		(number/32)
+
 /* GPIO registers */
 struct gpio_regs {
 	u32	gpio_dr;
arch/arm/include/asm/arch-mx6/gpio.h +0 -0
index 20c4e57..385d12d 100644

arch/arm/include/asm/arch-mx6/gpio.h line 32

Quoted 8 lines
arch/arm/include/asm/arch-mx6/gpio.h +2 -0
@@ -25,6 +25,8 @@
 #ifndef __ASM_ARCH_MX6_GPIO_H
 #define __ASM_ARCH_MX6_GPIO_H
 
+#define GPIO_TO_PORT(number)		(number/32)
+
 /* GPIO registers */
 struct gpio_regs {
 	u32	gpio_dr;

NAK. We have already (and probably too many) GPIO_TO_PORT:

arch/arm/include/asm/arch-mx6/imx-regs.h:#define GPIO_TO_PORT(number) (((number)/32)+1) arch/arm/include/asm/arch-mx5/mx5x_pins.h:#define GPIO_TO_PORT(n)
(n / GPIO_NUM_PIN)

Are they not enough ?

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
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
=====================================================================
#2 lore raw

PATCH 1/3 imx: Add GPIO_TO_PORT macro

Dear Vikram ,

Quoted 43 lines · Stefano Babic
Quoted 3 lines · Vikram Narayanan

imx: Add GPIO_TO_PORT macro

Hi,

Quoted 25 lines
---
  arch/arm/include/asm/arch-mx5/gpio.h |    2 ++
  arch/arm/include/asm/arch-mx6/gpio.h |    2 ++
  2 files changed, 4 insertions(+), 0 deletions(-)

50.0% arch/arm/include/asm/arch-mx5/
50.0% arch/arm/include/asm/arch-mx6/

arch/arm/include/asm/arch-mx5/gpio.h +2 -0
index 1dc34e9..bcb5edb 100644
@@ -25,6 +25,8 @@
  #ifndef __ASM_ARCH_MX5_GPIO_H
  #define __ASM_ARCH_MX5_GPIO_H
 
+#define GPIO_TO_PORT(number)		(number/32)
+
  /* GPIO registers */
  struct gpio_regs {
  	u32	gpio_dr;
arch/arm/include/asm/arch-mx6/gpio.h +0 -0
index 20c4e57..385d12d 100644

arch/arm/include/asm/arch-mx6/gpio.h line 32

Quoted 8 lines
arch/arm/include/asm/arch-mx6/gpio.h +2 -0
@@ -25,6 +25,8 @@
  #ifndef __ASM_ARCH_MX6_GPIO_H
  #define __ASM_ARCH_MX6_GPIO_H
 
+#define GPIO_TO_PORT(number)		(number/32)
+
  /* GPIO registers */
  struct gpio_regs {
  	u32	gpio_dr;

NAK. We have already (and probably too many) GPIO_TO_PORT:

Quoted 6 lines

arch/arm/include/asm/arch-mx6/imx-regs.h:#define GPIO_TO_PORT(number) (((number)/32)+1) arch/arm/include/asm/arch-mx5/mx5x_pins.h:#define GPIO_TO_PORT(n)
(n / GPIO_NUM_PIN)

Are they not enough ?

Vikram, it seems to me you sent the already NAKed patch to me

https://github.com/dirkbehme/u-boot-imx6/pull/2

again?

Please send U-Boot patches only to this U-Boot mailing list.

Dirk

#3 lore raw

PATCH 1/3 imx: Add GPIO_TO_PORT macro

Hello Dirk,

Quoted 54 lines · Dirk Behme

Dear Vikram ,

Quoted 51 lines · Stefano Babic
Quoted 3 lines · Vikram Narayanan

imx: Add GPIO_TO_PORT macro

Hi,

Quoted 27 lines

---
arch/arm/include/asm/arch-mx5/gpio.h | 2 ++
arch/arm/include/asm/arch-mx6/gpio.h | 2 ++

2 files changed, 4 insertions(+), 0 deletions(-)

50.0% arch/arm/include/asm/arch-mx5/
50.0% arch/arm/include/asm/arch-mx6/

arch/arm/include/asm/arch-mx5/gpio.h +2 -0
index 1dc34e9..bcb5edb 100644
@@ -25,6 +25,8 @@
 #ifndef __ASM_ARCH_MX5_GPIO_H
 #define __ASM_ARCH_MX5_GPIO_H
 
+#define GPIO_TO_PORT(number) (number/32)
+
 /* GPIO registers */
 struct gpio_regs {
 u32 gpio_dr;
arch/arm/include/asm/arch-mx6/gpio.h +0 -0
index 20c4e57..385d12d 100644

arch/arm/include/asm/arch-mx6/gpio.h line 32

Quoted 8 lines
arch/arm/include/asm/arch-mx6/gpio.h +2 -0
@@ -25,6 +25,8 @@
 #ifndef __ASM_ARCH_MX6_GPIO_H
 #define __ASM_ARCH_MX6_GPIO_H
 
+#define GPIO_TO_PORT(number) (number/32)
+
 /* GPIO registers */
 struct gpio_regs {
 u32 gpio_dr;

NAK. We have already (and probably too many) GPIO_TO_PORT:

arch/arm/include/asm/arch-mx6/imx-regs.h:#define GPIO_TO_PORT(number) (((number)/32)+1) arch/arm/include/asm/arch-mx5/mx5x_pins.h:#define GPIO_TO_PORT(n) (n / GPIO_NUM_PIN)

Are they not enough ?

@Stefano: Yeah. Just didn't notice it. Will resend it.

Quoted 6 lines

Vikram, it seems to me you sent the already NAKed patch to me

https://github.com/dirkbehme/u-boot-imx6/pull/2

again?

Sorry, something went wrong with my filter settings in my mailbox. I wasn't aware that it got NACked. Sorry for sending a pull req anyways.

Quoted 1 line

Please send U-Boot patches only to this U-Boot mailing list.

Sure. From now on!

Quoted 1 line

Dirk

~Vikram

#4 lore raw

PATCH 1/3 imx: Add GPIO_TO_PORT macro

In reply to Stefano Babic

Hi,

Quoted 35 lines · Stefano Babic
Quoted 3 lines · Vikram Narayanan

imx: Add GPIO_TO_PORT macro

Hi,

Quoted 28 lines
---
  arch/arm/include/asm/arch-mx5/gpio.h |    2 ++
  arch/arm/include/asm/arch-mx6/gpio.h |    2 ++
  2 files changed, 4 insertions(+), 0 deletions(-)

50.0% arch/arm/include/asm/arch-mx5/
50.0% arch/arm/include/asm/arch-mx6/

arch/arm/include/asm/arch-mx5/gpio.h +2 -0
index 1dc34e9..bcb5edb 100644
@@ -25,6 +25,8 @@
  #ifndef __ASM_ARCH_MX5_GPIO_H
  #define __ASM_ARCH_MX5_GPIO_H
 
+#define GPIO_TO_PORT(number)		(number/32)
+
  /* GPIO registers */
  struct gpio_regs {
  	u32	gpio_dr;
arch/arm/include/asm/arch-mx6/gpio.h +0 -0
index 20c4e57..385d12d 100644
@@ -25,6 +25,8 @@
  #ifndef __ASM_ARCH_MX6_GPIO_H
  #define __ASM_ARCH_MX6_GPIO_H
 
Quoted 7 lines

arch/arm/include/asm/arch-mx6/gpio.h line 32

Quoted 5 lines
arch/arm/include/asm/arch-mx6/gpio.h +2 -0
+#define GPIO_TO_PORT(number)		(number/32)
+
  /* GPIO registers */
  struct gpio_regs {
  	u32	gpio_dr;

NAK. We have already (and probably too many) GPIO_TO_PORT:

Yes. You are right.
So, instead of defining all the headers this way,

#if defined(CONFIG_MX53) || defined(CONFIG_MX51)
#include <asm/arch/mx5x_pins.h>
#elif defined(CONFIG_MX6)
#include <asm/arch/imx-regs.h>
#endif
..... etc

Why not define the GPIO_TO_PORT macro in the driver? Anyways for all its the same 32 pins. Any suggestions/flames?

Thanks,
Vikram

#5 lore raw

PATCH 1/3 imx: Add GPIO_TO_PORT macro

Am 09/04/2012 18:09, schrieb Vikram Narayanan:

Quoted 2 lines

Hi,

Hi,

Quoted 10 lines

Yes. You are right.
So, instead of defining all the headers this way,

#if defined(CONFIG_MX53) || defined(CONFIG_MX51)
#include <asm/arch/mx5x_pins.h>
#elif defined(CONFIG_MX6)
#include <asm/arch/imx-regs.h>
#endif
..... etc

We have not this code - I cannot find in u-boot, and wedo not want to introduce it. As you say, it is nasty. Where have you find it ?

There is no driver including mx*_pins.h. At the moment, only board specific code includes the SOC specific pin header.

Quoted 2 lines

Why not define the GPIO_TO_PORT macro in the driver?

Maybe there was some use of the macro outside the driver in the past. I think before i.MX code was adapted to use common gpio_ functions, boards are used to write directly into the registers of the GPIO controller.

I do not see any track of the macro in the current tree. So yes, we can move GPIO_ macros inside the driver.

Quoted 2 lines

Anyways for all its
the same 32 pins. Any suggestions/flames?

It seems to me also that the defined GPIO_PORT for MX6 is wrong.

arch/arm/include/asm/arch-mx6/imx-regs.h:

#define GPIO_TO_PORT(number) (((number)/32)+1)

Why is the port starting from 1 ? It is wrong, but really GPIO_TO_PORT() is not used anymore.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#6 lore raw

PATCH 1/3 imx: Add GPIO_TO_PORT macro

Hi Stefano,

Quoted 18 lines · stefano babic

Am 09/04/2012 18:09, schrieb Vikram Narayanan:

Quoted 2 lines

Hi,

Hi,

Quoted 10 lines

Yes. You are right.
So, instead of defining all the headers this way,

#if defined(CONFIG_MX53) || defined(CONFIG_MX51)
#include<asm/arch/mx5x_pins.h>
#elif defined(CONFIG_MX6)
#include<asm/arch/imx-regs.h>
#endif
..... etc

Quoted 2 lines

We have not this code - I cannot find in u-boot, and wedo not want to introduce it. As you say, it is nasty. Where have you find it ?

I don't find it anyway. If I want to use the existing macro, it would result in this.

Quoted 4 lines

There is no driver including mx*_pins.h. At the moment, only board specific code includes the SOC specific pin header.

Quoted 1 line
Quoted 8 lines
Quoted 1 line

Why not define the GPIO_TO_PORT macro in the driver?

Maybe there was some use of the macro outside the driver in the past. I think before i.MX code was adapted to use common gpio_ functions, boards are used to write directly into the registers of the GPIO controller.

I do not see any track of the macro in the current tree. So yes, we can move GPIO_ macros inside the driver.

Sure. I'll just do that.

Quoted 11 lines
Quoted 2 lines

Anyways for all its
the same 32 pins. Any suggestions/flames?

It seems to me also that the defined GPIO_PORT for MX6 is wrong.

arch/arm/include/asm/arch-mx6/imx-regs.h:

#define GPIO_TO_PORT(number) (((number)/32)+1)

Why is the port starting from 1 ? It is wrong, but really GPIO_TO_PORT() is not used anymore.

Yes. You are right. I'll send the v2 for this.

Thanks for your response,
Vikram

Quoted 3 lines

Best regards,
Stefano Babic