diff options
-rw-r--r-- | arch/arm/plat-nomadik/include/plat/gpio-nomadik.h | 1 | ||||
-rw-r--r-- | arch/arm/plat-nomadik/include/plat/pincfg.h | 6 | ||||
-rw-r--r-- | drivers/gpio/gpio-nomadik.c | 25 |
3 files changed, 32 insertions, 0 deletions
diff --git a/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h b/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h index 9605bf227df9..3e8b7f16fb78 100644 --- a/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h +++ b/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #define NMK_GPIO_SLPC 0x1c | 29 | #define NMK_GPIO_SLPC 0x1c |
30 | #define NMK_GPIO_AFSLA 0x20 | 30 | #define NMK_GPIO_AFSLA 0x20 |
31 | #define NMK_GPIO_AFSLB 0x24 | 31 | #define NMK_GPIO_AFSLB 0x24 |
32 | #define NMK_GPIO_LOWEMI 0x28 | ||
32 | 33 | ||
33 | #define NMK_GPIO_RIMSC 0x40 | 34 | #define NMK_GPIO_RIMSC 0x40 |
34 | #define NMK_GPIO_FIMSC 0x44 | 35 | #define NMK_GPIO_FIMSC 0x44 |
diff --git a/arch/arm/plat-nomadik/include/plat/pincfg.h b/arch/arm/plat-nomadik/include/plat/pincfg.h index 22cb97d2d8ad..da6b1e35e171 100644 --- a/arch/arm/plat-nomadik/include/plat/pincfg.h +++ b/arch/arm/plat-nomadik/include/plat/pincfg.h | |||
@@ -105,6 +105,12 @@ typedef unsigned long pin_cfg_t; | |||
105 | #define PIN_SLPM_VAL_LOW ((1 + 0) << PIN_SLPM_VAL_SHIFT) | 105 | #define PIN_SLPM_VAL_LOW ((1 + 0) << PIN_SLPM_VAL_SHIFT) |
106 | #define PIN_SLPM_VAL_HIGH ((1 + 1) << PIN_SLPM_VAL_SHIFT) | 106 | #define PIN_SLPM_VAL_HIGH ((1 + 1) << PIN_SLPM_VAL_SHIFT) |
107 | 107 | ||
108 | #define PIN_LOWEMI_SHIFT 25 | ||
109 | #define PIN_LOWEMI_MASK (0x1 << PIN_LOWEMI_SHIFT) | ||
110 | #define PIN_LOWEMI(x) (((x) & PIN_LOWEMI_MASK) >> PIN_LOWEMI_SHIFT) | ||
111 | #define PIN_LOWEMI_DISABLED (0 << PIN_LOWEMI_SHIFT) | ||
112 | #define PIN_LOWEMI_ENABLED (1 << PIN_LOWEMI_SHIFT) | ||
113 | |||
108 | /* Shortcuts. Use these instead of separate DIR, PULL, and VAL. */ | 114 | /* Shortcuts. Use these instead of separate DIR, PULL, and VAL. */ |
109 | #define PIN_INPUT_PULLDOWN (PIN_DIR_INPUT | PIN_PULL_DOWN) | 115 | #define PIN_INPUT_PULLDOWN (PIN_DIR_INPUT | PIN_PULL_DOWN) |
110 | #define PIN_INPUT_PULLUP (PIN_DIR_INPUT | PIN_PULL_UP) | 116 | #define PIN_INPUT_PULLUP (PIN_DIR_INPUT | PIN_PULL_UP) |
diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c index 681daee80291..7b45d88b4f44 100644 --- a/drivers/gpio/gpio-nomadik.c +++ b/drivers/gpio/gpio-nomadik.c | |||
@@ -61,6 +61,7 @@ struct nmk_gpio_chip { | |||
61 | u32 rimsc; | 61 | u32 rimsc; |
62 | u32 fimsc; | 62 | u32 fimsc; |
63 | u32 pull_up; | 63 | u32 pull_up; |
64 | u32 lowemi; | ||
64 | }; | 65 | }; |
65 | 66 | ||
66 | static struct nmk_gpio_chip * | 67 | static struct nmk_gpio_chip * |
@@ -125,6 +126,24 @@ static void __nmk_gpio_set_pull(struct nmk_gpio_chip *nmk_chip, | |||
125 | } | 126 | } |
126 | } | 127 | } |
127 | 128 | ||
129 | static void __nmk_gpio_set_lowemi(struct nmk_gpio_chip *nmk_chip, | ||
130 | unsigned offset, bool lowemi) | ||
131 | { | ||
132 | u32 bit = BIT(offset); | ||
133 | bool enabled = nmk_chip->lowemi & bit; | ||
134 | |||
135 | if (lowemi == enabled) | ||
136 | return; | ||
137 | |||
138 | if (lowemi) | ||
139 | nmk_chip->lowemi |= bit; | ||
140 | else | ||
141 | nmk_chip->lowemi &= ~bit; | ||
142 | |||
143 | writel_relaxed(nmk_chip->lowemi, | ||
144 | nmk_chip->addr + NMK_GPIO_LOWEMI); | ||
145 | } | ||
146 | |||
128 | static void __nmk_gpio_make_input(struct nmk_gpio_chip *nmk_chip, | 147 | static void __nmk_gpio_make_input(struct nmk_gpio_chip *nmk_chip, |
129 | unsigned offset) | 148 | unsigned offset) |
130 | { | 149 | { |
@@ -269,6 +288,8 @@ static void __nmk_config_pin(struct nmk_gpio_chip *nmk_chip, unsigned offset, | |||
269 | __nmk_gpio_set_pull(nmk_chip, offset, pull); | 288 | __nmk_gpio_set_pull(nmk_chip, offset, pull); |
270 | } | 289 | } |
271 | 290 | ||
291 | __nmk_gpio_set_lowemi(nmk_chip, offset, PIN_LOWEMI(cfg)); | ||
292 | |||
272 | /* | 293 | /* |
273 | * If the pin is switching to altfunc, and there was an interrupt | 294 | * If the pin is switching to altfunc, and there was an interrupt |
274 | * installed on it which has been lazy disabled, actually mask the | 295 | * installed on it which has been lazy disabled, actually mask the |
@@ -1181,6 +1202,10 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) | |||
1181 | chip->dev = &dev->dev; | 1202 | chip->dev = &dev->dev; |
1182 | chip->owner = THIS_MODULE; | 1203 | chip->owner = THIS_MODULE; |
1183 | 1204 | ||
1205 | clk_enable(nmk_chip->clk); | ||
1206 | nmk_chip->lowemi = readl_relaxed(nmk_chip->addr + NMK_GPIO_LOWEMI); | ||
1207 | clk_disable(nmk_chip->clk); | ||
1208 | |||
1184 | ret = gpiochip_add(&nmk_chip->chip); | 1209 | ret = gpiochip_add(&nmk_chip->chip); |
1185 | if (ret) | 1210 | if (ret) |
1186 | goto out_free; | 1211 | goto out_free; |