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>
This commit is contained in:
@@ -162,7 +162,7 @@
|
||||
#define U300_SYSCON_PMC4R_APP_MISC_16_APP_UART1_CTS 0x0100
|
||||
#define U300_SYSCON_PMC4R_APP_MISC_16_EMIF_1_STATIC_CS5_N 0x0200
|
||||
|
||||
#define DRIVER_NAME "pinmux-u300"
|
||||
#define DRIVER_NAME "pinctrl-u300"
|
||||
|
||||
/*
|
||||
* The DB3350 has 467 pads, I have enumerated the pads clockwise around the
|
||||
@@ -1053,13 +1053,16 @@ static struct pinctrl_desc u300_pmx_desc = {
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __init u300_pmx_probe(struct platform_device *pdev)
|
||||
static int __devinit u300_pmx_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct u300_pmx *upmx;
|
||||
struct resource *res;
|
||||
struct gpio_chip *gpio_chip = dev_get_platdata(&pdev->dev);
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
pr_err("U300 PMX PROBE\n");
|
||||
|
||||
/* Create state holders etc for this driver */
|
||||
upmx = devm_kzalloc(&pdev->dev, sizeof(*upmx), GFP_KERNEL);
|
||||
if (!upmx)
|
||||
@@ -1095,12 +1098,14 @@ static int __init u300_pmx_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
/* We will handle a range of GPIO pins */
|
||||
for (i = 0; i < ARRAY_SIZE(u300_gpio_ranges); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(u300_gpio_ranges); i++) {
|
||||
u300_gpio_ranges[i].gc = gpio_chip;
|
||||
pinctrl_add_gpio_range(upmx->pctl, &u300_gpio_ranges[i]);
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, upmx);
|
||||
|
||||
dev_info(&pdev->dev, "initialized U300 pinmux driver\n");
|
||||
dev_info(&pdev->dev, "initialized U300 pin control driver\n");
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1115,7 +1120,7 @@ out_no_resource:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __exit u300_pmx_remove(struct platform_device *pdev)
|
||||
static int __devexit u300_pmx_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct u300_pmx *upmx = platform_get_drvdata(pdev);
|
||||
int i;
|
||||
@@ -1136,12 +1141,13 @@ static struct platform_driver u300_pmx_driver = {
|
||||
.name = DRIVER_NAME,
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.remove = __exit_p(u300_pmx_remove),
|
||||
.probe = u300_pmx_probe,
|
||||
.remove = __devexit_p(u300_pmx_remove),
|
||||
};
|
||||
|
||||
static int __init u300_pmx_init(void)
|
||||
{
|
||||
return platform_driver_probe(&u300_pmx_driver, u300_pmx_probe);
|
||||
return platform_driver_register(&u300_pmx_driver);
|
||||
}
|
||||
arch_initcall(u300_pmx_init);
|
||||
|
||||
|
Reference in New Issue
Block a user