ARM: mx3: Remove unneeded ifdef's from mm-imx3.c
Subsystems (3)
PATCH 1/3 ARM: mx3: Remove unneeded ifdef's from mm-imx3.c
As we are already able to build a kernel that can run on mx31 and mx35, there is no need for the ifdef's anymore, so remove them.
--- arch/arm/mach-imx/mm-imx3.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
arch/arm/mach-imx/mm-imx3.c +0 -4
@@ -111,7 +111,6 @@ void imx3_init_l2x0(void)l2x0_init (l2x0_base,0x00030024 ,0x00000000 ); } -#ifdef CONFIG_SOC_IMX31 static struct map_desc mx31_io_desc[]__initdata = {imx_map_entry (MX31 ,X_MEMC ,MT_DEVICE ),imx_map_entry (MX31 ,AVIC ,MT_DEVICE_NONSHARED ),
@@ -176,9 +175,7 @@ void __init imx31_soc_init(void)imx_add_imx_sdma ("imx31-sdma" ,MX31_SDMA_BASE_ADDR ,MX31_INT_SDMA , &imx31_sdma_pdata); } -#endif /* ifdef CONFIG_SOC_IMX31 */ -#ifdef CONFIG_SOC_IMX35 static struct map_desc mx35_io_desc[]__initdata = {imx_map_entry (MX35 ,X_MEMC ,MT_DEVICE ),imx_map_entry (MX35 ,AVIC ,MT_DEVICE_NONSHARED ),
@@ -260,4 +257,3 @@ void __init imx35_soc_init(void)imx_add_imx_sdma ("imx35-sdma" ,MX35_SDMA_BASE_ADDR ,MX35_INT_SDMA , &imx35_sdma_pdata); } -#endif /* ifdef CONFIG_SOC_IMX35 */
Signature · 1 line
1.7.1
PATCH 2/3 ARM: mx3: Let mx31 and mx35 share the same CCM header file
Let mx31 and mx35 share the same CCM header file
---
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
PATCH 3/3 ARM: mx3: Let mx31 and mx35 enter in LPM mode in WFI
In reply to Fabio EstevamThe 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"
--- arch/arm/mach-imx/Makefile | 4 +- arch/arm/mach-imx/crmregs-imx3.h | 1 + arch/arm/mach-imx/mm-imx3.c | 4 ++- arch/arm/mach-imx/pm-imx3.c | 36 +++++++++++++++++++++++++++++++ arch/arm/plat-mxc/include/mach/common.h | 8 +++++++ 5 files changed, 50 insertions(+), 3 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 (cpu_is_mx35() ? (0x1 << 14) : 0)#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 +3 -1
@@ -34,7 +34,8 @@ static void imx3_idle(void) {unsigned long reg =0 ; -if (!need_resched ()) +if (!need_resched ()) { +mx3_cpu_lp_set (MX3_WAIT ); __asm__ __volatile__(/* disable I and D cache */ "mrc p15, 0, %0, c1, c0, 0\n"
@@ -58,6 +59,7 @@ static void imx3_idle(void) "orr %0, %0, #0x00000004\n" "mcr p15, 0, %0, c1, c0, 0\n" : "=r" (reg)); + }local_irq_enable (); }
arch/arm/mach-imx/pm-imx3.c new file +36 -0
@@ -0,0 +1,36 @@ +/* +* 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 : + reg |=MXC_CCM_CCMR_LPM_WAIT ; +__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
Sascha Hauer
maintainerPATCH 3/3 ARM: mx3: Let mx31 and mx35 enter in LPM mode in WFI
Quoted 11 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"
Do you consider this for -rc?
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 |
Fabio Estevam
reviewerPATCH 3/3 ARM: mx3: Let mx31 and mx35 enter in LPM mode in WFI
Quoted 1 line · Sascha Hauer
Do you consider this for -rc?
Yes, please.
Thanks,
Fabio Estevam
PATCH 3/3 ARM: mx3: Let mx31 and mx35 enter in LPM mode in WFI
In reply to Fabio EstevamHi,
Sorry for the late comment, I just saw this patch as I got the pull request from Sascha (I'll comment on that too), but the below sticks out:
Quoted 6 lines · Fabio Estevam
arch/arm/mach-imx/crmregs-imx3.h +0
-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)
Quoted 6 lines
?#define
MXC_CCM_CCMR_LPM_OFFSET? ? ? ? ? ? ? ? 14 ?#defineMXC_CCM_CCMR_LPM_MASK? ? ? ? ? ? ? ? ? (0x3<< 14) +#defineMXC_CCM_CCMR_LPM_WAIT?(cpu_is_mx35() ? (0x1<< 14) : 0) ?#defineMXC_CCM_CCMR_FIRS_OFFSET? ? ? ? ? ? ? ?11 ?#defineMXC_CCM_CCMR_FIRS_MASK? ? ? ? ? ? ? ? ?(0x3 << 11) ?#defineMXC_CCM_CCMR_UPE? ? ? ? ? ? ? ? ? ? ? ?(1 << 9)
This isn't a great idea -- constants like these should be static values. Since this is only used in one location, please just do a runtime check and either mask in the value or not.
Thanks,
-Olof
PATCH 1/3 ARM: mx3: Remove unneeded ifdef's from mm-imx3.c
In reply to Fabio EstevamQuoted 2 lines · Fabio Estevam
As we are already able to build a kernel that can run on mx31 and mx35, there is no need for the ifdef's anymore, so remove them.
They were introduced in commit
87514fc (ARM: imx/mm-imx3: conditionally compile i.MX31 and i.MX35 code)
and the problem was not that we can or cannot do kernels for both mx31 and mx35, but that we also want to do kernels for only one of them. Did you try to build an mx31-only kernel after your change?
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
Fabio Estevam
reviewerPATCH 1/3 ARM: mx3: Remove unneeded ifdef's from mm-imx3.c
Hi Uwe,
2012/1/20 Uwe Kleine-K?nig <[email protected]>:
Quoted 3 lines
and the problem was not that we can or cannot do kernels for both mx31 and mx35, but that we also want to do kernels for only one of them. Did you try to build an mx31-only kernel after your change?
Ok, just tried it and it fails with:
LD .tmp_vmlinux1arch/arm/mach-imx/built-in.o: In function `imx35_init_early':
mach-mx31_3ds.c:(.init.text+0x50): undefined reference to mxc_iomux_v3_init' arch/arm/mach-imx/built-in.o: In function imx35_soc_init':
mach-mx31_3ds.c:(.init.text+0x12c): undefined reference to `mx35_revision'
I think I can solve this build issue by merging cpu-imx31.c and cpu-imx35.c into a single file:cpu-imx3.c, using the same idea as in cpu-imx5.c
Would you like me to do this?
Regards,
Fabio Estevam
PATCH 1/3 ARM: mx3: Remove unneeded ifdef's from mm-imx3.c
Hi Fabio,
Quoted 14 lines · Fabio Estevam
2012/1/20 Uwe Kleine-K?nig <[email protected]>:
Quoted 3 lines
and the problem was not that we can or cannot do kernels for both mx31 and mx35, but that we also want to do kernels for only one of them. Did you try to build an mx31-only kernel after your change?
Ok, just tried it and it fails with:
LD .tmp_vmlinux1
arch/arm/mach-imx/built-in.o: In function `imx35_init_early':
mach-mx31_3ds.c:(.init.text+0x50): undefined reference tomxc_iomux_v3_init' arch/arm/mach-imx/built-in.o: In functionimx35_soc_init':
mach-mx31_3ds.c:(.init.text+0x12c): undefined reference to `mx35_revision'
Quoted 3 lines
I think I can solve this build issue by merging
cpu-imx31.candcpu-imx35.cinto a single file:cpu-imx3.c, using the same idea as incpu-imx5.c
... or by keeping the #ifdefs :-)
Quoted 1 line
Would you like me to do this?
I don't care much and pass the question to Sascha.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
Fabio Estevam
reviewerPATCH 1/3 ARM: mx3: Remove unneeded ifdef's from mm-imx3.c
2012/1/21 Uwe Kleine-K?nig <[email protected]>:
Quoted 1 line
... or by keeping the #ifdefs :-)
Yes, let's keep the #ifdefs
Quoted 2 lines
Quoted 1 line
Would you like me to do this?
I don't care much and pass the question to Sascha.
Ok, let's drop 1/3 for now.
My main goal in this patch series is patch 3/3 that fixes LPM setting on mx35.
Regards,
Fabio Estevam