ARM: mx3: Let mx31 and mx35 share the same CCM header file
Subsystems (3)
Fabio Estevam
reviewerPATCH v2 1/2 ARM: mx3: Let mx31 and mx35 share the same CCM header file
Let mx31 and mx35 share the same CCM header file
---
Changes since v1:
- No changes
arch/arm/mach-imx/clock-imx31.c | 2 +-
arch/arm/mach-imx/clock-imx35.c | 166 +++++++++-----------
.../mach-imx/{crmregs-imx31.h => crmregs-imx3.h} | 15 ++-
arch/arm/mach-imx/mach-armadillo5x0.c | 2 +-
4 files changed, 91 insertions(+), 94 deletions(-)
rename arch/arm/mach-imx/{crmregs-imx31.h => crmregs-imx3.h} (94%)arch/arm/mach-imx/clock-imx31.c +1 -1
@@ -32,7 +32,7 @@#include <mach/mx31.h> #include <mach/common.h> -#include "crmregs-imx31.h" +#include "crmregs-imx3.h" #define PRE_DIV_MIN_FREQ 10000000/* Minimum Frequency after Predivider */
arch/arm/mach-imx/clock-imx35.c +75 -91
275 lines not on this page · raw message
arch/arm/mach-imx/crmregs-imx3.h renamed from arch/arm/mach-imx/crmregs-imx31.h +14 -1
@@ -24,23 +24,36 @@#define CKIH_CLK_FREQ_27MHZ 27000000#define CKIL_CLK_FREQ 32768 -#define MXC_CCM_BASE MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR) +#define MXC_CCM_BASE (cpu_is_mx31() ? \ +MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR) : MX35_IO_ADDRESS(MX35_CCM_BASE_ADDR))/* Register addresses */ #define MXC_CCM_CCMR (MXC_CCM_BASE + 0x00)#define MXC_CCM_PDR0 (MXC_CCM_BASE + 0x04)#define MXC_CCM_PDR1 (MXC_CCM_BASE + 0x08) +#define MX35_CCM_PDR2 (MXC_CCM_BASE + 0x0C)#define MXC_CCM_RCSR (MXC_CCM_BASE + 0x0C) +#define MX35_CCM_PDR3 (MXC_CCM_BASE + 0x10)#define MXC_CCM_MPCTL (MXC_CCM_BASE + 0x10) +#define MX35_CCM_PDR4 (MXC_CCM_BASE + 0x14)#define MXC_CCM_UPCTL (MXC_CCM_BASE + 0x14) +#define MX35_CCM_RCSR (MXC_CCM_BASE + 0x18)#define MXC_CCM_SRPCTL (MXC_CCM_BASE + 0x18) +#define MX35_CCM_MPCTL (MXC_CCM_BASE + 0x1C)#define MXC_CCM_COSR (MXC_CCM_BASE + 0x1C) +#define MX35_CCM_PPCTL (MXC_CCM_BASE + 0x20)#define MXC_CCM_CGR0 (MXC_CCM_BASE + 0x20) +#define MX35_CCM_ACMR (MXC_CCM_BASE + 0x24)#define MXC_CCM_CGR1 (MXC_CCM_BASE + 0x24) +#define MX35_CCM_COSR (MXC_CCM_BASE + 0x28)#define MXC_CCM_CGR2 (MXC_CCM_BASE + 0x28) +#define MX35_CCM_CGR0 (MXC_CCM_BASE + 0x2C)#define MXC_CCM_WIMR (MXC_CCM_BASE + 0x2C) +#define MX35_CCM_CGR1 (MXC_CCM_BASE + 0x30)#define MXC_CCM_LDC (MXC_CCM_BASE + 0x30) +#define MX35_CCM_CGR2 (MXC_CCM_BASE + 0x34)#define MXC_CCM_DCVR0 (MXC_CCM_BASE + 0x34) +#define MX35_CCM_CGR3 (MXC_CCM_BASE + 0x38)#define MXC_CCM_DCVR1 (MXC_CCM_BASE + 0x38)#define MXC_CCM_DCVR2 (MXC_CCM_BASE + 0x3C)#define MXC_CCM_DCVR3 (MXC_CCM_BASE + 0x40)
arch/arm/mach-imx/mach-armadillo5x0.c +1 -1
@@ -51,7 +51,7 @@#include <mach/ulpi.h> #include "devices-imx31.h" -#include "crmregs-imx31.h" +#include "crmregs-imx3.h" static int armadillo5x0_pins[] = {/* UART1 */
Signature · 1 line
1.7.1
Fabio Estevam
reviewerPATCH v2 2/2 ARM: mx3: Let mx31 and mx35 enter in LPM mode in WFI
The LPM field of register CCMR is used to select the mode that the processor will run when it goes to WFI.
When mx31 enters in WFI mode the LPM field is at its reset value of 0, which configures the mx31 to enter in "wait mode".
On mx35, the LPM field on mx35 is also at 0 after reset, which corresponds to "run mode" instead of "wait mode".
Instead of relying on the reset value of LPM to set the low power mode for WFI, configure mx31 and mx35 to run in "wait mode"
---
Changes since v1:
- Make MXC_CCM_CCMR_LPM_WAIT a constant and then check in run-time the CPU type inside function mx3_cpu_lp_set to decide to apply or not the LPM bit.
- Rebased against linux-next
arch/arm/mach-imx/Makefile | 4 +- arch/arm/mach-imx/crmregs-imx3.h | 1 + arch/arm/mach-imx/mm-imx3.c | 1 + arch/arm/mach-imx/pm-imx3.c | 37 +++++++++++++++++++++++++++++++ arch/arm/plat-mxc/include/mach/common.h | 8 ++++++ 5 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-imx/pm-imx3.c
arch/arm/mach-imx/Makefile +2 -2
@@ -8,8 +8,8 @@ obj-$(CONFIG_SOC_IMX25) += clock-imx25.o mm-imx25.o ehci-imx25.o cpu-imx25.o obj-$(CONFIG_SOC_IMX27) += cpu-imx27.o pm-imx27.o obj-$(CONFIG_SOC_IMX27) += clock-imx27.o mm-imx27.o ehci-imx27.o -obj-$(CONFIG_SOC_IMX31) += mm-imx3.o cpu-imx31.o clock-imx31.o iomux-imx31.o ehci-imx31.o -obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o clock-imx35.o ehci-imx35.o +obj-$(CONFIG_SOC_IMX31) += mm-imx3.o cpu-imx31.o clock-imx31.o iomux-imx31.o ehci-imx31.o pm-imx3.o +obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o clock-imx35.o ehci-imx35.o pm-imx3.o obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o mm-imx5.o clock-mx51-mx53.o ehci-imx5.o pm-imx5.o cpu_op-mx51.o
arch/arm/mach-imx/crmregs-imx3.h +1 -0
@@ -77,6 +77,7 @@ MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR) : MX35_IO_ADDRESS(MX35_CCM_BASE_ADDR))#define MXC_CCM_CCMR_SSI2S_MASK (0x3 << 21)#define MXC_CCM_CCMR_LPM_OFFSET 14#define MXC_CCM_CCMR_LPM_MASK (0x3 << 14) +#define MXC_CCM_CCMR_LPM_WAIT_MX35 (0x1 << 14)#define MXC_CCM_CCMR_FIRS_OFFSET 11#define MXC_CCM_CCMR_FIRS_MASK (0x3 << 11)#define MXC_CCM_CCMR_UPE (1 << 9)
arch/arm/mach-imx/mm-imx3.c +1 -0
@@ -34,6 +34,7 @@ static void imx3_idle(void) {unsigned long reg =0 ; +mx3_cpu_lp_set (MX3_WAIT ); __asm__ __volatile__(/* disable I and D cache */ "mrc p15, 0, %0, c1, c0, 0\n"
arch/arm/mach-imx/pm-imx3.c new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Copyright (C) 2012 Freescale Semiconductor, Inc. All Rights Reserved. +* +* The code contained herein is licensed under the GNU General Public +* License. You may obtain a copy of the GNU General Public License +* Version 2 or later@the following locations: +* +* http://www.opensource.org/licenses/gpl-license.html +* http://www.gnu.org/copyleft/gpl.html +*/ +#include <linux/io.h> +#include <mach/common.h> +#include <mach/hardware.h> +#include <mach/devices-common.h> +#include "crmregs-imx3.h" + +/* +* Set cpu low power mode before WFI instruction. This function is called +* mx3 because it can be used for mx31 and mx35. +* Currently only WAIT_MODE is supported. +*/ +void mx3_cpu_lp_set (enum mx3_cpu_pwr_mode mode) +{ +int reg =__raw_readl (MXC_CCM_CCMR ); + reg &= ~MXC_CCM_CCMR_LPM_MASK ; + +switch (mode) { +case MX3_WAIT : +if (cpu_is_mx35 ()) + reg |=MXC_CCM_CCMR_LPM_WAIT_MX35 ; +__raw_writel (reg,MXC_CCM_CCMR ); +break ; +default : +pr_err ("Unknown cpu power mode: %d\n" , mode); +return ; + } +}
arch/arm/plat-mxc/include/mach/common.h +8 -0
@@ -84,6 +84,14 @@ enum mxc_cpu_pwr_mode { STOP_POWER_OFF, /* STOP + SRPG */ }; +enum mx3_cpu_pwr_mode { +MX3_RUN , +MX3_WAIT , +MX3_DOZE , +MX3_SLEEP , +}; + +extern void mx3_cpu_lp_set (enum mx3_cpu_pwr_mode mode);extern void mx5_cpu_lp_set (enum mxc_cpu_pwr_mode mode);extern void imx_print_silicon_rev (const char *cpu,int srev);
Signature · 1 line
1.7.1
PATCH v2 2/2 ARM: mx3: Let mx31 and mx35 enter in LPM mode in WFI
arch/arm/mach-imx/mm-imx3.c static void imx3_idle(void) · line 37
Quoted 9 lines
arch/arm/mach-imx/mm-imx3.c +1
-0@@ -34,6 +34,7 @@ static void imx3_idle(void) {unsigned long reg =0 ; +mx3_cpu_lp_set (MX3_WAIT );
Isn't it supposed to use cpuidle to level the idle state?
Thanks
Richard
Fabio Estevam
reviewerPATCH v2 2/2 ARM: mx3: Let mx31 and mx35 enter in LPM mode in WFI
Quoted 10 lines · Richard Zhao
arch/arm/mach-imx/mm-imx3.c static void imx3_idle(void) · line 37
Quoted 9 lines
arch/arm/mach-imx/mm-imx3.c +1
-0@@ -34,6 +34,7 @@ static void imx3_idle(void) ?{ ? ? ? unsigned long reg = 0; + ? ? mx3_cpu_lp_set(MX3_WAIT);Isn't it supposed to use cpuidle to level the idle state?
I am doing the same as in mx5. Isn't this ok?
Regards,
Fabio Estevam
Fabio Estevam
reviewerPATCH v2 2/2 ARM: mx3: Let mx31 and mx35 enter in LPM mode in WFI
In reply to Fabio EstevamHi Sascha,
Quoted 7 lines · Fabio Estevam
The LPM field of register CCMR is used to select the mode that the processor will run
when it goes to WFI.When mx31 enters in WFI mode the LPM field is at its reset value of 0, which configures the mx31 to enter in "wait mode".
Quoted 8 lines
On mx35, the LPM field on mx35 is also at 0 after reset, which corresponds to "run mode" instead of "wait mode".
Instead of relying on the reset value of LPM to set the low power mode for WFI, configure mx31 and mx35 to run in "wait mode"
Reported-by Benoit Thebaudeau <[email protected]>Signed-off-by Fabio Estevam <[email protected]>
I saw that you applied 1/2, but not 2/2.
Is there anything I should rework in this patch?
Regards,
Fabio Estevam
Sascha Hauer
maintainerPATCH v2 2/2 ARM: mx3: Let mx31 and mx35 enter in LPM mode in WFI
Quoted 16 lines · Fabio Estevam
Hi Sascha,
Quoted 13 lines · Fabio Estevam
The LPM field of register CCMR is used to select the mode that the processor will run
when it goes to WFI.When mx31 enters in WFI mode the LPM field is at its reset value of 0, which configures the mx31 to enter in "wait mode".
On mx35, the LPM field on mx35 is also at 0 after reset, which corresponds to "run mode" instead of "wait mode".
Instead of relying on the reset value of LPM to set the low power mode for WFI, configure mx31 and mx35 to run in "wait mode"
Quoted 6 lines
Quoted 2 lines
Reported-by Benoit Thebaudeau <[email protected]>Signed-off-by Fabio Estevam <[email protected]>I saw that you applied 1/2, but not 2/2.
Is there anything I should rework in this patch?
Nope, I just lost it. I'll queue it.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |