aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2011-11-16 04:23:05 -0500
committerLinus Walleij <linus.walleij@linaro.org>2012-01-03 03:10:04 -0500
commitf812f0f53e5643c06b929ce3299cbaffb307c488 (patch)
tree964d740bb4e04e1a54433b29f858f6ab91602c1c /drivers/pinctrl
parentca402d37dccf2b797440c5f03bd0db16f977acc9 (diff)
pinctrl: u300-pinmux: register proper GPIO ranges
This register the actual GPIO ranges used by the COH901XXX GPIO driver. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/pinmux-u300.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/drivers/pinctrl/pinmux-u300.c b/drivers/pinctrl/pinmux-u300.c
index bcf61bee7763..7e89b367a7e5 100644
--- a/drivers/pinctrl/pinmux-u300.c
+++ b/drivers/pinctrl/pinmux-u300.c
@@ -1019,15 +1019,29 @@ static struct pinmux_ops u300_pmx_ops = {
1019}; 1019};
1020 1020
1021/* 1021/*
1022 * FIXME: this will be set to sane values as this driver engulfs 1022 * GPIO ranges handled by the application-side COH901XXX GPIO controller
1023 * drivers/gpio/gpio-u300.c and we really know this stuff. 1023 * Very many pins can be converted into GPIO pins, but we only list those
1024 * that are useful in practice to cut down on tables.
1024 */ 1025 */
1025static struct pinctrl_gpio_range u300_gpio_range = { 1026#define U300_GPIO_RANGE(a, b, c) { .name = "COH901XXX", .id = a, .base= a, \
1026 .name = "COH901*", 1027 .pin_base = b, .npins = c }
1027 .id = 0, 1028
1028 .base = 0, 1029static struct pinctrl_gpio_range u300_gpio_ranges[] = {
1029 .pin_base = 0, 1030 U300_GPIO_RANGE(10, 426, 1),
1030 .npins = 64, 1031 U300_GPIO_RANGE(11, 180, 1),
1032 U300_GPIO_RANGE(12, 165, 1), /* MS/MMC card insertion */
1033 U300_GPIO_RANGE(13, 179, 1),
1034 U300_GPIO_RANGE(14, 178, 1),
1035 U300_GPIO_RANGE(16, 194, 1),
1036 U300_GPIO_RANGE(17, 193, 1),
1037 U300_GPIO_RANGE(18, 192, 1),
1038 U300_GPIO_RANGE(19, 191, 1),
1039 U300_GPIO_RANGE(20, 186, 1),
1040 U300_GPIO_RANGE(21, 185, 1),
1041 U300_GPIO_RANGE(22, 184, 1),
1042 U300_GPIO_RANGE(23, 183, 1),
1043 U300_GPIO_RANGE(24, 182, 1),
1044 U300_GPIO_RANGE(25, 181, 1),
1031}; 1045};
1032 1046
1033static struct pinctrl_desc u300_pmx_desc = { 1047static struct pinctrl_desc u300_pmx_desc = {
@@ -1042,9 +1056,10 @@ static struct pinctrl_desc u300_pmx_desc = {
1042 1056
1043static int __init u300_pmx_probe(struct platform_device *pdev) 1057static int __init u300_pmx_probe(struct platform_device *pdev)
1044{ 1058{
1045 int ret;
1046 struct u300_pmx *upmx; 1059 struct u300_pmx *upmx;
1047 struct resource *res; 1060 struct resource *res;
1061 int ret;
1062 int i;
1048 1063
1049 /* Create state holders etc for this driver */ 1064 /* Create state holders etc for this driver */
1050 upmx = devm_kzalloc(&pdev->dev, sizeof(*upmx), GFP_KERNEL); 1065 upmx = devm_kzalloc(&pdev->dev, sizeof(*upmx), GFP_KERNEL);
@@ -1081,7 +1096,8 @@ static int __init u300_pmx_probe(struct platform_device *pdev)
1081 } 1096 }
1082 1097
1083 /* We will handle a range of GPIO pins */ 1098 /* We will handle a range of GPIO pins */
1084 pinctrl_add_gpio_range(upmx->pctl, &u300_gpio_range); 1099 for (i = 0; i < ARRAY_SIZE(u300_gpio_ranges); i++)
1100 pinctrl_add_gpio_range(upmx->pctl, &u300_gpio_ranges[i]);
1085 1101
1086 platform_set_drvdata(pdev, upmx); 1102 platform_set_drvdata(pdev, upmx);
1087 1103
@@ -1103,8 +1119,10 @@ out_no_resource:
1103static int __exit u300_pmx_remove(struct platform_device *pdev) 1119static int __exit u300_pmx_remove(struct platform_device *pdev)
1104{ 1120{
1105 struct u300_pmx *upmx = platform_get_drvdata(pdev); 1121 struct u300_pmx *upmx = platform_get_drvdata(pdev);
1122 int i;
1106 1123
1107 pinctrl_remove_gpio_range(upmx->pctl, &u300_gpio_range); 1124 for (i = 0; i < ARRAY_SIZE(u300_gpio_ranges); i++)
1125 pinctrl_remove_gpio_range(upmx->pctl, &u300_gpio_ranges[i]);
1108 pinctrl_unregister(upmx->pctl); 1126 pinctrl_unregister(upmx->pctl);
1109 iounmap(upmx->virtbase); 1127 iounmap(upmx->virtbase);
1110 release_mem_region(upmx->phybase, upmx->physize); 1128 release_mem_region(upmx->phybase, upmx->physize);