pinctrl-sunxi: various fixes
Subsystems (2)
PATCH 1/4 pinctrl-sunxi: various fixes
Hi Linus,
Here are 4 fixes for pinctrl-sunxi, the first one was send a long time ago, but somehow never managed to find its way into 3.14-rc3. An identical patch to the second one was already send by Chen-Yu Tsai, we both came up with the same fix separately, it is included merely for completeness. Patches 3 and 4 are new and should speak for themselves.
I believe all of this is stable material. I've neglected to add a CC: stable myself, if you agree this is stable material please do so.
Thanks & Regards,
Hans
PATCH 1/4 pinctrl-sunxi: Fix sun5i-a13 port F multiplexing
The correct value for selecting the mmc0 function on port F pins is 2 not 4, as per the data-sheet:
http://dl.linux-sunxi.org/A13/A13%20Datasheet%20-%20v1.12%20%282012-03-29%29.pdf
--- drivers/pinctrl/pinctrl-sunxi-pins.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/pinctrl/pinctrl-sunxi-pins.h +6 -6
@@ -1932,27 +1932,27 @@ static const struct sunxi_desc_pin sun5i_a13_pins[] = {SUNXI_PIN (SUNXI_PINCTRL_PIN_PF0 ,SUNXI_FUNCTION (0x0 ,"gpio_in" ),SUNXI_FUNCTION (0x1 ,"gpio_out" ), -SUNXI_FUNCTION (0x4 ,"mmc0" )),/* D1 */ +SUNXI_FUNCTION (0x2 ,"mmc0" )),/* D1 */ SUNXI_PIN (SUNXI_PINCTRL_PIN_PF1 ,SUNXI_FUNCTION (0x0 ,"gpio_in" ),SUNXI_FUNCTION (0x1 ,"gpio_out" ), -SUNXI_FUNCTION (0x4 ,"mmc0" )),/* D0 */ +SUNXI_FUNCTION (0x2 ,"mmc0" )),/* D0 */ SUNXI_PIN (SUNXI_PINCTRL_PIN_PF2 ,SUNXI_FUNCTION (0x0 ,"gpio_in" ),SUNXI_FUNCTION (0x1 ,"gpio_out" ), -SUNXI_FUNCTION (0x4 ,"mmc0" )),/* CLK */ +SUNXI_FUNCTION (0x2 ,"mmc0" )),/* CLK */ SUNXI_PIN (SUNXI_PINCTRL_PIN_PF3 ,SUNXI_FUNCTION (0x0 ,"gpio_in" ),SUNXI_FUNCTION (0x1 ,"gpio_out" ), -SUNXI_FUNCTION (0x4 ,"mmc0" )),/* CMD */ +SUNXI_FUNCTION (0x2 ,"mmc0" )),/* CMD */ SUNXI_PIN (SUNXI_PINCTRL_PIN_PF4 ,SUNXI_FUNCTION (0x0 ,"gpio_in" ),SUNXI_FUNCTION (0x1 ,"gpio_out" ), -SUNXI_FUNCTION (0x4 ,"mmc0" )),/* D3 */ +SUNXI_FUNCTION (0x2 ,"mmc0" )),/* D3 */ SUNXI_PIN (SUNXI_PINCTRL_PIN_PF5 ,SUNXI_FUNCTION (0x0 ,"gpio_in" ),SUNXI_FUNCTION (0x1 ,"gpio_out" ), -SUNXI_FUNCTION (0x4 ,"mmc0" )),/* D2 */ +SUNXI_FUNCTION (0x2 ,"mmc0" )),/* D2 */ /* Hole */ SUNXI_PIN(SUNXI_PINCTRL_PIN_PG0, SUNXI_FUNCTION(0x0, "gpio_in"),
Signature · 1 line
1.8.5.3
PATCH 1/4 pinctrl-sunxi: Fix sun5i-a13 port F multiplexing
Quoted 6 lines · Hans de Goede
The correct value for selecting the mmc0 function on port F pins is 2 not 4, as per the data-sheet:
http://dl.linux-sunxi.org/A13/A13%20Datasheet%20-%20v1.12%20%282012-03-29%29.pdfSigned-off-by Hans de Goede <[email protected]>Acked-by Maxime Ripard <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 2/4 pinctrl-sunxi: Fix hang on gpio irq
In reply to Hans de GoedeOur irq handler was missing chained_irq_enter / exit calls, causing a hard hang as soon as a gpio irq happened.
--- drivers/pinctrl/pinctrl-sunxi.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/pinctrl/pinctrl-sunxi.c +5 -0
@@ -13,6 +13,7 @@#include <linux/io.h> #include <linux/clk.h> #include <linux/gpio.h> +#include <linux/irqchip/chained_irq.h> #include <linux/irqdomain.h> #include <linux/module.h> #include <linux/of.h>
@@ -665,9 +666,12 @@ static struct irq_chip sunxi_pinctrl_irq_chip = {static void sunxi_pinctrl_irq_handler (unsigned irq,struct irq_desc *desc) { +struct irq_chip *chip =irq_get_chip (irq);struct sunxi_pinctrl *pctl =irq_get_handler_data (irq);const unsigned long reg =readl (pctl->membase +IRQ_STATUS_REG ); +chained_irq_enter (chip, desc); +/* Clear all interrupts */ writel (reg, pctl->membase +IRQ_STATUS_REG );
@@ -679,6 +683,7 @@ static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc)generic_handle_irq (pin_irq); } } +chained_irq_exit (chip, desc); }static struct of_device_id sunxi_pinctrl_match[] = {
Signature · 1 line
1.8.5.3
PATCH 2/4 pinctrl-sunxi: Fix hang on gpio irq
Quoted 4 lines · Hans de Goede
Our irq handler was missing
chained_irq_enter/ exit calls, causing a hard hang as soon as a gpio irq happened.Signed-off-by Hans de Goede <[email protected]>
I have already applied the identical patch from
Chen-Yu Tsai for fixes so dropping this.
Yours,
Linus Walleij
PATCH 3/4 pinctrl-sunxi: Fix masking when setting irq type
In reply to Hans de Goede--- drivers/pinctrl/pinctrl-sunxi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-sunxi.c +1 -1
@@ -583,7 +583,7 @@ static int sunxi_pinctrl_irq_set_type(struct irq_data *d,spin_lock_irqsave (&pctl->lock, flags); regval =readl (pctl->membase + reg); - regval &= ~IRQ_CFG_IRQ_MASK ; + regval &= ~(IRQ_CFG_IRQ_MASK << index);writel (regval | (mode << index), pctl->membase + reg);spin_unlock_irqrestore (&pctl->lock, flags);
Signature · 1 line
1.8.5.3
PATCH 3/4 pinctrl-sunxi: Fix masking when setting irq type
Hi,
Quoted 1 line · Hans de Goede
Signed-off-by Hans de Goede <[email protected]>
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140218/3e77537a/attachment.sig>
PATCH 3/4 pinctrl-sunxi: Fix masking when setting irq type
In reply to Hans de GoedeQuoted 1 line · Hans de Goede
Signed-off-by Hans de Goede <[email protected]>
Patch applied with Maxime's ACK.
Yours,
Linus Walleij
PATCH 4/4 pinctrl-sunxi: Fix interrupt register offset calculation
In reply to Hans de GoedeThis fixing setting the interrupt type for eints >= 8.
--- drivers/pinctrl/pinctrl-sunxi.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-sunxi.h +3 -3
@@ -511,7 +511,7 @@ static inline u32 sunxi_pull_offset(u16 pin)static inline u32 sunxi_irq_cfg_reg (u16 irq) { -u8 reg = irq /IRQ_CFG_IRQ_PER_REG ; +u8 reg = irq /IRQ_CFG_IRQ_PER_REG *0x04 ;return reg +IRQ_CFG_REG ; }
@@ -523,7 +523,7 @@ static inline u32 sunxi_irq_cfg_offset(u16 irq)static inline u32 sunxi_irq_ctrl_reg (u16 irq) { -u8 reg = irq /IRQ_CTRL_IRQ_PER_REG ; +u8 reg = irq /IRQ_CTRL_IRQ_PER_REG *0x04 ;return reg +IRQ_CTRL_REG ; }
@@ -535,7 +535,7 @@ static inline u32 sunxi_irq_ctrl_offset(u16 irq)static inline u32 sunxi_irq_status_reg (u16 irq) { -u8 reg = irq /IRQ_STATUS_IRQ_PER_REG ; +u8 reg = irq /IRQ_STATUS_IRQ_PER_REG *0x04 ;return reg +IRQ_STATUS_REG ; }
Signature · 1 line
1.8.5.3
PATCH 4/4 pinctrl-sunxi: Fix interrupt register offset calculation
Quoted 3 lines · Hans de Goede
This fixing setting the interrupt type for eints >= 8.
Signed-off-by Hans de Goede <[email protected]>
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140218/f4608c70/attachment.sig>
PATCH 4/4 pinctrl-sunxi: Fix interrupt register offset calculation
In reply to Hans de GoedeQuoted 3 lines · Hans de Goede
This fixing setting the interrupt type for eints >= 8.
Signed-off-by Hans de Goede <[email protected]>
Patch applied with Maxime's ACK.
Yours,
Linus Walleij