Skip to content

Commit

Permalink
ARM: ux500: Register the AB8500 from DB8500 MFD
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lee Jones authored and Samuel Ortiz committed Jul 8, 2012
1 parent b874809 commit 3a8e39c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 28 deletions.
27 changes: 3 additions & 24 deletions arch/arm/mach-ux500/board-mop500.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,24 +197,6 @@ static struct ab8500_platform_data ab8500_platdata = {
.gpio = &ab8500_gpio_pdata,
};

static struct resource ab8500_resources[] = {
[0] = {
.start = IRQ_DB8500_AB8500,
.end = IRQ_DB8500_AB8500,
.flags = IORESOURCE_IRQ
}
};

struct platform_device ab8500_device = {
.name = "ab8500-core",
.id = 0,
.dev = {
.platform_data = &ab8500_platdata,
},
.num_resources = 1,
.resource = ab8500_resources,
};

/*
* TPS61052
*/
Expand Down Expand Up @@ -460,7 +442,6 @@ static struct hash_platform_data u8500_hash1_platform_data = {
/* add any platform devices here - TODO */
static struct platform_device *mop500_platform_devs[] __initdata = {
&mop500_gpio_keys_device,
&ab8500_device,
};

#ifdef CONFIG_STE_DMA40
Expand Down Expand Up @@ -622,7 +603,6 @@ static struct platform_device *snowball_platform_devs[] __initdata = {
&snowball_led_dev,
&snowball_key_dev,
&snowball_sbnet_dev,
&ab8500_device,
};

static struct platform_device *snowball_of_platform_devs[] __initdata = {
Expand All @@ -639,9 +619,8 @@ static void __init mop500_init_machine(void)
mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;

mop500_pinmaps_init();
parent = u8500_init_devices();
parent = u8500_init_devices(&ab8500_platdata);

/* FIXME: parent of ab8500 should be prcmu */
for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
mop500_platform_devs[i]->dev.parent = parent;

Expand Down Expand Up @@ -674,7 +653,7 @@ static void __init snowball_init_machine(void)
int i;

snowball_pinmaps_init();
parent = u8500_init_devices();
parent = u8500_init_devices(&ab8500_platdata);

for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
snowball_platform_devs[i]->dev.parent = parent;
Expand Down Expand Up @@ -706,7 +685,7 @@ static void __init hrefv60_init_machine(void)
mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;

hrefv60_pinmaps_init();
parent = u8500_init_devices();
parent = u8500_init_devices(&ab8500_platdata);

for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
mop500_platform_devs[i]->dev.parent = parent;
Expand Down
7 changes: 5 additions & 2 deletions arch/arm/mach-ux500/cpu-db8500.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/irq.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/mfd/abx500/ab8500.h>

#include <asm/mach/map.h>
#include <asm/pmu.h>
Expand Down Expand Up @@ -115,7 +116,7 @@ static irqreturn_t db8500_pmu_handler(int irq, void *dev, irq_handler_t handler)
return ret;
}

static struct arm_pmu_platdata db8500_pmu_platdata = {
struct arm_pmu_platdata db8500_pmu_platdata = {
.handle_irq = db8500_pmu_handler,
};

Expand Down Expand Up @@ -207,7 +208,7 @@ static struct device * __init db8500_soc_device_init(void)
/*
* This function is called from the board init
*/
struct device * __init u8500_init_devices(void)
struct device * __init u8500_init_devices(struct ab8500_platform_data *ab8500)
{
struct device *parent;
int i;
Expand All @@ -224,6 +225,8 @@ struct device * __init u8500_init_devices(void)
for (i = 0; i < ARRAY_SIZE(platform_devs); i++)
platform_devs[i]->dev.parent = parent;

db8500_prcmu_device.dev.platform_data = ab8500;

platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));

return parent;
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/mach-ux500/include/mach/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

#include <asm/mach/time.h>
#include <linux/init.h>
#include <linux/mfd/abx500/ab8500.h>

void __init ux500_map_io(void);
extern void __init u8500_map_io(void);

extern struct device * __init u8500_init_devices(void);
extern struct device * __init u8500_init_devices(struct ab8500_platform_data *ab8500);

extern void __init ux500_init_irq(void);
extern void __init ux500_init_late(void);
Expand Down
10 changes: 9 additions & 1 deletion drivers/mfd/db8500-prcmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <linux/uaccess.h>
#include <linux/mfd/core.h>
#include <linux/mfd/dbx500-prcmu.h>
#include <linux/mfd/abx500/ab8500.h>
#include <linux/regulator/db8500-prcmu.h>
#include <linux/regulator/machine.h>
#include <asm/hardware/gic.h>
Expand Down Expand Up @@ -2972,8 +2973,9 @@ static struct mfd_cell db8500_prcmu_devs[] = {
*/
static int __devinit db8500_prcmu_probe(struct platform_device *pdev)
{
struct ab8500_platform_data *ab8500_platdata = pdev->dev.platform_data;
struct device_node *np = pdev->dev.of_node;
int irq = 0, err = 0;
int irq = 0, err = 0, i;

if (ux500_is_svp())
return -ENODEV;
Expand All @@ -2997,6 +2999,12 @@ static int __devinit db8500_prcmu_probe(struct platform_device *pdev)
goto no_irq_return;
}

for (i = 0; i < ARRAY_SIZE(db8500_prcmu_devs); i++) {
if (!strcmp(db8500_prcmu_devs[i].name, "ab8500-core")) {
db8500_prcmu_devs[i].platform_data = ab8500_platdata;
}
}

if (cpu_is_u8500v20_or_later())
prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET);

Expand Down

0 comments on commit 3a8e39c

Please sign in to comment.