From 0aca3bac3c395728fe42ed5ced85435d7f12899f Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Sun, 20 May 2007 19:47:41 +0000 Subject: [PATCH] Implement architecture speficic GPIO calls for adm5120, thanks to Gabor Juhos SVN-Revision: 7286 --- target/linux/adm5120-2.6/config/default | 1 + .../files/arch/mips/adm5120/Makefile | 1 + .../asm-mips/mach-adm5120/adm5120_info.h | 10 ++++++ .../asm-mips/mach-adm5120/adm5120_switch.h | 32 +++++++++++++++++++ .../adm5120-2.6/patches/001-adm5120.patch | 3 +- target/linux/adm5120eb-2.6/config/default | 1 + 6 files changed, 47 insertions(+), 1 deletion(-) diff --git a/target/linux/adm5120-2.6/config/default b/target/linux/adm5120-2.6/config/default index 9747a42a75..3252f043fc 100644 --- a/target/linux/adm5120-2.6/config/default +++ b/target/linux/adm5120-2.6/config/default @@ -17,6 +17,7 @@ CONFIG_CMDLINE="console=ttyS0,115200 rootfs=jffs2,squashfs init=/etc/preinit" CONFIG_CPU_HAS_LLSC=y CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y +CONFIG_GENERIC_GPIO=y CONFIG_CPU_LITTLE_ENDIAN=y CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/Makefile b/target/linux/adm5120-2.6/files/arch/mips/adm5120/Makefile index 7ea82a1309..f3e0e7f988 100644 --- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/Makefile +++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/Makefile @@ -3,5 +3,6 @@ # obj-y := setup.o prom.o irq.o memory.o int-handler.o adm5120_info.o +obj-y += gpio.o EXTRA_AFLAGS := $(CFLAGS) diff --git a/target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/adm5120_info.h b/target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/adm5120_info.h index dbb02cf8ed..c78c46b3b7 100644 --- a/target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/adm5120_info.h +++ b/target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/adm5120_info.h @@ -52,6 +52,16 @@ extern unsigned int adm5120_package; extern void adm5120_info_init(void); +static inline int adm5120_package_pqfp(void) +{ + return (adm5120_package == ADM5120_PACKAGE_PQFP); +} + +static inline int adm5120_package_bga(void) +{ + return (adm5120_package == ADM5120_PACKAGE_BGA); +} + static inline int adm5120_has_pci(void) { return (adm5120_package == ADM5120_PACKAGE_BGA); diff --git a/target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/adm5120_switch.h b/target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/adm5120_switch.h index 52ea79e7ab..a0fc1e44ec 100644 --- a/target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/adm5120_switch.h +++ b/target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/adm5120_switch.h @@ -85,5 +85,37 @@ #define CODE_PK_BGA 0 /* BGA package */ #define CODE_PK_PQFP 1 /* PQFP package */ +/* GPIO_CONF0 register bits */ +#define GPIO_CONF0_MASK BITMASK(8) +#define GPIO_CONF0_IM_SHIFT 0 +#define GPIO_CONF0_IV_SHIFT 8 +#define GPIO_CONF0_OE_SHIFT 16 +#define GPIO_CONF0_OV_SHIFT 24 +#define GPIO_CONF0_IM_MASK (0xFF << GPIO_CONF0_IM_SHIFT) +#define GPIO_CONF0_IV_MASK (0xFF << GPIO_CONF0_IV_SHIFT) +#define GPIO_CONF0_OE_MASK (0xFF << GPIO_CONF0_OE_SHIFT) +#define GPIO_CONF0_OV_MASK (0xFF << GPIO_CONF0_OV_SHIFT) + +/* PORTx_LED register bits */ +#define LED_MODE_MASK BITMASK(4) +#define LED_MODE_INPUT 0 +#define LED_MODE_FLASH 1 +#define LED_MODE_OUT_HIGH 2 +#define LED_MODE_OUT_LOW 3 +#define LED_MODE_LINK 4 +#define LED_MODE_SPEED 5 +#define LED_MODE_DUPLEX 6 +#define LED_MODE_ACT 7 +#define LED_MODE_COLL 8 +#define LED_MODE_LINK_ACT 9 +#define LED_MODE_DUPLEX_COLL 10 +#define LED_MODE_10M_ACT 11 +#define LED_MODE_100M_ACT 12 +#define LED0_MODE_SHIFT 0 /* LED0 mode shift */ +#define LED1_MODE_SHIFT 4 /* LED1 mode shift */ +#define LED2_MODE_SHIFT 8 /* LED2 mode shift */ +#define LED0_IV_SHIFT 12 /* LED0 input value shift */ +#define LED1_IV_SHIFT 13 /* LED1 input value shift */ +#define LED2_IV_SHIFT 14 /* LED2 input value shift */ #endif /* _ADM5120_SWITCH_H */ diff --git a/target/linux/adm5120-2.6/patches/001-adm5120.patch b/target/linux/adm5120-2.6/patches/001-adm5120.patch index a77d1218dd..cc8739e217 100644 --- a/target/linux/adm5120-2.6/patches/001-adm5120.patch +++ b/target/linux/adm5120-2.6/patches/001-adm5120.patch @@ -1,7 +1,7 @@ diff -urN linux-2.6.19.2/arch/mips/Kconfig linux-2.6.19.2.new/arch/mips/Kconfig --- linux-2.6.19.2/arch/mips/Kconfig 2007-01-10 20:10:37.000000000 +0100 +++ linux-2.6.19.2.new/arch/mips/Kconfig 2007-01-23 14:49:38.000000000 +0100 -@@ -12,6 +12,19 @@ +@@ -12,6 +12,20 @@ prompt "System type" default SGI_IP22 @@ -13,6 +13,7 @@ diff -urN linux-2.6.19.2/arch/mips/Kconfig linux-2.6.19.2.new/arch/mips/Kconfig + select SYS_SUPPORTS_LITTLE_ENDIAN + select SYS_SUPPORTS_BIG_ENDIAN + select SYS_SUPPORTS_32BIT_KERNEL ++ select GENERIC_GPIO + +config PCI_ADM5120 + bool "Add PCI control support for ADM5120" diff --git a/target/linux/adm5120eb-2.6/config/default b/target/linux/adm5120eb-2.6/config/default index ad2a222a78..944e85de1c 100644 --- a/target/linux/adm5120eb-2.6/config/default +++ b/target/linux/adm5120eb-2.6/config/default @@ -17,6 +17,7 @@ CONFIG_CPU_BIG_ENDIAN=y CONFIG_CPU_HAS_LLSC=y CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y +CONFIG_GENERIC_GPIO=y # CONFIG_CPU_LITTLE_ENDIAN is not set CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y -- 2.25.1