diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2011-09-28 06:19:11 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-04-23 05:06:08 -0400 |
commit | ebc6178dab43b38042f0e089526bad49081870e5 (patch) | |
tree | 394a03b4d884ec7805424a7d12be0672b07ebe30 /drivers/gpio/gpio-nomadik.c | |
parent | 6c42ad1cf4d7f22469eaecb2eee3b6442169d732 (diff) |
gpio/nomadik: support low EMI mode
Low EMI (Electro-Magnetic Interference) mode means lower slew
rate on the signals. The Nomadik GPIO controller supports
this so create an interface to enable it.
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Reviewed-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-nomadik.c')
-rw-r--r-- | drivers/gpio/gpio-nomadik.c | 25 |
1 files changed, 25 insertions, 0 deletions
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; |