From 098877628888f28f321b8a61a9b0b982a969e415 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Thu, 16 Sep 2010 14:30:37 +0200 Subject: ppc4xx: Move gpio.h to ppc4xx-gpio.h since its ppc4xx specific Signed-off-by: Stefan Roese --- arch/powerpc/cpu/ppc4xx/cpu_init.c | 2 +- arch/powerpc/cpu/ppc4xx/gpio.c | 2 +- arch/powerpc/include/asm/gpio.h | 119 --------------------------------- arch/powerpc/include/asm/ppc4xx-gpio.h | 119 +++++++++++++++++++++++++++++++++ board/amcc/acadia/memory.c | 2 +- board/amcc/bamboo/bamboo.c | 2 +- board/amcc/canyonlands/canyonlands.c | 2 +- board/amcc/katmai/katmai.c | 2 +- board/amcc/makalu/makalu.c | 2 +- board/amcc/sequoia/sequoia.c | 2 +- board/amcc/taihu/lcd.c | 2 +- board/amcc/taihu/taihu.c | 2 +- board/esd/pmc405de/pmc405de.c | 2 +- board/gdsys/dlvision/dlvision.c | 2 +- board/gdsys/intip/intip.c | 2 +- board/korat/korat.c | 2 +- board/lwmon5/lwmon5.c | 2 +- board/mosaixtech/icon/icon.c | 2 +- board/quad100hd/nand.c | 2 +- board/quad100hd/quad100hd.c | 2 +- board/t3corp/t3corp.c | 2 +- board/zeus/update.c | 2 +- board/zeus/zeus.c | 2 +- post/board/lwmon5/watchdog.c | 2 +- 24 files changed, 141 insertions(+), 141 deletions(-) delete mode 100644 arch/powerpc/include/asm/gpio.h create mode 100644 arch/powerpc/include/asm/ppc4xx-gpio.h diff --git a/arch/powerpc/cpu/ppc4xx/cpu_init.c b/arch/powerpc/cpu/ppc4xx/cpu_init.c index 7a7954ddb9..6456dc7a98 100644 --- a/arch/powerpc/cpu/ppc4xx/cpu_init.c +++ b/arch/powerpc/cpu/ppc4xx/cpu_init.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #if defined(CONFIG_405GP) || defined(CONFIG_405EP) diff --git a/arch/powerpc/cpu/ppc4xx/gpio.c b/arch/powerpc/cpu/ppc4xx/gpio.c index c0d351a957..1f9f93a696 100644 --- a/arch/powerpc/cpu/ppc4xx/gpio.c +++ b/arch/powerpc/cpu/ppc4xx/gpio.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #if defined(CONFIG_SYS_4xx_GPIO_TABLE) gpio_param_s const gpio_tab[GPIO_GROUP_MAX][GPIO_MAX] = CONFIG_SYS_4xx_GPIO_TABLE; diff --git a/arch/powerpc/include/asm/gpio.h b/arch/powerpc/include/asm/gpio.h deleted file mode 100644 index 23e29b195e..0000000000 --- a/arch/powerpc/include/asm/gpio.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * (C) Copyright 2007-2008 - * Stefan Roese, DENX Software Engineering, sr@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_PPC_GPIO_H -#define __ASM_PPC_GPIO_H - -#include - -/* 4xx PPC's have 2 GPIO controllers */ -#if defined(CONFIG_405EZ) || \ - defined(CONFIG_440EP) || defined(CONFIG_440GR) || \ - defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \ - defined(CONFIG_460EX) || defined(CONFIG_460GT) -#define GPIO_GROUP_MAX 2 -#else -#define GPIO_GROUP_MAX 1 -#endif - -/* GPIO controller */ -struct ppc4xx_gpio { - u32 or; /* Output Control */ - u32 tcr; /* Tri-State Control */ - u32 osl; /* Output Select 16..31 */ - u32 osh; /* Output Select 0..15 */ - u32 tsl; /* Tri-State Select 16..31 */ - u32 tsh; /* Tri-State Select 0..15 */ - u32 odr; /* Open Drain */ - u32 ir; /* Input */ - u32 rr1; /* Receive Register 1 */ - u32 rr2; /* Receive Register 2 */ - u32 rr3; /* Receive Register 3 */ - u32 reserved; - u32 is1l; /* Input Select 1 16..31 */ - u32 is1h; /* Input Select 1 0..15 */ - u32 is2l; /* Input Select 2 16..31 */ - u32 is2h; /* Input Select 2 0..15 */ - u32 is3l; /* Input Select 3 16..31 */ - u32 is3h; /* Input Select 3 0..15 */ -}; - -/* Offsets */ -#define GPIOx_OR 0x00 /* GPIO Output Register */ -#define GPIOx_TCR 0x04 /* GPIO Three-State Control Register */ -#define GPIOx_OSL 0x08 /* GPIO Output Select Register (Bits 0-31) */ -#define GPIOx_OSH 0x0C /* GPIO Ouput Select Register (Bits 32-63) */ -#define GPIOx_TSL 0x10 /* GPIO Three-State Select Register (Bits 0-31) */ -#define GPIOx_TSH 0x14 /* GPIO Three-State Select Register (Bits 32-63) */ -#define GPIOx_ODR 0x18 /* GPIO Open drain Register */ -#define GPIOx_IR 0x1C /* GPIO Input Register */ -#define GPIOx_RR1 0x20 /* GPIO Receive Register 1 */ -#define GPIOx_RR2 0x24 /* GPIO Receive Register 2 */ -#define GPIOx_RR3 0x28 /* GPIO Receive Register 3 */ -#define GPIOx_IS1L 0x30 /* GPIO Input Select Register 1 (Bits 0-31) */ -#define GPIOx_IS1H 0x34 /* GPIO Input Select Register 1 (Bits 32-63) */ -#define GPIOx_IS2L 0x38 /* GPIO Input Select Register 2 (Bits 0-31) */ -#define GPIOx_IS2H 0x3C /* GPIO Input Select Register 2 (Bits 32-63) */ -#define GPIOx_IS3L 0x40 /* GPIO Input Select Register 3 (Bits 0-31) */ -#define GPIOx_IS3H 0x44 /* GPIO Input Select Register 3 (Bits 32-63) */ - -#define GPIO_OR(x) (x+GPIOx_OR) /* GPIO Output Register */ -#define GPIO_TCR(x) (x+GPIOx_TCR) /* GPIO Three-State Control Register */ -#define GPIO_OS(x) (x+GPIOx_OSL) /* GPIO Output Select Register High or Low */ -#define GPIO_TS(x) (x+GPIOx_TSL) /* GPIO Three-state Control Reg High or Low */ -#define GPIO_IS1(x) (x+GPIOx_IS1L) /* GPIO Input register1 High or Low */ -#define GPIO_IS2(x) (x+GPIOx_IS2L) /* GPIO Input register2 High or Low */ -#define GPIO_IS3(x) (x+GPIOx_IS3L) /* GPIO Input register3 High or Low */ - -#define GPIO0 0 -#define GPIO1 1 - -#define GPIO_MAX 32 -#define GPIO_ALT1_SEL 0x40000000 -#define GPIO_ALT2_SEL 0x80000000 -#define GPIO_ALT3_SEL 0xc0000000 -#define GPIO_IN_SEL 0x40000000 -#define GPIO_MASK 0xc0000000 - -#define GPIO_VAL(gpio) (0x80000000 >> (gpio)) - -#ifndef __ASSEMBLY__ -typedef enum gpio_select { GPIO_SEL, GPIO_ALT1, GPIO_ALT2, GPIO_ALT3 } gpio_select_t; -typedef enum gpio_driver { GPIO_DIS, GPIO_IN, GPIO_OUT, GPIO_BI } gpio_driver_t; -typedef enum gpio_out { GPIO_OUT_0, GPIO_OUT_1, GPIO_OUT_NO_CHG } gpio_out_t; - -typedef struct { - unsigned long add; /* gpio core base address */ - gpio_driver_t in_out; /* Driver Setting */ - gpio_select_t alt_nb; /* Selected Alternate */ - gpio_out_t out_val;/* Default Output Value */ -} gpio_param_s; -#endif - -void gpio_config(int pin, int in_out, int gpio_alt, int out_val); -void gpio_write_bit(int pin, int val); -int gpio_read_out_bit(int pin); -int gpio_read_in_bit(int pin); -void gpio_set_chip_configuration(void); - -#endif /* __ASM_PPC_GPIO_H */ diff --git a/arch/powerpc/include/asm/ppc4xx-gpio.h b/arch/powerpc/include/asm/ppc4xx-gpio.h new file mode 100644 index 0000000000..23e29b195e --- /dev/null +++ b/arch/powerpc/include/asm/ppc4xx-gpio.h @@ -0,0 +1,119 @@ +/* + * (C) Copyright 2007-2008 + * Stefan Roese, DENX Software Engineering, sr@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_PPC_GPIO_H +#define __ASM_PPC_GPIO_H + +#include + +/* 4xx PPC's have 2 GPIO controllers */ +#if defined(CONFIG_405EZ) || \ + defined(CONFIG_440EP) || defined(CONFIG_440GR) || \ + defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \ + defined(CONFIG_460EX) || defined(CONFIG_460GT) +#define GPIO_GROUP_MAX 2 +#else +#define GPIO_GROUP_MAX 1 +#endif + +/* GPIO controller */ +struct ppc4xx_gpio { + u32 or; /* Output Control */ + u32 tcr; /* Tri-State Control */ + u32 osl; /* Output Select 16..31 */ + u32 osh; /* Output Select 0..15 */ + u32 tsl; /* Tri-State Select 16..31 */ + u32 tsh; /* Tri-State Select 0..15 */ + u32 odr; /* Open Drain */ + u32 ir; /* Input */ + u32 rr1; /* Receive Register 1 */ + u32 rr2; /* Receive Register 2 */ + u32 rr3; /* Receive Register 3 */ + u32 reserved; + u32 is1l; /* Input Select 1 16..31 */ + u32 is1h; /* Input Select 1 0..15 */ + u32 is2l; /* Input Select 2 16..31 */ + u32 is2h; /* Input Select 2 0..15 */ + u32 is3l; /* Input Select 3 16..31 */ + u32 is3h; /* Input Select 3 0..15 */ +}; + +/* Offsets */ +#define GPIOx_OR 0x00 /* GPIO Output Register */ +#define GPIOx_TCR 0x04 /* GPIO Three-State Control Register */ +#define GPIOx_OSL 0x08 /* GPIO Output Select Register (Bits 0-31) */ +#define GPIOx_OSH 0x0C /* GPIO Ouput Select Register (Bits 32-63) */ +#define GPIOx_TSL 0x10 /* GPIO Three-State Select Register (Bits 0-31) */ +#define GPIOx_TSH 0x14 /* GPIO Three-State Select Register (Bits 32-63) */ +#define GPIOx_ODR 0x18 /* GPIO Open drain Register */ +#define GPIOx_IR 0x1C /* GPIO Input Register */ +#define GPIOx_RR1 0x20 /* GPIO Receive Register 1 */ +#define GPIOx_RR2 0x24 /* GPIO Receive Register 2 */ +#define GPIOx_RR3 0x28 /* GPIO Receive Register 3 */ +#define GPIOx_IS1L 0x30 /* GPIO Input Select Register 1 (Bits 0-31) */ +#define GPIOx_IS1H 0x34 /* GPIO Input Select Register 1 (Bits 32-63) */ +#define GPIOx_IS2L 0x38 /* GPIO Input Select Register 2 (Bits 0-31) */ +#define GPIOx_IS2H 0x3C /* GPIO Input Select Register 2 (Bits 32-63) */ +#define GPIOx_IS3L 0x40 /* GPIO Input Select Register 3 (Bits 0-31) */ +#define GPIOx_IS3H 0x44 /* GPIO Input Select Register 3 (Bits 32-63) */ + +#define GPIO_OR(x) (x+GPIOx_OR) /* GPIO Output Register */ +#define GPIO_TCR(x) (x+GPIOx_TCR) /* GPIO Three-State Control Register */ +#define GPIO_OS(x) (x+GPIOx_OSL) /* GPIO Output Select Register High or Low */ +#define GPIO_TS(x) (x+GPIOx_TSL) /* GPIO Three-state Control Reg High or Low */ +#define GPIO_IS1(x) (x+GPIOx_IS1L) /* GPIO Input register1 High or Low */ +#define GPIO_IS2(x) (x+GPIOx_IS2L) /* GPIO Input register2 High or Low */ +#define GPIO_IS3(x) (x+GPIOx_IS3L) /* GPIO Input register3 High or Low */ + +#define GPIO0 0 +#define GPIO1 1 + +#define GPIO_MAX 32 +#define GPIO_ALT1_SEL 0x40000000 +#define GPIO_ALT2_SEL 0x80000000 +#define GPIO_ALT3_SEL 0xc0000000 +#define GPIO_IN_SEL 0x40000000 +#define GPIO_MASK 0xc0000000 + +#define GPIO_VAL(gpio) (0x80000000 >> (gpio)) + +#ifndef __ASSEMBLY__ +typedef enum gpio_select { GPIO_SEL, GPIO_ALT1, GPIO_ALT2, GPIO_ALT3 } gpio_select_t; +typedef enum gpio_driver { GPIO_DIS, GPIO_IN, GPIO_OUT, GPIO_BI } gpio_driver_t; +typedef enum gpio_out { GPIO_OUT_0, GPIO_OUT_1, GPIO_OUT_NO_CHG } gpio_out_t; + +typedef struct { + unsigned long add; /* gpio core base address */ + gpio_driver_t in_out; /* Driver Setting */ + gpio_select_t alt_nb; /* Selected Alternate */ + gpio_out_t out_val;/* Default Output Value */ +} gpio_param_s; +#endif + +void gpio_config(int pin, int in_out, int gpio_alt, int out_val); +void gpio_write_bit(int pin, int val); +int gpio_read_out_bit(int pin); +int gpio_read_in_bit(int pin); +void gpio_set_chip_configuration(void); + +#endif /* __ASM_PPC_GPIO_H */ diff --git a/board/amcc/acadia/memory.c b/board/amcc/acadia/memory.c index 8c2addcb94..703a6686ea 100644 --- a/board/amcc/acadia/memory.c +++ b/board/amcc/acadia/memory.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include extern void board_pll_init_f(void); diff --git a/board/amcc/bamboo/bamboo.c b/board/amcc/bamboo/bamboo.c index 99497b2d42..41957c9b8f 100644 --- a/board/amcc/bamboo/bamboo.c +++ b/board/amcc/bamboo/bamboo.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include "bamboo.h" diff --git a/board/amcc/canyonlands/canyonlands.c b/board/amcc/canyonlands/canyonlands.c index ccc44f4413..b26cadb6bb 100644 --- a/board/amcc/canyonlands/canyonlands.c +++ b/board/amcc/canyonlands/canyonlands.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips */ diff --git a/board/amcc/katmai/katmai.c b/board/amcc/katmai/katmai.c index 15cf703891..7301cd5953 100644 --- a/board/amcc/katmai/katmai.c +++ b/board/amcc/katmai/katmai.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include diff --git a/board/amcc/makalu/makalu.c b/board/amcc/makalu/makalu.c index 3e3fccdbb0..483df66272 100644 --- a/board/amcc/makalu/makalu.c +++ b/board/amcc/makalu/makalu.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/amcc/sequoia/sequoia.c b/board/amcc/sequoia/sequoia.c index 1a6dfc1dc6..4338e6bca5 100644 --- a/board/amcc/sequoia/sequoia.c +++ b/board/amcc/sequoia/sequoia.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/amcc/taihu/lcd.c b/board/amcc/taihu/lcd.c index 9b2afdabca..15cfcb0c83 100644 --- a/board/amcc/taihu/lcd.c +++ b/board/amcc/taihu/lcd.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #define LCD_CMD_ADDR 0x50100002 #define LCD_DATA_ADDR 0x50100003 diff --git a/board/amcc/taihu/taihu.c b/board/amcc/taihu/taihu.c index dd2aba546c..87c9403e4a 100644 --- a/board/amcc/taihu/taihu.c +++ b/board/amcc/taihu/taihu.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include extern int lcd_init(void); diff --git a/board/esd/pmc405de/pmc405de.c b/board/esd/pmc405de/pmc405de.c index b84e08ad72..c266ebe84f 100644 --- a/board/esd/pmc405de/pmc405de.c +++ b/board/esd/pmc405de/pmc405de.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/gdsys/dlvision/dlvision.c b/board/gdsys/dlvision/dlvision.c index ff5f183235..3499bdc685 100644 --- a/board/gdsys/dlvision/dlvision.c +++ b/board/gdsys/dlvision/dlvision.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include enum { HWTYPE_DLVISION_CPU = 0, diff --git a/board/gdsys/intip/intip.c b/board/gdsys/intip/intip.c index 8d83198f72..aa85ea416a 100644 --- a/board/gdsys/intip/intip.c +++ b/board/gdsys/intip/intip.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; diff --git a/board/korat/korat.c b/board/korat/korat.c index cdcd8c9a70..afa36d6c6e 100644 --- a/board/korat/korat.c +++ b/board/korat/korat.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/lwmon5/lwmon5.c b/board/lwmon5/lwmon5.c index aec026314f..0c6f4e571c 100644 --- a/board/lwmon5/lwmon5.c +++ b/board/lwmon5/lwmon5.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include DECLARE_GLOBAL_DATA_PTR; diff --git a/board/mosaixtech/icon/icon.c b/board/mosaixtech/icon/icon.c index 70b03dc803..e09dbc3df0 100644 --- a/board/mosaixtech/icon/icon.c +++ b/board/mosaixtech/icon/icon.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/quad100hd/nand.c b/board/quad100hd/nand.c index 35525bc3bf..a2220994e2 100644 --- a/board/quad100hd/nand.c +++ b/board/quad100hd/nand.c @@ -24,7 +24,7 @@ #include #include #if defined(CONFIG_CMD_NAND) -#include +#include #include #include diff --git a/board/quad100hd/quad100hd.c b/board/quad100hd/quad100hd.c index f878c49bfa..2f72d2b1be 100644 --- a/board/quad100hd/quad100hd.c +++ b/board/quad100hd/quad100hd.c @@ -33,7 +33,7 @@ #include #include -#include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/board/t3corp/t3corp.c b/board/t3corp/t3corp.c index 26568e23c5..04d6a2e2af 100644 --- a/board/t3corp/t3corp.c +++ b/board/t3corp/t3corp.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include int board_early_init_f(void) { diff --git a/board/zeus/update.c b/board/zeus/update.c index 61196276d5..141f14b2b0 100644 --- a/board/zeus/update.c +++ b/board/zeus/update.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #if defined(CONFIG_ZEUS) diff --git a/board/zeus/zeus.c b/board/zeus/zeus.c index 4e6878a266..a29e518e0a 100644 --- a/board/zeus/zeus.c +++ b/board/zeus/zeus.c @@ -30,7 +30,7 @@ #include #include -#include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/post/board/lwmon5/watchdog.c b/post/board/lwmon5/watchdog.c index 44f0488323..f181506fe4 100644 --- a/post/board/lwmon5/watchdog.c +++ b/post/board/lwmon5/watchdog.c @@ -34,7 +34,7 @@ #if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG #include -#include +#include #include static uint watchdog_magic_read(void) -- cgit v1.2.1