Patchwork [U-Boot,3/3] imx: Define a common header file for gpio.h

login
register
mail settings
Submitter Vikram Narayanan
Date June 10, 2012, 1:04 p.m.
Message ID <4FD49B72.7050100@gmail.com>
Download mbox | patch
Permalink /patch/163998/
State Superseded
Headers show

Comments

Vikram Narayanan - June 10, 2012, 1:04 p.m.
Remove redundant gpio_regs structure for every board and define a
common header for gpio_regs in the drivers/gpio directory. All the
board files needs to be changed to point to asm-generic/gpio.h
for gpio_* functions.

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Cc: John Rigby <jcrigby@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
---
 arch/arm/include/asm/arch-mx25/gpio.h              |   41 --------------------
 arch/arm/include/asm/arch-mx31/gpio.h              |   35 -----------------
 arch/arm/include/asm/arch-mx35/gpio.h              |   40 -------------------
 arch/arm/include/asm/arch-mx5/gpio.h               |   35 -----------------
 board/CarMediaLab/flea3/flea3.c                    |    2 +-
 board/davedenx/qong/fpga.c                         |    2 +-
 board/davedenx/qong/qong.c                         |    2 +-
 board/denx/m28evk/m28evk.c                         |    2 +-
 board/efikamx/efikamx-usb.c                        |    2 +-
 board/efikamx/efikamx.c                            |    2 +-
 board/esg/ima3-mx53/ima3-mx53.c                    |    2 +-
 board/freescale/mx28evk/mx28evk.c                  |    2 +-
 board/freescale/mx35pdk/mx35pdk.c                  |    2 +-
 board/freescale/mx51evk/mx51evk.c                  |    2 +-
 board/freescale/mx53ard/mx53ard.c                  |    2 +-
 board/freescale/mx53evk/mx53evk.c                  |    2 +-
 board/freescale/mx53loco/mx53loco.c                |    2 +-
 board/freescale/mx53smd/mx53smd.c                  |    2 +-
 board/freescale/mx6qarm2/mx6qarm2.c                |    2 +-
 board/freescale/mx6qsabrelite/mx6qsabrelite.c      |    2 +-
 board/karo/tx25/tx25.c                             |    2 +-
 board/syteco/zmx25/zmx25.c                         |    2 +-
 board/ttcontrol/vision2/vision2.c                  |    2 +-
 common/cmd_gpio.c                                  |    2 +-
 drivers/gpio/mxc_gpio.c                            |    2 +-
 .../asm/arch-mx6/gpio.h => drivers/gpio/mxc_gpio.h |   12 +++---
 drivers/spi/mxc_spi.c                              |    2 +-
 27 files changed, 28 insertions(+), 179 deletions(-)
 delete mode 100644 arch/arm/include/asm/arch-mx25/gpio.h
 delete mode 100644 arch/arm/include/asm/arch-mx31/gpio.h
 delete mode 100644 arch/arm/include/asm/arch-mx35/gpio.h
 delete mode 100644 arch/arm/include/asm/arch-mx5/gpio.h
 rename arch/arm/include/asm/arch-mx6/gpio.h => drivers/gpio/mxc_gpio.h (85%)

Patch

