aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-01-11 10:45:29 -0500
committerLinus Walleij <linus.walleij@linaro.org>2013-01-18 15:00:56 -0500
commit32e67eee670e1254ee5ab41e2f454680acb9c17c (patch)
treece84eeeb8458c86460c026537c5de521f1eab7de /drivers/pinctrl
parent8979cfef26a74f0df154d4e991bdafb4105af8f1 (diff)
pinctrl: nomadik: Allow prcm_base to be extracted from Device Tree
The Nomadik Pinctrl driver requires access to some PRCMU registers in order to run with full functionality. When Device Tree is disabled the required PRCMU base address is passed in via platform data, so in order for Device Tree booting to be as functional, we need a similar mechanism to fetch it from Device Tree. The new semantics goes like this: Parse the Device Tree and look for the PRCMU node using a provided Phandle. Obtain the ioremaped address from that node. If one was supplied via platform data over-write it with anything found in Device Tree. Fail if either the prcm_base can't be found if we're running on anything other than an STN8815 ASIC. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/pinctrl-nomadik.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c
index ec3a5742e413..b885c0911e83 100644
--- a/drivers/pinctrl/pinctrl-nomadik.c
+++ b/drivers/pinctrl/pinctrl-nomadik.c
@@ -25,6 +25,7 @@
25#include <linux/irqdomain.h> 25#include <linux/irqdomain.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/of_device.h> 27#include <linux/of_device.h>
28#include <linux/of_address.h>
28#include <linux/pinctrl/machine.h> 29#include <linux/pinctrl/machine.h>
29#include <linux/pinctrl/pinctrl.h> 30#include <linux/pinctrl/pinctrl.h>
30#include <linux/pinctrl/pinmux.h> 31#include <linux/pinctrl/pinmux.h>
@@ -2135,6 +2136,7 @@ static int nmk_pinctrl_probe(struct platform_device *pdev)
2135{ 2136{
2136 const struct platform_device_id *platid = platform_get_device_id(pdev); 2137 const struct platform_device_id *platid = platform_get_device_id(pdev);
2137 struct device_node *np = pdev->dev.of_node; 2138 struct device_node *np = pdev->dev.of_node;
2139 struct device_node *prcm_np;
2138 struct nmk_pinctrl *npct; 2140 struct nmk_pinctrl *npct;
2139 struct resource *res; 2141 struct resource *res;
2140 unsigned int version = 0; 2142 unsigned int version = 0;
@@ -2163,21 +2165,26 @@ static int nmk_pinctrl_probe(struct platform_device *pdev)
2163 if (version == PINCTRL_NMK_DB8540) 2165 if (version == PINCTRL_NMK_DB8540)
2164 nmk_pinctrl_db8540_init(&npct->soc); 2166 nmk_pinctrl_db8540_init(&npct->soc);
2165 2167
2168 if (np) {
2169 prcm_np = of_parse_phandle(np, "prcm", 0);
2170 if (prcm_np)
2171 npct->prcm_base = of_iomap(prcm_np, 0);
2172 }
2173
2174 /* Allow platform passed information to over-write DT. */
2166 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2175 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2167 if (res) { 2176 if (res)
2168 npct->prcm_base = devm_ioremap(&pdev->dev, res->start, 2177 npct->prcm_base = devm_ioremap(&pdev->dev, res->start,
2169 resource_size(res)); 2178 resource_size(res));
2170 if (!npct->prcm_base) { 2179 if (!npct->prcm_base) {
2171 dev_err(&pdev->dev, 2180 if (version == PINCTRL_NMK_STN8815) {
2172 "failed to ioremap PRCM registers\n"); 2181 dev_info(&pdev->dev,
2173 return -ENOMEM; 2182 "No PRCM base, "
2183 "assuming no ALT-Cx control is available\n");
2184 } else {
2185 dev_err(&pdev->dev, "missing PRCM base address\n");
2186 return -EINVAL;
2174 } 2187 }
2175 } else if (version == PINCTRL_NMK_STN8815) {
2176 dev_info(&pdev->dev,
2177 "No PRCM base, assume no ALT-Cx control is available\n");
2178 } else {
2179 dev_err(&pdev->dev, "missing PRCM base address\n");
2180 return -EINVAL;
2181 } 2188 }
2182 2189
2183 /* 2190 /*