aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-ux500/board-mop500.c58
-rw-r--r--arch/arm/mach-ux500/devices-db8500.c2
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs-db8500.h25
-rw-r--r--drivers/mfd/db8500-prcmu.c140
-rw-r--r--include/linux/mfd/dbx500-prcmu.h2
5 files changed, 115 insertions, 112 deletions
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index b03457881c4b..fe3d72cc341c 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -206,63 +206,6 @@ struct ab8500_platform_data ab8500_platdata = {
206 .codec = &ab8500_codec_pdata, 206 .codec = &ab8500_codec_pdata,
207}; 207};
208 208
209/*
210 * Thermal Sensor
211 */
212
213static struct resource db8500_thsens_resources[] = {
214 {
215 .name = "IRQ_HOTMON_LOW",
216 .start = IRQ_PRCMU_HOTMON_LOW,
217 .end = IRQ_PRCMU_HOTMON_LOW,
218 .flags = IORESOURCE_IRQ,
219 },
220 {
221 .name = "IRQ_HOTMON_HIGH",
222 .start = IRQ_PRCMU_HOTMON_HIGH,
223 .end = IRQ_PRCMU_HOTMON_HIGH,
224 .flags = IORESOURCE_IRQ,
225 },
226};
227
228static struct db8500_thsens_platform_data db8500_thsens_data = {
229 .trip_points[0] = {
230 .temp = 70000,
231 .type = THERMAL_TRIP_ACTIVE,
232 .cdev_name = {
233 [0] = "thermal-cpufreq-0",
234 },
235 },
236 .trip_points[1] = {
237 .temp = 75000,
238 .type = THERMAL_TRIP_ACTIVE,
239 .cdev_name = {
240 [0] = "thermal-cpufreq-0",
241 },
242 },
243 .trip_points[2] = {
244 .temp = 80000,
245 .type = THERMAL_TRIP_ACTIVE,
246 .cdev_name = {
247 [0] = "thermal-cpufreq-0",
248 },
249 },
250 .trip_points[3] = {
251 .temp = 85000,
252 .type = THERMAL_TRIP_CRITICAL,
253 },
254 .num_trips = 4,
255};
256
257static struct platform_device u8500_thsens_device = {
258 .name = "db8500-thermal",
259 .resource = db8500_thsens_resources,
260 .num_resources = ARRAY_SIZE(db8500_thsens_resources),
261 .dev = {
262 .platform_data = &db8500_thsens_data,
263 },
264};
265
266static struct platform_device u8500_cpufreq_cooling_device = { 209static struct platform_device u8500_cpufreq_cooling_device = {
267 .name = "db8500-cpufreq-cooling", 210 .name = "db8500-cpufreq-cooling",
268}; 211};
@@ -622,7 +565,6 @@ static struct platform_device *snowball_platform_devs[] __initdata = {
622 &snowball_key_dev, 565 &snowball_key_dev,
623 &snowball_sbnet_dev, 566 &snowball_sbnet_dev,
624 &snowball_gpio_en_3v3_regulator_dev, 567 &snowball_gpio_en_3v3_regulator_dev,
625 &u8500_thsens_device,
626 &u8500_cpufreq_cooling_device, 568 &u8500_cpufreq_cooling_device,
627}; 569};
628 570
diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c
index f3d9419f75d3..df4d7de0fd9f 100644
--- a/arch/arm/mach-ux500/devices-db8500.c
+++ b/arch/arm/mach-ux500/devices-db8500.c
@@ -199,6 +199,8 @@ struct platform_device u8500_ske_keypad_device = {
199 199
200struct prcmu_pdata db8500_prcmu_pdata = { 200struct prcmu_pdata db8500_prcmu_pdata = {
201 .ab_platdata = &ab8500_platdata, 201 .ab_platdata = &ab8500_platdata,
202 .ab_irq = IRQ_DB8500_AB8500,
203 .irq_base = IRQ_PRCMU_BASE,
202 .version_offset = DB8500_PRCMU_FW_VERSION_OFFSET, 204 .version_offset = DB8500_PRCMU_FW_VERSION_OFFSET,
203 .legacy_offset = DB8500_PRCMU_LEGACY_OFFSET, 205 .legacy_offset = DB8500_PRCMU_LEGACY_OFFSET,
204}; 206};
diff --git a/arch/arm/mach-ux500/include/mach/irqs-db8500.h b/arch/arm/mach-ux500/include/mach/irqs-db8500.h
index 68bc14974608..f3a9d5947ef3 100644
--- a/arch/arm/mach-ux500/include/mach/irqs-db8500.h
+++ b/arch/arm/mach-ux500/include/mach/irqs-db8500.h
@@ -109,31 +109,6 @@
109 109
110/* Virtual interrupts corresponding to the PRCMU wakeups. */ 110/* Virtual interrupts corresponding to the PRCMU wakeups. */
111#define IRQ_PRCMU_BASE IRQ_SOC_START 111#define IRQ_PRCMU_BASE IRQ_SOC_START
112#define NUM_PRCMU_WAKEUPS (IRQ_PRCMU_END - IRQ_PRCMU_BASE)
113
114#define IRQ_PRCMU_RTC (IRQ_PRCMU_BASE)
115#define IRQ_PRCMU_RTT0 (IRQ_PRCMU_BASE + 1)
116#define IRQ_PRCMU_RTT1 (IRQ_PRCMU_BASE + 2)
117#define IRQ_PRCMU_HSI0 (IRQ_PRCMU_BASE + 3)
118#define IRQ_PRCMU_HSI1 (IRQ_PRCMU_BASE + 4)
119#define IRQ_PRCMU_CA_WAKE (IRQ_PRCMU_BASE + 5)
120#define IRQ_PRCMU_USB (IRQ_PRCMU_BASE + 6)
121#define IRQ_PRCMU_ABB (IRQ_PRCMU_BASE + 7)
122#define IRQ_PRCMU_ABB_FIFO (IRQ_PRCMU_BASE + 8)
123#define IRQ_PRCMU_ARM (IRQ_PRCMU_BASE + 9)
124#define IRQ_PRCMU_MODEM_SW_RESET_REQ (IRQ_PRCMU_BASE + 10)
125#define IRQ_PRCMU_GPIO0 (IRQ_PRCMU_BASE + 11)
126#define IRQ_PRCMU_GPIO1 (IRQ_PRCMU_BASE + 12)
127#define IRQ_PRCMU_GPIO2 (IRQ_PRCMU_BASE + 13)
128#define IRQ_PRCMU_GPIO3 (IRQ_PRCMU_BASE + 14)
129#define IRQ_PRCMU_GPIO4 (IRQ_PRCMU_BASE + 15)
130#define IRQ_PRCMU_GPIO5 (IRQ_PRCMU_BASE + 16)
131#define IRQ_PRCMU_GPIO6 (IRQ_PRCMU_BASE + 17)
132#define IRQ_PRCMU_GPIO7 (IRQ_PRCMU_BASE + 18)
133#define IRQ_PRCMU_GPIO8 (IRQ_PRCMU_BASE + 19)
134#define IRQ_PRCMU_CA_SLEEP (IRQ_PRCMU_BASE + 20)
135#define IRQ_PRCMU_HOTMON_LOW (IRQ_PRCMU_BASE + 21)
136#define IRQ_PRCMU_HOTMON_HIGH (IRQ_PRCMU_BASE + 22)
137#define IRQ_PRCMU_END (IRQ_PRCMU_BASE + 23) 112#define IRQ_PRCMU_END (IRQ_PRCMU_BASE + 23)
138 113
139/* 114/*
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index 0f99b01afa88..21434beb420a 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -33,7 +33,7 @@
33#include <linux/regulator/machine.h> 33#include <linux/regulator/machine.h>
34#include <linux/cpufreq.h> 34#include <linux/cpufreq.h>
35#include <linux/platform_data/ux500_wdt.h> 35#include <linux/platform_data/ux500_wdt.h>
36#include <mach/irqs.h> 36#include <linux/platform_data/db8500_thermal.h>
37#include "dbx500-prcmu-regs.h" 37#include "dbx500-prcmu-regs.h"
38 38
39/* Index of different voltages to be used when accessing AVSData */ 39/* Index of different voltages to be used when accessing AVSData */
@@ -273,8 +273,34 @@ static struct irq_domain *db8500_irq_domain;
273 * the bits in the bit field are not. (The bits also have a tendency to move 273 * the bits in the bit field are not. (The bits also have a tendency to move
274 * around, to further complicate matters.) 274 * around, to further complicate matters.)
275 */ 275 */
276#define IRQ_INDEX(_name) ((IRQ_PRCMU_##_name) - IRQ_PRCMU_BASE) 276#define IRQ_INDEX(_name) ((IRQ_PRCMU_##_name))
277#define IRQ_ENTRY(_name)[IRQ_INDEX(_name)] = (WAKEUP_BIT_##_name) 277#define IRQ_ENTRY(_name)[IRQ_INDEX(_name)] = (WAKEUP_BIT_##_name)
278
279#define IRQ_PRCMU_RTC 0
280#define IRQ_PRCMU_RTT0 1
281#define IRQ_PRCMU_RTT1 2
282#define IRQ_PRCMU_HSI0 3
283#define IRQ_PRCMU_HSI1 4
284#define IRQ_PRCMU_CA_WAKE 5
285#define IRQ_PRCMU_USB 6
286#define IRQ_PRCMU_ABB 7
287#define IRQ_PRCMU_ABB_FIFO 8
288#define IRQ_PRCMU_ARM 9
289#define IRQ_PRCMU_MODEM_SW_RESET_REQ 10
290#define IRQ_PRCMU_GPIO0 11
291#define IRQ_PRCMU_GPIO1 12
292#define IRQ_PRCMU_GPIO2 13
293#define IRQ_PRCMU_GPIO3 14
294#define IRQ_PRCMU_GPIO4 15
295#define IRQ_PRCMU_GPIO5 16
296#define IRQ_PRCMU_GPIO6 17
297#define IRQ_PRCMU_GPIO7 18
298#define IRQ_PRCMU_GPIO8 19
299#define IRQ_PRCMU_CA_SLEEP 20
300#define IRQ_PRCMU_HOTMON_LOW 21
301#define IRQ_PRCMU_HOTMON_HIGH 22
302#define NUM_PRCMU_WAKEUPS 23
303
278static u32 prcmu_irq_bit[NUM_PRCMU_WAKEUPS] = { 304static u32 prcmu_irq_bit[NUM_PRCMU_WAKEUPS] = {
279 IRQ_ENTRY(RTC), 305 IRQ_ENTRY(RTC),
280 IRQ_ENTRY(RTT0), 306 IRQ_ENTRY(RTT0),
@@ -2649,14 +2675,13 @@ static struct irq_domain_ops db8500_irq_ops = {
2649 .xlate = irq_domain_xlate_twocell, 2675 .xlate = irq_domain_xlate_twocell,
2650}; 2676};
2651 2677
2652static int db8500_irq_init(struct device_node *np) 2678static int db8500_irq_init(struct device_node *np, int irq_base)
2653{ 2679{
2654 int irq_base = 0;
2655 int i; 2680 int i;
2656 2681
2657 /* In the device tree case, just take some IRQs */ 2682 /* In the device tree case, just take some IRQs */
2658 if (!np) 2683 if (np)
2659 irq_base = IRQ_PRCMU_BASE; 2684 irq_base = 0;
2660 2685
2661 db8500_irq_domain = irq_domain_add_simple( 2686 db8500_irq_domain = irq_domain_add_simple(
2662 np, NUM_PRCMU_WAKEUPS, irq_base, 2687 np, NUM_PRCMU_WAKEUPS, irq_base,
@@ -2988,18 +3013,57 @@ static struct regulator_init_data db8500_regulators[DB8500_NUM_REGULATORS] = {
2988 }, 3013 },
2989}; 3014};
2990 3015
2991static struct resource ab8500_resources[] = {
2992 [0] = {
2993 .start = IRQ_DB8500_AB8500,
2994 .end = IRQ_DB8500_AB8500,
2995 .flags = IORESOURCE_IRQ
2996 }
2997};
2998
2999static struct ux500_wdt_data db8500_wdt_pdata = { 3016static struct ux500_wdt_data db8500_wdt_pdata = {
3000 .timeout = 600, /* 10 minutes */ 3017 .timeout = 600, /* 10 minutes */
3001 .has_28_bits_resolution = true, 3018 .has_28_bits_resolution = true,
3002}; 3019};
3020/*
3021 * Thermal Sensor
3022 */
3023
3024static struct resource db8500_thsens_resources[] = {
3025 {
3026 .name = "IRQ_HOTMON_LOW",
3027 .start = IRQ_PRCMU_HOTMON_LOW,
3028 .end = IRQ_PRCMU_HOTMON_LOW,
3029 .flags = IORESOURCE_IRQ,
3030 },
3031 {
3032 .name = "IRQ_HOTMON_HIGH",
3033 .start = IRQ_PRCMU_HOTMON_HIGH,
3034 .end = IRQ_PRCMU_HOTMON_HIGH,
3035 .flags = IORESOURCE_IRQ,
3036 },
3037};
3038
3039static struct db8500_thsens_platform_data db8500_thsens_data = {
3040 .trip_points[0] = {
3041 .temp = 70000,
3042 .type = THERMAL_TRIP_ACTIVE,
3043 .cdev_name = {
3044 [0] = "thermal-cpufreq-0",
3045 },
3046 },
3047 .trip_points[1] = {
3048 .temp = 75000,
3049 .type = THERMAL_TRIP_ACTIVE,
3050 .cdev_name = {
3051 [0] = "thermal-cpufreq-0",
3052 },
3053 },
3054 .trip_points[2] = {
3055 .temp = 80000,
3056 .type = THERMAL_TRIP_ACTIVE,
3057 .cdev_name = {
3058 [0] = "thermal-cpufreq-0",
3059 },
3060 },
3061 .trip_points[3] = {
3062 .temp = 85000,
3063 .type = THERMAL_TRIP_CRITICAL,
3064 },
3065 .num_trips = 4,
3066};
3003 3067
3004static struct mfd_cell db8500_prcmu_devs[] = { 3068static struct mfd_cell db8500_prcmu_devs[] = {
3005 { 3069 {
@@ -3021,11 +3085,10 @@ static struct mfd_cell db8500_prcmu_devs[] = {
3021 .id = -1, 3085 .id = -1,
3022 }, 3086 },
3023 { 3087 {
3024 .name = "ab8500-core", 3088 .name = "db8500-thermal",
3025 .of_compatible = "stericsson,ab8500", 3089 .num_resources = ARRAY_SIZE(db8500_thsens_resources),
3026 .num_resources = ARRAY_SIZE(ab8500_resources), 3090 .resources = db8500_thsens_resources,
3027 .resources = ab8500_resources, 3091 .platform_data = &db8500_thsens_data,
3028 .id = AB8500_VERSION_AB8500,
3029 }, 3092 },
3030}; 3093};
3031 3094
@@ -3037,6 +3100,24 @@ static void db8500_prcmu_update_cpufreq(void)
3037 } 3100 }
3038} 3101}
3039 3102
3103static int db8500_prcmu_register_ab8500(struct device *parent,
3104 struct ab8500_platform_data *pdata,
3105 int irq)
3106{
3107 struct resource ab8500_resource = DEFINE_RES_IRQ(irq);
3108 struct mfd_cell ab8500_cell = {
3109 .name = "ab8500-core",
3110 .of_compatible = "stericsson,ab8500",
3111 .id = AB8500_VERSION_AB8500,
3112 .platform_data = pdata,
3113 .pdata_size = sizeof(struct ab8500_platform_data),
3114 .resources = &ab8500_resource,
3115 .num_resources = 1,
3116 };
3117
3118 return mfd_add_devices(parent, 0, &ab8500_cell, 1, NULL, 0, NULL);
3119}
3120
3040/** 3121/**
3041 * prcmu_fw_init - arch init call for the Linux PRCMU fw init logic 3122 * prcmu_fw_init - arch init call for the Linux PRCMU fw init logic
3042 * 3123 *
@@ -3045,7 +3126,7 @@ static int db8500_prcmu_probe(struct platform_device *pdev)
3045{ 3126{
3046 struct device_node *np = pdev->dev.of_node; 3127 struct device_node *np = pdev->dev.of_node;
3047 struct prcmu_pdata *pdata = dev_get_platdata(&pdev->dev); 3128 struct prcmu_pdata *pdata = dev_get_platdata(&pdev->dev);
3048 int irq = 0, err = 0, i; 3129 int irq = 0, err = 0;
3049 struct resource *res; 3130 struct resource *res;
3050 3131
3051 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu"); 3132 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu");
@@ -3086,26 +3167,27 @@ static int db8500_prcmu_probe(struct platform_device *pdev)
3086 goto no_irq_return; 3167 goto no_irq_return;
3087 } 3168 }
3088 3169
3089 db8500_irq_init(np); 3170 db8500_irq_init(np, pdata->irq_base);
3090
3091 for (i = 0; i < ARRAY_SIZE(db8500_prcmu_devs); i++) {
3092 if (!strcmp(db8500_prcmu_devs[i].name, "ab8500-core")) {
3093 db8500_prcmu_devs[i].platform_data = pdata->ab_platdata;
3094 db8500_prcmu_devs[i].pdata_size = sizeof(struct ab8500_platform_data);
3095 }
3096 }
3097 3171
3098 prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET); 3172 prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET);
3099 3173
3100 db8500_prcmu_update_cpufreq(); 3174 db8500_prcmu_update_cpufreq();
3101 3175
3102 err = mfd_add_devices(&pdev->dev, 0, db8500_prcmu_devs, 3176 err = mfd_add_devices(&pdev->dev, 0, db8500_prcmu_devs,
3103 ARRAY_SIZE(db8500_prcmu_devs), NULL, 0, NULL); 3177 ARRAY_SIZE(db8500_prcmu_devs), NULL, 0, db8500_irq_domain);
3104 if (err) { 3178 if (err) {
3105 pr_err("prcmu: Failed to add subdevices\n"); 3179 pr_err("prcmu: Failed to add subdevices\n");
3106 return err; 3180 return err;
3107 } 3181 }
3108 3182
3183 err = db8500_prcmu_register_ab8500(&pdev->dev, pdata->ab_platdata,
3184 pdata->ab_irq);
3185 if (err) {
3186 mfd_remove_devices(&pdev->dev);
3187 pr_err("prcmu: Failed to add ab8500 subdevice\n");
3188 goto no_irq_return;
3189 }
3190
3109 pr_info("DB8500 PRCMU initialized\n"); 3191 pr_info("DB8500 PRCMU initialized\n");
3110 3192
3111no_irq_return: 3193no_irq_return:
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index fc43cecc9449..689e6a0d9c99 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -237,6 +237,8 @@ struct prcmu_pdata
237 bool enable_set_ddr_opp; 237 bool enable_set_ddr_opp;
238 bool enable_ape_opp_100_voltage; 238 bool enable_ape_opp_100_voltage;
239 struct ab8500_platform_data *ab_platdata; 239 struct ab8500_platform_data *ab_platdata;
240 int ab_irq;
241 int irq_base;
240 u32 version_offset; 242 u32 version_offset;
241 u32 legacy_offset; 243 u32 legacy_offset;
242 u32 adt_offset; 244 u32 adt_offset;