diff --git a/arch/arm/include/asm/arch-mx25/gpio.h b/arch/arm/include/asm/arch-mx25/gpio.h
deleted file mode 100644
index cc32d50..0000000
--- a/arch/arm/include/asm/arch-mx25/gpio.h
+++ /dev/null
@@ -1,41 +0,0 @@ 
-/*
- * Copyright (C) 2011
- * Stefano Babic, DENX Software Engineering, <sbabic@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#ifndef __ASM_ARCH_MX25_GPIO_H
-#define __ASM_ARCH_MX25_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 */
-};
-
-#endif
diff --git a/arch/arm/include/asm/arch-mx31/gpio.h b/arch/arm/include/asm/arch-mx31/gpio.h
deleted file mode 100644
index 95b73bf..0000000
--- a/arch/arm/include/asm/arch-mx31/gpio.h
+++ /dev/null
@@ -1,35 +0,0 @@ 
-/*
- * Copyright (C) 2011
- * Stefano Babic, DENX Software Engineering, <sbabic@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#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;
-};
-
-#endif
diff --git a/arch/arm/include/asm/arch-mx35/gpio.h b/arch/arm/include/asm/arch-mx35/gpio.h
deleted file mode 100644
index 7bcc3e8..0000000
--- a/arch/arm/include/asm/arch-mx35/gpio.h
+++ /dev/null
@@ -1,40 +0,0 @@ 
-/*
- * Copyright (C) 2011
- * Stefano Babic, DENX Software Engineering, <sbabic@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#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 */
-};
-
-#endif
diff --git a/arch/arm/include/asm/arch-mx5/gpio.h b/arch/arm/include/asm/arch-mx5/gpio.h
deleted file mode 100644
index 1dc34e9..0000000
--- a/arch/arm/include/asm/arch-mx5/gpio.h
+++ /dev/null
@@ -1,35 +0,0 @@ 
-/*
- * Copyright (C) 2011
- * Stefano Babic, DENX Software Engineering, <sbabic@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#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;
-};
-
-#endif
diff --git a/board/CarMediaLab/flea3/flea3.c b/board/CarMediaLab/flea3/flea3.c
index 34ede87..5577ca7 100644
--- a/board/CarMediaLab/flea3/flea3.c
+++ b/board/CarMediaLab/flea3/flea3.c
@@ -33,7 +33,7 @@ 
 #include <asm/arch/iomux.h>
 #include <i2c.h>
 #include <linux/types.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include <asm/arch/sys_proto.h>
 #include <netdev.h>
 
diff --git a/board/davedenx/qong/fpga.c b/board/davedenx/qong/fpga.c
index 6536a0b..726c136 100644
--- a/board/davedenx/qong/fpga.c
+++ b/board/davedenx/qong/fpga.c
@@ -25,7 +25,7 @@ 
 #include <common.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include <fpga.h>
 #include <lattice.h>
 #include "qong_fpga.h"
diff --git a/board/davedenx/qong/qong.c b/board/davedenx/qong/qong.c
index c41f11d..0f29cb2 100644
--- a/board/davedenx/qong/qong.c
+++ b/board/davedenx/qong/qong.c
@@ -30,7 +30,7 @@ 
 #include <nand.h>
 #include <pmic.h>
 #include <fsl_pmic.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include "qong_fpga.h"
 #include <watchdog.h>
 
diff --git a/board/denx/m28evk/m28evk.c b/board/denx/m28evk/m28evk.c
index 3d28ea8..1304ba3 100644
--- a/board/denx/m28evk/m28evk.c
+++ b/board/denx/m28evk/m28evk.c
@@ -24,7 +24,7 @@ 
  */
 
 #include <common.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux-mx28.h>
diff --git a/board/efikamx/efikamx-usb.c b/board/efikamx/efikamx-usb.c
index 618b39d..7845ff9 100644
--- a/board/efikamx/efikamx-usb.c
+++ b/board/efikamx/efikamx-usb.c
@@ -28,7 +28,7 @@ 
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/mx5x_pins.h>
 #include <asm/arch/iomux.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include <usb/ehci-fsl.h>
 #include <usb/ulpi.h>
 #include <errno.h>
diff --git a/board/efikamx/efikamx.c b/board/efikamx/efikamx.c
index e88b2ed..4fd095d 100644
--- a/board/efikamx/efikamx.c
+++ b/board/efikamx/efikamx.c
@@ -27,7 +27,7 @@ 
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/mx5x_pins.h>
 #include <asm/arch/iomux.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include <asm/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/crm_regs.h>
