diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-06-17 10:32:26 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-06-17 10:32:26 -0400 |
commit | f8db4cc4f2b11bdded6c94f0d55906847474b982 (patch) | |
tree | d1b99d186edb9d203fafd896f19487125a2395af /drivers/gpio | |
parent | 2e2de2e314672c8b6644f67a35556d6df780493d (diff) | |
parent | e479c60456ef22b0869432887216186aabaed086 (diff) |
Merge branch 'spi/merge' into spi/next
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/Kconfig | 28 | ||||
-rw-r--r-- | drivers/gpio/gpio-exynos4.c | 29 | ||||
-rw-r--r-- | drivers/gpio/gpio-nomadik.c | 40 | ||||
-rw-r--r-- | drivers/gpio/gpio-omap.c | 23 |
4 files changed, 74 insertions, 46 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-nomadik.c b/drivers/gpio/gpio-nomadik.c index 4961ef9bc153..2c212c732d76 100644 --- a/drivers/gpio/gpio-nomadik.c +++ b/drivers/gpio/gpio-nomadik.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Copyright (C) 2008,2009 STMicroelectronics | 4 | * Copyright (C) 2008,2009 STMicroelectronics |
5 | * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it> | 5 | * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it> |
6 | * Rewritten based on work by Prafulla WADASKAR <prafulla.wadaskar@st.com> | 6 | * Rewritten based on work by Prafulla WADASKAR <prafulla.wadaskar@st.com> |
7 | * Copyright (C) 2011 Linus Walleij <linus.walleij@linaro.org> | ||
7 | * | 8 | * |
8 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
@@ -49,6 +50,7 @@ struct nmk_gpio_chip { | |||
49 | u32 (*get_secondary_status)(unsigned int bank); | 50 | u32 (*get_secondary_status)(unsigned int bank); |
50 | void (*set_ioforce)(bool enable); | 51 | void (*set_ioforce)(bool enable); |
51 | spinlock_t lock; | 52 | spinlock_t lock; |
53 | bool sleepmode; | ||
52 | /* Keep track of configured edges */ | 54 | /* Keep track of configured edges */ |
53 | u32 edge_rising; | 55 | u32 edge_rising; |
54 | u32 edge_falling; | 56 | u32 edge_falling; |
@@ -393,14 +395,25 @@ EXPORT_SYMBOL(nmk_config_pins_sleep); | |||
393 | * @gpio: pin number | 395 | * @gpio: pin number |
394 | * @mode: NMK_GPIO_SLPM_INPUT or NMK_GPIO_SLPM_NOCHANGE, | 396 | * @mode: NMK_GPIO_SLPM_INPUT or NMK_GPIO_SLPM_NOCHANGE, |
395 | * | 397 | * |
396 | * Sets the sleep mode of a pin. If @mode is NMK_GPIO_SLPM_INPUT, the pin is | 398 | * This register is actually in the pinmux layer, not the GPIO block itself. |
397 | * changed to an input (with pullup/down enabled) in sleep and deep sleep. If | 399 | * The GPIO1B_SLPM register defines the GPIO mode when SLEEP/DEEP-SLEEP |
398 | * @mode is NMK_GPIO_SLPM_NOCHANGE, the pin remains in the state it was | 400 | * mode is entered (i.e. when signal IOFORCE is HIGH by the platform code). |
399 | * configured even when in sleep and deep sleep. | 401 | * Each GPIO can be configured to be forced into GPIO mode when IOFORCE is |
402 | * HIGH, overriding the normal setting defined by GPIO_AFSELx registers. | ||
403 | * When IOFORCE returns LOW (by software, after SLEEP/DEEP-SLEEP exit), | ||
404 | * the GPIOs return to the normal setting defined by GPIO_AFSELx registers. | ||
400 | * | 405 | * |
401 | * On DB8500v2 onwards, this setting loses the previous meaning and instead | 406 | * If @mode is NMK_GPIO_SLPM_INPUT, the corresponding GPIO is switched to GPIO |
402 | * indicates if wakeup detection is enabled on the pin. Note that | 407 | * mode when signal IOFORCE is HIGH (i.e. when SLEEP/DEEP-SLEEP mode is |
403 | * enable_irq_wake() will automatically enable wakeup detection. | 408 | * entered) regardless of the altfunction selected. Also wake-up detection is |
409 | * ENABLED. | ||
410 | * | ||
411 | * If @mode is NMK_GPIO_SLPM_NOCHANGE, the corresponding GPIO remains | ||
412 | * controlled by NMK_GPIO_DATC, NMK_GPIO_DATS, NMK_GPIO_DIR, NMK_GPIO_PDIS | ||
413 | * (for altfunction GPIO) or respective on-chip peripherals (for other | ||
414 | * altfuncs) when IOFORCE is HIGH. Also wake-up detection DISABLED. | ||
415 | * | ||
416 | * Note that enable_irq_wake() will automatically enable wakeup detection. | ||
404 | */ | 417 | */ |
405 | int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode) | 418 | int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode) |
406 | { | 419 | { |
@@ -551,6 +564,12 @@ static void __nmk_gpio_irq_modify(struct nmk_gpio_chip *nmk_chip, | |||
551 | static void __nmk_gpio_set_wake(struct nmk_gpio_chip *nmk_chip, | 564 | static void __nmk_gpio_set_wake(struct nmk_gpio_chip *nmk_chip, |
552 | int gpio, bool on) | 565 | int gpio, bool on) |
553 | { | 566 | { |
567 | if (nmk_chip->sleepmode) { | ||
568 | __nmk_gpio_set_slpm(nmk_chip, gpio - nmk_chip->chip.base, | ||
569 | on ? NMK_GPIO_SLPM_WAKEUP_ENABLE | ||
570 | : NMK_GPIO_SLPM_WAKEUP_DISABLE); | ||
571 | } | ||
572 | |||
554 | __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, on); | 573 | __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, on); |
555 | } | 574 | } |
556 | 575 | ||
@@ -901,7 +920,7 @@ void nmk_gpio_wakeups_suspend(void) | |||
901 | writel(chip->fwimsc & chip->real_wake, | 920 | writel(chip->fwimsc & chip->real_wake, |
902 | chip->addr + NMK_GPIO_FWIMSC); | 921 | chip->addr + NMK_GPIO_FWIMSC); |
903 | 922 | ||
904 | if (cpu_is_u8500v2()) { | 923 | if (chip->sleepmode) { |
905 | chip->slpm = readl(chip->addr + NMK_GPIO_SLPC); | 924 | chip->slpm = readl(chip->addr + NMK_GPIO_SLPC); |
906 | 925 | ||
907 | /* 0 -> wakeup enable */ | 926 | /* 0 -> wakeup enable */ |
@@ -923,7 +942,7 @@ void nmk_gpio_wakeups_resume(void) | |||
923 | writel(chip->rwimsc, chip->addr + NMK_GPIO_RWIMSC); | 942 | writel(chip->rwimsc, chip->addr + NMK_GPIO_RWIMSC); |
924 | writel(chip->fwimsc, chip->addr + NMK_GPIO_FWIMSC); | 943 | writel(chip->fwimsc, chip->addr + NMK_GPIO_FWIMSC); |
925 | 944 | ||
926 | if (cpu_is_u8500v2()) | 945 | if (chip->sleepmode) |
927 | writel(chip->slpm, chip->addr + NMK_GPIO_SLPC); | 946 | writel(chip->slpm, chip->addr + NMK_GPIO_SLPC); |
928 | } | 947 | } |
929 | } | 948 | } |
@@ -1010,6 +1029,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) | |||
1010 | nmk_chip->secondary_parent_irq = secondary_irq; | 1029 | nmk_chip->secondary_parent_irq = secondary_irq; |
1011 | nmk_chip->get_secondary_status = pdata->get_secondary_status; | 1030 | nmk_chip->get_secondary_status = pdata->get_secondary_status; |
1012 | nmk_chip->set_ioforce = pdata->set_ioforce; | 1031 | nmk_chip->set_ioforce = pdata->set_ioforce; |
1032 | nmk_chip->sleepmode = pdata->supports_sleepmode; | ||
1013 | spin_lock_init(&nmk_chip->lock); | 1033 | spin_lock_init(&nmk_chip->lock); |
1014 | 1034 | ||
1015 | chip = &nmk_chip->chip; | 1035 | chip = &nmk_chip->chip; |
@@ -1065,5 +1085,3 @@ core_initcall(nmk_gpio_init); | |||
1065 | MODULE_AUTHOR("Prafulla WADASKAR and Alessandro Rubini"); | 1085 | MODULE_AUTHOR("Prafulla WADASKAR and Alessandro Rubini"); |
1066 | MODULE_DESCRIPTION("Nomadik GPIO Driver"); | 1086 | MODULE_DESCRIPTION("Nomadik GPIO Driver"); |
1067 | MODULE_LICENSE("GPL"); | 1087 | MODULE_LICENSE("GPL"); |
1068 | |||
1069 | |||
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; |