diff options
| -rw-r--r-- | drivers/gpio/Kconfig | 28 | ||||
| -rw-r--r-- | drivers/gpio/gpio-exynos4.c | 29 | ||||
| -rw-r--r-- | drivers/gpio/gpio-omap.c | 23 |
3 files changed, 45 insertions, 35 deletions
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 4a7f63143455..2967002a9f82 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
| @@ -87,32 +87,20 @@ config GPIO_IT8761E | |||
| 87 | Say yes here to support GPIO functionality of IT8761E super I/O chip. | 87 | Say yes here to support GPIO functionality of IT8761E super I/O chip. |
| 88 | 88 | ||
| 89 | config GPIO_EXYNOS4 | 89 | config GPIO_EXYNOS4 |
| 90 | bool "Samsung Exynos4 GPIO library support" | 90 | def_bool y |
| 91 | default y if CPU_EXYNOS4210 | 91 | depends on CPU_EXYNOS4210 |
| 92 | depends on ARM | ||
| 93 | help | ||
| 94 | Say yes here to support Samsung Exynos4 series SoCs GPIO library | ||
| 95 | 92 | ||
| 96 | config GPIO_PLAT_SAMSUNG | 93 | config GPIO_PLAT_SAMSUNG |
| 97 | bool "Samsung SoCs GPIO library support" | 94 | def_bool y |
| 98 | default y if SAMSUNG_GPIOLIB_4BIT | 95 | depends on SAMSUNG_GPIOLIB_4BIT |
| 99 | depends on ARM | ||
| 100 | help | ||
| 101 | Say yes here to support Samsung SoCs GPIO library | ||
| 102 | 96 | ||
| 103 | config GPIO_S5PC100 | 97 | config GPIO_S5PC100 |
| 104 | bool "Samsung S5PC100 GPIO library support" | 98 | def_bool y |
| 105 | default y if CPU_S5PC100 | 99 | depends on CPU_S5PC100 |
| 106 | depends on ARM | ||
| 107 | help | ||
| 108 | Say yes here to support Samsung S5PC100 SoCs GPIO library | ||
| 109 | 100 | ||
| 110 | config GPIO_S5PV210 | 101 | config GPIO_S5PV210 |
| 111 | bool "Samsung S5PV210/S5PC110 GPIO library support" | 102 | def_bool y |
| 112 | default y if CPU_S5PV210 | 103 | depends on CPU_S5PV210 |
| 113 | depends on ARM | ||
| 114 | help | ||
| 115 | Say yes here to support Samsung S5PV210/S5PC110 SoCs GPIO library | ||
| 116 | 104 | ||
| 117 | config GPIO_PL061 | 105 | config GPIO_PL061 |
| 118 | bool "PrimeCell PL061 GPIO support" | 106 | bool "PrimeCell PL061 GPIO support" |
diff --git a/drivers/gpio/gpio-exynos4.c b/drivers/gpio/gpio-exynos4.c index d54ca6adb660..9029835112e7 100644 --- a/drivers/gpio/gpio-exynos4.c +++ b/drivers/gpio/gpio-exynos4.c | |||
| @@ -21,16 +21,37 @@ | |||
| 21 | #include <plat/gpio-cfg.h> | 21 | #include <plat/gpio-cfg.h> |
| 22 | #include <plat/gpio-cfg-helpers.h> | 22 | #include <plat/gpio-cfg-helpers.h> |
| 23 | 23 | ||
| 24 | int s3c_gpio_setpull_exynos4(struct s3c_gpio_chip *chip, | ||
| 25 | unsigned int off, s3c_gpio_pull_t pull) | ||
| 26 | { | ||
| 27 | if (pull == S3C_GPIO_PULL_UP) | ||
| 28 | pull = 3; | ||
| 29 | |||
| 30 | return s3c_gpio_setpull_updown(chip, off, pull); | ||
| 31 | } | ||
| 32 | |||
| 33 | s3c_gpio_pull_t s3c_gpio_getpull_exynos4(struct s3c_gpio_chip *chip, | ||
| 34 | unsigned int off) | ||
| 35 | { | ||
| 36 | s3c_gpio_pull_t pull; | ||
| 37 | |||
| 38 | pull = s3c_gpio_getpull_updown(chip, off); | ||
| 39 | if (pull == 3) | ||
| 40 | pull = S3C_GPIO_PULL_UP; | ||
| 41 | |||
| 42 | return pull; | ||
| 43 | } | ||
| 44 | |||
| 24 | static struct s3c_gpio_cfg gpio_cfg = { | 45 | static struct s3c_gpio_cfg gpio_cfg = { |
| 25 | .set_config = s3c_gpio_setcfg_s3c64xx_4bit, | 46 | .set_config = s3c_gpio_setcfg_s3c64xx_4bit, |
| 26 | .set_pull = s3c_gpio_setpull_updown, | 47 | .set_pull = s3c_gpio_setpull_exynos4, |
| 27 | .get_pull = s3c_gpio_getpull_updown, | 48 | .get_pull = s3c_gpio_getpull_exynos4, |
| 28 | }; | 49 | }; |
| 29 | 50 | ||
| 30 | static struct s3c_gpio_cfg gpio_cfg_noint = { | 51 | static struct s3c_gpio_cfg gpio_cfg_noint = { |
| 31 | .set_config = s3c_gpio_setcfg_s3c64xx_4bit, | 52 | .set_config = s3c_gpio_setcfg_s3c64xx_4bit, |
| 32 | .set_pull = s3c_gpio_setpull_updown, | 53 | .set_pull = s3c_gpio_setpull_exynos4, |
| 33 | .get_pull = s3c_gpio_getpull_updown, | 54 | .get_pull = s3c_gpio_getpull_exynos4, |
| 34 | }; | 55 | }; |
| 35 | 56 | ||
| 36 | /* | 57 | /* |
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 6c51191da567..01f74a8459d9 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
| @@ -432,7 +432,6 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, | |||
| 432 | { | 432 | { |
| 433 | void __iomem *base = bank->base; | 433 | void __iomem *base = bank->base; |
| 434 | u32 gpio_bit = 1 << gpio; | 434 | u32 gpio_bit = 1 << gpio; |
| 435 | u32 val; | ||
| 436 | 435 | ||
| 437 | if (cpu_is_omap44xx()) { | 436 | if (cpu_is_omap44xx()) { |
| 438 | MOD_REG_BIT(OMAP4_GPIO_LEVELDETECT0, gpio_bit, | 437 | MOD_REG_BIT(OMAP4_GPIO_LEVELDETECT0, gpio_bit, |
| @@ -455,15 +454,8 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, | |||
| 455 | } | 454 | } |
| 456 | if (likely(!(bank->non_wakeup_gpios & gpio_bit))) { | 455 | if (likely(!(bank->non_wakeup_gpios & gpio_bit))) { |
| 457 | if (cpu_is_omap44xx()) { | 456 | if (cpu_is_omap44xx()) { |
| 458 | if (trigger != 0) | 457 | MOD_REG_BIT(OMAP4_GPIO_IRQWAKEN0, gpio_bit, |
| 459 | __raw_writel(1 << gpio, bank->base+ | 458 | trigger != 0); |
| 460 | OMAP4_GPIO_IRQWAKEN0); | ||
| 461 | else { | ||
| 462 | val = __raw_readl(bank->base + | ||
| 463 | OMAP4_GPIO_IRQWAKEN0); | ||
| 464 | __raw_writel(val & (~(1 << gpio)), bank->base + | ||
| 465 | OMAP4_GPIO_IRQWAKEN0); | ||
| 466 | } | ||
| 467 | } else { | 459 | } else { |
| 468 | /* | 460 | /* |
| 469 | * GPIO wakeup request can only be generated on edge | 461 | * GPIO wakeup request can only be generated on edge |
| @@ -1134,8 +1126,11 @@ static void gpio_irq_shutdown(struct irq_data *d) | |||
| 1134 | { | 1126 | { |
| 1135 | unsigned int gpio = d->irq - IH_GPIO_BASE; | 1127 | unsigned int gpio = d->irq - IH_GPIO_BASE; |
| 1136 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); | 1128 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
| 1129 | unsigned long flags; | ||
| 1137 | 1130 | ||
| 1131 | spin_lock_irqsave(&bank->lock, flags); | ||
| 1138 | _reset_gpio(bank, gpio); | 1132 | _reset_gpio(bank, gpio); |
| 1133 | spin_unlock_irqrestore(&bank->lock, flags); | ||
| 1139 | } | 1134 | } |
| 1140 | 1135 | ||
| 1141 | static void gpio_ack_irq(struct irq_data *d) | 1136 | static void gpio_ack_irq(struct irq_data *d) |
| @@ -1150,9 +1145,12 @@ static void gpio_mask_irq(struct irq_data *d) | |||
| 1150 | { | 1145 | { |
| 1151 | unsigned int gpio = d->irq - IH_GPIO_BASE; | 1146 | unsigned int gpio = d->irq - IH_GPIO_BASE; |
| 1152 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); | 1147 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
| 1148 | unsigned long flags; | ||
| 1153 | 1149 | ||
| 1150 | spin_lock_irqsave(&bank->lock, flags); | ||
| 1154 | _set_gpio_irqenable(bank, gpio, 0); | 1151 | _set_gpio_irqenable(bank, gpio, 0); |
| 1155 | _set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE); | 1152 | _set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE); |
| 1153 | spin_unlock_irqrestore(&bank->lock, flags); | ||
| 1156 | } | 1154 | } |
| 1157 | 1155 | ||
| 1158 | static void gpio_unmask_irq(struct irq_data *d) | 1156 | static void gpio_unmask_irq(struct irq_data *d) |
| @@ -1161,7 +1159,9 @@ static void gpio_unmask_irq(struct irq_data *d) | |||
| 1161 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); | 1159 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
| 1162 | unsigned int irq_mask = 1 << get_gpio_index(gpio); | 1160 | unsigned int irq_mask = 1 << get_gpio_index(gpio); |
| 1163 | u32 trigger = irqd_get_trigger_type(d); | 1161 | u32 trigger = irqd_get_trigger_type(d); |
| 1162 | unsigned long flags; | ||
| 1164 | 1163 | ||
| 1164 | spin_lock_irqsave(&bank->lock, flags); | ||
| 1165 | if (trigger) | 1165 | if (trigger) |
| 1166 | _set_gpio_triggering(bank, get_gpio_index(gpio), trigger); | 1166 | _set_gpio_triggering(bank, get_gpio_index(gpio), trigger); |
| 1167 | 1167 | ||
| @@ -1173,6 +1173,7 @@ static void gpio_unmask_irq(struct irq_data *d) | |||
| 1173 | } | 1173 | } |
| 1174 | 1174 | ||
| 1175 | _set_gpio_irqenable(bank, gpio, 1); | 1175 | _set_gpio_irqenable(bank, gpio, 1); |
| 1176 | spin_unlock_irqrestore(&bank->lock, flags); | ||
| 1176 | } | 1177 | } |
| 1177 | 1178 | ||
| 1178 | static struct irq_chip gpio_irq_chip = { | 1179 | static struct irq_chip gpio_irq_chip = { |
| @@ -1524,7 +1525,7 @@ static void omap_gpio_mod_init(struct gpio_bank *bank, int id) | |||
| 1524 | } | 1525 | } |
| 1525 | } | 1526 | } |
| 1526 | 1527 | ||
| 1527 | static void __init omap_gpio_chip_init(struct gpio_bank *bank) | 1528 | static void __devinit omap_gpio_chip_init(struct gpio_bank *bank) |
| 1528 | { | 1529 | { |
| 1529 | int j; | 1530 | int j; |
| 1530 | static int gpio; | 1531 | static int gpio; |
