From patchwork Fri Jul 6 09:35:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 9883 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 8AF6D23E4F for ; Fri, 6 Jul 2012 09:35:53 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 40C60A18994 for ; Fri, 6 Jul 2012 09:35:53 +0000 (UTC) Received: by yenq6 with SMTP id q6so8980384yen.11 for ; Fri, 06 Jul 2012 02:35:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=kt8kWRTdt9jC7CjL2DDxK53sZnrlrhVeL2qeXNa1uGY=; b=fVyUSoFI4GMm15sX3+rjeY8OSdkDqmAMFmH9DrERGMNvy2ny2Z2rSiTiAdA6I2CdeF Z6W2AR4qoipHafb8GXFmmrRBKaGmubN1I4/Qd6ioJfRX5DXDhgfYKcjt3HRZbVsaqnJH rwFO6bORMaTebfm9/TMDGwHzrbpZ0Po0mRuL3AqoQI0DBrbpXebD7dxFafDbR3KiNTZG 0ZD2JwrEp2KlfDUw+QeDfPUTqZkgArFPYL5Clxqu8EBkGDoSmW2W2hRoGuxwBu541DoV 1aprx/u6zINxIjOf6D2xiZMBKSSHBsjzze1o9O5r5pQKqdiHuVDd9IeK0hmZGCqR6wZn nUWw== Received: by 10.50.203.39 with SMTP id kn7mr1924391igc.53.1341567352437; Fri, 06 Jul 2012 02:35:52 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp6932ibb; Fri, 6 Jul 2012 02:35:48 -0700 (PDT) Received: by 10.216.208.151 with SMTP id q23mr10260239weo.20.1341567347719; Fri, 06 Jul 2012 02:35:47 -0700 (PDT) Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com [74.125.82.42]) by mx.google.com with ESMTPS id fd10si5979279wib.43.2012.07.06.02.35.46 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 06 Jul 2012 02:35:47 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.42 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.42; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.42 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by wgbds11 with SMTP id ds11so510680wgb.1 for ; Fri, 06 Jul 2012 02:35:46 -0700 (PDT) Received: by 10.180.106.97 with SMTP id gt1mr6288847wib.5.1341567346608; Fri, 06 Jul 2012 02:35:46 -0700 (PDT) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id w10sm7474427wix.9.2012.07.06.02.35.44 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 06 Jul 2012 02:35:46 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: STEricsson_nomadik_linux@list.st.com, linus.walleij@stericsson.com, arnd@arndb.de, sameo@linux.intel.com, broonie@opensource.wolfsonmicro.com, Lee Jones Subject: [PATCH 1/1] ARM: ux500: Register the AB8500 from DB8500 MFD Date: Fri, 6 Jul 2012 10:35:40 +0100 Message-Id: <1341567340-5800-1-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQlltDQH9XpxKZ9mMZe4AGHVemWLPU03KuuA/iHz1dF3HeZiHDxnuqIXIyDdgChL4HTlzOUi 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 Suggested-by: Arnd Bergmann Signed-off-by: Lee Jones --- arch/arm/mach-ux500/board-mop500.c | 27 +++------------------------ arch/arm/mach-ux500/cpu-db8500.c | 7 +++++-- arch/arm/mach-ux500/include/mach/setup.h | 3 ++- drivers/mfd/db8500-prcmu.c | 10 +++++++++- 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 ac762bd..c2a7270 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c @@ -211,24 +211,6 @@ static struct ab8500_platform_data ab8500_platdata = { .codec = &ab8500_codec_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 */ @@ -443,7 +425,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 @@ -605,7 +586,6 @@ static struct platform_device *snowball_platform_devs[] __initdata = { &snowball_led_dev, &snowball_key_dev, &snowball_sbnet_dev, - &ab8500_device, }; static void __init mop500_init_machine(void) @@ -617,9 +597,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; @@ -652,7 +631,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; @@ -684,7 +663,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; diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index a12bd9e..aab96ca 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -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, }; @@ -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; @@ -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; diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h index 8b7ed82..7914e5e 100644 --- a/arch/arm/mach-ux500/include/mach/setup.h +++ b/arch/arm/mach-ux500/include/mach/setup.h @@ -13,11 +13,12 @@ #include #include +#include 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); diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index f4adcab..4050a1e 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -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; @@ -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);