From ca8522f23e272953dbc3d1ad91cab05a66aaf163 Mon Sep 17 00:00:00 2001 From: lw Date: Wed, 8 Feb 2012 14:22:13 +0800 Subject: [PATCH] rk30:modify gpio pull up or down operation --- arch/arm/mach-rk30/include/mach/gpio.h | 5 +---- arch/arm/mach-rk30/iomux.c | 6 +++--- drivers/gpio/gpio-rk30.c | 7 +++++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-rk30/include/mach/gpio.h b/arch/arm/mach-rk30/include/mach/gpio.h index f46ae002a77b..163a9f6f868c 100755 --- a/arch/arm/mach-rk30/include/mach/gpio.h +++ b/arch/arm/mach-rk30/include/mach/gpio.h @@ -35,7 +35,7 @@ typedef enum GPIOIntType { //¶¨ÒåGPIOÏà¹Ø¼Ä´æÆ÷Æ«ÒƵØÖ· #define GPIO_SWPORT_DR 0x00 #define GPIO_SWPORT_DDR 0x04 -#define GPIO_INTEN 0x30 +#define GPIO_INTEN 0x30 #define GPIO_INTMASK 0x34 #define GPIO_INTTYPE_LEVEL 0x38 #define GPIO_INT_POLARITY 0x3c @@ -270,7 +270,6 @@ typedef enum GPIOIntType { #define RK30_PIN6_PA5 (6*NUM_GROUP + PIN_BASE + 5) #define RK30_PIN6_PA6 (6*NUM_GROUP + PIN_BASE + 6) #define RK30_PIN6_PA7 (6*NUM_GROUP + PIN_BASE + 7) - #define RK30_PIN6_PB0 (6*NUM_GROUP + PIN_BASE + 8) #define RK30_PIN6_PB1 (6*NUM_GROUP + PIN_BASE + 9) #define RK30_PIN6_PB2 (6*NUM_GROUP + PIN_BASE + 10) @@ -280,8 +279,6 @@ typedef enum GPIOIntType { #define RK30_PIN6_PB6 (6*NUM_GROUP + PIN_BASE + 14) #define RK30_PIN6_PB7 (6*NUM_GROUP + PIN_BASE + 15) -#define RK30_PIN6_PD7 (6*NUM_GROUP + PIN_BASE + 31) - #if defined(CONFIG_SPI_FPGA_GPIO) #define FPGA_PIO0_00 (SPI_FPGA_EXPANDER_BASE + 0*NUM_GROUP + 0) #define FPGA_PIO0_01 (SPI_FPGA_EXPANDER_BASE + 0*NUM_GROUP + 1) diff --git a/arch/arm/mach-rk30/iomux.c b/arch/arm/mach-rk30/iomux.c index d14be4c29dc9..2db9f58648af 100755 --- a/arch/arm/mach-rk30/iomux.c +++ b/arch/arm/mach-rk30/iomux.c @@ -324,12 +324,12 @@ int __init rk30_iomux_init(void) #ifdef CONFIG_I2C3_RK30 rk30_mux_api_set(GPIO3A3_I2C3SCL_NAME, GPIO3A_I2C3_SCL); - rk30_mux_api_set(GPIO3A2_I2C3SDA_NAME, GPIO3A_I2C2_SDA); + rk30_mux_api_set(GPIO3A2_I2C3SDA_NAME, GPIO3A_I2C3_SDA); #endif #ifdef CONFIG_I2C4_RK30 - rk30_mux_api_set(GPIO3A5_I2C4SCL_NAME, GPIO3A_I2C3_SCL); - rk30_mux_api_set(GPIO3A4_I2C4SDA_NAME, GPIO3A_I2C2_SDA); + rk30_mux_api_set(GPIO3A5_I2C4SCL_NAME, GPIO3A_I2C4_SCL); + rk30_mux_api_set(GPIO3A4_I2C4SDA_NAME, GPIO3A_I2C4_SDA); #endif #ifdef CONFIG_RK30_VMAC diff --git a/drivers/gpio/gpio-rk30.c b/drivers/gpio/gpio-rk30.c index 729ea9f3a13e..7d13bbda9cfd 100755 --- a/drivers/gpio/gpio-rk30.c +++ b/drivers/gpio/gpio-rk30.c @@ -32,7 +32,7 @@ #include #include -#define MAX_PIN RK30_PIN6_PD7 +#define MAX_PIN RK30_PIN6_PB7 #define to_rk30_gpio_bank(c) container_of(c, struct rk30_gpio_bank, chip) @@ -303,7 +303,10 @@ static int rk30_gpiolib_pull_updown(struct gpio_chip *chip, unsigned offset, uns unsigned long flags; spin_lock_irqsave(&bank->lock, flags); - rk30_gpio_bit_op((void *__iomem) RK30_GRF_BASE, 0x78 + bank->id * 4, offset_to_bit(offset), !enable); + if(offset>=16) + rk30_gpio_bit_op((void *__iomem) RK30_GRF_BASE, GRF_GPIO0H_PULL + bank->id * 8, offset_to_bit(offset-16), !enable); + else + rk30_gpio_bit_op((void *__iomem) RK30_GRF_BASE, GRF_GPIO0L_PULL + bank->id * 8, offset_to_bit(offset), !enable); spin_unlock_irqrestore(&bank->lock, flags); return 0; -- 2.34.1