From b9cfddd90d03b9000f1dd969149c0d091101dcef Mon Sep 17 00:00:00 2001
From: Philipp Zabel
Date: Wed, 12 Dec 2012 13:21:44 +0100
Subject: pinctrl: imx5: fix GPIO_8 pad CAN1_RXCAN configuration
3 is an invalid value for the CAN1_IPP_IND_CANRX_SELECT_INPUT
register. Set it to 2, which correctly selects the GPIO_8 pad.
Signed-off-by: Philipp Zabel
Signed-off-by: Linus Walleij
---
drivers/pinctrl/pinctrl-imx53.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'drivers/pinctrl')
diff --git a/drivers/pinctrl/pinctrl-imx53.c b/drivers/pinctrl/pinctrl-imx53.c
index ec4048691775..af571dc3dc63 100644
--- a/drivers/pinctrl/pinctrl-imx53.c
+++ b/drivers/pinctrl/pinctrl-imx53.c
@@ -1371,7 +1371,7 @@ static struct imx_pin_reg imx53_pin_regs[] = {
IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 0, 0x7F8, 1), /* MX53_PAD_GPIO_8__ESAI1_TX5_RX0 */
IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 1, 0x000, 0), /* MX53_PAD_GPIO_8__GPIO1_8 */
IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 2, 0x000, 0), /* MX53_PAD_GPIO_8__EPIT2_EPITO */
- IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 3, 0x760, 3), /* MX53_PAD_GPIO_8__CAN1_RXCAN */
+ IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 3, 0x760, 2), /* MX53_PAD_GPIO_8__CAN1_RXCAN */
IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 4, 0x880, 5), /* MX53_PAD_GPIO_8__UART2_RXD_MUX */
IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 5, 0x000, 0), /* MX53_PAD_GPIO_8__FIRI_TXD */
IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 6, 0x000, 0), /* MX53_PAD_GPIO_8__SPDIF_SRCLK */
--
cgit v1.2.1
From c62b2b3448330ce1056d7730a01db4e19c95cfca Mon Sep 17 00:00:00 2001
From: Julia Lawall
Date: Wed, 12 Dec 2012 15:22:44 +0100
Subject: drivers/pinctrl/pinctrl-at91.c: convert kfree to devm_kfree
The function at91_dt_node_to_map is ultimately called by the function
pinctrl_get, which is an exported function. Since it is possible that this
function is not called from within a probe function, for safety, the kfree
is converted to a devm_kfree, to both free the data and remove it from the
device in a failure situation.
Acked-by: Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Julia Lawall
Signed-off-by: Linus Walleij
---
drivers/pinctrl/pinctrl-at91.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'drivers/pinctrl')
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index c5e757157183..bff54bfaff43 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -265,7 +265,7 @@ static int at91_dt_node_to_map(struct pinctrl_dev *pctldev,
/* create mux map */
parent = of_get_parent(np);
if (!parent) {
- kfree(new_map);
+ devm_kfree(pctldev->dev, new_map);
return -EINVAL;
}
new_map[0].type = PIN_MAP_TYPE_MUX_GROUP;
--
cgit v1.2.1
From b0666ba4745e35adc4e4f25e46c883cc84075ced Mon Sep 17 00:00:00 2001
From: Linus Walleij
Date: Tue, 11 Dec 2012 13:12:35 +0100
Subject: pinctrl: fix comment mistake
This variable pertains to pinctrl handles not muxes
specifically.
Signed-off-by: Linus Walleij
---
drivers/pinctrl/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'drivers/pinctrl')
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 5cdee8669ea3..59f5a965bdc4 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -700,7 +700,7 @@ static struct pinctrl *create_pinctrl(struct device *dev)
}
}
- /* Add the pinmux to the global list */
+ /* Add the pinctrl handle to the global list */
list_add_tail(&p->node, &pinctrl_list);
return p;
--
cgit v1.2.1
From fc2b04e7fbd119f4bf41b6821d2f8ce4bf9ae417 Mon Sep 17 00:00:00 2001
From: Barry Song
Date: Fri, 14 Dec 2012 17:15:59 +0800
Subject: pinctrl: sirf: enable GPIO pullup/down configuration from dts
commit 7bec207427c2efb794 remove sirfsoc_gpio_set_pull function,
this patches takes the feature back by adding sirf,pullups and
sirf,pulldowns prop in dts, and the driver will set the GPIO
pull according to the dts.
Cc: Arnd Bergmann
Signed-off-by: Barry Song
Signed-off-by: Linus Walleij
---
drivers/pinctrl/pinctrl-sirf.c | 48 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
(limited to 'drivers/pinctrl')
diff --git a/drivers/pinctrl/pinctrl-sirf.c b/drivers/pinctrl/pinctrl-sirf.c
index a4f0c5e487d5..30e1a38293a0 100644
--- a/drivers/pinctrl/pinctrl-sirf.c
+++ b/drivers/pinctrl/pinctrl-sirf.c
@@ -1663,6 +1663,44 @@ const struct irq_domain_ops sirfsoc_gpio_irq_simple_ops = {
.xlate = irq_domain_xlate_twocell,
};
+static void sirfsoc_gpio_set_pullup(const u32 *pullups)
+{
+ int i, n;
+ const unsigned long *p = (const unsigned long *)pullups;
+
+ for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) {
+ n = find_first_bit(p + i, BITS_PER_LONG);
+ while (n < BITS_PER_LONG) {
+ u32 offset = SIRFSOC_GPIO_CTRL(i, n);
+ u32 val = readl(sgpio_bank[i].chip.regs + offset);
+ val |= SIRFSOC_GPIO_CTL_PULL_MASK;
+ val |= SIRFSOC_GPIO_CTL_PULL_HIGH;
+ writel(val, sgpio_bank[i].chip.regs + offset);
+
+ n = find_next_bit(p + i, BITS_PER_LONG, n + 1);
+ }
+ }
+}
+
+static void sirfsoc_gpio_set_pulldown(const u32 *pulldowns)
+{
+ int i, n;
+ const unsigned long *p = (const unsigned long *)pulldowns;
+
+ for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) {
+ n = find_first_bit(p + i, BITS_PER_LONG);
+ while (n < BITS_PER_LONG) {
+ u32 offset = SIRFSOC_GPIO_CTRL(i, n);
+ u32 val = readl(sgpio_bank[i].chip.regs + offset);
+ val |= SIRFSOC_GPIO_CTL_PULL_MASK;
+ val &= ~SIRFSOC_GPIO_CTL_PULL_HIGH;
+ writel(val, sgpio_bank[i].chip.regs + offset);
+
+ n = find_next_bit(p + i, BITS_PER_LONG, n + 1);
+ }
+ }
+}
+
static int __devinit sirfsoc_gpio_probe(struct device_node *np)
{
int i, err = 0;
@@ -1671,6 +1709,8 @@ static int __devinit sirfsoc_gpio_probe(struct device_node *np)
struct platform_device *pdev;
bool is_marco = false;
+ u32 pullups[SIRFSOC_GPIO_NO_OF_BANKS], pulldowns[SIRFSOC_GPIO_NO_OF_BANKS];
+
pdev = of_find_device_by_node(np);
if (!pdev)
return -ENODEV;
@@ -1726,6 +1766,14 @@ static int __devinit sirfsoc_gpio_probe(struct device_node *np)
irq_set_handler_data(bank->parent_irq, bank);
}
+ if (!of_property_read_u32_array(np, "sirf,pullups", pullups,
+ SIRFSOC_GPIO_NO_OF_BANKS))
+ sirfsoc_gpio_set_pullup(pullups);
+
+ if (!of_property_read_u32_array(np, "sirf,pulldowns", pulldowns,
+ SIRFSOC_GPIO_NO_OF_BANKS))
+ sirfsoc_gpio_set_pulldown(pulldowns);
+
return 0;
out:
--
cgit v1.2.1
From 4ca075decc2bffc36ecacc59f2d943a037b46543 Mon Sep 17 00:00:00 2001
From: Fabio Baltieri
Date: Tue, 18 Dec 2012 10:12:11 +0100
Subject: pinctrl: nomadik: return if prcm_base is NULL
This patch adds a check for npct->prcm_base to make sure that the
address is not NULL before using it, as the driver was made capable of
loading even without a proper memory resource in:
f1671bf pinctrl/nomadik: make independent of prcmu driver
Also, refuses to probe without prcm_base on anything else than nomadik.
This solves the following crash, introduced during the merge window when
booting on U8500 with device tree:
pinctrl-nomadik pinctrl-db8500: No PRCM base, assume no ALT-Cx control is available
Unable to handle kernel NULL pointer dereference at virtual address 00000138
pgd = c0004000
[00000138] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 Not tainted (3.7.0-02892-g1ebaf4f #631)
PC is at nmk_pmx_enable+0x1bc/0x4d0
LR is at clk_disable+0x40/0x44
[snip]
[] (nmk_pmx_enable+0x1bc/0x4d0) from [] (pinmux_enable_setting+0x12c/0x1ec)
[] (pinmux_enable_setting+0x12c/0x1ec) from [] (pinctrl_select_state_locked+0xfc/0x134)
[] (pinctrl_select_state_locked+0xfc/0x134) from [] (pinctrl_register+0x26c/0x43c)
[] (pinctrl_register+0x26c/0x43c) from [] (nmk_pinctrl_probe+0x114/0x238)
[] (nmk_pinctrl_probe+0x114/0x238) from [] (platform_drv_probe+0x28/0x2c)
[] (platform_drv_probe+0x28/0x2c) from [] (driver_probe_device+0x84/0x21c)
[] (driver_probe_device+0x84/0x21c) from [] (__device_attach+0x50/0x54)
[] (__device_attach+0x50/0x54) from [] (bus_for_each_drv+0x54/0x9c)
[] (bus_for_each_drv+0x54/0x9c) from [] (device_attach+0x84/0x9c)
[] (device_attach+0x84/0x9c) from [] (bus_probe_device+0x94/0xb8)
[] (bus_probe_device+0x94/0xb8) from [] (device_add+0x4f0/0x5bc)
[] (device_add+0x4f0/0x5bc) from [] (of_device_add+0x40/0x48)
[] (of_device_add+0x40/0x48) from [] (of_platform_device_create_pdata+0x68/0x98)
[] (of_platform_device_create_pdata+0x68/0x98) from [] (of_platform_bus_create+0xe4/0x260)
[] (of_platform_bus_create+0xe4/0x260) from [] (of_platform_bus_create+0x130/0x260)
[] (of_platform_bus_create+0x130/0x260) from [] (of_platform_populate+0x6c/0xac)
[] (of_platform_populate+0x6c/0xac) from [] (u8500_init_machine+0x78/0x140)
[] (u8500_init_machine+0x78/0x140) from [] (customize_machine+0x24/0x30)
[] (customize_machine+0x24/0x30) from [] (do_one_initcall+0x130/0x1b0)
[] (do_one_initcall+0x130/0x1b0) from [] (kernel_init+0x138/0x2e8)
[] (kernel_init+0x138/0x2e8) from [] (ret_from_fork+0x14/0x20)
Code: 0a00001b e19400b2 e59a200c e0822000 (e592c000)
---[ end trace 1b75b31a2719ed1c ]---
note: swapper/0[1] exited with preempt_count 1
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
Signed-off-by: Fabio Baltieri
Signed-off-by: Linus Walleij
---
drivers/pinctrl/pinctrl-nomadik.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
(limited to 'drivers/pinctrl')
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c
index ef66f98e9202..015b093287a4 100644
--- a/drivers/pinctrl/pinctrl-nomadik.c
+++ b/drivers/pinctrl/pinctrl-nomadik.c
@@ -259,6 +259,9 @@ static void nmk_prcm_altcx_set_mode(struct nmk_pinctrl *npct,
const struct prcm_gpiocr_altcx_pin_desc *pin_desc;
const u16 *gpiocr_regs;
+ if (!npct->prcm_base)
+ return;
+
if (alt_num > PRCM_IDX_GPIOCR_ALTC_MAX) {
dev_err(npct->dev, "PRCM GPIOCR: alternate-C%i is invalid\n",
alt_num);
@@ -682,6 +685,9 @@ static int nmk_prcm_gpiocr_get_mode(struct pinctrl_dev *pctldev, int gpio)
const struct prcm_gpiocr_altcx_pin_desc *pin_desc;
const u16 *gpiocr_regs;
+ if (!npct->prcm_base)
+ return NMK_GPIO_ALT_C;
+
for (i = 0; i < npct->soc->npins_altcx; i++) {
if (npct->soc->altcx_pins[i].pin == gpio)
break;
@@ -1887,9 +1893,12 @@ static int __devinit nmk_pinctrl_probe(struct platform_device *pdev)
"failed to ioremap PRCM registers\n");
return -ENOMEM;
}
- } else {
+ } else if (version == PINCTRL_NMK_STN8815) {
dev_info(&pdev->dev,
"No PRCM base, assume no ALT-Cx control is available\n");
+ } else {
+ dev_err(&pdev->dev, "missing PRCM base address\n");
+ return -EINVAL;
}
/*
--
cgit v1.2.1