Skip to contentSkip to conversation

Consolidate and clean up the arch/arm/mach-mx5/mm-*.c

PATCH Superseded Jason Liu 4 participants 7 messages Aug 22, 2011 – Aug 29, 2011

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Jason Liu

author
#0 lore raw

cover Consolidate and clean up the arch/arm/mach-mx5/mm-*.c

The two patches work for consolidate and clean up the arch/arm/mach-mx5/mm-*.c

Jason Liu (2):
ARM: i.MX5/mm: Consolidate arch/arm/mach-mx5/mm-*.c
ARM: i.MX5/mm: use static mapping for TZIC

 arch/arm/mach-mx5/Makefile            |    1 -
 arch/arm/mach-mx5/mm-mx50.c           |   72 ---------------------------------
 arch/arm/mach-mx5/mm.c                |   61 +++++++++++++++++++++-------
 arch/arm/plat-mxc/include/mach/mx51.h |    1 +
 arch/arm/plat-mxc/include/mach/mx53.h |    1 +
 5 files changed, 48 insertions(+), 88 deletions(-)
 delete mode 100644 arch/arm/mach-mx5/mm-mx50.c
Signature · 1 line
1.7.4.1
author
#1 lore raw

PATCH 1/2 ARM: i.MX5/mm: Consolidate arch/arm/mach-mx5/mm-*.c

We don't need one seperate file to deal with i.mx50 related stuff, which is very similar with i.mx51/53. We can put it together into one file.So, just merge function from mm-mx50.c to mm.c and remove mm-mx50.c

No function change by this commit.

---
 arch/arm/mach-mx5/Makefile  |    1 -
 arch/arm/mach-mx5/mm-mx50.c |   72 -------------------------------------------
 arch/arm/mach-mx5/mm.c      |   43 +++++++++++++++++++++++++
 3 files changed, 43 insertions(+), 73 deletions(-)
arch/arm/mach-mx5/Makefile +0 -1
index 7f45243..9565304 100644
@@ -4,7 +4,6 @@
 
 # Object file lists.
 obj-y   := cpu.o mm.o clock-mx51-mx53.o ehci.o system.o
-obj-$(CONFIG_SOC_IMX50) += mm-mx50.o
 
 obj-$(CONFIG_PM) += pm-imx5.o
 obj-$(CONFIG_CPU_FREQ_IMX)    += cpu_op-mx51.o
arch/arm/mach-mx5/mm-mx50.c deleted +0 -72

72 lines not on this page · raw message

arch/arm/mach-mx5/mm.c +43 -0

64 lines not on this page · raw message

Signature · 1 line
1.7.4.1
author
#2 lore raw

PATCH 2/2 ARM: i.MX5/mm: use static mapping for TZIC

In reply to Jason Liu

We can use static mapping for TZIC to get rid of the duplicated code for ioremap and the error handling of ioremap, which will made code more clean and consistent.

---
 arch/arm/mach-mx5/mm.c                |   20 ++++----------------
 arch/arm/plat-mxc/include/mach/mx51.h |    1 +
 arch/arm/plat-mxc/include/mach/mx53.h |    1 +
 3 files changed, 6 insertions(+), 16 deletions(-)
