* [PATCH] ARM: pxa/lubbock: add GPIO driver for LUB_MISC_WR register
@ 2017-12-11 18:56 Russell King
2017-12-12 20:27 ` Robert Jarzmik
2017-12-12 23:09 ` Linus Walleij
0 siblings, 2 replies; 6+ messages in thread
From: Russell King @ 2017-12-11 18:56 UTC (permalink / raw)
To: linux-arm-kernel
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>
---
arch/arm/mach-pxa/Kconfig | 1 +
arch/arm/mach-pxa/lubbock.c | 24 ++++++++++++++++--------
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index ce7d97babb0f..a68b34183107 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -40,6 +40,7 @@ config MACH_PXA3XX_DT
config ARCH_LUBBOCK
bool "Intel DBPXA250 Development Platform (aka Lubbock)"
+ select GPIO_REG
select PXA25x
select SA1111
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index df45682e99a5..fe2ef9b78602 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -13,6 +13,7 @@
*/
#include <linux/clkdev.h>
#include <linux/gpio.h>
+#include <linux/gpio/gpio-reg.h>
#include <linux/gpio/machine.h>
#include <linux/module.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_MISC_WR __LUB_REG(LUBBOCK_FPGA_PHYS + 0x080)
void lubbock_set_hexled(uint32_t value)
{
LUB_HEXLED = value;
}
+static struct gpio_chip *lubbock_misc_wr_gc;
+
void lubbock_set_misc_wr(unsigned int mask, unsigned int set)
{
- unsigned long flags;
-
- local_irq_save(flags);
- LUB_MISC_WR = (LUB_MISC_WR & ~mask) | (set & mask);
- local_irq_restore(flags);
+ unsigned long m = mask, v = set;
+ lubbock_misc_wr_gc->set_multiple(lubbock_misc_wr_gc, &m, &v);
}
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);
if (mode & IR_SIRMODE) {
- LUB_MISC_WR &= ~(1 << 4);
+ lubbock_set_misc_wr(BIT(4), 0);
} else if (mode & IR_FIRMODE) {
- LUB_MISC_WR |= 1 << 4;
+ lubbock_set_misc_wr(BIT(4), BIT(4));
}
pxa2xx_transceiver_mode(dev, mode);
local_irq_restore(flags);
@@ -472,6 +471,15 @@ static void __init lubbock_init(void)
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_btuart_info(NULL);
pxa_set_stuart_info(NULL);
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] ARM: pxa/lubbock: add GPIO driver for LUB_MISC_WR register
2017-12-11 18:56 [PATCH] ARM: pxa/lubbock: add GPIO driver for LUB_MISC_WR register Russell King
@ 2017-12-12 20:27 ` Robert Jarzmik
2017-12-12 23:08 ` Linus Walleij
2017-12-12 23:24 ` Russell King - ARM Linux
2017-12-12 23:09 ` Linus Walleij
1 sibling, 2 replies; 6+ messages in thread
From: Robert Jarzmik @ 2017-12-12 20:27 UTC (permalink / raw)
To: linux-arm-kernel
Russell King <rmk+kernel@armlinux.org.uk> writes:
> 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>
Hi Russell and Linux,
It looks certainly good to me. It's unfortunate in the current status of
linux-next I have, gpio-reg.c seems broken (that one is for Linus in [1] and
[2]), and therefore I can't test it live.
Nonetheless, do you want me to carry it through the pxa tree or do you want to
keep it through your tree ?
Cheers.
--
Robert
[1] For Linus if he wasn't notified before :
---8>---
CC drivers/gpio/gpio-reg.o
drivers/gpio/gpio-reg.c: In function 'gpio_reg_to_irq':
drivers/gpio/gpio-reg.c:106:19: error: 'struct gpio_reg' has no member named 'irq'
if (irq >= 0 && r->irq.domain)
^
drivers/gpio/gpio-reg.c:107:27: error: 'struct gpio_reg' has no member named 'irq'
irq = irq_find_mapping(r->irq.domain, irq);
^
make[2]: *** [drivers/gpio/gpio-reg.o] Erreur 1
---8>---
[2] For Linux, git commit of my linux-next tip
d20787938ddb ("Add linux-next specific files for 20171212")
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] ARM: pxa/lubbock: add GPIO driver for LUB_MISC_WR register
2017-12-12 20:27 ` Robert Jarzmik
@ 2017-12-12 23:08 ` Linus Walleij
2017-12-12 23:24 ` Russell King - ARM Linux
1 sibling, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2017-12-12 23:08 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Dec 12, 2017 at 9:27 PM, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> Russell King <rmk+kernel@armlinux.org.uk> writes:
>
>> 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>
>
> Hi Russell and Linux,
>
> It looks certainly good to me. It's unfortunate in the current status of
> linux-next I have, gpio-reg.c seems broken (that one is for Linus in [1] and
> [2]), and therefore I can't test it live.
OK I have applied a patch fixing it, sorry for not preparing the trees and
pushing it out quicker :(
> Nonetheless, do you want me to carry it through the pxa tree or do you want to
> keep it through your tree ?
By all means carry it in the PXA tree.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] ARM: pxa/lubbock: add GPIO driver for LUB_MISC_WR register
2017-12-11 18:56 [PATCH] ARM: pxa/lubbock: add GPIO driver for LUB_MISC_WR register Russell King
2017-12-12 20:27 ` Robert Jarzmik
@ 2017-12-12 23:09 ` Linus Walleij
1 sibling, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2017-12-12 23:09 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Dec 11, 2017 at 7:56 PM, Russell King
<rmk+kernel@armlinux.org.uk> wrote:
> 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>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] ARM: pxa/lubbock: add GPIO driver for LUB_MISC_WR register
2017-12-12 20:27 ` Robert Jarzmik
2017-12-12 23:08 ` Linus Walleij
@ 2017-12-12 23:24 ` Russell King - ARM Linux
2017-12-17 20:02 ` Robert Jarzmik
1 sibling, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2017-12-12 23:24 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Dec 12, 2017 at 09:27:34PM +0100, Robert Jarzmik wrote:
> Russell King <rmk+kernel@armlinux.org.uk> writes:
>
> > 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>
>
> Hi Russell and Linux,
>
> It looks certainly good to me. It's unfortunate in the current status of
> linux-next I have, gpio-reg.c seems broken (that one is for Linus in [1] and
> [2]), and therefore I can't test it live.
It won't do much on its own without some patches to make use of the new
GPIOs... but it will be used as the direct register write becomes a
call to gpio-reg's ->set_multiple() method.
Further patches will be switching various bits over to using gpiod
stuff for some sa11x0/pxa bits, and on some platforms completely
eliminating the legacy "board control register" manipulations and
hacks spread around the kernel tree.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] ARM: pxa/lubbock: add GPIO driver for LUB_MISC_WR register
2017-12-12 23:24 ` Russell King - ARM Linux
@ 2017-12-17 20:02 ` Robert Jarzmik
0 siblings, 0 replies; 6+ messages in thread
From: Robert Jarzmik @ 2017-12-17 20:02 UTC (permalink / raw)
To: linux-arm-kernel
Russell King - ARM Linux <linux@armlinux.org.uk> writes:
> On Tue, Dec 12, 2017 at 09:27:34PM +0100, Robert Jarzmik wrote:
>> Russell King <rmk+kernel@armlinux.org.uk> writes:
>>
>> > 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>
>>
>> Hi Russell and Linux,
>>
>> It looks certainly good to me. It's unfortunate in the current status of
>> linux-next I have, gpio-reg.c seems broken (that one is for Linus in [1] and
>> [2]), and therefore I can't test it live.
>
> It won't do much on its own without some patches to make use of the new
> GPIOs... but it will be used as the direct register write becomes a
> call to gpio-reg's ->set_multiple() method.
Applied to pxa/for-next, thanks.
Cheers.
--
Robert
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-12-17 20:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-11 18:56 [PATCH] ARM: pxa/lubbock: add GPIO driver for LUB_MISC_WR register Russell King
2017-12-12 20:27 ` Robert Jarzmik
2017-12-12 23:08 ` Linus Walleij
2017-12-12 23:24 ` Russell King - ARM Linux
2017-12-17 20:02 ` Robert Jarzmik
2017-12-12 23:09 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).