aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-altera.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-04 15:05:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-04 15:05:32 -0400
commit2bd80401743568ced7d303b008ae5298ce77e695 (patch)
treed70278682fca619f7d842faa7c5a5bdce5016cfa /drivers/gpio/gpio-altera.c
parent99a7583de5ffd5cd82c407aad32bcbdeea09155b (diff)
parentb86c86aa9805b25ee70071d084e618b2c40641b5 (diff)
Merge tag 'gpio-v4.12-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO updates from Linus Walleij: "This is the bulk of GPIO changes for the v4.12 kernel cycle. Core changes: - Return NULL from gpiod_get_optional() when GPIOLIB is disabled. This was a much discussed change. It affects use cases where people write drivers that might or might not be using GPIO resources. I have decided that this is the lesser evil right now. - Make gpiod_count() behave consistently across different hardware descriptions. - Fix the syntax around open drain/open source to not infer active high/low semantics. New drivers: - A new single-register fixed-direction framework driver for hardware that have lines controlled by a single register that just work in one direction (out or in), including IRQ support. - Support the Fintek F71889A GPIO SuperIO controller. - Support the National NI 169445 MMIO GPIO. - Support for the X-Gene derivative of the DWC GPIO controller - Support for the Rohm BD9571MWV-M PMIC GPIO controller. - Refactor the Gemini GPIO driver to a generic Faraday FTGPIO driver and replace both the Gemini and the Moxa ART custom drivers with this driver. Driver improvements: - A whole slew of drivers have their spinlocks chaned to raw spinlocks as they provide irqchips, and thus we are progressing on realtime compliance. - Use devm_irq_alloc_descs() in a slew of drivers, getting managed resources. - Support for the embedded PWM controller inside the MVEBU driver. - Debounce, open source and open drain support for the Aspeed driver. - Misc smaller fixes like spelling and syntax and whatnot" * tag 'gpio-v4.12-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (77 commits) gpio: f7188x: Add a missing break gpio: omap: return error if requested debounce time is not possible gpio: Add ROHM BD9571MWV-M PMIC GPIO driver gpio: gpio-wcove: fix GPIO IRQ status mask gpio: DT bindings, move tca9554 from pcf857x to pca953x gpio: move tca9554 from pcf857x to pca953x gpio: arizona: Correct check whether the pin is an input gpio: Add XRA1403 DTS binding documentation dt-bindings: add exar to vendor prefixes list gpio: gpio-wcove: fix irq pending status bit width gpio: dwapb: use dwapb_read instead of readl_relaxed gpio: aspeed: Add open-source and open-drain support gpio: aspeed: Add debounce support gpio: aspeed: dt: Add optional clocks property gpio: aspeed: dt: Fix description alignment in bindings document gpio: mvebu: Add limited PWM support gpio: Use unsigned int for interrupt numbers gpio: f7188x: Add F71889A GPIO support. gpio: core: Decouple open drain/source flag with active low/high gpio: arizona: Correct handling for reading input GPIOs ...
Diffstat (limited to 'drivers/gpio/gpio-altera.c')
-rw-r--r--drivers/gpio/gpio-altera.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/gpio/gpio-altera.c b/drivers/gpio/gpio-altera.c
index 3fe6a21e05a5..17485dc20384 100644
--- a/drivers/gpio/gpio-altera.c
+++ b/drivers/gpio/gpio-altera.c
@@ -38,7 +38,7 @@
38*/ 38*/
39struct altera_gpio_chip { 39struct altera_gpio_chip {
40 struct of_mm_gpio_chip mmchip; 40 struct of_mm_gpio_chip mmchip;
41 spinlock_t gpio_lock; 41 raw_spinlock_t gpio_lock;
42 int interrupt_trigger; 42 int interrupt_trigger;
43 int mapped_irq; 43 int mapped_irq;
44}; 44};
@@ -53,12 +53,12 @@ static void altera_gpio_irq_unmask(struct irq_data *d)
53 altera_gc = gpiochip_get_data(irq_data_get_irq_chip_data(d)); 53 altera_gc = gpiochip_get_data(irq_data_get_irq_chip_data(d));
54 mm_gc = &altera_gc->mmchip; 54 mm_gc = &altera_gc->mmchip;
55 55
56 spin_lock_irqsave(&altera_gc->gpio_lock, flags); 56 raw_spin_lock_irqsave(&altera_gc->gpio_lock, flags);
57 intmask = readl(mm_gc->regs + ALTERA_GPIO_IRQ_MASK); 57 intmask = readl(mm_gc->regs + ALTERA_GPIO_IRQ_MASK);
58 /* Set ALTERA_GPIO_IRQ_MASK bit to unmask */ 58 /* Set ALTERA_GPIO_IRQ_MASK bit to unmask */
59 intmask |= BIT(irqd_to_hwirq(d)); 59 intmask |= BIT(irqd_to_hwirq(d));
60 writel(intmask, mm_gc->regs + ALTERA_GPIO_IRQ_MASK); 60 writel(intmask, mm_gc->regs + ALTERA_GPIO_IRQ_MASK);
61 spin_unlock_irqrestore(&altera_gc->gpio_lock, flags); 61 raw_spin_unlock_irqrestore(&altera_gc->gpio_lock, flags);
62} 62}
63 63
64static void altera_gpio_irq_mask(struct irq_data *d) 64static void altera_gpio_irq_mask(struct irq_data *d)
@@ -71,12 +71,12 @@ static void altera_gpio_irq_mask(struct irq_data *d)
71 altera_gc = gpiochip_get_data(irq_data_get_irq_chip_data(d)); 71 altera_gc = gpiochip_get_data(irq_data_get_irq_chip_data(d));
72 mm_gc = &altera_gc->mmchip; 72 mm_gc = &altera_gc->mmchip;
73 73
74 spin_lock_irqsave(&altera_gc->gpio_lock, flags); 74 raw_spin_lock_irqsave(&altera_gc->gpio_lock, flags);
75 intmask = readl(mm_gc->regs + ALTERA_GPIO_IRQ_MASK); 75 intmask = readl(mm_gc->regs + ALTERA_GPIO_IRQ_MASK);
76 /* Clear ALTERA_GPIO_IRQ_MASK bit to mask */ 76 /* Clear ALTERA_GPIO_IRQ_MASK bit to mask */
77 intmask &= ~BIT(irqd_to_hwirq(d)); 77 intmask &= ~BIT(irqd_to_hwirq(d));
78 writel(intmask, mm_gc->regs + ALTERA_GPIO_IRQ_MASK); 78 writel(intmask, mm_gc->regs + ALTERA_GPIO_IRQ_MASK);
79 spin_unlock_irqrestore(&altera_gc->gpio_lock, flags); 79 raw_spin_unlock_irqrestore(&altera_gc->gpio_lock, flags);
80} 80}
81 81
82/** 82/**
@@ -140,14 +140,14 @@ static void altera_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
140 mm_gc = to_of_mm_gpio_chip(gc); 140 mm_gc = to_of_mm_gpio_chip(gc);
141 chip = gpiochip_get_data(gc); 141 chip = gpiochip_get_data(gc);
142 142
143 spin_lock_irqsave(&chip->gpio_lock, flags); 143 raw_spin_lock_irqsave(&chip->gpio_lock, flags);
144 data_reg = readl(mm_gc->regs + ALTERA_GPIO_DATA); 144 data_reg = readl(mm_gc->regs + ALTERA_GPIO_DATA);
145 if (value) 145 if (value)
146 data_reg |= BIT(offset); 146 data_reg |= BIT(offset);
147 else 147 else
148 data_reg &= ~BIT(offset); 148 data_reg &= ~BIT(offset);
149 writel(data_reg, mm_gc->regs + ALTERA_GPIO_DATA); 149 writel(data_reg, mm_gc->regs + ALTERA_GPIO_DATA);
150 spin_unlock_irqrestore(&chip->gpio_lock, flags); 150 raw_spin_unlock_irqrestore(&chip->gpio_lock, flags);
151} 151}
152 152
153static int altera_gpio_direction_input(struct gpio_chip *gc, unsigned offset) 153static int altera_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
@@ -160,12 +160,12 @@ static int altera_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
160 mm_gc = to_of_mm_gpio_chip(gc); 160 mm_gc = to_of_mm_gpio_chip(gc);
161 chip = gpiochip_get_data(gc); 161 chip = gpiochip_get_data(gc);
162 162
163 spin_lock_irqsave(&chip->gpio_lock, flags); 163 raw_spin_lock_irqsave(&chip->gpio_lock, flags);
164 /* Set pin as input, assumes software controlled IP */ 164 /* Set pin as input, assumes software controlled IP */
165 gpio_ddr = readl(mm_gc->regs + ALTERA_GPIO_DIR); 165 gpio_ddr = readl(mm_gc->regs + ALTERA_GPIO_DIR);
166 gpio_ddr &= ~BIT(offset); 166 gpio_ddr &= ~BIT(offset);
167 writel(gpio_ddr, mm_gc->regs + ALTERA_GPIO_DIR); 167 writel(gpio_ddr, mm_gc->regs + ALTERA_GPIO_DIR);
168 spin_unlock_irqrestore(&chip->gpio_lock, flags); 168 raw_spin_unlock_irqrestore(&chip->gpio_lock, flags);
169 169
170 return 0; 170 return 0;
171} 171}
@@ -181,7 +181,7 @@ static int altera_gpio_direction_output(struct gpio_chip *gc,
181 mm_gc = to_of_mm_gpio_chip(gc); 181 mm_gc = to_of_mm_gpio_chip(gc);
182 chip = gpiochip_get_data(gc); 182 chip = gpiochip_get_data(gc);
183 183
184 spin_lock_irqsave(&chip->gpio_lock, flags); 184 raw_spin_lock_irqsave(&chip->gpio_lock, flags);
185 /* Sets the GPIO value */ 185 /* Sets the GPIO value */
186 data_reg = readl(mm_gc->regs + ALTERA_GPIO_DATA); 186 data_reg = readl(mm_gc->regs + ALTERA_GPIO_DATA);
187 if (value) 187 if (value)
@@ -194,7 +194,7 @@ static int altera_gpio_direction_output(struct gpio_chip *gc,
194 gpio_ddr = readl(mm_gc->regs + ALTERA_GPIO_DIR); 194 gpio_ddr = readl(mm_gc->regs + ALTERA_GPIO_DIR);
195 gpio_ddr |= BIT(offset); 195 gpio_ddr |= BIT(offset);
196 writel(gpio_ddr, mm_gc->regs + ALTERA_GPIO_DIR); 196 writel(gpio_ddr, mm_gc->regs + ALTERA_GPIO_DIR);
197 spin_unlock_irqrestore(&chip->gpio_lock, flags); 197 raw_spin_unlock_irqrestore(&chip->gpio_lock, flags);
198 198
199 return 0; 199 return 0;
200} 200}
@@ -262,7 +262,7 @@ static int altera_gpio_probe(struct platform_device *pdev)
262 if (!altera_gc) 262 if (!altera_gc)
263 return -ENOMEM; 263 return -ENOMEM;
264 264
265 spin_lock_init(&altera_gc->gpio_lock); 265 raw_spin_lock_init(&altera_gc->gpio_lock);
266 266
267 if (of_property_read_u32(node, "altr,ngpio", &reg)) 267 if (of_property_read_u32(node, "altr,ngpio", &reg))
268 /* By default assume maximum ngpio */ 268 /* By default assume maximum ngpio */