Re: [U-Boot] [PATCH v4] MX: Set a common gpio.h for all i.MX

2012-08-21 Thread Stefano Babic
On 20/08/2012 23:20, Matt Sealey wrote:
 Works fine on the Efika MX :)
 
 Tested-by: Matt Sealey m...@genesi-usa.com
 

Ok, thanks, I push it on the server.

Regards,
Stefano

-- 
=
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: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4] MX: Set a common gpio.h for all i.MX

2012-08-20 Thread Stefano Babic
Each i.MX has its own gpio.h, defining the same structure.
The internal GPIO controller has the same layout
(at least for the register used by u-boot) and can be shared.

Signed-off-by: Stefano Babic sba...@denx.de
---
Changes in v2:
- please ignore this version, it is broken

Changes in v3:
- call the macro IMX_GPIO_NR  as in kernel (Fabio Estevam)
- change psr in gpio_psr (Benoit Thebaudeau)
- drop MXC_GPIO_PORT_TO_NUM and use common macro (Benoit Thebaudeau)

Changes in v4:
- Add missing comment in commit message

 arch/arm/include/asm/arch-mx25/gpio.h |   17 +--
 arch/arm/include/asm/arch-mx31/gpio.h |7 +
 arch/arm/include/asm/arch-mx35/gpio.h |   12 +---
 arch/arm/include/asm/arch-mx5/gpio.h  |7 +
 arch/arm/include/asm/arch-mx6/gpio.h  |7 +
 arch/arm/include/asm/arch-mx6/imx-regs.h  |2 --
 arch/arm/include/asm/imx-common/gpio.h|   39 +
 board/freescale/mx6qsabrelite/mx6qsabrelite.c |   28 +-
 board/karo/tx25/tx25.c|   10 +++
 board/syteco/zmx25/zmx25.c|   26 -
 include/configs/mx6qsabrelite.h   |3 +-
 11 files changed, 78 insertions(+), 80 deletions(-)
 create mode 100644 arch/arm/include/asm/imx-common/gpio.h

diff --git a/arch/arm/include/asm/arch-mx25/gpio.h 
b/arch/arm/include/asm/arch-mx25/gpio.h
index dc6edc7..61c0b0d 100644
--- a/arch/arm/include/asm/arch-mx25/gpio.h
+++ b/arch/arm/include/asm/arch-mx25/gpio.h
@@ -25,21 +25,6 @@
 #ifndef __ASM_ARCH_MX25_GPIO_H
 #define __ASM_ARCH_MX25_GPIO_H
 
-/* Converts a GPIO port number and the internal bit position
- * to the GPIO number
- */
-#define MXC_GPIO_PORT_TO_NUM(port, bit) (((port - 1)  5) + (bit  0x1f))
-
-/* GPIO registers */
-struct gpio_regs {
-   u32 gpio_dr;/* data */
-   u32 gpio_dir;   /* direction */
-   u32 psr;/* pad satus */
-   u32 icr1;   /* interrupt config 1 */
-   u32 icr2;   /* interrupt config 2 */
-   u32 imr;/* interrupt mask */
-   u32 isr;/* interrupt status */
-   u32 edge_sel;   /* edge select */
-};
+#include asm/imx-common/gpio.h
 
 #endif
diff --git a/arch/arm/include/asm/arch-mx31/gpio.h 
b/arch/arm/include/asm/arch-mx31/gpio.h
index 95b73bf..55c0afa 100644
--- a/arch/arm/include/asm/arch-mx31/gpio.h
+++ b/arch/arm/include/asm/arch-mx31/gpio.h
@@ -25,11 +25,6 @@
 #ifndef __ASM_ARCH_MX31_GPIO_H
 #define __ASM_ARCH_MX31_GPIO_H
 
-/* GPIO Registers */
-struct gpio_regs {
-   u32 gpio_dr;
-   u32 gpio_dir;
-   u32 gpio_psr;
-};
+#include asm/imx-common/gpio.h
 
 #endif
