Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'gpio/merge' of git://git.secretlab.ca/git/linux-2.6

* 'gpio/merge' of git://git.secretlab.ca/git/linux-2.6:
gpio/basic_mmio: add missing include of spinlock_types.h
gpio/nomadik: fix sleepmode for elder Nomadik

+34 -11
+3
arch/arm/mach-ux500/cpu-db8500.c
··· 159 159 /* No custom data yet */ 160 160 }; 161 161 162 + if (cpu_is_u8500v2()) 163 + pdata.supports_sleepmode = true; 164 + 162 165 dbx500_add_gpios(ARRAY_AND_SIZE(db8500_gpio_base), 163 166 IRQ_DB8500_GPIO0, &pdata); 164 167 }
+1
arch/arm/plat-nomadik/include/plat/gpio.h
··· 90 90 int num_gpio; 91 91 u32 (*get_secondary_status)(unsigned int bank); 92 92 void (*set_ioforce)(bool enable); 93 + bool supports_sleepmode; 93 94 }; 94 95 95 96 #endif /* __ASM_PLAT_GPIO_H */
+29 -11
drivers/gpio/gpio-nomadik.c
··· 4 4 * Copyright (C) 2008,2009 STMicroelectronics 5 5 * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it> 6 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 9 * This program is free software; you can redistribute it and/or modify 9 10 * it under the terms of the GNU General Public License version 2 as ··· 50 49 u32 (*get_secondary_status)(unsigned int bank); 51 50 void (*set_ioforce)(bool enable); 52 51 spinlock_t lock; 52 + bool sleepmode; 53 53 /* Keep track of configured edges */ 54 54 u32 edge_rising; 55 55 u32 edge_falling; ··· 395 393 * @gpio: pin number 396 394 * @mode: NMK_GPIO_SLPM_INPUT or NMK_GPIO_SLPM_NOCHANGE, 397 395 * 398 - * Sets the sleep mode of a pin. If @mode is NMK_GPIO_SLPM_INPUT, the pin is 399 - * changed to an input (with pullup/down enabled) in sleep and deep sleep. If 400 - * @mode is NMK_GPIO_SLPM_NOCHANGE, the pin remains in the state it was 401 - * configured even when in sleep and deep sleep. 396 + * This register is actually in the pinmux layer, not the GPIO block itself. 397 + * The GPIO1B_SLPM register defines the GPIO mode when SLEEP/DEEP-SLEEP 398 + * mode is entered (i.e. when signal IOFORCE is HIGH by the platform code). 399 + * Each GPIO can be configured to be forced into GPIO mode when IOFORCE is 400 + * HIGH, overriding the normal setting defined by GPIO_AFSELx registers. 401 + * When IOFORCE returns LOW (by software, after SLEEP/DEEP-SLEEP exit), 402 + * the GPIOs return to the normal setting defined by GPIO_AFSELx registers. 402 403 * 403 - * On DB8500v2 onwards, this setting loses the previous meaning and instead 404 - * indicates if wakeup detection is enabled on the pin. Note that 405 - * enable_irq_wake() will automatically enable wakeup detection. 404 + * If @mode is NMK_GPIO_SLPM_INPUT, the corresponding GPIO is switched to GPIO 405 + * mode when signal IOFORCE is HIGH (i.e. when SLEEP/DEEP-SLEEP mode is 406 + * entered) regardless of the altfunction selected. Also wake-up detection is 407 + * ENABLED. 408 + * 409 + * If @mode is NMK_GPIO_SLPM_NOCHANGE, the corresponding GPIO remains 410 + * controlled by NMK_GPIO_DATC, NMK_GPIO_DATS, NMK_GPIO_DIR, NMK_GPIO_PDIS 411 + * (for altfunction GPIO) or respective on-chip peripherals (for other 412 + * altfuncs) when IOFORCE is HIGH. Also wake-up detection DISABLED. 413 + * 414 + * Note that enable_irq_wake() will automatically enable wakeup detection. 406 415 */ 407 416 int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode) 408 417 { ··· 564 551 static void __nmk_gpio_set_wake(struct nmk_gpio_chip *nmk_chip, 565 552 int gpio, bool on) 566 553 { 554 + if (nmk_chip->sleepmode) { 555 + __nmk_gpio_set_slpm(nmk_chip, gpio - nmk_chip->chip.base, 556 + on ? NMK_GPIO_SLPM_WAKEUP_ENABLE 557 + : NMK_GPIO_SLPM_WAKEUP_DISABLE); 558 + } 559 + 567 560 __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, on); 568 561 } 569 562 ··· 920 901 writel(chip->fwimsc & chip->real_wake, 921 902 chip->addr + NMK_GPIO_FWIMSC); 922 903 923 - if (cpu_is_u8500v2()) { 904 + if (chip->sleepmode) { 924 905 chip->slpm = readl(chip->addr + NMK_GPIO_SLPC); 925 906 926 907 /* 0 -> wakeup enable */ ··· 942 923 writel(chip->rwimsc, chip->addr + NMK_GPIO_RWIMSC); 943 924 writel(chip->fwimsc, chip->addr + NMK_GPIO_FWIMSC); 944 925 945 - if (cpu_is_u8500v2()) 926 + if (chip->sleepmode) 946 927 writel(chip->slpm, chip->addr + NMK_GPIO_SLPC); 947 928 } 948 929 } ··· 1029 1010 nmk_chip->secondary_parent_irq = secondary_irq; 1030 1011 nmk_chip->get_secondary_status = pdata->get_secondary_status; 1031 1012 nmk_chip->set_ioforce = pdata->set_ioforce; 1013 + nmk_chip->sleepmode = pdata->supports_sleepmode; 1032 1014 spin_lock_init(&nmk_chip->lock); 1033 1015 1034 1016 chip = &nmk_chip->chip; ··· 1085 1065 MODULE_AUTHOR("Prafulla WADASKAR and Alessandro Rubini"); 1086 1066 MODULE_DESCRIPTION("Nomadik GPIO Driver"); 1087 1067 MODULE_LICENSE("GPL"); 1088 - 1089 -
+1
include/linux/basic_mmio_gpio.h
··· 16 16 #include <linux/gpio.h> 17 17 #include <linux/types.h> 18 18 #include <linux/compiler.h> 19 + #include <linux/spinlock_types.h> 19 20 20 21 struct bgpio_pdata { 21 22 int base;