diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2013-11-19 17:21:04 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-11-26 15:01:58 -0500 |
commit | f4b3f523b384675d61fc05f0df2d10cdf370b827 (patch) | |
tree | 35de862978797ef52b535840fa663abcf0ad8250 | |
parent | 8d99339710ac9bd1eca8f04a356752c89dc7cf0b (diff) |
pinctrl: nomadik: decomission non-DT boot path
After the patches deleting the last board registering this
pin controller as a platform device has been deleted,
proceed to remove the non-DT boot patch and depend on
OF being available and the device to be coming up by
a DT node.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/pinctrl/pinctrl-nomadik.c | 80 |
1 files changed, 22 insertions, 58 deletions
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index 3895f1415ef9..983662e846a4 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright (C) 2008,2009 STMicroelectronics | 4 | * Copyright (C) 2008,2009 STMicroelectronics |
5 | * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it> | 5 | * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it> |
6 | * Rewritten based on work by Prafulla WADASKAR <prafulla.wadaskar@st.com> | 6 | * Rewritten based on work by Prafulla WADASKAR <prafulla.wadaskar@st.com> |
7 | * Copyright (C) 2011 Linus Walleij <linus.walleij@linaro.org> | 7 | * Copyright (C) 2011-2013 Linus Walleij <linus.walleij@linaro.org> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
@@ -1240,7 +1240,7 @@ static const struct irq_domain_ops nmk_gpio_irq_simple_ops = { | |||
1240 | 1240 | ||
1241 | static int nmk_gpio_probe(struct platform_device *dev) | 1241 | static int nmk_gpio_probe(struct platform_device *dev) |
1242 | { | 1242 | { |
1243 | struct nmk_gpio_platform_data *pdata = dev->dev.platform_data; | 1243 | struct nmk_gpio_platform_data *pdata; |
1244 | struct device_node *np = dev->dev.of_node; | 1244 | struct device_node *np = dev->dev.of_node; |
1245 | struct nmk_gpio_chip *nmk_chip; | 1245 | struct nmk_gpio_chip *nmk_chip; |
1246 | struct gpio_chip *chip; | 1246 | struct gpio_chip *chip; |
@@ -1248,32 +1248,24 @@ static int nmk_gpio_probe(struct platform_device *dev) | |||
1248 | struct clk *clk; | 1248 | struct clk *clk; |
1249 | int secondary_irq; | 1249 | int secondary_irq; |
1250 | void __iomem *base; | 1250 | void __iomem *base; |
1251 | int irq_start = 0; | ||
1252 | int irq; | 1251 | int irq; |
1253 | int ret; | 1252 | int ret; |
1254 | 1253 | ||
1255 | if (!pdata && !np) { | 1254 | pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL); |
1256 | dev_err(&dev->dev, "No platform data or device tree found\n"); | 1255 | if (!pdata) |
1257 | return -ENODEV; | 1256 | return -ENOMEM; |
1258 | } | ||
1259 | |||
1260 | if (np) { | ||
1261 | pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL); | ||
1262 | if (!pdata) | ||
1263 | return -ENOMEM; | ||
1264 | |||
1265 | if (of_get_property(np, "st,supports-sleepmode", NULL)) | ||
1266 | pdata->supports_sleepmode = true; | ||
1267 | 1257 | ||
1268 | if (of_property_read_u32(np, "gpio-bank", &dev->id)) { | 1258 | if (of_get_property(np, "st,supports-sleepmode", NULL)) |
1269 | dev_err(&dev->dev, "gpio-bank property not found\n"); | 1259 | pdata->supports_sleepmode = true; |
1270 | return -EINVAL; | ||
1271 | } | ||
1272 | 1260 | ||
1273 | pdata->first_gpio = dev->id * NMK_GPIO_PER_CHIP; | 1261 | if (of_property_read_u32(np, "gpio-bank", &dev->id)) { |
1274 | pdata->num_gpio = NMK_GPIO_PER_CHIP; | 1262 | dev_err(&dev->dev, "gpio-bank property not found\n"); |
1263 | return -EINVAL; | ||
1275 | } | 1264 | } |
1276 | 1265 | ||
1266 | pdata->first_gpio = dev->id * NMK_GPIO_PER_CHIP; | ||
1267 | pdata->num_gpio = NMK_GPIO_PER_CHIP; | ||
1268 | |||
1277 | irq = platform_get_irq(dev, 0); | 1269 | irq = platform_get_irq(dev, 0); |
1278 | if (irq < 0) | 1270 | if (irq < 0) |
1279 | return irq; | 1271 | return irq; |
@@ -1321,10 +1313,7 @@ static int nmk_gpio_probe(struct platform_device *dev) | |||
1321 | clk_enable(nmk_chip->clk); | 1313 | clk_enable(nmk_chip->clk); |
1322 | nmk_chip->lowemi = readl_relaxed(nmk_chip->addr + NMK_GPIO_LOWEMI); | 1314 | nmk_chip->lowemi = readl_relaxed(nmk_chip->addr + NMK_GPIO_LOWEMI); |
1323 | clk_disable(nmk_chip->clk); | 1315 | clk_disable(nmk_chip->clk); |
1324 | |||
1325 | #ifdef CONFIG_OF_GPIO | ||
1326 | chip->of_node = np; | 1316 | chip->of_node = np; |
1327 | #endif | ||
1328 | 1317 | ||
1329 | ret = gpiochip_add(&nmk_chip->chip); | 1318 | ret = gpiochip_add(&nmk_chip->chip); |
1330 | if (ret) | 1319 | if (ret) |
@@ -1336,10 +1325,8 @@ static int nmk_gpio_probe(struct platform_device *dev) | |||
1336 | 1325 | ||
1337 | platform_set_drvdata(dev, nmk_chip); | 1326 | platform_set_drvdata(dev, nmk_chip); |
1338 | 1327 | ||
1339 | if (!np) | ||
1340 | irq_start = pdata->first_irq; | ||
1341 | nmk_chip->domain = irq_domain_add_simple(np, | 1328 | nmk_chip->domain = irq_domain_add_simple(np, |
1342 | NMK_GPIO_PER_CHIP, irq_start, | 1329 | NMK_GPIO_PER_CHIP, 0, |
1343 | &nmk_gpio_irq_simple_ops, nmk_chip); | 1330 | &nmk_gpio_irq_simple_ops, nmk_chip); |
1344 | if (!nmk_chip->domain) { | 1331 | if (!nmk_chip->domain) { |
1345 | dev_err(&dev->dev, "failed to create irqdomain\n"); | 1332 | dev_err(&dev->dev, "failed to create irqdomain\n"); |
@@ -2072,11 +2059,10 @@ static int nmk_pinctrl_resume(struct platform_device *pdev) | |||
2072 | 2059 | ||
2073 | static int nmk_pinctrl_probe(struct platform_device *pdev) | 2060 | static int nmk_pinctrl_probe(struct platform_device *pdev) |
2074 | { | 2061 | { |
2075 | const struct platform_device_id *platid = platform_get_device_id(pdev); | 2062 | const struct of_device_id *match; |
2076 | struct device_node *np = pdev->dev.of_node; | 2063 | struct device_node *np = pdev->dev.of_node; |
2077 | struct device_node *prcm_np; | 2064 | struct device_node *prcm_np; |
2078 | struct nmk_pinctrl *npct; | 2065 | struct nmk_pinctrl *npct; |
2079 | struct resource *res; | ||
2080 | unsigned int version = 0; | 2066 | unsigned int version = 0; |
2081 | int i; | 2067 | int i; |
2082 | 2068 | ||
@@ -2084,16 +2070,10 @@ static int nmk_pinctrl_probe(struct platform_device *pdev) | |||
2084 | if (!npct) | 2070 | if (!npct) |
2085 | return -ENOMEM; | 2071 | return -ENOMEM; |
2086 | 2072 | ||
2087 | if (platid) | 2073 | match = of_match_device(nmk_pinctrl_match, &pdev->dev); |
2088 | version = platid->driver_data; | 2074 | if (!match) |
2089 | else if (np) { | 2075 | return -ENODEV; |
2090 | const struct of_device_id *match; | 2076 | version = (unsigned int) match->data; |
2091 | |||
2092 | match = of_match_device(nmk_pinctrl_match, &pdev->dev); | ||
2093 | if (!match) | ||
2094 | return -ENODEV; | ||
2095 | version = (unsigned int) match->data; | ||
2096 | } | ||
2097 | 2077 | ||
2098 | /* Poke in other ASIC variants here */ | 2078 | /* Poke in other ASIC variants here */ |
2099 | if (version == PINCTRL_NMK_STN8815) | 2079 | if (version == PINCTRL_NMK_STN8815) |
@@ -2103,17 +2083,9 @@ static int nmk_pinctrl_probe(struct platform_device *pdev) | |||
2103 | if (version == PINCTRL_NMK_DB8540) | 2083 | if (version == PINCTRL_NMK_DB8540) |
2104 | nmk_pinctrl_db8540_init(&npct->soc); | 2084 | nmk_pinctrl_db8540_init(&npct->soc); |
2105 | 2085 | ||
2106 | if (np) { | 2086 | prcm_np = of_parse_phandle(np, "prcm", 0); |
2107 | prcm_np = of_parse_phandle(np, "prcm", 0); | 2087 | if (prcm_np) |
2108 | if (prcm_np) | 2088 | npct->prcm_base = of_iomap(prcm_np, 0); |
2109 | npct->prcm_base = of_iomap(prcm_np, 0); | ||
2110 | } | ||
2111 | |||
2112 | /* Allow platform passed information to over-write DT. */ | ||
2113 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
2114 | if (res) | ||
2115 | npct->prcm_base = devm_ioremap(&pdev->dev, res->start, | ||
2116 | resource_size(res)); | ||
2117 | if (!npct->prcm_base) { | 2089 | if (!npct->prcm_base) { |
2118 | if (version == PINCTRL_NMK_STN8815) { | 2090 | if (version == PINCTRL_NMK_STN8815) { |
2119 | dev_info(&pdev->dev, | 2091 | dev_info(&pdev->dev, |
@@ -2172,13 +2144,6 @@ static struct platform_driver nmk_gpio_driver = { | |||
2172 | .probe = nmk_gpio_probe, | 2144 | .probe = nmk_gpio_probe, |
2173 | }; | 2145 | }; |
2174 | 2146 | ||
2175 | static const struct platform_device_id nmk_pinctrl_id[] = { | ||
2176 | { "pinctrl-stn8815", PINCTRL_NMK_STN8815 }, | ||
2177 | { "pinctrl-db8500", PINCTRL_NMK_DB8500 }, | ||
2178 | { "pinctrl-db8540", PINCTRL_NMK_DB8540 }, | ||
2179 | { } | ||
2180 | }; | ||
2181 | |||
2182 | static struct platform_driver nmk_pinctrl_driver = { | 2147 | static struct platform_driver nmk_pinctrl_driver = { |
2183 | .driver = { | 2148 | .driver = { |
2184 | .owner = THIS_MODULE, | 2149 | .owner = THIS_MODULE, |
@@ -2186,7 +2151,6 @@ static struct platform_driver nmk_pinctrl_driver = { | |||
2186 | .of_match_table = nmk_pinctrl_match, | 2151 | .of_match_table = nmk_pinctrl_match, |
2187 | }, | 2152 | }, |
2188 | .probe = nmk_pinctrl_probe, | 2153 | .probe = nmk_pinctrl_probe, |
2189 | .id_table = nmk_pinctrl_id, | ||
2190 | #ifdef CONFIG_PM | 2154 | #ifdef CONFIG_PM |
2191 | .suspend = nmk_pinctrl_suspend, | 2155 | .suspend = nmk_pinctrl_suspend, |
2192 | .resume = nmk_pinctrl_resume, | 2156 | .resume = nmk_pinctrl_resume, |