Skip to content

Commit 9dabfdd

Browse files
zonquelinusw
authored andcommitted
gpio: pxa: disable pinctrl calls for PXA3xx
The pxa3xx driver uses the pinctrl-single driver since a while which does not implement a .gpio_set_direction() callback. The pinmux core will simply return 0 in this case, and the pxa3xx gpio driver hence believes the pinctrl driver did its job and returns as well. This effectively makes pxa_gpio_direction_{input,output} no-ops. To fix this, do not call into the pinctrl subsystem for the PXA3xx platform for now. We can revert this once the pinctrl-single driver learned to support setting pin directions. Signed-off-by: Daniel Mack <daniel@zonque.org> Acked-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 4bf4eed commit 9dabfdd

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

drivers/gpio/gpio-pxa.c

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,17 @@ int pxa_irq_to_gpio(int irq)
241241
return irq_gpio0;
242242
}
243243

244+
static bool pxa_gpio_has_pinctrl(void)
245+
{
246+
switch (gpio_type) {
247+
case PXA3XX_GPIO:
248+
return false;
249+
250+
default:
251+
return true;
252+
}
253+
}
254+
244255
static int pxa_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
245256
{
246257
struct pxa_gpio_chip *pchip = chip_to_pxachip(chip);
@@ -255,9 +266,11 @@ static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
255266
unsigned long flags;
256267
int ret;
257268

258-
ret = pinctrl_gpio_direction_input(chip->base + offset);
259-
if (!ret)
260-
return 0;
269+
if (pxa_gpio_has_pinctrl()) {
270+
ret = pinctrl_gpio_direction_input(chip->base + offset);
271+
if (!ret)
272+
return 0;
273+
}
261274

262275
spin_lock_irqsave(&gpio_lock, flags);
263276

@@ -282,9 +295,11 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip,
282295

283296
writel_relaxed(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET));
284297

285-
ret = pinctrl_gpio_direction_output(chip->base + offset);
286-
if (ret)
287-
return ret;
298+
if (pxa_gpio_has_pinctrl()) {
299+
ret = pinctrl_gpio_direction_output(chip->base + offset);
300+
if (ret)
301+
return ret;
302+
}
288303

289304
spin_lock_irqsave(&gpio_lock, flags);
290305

@@ -348,8 +363,12 @@ static int pxa_init_gpio_chip(struct pxa_gpio_chip *pchip, int ngpio,
348363
pchip->chip.set = pxa_gpio_set;
349364
pchip->chip.to_irq = pxa_gpio_to_irq;
350365
pchip->chip.ngpio = ngpio;
351-
pchip->chip.request = gpiochip_generic_request;
352-
pchip->chip.free = gpiochip_generic_free;
366+
367+
if (pxa_gpio_has_pinctrl()) {
368+
pchip->chip.request = gpiochip_generic_request;
369+
pchip->chip.free = gpiochip_generic_free;
370+
}
371+
353372
#ifdef CONFIG_OF_GPIO
354373
pchip->chip.of_node = np;
355374
pchip->chip.of_xlate = pxa_gpio_of_xlate;

0 commit comments

Comments
 (0)