aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/db8500-prcmu.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2014-02-03 18:35:56 -0500
committerLinus Walleij <linus.walleij@linaro.org>2014-03-03 19:58:11 -0500
commitf864c46aae4cb6aed09e98615c427fcc4f1de104 (patch)
treee99dfede3907fff672ba55400ede7ab61868c406 /drivers/mfd/db8500-prcmu.c
parent8cc0071556c18bf3dc036a33fa989d0ebe537e33 (diff)
mfd: dbx500/abx500: root out hardcoded IRQ assignments
The DBx500 and ABx500 should be getting their IRQs from the device tree and nowhere else. Get rid of all the static assignments everywhere, delete it from the driver, platform data and the board files in one swift strike. Lots of cross-dependencies in the MFD drivers for PRCMU and AB8500 makes it necessary to strike everywhere at once to eradicate IRQs passed as resources and platform data to the left and right around the platform. Cc: Mark Brown <broonie@kernel.org> Cc: Samuel Ortiz <sameo@linux.intel.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/mfd/db8500-prcmu.c')
-rw-r--r--drivers/mfd/db8500-prcmu.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index e43e6e821117..7694e0700d34 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -25,6 +25,7 @@
25#include <linux/bitops.h> 25#include <linux/bitops.h>
26#include <linux/fs.h> 26#include <linux/fs.h>
27#include <linux/of.h> 27#include <linux/of.h>
28#include <linux/of_irq.h>
28#include <linux/platform_device.h> 29#include <linux/platform_device.h>
29#include <linux/uaccess.h> 30#include <linux/uaccess.h>
30#include <linux/mfd/core.h> 31#include <linux/mfd/core.h>
@@ -2678,16 +2679,12 @@ static struct irq_domain_ops db8500_irq_ops = {
2678 .xlate = irq_domain_xlate_twocell, 2679 .xlate = irq_domain_xlate_twocell,
2679}; 2680};
2680 2681
2681static int db8500_irq_init(struct device_node *np, int irq_base) 2682static int db8500_irq_init(struct device_node *np)
2682{ 2683{
2683 int i; 2684 int i;
2684 2685
2685 /* In the device tree case, just take some IRQs */
2686 if (np)
2687 irq_base = 0;
2688
2689 db8500_irq_domain = irq_domain_add_simple( 2686 db8500_irq_domain = irq_domain_add_simple(
2690 np, NUM_PRCMU_WAKEUPS, irq_base, 2687 np, NUM_PRCMU_WAKEUPS, 0,
2691 &db8500_irq_ops, NULL); 2688 &db8500_irq_ops, NULL);
2692 2689
2693 if (!db8500_irq_domain) { 2690 if (!db8500_irq_domain) {
@@ -3114,10 +3111,10 @@ static void db8500_prcmu_update_cpufreq(void)
3114} 3111}
3115 3112
3116static int db8500_prcmu_register_ab8500(struct device *parent, 3113static int db8500_prcmu_register_ab8500(struct device *parent,
3117 struct ab8500_platform_data *pdata, 3114 struct ab8500_platform_data *pdata)
3118 int irq)
3119{ 3115{
3120 struct resource ab8500_resource = DEFINE_RES_IRQ(irq); 3116 struct device_node *np;
3117 struct resource ab8500_resource;
3121 struct mfd_cell ab8500_cell = { 3118 struct mfd_cell ab8500_cell = {
3122 .name = "ab8500-core", 3119 .name = "ab8500-core",
3123 .of_compatible = "stericsson,ab8500", 3120 .of_compatible = "stericsson,ab8500",
@@ -3128,6 +3125,20 @@ static int db8500_prcmu_register_ab8500(struct device *parent,
3128 .num_resources = 1, 3125 .num_resources = 1,
3129 }; 3126 };
3130 3127
3128 if (!parent->of_node)
3129 return -ENODEV;
3130
3131 /* Look up the device node, sneak the IRQ out of it */
3132 for_each_child_of_node(parent->of_node, np) {
3133 if (of_device_is_compatible(np, ab8500_cell.of_compatible))
3134 break;
3135 }
3136 if (!np) {
3137 dev_info(parent, "could not find AB8500 node in the device tree\n");
3138 return -ENODEV;
3139 }
3140 of_irq_to_resource_table(np, &ab8500_resource, 1);
3141
3131 return mfd_add_devices(parent, 0, &ab8500_cell, 1, NULL, 0, NULL); 3142 return mfd_add_devices(parent, 0, &ab8500_cell, 1, NULL, 0, NULL);
3132} 3143}
3133 3144
@@ -3180,7 +3191,7 @@ static int db8500_prcmu_probe(struct platform_device *pdev)
3180 goto no_irq_return; 3191 goto no_irq_return;
3181 } 3192 }
3182 3193
3183 db8500_irq_init(np, pdata->irq_base); 3194 db8500_irq_init(np);
3184 3195
3185 prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET); 3196 prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET);
3186 3197
@@ -3205,8 +3216,7 @@ static int db8500_prcmu_probe(struct platform_device *pdev)
3205 } 3216 }
3206 } 3217 }
3207 3218
3208 err = db8500_prcmu_register_ab8500(&pdev->dev, pdata->ab_platdata, 3219 err = db8500_prcmu_register_ab8500(&pdev->dev, pdata->ab_platdata);
3209 pdata->ab_irq);
3210 if (err) { 3220 if (err) {
3211 mfd_remove_devices(&pdev->dev); 3221 mfd_remove_devices(&pdev->dev);
3212 pr_err("prcmu: Failed to add ab8500 subdevice\n"); 3222 pr_err("prcmu: Failed to add ab8500 subdevice\n");