aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-u300.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2012-02-21 08:31:45 -0500
committerLinus Walleij <linus.walleij@linaro.org>2012-02-22 11:59:33 -0500
commit128a06d4bb997d90158e668173a6944d376c84cb (patch)
treecbfe9ed922f93fa4132d8d6db6e3a22aeb8637fa /drivers/pinctrl/pinctrl-u300.c
parent4ecce45dd663f6945bed7e2e06c05b5d90f3a2a1 (diff)
pinctrl: spawn U300 pinctrl from the COH901 GPIO
This solves the riddle on how the U300 pin controller shall be able to reference the struct gpio_chip even though these are two separate drivers: spawn the pinctrl child from the GPIO driver and pass in the struct gpio_chip as platform data. In the process we rename the U300 "pinmux-u300" to "pinctrl-u300" so as not to confuse. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-u300.c')
-rw-r--r--drivers/pinctrl/pinctrl-u300.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/pinctrl/pinctrl-u300.c b/drivers/pinctrl/pinctrl-u300.c
index c8d02f1c2b5e..fc4a281caba5 100644
--- a/drivers/pinctrl/pinctrl-u300.c
+++ b/drivers/pinctrl/pinctrl-u300.c
@@ -162,7 +162,7 @@
162#define U300_SYSCON_PMC4R_APP_MISC_16_APP_UART1_CTS 0x0100 162#define U300_SYSCON_PMC4R_APP_MISC_16_APP_UART1_CTS 0x0100
163#define U300_SYSCON_PMC4R_APP_MISC_16_EMIF_1_STATIC_CS5_N 0x0200 163#define U300_SYSCON_PMC4R_APP_MISC_16_EMIF_1_STATIC_CS5_N 0x0200
164 164
165#define DRIVER_NAME "pinmux-u300" 165#define DRIVER_NAME "pinctrl-u300"
166 166
167/* 167/*
168 * The DB3350 has 467 pads, I have enumerated the pads clockwise around the 168 * The DB3350 has 467 pads, I have enumerated the pads clockwise around the
@@ -1053,13 +1053,16 @@ static struct pinctrl_desc u300_pmx_desc = {
1053 .owner = THIS_MODULE, 1053 .owner = THIS_MODULE,
1054}; 1054};
1055 1055
1056static int __init u300_pmx_probe(struct platform_device *pdev) 1056static int __devinit u300_pmx_probe(struct platform_device *pdev)
1057{ 1057{
1058 struct u300_pmx *upmx; 1058 struct u300_pmx *upmx;
1059 struct resource *res; 1059 struct resource *res;
1060 struct gpio_chip *gpio_chip = dev_get_platdata(&pdev->dev);
1060 int ret; 1061 int ret;
1061 int i; 1062 int i;
1062 1063
1064 pr_err("U300 PMX PROBE\n");
1065
1063 /* Create state holders etc for this driver */ 1066 /* Create state holders etc for this driver */
1064 upmx = devm_kzalloc(&pdev->dev, sizeof(*upmx), GFP_KERNEL); 1067 upmx = devm_kzalloc(&pdev->dev, sizeof(*upmx), GFP_KERNEL);
1065 if (!upmx) 1068 if (!upmx)
@@ -1095,12 +1098,14 @@ static int __init u300_pmx_probe(struct platform_device *pdev)
1095 } 1098 }
1096 1099
1097 /* We will handle a range of GPIO pins */ 1100 /* We will handle a range of GPIO pins */
1098 for (i = 0; i < ARRAY_SIZE(u300_gpio_ranges); i++) 1101 for (i = 0; i < ARRAY_SIZE(u300_gpio_ranges); i++) {
1102 u300_gpio_ranges[i].gc = gpio_chip;
1099 pinctrl_add_gpio_range(upmx->pctl, &u300_gpio_ranges[i]); 1103 pinctrl_add_gpio_range(upmx->pctl, &u300_gpio_ranges[i]);
1104 }
1100 1105
1101 platform_set_drvdata(pdev, upmx); 1106 platform_set_drvdata(pdev, upmx);
1102 1107
1103 dev_info(&pdev->dev, "initialized U300 pinmux driver\n"); 1108 dev_info(&pdev->dev, "initialized U300 pin control driver\n");
1104 1109
1105 return 0; 1110 return 0;
1106 1111
@@ -1115,7 +1120,7 @@ out_no_resource:
1115 return ret; 1120 return ret;
1116} 1121}
1117 1122
1118static int __exit u300_pmx_remove(struct platform_device *pdev) 1123static int __devexit u300_pmx_remove(struct platform_device *pdev)
1119{ 1124{
1120 struct u300_pmx *upmx = platform_get_drvdata(pdev); 1125 struct u300_pmx *upmx = platform_get_drvdata(pdev);
1121 int i; 1126 int i;
@@ -1136,12 +1141,13 @@ static struct platform_driver u300_pmx_driver = {
1136 .name = DRIVER_NAME, 1141 .name = DRIVER_NAME,
1137 .owner = THIS_MODULE, 1142 .owner = THIS_MODULE,
1138 }, 1143 },
1139 .remove = __exit_p(u300_pmx_remove), 1144 .probe = u300_pmx_probe,
1145 .remove = __devexit_p(u300_pmx_remove),
1140}; 1146};
1141 1147
1142static int __init u300_pmx_init(void) 1148static int __init u300_pmx_init(void)
1143{ 1149{
1144 return platform_driver_probe(&u300_pmx_driver, u300_pmx_probe); 1150 return platform_driver_register(&u300_pmx_driver);
1145} 1151}
1146arch_initcall(u300_pmx_init); 1152arch_initcall(u300_pmx_init);
1147 1153