diff --git a/arch/arm/include/asm/arch-mx35/gpio.h 
b/arch/arm/include/asm/arch-mx35/gpio.h
index 7bcc3e8..1deb292 100644
--- a/arch/arm/include/asm/arch-mx35/gpio.h
+++ b/arch/arm/include/asm/arch-mx35/gpio.h
@@ -25,16 +25,6 @@
 #ifndef __ASM_ARCH_MX35_GPIO_H
 #define __ASM_ARCH_MX35_GPIO_H
 
-/* GPIO registers */
-struct gpio_regs {
-   u32 gpio_dr;/* data */
-   u32 gpio_dir;   /* direction */
-   u32 psr;/* pad satus */
-   u32 icr1;   /* interrupt config 1 */
-   u32 icr2;   /* interrupt config 2 */
-   u32 imr;/* interrupt mask */
-   u32 isr;/* interrupt status */
-   u32 edge_sel;   /* edge select */
-};
+#include asm/imx-common/gpio.h
 
 #endif
diff --git a/arch/arm/include/asm/arch-mx5/gpio.h 
b/arch/arm/include/asm/arch-mx5/gpio.h
index 1dc34e9..b1b1218 100644
--- a/arch/arm/include/asm/arch-mx5/gpio.h
+++ b/arch/arm/include/asm/arch-mx5/gpio.h
@@ -25,11 +25,6 @@
 #ifndef __ASM_ARCH_MX5_GPIO_H
 #define __ASM_ARCH_MX5_GPIO_H
 
-/* GPIO registers */
-struct gpio_regs {
-   u32 gpio_dr;
-   u32 gpio_dir;
-   u32 gpio_psr;
-};
+#include asm/imx-common/gpio.h
 
 #endif
diff --git a/arch/arm/include/asm/arch-mx6/gpio.h 
b/arch/arm/include/asm/arch-mx6/gpio.h
index 20c4e57..24c10f8 100644
--- a/arch/arm/include/asm/arch-mx6/gpio.h
+++ b/arch/arm/include/asm/arch-mx6/gpio.h
@@ -25,11 +25,6 @@
 #ifndef __ASM_ARCH_MX6_GPIO_H
 #define __ASM_ARCH_MX6_GPIO_H
 
-/* GPIO registers */
-struct gpio_regs {
-   u32 gpio_dr;
-   u32 gpio_dir;
-   u32 gpio_psr;
-};
+#include asm/imx-common/gpio.h
 
 #endif /* __ASM_ARCH_MX6_GPIO_H */
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h 
b/arch/arm/include/asm/arch-mx6/imx-regs.h
index 5d77603..f3e58b5 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -172,8 +172,6 @@
 #define IMX_IIM_BASE OCOTP_BASE_ADDR
 #define FEC_QUIRK_ENET_MAC
 
-#define GPIO_NUMBER(port, index)   port)-1)*32)+((index)31))
-
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
 #include asm/types.h
 
diff --git a/arch/arm/include/asm/imx-common/gpio.h 
b/arch/arm/include/asm/imx-common/gpio.h
new file mode 100644
index 000..65226d9

Re: [U-Boot] [PATCH v4] MX: Set a common gpio.h for all i.MX

