aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-davinci.c
diff options
context:
space:
mode:
authorAndrew F. Davis <afd@ti.com>2018-08-31 15:13:26 -0400
committerLinus Walleij <linus.walleij@linaro.org>2018-09-20 11:36:19 -0400
commit79b73ff9b2a3ef312d8fa30894fd963c80ded466 (patch)
treeea8b7779d33e9c856b47970abbdb1c7c4bd9d5dd /drivers/gpio/gpio-davinci.c
parentc36219d9d8df11641d28c6bd0698459485b1709b (diff)
gpio: davinci: Move driver local definitions to driver
These defines, structs and inline functions are used only internally by the driver, they do not belong in platform_data. Move them. Signed-off-by: Andrew F. Davis <afd@ti.com> Tested-by: Keerthy <j-keerthy@ti.com> Acked-by: Keerthy <j-keerthy@ti.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-davinci.c')
-rw-r--r--drivers/gpio/gpio-davinci.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index 121a7948f785..5c1564fcc24e 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -9,6 +9,7 @@
9 * the Free Software Foundation; either version 2 of the License, or 9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version. 10 * (at your option) any later version.
11 */ 11 */
12
12#include <linux/gpio/driver.h> 13#include <linux/gpio/driver.h>
13#include <linux/errno.h> 14#include <linux/errno.h>
14#include <linux/kernel.h> 15#include <linux/kernel.h>
@@ -24,6 +25,12 @@
24#include <linux/platform_device.h> 25#include <linux/platform_device.h>
25#include <linux/platform_data/gpio-davinci.h> 26#include <linux/platform_data/gpio-davinci.h>
26#include <linux/irqchip/chained_irq.h> 27#include <linux/irqchip/chained_irq.h>
28#include <linux/spinlock.h>
29
30#include <asm-generic/gpio.h>
31
32#define MAX_REGS_BANKS 5
33#define MAX_INT_PER_BANK 32
27 34
28struct davinci_gpio_regs { 35struct davinci_gpio_regs {
29 u32 dir; 36 u32 dir;
@@ -45,6 +52,27 @@ typedef struct irq_chip *(*gpio_get_irq_chip_cb_t)(unsigned int irq);
45static void __iomem *gpio_base; 52static void __iomem *gpio_base;
46static unsigned int offset_array[5] = {0x10, 0x38, 0x60, 0x88, 0xb0}; 53static unsigned int offset_array[5] = {0x10, 0x38, 0x60, 0x88, 0xb0};
47 54
55struct davinci_gpio_irq_data {
56 void __iomem *regs;
57 struct davinci_gpio_controller *chip;
58 int bank_num;
59};
60
61struct davinci_gpio_controller {
62 struct gpio_chip chip;
63 struct irq_domain *irq_domain;
64 /* Serialize access to GPIO registers */
65 spinlock_t lock;
66 void __iomem *regs[MAX_REGS_BANKS];
67 int gpio_unbanked;
68 int irqs[MAX_INT_PER_BANK];
69};
70
71static inline u32 __gpio_mask(unsigned gpio)
72{
73 return 1 << (gpio % 32);
74}
75
48static inline struct davinci_gpio_regs __iomem *irq2regs(struct irq_data *d) 76static inline struct davinci_gpio_regs __iomem *irq2regs(struct irq_data *d)
49{ 77{
50 struct davinci_gpio_regs __iomem *g; 78 struct davinci_gpio_regs __iomem *g;