aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2012-07-06 06:46:23 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-07-08 18:16:14 -0400
commit3a8e39c9f475dd061d1bbb7bf3b819f601df33e5 (patch)
treed465450ddb2ec4bed426415408be71f74266a33a
parentb8748096111b483de8a544cc220510dff17bbff9 (diff)
ARM: ux500: Register the AB8500 from DB8500 MFD
As the AB8500 is a subordinate MFD device to the DB8500-PRCMU, for consistency and a better 1:1 depiction of how the hardware is laid out, it is a good idea to register it in the same way as we do for the other MFD child devices. In order for us to do this successfully we have to pass AB8500's platform data when registering the DB8500-PRCMU from platform code. Also solves this issue: WARNING: at fs/sysfs/dir.c:526 sysfs_add_one+0x88/0xb0() sysfs: cannot create duplicate filename '/bus/platform/devices/ab8500-core.0' Reported-by: Linus Walleij <linus.walleij@linaro.org> Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--arch/arm/mach-ux500/board-mop500.c27
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c7
-rw-r--r--arch/arm/mach-ux500/include/mach/setup.h3
-rw-r--r--drivers/mfd/db8500-prcmu.c10
4 files changed, 19 insertions, 28 deletions
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 6224400a9d47..833903e428a8 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -197,24 +197,6 @@ static struct ab8500_platform_data ab8500_platdata = {
197 .gpio = &ab8500_gpio_pdata, 197 .gpio = &ab8500_gpio_pdata,
198}; 198};
199 199
200static struct resource ab8500_resources[] = {
201 [0] = {
202 .start = IRQ_DB8500_AB8500,
203 .end = IRQ_DB8500_AB8500,
204 .flags = IORESOURCE_IRQ
205 }
206};
207
208struct platform_device ab8500_device = {
209 .name = "ab8500-core",
210 .id = 0,
211 .dev = {
212 .platform_data = &ab8500_platdata,
213 },
214 .num_resources = 1,
215 .resource = ab8500_resources,
216};
217
218/* 200/*
219 * TPS61052 201 * TPS61052
220 */ 202 */
@@ -460,7 +442,6 @@ static struct hash_platform_data u8500_hash1_platform_data = {
460/* add any platform devices here - TODO */ 442/* add any platform devices here - TODO */
461static struct platform_device *mop500_platform_devs[] __initdata = { 443static struct platform_device *mop500_platform_devs[] __initdata = {
462 &mop500_gpio_keys_device, 444 &mop500_gpio_keys_device,
463 &ab8500_device,
464}; 445};
465 446
466#ifdef CONFIG_STE_DMA40 447#ifdef CONFIG_STE_DMA40
@@ -622,7 +603,6 @@ static struct platform_device *snowball_platform_devs[] __initdata = {
622 &snowball_led_dev, 603 &snowball_led_dev,
623 &snowball_key_dev, 604 &snowball_key_dev,
624 &snowball_sbnet_dev, 605 &snowball_sbnet_dev,
625 &ab8500_device,
626}; 606};
627 607
628static struct platform_device *snowball_of_platform_devs[] __initdata = { 608static struct platform_device *snowball_of_platform_devs[] __initdata = {
@@ -639,9 +619,8 @@ static void __init mop500_init_machine(void)
639 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; 619 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
640 620
641 mop500_pinmaps_init(); 621 mop500_pinmaps_init();
642 parent = u8500_init_devices(); 622 parent = u8500_init_devices(&ab8500_platdata);
643 623
644 /* FIXME: parent of ab8500 should be prcmu */
645 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++) 624 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
646 mop500_platform_devs[i]->dev.parent = parent; 625 mop500_platform_devs[i]->dev.parent = parent;
647 626
@@ -674,7 +653,7 @@ static void __init snowball_init_machine(void)
674 int i; 653 int i;
675 654
676 snowball_pinmaps_init(); 655 snowball_pinmaps_init();
677 parent = u8500_init_devices(); 656 parent = u8500_init_devices(&ab8500_platdata);
678 657
679 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++) 658 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
680 snowball_platform_devs[i]->dev.parent = parent; 659 snowball_platform_devs[i]->dev.parent = parent;
@@ -706,7 +685,7 @@ static void __init hrefv60_init_machine(void)
706 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; 685 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
707 686
708 hrefv60_pinmaps_init(); 687 hrefv60_pinmaps_init();
709 parent = u8500_init_devices(); 688 parent = u8500_init_devices(&ab8500_platdata);
710 689
711 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++) 690 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
712 mop500_platform_devs[i]->dev.parent = parent; 691 mop500_platform_devs[i]->dev.parent = parent;
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 33275eb4c689..1fcdc2da33ba 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -16,6 +16,7 @@
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/mfd/abx500/ab8500.h>
19 20
20#include <asm/mach/map.h> 21#include <asm/mach/map.h>
21#include <asm/pmu.h> 22#include <asm/pmu.h>
@@ -115,7 +116,7 @@ static irqreturn_t db8500_pmu_handler(int irq, void *dev, irq_handler_t handler)
115 return ret; 116 return ret;
116} 117}
117 118
118static struct arm_pmu_platdata db8500_pmu_platdata = { 119struct arm_pmu_platdata db8500_pmu_platdata = {
119 .handle_irq = db8500_pmu_handler, 120 .handle_irq = db8500_pmu_handler,
120}; 121};
121 122
@@ -207,7 +208,7 @@ static struct device * __init db8500_soc_device_init(void)
207/* 208/*
208 * This function is called from the board init 209 * This function is called from the board init
209 */ 210 */
210struct device * __init u8500_init_devices(void) 211struct device * __init u8500_init_devices(struct ab8500_platform_data *ab8500)
211{ 212{
212 struct device *parent; 213 struct device *parent;
213 int i; 214 int i;
@@ -224,6 +225,8 @@ struct device * __init u8500_init_devices(void)
224 for (i = 0; i < ARRAY_SIZE(platform_devs); i++) 225 for (i = 0; i < ARRAY_SIZE(platform_devs); i++)
225 platform_devs[i]->dev.parent = parent; 226 platform_devs[i]->dev.parent = parent;
226 227
228 db8500_prcmu_device.dev.platform_data = ab8500;
229
227 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); 230 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));
228 231
229 return parent; 232 return parent;
diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h
index 8b7ed82a2866..7914e5eaa9c7 100644
--- a/arch/arm/mach-ux500/include/mach/setup.h
+++ b/arch/arm/mach-ux500/include/mach/setup.h
@@ -13,11 +13,12 @@
13 13
14#include <asm/mach/time.h> 14#include <asm/mach/time.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/mfd/abx500/ab8500.h>
16 17
17void __init ux500_map_io(void); 18void __init ux500_map_io(void);
18extern void __init u8500_map_io(void); 19extern void __init u8500_map_io(void);
19 20
20extern struct device * __init u8500_init_devices(void); 21extern struct device * __init u8500_init_devices(struct ab8500_platform_data *ab8500);
21 22
22extern void __init ux500_init_irq(void); 23extern void __init ux500_init_irq(void);
23extern void __init ux500_init_late(void); 24extern void __init ux500_init_late(void);
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index f4adcabb2a51..4050a1e1872b 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -28,6 +28,7 @@
28#include <linux/uaccess.h> 28#include <linux/uaccess.h>
29#include <linux/mfd/core.h> 29#include <linux/mfd/core.h>
30#include <linux/mfd/dbx500-prcmu.h> 30#include <linux/mfd/dbx500-prcmu.h>
31#include <linux/mfd/abx500/ab8500.h>
31#include <linux/regulator/db8500-prcmu.h> 32#include <linux/regulator/db8500-prcmu.h>
32#include <linux/regulator/machine.h> 33#include <linux/regulator/machine.h>
33#include <asm/hardware/gic.h> 34#include <asm/hardware/gic.h>
@@ -2972,8 +2973,9 @@ static struct mfd_cell db8500_prcmu_devs[] = {
2972 */ 2973 */
2973static int __devinit db8500_prcmu_probe(struct platform_device *pdev) 2974static int __devinit db8500_prcmu_probe(struct platform_device *pdev)
2974{ 2975{
2976 struct ab8500_platform_data *ab8500_platdata = pdev->dev.platform_data;
2975 struct device_node *np = pdev->dev.of_node; 2977 struct device_node *np = pdev->dev.of_node;
2976 int irq = 0, err = 0; 2978 int irq = 0, err = 0, i;
2977 2979
2978 if (ux500_is_svp()) 2980 if (ux500_is_svp())
2979 return -ENODEV; 2981 return -ENODEV;
@@ -2997,6 +2999,12 @@ static int __devinit db8500_prcmu_probe(struct platform_device *pdev)
2997 goto no_irq_return; 2999 goto no_irq_return;
2998 } 3000 }
2999 3001
3002 for (i = 0; i < ARRAY_SIZE(db8500_prcmu_devs); i++) {
3003 if (!strcmp(db8500_prcmu_devs[i].name, "ab8500-core")) {
3004 db8500_prcmu_devs[i].platform_data = ab8500_platdata;
3005 }
3006 }
3007
3000 if (cpu_is_u8500v20_or_later()) 3008 if (cpu_is_u8500v20_or_later())
3001 prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET); 3009 prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET);
3002 3010