summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/bcma/driver_gpio.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/bcma/driver_gpio.c b/drivers/bcma/driver_gpio.c
index 949754427ce2..98067f757fb0 100644
--- a/drivers/bcma/driver_gpio.c
+++ b/drivers/bcma/driver_gpio.c
@@ -17,14 +17,9 @@
17 17
18#define BCMA_GPIO_MAX_PINS 32 18#define BCMA_GPIO_MAX_PINS 32
19 19
20static inline struct bcma_drv_cc *bcma_gpio_get_cc(struct gpio_chip *chip)
21{
22 return container_of(chip, struct bcma_drv_cc, gpio);
23}
24
25static int bcma_gpio_get_value(struct gpio_chip *chip, unsigned gpio) 20static int bcma_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
26{ 21{
27 struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip); 22 struct bcma_drv_cc *cc = gpiochip_get_data(chip);
28 23
29 return !!bcma_chipco_gpio_in(cc, 1 << gpio); 24 return !!bcma_chipco_gpio_in(cc, 1 << gpio);
30} 25}
@@ -32,14 +27,14 @@ static int bcma_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
32static void bcma_gpio_set_value(struct gpio_chip *chip, unsigned gpio, 27static void bcma_gpio_set_value(struct gpio_chip *chip, unsigned gpio,
33 int value) 28 int value)
34{ 29{
35 struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip); 30 struct bcma_drv_cc *cc = gpiochip_get_data(chip);
36 31
37 bcma_chipco_gpio_out(cc, 1 << gpio, value ? 1 << gpio : 0); 32 bcma_chipco_gpio_out(cc, 1 << gpio, value ? 1 << gpio : 0);
38} 33}
39 34
40static int bcma_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) 35static int bcma_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
41{ 36{
42 struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip); 37 struct bcma_drv_cc *cc = gpiochip_get_data(chip);
43 38
44 bcma_chipco_gpio_outen(cc, 1 << gpio, 0); 39 bcma_chipco_gpio_outen(cc, 1 << gpio, 0);
45 return 0; 40 return 0;
@@ -48,7 +43,7 @@ static int bcma_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
48static int bcma_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, 43static int bcma_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
49 int value) 44 int value)
50{ 45{
51 struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip); 46 struct bcma_drv_cc *cc = gpiochip_get_data(chip);
52 47
53 bcma_chipco_gpio_outen(cc, 1 << gpio, 1 << gpio); 48 bcma_chipco_gpio_outen(cc, 1 << gpio, 1 << gpio);
54 bcma_chipco_gpio_out(cc, 1 << gpio, value ? 1 << gpio : 0); 49 bcma_chipco_gpio_out(cc, 1 << gpio, value ? 1 << gpio : 0);
@@ -57,7 +52,7 @@ static int bcma_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
57 52
58static int bcma_gpio_request(struct gpio_chip *chip, unsigned gpio) 53static int bcma_gpio_request(struct gpio_chip *chip, unsigned gpio)
59{ 54{
60 struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip); 55 struct bcma_drv_cc *cc = gpiochip_get_data(chip);
61 56
62 bcma_chipco_gpio_control(cc, 1 << gpio, 0); 57 bcma_chipco_gpio_control(cc, 1 << gpio, 0);
63 /* clear pulldown */ 58 /* clear pulldown */
@@ -70,7 +65,7 @@ static int bcma_gpio_request(struct gpio_chip *chip, unsigned gpio)
70 65
71static void bcma_gpio_free(struct gpio_chip *chip, unsigned gpio) 66static void bcma_gpio_free(struct gpio_chip *chip, unsigned gpio)
72{ 67{
73 struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip); 68 struct bcma_drv_cc *cc = gpiochip_get_data(chip);
74 69
75 /* clear pullup */ 70 /* clear pullup */
76 bcma_chipco_gpio_pullup(cc, 1 << gpio, 0); 71 bcma_chipco_gpio_pullup(cc, 1 << gpio, 0);
@@ -81,7 +76,7 @@ static void bcma_gpio_free(struct gpio_chip *chip, unsigned gpio)
81static void bcma_gpio_irq_unmask(struct irq_data *d) 76static void bcma_gpio_irq_unmask(struct irq_data *d)
82{ 77{
83 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 78 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
84 struct bcma_drv_cc *cc = bcma_gpio_get_cc(gc); 79 struct bcma_drv_cc *cc = gpiochip_get_data(gc);
85 int gpio = irqd_to_hwirq(d); 80 int gpio = irqd_to_hwirq(d);
86 u32 val = bcma_chipco_gpio_in(cc, BIT(gpio)); 81 u32 val = bcma_chipco_gpio_in(cc, BIT(gpio));
87 82
@@ -92,7 +87,7 @@ static void bcma_gpio_irq_unmask(struct irq_data *d)
92static void bcma_gpio_irq_mask(struct irq_data *d) 87static void bcma_gpio_irq_mask(struct irq_data *d)
93{ 88{
94 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 89 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
95 struct bcma_drv_cc *cc = bcma_gpio_get_cc(gc); 90 struct bcma_drv_cc *cc = gpiochip_get_data(gc);
96 int gpio = irqd_to_hwirq(d); 91 int gpio = irqd_to_hwirq(d);
97 92
98 bcma_chipco_gpio_intmask(cc, BIT(gpio), 0); 93 bcma_chipco_gpio_intmask(cc, BIT(gpio), 0);
@@ -216,7 +211,7 @@ int bcma_gpio_init(struct bcma_drv_cc *cc)
216 else 211 else
217 chip->base = -1; 212 chip->base = -1;
218 213
219 err = gpiochip_add(chip); 214 err = gpiochip_add_data(chip, cc);
220 if (err) 215 if (err)
221 return err; 216 return err;
222 217