diff options
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/Kconfig | 4 | ||||
-rw-r--r-- | drivers/gpio/gpio-74x164.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpio-mvebu.c | 4 | ||||
-rw-r--r-- | drivers/gpio/gpio-omap.c | 35 | ||||
-rw-r--r-- | drivers/gpio/gpio-samsung.c | 43 | ||||
-rw-r--r-- | drivers/gpio/gpio-timberdale.c | 4 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.c | 10 |
7 files changed, 72 insertions, 30 deletions
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index d055cee36942..6dbc4031f825 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -47,7 +47,7 @@ if GPIOLIB | |||
47 | 47 | ||
48 | config OF_GPIO | 48 | config OF_GPIO |
49 | def_bool y | 49 | def_bool y |
50 | depends on OF && !SPARC | 50 | depends on OF |
51 | 51 | ||
52 | config DEBUG_GPIO | 52 | config DEBUG_GPIO |
53 | bool "Debug GPIO calls" | 53 | bool "Debug GPIO calls" |
@@ -152,7 +152,7 @@ config GPIO_MSM_V2 | |||
152 | 152 | ||
153 | config GPIO_MVEBU | 153 | config GPIO_MVEBU |
154 | def_bool y | 154 | def_bool y |
155 | depends on ARCH_MVEBU | 155 | depends on PLAT_ORION |
156 | select GPIO_GENERIC | 156 | select GPIO_GENERIC |
157 | select GENERIC_IRQ_CHIP | 157 | select GENERIC_IRQ_CHIP |
158 | 158 | ||
diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index ed3e55161bdc..f05e54258ffb 100644 --- a/drivers/gpio/gpio-74x164.c +++ b/drivers/gpio/gpio-74x164.c | |||
@@ -153,7 +153,7 @@ static int __devinit gen_74x164_probe(struct spi_device *spi) | |||
153 | } | 153 | } |
154 | 154 | ||
155 | chip->gpio_chip.ngpio = GEN_74X164_NUMBER_GPIOS * chip->registers; | 155 | chip->gpio_chip.ngpio = GEN_74X164_NUMBER_GPIOS * chip->registers; |
156 | chip->buffer = devm_kzalloc(&spi->dev, chip->gpio_chip.ngpio, GFP_KERNEL); | 156 | chip->buffer = devm_kzalloc(&spi->dev, chip->registers, GFP_KERNEL); |
157 | if (!chip->buffer) { | 157 | if (!chip->buffer) { |
158 | ret = -ENOMEM; | 158 | ret = -ENOMEM; |
159 | goto exit_destroy; | 159 | goto exit_destroy; |
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index 7a874129e5d8..cf7afb9eb61a 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c | |||
@@ -244,6 +244,8 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned pin, | |||
244 | if (ret) | 244 | if (ret) |
245 | return ret; | 245 | return ret; |
246 | 246 | ||
247 | mvebu_gpio_set(chip, pin, value); | ||
248 | |||
247 | spin_lock_irqsave(&mvchip->lock, flags); | 249 | spin_lock_irqsave(&mvchip->lock, flags); |
248 | u = readl_relaxed(mvebu_gpioreg_io_conf(mvchip)); | 250 | u = readl_relaxed(mvebu_gpioreg_io_conf(mvchip)); |
249 | u &= ~(1 << pin); | 251 | u &= ~(1 << pin); |
@@ -644,7 +646,7 @@ static int __devinit mvebu_gpio_probe(struct platform_device *pdev) | |||
644 | ct->handler = handle_edge_irq; | 646 | ct->handler = handle_edge_irq; |
645 | ct->chip.name = mvchip->chip.label; | 647 | ct->chip.name = mvchip->chip.label; |
646 | 648 | ||
647 | irq_setup_generic_chip(gc, IRQ_MSK(ngpios), IRQ_GC_INIT_MASK_CACHE, | 649 | irq_setup_generic_chip(gc, IRQ_MSK(ngpios), 0, |
648 | IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); | 650 | IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); |
649 | 651 | ||
650 | /* Setup irq domain on top of the generic chip. */ | 652 | /* Setup irq domain on top of the generic chip. */ |
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 94cbc842fbc3..d335af1d4d85 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -251,6 +251,40 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio, | |||
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | /** | ||
255 | * _clear_gpio_debounce - clear debounce settings for a gpio | ||
256 | * @bank: the gpio bank we're acting upon | ||
257 | * @gpio: the gpio number on this @gpio | ||
258 | * | ||
259 | * If a gpio is using debounce, then clear the debounce enable bit and if | ||
260 | * this is the only gpio in this bank using debounce, then clear the debounce | ||
261 | * time too. The debounce clock will also be disabled when calling this function | ||
262 | * if this is the only gpio in the bank using debounce. | ||
263 | */ | ||
264 | static void _clear_gpio_debounce(struct gpio_bank *bank, unsigned gpio) | ||
265 | { | ||
266 | u32 gpio_bit = GPIO_BIT(bank, gpio); | ||
267 | |||
268 | if (!bank->dbck_flag) | ||
269 | return; | ||
270 | |||
271 | if (!(bank->dbck_enable_mask & gpio_bit)) | ||
272 | return; | ||
273 | |||
274 | bank->dbck_enable_mask &= ~gpio_bit; | ||
275 | bank->context.debounce_en &= ~gpio_bit; | ||
276 | __raw_writel(bank->context.debounce_en, | ||
277 | bank->base + bank->regs->debounce_en); | ||
278 | |||
279 | if (!bank->dbck_enable_mask) { | ||
280 | bank->context.debounce = 0; | ||
281 | __raw_writel(bank->context.debounce, bank->base + | ||
282 | bank->regs->debounce); | ||
283 | clk_disable(bank->dbck); | ||
284 | bank->dbck_enabled = false; | ||
285 | } | ||
286 | } | ||
287 | |||
254 | static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio, | 288 | static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio, |
255 | unsigned trigger) | 289 | unsigned trigger) |
256 | { | 290 | { |
@@ -539,6 +573,7 @@ static void _reset_gpio(struct gpio_bank *bank, int gpio) | |||
539 | _set_gpio_irqenable(bank, gpio, 0); | 573 | _set_gpio_irqenable(bank, gpio, 0); |
540 | _clear_gpio_irqstatus(bank, gpio); | 574 | _clear_gpio_irqstatus(bank, gpio); |
541 | _set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE); | 575 | _set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE); |
576 | _clear_gpio_debounce(bank, gpio); | ||
542 | } | 577 | } |
543 | 578 | ||
544 | /* Use disable_irq_wake() and enable_irq_wake() functions from drivers */ | 579 | /* Use disable_irq_wake() and enable_irq_wake() functions from drivers */ |
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index a006f0db15af..88f41e51565b 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c | |||
@@ -2797,27 +2797,6 @@ static __init void exynos4_gpiolib_init(void) | |||
2797 | int group = 0; | 2797 | int group = 0; |
2798 | void __iomem *gpx_base; | 2798 | void __iomem *gpx_base; |
2799 | 2799 | ||
2800 | #ifdef CONFIG_PINCTRL_SAMSUNG | ||
2801 | /* | ||
2802 | * This gpio driver includes support for device tree support and | ||
2803 | * there are platforms using it. In order to maintain | ||
2804 | * compatibility with those platforms, and to allow non-dt | ||
2805 | * Exynos4210 platforms to use this gpiolib support, a check | ||
2806 | * is added to find out if there is a active pin-controller | ||
2807 | * driver support available. If it is available, this gpiolib | ||
2808 | * support is ignored and the gpiolib support available in | ||
2809 | * pin-controller driver is used. This is a temporary check and | ||
2810 | * will go away when all of the Exynos4210 platforms have | ||
2811 | * switched to using device tree and the pin-ctrl driver. | ||
2812 | */ | ||
2813 | struct device_node *pctrl_np; | ||
2814 | const char *pctrl_compat = "samsung,pinctrl-exynos4210"; | ||
2815 | pctrl_np = of_find_compatible_node(NULL, NULL, pctrl_compat); | ||
2816 | if (pctrl_np) | ||
2817 | if (of_device_is_available(pctrl_np)) | ||
2818 | return; | ||
2819 | #endif | ||
2820 | |||
2821 | /* gpio part1 */ | 2800 | /* gpio part1 */ |
2822 | gpio_base1 = ioremap(EXYNOS4_PA_GPIO1, SZ_4K); | 2801 | gpio_base1 = ioremap(EXYNOS4_PA_GPIO1, SZ_4K); |
2823 | if (gpio_base1 == NULL) { | 2802 | if (gpio_base1 == NULL) { |
@@ -3032,6 +3011,28 @@ static __init int samsung_gpiolib_init(void) | |||
3032 | int i, nr_chips; | 3011 | int i, nr_chips; |
3033 | int group = 0; | 3012 | int group = 0; |
3034 | 3013 | ||
3014 | #ifdef CONFIG_PINCTRL_SAMSUNG | ||
3015 | /* | ||
3016 | * This gpio driver includes support for device tree support and there | ||
3017 | * are platforms using it. In order to maintain compatibility with those | ||
3018 | * platforms, and to allow non-dt Exynos4210 platforms to use this | ||
3019 | * gpiolib support, a check is added to find out if there is a active | ||
3020 | * pin-controller driver support available. If it is available, this | ||
3021 | * gpiolib support is ignored and the gpiolib support available in | ||
3022 | * pin-controller driver is used. This is a temporary check and will go | ||
3023 | * away when all of the Exynos4210 platforms have switched to using | ||
3024 | * device tree and the pin-ctrl driver. | ||
3025 | */ | ||
3026 | struct device_node *pctrl_np; | ||
3027 | static const struct of_device_id exynos_pinctrl_ids[] = { | ||
3028 | { .compatible = "samsung,pinctrl-exynos4210", }, | ||
3029 | { .compatible = "samsung,pinctrl-exynos4x12", }, | ||
3030 | }; | ||
3031 | for_each_matching_node(pctrl_np, exynos_pinctrl_ids) | ||
3032 | if (pctrl_np && of_device_is_available(pctrl_np)) | ||
3033 | return -ENODEV; | ||
3034 | #endif | ||
3035 | |||
3035 | samsung_gpiolib_set_cfg(samsung_gpio_cfgs, ARRAY_SIZE(samsung_gpio_cfgs)); | 3036 | samsung_gpiolib_set_cfg(samsung_gpio_cfgs, ARRAY_SIZE(samsung_gpio_cfgs)); |
3036 | 3037 | ||
3037 | if (soc_is_s3c24xx()) { | 3038 | if (soc_is_s3c24xx()) { |
diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c index 031c6adf5b65..1a3e2b9b4772 100644 --- a/drivers/gpio/gpio-timberdale.c +++ b/drivers/gpio/gpio-timberdale.c | |||
@@ -116,7 +116,7 @@ static void timbgpio_irq_disable(struct irq_data *d) | |||
116 | unsigned long flags; | 116 | unsigned long flags; |
117 | 117 | ||
118 | spin_lock_irqsave(&tgpio->lock, flags); | 118 | spin_lock_irqsave(&tgpio->lock, flags); |
119 | tgpio->last_ier &= ~(1 << offset); | 119 | tgpio->last_ier &= ~(1UL << offset); |
120 | iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); | 120 | iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); |
121 | spin_unlock_irqrestore(&tgpio->lock, flags); | 121 | spin_unlock_irqrestore(&tgpio->lock, flags); |
122 | } | 122 | } |
@@ -128,7 +128,7 @@ static void timbgpio_irq_enable(struct irq_data *d) | |||
128 | unsigned long flags; | 128 | unsigned long flags; |
129 | 129 | ||
130 | spin_lock_irqsave(&tgpio->lock, flags); | 130 | spin_lock_irqsave(&tgpio->lock, flags); |
131 | tgpio->last_ier |= 1 << offset; | 131 | tgpio->last_ier |= 1UL << offset; |
132 | iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); | 132 | iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); |
133 | spin_unlock_irqrestore(&tgpio->lock, flags); | 133 | spin_unlock_irqrestore(&tgpio->lock, flags); |
134 | } | 134 | } |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 5d6c71edc739..1c8d9e3380e1 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -623,9 +623,11 @@ static ssize_t export_store(struct class *class, | |||
623 | */ | 623 | */ |
624 | 624 | ||
625 | status = gpio_request(gpio, "sysfs"); | 625 | status = gpio_request(gpio, "sysfs"); |
626 | if (status < 0) | 626 | if (status < 0) { |
627 | if (status == -EPROBE_DEFER) | ||
628 | status = -ENODEV; | ||
627 | goto done; | 629 | goto done; |
628 | 630 | } | |
629 | status = gpio_export(gpio, true); | 631 | status = gpio_export(gpio, true); |
630 | if (status < 0) | 632 | if (status < 0) |
631 | gpio_free(gpio); | 633 | gpio_free(gpio); |
@@ -1191,8 +1193,10 @@ int gpio_request(unsigned gpio, const char *label) | |||
1191 | 1193 | ||
1192 | spin_lock_irqsave(&gpio_lock, flags); | 1194 | spin_lock_irqsave(&gpio_lock, flags); |
1193 | 1195 | ||
1194 | if (!gpio_is_valid(gpio)) | 1196 | if (!gpio_is_valid(gpio)) { |
1197 | status = -EINVAL; | ||
1195 | goto done; | 1198 | goto done; |
1199 | } | ||
1196 | desc = &gpio_desc[gpio]; | 1200 | desc = &gpio_desc[gpio]; |
1197 | chip = desc->chip; | 1201 | chip = desc->chip; |
1198 | if (chip == NULL) | 1202 | if (chip == NULL) |