arch/arm/mach-mx5/mm.c +4 -16
index f8ebe37..adfe889 100644
@@ -25,6 +25,7 @@
  * Define the MX51 memory map.
  */
 static struct map_desc mx51_io_desc[] __initdata = {
+	imx_map_entry(MX51, TZIC, MT_DEVICE),
 	imx_map_entry(MX51, IRAM, MT_DEVICE),
 	imx_map_entry(MX51, DEBUG, MT_DEVICE),
 	imx_map_entry(MX51, AIPS1, MT_DEVICE),
@@ -36,6 +37,7 @@ static struct map_desc mx51_io_desc[] __initdata = {
  * Define the MX53 memory map.
  */
 static struct map_desc mx53_io_desc[] __initdata = {
+	imx_map_entry(MX53, TZIC, MT_DEVICE),
 	imx_map_entry(MX53, AIPS1, MT_DEVICE),
 	imx_map_entry(MX53, SPBA0, MT_DEVICE),
 	imx_map_entry(MX53, AIPS2, MT_DEVICE),
@@ -100,32 +102,18 @@ void __init imx50_init_early(void)
 void __init mx51_init_irq(void)
 {
 	unsigned long tzic_addr;
-	void __iomem *tzic_virt;
 
 	if (mx51_revision() < IMX_CHIP_REVISION_2_0)
 		tzic_addr = MX51_TZIC_BASE_ADDR_TO1;
 	else
 		tzic_addr = MX51_TZIC_BASE_ADDR;
 
-	tzic_virt = ioremap(tzic_addr, SZ_16K);
-	if (!tzic_virt)
-		panic("unable to map TZIC interrupt controller\n");
-
-	tzic_init_irq(tzic_virt);
+	tzic_init_irq(MX51_IO_ADDRESS(tzic_addr));
 }
 
 void __init mx53_init_irq(void)
 {
-	unsigned long tzic_addr;
-	void __iomem *tzic_virt;
-
-	tzic_addr = MX53_TZIC_BASE_ADDR;
-
-	tzic_virt = ioremap(tzic_addr, SZ_16K);
-	if (!tzic_virt)
-		panic("unable to map TZIC interrupt controller\n");
-
-	tzic_init_irq(tzic_virt);
+	tzic_init_irq(MX53_IO_ADDRESS(MX53_TZIC_BASE_ADDR));
 }
 
 void __init mx50_init_irq(void)
arch/arm/plat-mxc/include/mach/mx51.h +1 -0
index 9666e31..1e74210 100644
@@ -135,6 +135,7 @@
 
 #define MX51_GPU2D_BASE_ADDR		0xd0000000
 #define MX51_TZIC_BASE_ADDR		0xe0000000
+#define MX51_TZIC_SIZE                  SZ_16K
 
 #define MX51_IO_P2V(x)			IMX_IO_P2V(x)
 #define MX51_IO_ADDRESS(x)		IOMEM(MX51_IO_P2V(x))
arch/arm/plat-mxc/include/mach/mx53.h +1 -0
index 5e3c323..fbf2610 100644
@@ -9,6 +9,7 @@
 
 /* TZIC */
 #define MX53_TZIC_BASE_ADDR		0x0FFFC000
+#define MX53_TZIC_SIZE                  SZ_16K
 
 /*
  * AHCI SATA
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH 2/2 ARM: i.MX5/mm: use static mapping for TZIC

Hello Jason,

Quoted 38 lines · Jason Liu

We can use static mapping for TZIC to get rid of the duplicated code for ioremap and the error handling of ioremap, which will made code more clean and consistent.

---
 arch/arm/mach-mx5/mm.c                |   20 ++++----------------
 arch/arm/plat-mxc/include/mach/mx51.h |    1 +
 arch/arm/plat-mxc/include/mach/mx53.h |    1 +
 3 files changed, 6 insertions(+), 16 deletions(-)
arch/arm/mach-mx5/mm.c +2 -1
index f8ebe37..adfe889 100644
@@ -25,6 +25,7 @@
  * Define the MX51 memory map.
  */
 static struct map_desc mx51_io_desc[] __initdata = {
+	imx_map_entry(MX51, TZIC, MT_DEVICE),
 	imx_map_entry(MX51, IRAM, MT_DEVICE),
 	imx_map_entry(MX51, DEBUG, MT_DEVICE),
 	imx_map_entry(MX51, AIPS1, MT_DEVICE),
@@ -36,6 +37,7 @@ static struct map_desc mx51_io_desc[] __initdata = {
  * Define the MX53 memory map.
  */
 static struct map_desc mx53_io_desc[] __initdata = {
+	imx_map_entry(MX53, TZIC, MT_DEVICE),
 	imx_map_entry(MX53, AIPS1, MT_DEVICE),
 	imx_map_entry(MX53, SPBA0, MT_DEVICE),
 	imx_map_entry(MX53, AIPS2, MT_DEVICE),
@@ -100,32 +102,18 @@ void __init imx50_init_early(void)
 void __init mx51_init_irq(void)
 {
 	unsigned long tzic_addr;
-	void __iomem *tzic_virt;
 
 	if (mx51_revision() < IMX_CHIP_REVISION_2_0)

arch/arm/mach-mx5/mm.c void __init imx50_init_early(void) · line 111

Quoted 10 lines
arch/arm/mach-mx5/mm.c +1 -5
 		tzic_addr = MX51_TZIC_BASE_ADDR_TO1;
 	else
 		tzic_addr = MX51_TZIC_BASE_ADDR;
 
-	tzic_virt = ioremap(tzic_addr, SZ_16K);
-	if (!tzic_virt)
-		panic("unable to map TZIC interrupt controller\n");
-
-	tzic_init_irq(tzic_virt);
+	tzic_init_irq(MX51_IO_ADDRESS(tzic_addr));

arch/arm/plat-mxc/include/mach/hardware.h has a list of all SoCs with the memory areas mapped that you are expected to update if you add another mapping. If you had done that, you would have noticed that MX51_TZIC_BASE_ADDR (== 0xe0000000) maps to the very same address as MX51_DEBUG_BASE_ADDR (== 0x60000000).
So only one of these two can be statically mapped (or the function needs to change).

Having said that it would be nice to use a static mapping for TZIC. Do we really need MX51_DEBUG mapped?

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
author
#4 lore raw

PATCH 2/2 ARM: i.MX5/mm: use static mapping for TZIC

Hi, Uwe,

2011/8/23 Uwe Kleine-K?nig <[email protected]>:

Quoted 45 lines

Hello Jason,

Quoted 42 lines · Jason Liu

We can use static mapping for TZIC to get rid of the duplicated code for ioremap and the error handling of ioremap, which will made code more clean and consistent.

---

?arch/arm/mach-mx5/mm.c ? ? ? ? ? ? ? ?| ? 20 ++++----------------
?arch/arm/plat-mxc/include/mach/mx51.h | ? ?1 +
?arch/arm/plat-mxc/include/mach/mx53.h | ? ?1 +

?3 files changed, 6 insertions(+), 16 deletions(-)

arch/arm/mach-mx5/mm.c +0 -0
index f8ebe37..adfe889 100644
@@ -25,6 +25,7 @@

? * Define the MX51 memory map.
? */
?static struct map_desc mx51_io_desc[] __initdata = {
+ ? ? imx_map_entry(MX51, TZIC, MT_DEVICE),
? ? ? imx_map_entry(MX51, IRAM, MT_DEVICE),
? ? ? imx_map_entry(MX51, DEBUG, MT_DEVICE), ? ? ? imx_map_entry(MX51, AIPS1, MT_DEVICE),

arch/arm/mach-mx5/mm.c +0 -0
@@ -36,6 +37,7 @@ static struct map_desc mx51_io_desc[] __initdata = {

? * Define the MX53 memory map.
? */
?static struct map_desc mx53_io_desc[] __initdata = {
+ ? ? imx_map_entry(MX53, TZIC, MT_DEVICE),
? ? ? imx_map_entry(MX53, AIPS1, MT_DEVICE), ? ? ? imx_map_entry(MX53, SPBA0, MT_DEVICE), ? ? ? imx_map_entry(MX53, AIPS2, MT_DEVICE),

arch/arm/mach-mx5/mm.c +0 -1
@@ -100,32 +102,18 @@ void __init imx50_init_early(void)
 ?void __init mx51_init_irq(void)
 ?{
 ? ? ? unsigned long tzic_addr;
- ? ? void __iomem *tzic_virt;
 
 ? ? ? if (mx51_revision() < IMX_CHIP_REVISION_2_0)
 ? ? ? ? ? ? ? tzic_addr = MX51_TZIC_BASE_ADDR_TO1;

? ? ? else
? ? ? ? ? ? ? tzic_addr = MX51_TZIC_BASE_ADDR;

Quoted 13 lines
Quoted 6 lines

- ? ? tzic_virt = ioremap(tzic_addr, SZ_16K);
- ? ? if (!tzic_virt)
- ? ? ? ? ? ? panic("unable to map TZIC interrupt controller\n"); -
- ? ? tzic_init_irq(tzic_virt);
+ ? ? tzic_init_irq(MX51_IO_ADDRESS(tzic_addr));

arch/arm/plat-mxc/include/mach/hardware.h has a list of all SoCs with the memory areas mapped that you are expected to update if you add another mapping. If you had done that, you would have noticed that MX51_TZIC_BASE_ADDR (== 0xe0000000) maps to the very same address as MX51_DEBUG_BASE_ADDR (== 0x60000000).
So only one of these two can be statically mapped (or the function needs to change).

Yes, right. But I think we can get rid of DEBUG mapping, this is useless and no-one
use it. And I also want to clean up the following def, it is dead code.

-#define MX51_DEBUG_BASE_ADDR 0x60000000
-#define MX51_DEBUG_SIZE SZ_1M
-

-#define MX51_ETB_BASE_ADDR             (MX51_DEBUG_BASE_ADDR + 0x01000)
-#define MX51_ETM_BASE_ADDR             (MX51_DEBUG_BASE_ADDR + 0x02000)
-#define MX51_TPIU_BASE_ADDR            (MX51_DEBUG_BASE_ADDR + 0x03000)
-#define MX51_CTI0_BASE_ADDR            (MX51_DEBUG_BASE_ADDR + 0x04000)
-#define MX51_CTI1_BASE_ADDR            (MX51_DEBUG_BASE_ADDR + 0x05000)
-#define MX51_CTI2_BASE_ADDR            (MX51_DEBUG_BASE_ADDR + 0x06000)
-#define MX51_CTI3_BASE_ADDR            (MX51_DEBUG_BASE_ADDR + 0x07000)
-#define MX51_CORTEX_DBG_BASE_ADDR      (MX51_DEBUG_BASE_ADDR + 0x08000)
Quoted 3 lines

Having said that it would be nice to use a static mapping for TZIC. Do we really need MX51_DEBUG mapped?

IMHO, I think we don't need MX51_DEBUG mapping.

I will give one v2 patch to include the above comments if you allow.

Thanks for your review.

Jason

Quoted 8 lines

Best regards
Uwe

--

Pengutronix e.K. ? ? ? ? ? ? ? ? ? ? ? ? ? | Uwe Kleine-K?nig ? ? ? ? ? ?|
Industrial Linux Solutions ? ? ? ? ? ? ? ? | http://www.pengutronix.de/ ?|
#5 lore raw

cover Consolidate and clean up the arch/arm/mach-mx5/mm-*.c

In reply to Jason Liu

Hi, Sascha,

2011/8/22 Jason Liu <[email protected]>:

Quoted 6 lines

The two patches work for consolidate and clean up the arch/arm/mach-mx5/mm-*.c

Jason Liu (2):
?ARM: i.MX5/mm: Consolidate arch/arm/mach-mx5/mm-*.c ?ARM: i.MX5/mm: use static mapping for TZIC

Quoted 7 lines
?arch/arm/mach-mx5/Makefile ? ? ? ? ? ?| ? ?1 -
?arch/arm/mach-mx5/mm-mx50.c ? ? ? ? ? | ? 72 ---------------------------------
?arch/arm/mach-mx5/mm.c ? ? ? ? ? ? ? ?| ? 61 +++++++++++++++++++++-------
?arch/arm/plat-mxc/include/mach/mx51.h | ? ?1 +
?arch/arm/plat-mxc/include/mach/mx53.h | ? ?1 +

?5 files changed, 48 insertions(+), 88 deletions(-) ?delete mode 100644 arch/arm/mach-mx5/mm-mx50.c

Any comments for this patch set?
The patch-set has the v2 version for :i.MX5/mm: use static mapping for TZIC, which addresses
the comments from Uwe, the v2 is referenced here:
http://patchwork.ozlabs.org/patch/111075/

Thanks.

Jason

Quoted 11 lines

--
1.7.4.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#6 lore raw

cover Consolidate and clean up the arch/arm/mach-mx5/mm-*.c

Quoted 1 line · Jason Liu

Any comments for this patch set?

http://article.gmane.org/gmane.linux.ports.arm.kernel/130287

rsc

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 |