diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2016-09-03 09:37:35 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2020-10-12 21:53:15 +0100 |
commit | efc9d25a76cab8e7f30637703fb93d476946451b (patch) | |
tree | 2238e0cb9b099e2800d4fbf10d548f67895834a0 | |
parent | 05761815a6800b3f2a212bcc5e13f1ef902da73d (diff) |
ARM: pxa/mainstone: convert mainstone IrDA to use gpiod APIs
Convert the mainstone IrDA support to use gpiod APIs, eliminating the
need for the transceiver mode callback into platform code.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | arch/arm/mach-pxa/mainstone.c | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index d1010ec26e9f..ee0deb0b76fb 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c @@ -316,6 +316,15 @@ static struct pxafb_mach_info mainstone_pxafb_info = { .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, }; +static struct gpio_chip *mst_mscwr1; + +static void mainstone_gpio_write(struct gpio_chip *gc, unsigned long mask, + unsigned long value) +{ + if (gc) + gc->set_multiple(gc, &mask, &value); +} + static int mainstone_mci_init(struct device *dev, irq_handler_t mstone_detect_int, void *data) { int err; @@ -323,7 +332,7 @@ static int mainstone_mci_init(struct device *dev, irq_handler_t mstone_detect_in /* make sure SD/Memory Stick multiplexer's signals * are routed to MMC controller */ - MST_MSCWR1 &= ~MST_MSCWR1_MS_SEL; + mainstone_gpio_write(mst_mscwr1, MST_MSCWR1_MS_SEL, 0); err = request_irq(MAINSTONE_MMC_IRQ, mstone_detect_int, 0, "MMC card detect", data); @@ -339,11 +348,9 @@ static int mainstone_mci_setpower(struct device *dev, unsigned int vdd) if (( 1 << vdd) & p_d->ocr_mask) { printk(KERN_DEBUG "%s: on\n", __func__); - MST_MSCWR1 |= MST_MSCWR1_MMC_ON; - MST_MSCWR1 &= ~MST_MSCWR1_MS_SEL; + mainstone_gpio_write(mst_mscwr1, MST_MSCWR1_MS_SEL, 0); } else { printk(KERN_DEBUG "%s: off\n", __func__); - MST_MSCWR1 &= ~MST_MSCWR1_MMC_ON; } return 0; } @@ -360,29 +367,19 @@ static struct pxamci_platform_data mainstone_mci_platform_data = { .exit = mainstone_mci_exit, }; -static void mainstone_irda_transceiver_mode(struct device *dev, int mode) -{ - unsigned long flags; - - local_irq_save(flags); - if (mode & IR_SIRMODE) { - MST_MSCWR1 &= ~MST_MSCWR1_IRDA_FIR; - } else if (mode & IR_FIRMODE) { - MST_MSCWR1 |= MST_MSCWR1_IRDA_FIR; - } - pxa2xx_transceiver_mode(dev, mode); - if (mode & IR_OFF) { - MST_MSCWR1 = (MST_MSCWR1 & ~MST_MSCWR1_IRDA_MASK) | MST_MSCWR1_IRDA_OFF; - } else { - MST_MSCWR1 = (MST_MSCWR1 & ~MST_MSCWR1_IRDA_MASK) | MST_MSCWR1_IRDA_FULL; - } - local_irq_restore(flags); -} - static struct pxaficp_platform_data mainstone_ficp_platform_data = { .gpio_pwdown = -1, .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, - .transceiver_mode = mainstone_irda_transceiver_mode, +}; + +static struct gpiod_lookup_table mainstone_ficp_gpio_table = { + .dev_id = "pxa2xx-ir", + .table = { + GPIO_LOOKUP("mst-mscwr1", 4, "ir-fsel", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("mst-mscwr1", 5, "ir-md0", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("mst-mscwr1", 6, "ir-md1", GPIO_ACTIVE_HIGH), + { }, + }, }; static struct gpio_keys_button gpio_keys_button[] = { @@ -559,6 +556,12 @@ static void __init mainstone_init(void) NULL, mst_pcmcia1_irqs); gpiod_add_lookup_table(&mainstone_pcmcia_gpio_table); + mst_mscwr1 = gpio_reg_init(NULL, (void __iomem *)&MST_MSCWR1, -1, 16, + "mst-mscwr1", 0, 0, NULL, NULL, NULL); + gpiod_add_lookup_table(&mainstone_ficp_gpio_table); + /* MCI power on = MST_MSCWR1_MMC_ON */ + mainstone_mci_platform_data.gpio_power = mst_mscwr1->base + 11; + pxa_set_ffuart_info(NULL); pxa_set_btuart_info(NULL); pxa_set_stuart_info(NULL); |