Skip to contentSkip to conversation

mfd: db8500-prcmu: update resource passing

PATCH Superseded Linus Walleij 2 participants 2 messages Feb 10, 2013 – Feb 12, 2013

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 mfd: db8500-prcmu: update resource passing

From: Linus Walleij <[email protected]>

When trying to get rid of the cross-includes of <mach/id.h> from different drivers, so we can localize ASIC/CPU detection to the mach-ux500 folder, we run into the way the PRCMU handles base addresses and firmware detection.

This patch updates the firmware version detection to pass the required information as platform data instead of relying on cpu_is_* macros.

Now the PRCMU base address, the secondary TCDM area, the TCPM area and the IRQ are passed as resources instead of being grabbed from <mach/*> files. Incidentally this also removes part of the reliance on <mach/irqs.h>.

Further it updates the firmware version detection, since the location of the firmware ID bytes in the designated memory are is now passed from the platform data instead. There is no reason not to include the nice split-off of a struct to hold the firmware information and a separate function to populate it.

The patch actually rids the need to use the external db8500_prcmu_early_init call at all, but I'm keepin back that removal as I don't want the patch to be too big.

---
Sam, we'd really like to take this into the ARM SoC tree next/cleanup branch. This is because it is currently broken on ux500 since <mach/id.h> is already deleted there.

I have tested this by git-pull:in the branch with this patch right on top of linux-next, and it worked flawlessly.

If it anyway doesn't work out for MFD we'll have to merge this during the -rc phase (which isn't the end of the world), but it'd be great to know.

ARM SoC: please merge this to next/cleanup if Samuel is OK with it.

---
 arch/arm/mach-ux500/board-mop500.c   |   5 +-
 arch/arm/mach-ux500/cpu-db8500.c     |   7 +-
 arch/arm/mach-ux500/devices-db8500.c |  44 +++++++++++++
 arch/arm/mach-ux500/devices-db8500.h |   5 ++
 drivers/mfd/db8500-prcmu.c           | 122 +++++++++++++++++++++++------------
 include/linux/mfd/db8500-prcmu.h     |  14 ----
 include/linux/mfd/dbx500-prcmu.h     |  46 +++++++++++++
 7 files changed, 180 insertions(+), 63 deletions(-)
arch/arm/mach-ux500/board-mop500.c +4 -1
index d453522..6cb1407 100644
@@ -215,7 +215,7 @@ static struct platform_device snowball_sbnet_dev = {
 	},
 };
 
-static struct ab8500_platform_data ab8500_platdata = {
+struct ab8500_platform_data ab8500_platdata = {
 	.irq_base	= MOP500_AB8500_IRQ_BASE,
 	.regulator_reg_init = ab8500_regulator_reg_init,
 	.num_regulator_reg_init	= ARRAY_SIZE(ab8500_regulator_reg_init),
@@ -651,6 +651,7 @@ static void __init mop500_init_machine(void)
 	int i2c0_devs;
 	int i;
 
+	platform_device_register(&db8500_prcmu_device);
 	mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
 
 	mop500_pinmaps_init();
@@ -685,6 +686,7 @@ static void __init snowball_init_machine(void)
 	struct device *parent = NULL;
 	int i;
 
+	platform_device_register(&db8500_prcmu_device);
 	snowball_pinmaps_init();
 	parent = u8500_init_devices(&ab8500_platdata);
 
@@ -710,6 +712,7 @@ static void __init hrefv60_init_machine(void)
 	int i2c0_devs;
 	int i;
 
+	platform_device_register(&db8500_prcmu_device);
 	/*
 	 * The HREFv60 board removed a GPIO expander and routed
 	 * all these GPIO pins to the internal GPIO controller
arch/arm/mach-ux500/cpu-db8500.c +2 -5
index 09c3fee..8501970 100644
@@ -139,14 +139,9 @@ static struct platform_device db8500_pmu_device = {
 	.dev.platform_data	= &db8500_pmu_platdata,
 };
 
-static struct platform_device db8500_prcmu_device = {
-	.name			= "db8500-prcmu",
-};
-
 static struct platform_device *platform_devs[] __initdata = {
 	&u8500_dma40_device,
 	&db8500_pmu_device,
-	&db8500_prcmu_device,
 };
 
 static resource_size_t __initdata db8500_gpio_base[] = {
@@ -286,6 +281,8 @@ static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL),
 	OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL),
 	OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL),
+	OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu",
+			&db8500_prcmu_pdata),
 	/* Requires device name bindings. */
 	OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL),
 	/* Requires clock name and DMA bindings. */
