aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-nomadik.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio/gpio-nomadik.c')
-rw-r--r--drivers/gpio/gpio-nomadik.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c
index 380204781f84..4961ef9bc153 100644
--- a/drivers/gpio/gpio-nomadik.c
+++ b/drivers/gpio/gpio-nomadik.c
@@ -57,6 +57,7 @@ struct nmk_gpio_chip {
57 u32 fwimsc; 57 u32 fwimsc;
58 u32 slpm; 58 u32 slpm;
59 u32 enabled; 59 u32 enabled;
60 u32 pull_up;
60}; 61};
61 62
62static struct nmk_gpio_chip * 63static struct nmk_gpio_chip *
@@ -103,16 +104,22 @@ static void __nmk_gpio_set_pull(struct nmk_gpio_chip *nmk_chip,
103 u32 pdis; 104 u32 pdis;
104 105
105 pdis = readl(nmk_chip->addr + NMK_GPIO_PDIS); 106 pdis = readl(nmk_chip->addr + NMK_GPIO_PDIS);
106 if (pull == NMK_GPIO_PULL_NONE) 107 if (pull == NMK_GPIO_PULL_NONE) {
107 pdis |= bit; 108 pdis |= bit;
108 else 109 nmk_chip->pull_up &= ~bit;
110 } else {
109 pdis &= ~bit; 111 pdis &= ~bit;
112 }
113
110 writel(pdis, nmk_chip->addr + NMK_GPIO_PDIS); 114 writel(pdis, nmk_chip->addr + NMK_GPIO_PDIS);
111 115
112 if (pull == NMK_GPIO_PULL_UP) 116 if (pull == NMK_GPIO_PULL_UP) {
117 nmk_chip->pull_up |= bit;
113 writel(bit, nmk_chip->addr + NMK_GPIO_DATS); 118 writel(bit, nmk_chip->addr + NMK_GPIO_DATS);
114 else if (pull == NMK_GPIO_PULL_DOWN) 119 } else if (pull == NMK_GPIO_PULL_DOWN) {
120 nmk_chip->pull_up &= ~bit;
115 writel(bit, nmk_chip->addr + NMK_GPIO_DATC); 121 writel(bit, nmk_chip->addr + NMK_GPIO_DATC);
122 }
116} 123}
117 124
118static void __nmk_gpio_make_input(struct nmk_gpio_chip *nmk_chip, 125static void __nmk_gpio_make_input(struct nmk_gpio_chip *nmk_chip,
@@ -921,6 +928,25 @@ void nmk_gpio_wakeups_resume(void)
921 } 928 }
922} 929}
923 930
931/*
932 * Read the pull up/pull down status.
933 * A bit set in 'pull_up' means that pull up
934 * is selected if pull is enabled in PDIS register.
935 * Note: only pull up/down set via this driver can
936 * be detected due to HW limitations.
937 */
938void nmk_gpio_read_pull(int gpio_bank, u32 *pull_up)
939{
940 if (gpio_bank < NUM_BANKS) {
941 struct nmk_gpio_chip *chip = nmk_gpio_chips[gpio_bank];
942
943 if (!chip)
944 return;
945
946 *pull_up = chip->pull_up;
947 }
948}
949
924static int __devinit nmk_gpio_probe(struct platform_device *dev) 950static int __devinit nmk_gpio_probe(struct platform_device *dev)
925{ 951{
926 struct nmk_gpio_platform_data *pdata = dev->dev.platform_data; 952 struct nmk_gpio_platform_data *pdata = dev->dev.platform_data;