* AT91 pinctrl/gpio fixes @ 2014-09-08 13:23 Sascha Hauer 2014-09-08 13:23 ` [PATCH 1/4] ARM: AT91: Add missing include Sascha Hauer ` (4 more replies) 0 siblings, 5 replies; 8+ messages in thread From: Sascha Hauer @ 2014-09-08 13:23 UTC (permalink / raw) To: barebox Unfortunately the transition to pinctrl for AT91 caused some damage. The 926x do not compile anymore. Even when this is fixed the boards won't work since the new pinctrl driver uses of_alias_get_id() even for the platform case to translate the device into a gpio chip. Sascha ---------------------------------------------------------------- Sascha Hauer (4): ARM: AT91: Add missing include ARM: AT91: Make gpio mux functions inline pinctrl: AT91: Only use of_alias_get_id when probed from devicetree pinctrl: AT91: use alias_idx to calculate the base gpio number arch/arm/mach-at91/at91sam926x_lowlevel_init.c | 2 +- arch/arm/mach-at91/include/mach/gpio.h | 42 ++++++++++++-------------- drivers/pinctrl/pinctrl-at91.c | 9 ++++-- 3 files changed, 27 insertions(+), 26 deletions(-) _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/4] ARM: AT91: Add missing include 2014-09-08 13:23 AT91 pinctrl/gpio fixes Sascha Hauer @ 2014-09-08 13:23 ` Sascha Hauer 2014-09-08 13:23 ` [PATCH 2/4] ARM: AT91: Make gpio mux functions inline Sascha Hauer ` (3 subsequent siblings) 4 siblings, 0 replies; 8+ messages in thread From: Sascha Hauer @ 2014-09-08 13:23 UTC (permalink / raw) To: barebox the gpio mux functions were moved to mach/gpio.h. Add the missing include. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- arch/arm/mach-at91/at91sam926x_lowlevel_init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-at91/at91sam926x_lowlevel_init.c b/arch/arm/mach-at91/at91sam926x_lowlevel_init.c index e69e4a8..59ea83e 100644 --- a/arch/arm/mach-at91/at91sam926x_lowlevel_init.c +++ b/arch/arm/mach-at91/at91sam926x_lowlevel_init.c @@ -20,6 +20,7 @@ #include <mach/at91sam9_sdramc.h> #include <mach/at91sam9_smc.h> #include <mach/at91_lowlevel_init.h> +#include <mach/gpio.h> #include <mach/io.h> #include <init.h> #include <sizes.h> -- 2.1.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/4] ARM: AT91: Make gpio mux functions inline 2014-09-08 13:23 AT91 pinctrl/gpio fixes Sascha Hauer 2014-09-08 13:23 ` [PATCH 1/4] ARM: AT91: Add missing include Sascha Hauer @ 2014-09-08 13:23 ` Sascha Hauer 2014-09-08 13:23 ` [PATCH 3/4] pinctrl: AT91: Only use of_alias_get_id when probed from devicetree Sascha Hauer ` (2 subsequent siblings) 4 siblings, 0 replies; 8+ messages in thread From: Sascha Hauer @ 2014-09-08 13:23 UTC (permalink / raw) To: barebox Otherwise we get a unused function warning each time mach/gpio.h is included. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- arch/arm/mach-at91/at91sam926x_lowlevel_init.c | 1 - arch/arm/mach-at91/include/mach/gpio.h | 42 ++++++++++++-------------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/arch/arm/mach-at91/at91sam926x_lowlevel_init.c b/arch/arm/mach-at91/at91sam926x_lowlevel_init.c index 59ea83e..6452bdd 100644 --- a/arch/arm/mach-at91/at91sam926x_lowlevel_init.c +++ b/arch/arm/mach-at91/at91sam926x_lowlevel_init.c @@ -25,7 +25,6 @@ #include <init.h> #include <sizes.h> -#define __gpio_init inline #include "gpio.h" static void inline access_sdram(void) diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h index 6a6b9cd..4e9d686 100644 --- a/arch/arm/mach-at91/include/mach/gpio.h +++ b/arch/arm/mach-at91/include/mach/gpio.h @@ -9,10 +9,6 @@ #include <asm-generic/gpio.h> -#ifndef __gpio_init -#define __gpio_init -#endif - #define MAX_NB_GPIO_PER_BANK 32 static inline unsigned pin_to_bank(unsigned pin) @@ -30,32 +26,32 @@ static inline unsigned pin_to_mask(unsigned pin) return 1 << pin_to_bank_offset(pin); } -static __gpio_init void at91_mux_disable_interrupt(void __iomem *pio, unsigned mask) +static inline void at91_mux_disable_interrupt(void __iomem *pio, unsigned mask) { __raw_writel(mask, pio + PIO_IDR); } -static __gpio_init void at91_mux_set_pullup(void __iomem *pio, unsigned mask, bool on) +static inline void at91_mux_set_pullup(void __iomem *pio, unsigned mask, bool on) { __raw_writel(mask, pio + (on ? PIO_PUER : PIO_PUDR)); } -static __gpio_init void at91_mux_set_multidrive(void __iomem *pio, unsigned mask, bool on) +static inline void at91_mux_set_multidrive(void __iomem *pio, unsigned mask, bool on) { __raw_writel(mask, pio + (on ? PIO_MDER : PIO_MDDR)); } -static __gpio_init void at91_mux_set_A_periph(void __iomem *pio, unsigned mask) +static inline void at91_mux_set_A_periph(void __iomem *pio, unsigned mask) { __raw_writel(mask, pio + PIO_ASR); } -static __gpio_init void at91_mux_set_B_periph(void __iomem *pio, unsigned mask) +static inline void at91_mux_set_B_periph(void __iomem *pio, unsigned mask) { __raw_writel(mask, pio + PIO_BSR); } -static __gpio_init void at91_mux_pio3_set_A_periph(void __iomem *pio, unsigned mask) +static inline void at91_mux_pio3_set_A_periph(void __iomem *pio, unsigned mask) { __raw_writel(__raw_readl(pio + PIO_ABCDSR1) & ~mask, @@ -64,7 +60,7 @@ static __gpio_init void at91_mux_pio3_set_A_periph(void __iomem *pio, unsigned m pio + PIO_ABCDSR2); } -static __gpio_init void at91_mux_pio3_set_B_periph(void __iomem *pio, unsigned mask) +static inline void at91_mux_pio3_set_B_periph(void __iomem *pio, unsigned mask) { __raw_writel(__raw_readl(pio + PIO_ABCDSR1) | mask, pio + PIO_ABCDSR1); @@ -72,31 +68,31 @@ static __gpio_init void at91_mux_pio3_set_B_periph(void __iomem *pio, unsigned m pio + PIO_ABCDSR2); } -static __gpio_init void at91_mux_pio3_set_C_periph(void __iomem *pio, unsigned mask) +static inline void at91_mux_pio3_set_C_periph(void __iomem *pio, unsigned mask) { __raw_writel(__raw_readl(pio + PIO_ABCDSR1) & ~mask, pio + PIO_ABCDSR1); __raw_writel(__raw_readl(pio + PIO_ABCDSR2) | mask, pio + PIO_ABCDSR2); } -static __gpio_init void at91_mux_pio3_set_D_periph(void __iomem *pio, unsigned mask) +static inline void at91_mux_pio3_set_D_periph(void __iomem *pio, unsigned mask) { __raw_writel(__raw_readl(pio + PIO_ABCDSR1) | mask, pio + PIO_ABCDSR1); __raw_writel(__raw_readl(pio + PIO_ABCDSR2) | mask, pio + PIO_ABCDSR2); } -static __gpio_init void at91_mux_set_deglitch(void __iomem *pio, unsigned mask, bool is_on) +static inline void at91_mux_set_deglitch(void __iomem *pio, unsigned mask, bool is_on) { __raw_writel(mask, pio + (is_on ? PIO_IFER : PIO_IFDR)); } -static __gpio_init void at91_mux_pio3_set_deglitch(void __iomem *pio, unsigned mask, bool is_on) +static inline void at91_mux_pio3_set_deglitch(void __iomem *pio, unsigned mask, bool is_on) { if (is_on) __raw_writel(mask, pio + PIO_IFSCDR); at91_mux_set_deglitch(pio, mask, is_on); } -static __gpio_init void at91_mux_pio3_set_debounce(void __iomem *pio, unsigned mask, +static inline void at91_mux_pio3_set_debounce(void __iomem *pio, unsigned mask, bool is_on, u32 div) { if (is_on) { @@ -108,38 +104,38 @@ static __gpio_init void at91_mux_pio3_set_debounce(void __iomem *pio, unsigned m } } -static __gpio_init void at91_mux_pio3_set_pulldown(void __iomem *pio, unsigned mask, bool is_on) +static inline void at91_mux_pio3_set_pulldown(void __iomem *pio, unsigned mask, bool is_on) { __raw_writel(mask, pio + (is_on ? PIO_PPDER : PIO_PPDDR)); } -static __gpio_init void at91_mux_pio3_disable_schmitt_trig(void __iomem *pio, unsigned mask) +static inline void at91_mux_pio3_disable_schmitt_trig(void __iomem *pio, unsigned mask) { __raw_writel(__raw_readl(pio + PIO_SCHMITT) | mask, pio + PIO_SCHMITT); } -static __gpio_init void at91_mux_gpio_disable(void __iomem *pio, unsigned mask) +static inline void at91_mux_gpio_disable(void __iomem *pio, unsigned mask) { __raw_writel(mask, pio + PIO_PDR); } -static __gpio_init void at91_mux_gpio_enable(void __iomem *pio, unsigned mask) +static inline void at91_mux_gpio_enable(void __iomem *pio, unsigned mask) { __raw_writel(mask, pio + PIO_PER); } -static __gpio_init void at91_mux_gpio_input(void __iomem *pio, unsigned mask, bool input) +static inline void at91_mux_gpio_input(void __iomem *pio, unsigned mask, bool input) { __raw_writel(mask, pio + (input ? PIO_ODR : PIO_OER)); } -static __gpio_init void at91_mux_gpio_set(void __iomem *pio, unsigned mask, +static inline void at91_mux_gpio_set(void __iomem *pio, unsigned mask, int value) { __raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR)); } -static __gpio_init int at91_mux_gpio_get(void __iomem *pio, unsigned mask) +static inline int at91_mux_gpio_get(void __iomem *pio, unsigned mask) { u32 pdsr; -- 2.1.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/4] pinctrl: AT91: Only use of_alias_get_id when probed from devicetree 2014-09-08 13:23 AT91 pinctrl/gpio fixes Sascha Hauer 2014-09-08 13:23 ` [PATCH 1/4] ARM: AT91: Add missing include Sascha Hauer 2014-09-08 13:23 ` [PATCH 2/4] ARM: AT91: Make gpio mux functions inline Sascha Hauer @ 2014-09-08 13:23 ` Sascha Hauer 2014-09-08 13:23 ` [PATCH 4/4] pinctrl: AT91: use alias_idx to calculate the base gpio number Sascha Hauer 2014-09-08 13:36 ` AT91 pinctrl/gpio fixes Raphaël Poggi 4 siblings, 0 replies; 8+ messages in thread From: Sascha Hauer @ 2014-09-08 13:23 UTC (permalink / raw) To: barebox If probed from platform data we have to use dev->id instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/pinctrl/pinctrl-at91.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index e212f7a..3c194df 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -618,10 +618,15 @@ static int at91_gpio_probe(struct device_d *dev) struct at91_gpio_chip *at91_gpio; struct clk *clk; int ret; - int alias_idx = of_alias_get_id(dev->device_node, "gpio"); + int alias_idx; BUG_ON(dev->id > MAX_GPIO_BANKS); + if (dev->device_node) + alias_idx = of_alias_get_id(dev->device_node, "gpio"); + else + alias_idx = dev->id; + at91_gpio = &gpio_chip[alias_idx]; clk = clk_get(dev, NULL); -- 2.1.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/4] pinctrl: AT91: use alias_idx to calculate the base gpio number 2014-09-08 13:23 AT91 pinctrl/gpio fixes Sascha Hauer ` (2 preceding siblings ...) 2014-09-08 13:23 ` [PATCH 3/4] pinctrl: AT91: Only use of_alias_get_id when probed from devicetree Sascha Hauer @ 2014-09-08 13:23 ` Sascha Hauer 2014-09-08 13:36 ` AT91 pinctrl/gpio fixes Raphaël Poggi 4 siblings, 0 replies; 8+ messages in thread From: Sascha Hauer @ 2014-09-08 13:23 UTC (permalink / raw) To: barebox For the devicetree case alias_idx contains the gpio bank number. dev->id has no meaning in this case. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/pinctrl/pinctrl-at91.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index 3c194df..e77c8c4 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -651,7 +651,7 @@ static int at91_gpio_probe(struct device_d *dev) at91_gpio->chip.ops = &at91_gpio_ops; at91_gpio->chip.ngpio = MAX_NB_GPIO_PER_BANK; at91_gpio->chip.dev = dev; - at91_gpio->chip.base = dev->id * MAX_NB_GPIO_PER_BANK; + at91_gpio->chip.base = alias_idx * MAX_NB_GPIO_PER_BANK; ret = gpiochip_add(&at91_gpio->chip); if (ret) { -- 2.1.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: AT91 pinctrl/gpio fixes 2014-09-08 13:23 AT91 pinctrl/gpio fixes Sascha Hauer ` (3 preceding siblings ...) 2014-09-08 13:23 ` [PATCH 4/4] pinctrl: AT91: use alias_idx to calculate the base gpio number Sascha Hauer @ 2014-09-08 13:36 ` Raphaël Poggi 2014-09-09 8:19 ` Sascha Hauer 4 siblings, 1 reply; 8+ messages in thread From: Raphaël Poggi @ 2014-09-08 13:36 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox Hello, I just send patchs, to fix all this issues. 2014-09-08 15:23 GMT+02:00 Sascha Hauer <s.hauer@pengutronix.de>: > Unfortunately the transition to pinctrl for AT91 caused some damage. > The 926x do not compile anymore. Even when this is fixed the boards > won't work since the new pinctrl driver uses of_alias_get_id() even > for the platform case to translate the device into a gpio chip. > > Sascha > > ---------------------------------------------------------------- > Sascha Hauer (4): > ARM: AT91: Add missing include > ARM: AT91: Make gpio mux functions inline > pinctrl: AT91: Only use of_alias_get_id when probed from devicetree > pinctrl: AT91: use alias_idx to calculate the base gpio number > > arch/arm/mach-at91/at91sam926x_lowlevel_init.c | 2 +- > arch/arm/mach-at91/include/mach/gpio.h | 42 ++++++++++++-------------- > drivers/pinctrl/pinctrl-at91.c | 9 ++++-- > 3 files changed, 27 insertions(+), 26 deletions(-) > > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: AT91 pinctrl/gpio fixes 2014-09-08 13:36 ` AT91 pinctrl/gpio fixes Raphaël Poggi @ 2014-09-09 8:19 ` Sascha Hauer 2014-09-09 8:47 ` Raphaël Poggi 0 siblings, 1 reply; 8+ messages in thread From: Sascha Hauer @ 2014-09-09 8:19 UTC (permalink / raw) To: Raphaël Poggi; +Cc: barebox On Mon, Sep 08, 2014 at 03:36:16PM +0200, Raphaël Poggi wrote: > Hello, I just send patchs, to fix all this issues. Not really all, there are still some compile errors in a board you don't compile test. As a result I applied a mixture of our patches to master: 5a5ba5a ARM: AT91: Make gpio mux functions inline a918dbf ARM: AT91: Add missing include 5dc6c89 pinctrl: at91: retrieve device id in non dtb probe 9c885a2 pinctrl: at91: fix the pin_to_controller function 9732308 pinctrl: at91: add driver data It now builds fine. Could you do some runtime tests to see if it also works? Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: AT91 pinctrl/gpio fixes 2014-09-09 8:19 ` Sascha Hauer @ 2014-09-09 8:47 ` Raphaël Poggi 0 siblings, 0 replies; 8+ messages in thread From: Raphaël Poggi @ 2014-09-09 8:47 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox I am only able to test with the at91sam9m10g45ek board, and the compile + pinctrl/gpio are working well, in device tree and non device tree case. I just needed to add my v2 patch for the gpio clocks registration. I'm sorry to have broken the build of the others Atmel boards. Next time I will take care of that. Thanks, Raphaël 2014-09-09 10:19 GMT+02:00 Sascha Hauer <s.hauer@pengutronix.de>: > On Mon, Sep 08, 2014 at 03:36:16PM +0200, Raphaël Poggi wrote: >> Hello, I just send patchs, to fix all this issues. > > Not really all, there are still some compile errors in a board you > don't compile test. As a result I applied a mixture of our patches > to master: > > 5a5ba5a ARM: AT91: Make gpio mux functions inline > a918dbf ARM: AT91: Add missing include > 5dc6c89 pinctrl: at91: retrieve device id in non dtb probe > 9c885a2 pinctrl: at91: fix the pin_to_controller function > 9732308 pinctrl: at91: add driver data > > It now builds fine. Could you do some runtime tests to see if it > also works? > > Sascha > > > -- > Pengutronix e.K. | | > Industrial Linux Solutions | http://www.pengutronix.de/ | > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-09-09 8:48 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-09-08 13:23 AT91 pinctrl/gpio fixes Sascha Hauer 2014-09-08 13:23 ` [PATCH 1/4] ARM: AT91: Add missing include Sascha Hauer 2014-09-08 13:23 ` [PATCH 2/4] ARM: AT91: Make gpio mux functions inline Sascha Hauer 2014-09-08 13:23 ` [PATCH 3/4] pinctrl: AT91: Only use of_alias_get_id when probed from devicetree Sascha Hauer 2014-09-08 13:23 ` [PATCH 4/4] pinctrl: AT91: use alias_idx to calculate the base gpio number Sascha Hauer 2014-09-08 13:36 ` AT91 pinctrl/gpio fixes Raphaël Poggi 2014-09-09 8:19 ` Sascha Hauer 2014-09-09 8:47 ` Raphaël Poggi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox