aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-05-08 09:29:08 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-05-14 07:07:49 -0400
commit86c976e43da417e341bee30ee734b89743ebe7e8 (patch)
treec6f0992e28b61a08d4936882cd037d32066b48bf /drivers/pinctrl
parent2fcad12eb4d80b174c69bfbc34d1c094ad37e1bd (diff)
pinctrl: abx500: Rejiggle platform data and DT initialisation
Platform Data is invariably populated for this driver, even when booting with Device Tree. Thus the Device Tree probing code encased within the first check for Platform Data will never executed, causing the driver to fail when DT is enabled. This patch fixes the aforementioned regression by rejigging the probe() semantics to attempt to extract a platform ID from Device Tree if one can not be sourced from platform data. A pointer to GPIO platform data is always passed to the driver now, so there's little point in checking for 'pdata' and executing the DT case if it's not there. The difference between booting with DT and !DT is when booting with DT, plat_id is not populated. Thus, in the DT case we have to use a DT match table in order to find out which platform we're executing on. So, we're changing the semantics here to only use the match table if no plat_id is supplied though platform data. Signed-off-by: Lee Jones <lee.jones@linaro.org> [edited commit message] Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/pinctrl-abx500.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c
index 2a2a9df90bba..6d4532702f80 100644
--- a/drivers/pinctrl/pinctrl-abx500.c
+++ b/drivers/pinctrl/pinctrl-abx500.c
@@ -851,23 +851,12 @@ static int abx500_gpio_probe(struct platform_device *pdev)
851 851
852 if (abx500_pdata) 852 if (abx500_pdata)
853 pdata = abx500_pdata->gpio; 853 pdata = abx500_pdata->gpio;
854 if (!pdata) {
855 if (np) {
856 const struct of_device_id *match;
857 854
858 match = of_match_device(abx500_gpio_match, &pdev->dev); 855 if (!(pdata || np)) {
859 if (!match) 856 dev_err(&pdev->dev, "gpio dt and platform data missing\n");
860 return -ENODEV; 857 return -ENODEV;
861 id = (unsigned long)match->data;
862 } else {
863 dev_err(&pdev->dev, "gpio dt and platform data missing\n");
864 return -ENODEV;
865 }
866 } 858 }
867 859
868 if (platid)
869 id = platid->driver_data;
870
871 pct = devm_kzalloc(&pdev->dev, sizeof(struct abx500_pinctrl), 860 pct = devm_kzalloc(&pdev->dev, sizeof(struct abx500_pinctrl),
872 GFP_KERNEL); 861 GFP_KERNEL);
873 if (pct == NULL) { 862 if (pct == NULL) {
@@ -882,6 +871,16 @@ static int abx500_gpio_probe(struct platform_device *pdev)
882 pct->chip.dev = &pdev->dev; 871 pct->chip.dev = &pdev->dev;
883 pct->chip.base = (np) ? -1 : pdata->gpio_base; 872 pct->chip.base = (np) ? -1 : pdata->gpio_base;
884 873
874 if (platid)
875 id = platid->driver_data;
876 else if (np) {
877 const struct of_device_id *match;
878
879 match = of_match_device(abx500_gpio_match, &pdev->dev);
880 if (match)
881 id = (unsigned long)match->data;
882 }
883
885 /* initialize the lock */ 884 /* initialize the lock */
886 mutex_init(&pct->lock); 885 mutex_init(&pct->lock);
887 886