diff --git a/board/esg/ima3-mx53/ima3-mx53.c b/board/esg/ima3-mx53/ima3-mx53.c
index 9ecf31d..e60d60d 100644
--- a/board/esg/ima3-mx53/ima3-mx53.c
+++ b/board/esg/ima3-mx53/ima3-mx53.c
@@ -32,7 +32,7 @@ 
 #include <netdev.h>
 #include <mmc.h>
 #include <fsl_esdhc.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 
 /* NOR flash configuration */
 #define IMA3_MX53_CS0GCR1	(CSEN | DSZ(2))
diff --git a/board/freescale/mx28evk/mx28evk.c b/board/freescale/mx28evk/mx28evk.c
index 1bc83e9..3a09453 100644
--- a/board/freescale/mx28evk/mx28evk.c
+++ b/board/freescale/mx28evk/mx28evk.c
@@ -24,7 +24,7 @@ 
  */
 
 #include <common.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux-mx28.h>
diff --git a/board/freescale/mx35pdk/mx35pdk.c b/board/freescale/mx35pdk/mx35pdk.c
index bc415b8..e50d5cd 100644
--- a/board/freescale/mx35pdk/mx35pdk.c
+++ b/board/freescale/mx35pdk/mx35pdk.c
@@ -35,7 +35,7 @@ 
 #include <mc9sdz60.h>
 #include <mc13892.h>
 #include <linux/types.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include <asm/arch/sys_proto.h>
 #include <netdev.h>
 
diff --git a/board/freescale/mx51evk/mx51evk.c b/board/freescale/mx51evk/mx51evk.c
index 514a7ac..3b47f86 100644
--- a/board/freescale/mx51evk/mx51evk.c
+++ b/board/freescale/mx51evk/mx51evk.c
@@ -22,7 +22,7 @@ 
 
 #include <common.h>
 #include <asm/io.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/mx5x_pins.h>
 #include <asm/arch/iomux.h>
diff --git a/board/freescale/mx53ard/mx53ard.c b/board/freescale/mx53ard/mx53ard.c
index 2d21584..a2410bc 100644
--- a/board/freescale/mx53ard/mx53ard.c
+++ b/board/freescale/mx53ard/mx53ard.c
@@ -31,7 +31,7 @@ 
 #include <netdev.h>
 #include <mmc.h>
 #include <fsl_esdhc.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 
 #define ETHERNET_INT		(1 * 32 + 31)  /* GPIO2_31 */
 
diff --git a/board/freescale/mx53evk/mx53evk.c b/board/freescale/mx53evk/mx53evk.c
index 8a6e31d..0edc327 100644
--- a/board/freescale/mx53evk/mx53evk.c
+++ b/board/freescale/mx53evk/mx53evk.c
@@ -34,7 +34,7 @@ 
 #include <fsl_esdhc.h>
 #include <pmic.h>
 #include <fsl_pmic.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include <mc13892.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
index d8e027c..d747b51 100644
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -35,7 +35,7 @@ 
 #include <i2c.h>
 #include <mmc.h>
 #include <fsl_esdhc.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include <pmic.h>
 #include <dialog_pmic.h>
 #include <fsl_pmic.h>
diff --git a/board/freescale/mx53smd/mx53smd.c b/board/freescale/mx53smd/mx53smd.c
index c237980..9cf73f4 100644
--- a/board/freescale/mx53smd/mx53smd.c
+++ b/board/freescale/mx53smd/mx53smd.c
@@ -27,7 +27,7 @@ 
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/iomux.h>
-#include <asm/errno.h>
+#include <asm-generic/errno.h>
 #include <netdev.h>
 #include <mmc.h>
 #include <fsl_esdhc.h>
diff --git a/board/freescale/mx6qarm2/mx6qarm2.c b/board/freescale/mx6qarm2/mx6qarm2.c
index 1367b88..c286a6d 100644
--- a/board/freescale/mx6qarm2/mx6qarm2.c
+++ b/board/freescale/mx6qarm2/mx6qarm2.c
@@ -26,7 +26,7 @@ 
 #include <asm/arch/mx6x_pins.h>
 #include <asm/arch/iomux-v3.h>
 #include <asm/errno.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include <mmc.h>
 #include <fsl_esdhc.h>
 #include <miiphy.h>
