ARM: pxa/lubbock: add GPIO driver for LUB_MISC_WR register

Add a gpio driver for the lubbock miscellaneous write IO register so we
can take advantage of subsystems modelled around gpiolib, rather than
having to provide platform specific callbacks.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
This commit is contained in:
Russell King 2017-12-11 18:56:35 +00:00 committed by Robert Jarzmik
parent c6f8d31c06
commit 9c66638412
2 changed files with 17 additions and 8 deletions

View File

@ -40,6 +40,7 @@ config MACH_PXA3XX_DT
config ARCH_LUBBOCK config ARCH_LUBBOCK
bool "Intel DBPXA250 Development Platform (aka Lubbock)" bool "Intel DBPXA250 Development Platform (aka Lubbock)"
select GPIO_REG
select PXA25x select PXA25x
select SA1111 select SA1111

View File

@ -13,6 +13,7 @@
*/ */
#include <linux/clkdev.h> #include <linux/clkdev.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio/gpio-reg.h>
#include <linux/gpio/machine.h> #include <linux/gpio/machine.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
@ -110,20 +111,18 @@ static unsigned long lubbock_pin_config[] __initdata = {
}; };
#define LUB_HEXLED __LUB_REG(LUBBOCK_FPGA_PHYS + 0x010) #define LUB_HEXLED __LUB_REG(LUBBOCK_FPGA_PHYS + 0x010)
#define LUB_MISC_WR __LUB_REG(LUBBOCK_FPGA_PHYS + 0x080)
void lubbock_set_hexled(uint32_t value) void lubbock_set_hexled(uint32_t value)
{ {
LUB_HEXLED = value; LUB_HEXLED = value;
} }
static struct gpio_chip *lubbock_misc_wr_gc;
void lubbock_set_misc_wr(unsigned int mask, unsigned int set) void lubbock_set_misc_wr(unsigned int mask, unsigned int set)
{ {
unsigned long flags; unsigned long m = mask, v = set;
lubbock_misc_wr_gc->set_multiple(lubbock_misc_wr_gc, &m, &v);
local_irq_save(flags);
LUB_MISC_WR = (LUB_MISC_WR & ~mask) | (set & mask);
local_irq_restore(flags);
} }
EXPORT_SYMBOL(lubbock_set_misc_wr); EXPORT_SYMBOL(lubbock_set_misc_wr);
@ -452,9 +451,9 @@ static void lubbock_irda_transceiver_mode(struct device *dev, int mode)
local_irq_save(flags); local_irq_save(flags);
if (mode & IR_SIRMODE) { if (mode & IR_SIRMODE) {
LUB_MISC_WR &= ~(1 << 4); lubbock_set_misc_wr(BIT(4), 0);
} else if (mode & IR_FIRMODE) { } else if (mode & IR_FIRMODE) {
LUB_MISC_WR |= 1 << 4; lubbock_set_misc_wr(BIT(4), BIT(4));
} }
pxa2xx_transceiver_mode(dev, mode); pxa2xx_transceiver_mode(dev, mode);
local_irq_restore(flags); local_irq_restore(flags);
@ -472,6 +471,15 @@ static void __init lubbock_init(void)
pxa2xx_mfp_config(ARRAY_AND_SIZE(lubbock_pin_config)); pxa2xx_mfp_config(ARRAY_AND_SIZE(lubbock_pin_config));
lubbock_misc_wr_gc = gpio_reg_init(NULL, (void *)&LUB_MISC_WR,
-1, 16, "lubbock", 0, LUB_MISC_WR,
NULL, NULL, NULL);
if (IS_ERR(lubbock_misc_wr_gc)) {
pr_err("Lubbock: unable to register lubbock GPIOs: %ld\n",
PTR_ERR(lubbock_misc_wr_gc));
lubbock_misc_wr_gc = NULL;
}
pxa_set_ffuart_info(NULL); pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL); pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL); pxa_set_stuart_info(NULL);