Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'ux500-multiplatform-mfd' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson

MFD portions of the ux500 multiplatform branch.
A second tag for the ARM SoC tree will build upon
this one. This mainly removes the header file
dependencies from the PRCMU driver in the MFD
subsystem, and moves the PM functions to the
machine.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

+452 -415
+1 -1
arch/arm/mach-ux500/Makefile
··· 3 3 # 4 4 5 5 obj-y := cpu.o devices.o devices-common.o \ 6 - id.o usb.o timer.o 6 + id.o usb.o timer.o pm.o 7 7 obj-$(CONFIG_CPU_IDLE) += cpuidle.o 8 8 obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o 9 9 obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o
-58
arch/arm/mach-ux500/board-mop500.c
··· 206 206 .codec = &ab8500_codec_pdata, 207 207 }; 208 208 209 - /* 210 - * Thermal Sensor 211 - */ 212 - 213 - static 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 - 228 - static 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 - 257 - static 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 - 266 209 static struct platform_device u8500_cpufreq_cooling_device = { 267 210 .name = "db8500-cpufreq-cooling", 268 211 }; ··· 565 622 &snowball_key_dev, 566 623 &snowball_sbnet_dev, 567 624 &snowball_gpio_en_3v3_regulator_dev, 568 - &u8500_thsens_device, 569 625 &u8500_cpufreq_cooling_device, 570 626 }; 571 627
-2
arch/arm/mach-ux500/cpu-db8500.c
··· 94 94 iotable_init(u9540_io_desc, ARRAY_SIZE(u9540_io_desc)); 95 95 else 96 96 iotable_init(u8500_io_desc, ARRAY_SIZE(u8500_io_desc)); 97 - 98 - _PRCMU_BASE = __io_address(U8500_PRCMU_BASE); 99 97 } 100 98 101 99 static struct resource db8500_pmu_resources[] = {
+13 -8
arch/arm/mach-ux500/cpu.c
··· 8 8 9 9 #include <linux/platform_device.h> 10 10 #include <linux/io.h> 11 - #include <linux/mfd/db8500-prcmu.h> 11 + #include <linux/mfd/dbx500-prcmu.h> 12 12 #include <linux/clksrc-dbx500-prcmu.h> 13 13 #include <linux/sys_soc.h> 14 14 #include <linux/err.h> ··· 20 20 #include <linux/irqchip.h> 21 21 #include <linux/irqchip/arm-gic.h> 22 22 #include <linux/platform_data/clk-ux500.h> 23 + #include <linux/platform_data/arm-ux500-pm.h> 23 24 24 25 #include <asm/mach/map.h> 25 26 ··· 30 29 31 30 #include "board-mop500.h" 32 31 #include "id.h" 33 - 34 - void __iomem *_PRCMU_BASE; 35 32 36 33 /* 37 34 * FIXME: Should we set up the GPIO domain here? ··· 67 68 * Init clocks here so that they are available for system timer 68 69 * initialization. 69 70 */ 70 - if (cpu_is_u8500_family() || cpu_is_u9540()) 71 - db8500_prcmu_early_init(); 72 - 73 - if (cpu_is_u8500_family() || cpu_is_u9540()) 71 + if (cpu_is_u8500_family()) { 72 + prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1); 73 + ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1); 74 74 u8500_clk_init(); 75 - else if (cpu_is_u8540()) 75 + } else if (cpu_is_u9540()) { 76 + prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1); 77 + ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1); 78 + u8500_clk_init(); 79 + } else if (cpu_is_u8540()) { 80 + prcmu_early_init(U8500_PRCMU_BASE, SZ_8K + SZ_4K - 1); 81 + ux500_pm_init(U8500_PRCMU_BASE, SZ_8K + SZ_4K - 1); 76 82 u8540_clk_init(); 83 + } 77 84 } 78 85 79 86 void __init ux500_init_late(void)
+2 -1
arch/arm/mach-ux500/cpuidle.c
··· 16 16 #include <linux/atomic.h> 17 17 #include <linux/smp.h> 18 18 #include <linux/mfd/dbx500-prcmu.h> 19 + #include <linux/platform_data/arm-ux500-pm.h> 19 20 20 21 #include <asm/cpuidle.h> 21 22 #include <asm/proc-fns.h> ··· 131 130 int ret, cpu; 132 131 struct cpuidle_device *device; 133 132 134 - /* Configure wake up reasons */ 133 + /* Configure wake up reasons */ 135 134 prcmu_enable_wakeups(PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) | 136 135 PRCMU_WAKEUP(ABB)); 137 136
+2
arch/arm/mach-ux500/devices-db8500.c
··· 199 199 200 200 struct prcmu_pdata db8500_prcmu_pdata = { 201 201 .ab_platdata = &ab8500_platdata, 202 + .ab_irq = IRQ_DB8500_AB8500, 203 + .irq_base = IRQ_PRCMU_BASE, 202 204 .version_offset = DB8500_PRCMU_FW_VERSION_OFFSET, 203 205 .legacy_offset = DB8500_PRCMU_LEGACY_OFFSET, 204 206 };
-2
arch/arm/mach-ux500/include/mach/hardware.h
··· 39 39 40 40 #ifndef __ASSEMBLY__ 41 41 42 - extern void __iomem *_PRCMU_BASE; 43 - 44 42 #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) 45 43 46 44 #endif /* __ASSEMBLY__ */
-25
arch/arm/mach-ux500/include/mach/irqs-db8500.h
··· 109 109 110 110 /* Virtual interrupts corresponding to the PRCMU wakeups. */ 111 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 112 #define IRQ_PRCMU_END (IRQ_PRCMU_BASE + 23) 138 113 139 114 /*
+167
arch/arm/mach-ux500/pm.c
··· 1 + /* 2 + * Copyright (C) ST-Ericsson SA 2010-2013 3 + * Author: Rickard Andersson <rickard.andersson@stericsson.com> for 4 + * ST-Ericsson. 5 + * Author: Daniel Lezcano <daniel.lezcano@linaro.org> for Linaro. 6 + * License terms: GNU General Public License (GPL) version 2 7 + * 8 + */ 9 + 10 + #include <linux/kernel.h> 11 + #include <linux/irqchip/arm-gic.h> 12 + #include <linux/delay.h> 13 + #include <linux/io.h> 14 + #include <linux/platform_data/arm-ux500-pm.h> 15 + 16 + #include <mach/hardware.h> 17 + 18 + /* ARM WFI Standby signal register */ 19 + #define PRCM_ARM_WFI_STANDBY (prcmu_base + 0x130) 20 + #define PRCM_ARM_WFI_STANDBY_WFI0 0x08 21 + #define PRCM_ARM_WFI_STANDBY_WFI1 0x10 22 + #define PRCM_IOCR (prcmu_base + 0x310) 23 + #define PRCM_IOCR_IOFORCE 0x1 24 + 25 + /* Dual A9 core interrupt management unit registers */ 26 + #define PRCM_A9_MASK_REQ (prcmu_base + 0x328) 27 + #define PRCM_A9_MASK_REQ_PRCM_A9_MASK_REQ 0x1 28 + 29 + #define PRCM_A9_MASK_ACK (prcmu_base + 0x32c) 30 + #define PRCM_ARMITMSK31TO0 (prcmu_base + 0x11c) 31 + #define PRCM_ARMITMSK63TO32 (prcmu_base + 0x120) 32 + #define PRCM_ARMITMSK95TO64 (prcmu_base + 0x124) 33 + #define PRCM_ARMITMSK127TO96 (prcmu_base + 0x128) 34 + #define PRCM_POWER_STATE_VAL (prcmu_base + 0x25C) 35 + #define PRCM_ARMITVAL31TO0 (prcmu_base + 0x260) 36 + #define PRCM_ARMITVAL63TO32 (prcmu_base + 0x264) 37 + #define PRCM_ARMITVAL95TO64 (prcmu_base + 0x268) 38 + #define PRCM_ARMITVAL127TO96 (prcmu_base + 0x26C) 39 + 40 + static void __iomem *prcmu_base; 41 + 42 + /* This function decouple the gic from the prcmu */ 43 + int prcmu_gic_decouple(void) 44 + { 45 + u32 val = readl(PRCM_A9_MASK_REQ); 46 + 47 + /* Set bit 0 register value to 1 */ 48 + writel(val | PRCM_A9_MASK_REQ_PRCM_A9_MASK_REQ, 49 + PRCM_A9_MASK_REQ); 50 + 51 + /* Make sure the register is updated */ 52 + readl(PRCM_A9_MASK_REQ); 53 + 54 + /* Wait a few cycles for the gic mask completion */ 55 + udelay(1); 56 + 57 + return 0; 58 + } 59 + 60 + /* This function recouple the gic with the prcmu */ 61 + int prcmu_gic_recouple(void) 62 + { 63 + u32 val = readl(PRCM_A9_MASK_REQ); 64 + 65 + /* Set bit 0 register value to 0 */ 66 + writel(val & ~PRCM_A9_MASK_REQ_PRCM_A9_MASK_REQ, PRCM_A9_MASK_REQ); 67 + 68 + return 0; 69 + } 70 + 71 + #define PRCMU_GIC_NUMBER_REGS 5 72 + 73 + /* 74 + * This function checks if there are pending irq on the gic. It only 75 + * makes sense if the gic has been decoupled before with the 76 + * db8500_prcmu_gic_decouple function. Disabling an interrupt only 77 + * disables the forwarding of the interrupt to any CPU interface. It 78 + * does not prevent the interrupt from changing state, for example 79 + * becoming pending, or active and pending if it is already 80 + * active. Hence, we have to check the interrupt is pending *and* is 81 + * active. 82 + */ 83 + bool prcmu_gic_pending_irq(void) 84 + { 85 + u32 pr; /* Pending register */ 86 + u32 er; /* Enable register */ 87 + void __iomem *dist_base = __io_address(U8500_GIC_DIST_BASE); 88 + int i; 89 + 90 + /* 5 registers. STI & PPI not skipped */ 91 + for (i = 0; i < PRCMU_GIC_NUMBER_REGS; i++) { 92 + 93 + pr = readl_relaxed(dist_base + GIC_DIST_PENDING_SET + i * 4); 94 + er = readl_relaxed(dist_base + GIC_DIST_ENABLE_SET + i * 4); 95 + 96 + if (pr & er) 97 + return true; /* There is a pending interrupt */ 98 + } 99 + 100 + return false; 101 + } 102 + 103 + /* 104 + * This function checks if there are pending interrupt on the 105 + * prcmu which has been delegated to monitor the irqs with the 106 + * db8500_prcmu_copy_gic_settings function. 107 + */ 108 + bool prcmu_pending_irq(void) 109 + { 110 + u32 it, im; 111 + int i; 112 + 113 + for (i = 0; i < PRCMU_GIC_NUMBER_REGS - 1; i++) { 114 + it = readl(PRCM_ARMITVAL31TO0 + i * 4); 115 + im = readl(PRCM_ARMITMSK31TO0 + i * 4); 116 + if (it & im) 117 + return true; /* There is a pending interrupt */ 118 + } 119 + 120 + return false; 121 + } 122 + 123 + /* 124 + * This function checks if the specified cpu is in in WFI. It's usage 125 + * makes sense only if the gic is decoupled with the db8500_prcmu_gic_decouple 126 + * function. Of course passing smp_processor_id() to this function will 127 + * always return false... 128 + */ 129 + bool prcmu_is_cpu_in_wfi(int cpu) 130 + { 131 + return readl(PRCM_ARM_WFI_STANDBY) & cpu ? PRCM_ARM_WFI_STANDBY_WFI1 : 132 + PRCM_ARM_WFI_STANDBY_WFI0; 133 + } 134 + 135 + /* 136 + * This function copies the gic SPI settings to the prcmu in order to 137 + * monitor them and abort/finish the retention/off sequence or state. 138 + */ 139 + int prcmu_copy_gic_settings(void) 140 + { 141 + u32 er; /* Enable register */ 142 + void __iomem *dist_base = __io_address(U8500_GIC_DIST_BASE); 143 + int i; 144 + 145 + /* We skip the STI and PPI */ 146 + for (i = 0; i < PRCMU_GIC_NUMBER_REGS - 1; i++) { 147 + er = readl_relaxed(dist_base + 148 + GIC_DIST_ENABLE_SET + (i + 1) * 4); 149 + writel(er, PRCM_ARMITMSK31TO0 + i * 4); 150 + } 151 + 152 + return 0; 153 + } 154 + 155 + void __init ux500_pm_init(u32 phy_base, u32 size) 156 + { 157 + prcmu_base = ioremap(phy_base, size); 158 + if (!prcmu_base) { 159 + pr_err("could not remap PRCMU for PM functions\n"); 160 + return; 161 + } 162 + /* 163 + * On watchdog reboot the GIC is in some cases decoupled. 164 + * This will make sure that the GIC is correctly configured. 165 + */ 166 + prcmu_gic_recouple(); 167 + }
+152 -164
drivers/mfd/db8500-prcmu.c
··· 26 26 #include <linux/fs.h> 27 27 #include <linux/platform_device.h> 28 28 #include <linux/uaccess.h> 29 - #include <linux/irqchip/arm-gic.h> 30 29 #include <linux/mfd/core.h> 31 30 #include <linux/mfd/dbx500-prcmu.h> 32 31 #include <linux/mfd/abx500/ab8500.h> ··· 33 34 #include <linux/regulator/machine.h> 34 35 #include <linux/cpufreq.h> 35 36 #include <linux/platform_data/ux500_wdt.h> 36 - #include <mach/hardware.h> 37 - #include <mach/irqs.h> 38 - #include <mach/db8500-regs.h> 37 + #include <linux/platform_data/db8500_thermal.h> 39 38 #include "dbx500-prcmu-regs.h" 40 39 41 40 /* Index of different voltages to be used when accessing AVSData */ ··· 273 276 * the bits in the bit field are not. (The bits also have a tendency to move 274 277 * around, to further complicate matters.) 275 278 */ 276 - #define IRQ_INDEX(_name) ((IRQ_PRCMU_##_name) - IRQ_PRCMU_BASE) 279 + #define IRQ_INDEX(_name) ((IRQ_PRCMU_##_name)) 277 280 #define IRQ_ENTRY(_name)[IRQ_INDEX(_name)] = (WAKEUP_BIT_##_name) 281 + 282 + #define IRQ_PRCMU_RTC 0 283 + #define IRQ_PRCMU_RTT0 1 284 + #define IRQ_PRCMU_RTT1 2 285 + #define IRQ_PRCMU_HSI0 3 286 + #define IRQ_PRCMU_HSI1 4 287 + #define IRQ_PRCMU_CA_WAKE 5 288 + #define IRQ_PRCMU_USB 6 289 + #define IRQ_PRCMU_ABB 7 290 + #define IRQ_PRCMU_ABB_FIFO 8 291 + #define IRQ_PRCMU_ARM 9 292 + #define IRQ_PRCMU_MODEM_SW_RESET_REQ 10 293 + #define IRQ_PRCMU_GPIO0 11 294 + #define IRQ_PRCMU_GPIO1 12 295 + #define IRQ_PRCMU_GPIO2 13 296 + #define IRQ_PRCMU_GPIO3 14 297 + #define IRQ_PRCMU_GPIO4 15 298 + #define IRQ_PRCMU_GPIO5 16 299 + #define IRQ_PRCMU_GPIO6 17 300 + #define IRQ_PRCMU_GPIO7 18 301 + #define IRQ_PRCMU_GPIO8 19 302 + #define IRQ_PRCMU_CA_SLEEP 20 303 + #define IRQ_PRCMU_HOTMON_LOW 21 304 + #define IRQ_PRCMU_HOTMON_HIGH 22 305 + #define NUM_PRCMU_WAKEUPS 23 306 + 278 307 static u32 prcmu_irq_bit[NUM_PRCMU_WAKEUPS] = { 279 308 IRQ_ENTRY(RTC), 280 309 IRQ_ENTRY(RTT0), ··· 445 422 446 423 /* Global var to runtime determine TCDM base for v2 or v1 */ 447 424 static __iomem void *tcdm_base; 425 + static __iomem void *prcmu_base; 448 426 449 427 struct clk_mgt { 450 - void __iomem *reg; 428 + u32 offset; 451 429 u32 pllsw; 452 430 int branch; 453 431 bool clk38div; ··· 623 599 while ((readl(PRCM_SEM) & PRCM_SEM_PRCM_SEM) != 0) 624 600 cpu_relax(); 625 601 626 - writel(PRCMU_DSI_CLOCK_SETTING, PRCM_HDMICLK_MGT); 627 - writel(PRCMU_DSI_LP_CLOCK_SETTING, PRCM_TVCLK_MGT); 628 - writel(PRCMU_DPI_CLOCK_SETTING, PRCM_LCDCLK_MGT); 602 + writel(PRCMU_DSI_CLOCK_SETTING, prcmu_base + PRCM_HDMICLK_MGT); 603 + writel(PRCMU_DSI_LP_CLOCK_SETTING, prcmu_base + PRCM_TVCLK_MGT); 604 + writel(PRCMU_DPI_CLOCK_SETTING, prcmu_base + PRCM_LCDCLK_MGT); 629 605 630 606 /* Release the HW semaphore. */ 631 607 writel(0, PRCM_SEM); ··· 637 613 638 614 u32 db8500_prcmu_read(unsigned int reg) 639 615 { 640 - return readl(_PRCMU_BASE + reg); 616 + return readl(prcmu_base + reg); 641 617 } 642 618 643 619 void db8500_prcmu_write(unsigned int reg, u32 value) ··· 645 621 unsigned long flags; 646 622 647 623 spin_lock_irqsave(&prcmu_lock, flags); 648 - writel(value, (_PRCMU_BASE + reg)); 624 + writel(value, (prcmu_base + reg)); 649 625 spin_unlock_irqrestore(&prcmu_lock, flags); 650 626 } 651 627 ··· 655 631 unsigned long flags; 656 632 657 633 spin_lock_irqsave(&prcmu_lock, flags); 658 - val = readl(_PRCMU_BASE + reg); 634 + val = readl(prcmu_base + reg); 659 635 val = ((val & ~mask) | (value & mask)); 660 - writel(val, (_PRCMU_BASE + reg)); 636 + writel(val, (prcmu_base + reg)); 661 637 spin_unlock_irqrestore(&prcmu_lock, flags); 662 638 } 663 639 ··· 817 793 return readb(tcdm_base + PRCM_ACK_MB0_AP_PWRSTTR_STATUS); 818 794 } 819 795 820 - /* This function decouple the gic from the prcmu */ 821 - int db8500_prcmu_gic_decouple(void) 822 - { 823 - u32 val = readl(PRCM_A9_MASK_REQ); 824 - 825 - /* Set bit 0 register value to 1 */ 826 - writel(val | PRCM_A9_MASK_REQ_PRCM_A9_MASK_REQ, 827 - PRCM_A9_MASK_REQ); 828 - 829 - /* Make sure the register is updated */ 830 - readl(PRCM_A9_MASK_REQ); 831 - 832 - /* Wait a few cycles for the gic mask completion */ 833 - udelay(1); 834 - 835 - return 0; 836 - } 837 - 838 - /* This function recouple the gic with the prcmu */ 839 - int db8500_prcmu_gic_recouple(void) 840 - { 841 - u32 val = readl(PRCM_A9_MASK_REQ); 842 - 843 - /* Set bit 0 register value to 0 */ 844 - writel(val & ~PRCM_A9_MASK_REQ_PRCM_A9_MASK_REQ, PRCM_A9_MASK_REQ); 845 - 846 - return 0; 847 - } 848 - 849 - #define PRCMU_GIC_NUMBER_REGS 5 850 - 851 - /* 852 - * This function checks if there are pending irq on the gic. It only 853 - * makes sense if the gic has been decoupled before with the 854 - * db8500_prcmu_gic_decouple function. Disabling an interrupt only 855 - * disables the forwarding of the interrupt to any CPU interface. It 856 - * does not prevent the interrupt from changing state, for example 857 - * becoming pending, or active and pending if it is already 858 - * active. Hence, we have to check the interrupt is pending *and* is 859 - * active. 860 - */ 861 - bool db8500_prcmu_gic_pending_irq(void) 862 - { 863 - u32 pr; /* Pending register */ 864 - u32 er; /* Enable register */ 865 - void __iomem *dist_base = __io_address(U8500_GIC_DIST_BASE); 866 - int i; 867 - 868 - /* 5 registers. STI & PPI not skipped */ 869 - for (i = 0; i < PRCMU_GIC_NUMBER_REGS; i++) { 870 - 871 - pr = readl_relaxed(dist_base + GIC_DIST_PENDING_SET + i * 4); 872 - er = readl_relaxed(dist_base + GIC_DIST_ENABLE_SET + i * 4); 873 - 874 - if (pr & er) 875 - return true; /* There is a pending interrupt */ 876 - } 877 - 878 - return false; 879 - } 880 - 881 - /* 882 - * This function checks if there are pending interrupt on the 883 - * prcmu which has been delegated to monitor the irqs with the 884 - * db8500_prcmu_copy_gic_settings function. 885 - */ 886 - bool db8500_prcmu_pending_irq(void) 887 - { 888 - u32 it, im; 889 - int i; 890 - 891 - for (i = 0; i < PRCMU_GIC_NUMBER_REGS - 1; i++) { 892 - it = readl(PRCM_ARMITVAL31TO0 + i * 4); 893 - im = readl(PRCM_ARMITMSK31TO0 + i * 4); 894 - if (it & im) 895 - return true; /* There is a pending interrupt */ 896 - } 897 - 898 - return false; 899 - } 900 - 901 - /* 902 - * This function checks if the specified cpu is in in WFI. It's usage 903 - * makes sense only if the gic is decoupled with the db8500_prcmu_gic_decouple 904 - * function. Of course passing smp_processor_id() to this function will 905 - * always return false... 906 - */ 907 - bool db8500_prcmu_is_cpu_in_wfi(int cpu) 908 - { 909 - return readl(PRCM_ARM_WFI_STANDBY) & cpu ? PRCM_ARM_WFI_STANDBY_WFI1 : 910 - PRCM_ARM_WFI_STANDBY_WFI0; 911 - } 912 - 913 - /* 914 - * This function copies the gic SPI settings to the prcmu in order to 915 - * monitor them and abort/finish the retention/off sequence or state. 916 - */ 917 - int db8500_prcmu_copy_gic_settings(void) 918 - { 919 - u32 er; /* Enable register */ 920 - void __iomem *dist_base = __io_address(U8500_GIC_DIST_BASE); 921 - int i; 922 - 923 - /* We skip the STI and PPI */ 924 - for (i = 0; i < PRCMU_GIC_NUMBER_REGS - 1; i++) { 925 - er = readl_relaxed(dist_base + 926 - GIC_DIST_ENABLE_SET + (i + 1) * 4); 927 - writel(er, PRCM_ARMITMSK31TO0 + i * 4); 928 - } 929 - 930 - return 0; 931 - } 932 - 933 796 /* This function should only be called while mb0_transfer.lock is held. */ 934 797 static void config_wakeups(void) 935 798 { ··· 970 1059 /* Divide the frequency of certain clocks by 2 for APE_50_PARTLY_25_OPP. */ 971 1060 static void request_even_slower_clocks(bool enable) 972 1061 { 973 - void __iomem *clock_reg[] = { 1062 + u32 clock_reg[] = { 974 1063 PRCM_ACLK_MGT, 975 1064 PRCM_DMACLK_MGT 976 1065 }; ··· 987 1076 u32 val; 988 1077 u32 div; 989 1078 990 - val = readl(clock_reg[i]); 1079 + val = readl(prcmu_base + clock_reg[i]); 991 1080 div = (val & PRCM_CLK_MGT_CLKPLLDIV_MASK); 992 1081 if (enable) { 993 1082 if ((div <= 1) || (div > 15)) { ··· 1003 1092 } 1004 1093 val = ((val & ~PRCM_CLK_MGT_CLKPLLDIV_MASK) | 1005 1094 (div & PRCM_CLK_MGT_CLKPLLDIV_MASK)); 1006 - writel(val, clock_reg[i]); 1095 + writel(val, prcmu_base + clock_reg[i]); 1007 1096 } 1008 1097 1009 1098 unlock_and_return: ··· 1357 1446 while ((readl(PRCM_SEM) & PRCM_SEM_PRCM_SEM) != 0) 1358 1447 cpu_relax(); 1359 1448 1360 - val = readl(clk_mgt[clock].reg); 1449 + val = readl(prcmu_base + clk_mgt[clock].offset); 1361 1450 if (enable) { 1362 1451 val |= (PRCM_CLK_MGT_CLKEN | clk_mgt[clock].pllsw); 1363 1452 } else { 1364 1453 clk_mgt[clock].pllsw = (val & PRCM_CLK_MGT_CLKPLLSW_MASK); 1365 1454 val &= ~(PRCM_CLK_MGT_CLKEN | PRCM_CLK_MGT_CLKPLLSW_MASK); 1366 1455 } 1367 - writel(val, clk_mgt[clock].reg); 1456 + writel(val, prcmu_base + clk_mgt[clock].offset); 1368 1457 1369 1458 /* Release the HW semaphore. */ 1370 1459 writel(0, PRCM_SEM); ··· 1540 1629 u32 pllsw; 1541 1630 unsigned long rate = ROOT_CLOCK_RATE; 1542 1631 1543 - val = readl(clk_mgt[clock].reg); 1632 + val = readl(prcmu_base + clk_mgt[clock].offset); 1544 1633 1545 1634 if (val & PRCM_CLK_MGT_CLK38) { 1546 1635 if (clk_mgt[clock].clk38div && (val & PRCM_CLK_MGT_CLK38DIV)) ··· 1696 1785 unsigned long src_rate; 1697 1786 long rounded_rate; 1698 1787 1699 - val = readl(clk_mgt[clock].reg); 1788 + val = readl(prcmu_base + clk_mgt[clock].offset); 1700 1789 src_rate = clock_source_rate((val | clk_mgt[clock].pllsw), 1701 1790 clk_mgt[clock].branch); 1702 1791 div = clock_divider(src_rate, rate); ··· 1844 1933 while ((readl(PRCM_SEM) & PRCM_SEM_PRCM_SEM) != 0) 1845 1934 cpu_relax(); 1846 1935 1847 - val = readl(clk_mgt[clock].reg); 1936 + val = readl(prcmu_base + clk_mgt[clock].offset); 1848 1937 src_rate = clock_source_rate((val | clk_mgt[clock].pllsw), 1849 1938 clk_mgt[clock].branch); 1850 1939 div = clock_divider(src_rate, rate); ··· 1872 1961 val &= ~PRCM_CLK_MGT_CLKPLLDIV_MASK; 1873 1962 val |= min(div, (u32)31); 1874 1963 } 1875 - writel(val, clk_mgt[clock].reg); 1964 + writel(val, prcmu_base + clk_mgt[clock].offset); 1876 1965 1877 1966 /* Release the HW semaphore. */ 1878 1967 writel(0, PRCM_SEM); ··· 2675 2764 .xlate = irq_domain_xlate_twocell, 2676 2765 }; 2677 2766 2678 - static int db8500_irq_init(struct device_node *np) 2767 + static int db8500_irq_init(struct device_node *np, int irq_base) 2679 2768 { 2680 - int irq_base = 0; 2681 2769 int i; 2682 2770 2683 2771 /* In the device tree case, just take some IRQs */ 2684 - if (!np) 2685 - irq_base = IRQ_PRCMU_BASE; 2772 + if (np) 2773 + irq_base = 0; 2686 2774 2687 2775 db8500_irq_domain = irq_domain_add_simple( 2688 2776 np, NUM_PRCMU_WAKEUPS, irq_base, ··· 2735 2825 } 2736 2826 } 2737 2827 2738 - void __init db8500_prcmu_early_init(void) 2828 + void __init db8500_prcmu_early_init(u32 phy_base, u32 size) 2739 2829 { 2830 + /* 2831 + * This is a temporary remap to bring up the clocks. It is 2832 + * subsequently replaces with a real remap. After the merge of 2833 + * the mailbox subsystem all of this early code goes away, and the 2834 + * clock driver can probe independently. An early initcall will 2835 + * still be needed, but it can be diverted into drivers/clk/ux500. 2836 + */ 2837 + prcmu_base = ioremap(phy_base, size); 2838 + if (!prcmu_base) 2839 + pr_err("%s: ioremap() of prcmu registers failed!\n", __func__); 2840 + 2740 2841 spin_lock_init(&mb0_transfer.lock); 2741 2842 spin_lock_init(&mb0_transfer.dbb_irqs_lock); 2742 2843 mutex_init(&mb0_transfer.ac_wake_lock); ··· 3013 3092 }, 3014 3093 }; 3015 3094 3016 - static struct resource ab8500_resources[] = { 3017 - [0] = { 3018 - .start = IRQ_DB8500_AB8500, 3019 - .end = IRQ_DB8500_AB8500, 3020 - .flags = IORESOURCE_IRQ 3021 - } 3022 - }; 3023 - 3024 3095 static struct ux500_wdt_data db8500_wdt_pdata = { 3025 3096 .timeout = 600, /* 10 minutes */ 3026 3097 .has_28_bits_resolution = true, 3098 + }; 3099 + /* 3100 + * Thermal Sensor 3101 + */ 3102 + 3103 + static struct resource db8500_thsens_resources[] = { 3104 + { 3105 + .name = "IRQ_HOTMON_LOW", 3106 + .start = IRQ_PRCMU_HOTMON_LOW, 3107 + .end = IRQ_PRCMU_HOTMON_LOW, 3108 + .flags = IORESOURCE_IRQ, 3109 + }, 3110 + { 3111 + .name = "IRQ_HOTMON_HIGH", 3112 + .start = IRQ_PRCMU_HOTMON_HIGH, 3113 + .end = IRQ_PRCMU_HOTMON_HIGH, 3114 + .flags = IORESOURCE_IRQ, 3115 + }, 3116 + }; 3117 + 3118 + static struct db8500_thsens_platform_data db8500_thsens_data = { 3119 + .trip_points[0] = { 3120 + .temp = 70000, 3121 + .type = THERMAL_TRIP_ACTIVE, 3122 + .cdev_name = { 3123 + [0] = "thermal-cpufreq-0", 3124 + }, 3125 + }, 3126 + .trip_points[1] = { 3127 + .temp = 75000, 3128 + .type = THERMAL_TRIP_ACTIVE, 3129 + .cdev_name = { 3130 + [0] = "thermal-cpufreq-0", 3131 + }, 3132 + }, 3133 + .trip_points[2] = { 3134 + .temp = 80000, 3135 + .type = THERMAL_TRIP_ACTIVE, 3136 + .cdev_name = { 3137 + [0] = "thermal-cpufreq-0", 3138 + }, 3139 + }, 3140 + .trip_points[3] = { 3141 + .temp = 85000, 3142 + .type = THERMAL_TRIP_CRITICAL, 3143 + }, 3144 + .num_trips = 4, 3027 3145 }; 3028 3146 3029 3147 static struct mfd_cell db8500_prcmu_devs[] = { ··· 3085 3125 .id = -1, 3086 3126 }, 3087 3127 { 3088 - .name = "ab8500-core", 3089 - .of_compatible = "stericsson,ab8500", 3090 - .num_resources = ARRAY_SIZE(ab8500_resources), 3091 - .resources = ab8500_resources, 3092 - .id = AB8500_VERSION_AB8500, 3128 + .name = "db8500-thermal", 3129 + .num_resources = ARRAY_SIZE(db8500_thsens_resources), 3130 + .resources = db8500_thsens_resources, 3131 + .platform_data = &db8500_thsens_data, 3093 3132 }, 3094 3133 }; 3095 3134 ··· 3100 3141 } 3101 3142 } 3102 3143 3144 + static int db8500_prcmu_register_ab8500(struct device *parent, 3145 + struct ab8500_platform_data *pdata, 3146 + int irq) 3147 + { 3148 + struct resource ab8500_resource = DEFINE_RES_IRQ(irq); 3149 + struct mfd_cell ab8500_cell = { 3150 + .name = "ab8500-core", 3151 + .of_compatible = "stericsson,ab8500", 3152 + .id = AB8500_VERSION_AB8500, 3153 + .platform_data = pdata, 3154 + .pdata_size = sizeof(struct ab8500_platform_data), 3155 + .resources = &ab8500_resource, 3156 + .num_resources = 1, 3157 + }; 3158 + 3159 + return mfd_add_devices(parent, 0, &ab8500_cell, 1, NULL, 0, NULL); 3160 + } 3161 + 3103 3162 /** 3104 3163 * prcmu_fw_init - arch init call for the Linux PRCMU fw init logic 3105 3164 * ··· 3126 3149 { 3127 3150 struct device_node *np = pdev->dev.of_node; 3128 3151 struct prcmu_pdata *pdata = dev_get_platdata(&pdev->dev); 3129 - int irq = 0, err = 0, i; 3152 + int irq = 0, err = 0; 3130 3153 struct resource *res; 3131 3154 3155 + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu"); 3156 + if (!res) { 3157 + dev_err(&pdev->dev, "no prcmu memory region provided\n"); 3158 + return -ENOENT; 3159 + } 3160 + prcmu_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); 3161 + if (!prcmu_base) { 3162 + dev_err(&pdev->dev, 3163 + "failed to ioremap prcmu register memory\n"); 3164 + return -ENOENT; 3165 + } 3132 3166 init_prcm_registers(); 3133 - 3134 3167 dbx500_fw_version_init(pdev, pdata->version_offset); 3135 3168 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu-tcdm"); 3136 3169 if (!res) { ··· 3167 3180 goto no_irq_return; 3168 3181 } 3169 3182 3170 - db8500_irq_init(np); 3171 - 3172 - for (i = 0; i < ARRAY_SIZE(db8500_prcmu_devs); i++) { 3173 - if (!strcmp(db8500_prcmu_devs[i].name, "ab8500-core")) { 3174 - db8500_prcmu_devs[i].platform_data = pdata->ab_platdata; 3175 - db8500_prcmu_devs[i].pdata_size = sizeof(struct ab8500_platform_data); 3176 - } 3177 - } 3183 + db8500_irq_init(np, pdata->irq_base); 3178 3184 3179 3185 prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET); 3180 3186 3181 3187 db8500_prcmu_update_cpufreq(); 3182 3188 3183 3189 err = mfd_add_devices(&pdev->dev, 0, db8500_prcmu_devs, 3184 - ARRAY_SIZE(db8500_prcmu_devs), NULL, 0, NULL); 3190 + ARRAY_SIZE(db8500_prcmu_devs), NULL, 0, db8500_irq_domain); 3185 3191 if (err) { 3186 3192 pr_err("prcmu: Failed to add subdevices\n"); 3187 3193 return err; 3194 + } 3195 + 3196 + err = db8500_prcmu_register_ab8500(&pdev->dev, pdata->ab_platdata, 3197 + pdata->ab_irq); 3198 + if (err) { 3199 + mfd_remove_devices(&pdev->dev); 3200 + pr_err("prcmu: Failed to add ab8500 subdevice\n"); 3201 + goto no_irq_return; 3188 3202 } 3189 3203 3190 3204 pr_info("DB8500 PRCMU initialized\n");
+87 -113
drivers/mfd/dbx500-prcmu-regs.h
··· 13 13 #ifndef __DB8500_PRCMU_REGS_H 14 14 #define __DB8500_PRCMU_REGS_H 15 15 16 - #include <mach/hardware.h> 17 - 18 16 #define BITS(_start, _end) ((BIT(_end) - BIT(_start)) + BIT(_end)) 19 17 20 - #define PRCM_CLK_MGT(_offset) (void __iomem *)(IO_ADDRESS(U8500_PRCMU_BASE) \ 21 - + _offset) 22 - #define PRCM_ACLK_MGT PRCM_CLK_MGT(0x004) 23 - #define PRCM_SVACLK_MGT PRCM_CLK_MGT(0x008) 24 - #define PRCM_SIACLK_MGT PRCM_CLK_MGT(0x00C) 25 - #define PRCM_SGACLK_MGT PRCM_CLK_MGT(0x014) 26 - #define PRCM_UARTCLK_MGT PRCM_CLK_MGT(0x018) 27 - #define PRCM_MSP02CLK_MGT PRCM_CLK_MGT(0x01C) 28 - #define PRCM_I2CCLK_MGT PRCM_CLK_MGT(0x020) 29 - #define PRCM_SDMMCCLK_MGT PRCM_CLK_MGT(0x024) 30 - #define PRCM_SLIMCLK_MGT PRCM_CLK_MGT(0x028) 31 - #define PRCM_PER1CLK_MGT PRCM_CLK_MGT(0x02C) 32 - #define PRCM_PER2CLK_MGT PRCM_CLK_MGT(0x030) 33 - #define PRCM_PER3CLK_MGT PRCM_CLK_MGT(0x034) 34 - #define PRCM_PER5CLK_MGT PRCM_CLK_MGT(0x038) 35 - #define PRCM_PER6CLK_MGT PRCM_CLK_MGT(0x03C) 36 - #define PRCM_PER7CLK_MGT PRCM_CLK_MGT(0x040) 37 - #define PRCM_LCDCLK_MGT PRCM_CLK_MGT(0x044) 38 - #define PRCM_BMLCLK_MGT PRCM_CLK_MGT(0x04C) 39 - #define PRCM_HSITXCLK_MGT PRCM_CLK_MGT(0x050) 40 - #define PRCM_HSIRXCLK_MGT PRCM_CLK_MGT(0x054) 41 - #define PRCM_HDMICLK_MGT PRCM_CLK_MGT(0x058) 42 - #define PRCM_APEATCLK_MGT PRCM_CLK_MGT(0x05C) 43 - #define PRCM_APETRACECLK_MGT PRCM_CLK_MGT(0x060) 44 - #define PRCM_MCDECLK_MGT PRCM_CLK_MGT(0x064) 45 - #define PRCM_IPI2CCLK_MGT PRCM_CLK_MGT(0x068) 46 - #define PRCM_DSIALTCLK_MGT PRCM_CLK_MGT(0x06C) 47 - #define PRCM_DMACLK_MGT PRCM_CLK_MGT(0x074) 48 - #define PRCM_B2R2CLK_MGT PRCM_CLK_MGT(0x078) 49 - #define PRCM_TVCLK_MGT PRCM_CLK_MGT(0x07C) 50 - #define PRCM_UNIPROCLK_MGT PRCM_CLK_MGT(0x278) 51 - #define PRCM_SSPCLK_MGT PRCM_CLK_MGT(0x280) 52 - #define PRCM_RNGCLK_MGT PRCM_CLK_MGT(0x284) 53 - #define PRCM_UICCCLK_MGT PRCM_CLK_MGT(0x27C) 54 - #define PRCM_MSP1CLK_MGT PRCM_CLK_MGT(0x288) 18 + #define PRCM_ACLK_MGT (0x004) 19 + #define PRCM_SVACLK_MGT (0x008) 20 + #define PRCM_SIACLK_MGT (0x00C) 21 + #define PRCM_SGACLK_MGT (0x014) 22 + #define PRCM_UARTCLK_MGT (0x018) 23 + #define PRCM_MSP02CLK_MGT (0x01C) 24 + #define PRCM_I2CCLK_MGT (0x020) 25 + #define PRCM_SDMMCCLK_MGT (0x024) 26 + #define PRCM_SLIMCLK_MGT (0x028) 27 + #define PRCM_PER1CLK_MGT (0x02C) 28 + #define PRCM_PER2CLK_MGT (0x030) 29 + #define PRCM_PER3CLK_MGT (0x034) 30 + #define PRCM_PER5CLK_MGT (0x038) 31 + #define PRCM_PER6CLK_MGT (0x03C) 32 + #define PRCM_PER7CLK_MGT (0x040) 33 + #define PRCM_LCDCLK_MGT (0x044) 34 + #define PRCM_BMLCLK_MGT (0x04C) 35 + #define PRCM_HSITXCLK_MGT (0x050) 36 + #define PRCM_HSIRXCLK_MGT (0x054) 37 + #define PRCM_HDMICLK_MGT (0x058) 38 + #define PRCM_APEATCLK_MGT (0x05C) 39 + #define PRCM_APETRACECLK_MGT (0x060) 40 + #define PRCM_MCDECLK_MGT (0x064) 41 + #define PRCM_IPI2CCLK_MGT (0x068) 42 + #define PRCM_DSIALTCLK_MGT (0x06C) 43 + #define PRCM_DMACLK_MGT (0x074) 44 + #define PRCM_B2R2CLK_MGT (0x078) 45 + #define PRCM_TVCLK_MGT (0x07C) 46 + #define PRCM_UNIPROCLK_MGT (0x278) 47 + #define PRCM_SSPCLK_MGT (0x280) 48 + #define PRCM_RNGCLK_MGT (0x284) 49 + #define PRCM_UICCCLK_MGT (0x27C) 50 + #define PRCM_MSP1CLK_MGT (0x288) 55 51 56 - #define PRCM_ARM_PLLDIVPS (_PRCMU_BASE + 0x118) 52 + #define PRCM_ARM_PLLDIVPS (prcmu_base + 0x118) 57 53 #define PRCM_ARM_PLLDIVPS_ARM_BRM_RATE 0x3f 58 54 #define PRCM_ARM_PLLDIVPS_MAX_MASK 0xf 59 55 60 - #define PRCM_PLLARM_LOCKP (_PRCMU_BASE + 0x0a8) 56 + #define PRCM_PLLARM_LOCKP (prcmu_base + 0x0a8) 61 57 #define PRCM_PLLARM_LOCKP_PRCM_PLLARM_LOCKP3 0x2 62 58 63 - #define PRCM_ARM_CHGCLKREQ (_PRCMU_BASE + 0x114) 59 + #define PRCM_ARM_CHGCLKREQ (prcmu_base + 0x114) 64 60 #define PRCM_ARM_CHGCLKREQ_PRCM_ARM_CHGCLKREQ BIT(0) 65 61 #define PRCM_ARM_CHGCLKREQ_PRCM_ARM_DIVSEL BIT(16) 66 62 67 - #define PRCM_PLLARM_ENABLE (_PRCMU_BASE + 0x98) 63 + #define PRCM_PLLARM_ENABLE (prcmu_base + 0x98) 68 64 #define PRCM_PLLARM_ENABLE_PRCM_PLLARM_ENABLE 0x1 69 65 #define PRCM_PLLARM_ENABLE_PRCM_PLLARM_COUNTON 0x100 70 66 71 - #define PRCM_ARMCLKFIX_MGT (_PRCMU_BASE + 0x0) 72 - #define PRCM_A9PL_FORCE_CLKEN (_PRCMU_BASE + 0x19C) 73 - #define PRCM_A9_RESETN_CLR (_PRCMU_BASE + 0x1f4) 74 - #define PRCM_A9_RESETN_SET (_PRCMU_BASE + 0x1f0) 75 - #define PRCM_ARM_LS_CLAMP (_PRCMU_BASE + 0x30c) 76 - #define PRCM_SRAM_A9 (_PRCMU_BASE + 0x308) 67 + #define PRCM_ARMCLKFIX_MGT (prcmu_base + 0x0) 68 + #define PRCM_A9PL_FORCE_CLKEN (prcmu_base + 0x19C) 69 + #define PRCM_A9_RESETN_CLR (prcmu_base + 0x1f4) 70 + #define PRCM_A9_RESETN_SET (prcmu_base + 0x1f0) 71 + #define PRCM_ARM_LS_CLAMP (prcmu_base + 0x30c) 72 + #define PRCM_SRAM_A9 (prcmu_base + 0x308) 77 73 78 74 #define PRCM_A9PL_FORCE_CLKEN_PRCM_A9PL_FORCE_CLKEN BIT(0) 79 75 #define PRCM_A9PL_FORCE_CLKEN_PRCM_A9AXI_FORCE_CLKEN BIT(1) 80 76 81 - /* ARM WFI Standby signal register */ 82 - #define PRCM_ARM_WFI_STANDBY (_PRCMU_BASE + 0x130) 83 - #define PRCM_ARM_WFI_STANDBY_WFI0 0x08 84 - #define PRCM_ARM_WFI_STANDBY_WFI1 0x10 85 - #define PRCM_IOCR (_PRCMU_BASE + 0x310) 86 - #define PRCM_IOCR_IOFORCE 0x1 87 - 88 77 /* CPU mailbox registers */ 89 - #define PRCM_MBOX_CPU_VAL (_PRCMU_BASE + 0x0fc) 90 - #define PRCM_MBOX_CPU_SET (_PRCMU_BASE + 0x100) 91 - #define PRCM_MBOX_CPU_CLR (_PRCMU_BASE + 0x104) 78 + #define PRCM_MBOX_CPU_VAL (prcmu_base + 0x0fc) 79 + #define PRCM_MBOX_CPU_SET (prcmu_base + 0x100) 80 + #define PRCM_MBOX_CPU_CLR (prcmu_base + 0x104) 92 81 93 - /* Dual A9 core interrupt management unit registers */ 94 - #define PRCM_A9_MASK_REQ (_PRCMU_BASE + 0x328) 95 - #define PRCM_A9_MASK_REQ_PRCM_A9_MASK_REQ 0x1 96 - 97 - #define PRCM_A9_MASK_ACK (_PRCMU_BASE + 0x32c) 98 - #define PRCM_ARMITMSK31TO0 (_PRCMU_BASE + 0x11c) 99 - #define PRCM_ARMITMSK63TO32 (_PRCMU_BASE + 0x120) 100 - #define PRCM_ARMITMSK95TO64 (_PRCMU_BASE + 0x124) 101 - #define PRCM_ARMITMSK127TO96 (_PRCMU_BASE + 0x128) 102 - #define PRCM_POWER_STATE_VAL (_PRCMU_BASE + 0x25C) 103 - #define PRCM_ARMITVAL31TO0 (_PRCMU_BASE + 0x260) 104 - #define PRCM_ARMITVAL63TO32 (_PRCMU_BASE + 0x264) 105 - #define PRCM_ARMITVAL95TO64 (_PRCMU_BASE + 0x268) 106 - #define PRCM_ARMITVAL127TO96 (_PRCMU_BASE + 0x26C) 107 - 108 - #define PRCM_HOSTACCESS_REQ (_PRCMU_BASE + 0x334) 82 + #define PRCM_HOSTACCESS_REQ (prcmu_base + 0x334) 109 83 #define PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ 0x1 110 84 #define PRCM_HOSTACCESS_REQ_WAKE_REQ BIT(16) 111 85 #define ARM_WAKEUP_MODEM 0x1 112 86 113 - #define PRCM_ARM_IT1_CLR (_PRCMU_BASE + 0x48C) 114 - #define PRCM_ARM_IT1_VAL (_PRCMU_BASE + 0x494) 115 - #define PRCM_HOLD_EVT (_PRCMU_BASE + 0x174) 87 + #define PRCM_ARM_IT1_CLR (prcmu_base + 0x48C) 88 + #define PRCM_ARM_IT1_VAL (prcmu_base + 0x494) 89 + #define PRCM_HOLD_EVT (prcmu_base + 0x174) 116 90 117 - #define PRCM_MOD_AWAKE_STATUS (_PRCMU_BASE + 0x4A0) 91 + #define PRCM_MOD_AWAKE_STATUS (prcmu_base + 0x4A0) 118 92 #define PRCM_MOD_AWAKE_STATUS_PRCM_MOD_COREPD_AWAKE BIT(0) 119 93 #define PRCM_MOD_AWAKE_STATUS_PRCM_MOD_AAPD_AWAKE BIT(1) 120 94 #define PRCM_MOD_AWAKE_STATUS_PRCM_MOD_VMODEM_OFF_ISO BIT(2) 121 95 122 - #define PRCM_ITSTATUS0 (_PRCMU_BASE + 0x148) 123 - #define PRCM_ITSTATUS1 (_PRCMU_BASE + 0x150) 124 - #define PRCM_ITSTATUS2 (_PRCMU_BASE + 0x158) 125 - #define PRCM_ITSTATUS3 (_PRCMU_BASE + 0x160) 126 - #define PRCM_ITSTATUS4 (_PRCMU_BASE + 0x168) 127 - #define PRCM_ITSTATUS5 (_PRCMU_BASE + 0x484) 128 - #define PRCM_ITCLEAR5 (_PRCMU_BASE + 0x488) 129 - #define PRCM_ARMIT_MASKXP70_IT (_PRCMU_BASE + 0x1018) 96 + #define PRCM_ITSTATUS0 (prcmu_base + 0x148) 97 + #define PRCM_ITSTATUS1 (prcmu_base + 0x150) 98 + #define PRCM_ITSTATUS2 (prcmu_base + 0x158) 99 + #define PRCM_ITSTATUS3 (prcmu_base + 0x160) 100 + #define PRCM_ITSTATUS4 (prcmu_base + 0x168) 101 + #define PRCM_ITSTATUS5 (prcmu_base + 0x484) 102 + #define PRCM_ITCLEAR5 (prcmu_base + 0x488) 103 + #define PRCM_ARMIT_MASKXP70_IT (prcmu_base + 0x1018) 130 104 131 105 /* System reset register */ 132 - #define PRCM_APE_SOFTRST (_PRCMU_BASE + 0x228) 106 + #define PRCM_APE_SOFTRST (prcmu_base + 0x228) 133 107 134 108 /* Level shifter and clamp control registers */ 135 - #define PRCM_MMIP_LS_CLAMP_SET (_PRCMU_BASE + 0x420) 136 - #define PRCM_MMIP_LS_CLAMP_CLR (_PRCMU_BASE + 0x424) 109 + #define PRCM_MMIP_LS_CLAMP_SET (prcmu_base + 0x420) 110 + #define PRCM_MMIP_LS_CLAMP_CLR (prcmu_base + 0x424) 137 111 138 112 #define PRCM_MMIP_LS_CLAMP_DSIPLL_CLAMP BIT(11) 139 113 #define PRCM_MMIP_LS_CLAMP_DSIPLL_CLAMPI BIT(22) 140 114 141 115 /* PRCMU clock/PLL/reset registers */ 142 - #define PRCM_PLLSOC0_FREQ (_PRCMU_BASE + 0x080) 143 - #define PRCM_PLLSOC1_FREQ (_PRCMU_BASE + 0x084) 144 - #define PRCM_PLLARM_FREQ (_PRCMU_BASE + 0x088) 145 - #define PRCM_PLLDDR_FREQ (_PRCMU_BASE + 0x08C) 116 + #define PRCM_PLLSOC0_FREQ (prcmu_base + 0x080) 117 + #define PRCM_PLLSOC1_FREQ (prcmu_base + 0x084) 118 + #define PRCM_PLLARM_FREQ (prcmu_base + 0x088) 119 + #define PRCM_PLLDDR_FREQ (prcmu_base + 0x08C) 146 120 #define PRCM_PLL_FREQ_D_SHIFT 0 147 121 #define PRCM_PLL_FREQ_D_MASK BITS(0, 7) 148 122 #define PRCM_PLL_FREQ_N_SHIFT 8 ··· 126 152 #define PRCM_PLL_FREQ_SELDIV2 BIT(24) 127 153 #define PRCM_PLL_FREQ_DIV2EN BIT(25) 128 154 129 - #define PRCM_PLLDSI_FREQ (_PRCMU_BASE + 0x500) 130 - #define PRCM_PLLDSI_ENABLE (_PRCMU_BASE + 0x504) 131 - #define PRCM_PLLDSI_LOCKP (_PRCMU_BASE + 0x508) 132 - #define PRCM_DSI_PLLOUT_SEL (_PRCMU_BASE + 0x530) 133 - #define PRCM_DSITVCLK_DIV (_PRCMU_BASE + 0x52C) 134 - #define PRCM_PLLDSI_LOCKP (_PRCMU_BASE + 0x508) 135 - #define PRCM_APE_RESETN_SET (_PRCMU_BASE + 0x1E4) 136 - #define PRCM_APE_RESETN_CLR (_PRCMU_BASE + 0x1E8) 155 + #define PRCM_PLLDSI_FREQ (prcmu_base + 0x500) 156 + #define PRCM_PLLDSI_ENABLE (prcmu_base + 0x504) 157 + #define PRCM_PLLDSI_LOCKP (prcmu_base + 0x508) 158 + #define PRCM_DSI_PLLOUT_SEL (prcmu_base + 0x530) 159 + #define PRCM_DSITVCLK_DIV (prcmu_base + 0x52C) 160 + #define PRCM_PLLDSI_LOCKP (prcmu_base + 0x508) 161 + #define PRCM_APE_RESETN_SET (prcmu_base + 0x1E4) 162 + #define PRCM_APE_RESETN_CLR (prcmu_base + 0x1E8) 137 163 138 164 #define PRCM_PLLDSI_ENABLE_PRCM_PLLDSI_ENABLE BIT(0) 139 165 ··· 162 188 163 189 #define PRCM_APE_RESETN_DSIPLL_RESETN BIT(14) 164 190 165 - #define PRCM_CLKOCR (_PRCMU_BASE + 0x1CC) 191 + #define PRCM_CLKOCR (prcmu_base + 0x1CC) 166 192 #define PRCM_CLKOCR_CLKOUT0_REF_CLK (1 << 0) 167 193 #define PRCM_CLKOCR_CLKOUT0_MASK BITS(0, 13) 168 194 #define PRCM_CLKOCR_CLKOUT1_REF_CLK (1 << 16) 169 195 #define PRCM_CLKOCR_CLKOUT1_MASK BITS(16, 29) 170 196 171 197 /* ePOD and memory power signal control registers */ 172 - #define PRCM_EPOD_C_SET (_PRCMU_BASE + 0x410) 173 - #define PRCM_SRAM_LS_SLEEP (_PRCMU_BASE + 0x304) 198 + #define PRCM_EPOD_C_SET (prcmu_base + 0x410) 199 + #define PRCM_SRAM_LS_SLEEP (prcmu_base + 0x304) 174 200 175 201 /* Debug power control unit registers */ 176 - #define PRCM_POWER_STATE_SET (_PRCMU_BASE + 0x254) 202 + #define PRCM_POWER_STATE_SET (prcmu_base + 0x254) 177 203 178 204 /* Miscellaneous unit registers */ 179 - #define PRCM_DSI_SW_RESET (_PRCMU_BASE + 0x324) 180 - #define PRCM_GPIOCR (_PRCMU_BASE + 0x138) 205 + #define PRCM_DSI_SW_RESET (prcmu_base + 0x324) 206 + #define PRCM_GPIOCR (prcmu_base + 0x138) 181 207 #define PRCM_GPIOCR_DBG_STM_MOD_CMD1 0x800 182 208 #define PRCM_GPIOCR_DBG_UARTMOD_CMD0 0x1 183 209 184 210 /* PRCMU HW semaphore */ 185 - #define PRCM_SEM (_PRCMU_BASE + 0x400) 211 + #define PRCM_SEM (prcmu_base + 0x400) 186 212 #define PRCM_SEM_PRCM_SEM BIT(0) 187 213 188 - #define PRCM_TCR (_PRCMU_BASE + 0x1C8) 214 + #define PRCM_TCR (prcmu_base + 0x1C8) 189 215 #define PRCM_TCR_TENSEL_MASK BITS(0, 7) 190 216 #define PRCM_TCR_STOP_TIMERS BIT(16) 191 217 #define PRCM_TCR_DOZE_MODE BIT(17) ··· 213 239 /* GPIOCR register */ 214 240 #define PRCM_GPIOCR_SPI2_SELECT BIT(23) 215 241 216 - #define PRCM_DDR_SUBSYS_APE_MINBW (_PRCMU_BASE + 0x438) 217 - #define PRCM_CGATING_BYPASS (_PRCMU_BASE + 0x134) 242 + #define PRCM_DDR_SUBSYS_APE_MINBW (prcmu_base + 0x438) 243 + #define PRCM_CGATING_BYPASS (prcmu_base + 0x134) 218 244 #define PRCM_CGATING_BYPASS_ICN2 BIT(6) 219 245 220 246 /* Miscellaneous unit registers */ 221 - #define PRCM_RESOUTN_SET (_PRCMU_BASE + 0x214) 222 - #define PRCM_RESOUTN_CLR (_PRCMU_BASE + 0x218) 247 + #define PRCM_RESOUTN_SET (prcmu_base + 0x214) 248 + #define PRCM_RESOUTN_CLR (prcmu_base + 0x218) 223 249 224 250 /* System reset register */ 225 - #define PRCM_APE_SOFTRST (_PRCMU_BASE + 0x228) 251 + #define PRCM_APE_SOFTRST (prcmu_base + 0x228) 226 252 227 253 #endif /* __DB8500_PRCMU_REGS_H */
+2 -8
include/linux/mfd/db8500-prcmu.h
··· 489 489 490 490 #ifdef CONFIG_MFD_DB8500_PRCMU 491 491 492 - void db8500_prcmu_early_init(void); 492 + void db8500_prcmu_early_init(u32 phy_base, u32 size); 493 493 int prcmu_set_rc_a2p(enum romcode_write); 494 494 enum romcode_read prcmu_get_rc_p2a(void); 495 495 enum ap_pwrst prcmu_get_xp70_current_state(void); ··· 522 522 void db8500_prcmu_system_reset(u16 reset_code); 523 523 int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll); 524 524 u8 db8500_prcmu_get_power_state_result(void); 525 - int db8500_prcmu_gic_decouple(void); 526 - int db8500_prcmu_gic_recouple(void); 527 - int db8500_prcmu_copy_gic_settings(void); 528 - bool db8500_prcmu_gic_pending_irq(void); 529 - bool db8500_prcmu_pending_irq(void); 530 - bool db8500_prcmu_is_cpu_in_wfi(int cpu); 531 525 void db8500_prcmu_enable_wakeups(u32 wakeups); 532 526 int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state); 533 527 int db8500_prcmu_request_clock(u8 clock, bool enable); ··· 547 553 548 554 #else /* !CONFIG_MFD_DB8500_PRCMU */ 549 555 550 - static inline void db8500_prcmu_early_init(void) {} 556 + static inline void db8500_prcmu_early_init(u32 phy_base, u32 size) {} 551 557 552 558 static inline int prcmu_set_rc_a2p(enum romcode_write code) 553 559 {
+5 -33
include/linux/mfd/dbx500-prcmu.h
··· 237 237 bool enable_set_ddr_opp; 238 238 bool enable_ape_opp_100_voltage; 239 239 struct ab8500_platform_data *ab_platdata; 240 + int ab_irq; 241 + int irq_base; 240 242 u32 version_offset; 241 243 u32 legacy_offset; 242 244 u32 adt_offset; ··· 278 276 279 277 #if defined(CONFIG_UX500_SOC_DB8500) 280 278 281 - static inline void __init prcmu_early_init(void) 279 + static inline void prcmu_early_init(u32 phy_base, u32 size) 282 280 { 283 - return db8500_prcmu_early_init(); 281 + return db8500_prcmu_early_init(phy_base, size); 284 282 } 285 283 286 284 static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, ··· 293 291 static inline u8 prcmu_get_power_state_result(void) 294 292 { 295 293 return db8500_prcmu_get_power_state_result(); 296 - } 297 - 298 - static inline int prcmu_gic_decouple(void) 299 - { 300 - return db8500_prcmu_gic_decouple(); 301 - } 302 - 303 - static inline int prcmu_gic_recouple(void) 304 - { 305 - return db8500_prcmu_gic_recouple(); 306 - } 307 - 308 - static inline bool prcmu_gic_pending_irq(void) 309 - { 310 - return db8500_prcmu_gic_pending_irq(); 311 - } 312 - 313 - static inline bool prcmu_is_cpu_in_wfi(int cpu) 314 - { 315 - return db8500_prcmu_is_cpu_in_wfi(cpu); 316 - } 317 - 318 - static inline int prcmu_copy_gic_settings(void) 319 - { 320 - return db8500_prcmu_copy_gic_settings(); 321 - } 322 - 323 - static inline bool prcmu_pending_irq(void) 324 - { 325 - return db8500_prcmu_pending_irq(); 326 294 } 327 295 328 296 static inline int prcmu_set_epod(u16 epod_id, u8 epod_state) ··· 472 500 } 473 501 #else 474 502 475 - static inline void __init prcmu_early_init(void) {} 503 + static inline void prcmu_early_init(u32 phy_base, u32 size) {} 476 504 477 505 static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, 478 506 bool keep_ap_pll)
+21
include/linux/platform_data/arm-ux500-pm.h
··· 1 + /* 2 + * Copyright (C) ST-Ericsson SA 2010-2013 3 + * Author: Rickard Andersson <rickard.andersson@stericsson.com> for 4 + * ST-Ericsson. 5 + * Author: Daniel Lezcano <daniel.lezcano@linaro.org> for Linaro. 6 + * License terms: GNU General Public License (GPL) version 2 7 + * 8 + */ 9 + 10 + #ifndef ARM_UX500_PM_H 11 + #define ARM_UX500_PM_H 12 + 13 + int prcmu_gic_decouple(void); 14 + int prcmu_gic_recouple(void); 15 + bool prcmu_gic_pending_irq(void); 16 + bool prcmu_pending_irq(void); 17 + bool prcmu_is_cpu_in_wfi(int cpu); 18 + int prcmu_copy_gic_settings(void); 19 + void ux500_pm_init(u32 phy_base, u32 size); 20 + 21 + #endif /* ARM_UX500_PM_H */