diff --git a/board/freescale/mx6qsabrelite/mx6qsabrelite.c b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
index 29cbfed..72669c9 100644
--- a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
+++ b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
@@ -27,7 +27,7 @@ 
 #include <asm/arch/iomux-v3.h>
 #include <asm/arch/clock.h>
 #include <asm/errno.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include <mmc.h>
 #include <fsl_esdhc.h>
 #include <micrel.h>
diff --git a/board/karo/tx25/tx25.c b/board/karo/tx25/tx25.c
index 6d03130..d1c8701 100644
--- a/board/karo/tx25/tx25.c
+++ b/board/karo/tx25/tx25.c
@@ -28,7 +28,7 @@ 
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/imx25-pinmux.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include <asm/arch/sys_proto.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/syteco/zmx25/zmx25.c b/board/syteco/zmx25/zmx25.c
index c56b195..6efb783 100644
--- a/board/syteco/zmx25/zmx25.c
+++ b/board/syteco/zmx25/zmx25.c
@@ -29,7 +29,7 @@ 
  *
  */
 #include <common.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/imx25-pinmux.h>
diff --git a/board/ttcontrol/vision2/vision2.c b/board/ttcontrol/vision2/vision2.c
index d68bef7..980016d 100644
--- a/board/ttcontrol/vision2/vision2.c
+++ b/board/ttcontrol/vision2/vision2.c
@@ -29,7 +29,7 @@ 
 #include <asm/arch/mx5x_pins.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/iomux.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include <asm/arch/sys_proto.h>
 #include <i2c.h>
 #include <mmc.h>
diff --git a/common/cmd_gpio.c b/common/cmd_gpio.c
index 47eee89..d33e83b 100644
--- a/common/cmd_gpio.c
+++ b/common/cmd_gpio.c
@@ -9,7 +9,7 @@ 
 #include <common.h>
 #include <command.h>
 
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 
 #ifndef name_to_gpio
 #define name_to_gpio(name) simple_strtoul(name, NULL, 10)
diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
index 6615535..c990609 100644
--- a/drivers/gpio/mxc_gpio.c
+++ b/drivers/gpio/mxc_gpio.c
@@ -25,7 +25,7 @@ 
  */
 #include <common.h>
 #include <asm/arch/imx-regs.h>
-#include <asm/gpio.h>
+#include "mxc_gpio.h"
 #include <asm/io.h>
 #include <errno.h>
 
diff --git a/arch/arm/include/asm/arch-mx6/gpio.h b/drivers/gpio/mxc_gpio.h
similarity index 85%
rename from arch/arm/include/asm/arch-mx6/gpio.h
rename to drivers/gpio/mxc_gpio.h
index 20c4e57..af6a8e8 100644
--- a/arch/arm/include/asm/arch-mx6/gpio.h
+++ b/drivers/gpio/mxc_gpio.h
@@ -22,14 +22,14 @@ 
  */
 
 
-#ifndef __ASM_ARCH_MX6_GPIO_H
-#define __ASM_ARCH_MX6_GPIO_H
+#ifndef __IMX_GPIO_H
+#define __IMX_GPIO_H
 
 /* GPIO registers */
 struct gpio_regs {
-	u32	gpio_dr;
-	u32	gpio_dir;
-	u32	gpio_psr;
+	u32 gpio_dr;	/* data */
+	u32 gpio_dir;	/* direction */
+	u32 gpio_psr;	/* pad satus */
 };
 
-#endif	/* __ASM_ARCH_MX6_GPIO_H */
+#endif /*  __IMX_GPIO_H */
diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index 2e15318..e11b714 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -23,7 +23,7 @@ 
 #include <spi.h>
 #include <asm/errno.h>
 #include <asm/io.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>