2012-08-20 Thread Benoît Thébaudeau
Hi Stefano,

 Each i.MX has its own gpio.h, defining the same structure.
 The internal GPIO controller has the same layout
 (at least for the register used by u-boot) and can be shared.
 
 Signed-off-by: Stefano Babic sba...@denx.de
 ---
 Changes in v2:
 - please ignore this version, it is broken
 
 Changes in v3:
 - call the macro IMX_GPIO_NR  as in kernel (Fabio Estevam)
 - change psr in gpio_psr (Benoit Thebaudeau)
 - drop MXC_GPIO_PORT_TO_NUM and use common macro (Benoit Thebaudeau)
 
 Changes in v4:
 - Add missing comment in commit message
 
  arch/arm/include/asm/arch-mx25/gpio.h |   17 +--
  arch/arm/include/asm/arch-mx31/gpio.h |7 +
  arch/arm/include/asm/arch-mx35/gpio.h |   12 +---
  arch/arm/include/asm/arch-mx5/gpio.h  |7 +
  arch/arm/include/asm/arch-mx6/gpio.h  |7 +
  arch/arm/include/asm/arch-mx6/imx-regs.h  |2 --
  arch/arm/include/asm/imx-common/gpio.h|   39
  +
  board/freescale/mx6qsabrelite/mx6qsabrelite.c |   28
  +-
  board/karo/tx25/tx25.c|   10 +++
  board/syteco/zmx25/zmx25.c|   26
  -
  include/configs/mx6qsabrelite.h   |3 +-
  11 files changed, 78 insertions(+), 80 deletions(-)
  create mode 100644 arch/arm/include/asm/imx-common/gpio.h
 
 diff --git a/arch/arm/include/asm/arch-mx25/gpio.h
 b/arch/arm/include/asm/arch-mx25/gpio.h
 index dc6edc7..61c0b0d 100644
 --- a/arch/arm/include/asm/arch-mx25/gpio.h
 +++ b/arch/arm/include/asm/arch-mx25/gpio.h
 @@ -25,21 +25,6 @@
  #ifndef __ASM_ARCH_MX25_GPIO_H
  #define __ASM_ARCH_MX25_GPIO_H
  
 -/* Converts a GPIO port number and the internal bit position
 - * to the GPIO number
 - */
 -#define MXC_GPIO_PORT_TO_NUM(port, bit) (((port - 1)  5) + (bit 
 0x1f))
 -
 -/* GPIO registers */
 -struct gpio_regs {
 - u32 gpio_dr;/* data */
 - u32 gpio_dir;   /* direction */
 - u32 psr;/* pad satus */
 - u32 icr1;   /* interrupt config 1 */
 - u32 icr2;   /* interrupt config 2 */
 - u32 imr;/* interrupt mask */
 - u32 isr;/* interrupt status */
 - u32 edge_sel;   /* edge select */
 -};
 +#include asm/imx-common/gpio.h
  
  #endif
 diff --git a/arch/arm/include/asm/arch-mx31/gpio.h
 b/arch/arm/include/asm/arch-mx31/gpio.h
 index 95b73bf..55c0afa 100644
 --- a/arch/arm/include/asm/arch-mx31/gpio.h
 +++ b/arch/arm/include/asm/arch-mx31/gpio.h
 @@ -25,11 +25,6 @@
  #ifndef __ASM_ARCH_MX31_GPIO_H
  #define __ASM_ARCH_MX31_GPIO_H
  
 -/* GPIO Registers */
 -struct gpio_regs {
 - u32 gpio_dr;
 - u32 gpio_dir;
 - u32 gpio_psr;
 -};
 +#include asm/imx-common/gpio.h
  
  #endif
 diff --git a/arch/arm/include/asm/arch-mx35/gpio.h
 b/arch/arm/include/asm/arch-mx35/gpio.h
 index 7bcc3e8..1deb292 100644
 --- a/arch/arm/include/asm/arch-mx35/gpio.h
 +++ b/arch/arm/include/asm/arch-mx35/gpio.h
 @@ -25,16 +25,6 @@
  #ifndef __ASM_ARCH_MX35_GPIO_H
  #define __ASM_ARCH_MX35_GPIO_H
  
 -/* GPIO registers */
 -struct gpio_regs {
 - u32 gpio_dr;/* data */
 - u32 gpio_dir;   /* direction */
 - u32 psr;/* pad satus */
 - u32 icr1;   /* interrupt config 1 */
 - u32 icr2;   /* interrupt config 2 */
 - u32 imr;/* interrupt mask */
 - u32 isr;/* interrupt status */
 - u32 edge_sel;   /* edge select */
 -};
 +#include asm/imx-common/gpio.h
  
  #endif
 diff --git a/arch/arm/include/asm/arch-mx5/gpio.h
 b/arch/arm/include/asm/arch-mx5/gpio.h
 index 1dc34e9..b1b1218 100644
 --- a/arch/arm/include/asm/arch-mx5/gpio.h
 +++ b/arch/arm/include/asm/arch-mx5/gpio.h
 @@ -25,11 +25,6 @@
  #ifndef __ASM_ARCH_MX5_GPIO_H
  #define __ASM_ARCH_MX5_GPIO_H
  
 -/* GPIO registers */
 -struct gpio_regs {
 - u32 gpio_dr;
 - u32 gpio_dir;
 - u32 gpio_psr;
 -};
 +#include asm/imx-common/gpio.h
  
  #endif
 diff --git a/arch/arm/include/asm/arch-mx6/gpio.h
 b/arch/arm/include/asm/arch-mx6/gpio.h
 index 20c4e57..24c10f8 100644
 --- a/arch/arm/include/asm/arch-mx6/gpio.h
 +++ b/arch/arm/include/asm/arch-mx6/gpio.h
 @@ -25,11 +25,6 @@
  #ifndef __ASM_ARCH_MX6_GPIO_H
  #define __ASM_ARCH_MX6_GPIO_H
  
 -/* GPIO registers */
 -struct gpio_regs {
 - u32 gpio_dr;
 - u32 gpio_dir;
 - u32 gpio_psr;
 -};
 +#include asm/imx-common/gpio.h
  
  #endif   /* __ASM_ARCH_MX6_GPIO_H */
 diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h
 b/arch/arm/include/asm/arch-mx6/imx-regs.h
 index 5d77603..f3e58b5 100644
 --- a/arch/arm/include/asm/arch-mx6/imx-regs.h
 +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
 @@ -172,8 +172,6 @@
  #define IMX_IIM_BASE OCOTP_BASE_ADDR
  #define FEC_QUIRK_ENET_MAC
  
 -#define GPIO_NUMBER(port, index) port)-1)*32)+((index)31))
 -
  #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
  #include asm/types.h
  
 diff --git 

