diff options
| author | Philippe Langlais <philippe.langlais@linaro.org> | 2011-07-07 13:39:47 +0200 |
|---|---|---|
| committer | Ulf Hansson <ulf.hansson@stericsson.com> | 2011-09-19 15:15:43 +0200 |
| commit | 31470a483d96caf4d439fe41e8144bde728cf286 (patch) | |
| tree | 05d860463de00efee669d4630c2bf0d7150f8303 /arch/arm/mach-ux500 | |
| parent | f39ddd4052704c60a950c055b6f18f5aeed0c40e (diff) | |
ux500: align u5500 PRCMU & CPUFREQ management with u8500 (multiple commits in one)
Signed-off-by: Philippe Langlais <philippe.langlais@linaro.org>
Merge of following commits too:
u5500: add support for sysclk
basic sysclk support added in PRCMU driver and
clock framework driver updated.
Signed-off-by: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com>
U5500: Support for ESRAM12 EPOD in PRCMU driver
Signed-off-by: Vijaya Kumar Kilari <vijay.kilari@stericsson.com>
ux500: regulator: handle different base offset of ePOD ID
5500 ePOD ids are offseted for some reason in the PRCMU driver. Adjust the ids
to index the local arrays to avoid memory corruption.
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
ux500: pm: support PRCMU status check on 5500
This also removes unused 8500v1 code.
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
arm: ux500: prcmu_ac_wake_req workaround
This patch adds a check in prcmu_ac_wake_req that the modem is
awake (in terms of the value in the PRCM_MOD_AWAKE_STATUS
register) after the AC_WAKE_ACK has been received from the PRCMU
FW. If the check fails, a retry is made.
This seems to be necessary, since the modem can generate an
AC_WAKE_ACK, and then still go to sleep.
Signed-off-by: Mattias Nilsson <mattias.i.nilsson@stericsson.com>
U5500: Add support for PRCMU Mailbox0
Add PRCMU mailbox 0 support for irq wakeup
enable and disable
Signed-off-by: Vijaya Kumar K <vijay.kilari@stericsson.com>
U5500: Add support for power state transition
PRCMU driver is updated to provide API for
system power state transition
Signed-off-by: Vijaya Kumar K <vijay.kilari@stericsson.com>
ARM: ux500: prcmu: Add A9 watchdog interface
Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
U5500 : ab5500 core interrupt hander update
AB5500 interrupts will be now handled by PRCMU and then
routed to AB5500 core driver.AB5500 irq handler will
no more read the latch registers to find the interrupt
reason.Instead PRCMU will read the latch registers and
provide the values to core driver.
Signed-off-by: Bibek Basu <bibek.basu@stericsson.com>
ARM: ux500: prcmu-dbg: Tiny code clean-up
Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
u5500: add mailbox1 and related function support
Add cpufreq-db5500.c file for db5500 CPUfreq support.
PRCMU mailbox1 and related functions' support is added.
List of functions implemented:
- prcmu_get/set_arm_opp
- read_mailbox_1
Signed-off-by: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com>
Fix for PRCMU
u5500: PRCMU IRQ should be NO_SUSPEND
As on 8500.
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
ARM: u5500: PRCMU reset API
Added API for rebooting the board and for getting the last reboot code.
Signed-off-by: Pawel Szyszuk <pawel.szyszuk@stericsson.com>
Diffstat (limited to 'arch/arm/mach-ux500')
| -rw-r--r-- | arch/arm/mach-ux500/board-u5500-regulators.c | 82 | ||||
| -rw-r--r-- | arch/arm/mach-ux500/board-u5500.c | 5 | ||||
| -rw-r--r-- | arch/arm/mach-ux500/clock-db5500.c | 83 | ||||
| -rw-r--r-- | arch/arm/mach-ux500/cpu-db5500.c | 5 | ||||
| -rw-r--r-- | arch/arm/mach-ux500/cpu.c | 9 | ||||
| -rw-r--r-- | arch/arm/mach-ux500/devices-db5500.c | 5 | ||||
| -rw-r--r-- | arch/arm/mach-ux500/include/mach/irqs-db5500.h | 29 | ||||
| -rw-r--r-- | arch/arm/mach-ux500/include/mach/prcmu-regs.h | 8 | ||||
| -rw-r--r-- | arch/arm/mach-ux500/include/mach/prcmu.h | 124 | ||||
| -rw-r--r-- | arch/arm/mach-ux500/include/mach/regulator.h | 16 | ||||
| -rw-r--r-- | arch/arm/mach-ux500/pm/Kconfig | 7 | ||||
| -rw-r--r-- | arch/arm/mach-ux500/pm/pm.c | 13 | ||||
| -rw-r--r-- | arch/arm/mach-ux500/pm/runtime.c | 2 | ||||
| -rw-r--r-- | arch/arm/mach-ux500/pm/suspend.c | 5 | ||||
| -rw-r--r-- | arch/arm/mach-ux500/prcmu-debug.c | 52 |
15 files changed, 198 insertions, 247 deletions
diff --git a/arch/arm/mach-ux500/board-u5500-regulators.c b/arch/arm/mach-ux500/board-u5500-regulators.c index b345a72038b..f890ebebf10 100644 --- a/arch/arm/mach-ux500/board-u5500-regulators.c +++ b/arch/arm/mach-ux500/board-u5500-regulators.c @@ -9,7 +9,6 @@ #include <linux/platform_device.h> #include <linux/regulator/machine.h> #include <linux/regulator/ab5500.h> -#include <linux/regulator/db5500-prcmu.h> #include "board-u5500.h" @@ -146,83 +145,6 @@ struct ab5500_regulator_platform_data u5500_ab5500_regulator_data = { .num_regulator = ARRAY_SIZE(ab5500_regulator_init_data), }; -/* - * Power state, ePOD, etc. - */ - -static struct regulator_consumer_supply u5500_vape_consumers[] = { - REGULATOR_SUPPLY("v-ape", NULL), - REGULATOR_SUPPLY("v-i2c", "nmk-i2c.0"), - REGULATOR_SUPPLY("v-i2c", "nmk-i2c.1"), - REGULATOR_SUPPLY("v-i2c", "nmk-i2c.2"), - REGULATOR_SUPPLY("v-i2c", "nmk-i2c.3"), - REGULATOR_SUPPLY("v-mmc", "sdi0"), - REGULATOR_SUPPLY("v-mmc", "sdi1"), - REGULATOR_SUPPLY("v-mmc", "sdi2"), - REGULATOR_SUPPLY("v-mmc", "sdi3"), - REGULATOR_SUPPLY("v-mmc", "sdi4"), - REGULATOR_SUPPLY("v-uart", "uart0"), - REGULATOR_SUPPLY("v-uart", "uart1"), - REGULATOR_SUPPLY("v-uart", "uart2"), - REGULATOR_SUPPLY("v-uart", "uart3"), -}; - -static struct regulator_consumer_supply u5500_sga_consumers[] = { - REGULATOR_SUPPLY("debug", "reg-virt-consumer.0"), - REGULATOR_SUPPLY("v-mali", NULL), -}; - -static struct regulator_consumer_supply u5500_hva_consumers[] = { - REGULATOR_SUPPLY("debug", "reg-virt-consumer.1"), - REGULATOR_SUPPLY("v-hva", NULL), -}; - -static struct regulator_consumer_supply u5500_sia_consumers[] = { - REGULATOR_SUPPLY("debug", "reg-virt-consumer.2"), - REGULATOR_SUPPLY("v-sia", "mmio_camera"), -}; - -static struct regulator_consumer_supply u5500_disp_consumers[] = { - REGULATOR_SUPPLY("debug", "reg-virt-consumer.3"), - REGULATOR_SUPPLY("vsupply", "b2r2_bus"), - REGULATOR_SUPPLY("vsupply", "mcde"), -}; - -static struct regulator_consumer_supply u5500_esram12_consumers[] = { - REGULATOR_SUPPLY("debug", "reg-virt-consumer.4"), - REGULATOR_SUPPLY("v-esram12", "mcde"), - REGULATOR_SUPPLY("esram12", "cm_control"), -}; - -#define U5500_REGULATOR_SWITCH(lower, upper) \ -[U5500_REGULATOR_SWITCH_##upper] = (struct regulator_init_data []) { \ -{ \ - .constraints = { \ - .valid_ops_mask = REGULATOR_CHANGE_STATUS, \ - }, \ - .consumer_supplies = u5500_##lower##_consumers, \ - .num_consumer_supplies = ARRAY_SIZE(u5500_##lower##_consumers),\ -} \ -} - -static struct regulator_init_data * -u5500_regulator_init_data[U5500_NUM_REGULATORS] __initdata = { - [U5500_REGULATOR_VAPE] = (struct regulator_init_data []) { - { - .constraints = { - .valid_ops_mask = REGULATOR_CHANGE_STATUS, - }, - .consumer_supplies = u5500_vape_consumers, - .num_consumer_supplies = ARRAY_SIZE(u5500_vape_consumers), - } - }, - U5500_REGULATOR_SWITCH(sga, SGA), - U5500_REGULATOR_SWITCH(hva, HVA), - U5500_REGULATOR_SWITCH(sia, SIA), - U5500_REGULATOR_SWITCH(disp, DISP), - U5500_REGULATOR_SWITCH(esram12, ESRAM12), -}; - static void __init u5500_regulators_init_debug(void) { const char data[] = "debug"; @@ -236,8 +158,4 @@ static void __init u5500_regulators_init_debug(void) void __init u5500_regulators_init(void) { u5500_regulators_init_debug(); - - platform_device_register_data(NULL, "u5500-regulators", -1, - u5500_regulator_init_data, - sizeof(u5500_regulator_init_data)); } diff --git a/arch/arm/mach-ux500/board-u5500.c b/arch/arm/mach-ux500/board-u5500.c index 3759a815261..65fca58b364 100644 --- a/arch/arm/mach-ux500/board-u5500.c +++ b/arch/arm/mach-ux500/board-u5500.c @@ -303,9 +303,8 @@ static void __init u5500_spi_init(void) static struct resource ab5500_resources[] = { [0] = { - /*TODO Change this when prcmu driver arrives */ - .start = IRQ_DB5500_AB5500, - .end = IRQ_DB5500_AB5500, + .start = IRQ_DB5500_PRCMU_ABB, + .end = IRQ_DB5500_PRCMU_ABB, .flags = IORESOURCE_IRQ } }; diff --git a/arch/arm/mach-ux500/clock-db5500.c b/arch/arm/mach-ux500/clock-db5500.c index ee2ea8033bd..18583a52334 100644 --- a/arch/arm/mach-ux500/clock-db5500.c +++ b/arch/arm/mach-ux500/clock-db5500.c @@ -36,59 +36,16 @@ static DEFINE_MUTEX(ab_ulpclk_mutex); static DEFINE_MUTEX(audioclk_mutex); /* SysClk operations. */ - -static int request_sysclk(bool enable) -{ - static int requests; - - if ((enable && (requests++ == 0)) || (!enable && (--requests == 0))) - return prcmu_request_clock(PRCMU_SYSCLK, enable); - return 0; -} - static int sysclk_enable(struct clk *clk) { - static bool swat_enable; - int r; - - if (!swat_enable) { - r = ab8500_sysctrl_set(AB8500_SWATCTRL, - AB8500_SWATCTRL_SWATENABLE); - if (r) - return r; - - swat_enable = true; - } - - r = request_sysclk(true); - if (r) - return r; - - if (clk->cg_sel) { - r = ab8500_sysctrl_set(AB8500_SYSULPCLKCTRL1, (u8)clk->cg_sel); - if (r) - (void)request_sysclk(false); - } - return r; + return prcmu_request_clock(PRCMU_SYSCLK, true); } static void sysclk_disable(struct clk *clk) { - int r; - if (clk->cg_sel) { - r = ab8500_sysctrl_clear(AB8500_SYSULPCLKCTRL1, - (u8)clk->cg_sel); - if (r) - goto disable_failed; - } - r = request_sysclk(false); - if (r) - goto disable_failed; + prcmu_request_clock(PRCMU_SYSCLK, false); return; - -disable_failed: - pr_err("clock: failed to disable %s.\n", clk->name); } static struct clkops sysclk_ops = { @@ -324,27 +281,6 @@ static struct clk sysclk = { .mutex = &sysclk_mutex, }; -static struct clk sysclk2 = { - .name = "sysclk2", - .ops = &sysclk_ops, - .cg_sel = AB8500_SYSULPCLKCTRL1_SYSCLKBUF2REQ, - .mutex = &sysclk_mutex, -}; - -static struct clk sysclk3 = { - .name = "sysclk3", - .ops = &sysclk_ops, - .cg_sel = AB8500_SYSULPCLKCTRL1_SYSCLKBUF3REQ, - .mutex = &sysclk_mutex, -}; - -static struct clk sysclk4 = { - .name = "sysclk4", - .ops = &sysclk_ops, - .cg_sel = AB8500_SYSULPCLKCTRL1_SYSCLKBUF4REQ, - .mutex = &sysclk_mutex, -}; - static struct clk rtc32k = { .name = "rtc32k", .rate = 32768, @@ -633,7 +569,6 @@ static struct clk *db5500_dbg_clks[] __initdata = { &p6_pclk7, /* Clock sources */ - &sysclk2, &clkout0, &clkout1, &rtc_clk1, @@ -655,12 +590,6 @@ static struct clk_lookup u8500_common_clock_sources[] = { CLK_LOOKUP(audioclk, "ab8500-codec.0", "audioclk"), }; -static struct clk_lookup u8500_v2_sysclks[] = { - CLK_LOOKUP(sysclk2, NULL, "sysclk2"), - CLK_LOOKUP(sysclk3, NULL, "sysclk3"), - CLK_LOOKUP(sysclk4, NULL, "sysclk4"), -}; - static struct clk_lookup db5500_prcmu_clocks[] = { CLK_LOOKUP(sgaclk, "mali", NULL), CLK_LOOKUP(siaclk, "mmio_camera", "sia"), @@ -793,9 +722,6 @@ static void __init db5500_boot_clk_enable(void) int __init db5500_clk_init(void) { - sysclk_ops.enable = NULL; - sysclk_ops.disable = NULL; - if (ux500_is_svp()) { prcmu_clk_ops.enable = NULL; prcmu_clk_ops.disable = NULL; @@ -813,11 +739,6 @@ int __init db5500_clk_init(void) clks_register(db5500_clkouts, ARRAY_SIZE(db5500_clkouts)); clks_register(u5500_clocks, ARRAY_SIZE(u5500_clocks)); - if (cpu_is_u8500v2()) { - clks_register(u8500_v2_sysclks, - ARRAY_SIZE(u8500_v2_sysclks)); - } - db5500_boot_clk_enable(); /* diff --git a/arch/arm/mach-ux500/cpu-db5500.c b/arch/arm/mach-ux500/cpu-db5500.c index 3b0fd471d80..8e20bc69efa 100644 --- a/arch/arm/mach-ux500/cpu-db5500.c +++ b/arch/arm/mach-ux500/cpu-db5500.c @@ -158,11 +158,16 @@ static struct platform_device mbox2_device = { .num_resources = ARRAY_SIZE(mbox2_resources), }; +static struct platform_device db5500_prcmu_device = { + .name = "db5500-prcmu", +}; + static struct platform_device *db5500_platform_devs[] __initdata = { &db5500_pmu_device, &mbox0_device, &mbox1_device, &mbox2_device, + &db5500_prcmu_device, }; static resource_size_t __initdata db5500_gpio_base[] = { diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c index a9b01188dc4..f28f7858040 100644 --- a/arch/arm/mach-ux500/cpu.c +++ b/arch/arm/mach-ux500/cpu.c @@ -64,13 +64,8 @@ void __init ux500_init_irq(void) * Init clocks here so that they are available for system timer * initialization. */ - if (cpu_is_u5500()) - db5500_prcmu_early_init(); - if (cpu_is_u8500()) { - prcmu_early_init(); - arm_pm_restart = ux500_restart; - } - + prcmu_early_init(); + arm_pm_restart = ux500_restart; clk_init(); } diff --git a/arch/arm/mach-ux500/devices-db5500.c b/arch/arm/mach-ux500/devices-db5500.c index aa6389a2c20..75ecfd7a881 100644 --- a/arch/arm/mach-ux500/devices-db5500.c +++ b/arch/arm/mach-ux500/devices-db5500.c @@ -40,6 +40,11 @@ .start = IRQ_DB5500_GPIO##block, \ .end = IRQ_DB5500_GPIO##block, \ .flags = IORESOURCE_IRQ, \ + }, \ + { \ + .start = IRQ_DB5500_PRCMU_GPIO##block, \ + .end = IRQ_DB5500_PRCMU_GPIO##block, \ + .flags = IORESOURCE_IRQ, \ } #define GPIO_DEVICE(block) \ diff --git a/arch/arm/mach-ux500/include/mach/irqs-db5500.h b/arch/arm/mach-ux500/include/mach/irqs-db5500.h index 77239776a6f..d8d00b6c2ba 100644 --- a/arch/arm/mach-ux500/include/mach/irqs-db5500.h +++ b/arch/arm/mach-ux500/include/mach/irqs-db5500.h @@ -85,6 +85,35 @@ #ifdef CONFIG_UX500_SOC_DB5500 +/* Virtual interrupts corresponding to the PRCMU wakeups. */ +#define IRQ_DB5500_PRCMU_BASE IRQ_SOC_START + +#define IRQ_DB5500_PRCMU_RTC (IRQ_DB5500_PRCMU_BASE) +#define IRQ_DB5500_PRCMU_RTT0 (IRQ_DB5500_PRCMU_BASE + 1) +#define IRQ_DB5500_PRCMU_RTT1 (IRQ_DB5500_PRCMU_BASE + 2) +#define IRQ_DB5500_PRCMU_CD_IRQ (IRQ_DB5500_PRCMU_BASE + 3) +#define IRQ_DB5500_PRCMU_SRP_TIM (IRQ_DB5500_PRCMU_BASE + 4) +#define IRQ_DB5500_PRCMU_APE_REQ (IRQ_DB5500_PRCMU_BASE + 5) +#define IRQ_DB5500_PRCMU_USB (IRQ_DB5500_PRCMU_BASE + 6) +#define IRQ_DB5500_PRCMU_ABB (IRQ_DB5500_PRCMU_BASE + 7) +#define IRQ_DB5500_PRCMU_ARM (IRQ_DB5500_PRCMU_BASE + 8) +#define IRQ_DB5500_PRCMU_MODEM_SW_RESET_REQ (IRQ_DB5500_PRCMU_BASE + 9) +#define IRQ_DB5500_PRCMU_AC_WAKE_ACK (IRQ_DB5500_PRCMU_BASE + 10) +#define IRQ_DB5500_PRCMU_GPIO0 (IRQ_DB5500_PRCMU_BASE + 11) +#define IRQ_DB5500_PRCMU_GPIO1 (IRQ_DB5500_PRCMU_BASE + 12) +#define IRQ_DB5500_PRCMU_GPIO2 (IRQ_DB5500_PRCMU_BASE + 13) +#define IRQ_DB5500_PRCMU_GPIO3 (IRQ_DB5500_PRCMU_BASE + 14) +#define IRQ_DB5500_PRCMU_GPIO4 (IRQ_DB5500_PRCMU_BASE + 15) +#define IRQ_DB5500_PRCMU_GPIO5 (IRQ_DB5500_PRCMU_BASE + 16) +#define IRQ_DB5500_PRCMU_GPIO6 (IRQ_DB5500_PRCMU_BASE + 17) +#define IRQ_DB5500_PRCMU_GPIO7 (IRQ_DB5500_PRCMU_BASE + 18) +#define IRQ_DB5500_PRCMU_AC_REL_ACK (IRQ_DB5500_PRCMU_BASE + 19) +#define IRQ_DB5500_PRCMU_LOW_POWER_AUDIO (IRQ_DB5500_PRCMU_BASE + 20) +#define IRQ_DB5500_PRCMU_TEMP_SENSOR (IRQ_DB5500_PRCMU_BASE + 21) +#define IRQ_DB5500_PRCMU_END (IRQ_DB5500_PRCMU_BASE + 22) + +#define NUM_DB5500_PRCMU_WAKEUPS (IRQ_DB5500_PRCMU_END - IRQ_DB5500_PRCMU_BASE) + /* * After the GPIO ones we reserve a range of IRQ:s in which virtual * IRQ:s representing modem IRQ:s can be allocated diff --git a/arch/arm/mach-ux500/include/mach/prcmu-regs.h b/arch/arm/mach-ux500/include/mach/prcmu-regs.h index ec4663046e3..50c51b5605e 100644 --- a/arch/arm/mach-ux500/include/mach/prcmu-regs.h +++ b/arch/arm/mach-ux500/include/mach/prcmu-regs.h @@ -110,6 +110,11 @@ #define PRCM_ARM_IT1_VAL (_PRCMU_BASE + 0x494) #define PRCM_HOLD_EVT (_PRCMU_BASE + 0x174) +#define PRCM_MOD_AWAKE_STATUS (_PRCMU_BASE + 0x4A0) +#define PRCM_MOD_AWAKE_STATUS_PRCM_MOD_COREPD_AWAKE BIT(0) +#define PRCM_MOD_AWAKE_STATUS_PRCM_MOD_AAPD_AWAKE BIT(1) +#define PRCM_MOD_AWAKE_STATUS_PRCM_MOD_VMODEM_OFF_ISO BIT(2) + #define PRCM_ITSTATUS0 (_PRCMU_BASE + 0x148) #define PRCM_ITSTATUS1 (_PRCMU_BASE + 0x150) #define PRCM_ITSTATUS2 (_PRCMU_BASE + 0x158) @@ -193,4 +198,7 @@ #define PRCM_RESOUTN_SET (_PRCMU_BASE + 0x214) #define PRCM_RESOUTN_CLR (_PRCMU_BASE + 0x218) +/* System reset register */ +#define PRCM_APE_SOFTRST (_PRCMU_BASE + 0x228) + #endif /* __MACH_PRCMU__REGS_H */ diff --git a/arch/arm/mach-ux500/include/mach/prcmu.h b/arch/arm/mach-ux500/include/mach/prcmu.h index 41f68f0f087..6c7584d69d8 100644 --- a/arch/arm/mach-ux500/include/mach/prcmu.h +++ b/arch/arm/mach-ux500/include/mach/prcmu.h @@ -23,6 +23,7 @@ enum prcmu_wakeup_index { PRCMU_WAKEUP_INDEX_ABB, PRCMU_WAKEUP_INDEX_ABB_FIFO, PRCMU_WAKEUP_INDEX_ARM, + PRCMU_WAKEUP_INDEX_CD_IRQ, NUM_PRCMU_WAKEUP_INDICES }; #define PRCMU_WAKEUP(_name) (BIT(PRCMU_WAKEUP_INDEX_##_name)) @@ -192,12 +193,38 @@ enum ddr_opp { DDR_25_OPP = 0x02, }; +/* + * Definitions for controlling ESRAM0 in deep sleep. + */ +#define ESRAM0_DEEP_SLEEP_STATE_OFF 1 +#define ESRAM0_DEEP_SLEEP_STATE_RET 2 + +/** + * enum ddr_pwrst - DDR power states definition + * @DDR_PWR_STATE_UNCHANGED: SDRAM and DDR controller state is unchanged + * @DDR_PWR_STATE_ON: + * @DDR_PWR_STATE_OFFLOWLAT: + * @DDR_PWR_STATE_OFFHIGHLAT: + */ +enum ddr_pwrst { + DDR_PWR_STATE_UNCHANGED = 0x00, + DDR_PWR_STATE_ON = 0x01, + DDR_PWR_STATE_OFFLOWLAT = 0x02, + DDR_PWR_STATE_OFFHIGHLAT = 0x03 +}; + #include <linux/mfd/db8500-prcmu.h> #include <linux/mfd/db5500-prcmu.h> #if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500) -void __init prcmu_early_init(void); +static inline void __init prcmu_early_init(void) +{ + if (machine_is_u5500()) + return db5500_prcmu_early_init(); + else + return db8500_prcmu_early_init(); +} static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll) @@ -231,6 +258,22 @@ static inline void prcmu_disable_wakeups(void) prcmu_enable_wakeups(0); } +static inline void prcmu_config_abb_event_readout(u32 abb_events) +{ + if (machine_is_u5500()) + db5500_prcmu_config_abb_event_readout(abb_events); + else + db8500_prcmu_config_abb_event_readout(abb_events); +} + +static inline void prcmu_get_abb_event_buffer(void __iomem **buf) +{ + if (machine_is_u5500()) + db5500_prcmu_get_abb_event_buffer(buf); + else + db8500_prcmu_get_abb_event_buffer(buf); +} + int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); @@ -246,11 +289,25 @@ static inline int prcmu_request_clock(u8 clock, bool enable) int prcmu_set_ape_opp(u8 opp); int prcmu_get_ape_opp(void); -int prcmu_set_arm_opp(u8 opp); -int prcmu_get_arm_opp(void); int prcmu_set_ddr_opp(u8 opp); int prcmu_get_ddr_opp(void); +static inline int prcmu_set_arm_opp(u8 opp) +{ + if (machine_is_u5500()) + return db5500_prcmu_set_arm_opp(opp); + else + return db8500_prcmu_set_arm_opp(opp); +} + +static inline int prcmu_get_arm_opp(void) +{ + if (machine_is_u5500()) + return db5500_prcmu_get_arm_opp(); + else + return db8500_prcmu_get_arm_opp(); +} + static inline void prcmu_system_reset(u16 reset_code) { if (machine_is_u5500()) @@ -259,17 +316,56 @@ static inline void prcmu_system_reset(u16 reset_code) return db8500_prcmu_system_reset(reset_code); } -u16 prcmu_get_reset_code(void); +static inline u16 prcmu_get_reset_code(void) +{ + if (machine_is_u5500()) + return db5500_prcmu_get_reset_code(); + else + return db8500_prcmu_get_reset_code(); +} void prcmu_ac_wake_req(void); void prcmu_ac_sleep_req(void); void prcmu_modem_reset(void); -bool prcmu_is_ac_wake_requested(void); +static inline bool prcmu_is_ac_wake_requested(void) +{ + if (machine_is_u5500()) + return db5500_prcmu_is_ac_wake_requested(); + else + return db8500_prcmu_is_ac_wake_requested(); +} + +static inline int prcmu_set_display_clocks(void) +{ + if (machine_is_u5500()) + return db5500_prcmu_set_display_clocks(); + else + return db8500_prcmu_set_display_clocks(); +} + +static inline int prcmu_disable_dsipll(void) +{ + if (machine_is_u5500()) + return db5500_prcmu_disable_dsipll(); + else + return db8500_prcmu_disable_dsipll(); +} -int prcmu_set_display_clocks(void); -int prcmu_disable_dsipll(void); -int prcmu_enable_dsipll(void); +static inline int prcmu_enable_dsipll(void) +{ + if (machine_is_u5500()) + return db5500_prcmu_enable_dsipll(); + else + return db8500_prcmu_enable_dsipll(); +} +static inline int prcmu_config_esram0_deep_sleep(u8 state) +{ + if (machine_is_u5500()) + return db5500_prcmu_config_esram0_deep_sleep(state); + else + return db8500_prcmu_config_esram0_deep_sleep(state); +} #else static inline void __init prcmu_early_init(void) {} @@ -372,6 +468,18 @@ static inline int prcmu_enable_dsipll(void) return 0; } +static inline int prcmu_config_esram0_deep_sleep(u8 state) +{ + return 0; +} + +static inline void prcmu_config_abb_event_readout(u32 abb_events) {} + +static inline void prcmu_get_abb_event_buffer(void __iomem **buf) +{ + *buf = NULL; +} + #endif /* PRCMU QoS APE OPP class */ diff --git a/arch/arm/mach-ux500/include/mach/regulator.h b/arch/arm/mach-ux500/include/mach/regulator.h deleted file mode 100644 index cacb6bf5277..00000000000 --- a/arch/arm/mach-ux500/include/mach/regulator.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) ST-Ericsson SA 2010 - * - * Author: Bengt Jonsson <bengt.jonsson@stericsson.com> for ST-Ericsson, - * Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson - * - * License Terms: GNU General Public License v2 - * - */ - -#ifndef MACH_UX500_REGULATOR_H -#define MACH_UX500_REGULATOR_H - -#include <linux/regulator/dbx500-prcmu.h> - -#endif diff --git a/arch/arm/mach-ux500/pm/Kconfig b/arch/arm/mach-ux500/pm/Kconfig index d6454eab2a5..03aeaea57a5 100644 --- a/arch/arm/mach-ux500/pm/Kconfig +++ b/arch/arm/mach-ux500/pm/Kconfig @@ -1,10 +1,3 @@ -config U8500_CPUFREQ - tristate "CPUFreq support" - depends on UX500_SOC_DB8500 && CPU_FREQ && PM - default y - help - Add support for CPU Frequency scaling for U8500. - config U8500_CPUIDLE tristate "CPUIdle support" depends on UX500_SOC_DB8500 && CPU_IDLE && !RTC_DRV_PL031 && PM diff --git a/arch/arm/mach-ux500/pm/pm.c b/arch/arm/mach-ux500/pm/pm.c index 5324d715274..b6442212324 100644 --- a/arch/arm/mach-ux500/pm/pm.c +++ b/arch/arm/mach-ux500/pm/pm.c @@ -185,18 +185,21 @@ bool ux500_pm_other_cpu_wfi(void) return false; } -#define PRCMU_STATUS_REGISTER_V1 0x8015fe08 -#define PRCMU_STATUS_REGISTER_V2 0x801b8e08 +/* PRCM_ACK_MB0_AP_PWRSTTR_STATUS */ +#define DB8500_PRCMU_STATUS_REGISTER 0x801b8e08 +#define DB5500_PRCMU_STATUS_REGISTER 0x80168f38 enum prcmu_idle_stat ux500_pm_prcmu_idle_stat(void) { u32 val; void __iomem *prcmu_status_reg; - if (cpu_is_u8500v20_or_later()) - prcmu_status_reg = (void *)IO_ADDRESS(PRCMU_STATUS_REGISTER_V2); + if (cpu_is_u8500()) + prcmu_status_reg = __io_address(DB8500_PRCMU_STATUS_REGISTER); + else if (cpu_is_u5500()) + prcmu_status_reg = __io_address(DB5500_PRCMU_STATUS_REGISTER); else - prcmu_status_reg = (void *)IO_ADDRESS(PRCMU_STATUS_REGISTER_V1); + ux500_unknown_soc(); val = readl(prcmu_status_reg) & 0xff; diff --git a/arch/arm/mach-ux500/pm/runtime.c b/arch/arm/mach-ux500/pm/runtime.c index 40b360b684b..265faf3085d 100644 --- a/arch/arm/mach-ux500/pm/runtime.c +++ b/arch/arm/mach-ux500/pm/runtime.c @@ -19,7 +19,7 @@ #include <linux/amba/bus.h> #include <linux/clk.h> #include <plat/pincfg.h> -#include <mach/regulator.h> +#include <linux/regulator/dbx500-prcmu.h> #include "../pins.h" diff --git a/arch/arm/mach-ux500/pm/suspend.c b/arch/arm/mach-ux500/pm/suspend.c index 44cd2373cc4..021ee8f53b5 100644 --- a/arch/arm/mach-ux500/pm/suspend.c +++ b/arch/arm/mach-ux500/pm/suspend.c @@ -155,7 +155,7 @@ exit: nmk_gpio_wakeups_resume(); ux500_suspend_dbg_remove_wake_on_uart(); - return 0; + return ret; } static int ux500_suspend_enter(suspend_state_t state) @@ -168,7 +168,8 @@ static int ux500_suspend_enter(suspend_state_t state) if (ux500_suspend_sleep_enabled()) return suspend(false); /* For debugging, if Sleep and DeepSleep disabled, do Idle */ - prcmu_set_power_state(PRCMU_AP_IDLE, true, true); + if (!cpu_is_u5500()) + prcmu_set_power_state(PRCMU_AP_IDLE, true, true); } dsb(); diff --git a/arch/arm/mach-ux500/prcmu-debug.c b/arch/arm/mach-ux500/prcmu-debug.c index 44e7c15bbcf..8344ff36ffb 100644 --- a/arch/arm/mach-ux500/prcmu-debug.c +++ b/arch/arm/mach-ux500/prcmu-debug.c @@ -285,24 +285,19 @@ static ssize_t opp_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos, int prcmu_qos_class) { - char buf[32]; - ssize_t buf_size; - long unsigned int i; + long unsigned i; + int err; - /* Get userspace string and assure termination */ - buf_size = min(count, (sizeof(buf)-1)); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - buf[buf_size] = 0; + err = kstrtoul_from_user(user_buf, count, 0, &i); - if (strict_strtoul(buf, 0, &i) != 0) - return buf_size; + if (err) + return err; prcmu_qos_force_opp(prcmu_qos_class, i); pr_info("prcmu debug: forced OPP for %d to %d\n", prcmu_qos_class, (int)i); - return buf_size; + return count; } static ssize_t ddr_opp_write(struct file *file, @@ -335,20 +330,13 @@ static ssize_t ape_voltage_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { - - char buf[32]; - ssize_t buf_size; - long unsigned int i; + long unsigned i; int err; - /* Get userspace string and assure termination */ - buf_size = min(count, (sizeof(buf)-1)); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - buf[buf_size] = 0; + err = kstrtoul_from_user(user_buf, count, 0, &i); - if (strict_strtoul(buf, 0, &i) != 0) - return buf_size; + if (err) + return err; switch (i) { case 0: @@ -372,33 +360,27 @@ static ssize_t ape_voltage_write(struct file *file, default: pr_info("prcmu debug: value not equal to 0 or 1\n"); } - return buf_size; + return count; } static ssize_t cpufreq_delay_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { + int err; + long unsigned i; - char buf[32]; - ssize_t buf_size; - long unsigned int i; - - /* Get userspace string and assure termination */ - buf_size = min(count, (sizeof(buf)-1)); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - buf[buf_size] = 0; + err = kstrtoul_from_user(user_buf, count, 0, &i); - if (strict_strtoul(buf, 0, &i) != 0) - return buf_size; + if (err) + return err; prcmu_qos_set_cpufreq_opp_delay(i); pr_info("prcmu debug: changed delay between cpufreq change and QoS " "requirement to %lu.\n", i); - return buf_size; + return count; } static int arm_opp_open_file(struct inode *inode, struct file *file) |