arch/arm/mach-ux500/devices-db8500.c +44 -0

58 lines not on this page · raw message

arch/arm/mach-ux500/devices-db8500.h +5 -0
index a5e05f6..dbcb35c 100644
@@ -14,6 +14,11 @@
 
 struct ske_keypad_platform_data;
 struct pl022_ssp_controller;
+struct platform_device;
+
+extern struct ab8500_platform_data ab8500_platdata;
+extern struct prcmu_pdata db8500_prcmu_pdata;
+extern struct platform_device db8500_prcmu_device;
 
 static inline struct platform_device *
 db8500_add_ske_keypad(struct device *parent,
drivers/mfd/db8500-prcmu.c +79 -43

173 lines not on this page · raw message

include/linux/mfd/db8500-prcmu.h +0 -14
index a65dedd..77a46ae 100644
@@ -487,20 +487,6 @@ struct prcmu_auto_pm_config {
 	u8 sva_policy;
 };
 
-#define PRCMU_FW_PROJECT_U8500		2
-#define PRCMU_FW_PROJECT_U9500		4
-#define PRCMU_FW_PROJECT_U8500_C2	7
-#define PRCMU_FW_PROJECT_U9500_C2	11
-#define PRCMU_FW_PROJECT_U8520		13
-#define PRCMU_FW_PROJECT_U8420		14
-
-struct prcmu_fw_version {
-	u8 project;
-	u8 api_version;
-	u8 func_version;
-	u8 errata;
-};
-
 #ifdef CONFIG_MFD_DB8500_PRCMU
 
 void db8500_prcmu_early_init(void);
include/linux/mfd/dbx500-prcmu.h +46 -0

58 lines not on this page · raw message

Signature · 1 line
1.7.11.3
#1 lore raw

PATCH 2/2 mfd: db8500-prcmu: update resource passing

Hi Linus,

Quoted 34 lines · Linus Walleij

From: Linus Walleij <[email protected]>

When trying to get rid of the cross-includes of <mach/id.h> from different drivers, so we can localize ASIC/CPU detection to the mach-ux500 folder, we run into the way the PRCMU handles base addresses and firmware detection.

This patch updates the firmware version detection to pass the required information as platform data instead of relying on cpu_is_* macros.

Now the PRCMU base address, the secondary TCDM area, the TCPM area and the IRQ are passed as resources instead of being grabbed from <mach/*> files. Incidentally this also removes part of the reliance on <mach/irqs.h>.

Further it updates the firmware version detection, since the location of the firmware ID bytes in the designated memory are is now passed from the platform data instead. There is no reason not to include the nice split-off of a struct to hold the firmware information and a separate function to populate it.

The patch actually rids the need to use the external db8500_prcmu_early_init call at all, but I'm keepin back that removal as I don't want the patch to be too big.

Quoted 7 lines

---
Sam, we'd really like to take this into the ARM SoC tree next/cleanup branch. This is because it is currently broken on ux500 since <mach/id.h> is already deleted there.

I have tested this by git-pull:in the branch with this patch right on top of linux-next, and it worked flawlessly.

Please go ahead and merge it into the ARM SoC tree. If we get merge conflicts reports from Stephen, I'll ask you to drop it though.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/