Re: [U-Boot] [PATCH v4] MX: Set a common gpio.h for all i.MX

2012-08-20 Thread Matt Sealey
Works fine on the Efika MX :)

Tested-by: Matt Sealey m...@genesi-usa.com

-- 
Matt Sealey m...@genesi-usa.com
Product Development Analyst, Genesi USA, Inc.


On Mon, Aug 20, 2012 at 2:33 AM, Stefano Babic sba...@denx.de wrote:
 Each i.MX has its own gpio.h, defining the same structure.
 The internal GPIO controller has the same layout
 (at least for the register used by u-boot) and can be shared.

 Signed-off-by: Stefano Babic sba...@denx.de
 ---
 Changes in v2:
 - please ignore this version, it is broken

 Changes in v3:
 - call the macro IMX_GPIO_NR  as in kernel (Fabio Estevam)
 - change psr in gpio_psr (Benoit Thebaudeau)
 - drop MXC_GPIO_PORT_TO_NUM and use common macro (Benoit Thebaudeau)

 Changes in v4:
 - Add missing comment in commit message

  arch/arm/include/asm/arch-mx25/gpio.h |   17 +--
  arch/arm/include/asm/arch-mx31/gpio.h |7 +
  arch/arm/include/asm/arch-mx35/gpio.h |   12 +---
  arch/arm/include/asm/arch-mx5/gpio.h  |7 +
  arch/arm/include/asm/arch-mx6/gpio.h  |7 +
  arch/arm/include/asm/arch-mx6/imx-regs.h  |2 --
  arch/arm/include/asm/imx-common/gpio.h|   39 
 +
  board/freescale/mx6qsabrelite/mx6qsabrelite.c |   28 +-
  board/karo/tx25/tx25.c|   10 +++
  board/syteco/zmx25/zmx25.c|   26 -
  include/configs/mx6qsabrelite.h   |3 +-
  11 files changed, 78 insertions(+), 80 deletions(-)
  create mode 100644 arch/arm/include/asm/imx-common/gpio.h

 diff --git a/arch/arm/include/asm/arch-mx25/gpio.h 
 b/arch/arm/include/asm/arch-mx25/gpio.h
 index dc6edc7..61c0b0d 100644
 --- a/arch/arm/include/asm/arch-mx25/gpio.h
 +++ b/arch/arm/include/asm/arch-mx25/gpio.h
 @@ -25,21 +25,6 @@
  #ifndef __ASM_ARCH_MX25_GPIO_H
  #define __ASM_ARCH_MX25_GPIO_H

 -/* Converts a GPIO port number and the internal bit position
 - * to the GPIO number
 - */
 -#define MXC_GPIO_PORT_TO_NUM(port, bit) (((port - 1)  5) + (bit  0x1f))
 -
 -/* GPIO registers */
 -struct gpio_regs {
 -   u32 gpio_dr;/* data */
 -   u32 gpio_dir;   /* direction */
 -   u32 psr;/* pad satus */
 -   u32 icr1;   /* interrupt config 1 */
 -   u32 icr2;   /* interrupt config 2 */
 -   u32 imr;/* interrupt mask */
 -   u32 isr;/* interrupt status */
 -   u32 edge_sel;   /* edge select */
 -};
 +#include asm/imx-common/gpio.h

  #endif
 diff --git a/arch/arm/include/asm/arch-mx31/gpio.h 
 b/arch/arm/include/asm/arch-mx31/gpio.h
 index 95b73bf..55c0afa 100644
 --- a/arch/arm/include/asm/arch-mx31/gpio.h
 +++ b/arch/arm/include/asm/arch-mx31/gpio.h
 @@ -25,11 +25,6 @@
  #ifndef __ASM_ARCH_MX31_GPIO_H
  #define __ASM_ARCH_MX31_GPIO_H

 -/* GPIO Registers */
 -struct gpio_regs {
 -   u32 gpio_dr;
 -   u32 gpio_dir;
 -   u32 gpio_psr;
 -};
 +#include asm/imx-common/gpio.h

  #endif
 diff --git a/arch/arm/include/asm/arch-mx35/gpio.h 
 b/arch/arm/include/asm/arch-mx35/gpio.h
 index 7bcc3e8..1deb292 100644
 --- a/arch/arm/include/asm/arch-mx35/gpio.h
 +++ b/arch/arm/include/asm/arch-mx35/gpio.h
 @@ -25,16 +25,6 @@
  #ifndef __ASM_ARCH_MX35_GPIO_H
  #define __ASM_ARCH_MX35_GPIO_H

 -/* GPIO registers */
 -struct gpio_regs {
 -   u32 gpio_dr;/* data */
 -   u32 gpio_dir;   /* direction */
 -   u32 psr;/* pad satus */
 -   u32 icr1;   /* interrupt config 1 */
 -   u32 icr2;   /* interrupt config 2 */
 -   u32 imr;/* interrupt mask */
 -   u32 isr;/* interrupt status */
 -   u32 edge_sel;   /* edge select */
 -};
 +#include asm/imx-common/gpio.h

  #endif
 diff --git a/arch/arm/include/asm/arch-mx5/gpio.h 
 b/arch/arm/include/asm/arch-mx5/gpio.h
 index 1dc34e9..b1b1218 100644
 --- a/arch/arm/include/asm/arch-mx5/gpio.h
 +++ b/arch/arm/include/asm/arch-mx5/gpio.h
 @@ -25,11 +25,6 @@
  #ifndef __ASM_ARCH_MX5_GPIO_H
  #define __ASM_ARCH_MX5_GPIO_H

 -/* GPIO registers */
 -struct gpio_regs {
 -   u32 gpio_dr;
 -   u32 gpio_dir;
 -   u32 gpio_psr;
 -};
 +#include asm/imx-common/gpio.h

  #endif
 diff --git a/arch/arm/include/asm/arch-mx6/gpio.h 
 b/arch/arm/include/asm/arch-mx6/gpio.h
 index 20c4e57..24c10f8 100644
 --- a/arch/arm/include/asm/arch-mx6/gpio.h
 +++ b/arch/arm/include/asm/arch-mx6/gpio.h
 @@ -25,11 +25,6 @@
  #ifndef __ASM_ARCH_MX6_GPIO_H
  #define __ASM_ARCH_MX6_GPIO_H

 -/* GPIO registers */
 -struct gpio_regs {
 -   u32 gpio_dr;
 -   u32 gpio_dir;
 -   u32 gpio_psr;
 -};
 +#include asm/imx-common/gpio.h

  #endif /* __ASM_ARCH_MX6_GPIO_H */
 diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h 
 b/arch/arm/include/asm/arch-mx6/imx-regs.h
 index 5d77603..f3e58b5 100644
 --- a/arch/arm/include/asm/arch-mx6/imx-regs.h
 +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
 @@ -172,8 +172,6 @@
  #define IMX_IIM_BASE