diff options
Diffstat (limited to 'drivers/gpio/gpio-omap.c')
-rw-r--r-- | drivers/gpio/gpio-omap.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index c4ed1722734c..e6efd77668f0 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -174,12 +174,22 @@ static inline void _gpio_dbck_enable(struct gpio_bank *bank) | |||
174 | if (bank->dbck_enable_mask && !bank->dbck_enabled) { | 174 | if (bank->dbck_enable_mask && !bank->dbck_enabled) { |
175 | clk_enable(bank->dbck); | 175 | clk_enable(bank->dbck); |
176 | bank->dbck_enabled = true; | 176 | bank->dbck_enabled = true; |
177 | |||
178 | __raw_writel(bank->dbck_enable_mask, | ||
179 | bank->base + bank->regs->debounce_en); | ||
177 | } | 180 | } |
178 | } | 181 | } |
179 | 182 | ||
180 | static inline void _gpio_dbck_disable(struct gpio_bank *bank) | 183 | static inline void _gpio_dbck_disable(struct gpio_bank *bank) |
181 | { | 184 | { |
182 | if (bank->dbck_enable_mask && bank->dbck_enabled) { | 185 | if (bank->dbck_enable_mask && bank->dbck_enabled) { |
186 | /* | ||
187 | * Disable debounce before cutting it's clock. If debounce is | ||
188 | * enabled but the clock is not, GPIO module seems to be unable | ||
189 | * to detect events and generate interrupts at least on OMAP3. | ||
190 | */ | ||
191 | __raw_writel(0, bank->base + bank->regs->debounce_en); | ||
192 | |||
183 | clk_disable(bank->dbck); | 193 | clk_disable(bank->dbck); |
184 | bank->dbck_enabled = false; | 194 | bank->dbck_enabled = false; |
185 | } | 195 | } |
@@ -889,12 +899,6 @@ static int gpio_debounce(struct gpio_chip *chip, unsigned offset, | |||
889 | 899 | ||
890 | bank = container_of(chip, struct gpio_bank, chip); | 900 | bank = container_of(chip, struct gpio_bank, chip); |
891 | 901 | ||
892 | if (!bank->dbck) { | ||
893 | bank->dbck = clk_get(bank->dev, "dbclk"); | ||
894 | if (IS_ERR(bank->dbck)) | ||
895 | dev_err(bank->dev, "Could not get gpio dbck\n"); | ||
896 | } | ||
897 | |||
898 | spin_lock_irqsave(&bank->lock, flags); | 902 | spin_lock_irqsave(&bank->lock, flags); |
899 | _set_gpio_debounce(bank, offset, debounce); | 903 | _set_gpio_debounce(bank, offset, debounce); |
900 | spin_unlock_irqrestore(&bank->lock, flags); | 904 | spin_unlock_irqrestore(&bank->lock, flags); |
@@ -966,6 +970,10 @@ static void omap_gpio_mod_init(struct gpio_bank *bank) | |||
966 | /* Initialize interface clk ungated, module enabled */ | 970 | /* Initialize interface clk ungated, module enabled */ |
967 | if (bank->regs->ctrl) | 971 | if (bank->regs->ctrl) |
968 | __raw_writel(0, base + bank->regs->ctrl); | 972 | __raw_writel(0, base + bank->regs->ctrl); |
973 | |||
974 | bank->dbck = clk_get(bank->dev, "dbclk"); | ||
975 | if (IS_ERR(bank->dbck)) | ||
976 | dev_err(bank->dev, "Could not get gpio dbck\n"); | ||
969 | } | 977 | } |
970 | 978 | ||
971 | static __devinit void | 979 | static __devinit void |
@@ -1081,7 +1089,6 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev) | |||
1081 | bank->is_mpuio = pdata->is_mpuio; | 1089 | bank->is_mpuio = pdata->is_mpuio; |
1082 | bank->non_wakeup_gpios = pdata->non_wakeup_gpios; | 1090 | bank->non_wakeup_gpios = pdata->non_wakeup_gpios; |
1083 | bank->loses_context = pdata->loses_context; | 1091 | bank->loses_context = pdata->loses_context; |
1084 | bank->get_context_loss_count = pdata->get_context_loss_count; | ||
1085 | bank->regs = pdata->regs; | 1092 | bank->regs = pdata->regs; |
1086 | #ifdef CONFIG_OF_GPIO | 1093 | #ifdef CONFIG_OF_GPIO |
1087 | bank->chip.of_node = of_node_get(node); | 1094 | bank->chip.of_node = of_node_get(node); |
@@ -1135,6 +1142,9 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev) | |||
1135 | omap_gpio_chip_init(bank); | 1142 | omap_gpio_chip_init(bank); |
1136 | omap_gpio_show_rev(bank); | 1143 | omap_gpio_show_rev(bank); |
1137 | 1144 | ||
1145 | if (bank->loses_context) | ||
1146 | bank->get_context_loss_count = pdata->get_context_loss_count; | ||
1147 | |||
1138 | pm_runtime_put(bank->dev); | 1148 | pm_runtime_put(bank->dev); |
1139 | 1149 | ||
1140 | list_add_tail(&bank->node, &omap_gpio_list); | 1150 | list_add_tail(&bank->node, &omap_gpio_list); |