Skip to contentSkip to conversation

mx1: fix build when DEBUG_LL is enabled

PATCH New Baruch Siach 4 participants 25 messages Mar 9, 2010 – Oct 26, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mx1: fix build when DEBUG_LL is enabled

Commit "mx1: prefix SOC specific defines with MX1_ and deprecate old names" redefined the IO_ADDRESS macro in a way that is incompatible with debug-macro.S. Reintroduce AVIC_IO_ADDRESS, and use it in debug-macro.S.

---
 arch/arm/plat-mxc/include/mach/debug-macro.S |    2 +-
 arch/arm/plat-mxc/include/mach/mx1.h         |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)
arch/arm/plat-mxc/include/mach/debug-macro.S +1 -1
index 133d66b..8f82ff4 100644
@@ -15,7 +15,7 @@
 #ifdef CONFIG_ARCH_MX1
 #include <mach/mx1.h>
 #define UART_PADDR	UART1_BASE_ADDR
-#define UART_VADDR	IO_ADDRESS(UART1_BASE_ADDR)
+#define UART_VADDR	AVIC_IO_ADDRESS(UART1_BASE_ADDR)
 #endif
 
 #ifdef CONFIG_ARCH_MX25
arch/arm/plat-mxc/include/mach/mx1.h +4 -1
index 5eba7e6..37d3560 100644
@@ -72,6 +72,10 @@
 #define MX1_AVIC_BASE_ADDR		(0x23000 + MX1_IO_BASE_ADDR)
 #define MX1_CSI_BASE_ADDR		(0x24000 + MX1_IO_BASE_ADDR)
 
+/* define macro needed for entry-macro.S */
+#define AVIC_IO_ADDRESS(x)	((x) - MX1_IO_BASE_ADDR			\
+		+ MX1_IO_BASE_ADDR_VIRT)
+
 /* macro to get at IO space when running virtually */
 #define MX1_IO_ADDRESS(x) (						\
 	IMX_IO_ADDRESS(x, MX1_IO))
@@ -213,7 +217,6 @@
 #define AVIC_BASE_ADDR MX1_AVIC_BASE_ADDR
 #define CSI_BASE_ADDR MX1_CSI_BASE_ADDR
 #define IO_ADDRESS(x) MX1_IO_ADDRESS(x)
-#define AVIC_IO_ADDRESS(x) IO_ADDRESS(x)
 #define INT_SOFTINT MX1_INT_SOFTINT
 #define CSI_INT MX1_CSI_INT
 #define DSPA_MAC_INT MX1_DSPA_MAC_INT
Signature · 1 line
1.7.0
#1 lore raw

PATCH 2/2 mx25: fix build when DEBUG_LL is enabled

From: Alex Greshgorin <[email protected]>

Commit "imx25: redefine MX25_IO_ADDRESS using IMX_IO_ADDRESS" removed the MX25_AIPS1_IO_ADDRESS macro which is used in debug-macro.S. Reintroduce this macro.

---
 arch/arm/plat-mxc/include/mach/mx25.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/plat-mxc/include/mach/mx25.h +4 -0
index 4eb6e33..e2e35db 100644
@@ -22,6 +22,10 @@
 #define MX25_GPIO3_BASE_ADDR_VIRT	(MX25_AIPS2_BASE_ADDR_VIRT + 0xa4000)
 #define MX25_GPIO4_BASE_ADDR_VIRT	(MX25_AIPS2_BASE_ADDR_VIRT + 0x9c000)
 
+/* define macro needed for debug-macro.S */
+#define MX25_AIPS1_IO_ADDRESS(x)	\
+	(((x) - MX25_AIPS1_BASE_ADDR) + MX25_AIPS1_BASE_ADDR_VIRT)
+
 #define MX25_IO_ADDRESS(x) (					\
 	IMX_IO_ADDRESS(x, MX25_AIPS1) ?:			\
 	IMX_IO_ADDRESS(x, MX25_AIPS2) ?:			\
Signature · 1 line
1.7.0
#2 lore raw

PATCH 1/2 mx1: fix build when DEBUG_LL is enabled

In reply to Baruch Siach

Hello,

Quoted 3 lines · Baruch Siach

Commit "mx1: prefix SOC specific defines with MX1_ and deprecate old names" redefined the IO_ADDRESS macro in a way that is incompatible with debug-macro.S. Reintroduce AVIC_IO_ADDRESS, and use it in debug-macro.S.

This feels wrong. Can you please instead fix IMX_IO_ADDRESS?

Something like:

	#ifdef __ASSEMBLY__
	#define IOREG(x) (x)
	#else
	#define IOREG(x) ((void __force __iomem *)(x))
	#endif

	#define IMX_IO_ADDRESS(addr, module) IOREG(\
	...

could work. Don't know if the cast to unsigned long works in assembler. Maybe it's unneeded? Don't remember.

Best regards
Uwe

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

PATCH 1/2 mx1: fix build when DEBUG_LL is enabled

Quoted 19 lines · Uwe Kleine-K?nig

Hello,

Quoted 3 lines · Baruch Siach

Commit "mx1: prefix SOC specific defines with MX1_ and deprecate old names" redefined the IO_ADDRESS macro in a way that is incompatible with debug-macro.S. Reintroduce AVIC_IO_ADDRESS, and use it in debug-macro.S.

This feels wrong. Can you please instead fix IMX_IO_ADDRESS?

Something like:

	#ifdef __ASSEMBLY__
	#define IOREG(x) (x)
	#else
	#define IOREG(x) ((void __force __iomem *)(x))
	#endif

	#define IMX_IO_ADDRESS(addr, module) IOREG(\
	...
Quoted 2 lines

could work. Don't know if the cast to unsigned long works in assembler. Maybe it's unneeded? Don't remember.

This is what I put in place for OMAP:

#ifdef __ASSEMBLER__
#define IOMEM(x) (x)
#else
#define IOMEM(x) ((void __force __iomem *)(x))
#endif

and then define all your device virtual addresses as normal hex integers wrapped in IOMEM().

You can then use those symbols in assembly and C without any harm.

I'd prefer folk use the same macro across all platforms - it's something we should eventually move to the asm/ includes - but not yet because there isn't a clear include that it should go in. (asm/io.h seems logical but has problems for assembly.)

#4 lore raw

PATCH 1/2 mx1: fix build when DEBUG_LL is enabled

Hi Russel, Uwe,

Quoted 31 lines · Russell King - ARM Linux
Quoted 19 lines · Uwe Kleine-K?nig

Hello,

Quoted 3 lines · Baruch Siach

Commit "mx1: prefix SOC specific defines with MX1_ and deprecate old names" redefined the IO_ADDRESS macro in a way that is incompatible with debug-macro.S. Reintroduce AVIC_IO_ADDRESS, and use it in debug-macro.S.

This feels wrong. Can you please instead fix IMX_IO_ADDRESS?

Something like:

	#ifdef __ASSEMBLY__
	#define IOREG(x) (x)
	#else
	#define IOREG(x) ((void __force __iomem *)(x))
	#endif

	#define IMX_IO_ADDRESS(addr, module) IOREG(\
	...
Quoted 2 lines

could work. Don't know if the cast to unsigned long works in assembler. Maybe it's unneeded? Don't remember.

This is what I put in place for OMAP:

#ifdef __ASSEMBLER__
#define IOMEM(x) (x)
#else
#define IOMEM(x) ((void __force __iomem *)(x))
#endif

Quoted 4 lines

and then define all your device virtual addresses as normal hex integers wrapped in IOMEM().

You can then use those symbols in assembly and C without any harm.

OK. I'll try this approach and send an updated patch shortly.

baruch

Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#5 lore raw

cover imx: fix build of assembly code using P2V macros

In reply to Russell King - ARM Linux

This set of patches fixes the build of mx1 and mx25 which CONFIG_DEBUG_LL is enabled. The first patch makes IMX_IO_ADDRESS compatible with assmebly code, and the other two use IMX_IO_ADDRESS to fix debug-macro.S.

Alex Greshgorin (1):
mx25: fix build when DEBUG_LL is enabled

Baruch Siach (2):
imx: make IMX_IO_ADDRESS assembly compatible
mx1: fix build when DEBUG_LL is enabled

 arch/arm/plat-mxc/include/mach/debug-macro.S |    6 +++---
 arch/arm/plat-mxc/include/mach/hardware.h    |   16 ++++++++++++----
 2 files changed, 15 insertions(+), 7 deletions(-)
#6 lore raw

PATCH 1/3 imx: make IMX_IO_ADDRESS assembly compatible

In reply to Russell King - ARM Linux

The IMX_IO_ADDRESS macro may be used directly on indirectly in assembly code. Make it assembly compatible by using the IOMEM helper macro.

---
 arch/arm/plat-mxc/include/mach/hardware.h |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
arch/arm/plat-mxc/include/mach/hardware.h +12 -4
index ebadf4a..f75a5cc 100644
@@ -22,10 +22,18 @@
 
 #include <asm/sizes.h>
 
-#define IMX_IO_ADDRESS(addr, module)					\
-	((void __force __iomem *)					\
-	 (((unsigned long)((addr) - (module ## _BASE_ADDR)) < module ## _SIZE) ?\
-	 (addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0))
+#ifdef __ASSEMBLER__
+#define IOMEM(addr,base,size,virt)	((addr) - (base) + (virt))
+#else
+#define IOMEM(addr,base,size,virt)			\
+	((void __force __iomem *)			\
+	((unsigned long) ((addr) - (base)) < size) ?	\
+	(addr) - (base) + (virt) : 0)
+#endif
+
+#define IMX_IO_ADDRESS(addr, module)				\
+	IOMEM(addr, module ## _BASE_ADDR, module ## _SIZE,	\
+	module ## _BASE_ADDR_VIRT)
 
 #ifdef CONFIG_ARCH_MX5
 #include <mach/mx51.h>
Signature · 1 line
1.7.0
#7 lore raw

PATCH RESEND 1/1 imx: make IMX_IO_ADDRESS assembly compatible

The IMX_IO_ADDRESS macro may be used directly on indirectly in assembly code. Make it assembly compatible by using the IOMEM helper macro.

---

Fixed the unsigned long cast. Please ignore the previous patch.

 arch/arm/plat-mxc/include/mach/hardware.h |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
arch/arm/plat-mxc/include/mach/hardware.h +12 -4
index ebadf4a..6bb0928 100644
@@ -22,10 +22,18 @@
 
 #include <asm/sizes.h>
 
-#define IMX_IO_ADDRESS(addr, module)					\
-	((void __force __iomem *)					\
-	 (((unsigned long)((addr) - (module ## _BASE_ADDR)) < module ## _SIZE) ?\
-	 (addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0))
+#ifdef __ASSEMBLER__
+#define IOMEM(addr,base,size,virt)	((addr) - (base) + (virt))
+#else
+#define IOMEM(addr,base,size,virt)			\
+	((void __force __iomem *)			\
+	(((unsigned long) ((addr) - (base)) < size) ?	\
+	(addr) - (base) + (virt) : 0))
+#endif
+
+#define IMX_IO_ADDRESS(addr, module)				\
+	IOMEM(addr, module ## _BASE_ADDR, module ## _SIZE,	\
+	module ## _BASE_ADDR_VIRT)
 
 #ifdef CONFIG_ARCH_MX5
 #include <mach/mx51.h>
Signature · 1 line
1.7.0
#8 lore raw

PATCH RESEND 1/1 imx: make IMX_IO_ADDRESS assembly compatible

arch/arm/plat-mxc/include/mach/hardware.h line 32

Quoted 8 lines · Baruch Siach
arch/arm/plat-mxc/include/mach/hardware.h +8 -0
+#ifdef __ASSEMBLER__
+#define IOMEM(addr,base,size,virt)	((addr) - (base) + (virt))
+#else
+#define IOMEM(addr,base,size,virt)			\
+	((void __force __iomem *)			\
+	(((unsigned long) ((addr) - (base)) < size) ?	\
+	(addr) - (base) + (virt) : 0))
+#endif

If you look at:

http://lists.arm.linux.org.uk/lurker/message/20100311.105637.21ac15c1.en.html

you'll see this definition is incompatible with my stated aim for this macro.

#9 lore raw

PATCH 1/3 imx: make IMX_IO_ADDRESS assembly compatible

In reply to Baruch Siach

Hello Baruch,

Quoted 22 lines · Baruch Siach

The IMX_IO_ADDRESS macro may be used directly on indirectly in assembly code. Make it assembly compatible by using the IOMEM helper macro.

---
 arch/arm/plat-mxc/include/mach/hardware.h |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
arch/arm/plat-mxc/include/mach/hardware.h +2 -4
index ebadf4a..f75a5cc 100644
@@ -22,10 +22,18 @@
 
 #include <asm/sizes.h>
 
-#define IMX_IO_ADDRESS(addr, module)					\
-	((void __force __iomem *)					\
-	 (((unsigned long)((addr) - (module ## _BASE_ADDR)) < module ## _SIZE) ?\
-	 (addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0))
+#ifdef __ASSEMBLER__
+#define IOMEM(addr,base,size,virt)	((addr) - (base) + (virt))

arch/arm/plat-mxc/include/mach/hardware.h line 36

Quoted 10 lines
arch/arm/plat-mxc/include/mach/hardware.h +10 -0
+#else
+#define IOMEM(addr,base,size,virt)			\
+	((void __force __iomem *)			\
+	((unsigned long) ((addr) - (base)) < size) ?	\
+	(addr) - (base) + (virt) : 0)
+#endif
+
+#define IMX_IO_ADDRESS(addr, module)				\
+	IOMEM(addr, module ## _BASE_ADDR, module ## _SIZE,	\
+	module ## _BASE_ADDR_VIRT)

hmmm, the construct used to define MX27_IO_ADDRESS et al. does only work without __ASSEMBLER__ anyhow, still I think it might be at least surprising that e.g.

	IOMEM(MX27_WDOG_BASE_ADDR, MX27_SAHB1_BASE_ADDR, MX27_SAHB1_SIZE, MX27_SAHB1_BASE_ADDR_VIRT)

evaluates to 0x84102000 if __ASSEMBLER__ is defined but 0 if not.

I tend to think we should use a different solution.

IMHO it would be great to have a macro that maps physical to virtual addresses for both assembler and C. E.g. ns9xxx has something like that[1], other probably, too, but for imx it would be harder as the used addresses differ and are spread over the whole address space. Some time ago I found a function that would do the task, but Sascha didn't agree to use it because it involved too much magic.

Best regards
Uwe

[1] io_p2v defined in arch/arm/mach-ns9xxx/include/mach/hardware.h

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

PATCH 1/3 imx: make IMX_IO_ADDRESS assembly compatible

Hi Uwe,

Quoted 41 lines · Uwe Kleine-K?nig
Quoted 22 lines · Baruch Siach

The IMX_IO_ADDRESS macro may be used directly on indirectly in assembly code. Make it assembly compatible by using the IOMEM helper macro.

---
 arch/arm/plat-mxc/include/mach/hardware.h |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
arch/arm/plat-mxc/include/mach/hardware.h +2 -4
index ebadf4a..f75a5cc 100644
@@ -22,10 +22,18 @@
 
 #include <asm/sizes.h>
 
-#define IMX_IO_ADDRESS(addr, module)					\
-	((void __force __iomem *)					\
-	 (((unsigned long)((addr) - (module ## _BASE_ADDR)) < module ## _SIZE) ?\
-	 (addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0))
+#ifdef __ASSEMBLER__
+#define IOMEM(addr,base,size,virt)	((addr) - (base) + (virt))

arch/arm/plat-mxc/include/mach/hardware.h line 36

Quoted 10 lines
arch/arm/plat-mxc/include/mach/hardware.h +10 -0
+#else
+#define IOMEM(addr,base,size,virt)			\
+	((void __force __iomem *)			\
+	((unsigned long) ((addr) - (base)) < size) ?	\
+	(addr) - (base) + (virt) : 0)
+#endif
+
+#define IMX_IO_ADDRESS(addr, module)				\
+	IOMEM(addr, module ## _BASE_ADDR, module ## _SIZE,	\
+	module ## _BASE_ADDR_VIRT)

hmmm, the construct used to define MX27_IO_ADDRESS et al. does only work without __ASSEMBLER__ anyhow, still I think it might be at least surprising that e.g.

	IOMEM(MX27_WDOG_BASE_ADDR, MX27_SAHB1_BASE_ADDR, MX27_SAHB1_SIZE, MX27_SAHB1_BASE_ADDR_VIRT)

evaluates to 0x84102000 if __ASSEMBLER__ is defined but 0 if not.

Quoted 8 lines

I tend to think we should use a different solution.

IMHO it would be great to have a macro that maps physical to virtual addresses for both assembler and C. E.g. ns9xxx has something like that[1], other probably, too, but for imx it would be harder as the used addresses differ and are spread over the whole address space. Some time ago I found a function that would do the task, but Sascha didn't agree to use it because it involved too much magic.

So, what you actually suggest is to use the simple arithmetic IOMEM version which is assembly compatible, and remove the C only ?: error checking, as is being done in ns9xxx, right? Or are you suggesting to change the P2V mapping of the entire i.MX platform so that this error checking is not needed?

baruch

Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#11 lore raw

PATCH 1/3 imx: make IMX_IO_ADDRESS assembly compatible

Hi Baruch,

Quoted 33 lines
Quoted 24 lines
Quoted 6 lines
arch/arm/plat-mxc/include/mach/hardware.h +2 -4
-#define IMX_IO_ADDRESS(addr, module)					\
-	((void __force __iomem *)					\
-	 (((unsigned long)((addr) - (module ## _BASE_ADDR)) < module ## _SIZE) ?\
-	 (addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0))
+#ifdef __ASSEMBLER__
+#define IOMEM(addr,base,size,virt)	((addr) - (base) + (virt))

arch/arm/plat-mxc/include/mach/hardware.h line 36

Quoted 10 lines
arch/arm/plat-mxc/include/mach/hardware.h +10 -0
+#else
+#define IOMEM(addr,base,size,virt)			\
+	((void __force __iomem *)			\
+	((unsigned long) ((addr) - (base)) < size) ?	\
+	(addr) - (base) + (virt) : 0)
+#endif
+
+#define IMX_IO_ADDRESS(addr, module)				\
+	IOMEM(addr, module ## _BASE_ADDR, module ## _SIZE,	\
+	module ## _BASE_ADDR_VIRT)

hmmm, the construct used to define MX27_IO_ADDRESS et al. does only work without __ASSEMBLER__ anyhow, still I think it might be at least surprising that e.g.

	IOMEM(MX27_WDOG_BASE_ADDR, MX27_SAHB1_BASE_ADDR, MX27_SAHB1_SIZE, MX27_SAHB1_BASE_ADDR_VIRT)

evaluates to 0x84102000 if __ASSEMBLER__ is defined but 0 if not.

Quoted 8 lines

I tend to think we should use a different solution.

IMHO it would be great to have a macro that maps physical to virtual addresses for both assembler and C. E.g. ns9xxx has something like that[1], other probably, too, but for imx it would be harder as the used addresses differ and are spread over the whole address space. Some time ago I found a function that would do the task, but Sascha didn't agree to use it because it involved too much magic.

Quoted 4 lines

So, what you actually suggest is to use the simple arithmetic IOMEM version which is assembly compatible, and remove the C only ?: error checking, as is being done in ns9xxx, right? Or are you suggesting to change the P2V mapping of the entire i.MX platform so that this error checking is not needed?

We currently need the ?: construct for the definition of
MX.._IO_ADDRESS. Maybe using it would work for assembler, too, as
there are only constants involved?

For reference: The function I found back then is:

	#define io_p2v(x)	(0xf4000000 + \
				(((x) & 0x50000000) >> 8) + \
				(((x) & 0x02000000) >> 4) + \
				(((x) & 0x000fffff)))

This would introduce an injective mapping of the io space to [0xf4000000;0xf47fffff] for mx1, mx21, mx25, mx27, mx31 and mx35. (Skipping the chip select mappings that are (AFAIK unnecessarily) currently used on some socs.):

        mx1:            0x00200000 -> 0xf4000000
        mx2[17]:        0x10000000 -> 0xf4100000
                        0x80000000 -> 0xf4000000
        mx21:           0xdf000000 -> 0xf4700000
        mx27:           0xd8000000 -> 0xf4500000
        mx3[15]:        0xb8000000 -> 0xf4100000
        mx{25,31,35}:   0x68000000 -> 0xf4400000
                        0x43f00000 -> 0xf4600000
                        0x53f00000 -> 0xf4700000

The upside of this approach is that it just works in C and Assembler, but it's ugly and the mapped sections are spread over [0xf4000000;0xf47fffff] instead of being one after another as they are now. For mx51 this might need further adaption.

So in my order of preference the possibilities are:

1) IOMEM with ?: for Assembler, too
2) "my" io_p2v as above
3) IOMEM as you suggested

The nice thing about 1) (and 2)) is that we could just use MX.._IO_ADDRESS in debug-macro.h.

Best regards
Uwe

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

PATCH 1/3 imx: make IMX_IO_ADDRESS assembly compatible

Hello,

Quoted 68 lines · Uwe Kleine-K?nig
Quoted 33 lines
Quoted 24 lines
Quoted 6 lines
arch/arm/plat-mxc/include/mach/hardware.h +2 -4
-#define IMX_IO_ADDRESS(addr, module)					\
-	((void __force __iomem *)					\
-	 (((unsigned long)((addr) - (module ## _BASE_ADDR)) < module ## _SIZE) ?\
-	 (addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0))
+#ifdef __ASSEMBLER__
+#define IOMEM(addr,base,size,virt)	((addr) - (base) + (virt))

arch/arm/plat-mxc/include/mach/hardware.h line 36

Quoted 10 lines
arch/arm/plat-mxc/include/mach/hardware.h +10 -0
+#else
+#define IOMEM(addr,base,size,virt)			\
+	((void __force __iomem *)			\
+	((unsigned long) ((addr) - (base)) < size) ?	\
+	(addr) - (base) + (virt) : 0)
+#endif
+
+#define IMX_IO_ADDRESS(addr, module)				\
+	IOMEM(addr, module ## _BASE_ADDR, module ## _SIZE,	\
+	module ## _BASE_ADDR_VIRT)

hmmm, the construct used to define MX27_IO_ADDRESS et al. does only work without __ASSEMBLER__ anyhow, still I think it might be at least surprising that e.g.

	IOMEM(MX27_WDOG_BASE_ADDR, MX27_SAHB1_BASE_ADDR, MX27_SAHB1_SIZE, MX27_SAHB1_BASE_ADDR_VIRT)

evaluates to 0x84102000 if __ASSEMBLER__ is defined but 0 if not.

Quoted 8 lines

I tend to think we should use a different solution.

IMHO it would be great to have a macro that maps physical to virtual addresses for both assembler and C. E.g. ns9xxx has something like that[1], other probably, too, but for imx it would be harder as the used addresses differ and are spread over the whole address space. Some time ago I found a function that would do the task, but Sascha didn't agree to use it because it involved too much magic.

Quoted 4 lines

So, what you actually suggest is to use the simple arithmetic IOMEM version which is assembly compatible, and remove the C only ?: error checking, as is being done in ns9xxx, right? Or are you suggesting to change the P2V mapping of the entire i.MX platform so that this error checking is not needed?

We currently need the ?: construct for the definition of
MX.._IO_ADDRESS. Maybe using it would work for assembler, too, as
there are only constants involved?

For reference: The function I found back then is:

	#define io_p2v(x)	(0xf4000000 + \
				(((x) & 0x50000000) >> 8) + \
				(((x) & 0x02000000) >> 4) + \
				(((x) & 0x000fffff)))

This would introduce an injective mapping of the io space to [0xf4000000;0xf47fffff] for mx1, mx21, mx25, mx27, mx31 and mx35. (Skipping the chip select mappings that are (AFAIK unnecessarily) currently used on some socs.):

        mx1:            0x00200000 -> 0xf4000000
        mx2[17]:        0x10000000 -> 0xf4100000
                        0x80000000 -> 0xf4000000
        mx21:           0xdf000000 -> 0xf4700000
        mx27:           0xd8000000 -> 0xf4500000
        mx3[15]:        0xb8000000 -> 0xf4100000
        mx{25,31,35}:   0x68000000 -> 0xf4400000
                        0x43f00000 -> 0xf4600000
                        0x53f00000 -> 0xf4700000

The upside of this approach is that it just works in C and Assembler, but it's ugly and the mapped sections are spread over [0xf4000000;0xf47fffff] instead of being one after another as they are now. For mx51 this might need further adaption.

Quoted 8 lines

So in my order of preference the possibilities are:

1) IOMEM with ?: for Assembler, too
2) "my" io_p2v as above
3) IOMEM as you suggested

The nice thing about 1) (and 2)) is that we could just use MX.._IO_ADDRESS in debug-macro.h.

While trying to get rid of IMX_NEEDS_DEPRECATED_SYMBOLS I tried 1), but it seems it doesn't work (using a gcc 4.3.2 + binutils 2.19 toolchain). :-(

So I tried if my function works for mx51, and it does. Unfortunately it fails for mxc91231. But I already have a different function that works on all mxc-SoCs.

I will create an RFC patch that introduces my suggestion in reply to this mail. Would be nice to hear (or better read) your thoughts on that.

Best regards
Uwe

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

PATCH 1/7 mx3: fix the last users of IMX_NEEDS_DEPRECATED_SYMBOLS

---
 arch/arm/mach-mx3/Makefile        |    3 --
 arch/arm/mach-mx3/devices.c       |   72 ++++++++++++++++++++-----------------
 arch/arm/mach-mx3/mach-mx31_3ds.c |    2 +-
 arch/arm/mach-mx3/mm.c            |   48 ++++++++++++------------
 4 files changed, 64 insertions(+), 61 deletions(-)
arch/arm/mach-mx3/Makefile +0 -3
index 8a182d0a..7feb6c4 100644
@@ -5,8 +5,6 @@
 # Object file lists.
 
 obj-y				:= mm.o devices.o cpu.o
-CFLAGS_mm.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS
-CFLAGS_devices.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS
 obj-$(CONFIG_ARCH_MX31)		+= clock-imx31.o iomux-imx31.o
 obj-$(CONFIG_ARCH_MX35)		+= clock-imx35.o
 obj-$(CONFIG_MACH_MX31ADS)	+= mach-mx31ads.o
@@ -15,7 +13,6 @@ obj-$(CONFIG_MACH_MX31LITE)	+= mach-mx31lite.o mx31lite-db.o
 obj-$(CONFIG_MACH_PCM037)	+= mach-pcm037.o
 obj-$(CONFIG_MACH_PCM037_EET)	+= mach-pcm037_eet.o
 obj-$(CONFIG_MACH_MX31_3DS)	+= mach-mx31_3ds.o
-CFLAGS_mach-mx31_3ds.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS
 obj-$(CONFIG_MACH_MX31MOBOARD)	+= mach-mx31moboard.o mx31moboard-devboard.o \
 				   mx31moboard-marxbot.o mx31moboard-smartbot.o
 obj-$(CONFIG_MACH_QONG)		+= mach-qong.o
arch/arm/mach-mx3/devices.c +39 -33

173 lines not on this page · raw message

arch/arm/mach-mx3/mach-mx31_3ds.c +1 -1
index 6fe69e1..1d24617 100644
@@ -281,7 +281,7 @@ static void __init mxc_board_init(void)
 	mx31_3ds_usbotg_init();
 	mxc_register_device(&mxc_otg_udc_device, &usbotg_pdata);
 
-	if (!mxc_expio_init(CS5_BASE_ADDR, EXPIO_PARENT_INT))
+	if (!mxc_expio_init(MX31_CS5_BASE_ADDR, EXPIO_PARENT_INT))
 		printk(KERN_WARNING "Init of the debugboard failed, all "
 				    "devices on the board are unusable.\n");
 }
arch/arm/mach-mx3/mm.c +24 -24

82 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#14 lore raw

PATCH 2/7 imx: refactor the io mapping macro

In reply to Uwe Kleine-König

This makes it more assembler friendly and allows it to be used in situation that need an unsigned long and not a pointer. Also the naming is clearer. IOMEM is introduced without IMX_ prefix as it is used this way in more than one ARM subarch and it might become globally available soon.

---
 arch/arm/mach-mx3/mach-kzm_arm11_01.c     |    6 +++---
 arch/arm/plat-mxc/include/mach/hardware.h |   13 +++++++++----
 arch/arm/plat-mxc/include/mach/mx1.h      |    5 +++--
 arch/arm/plat-mxc/include/mach/mx21.h     |    9 +++++----
 arch/arm/plat-mxc/include/mach/mx25.h     |    9 +++++----
 arch/arm/plat-mxc/include/mach/mx27.h     |    9 +++++----
 arch/arm/plat-mxc/include/mach/mx31.h     |   13 +++++++------
 arch/arm/plat-mxc/include/mach/mx35.h     |   13 +++++++------
 arch/arm/plat-mxc/include/mach/mx51.h     |   13 +++++++------
 arch/arm/plat-mxc/include/mach/mxc91231.h |   19 ++++++++++---------
 10 files changed, 61 insertions(+), 48 deletions(-)
arch/arm/mach-mx3/mach-kzm_arm11_01.c +3 -3
index 5b23e41..423387d 100644
@@ -41,9 +41,9 @@
 #include "devices-imx31.h"
 #include "devices.h"
 
-#define KZM_ARM11_IO_ADDRESS(x) (					\
-	IMX_IO_ADDRESS(x, MX31_CS4) ?:					\
-	IMX_IO_ADDRESS(x, MX31_CS5) ?:					\
+#define KZM_ARM11_IO_ADDRESS(x) (IOMEM(					\
+	IMX_IO_P2V_MODULE(x, MX31_CS4) ?:				\
+	IMX_IO_P2V_MODULE(x, MX31_CS5)) ?:				\
 	MX31_IO_ADDRESS(x))
 
 /*
arch/arm/plat-mxc/include/mach/hardware.h +9 -4
index ebadf4a..4bbe506 100644
@@ -22,10 +22,15 @@
 
 #include <asm/sizes.h>
 
-#define IMX_IO_ADDRESS(addr, module)					\
-	((void __force __iomem *)					\
-	 (((unsigned long)((addr) - (module ## _BASE_ADDR)) < module ## _SIZE) ?\
-	 (addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0))
+#ifdef __ASSEMBLER__
+#define IOMEM(addr)	(addr)
+#else
+#define IOMEM(addr)	((void __force __iomem *)(addr))
+#endif
+
+#define IMX_IO_P2V_MODULE(addr, module)					\
+	(((addr) - module ## _BASE_ADDR) < module ## _SIZE ?		\
+	 (addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0)
 
 #ifdef CONFIG_ARCH_MX5
 #include <mach/mx51.h>
arch/arm/plat-mxc/include/mach/mx1.h +3 -2
index 641b246..6faa7d2 100644
@@ -73,8 +73,9 @@
 #define MX1_CSI_BASE_ADDR		(0x24000 + MX1_IO_BASE_ADDR)
 
 /* macro to get at IO space when running virtually */
-#define MX1_IO_ADDRESS(x) (						\
-	IMX_IO_ADDRESS(x, MX1_IO))
+#define MX1_IO_P2V(x)	(						\
+	IMX_IO_P2V_MODULE(x, MX1_IO))
+#define MX1_IO_ADDRESS(x) 		IOMEM(MX1_IO_P2V(x))
 
 /* fixed interrput numbers */
 #define MX1_INT_SOFTINT		0
arch/arm/plat-mxc/include/mach/mx21.h +5 -4
index 8bc5972..aed0277 100644
@@ -92,10 +92,11 @@
 
 #define MX21_IRAM_BASE_ADDR		0xffffe800	/* internal ram */
 
-#define MX21_IO_ADDRESS(x) (						\
-	IMX_IO_ADDRESS(x, MX21_AIPI) ?:					\
-	IMX_IO_ADDRESS(x, MX21_SAHB1) ?:				\
-	IMX_IO_ADDRESS(x, MX21_X_MEMC))
+#define MX21_IO_P2V(x)	(						\
+	IMX_IO_P2V_MODULE(x, MX21_AIPI) ?:				\
+	IMX_IO_P2V_MODULE(x, MX21_SAHB1) ?:				\
+	IMX_IO_P2V_MODULE(x, MX21_X_MEMC))
+#define MX21_IO_ADDRESS(x)		IOMEM(MX21_IO_P2V(x))
 
 /* fixed interrupt numbers */
 #define MX21_INT_CSPI3		6
arch/arm/plat-mxc/include/mach/mx25.h +5 -4
index cf46a45..6f9e1d4 100644
@@ -28,10 +28,11 @@
 #define MX25_GPIO3_BASE_ADDR_VIRT	(MX25_AIPS2_BASE_ADDR_VIRT + 0xa4000)
 #define MX25_GPIO4_BASE_ADDR_VIRT	(MX25_AIPS2_BASE_ADDR_VIRT + 0x9c000)
 
-#define MX25_IO_ADDRESS(x) (					\
-	IMX_IO_ADDRESS(x, MX25_AIPS1) ?:			\
-	IMX_IO_ADDRESS(x, MX25_AIPS2) ?:			\
-	IMX_IO_ADDRESS(x, MX25_AVIC))
+#define MX25_IO_P2V(x)	(					\
+	IMX_IO_P2V_MODULE(x, MX25_AIPS1) ?:			\
+	IMX_IO_P2V_MODULE(x, MX25_AIPS2) ?:			\
+	IMX_IO_P2V_MODULE(x, MX25_AVIC))
+#define MX25_IO_ADDRESS(x)		IOMEM(MX25_IO_P2V(x))
 
 #define MX25_AIPS1_IO_ADDRESS(x) \
 	(((x) - MX25_AIPS1_BASE_ADDR) + MX25_AIPS1_BASE_ADDR_VIRT)
arch/arm/plat-mxc/include/mach/mx27.h +5 -4
index 2237ba2..c769cc8 100644
@@ -123,10 +123,11 @@
 /* IRAM */
 #define MX27_IRAM_BASE_ADDR		0xffff4c00	/* internal ram */
 
-#define MX27_IO_ADDRESS(x) (						\
-	IMX_IO_ADDRESS(x, MX27_AIPI) ?:					\
-	IMX_IO_ADDRESS(x, MX27_SAHB1) ?:				\
-	IMX_IO_ADDRESS(x, MX27_X_MEMC))
+#define MX27_IO_P2V(x)	(						\
+	IMX_IO_P2V_MODULE(x, MX27_AIPI) ?:				\
+	IMX_IO_P2V_MODULE(x, MX27_SAHB1) ?:				\
+	IMX_IO_P2V_MODULE(x, MX27_X_MEMC))
+#define MX27_IO_ADDRESS(x)		IOMEM(MX27_IO_P2V(x))
 
 #ifndef __ASSEMBLER__
 static inline void mx27_setup_weimcs(size_t cs,
arch/arm/plat-mxc/include/mach/mx31.h +7 -6
index 61cfe82..eb4a28d 100644
@@ -121,12 +121,13 @@
 
 #define MX31_PCMCIA_MEM_BASE_ADDR	0xbc000000
 
-#define MX31_IO_ADDRESS(x) (						\
-	IMX_IO_ADDRESS(x, MX31_AIPS1) ?:				\
-	IMX_IO_ADDRESS(x, MX31_AIPS2) ?:				\
-	IMX_IO_ADDRESS(x, MX31_AVIC) ?:					\
-	IMX_IO_ADDRESS(x, MX31_X_MEMC) ?:				\
-	IMX_IO_ADDRESS(x, MX31_SPBA0))
+#define MX31_IO_P2V(x)	(						\
+	IMX_IO_P2V_MODULE(x, MX31_AIPS1) ?:				\
+	IMX_IO_P2V_MODULE(x, MX31_AIPS2) ?:				\
+	IMX_IO_P2V_MODULE(x, MX31_AVIC) ?:				\
+	IMX_IO_P2V_MODULE(x, MX31_X_MEMC) ?:				\
+	IMX_IO_P2V_MODULE(x, MX31_SPBA0))
+#define MX31_IO_ADDRESS(x)		IOMEM(MX31_IO_P2V(x))
 
 #ifndef __ASSEMBLER__
 static inline void mx31_setup_weimcs(size_t cs,
arch/arm/plat-mxc/include/mach/mx35.h +7 -6
index 6267cff..ce1a24b 100644
@@ -114,12 +114,13 @@
 #define MX35_NFC_BASE_ADDR		0xbb000000
 #define MX35_PCMCIA_MEM_BASE_ADDR	0xbc000000
 
-#define MX35_IO_ADDRESS(x) (						\
-	IMX_IO_ADDRESS(x, MX35_AIPS1) ?:				\
-	IMX_IO_ADDRESS(x, MX35_AIPS2) ?:				\
-	IMX_IO_ADDRESS(x, MX35_AVIC) ?:					\
-	IMX_IO_ADDRESS(x, MX35_X_MEMC) ?:				\
-	IMX_IO_ADDRESS(x, MX35_SPBA0))
+#define MX35_IO_P2V(x)	(						\
+	IMX_IO_P2V_MODULE(x, MX35_AIPS1) ?:				\
+	IMX_IO_P2V_MODULE(x, MX35_AIPS2) ?:				\
+	IMX_IO_P2V_MODULE(x, MX35_AVIC) ?:				\
+	IMX_IO_P2V_MODULE(x, MX35_X_MEMC) ?:				\
+	IMX_IO_P2V_MODULE(x, MX35_SPBA0))
+#define MX35_IO_ADDRESS(x)		IOMEM(MX35_IO_P2V(x))
 
 /*
  * Interrupt numbers
arch/arm/plat-mxc/include/mach/mx51.h +7 -6
index 2af7a10..e93cf5b 100644
@@ -163,12 +163,13 @@
 #define MX51_GPU2D_BASE_ADDR		0xd0000000
 #define MX51_TZIC_BASE_ADDR		0xe0000000
 
-#define MX51_IO_ADDRESS(x) (						\
-	IMX_IO_ADDRESS(x, MX51_IRAM) ?:					\
-	IMX_IO_ADDRESS(x, MX51_DEBUG) ?:				\
-	IMX_IO_ADDRESS(x, MX51_SPBA0) ?:				\
-	IMX_IO_ADDRESS(x, MX51_AIPS1) ?:				\
-	IMX_IO_ADDRESS(x, MX51_AIPS2))
+#define MX51_IO_P2V(x)	(						\
+	IMX_IO_P2V_MODULE(x, MX51_IRAM) ?:				\
+	IMX_IO_P2V_MODULE(x, MX51_DEBUG) ?:				\
+	IMX_IO_P2V_MODULE(x, MX51_SPBA0) ?:				\
+	IMX_IO_P2V_MODULE(x, MX51_AIPS1) ?:				\
+	IMX_IO_P2V_MODULE(x, MX51_AIPS2))
+#define MX51_IO_ADDRESS(x)		IOMEM(MX51_IO_P2V(x))
 
 /* This is currently used in <mach/debug-macro.S>, but should go away */
 #define MX51_AIPS1_IO_ADDRESS(x)  \
arch/arm/plat-mxc/include/mach/mxc91231.h +10 -9
index 0ca3101..49e5e25 100644
@@ -187,15 +187,16 @@
  * it returns 0.
  */
 
-#define MXC91231_IO_ADDRESS(x) (					\
-	IMX_IO_ADDRESS(x, MXC91231_L2CC) ?:				\
-	IMX_IO_ADDRESS(x, MXC91231_X_MEMC) ?:				\
-	IMX_IO_ADDRESS(x, MXC91231_ROMP) ?:				\
-	IMX_IO_ADDRESS(x, MXC91231_AVIC) ?:				\
-	IMX_IO_ADDRESS(x, MXC91231_AIPS1) ?:				\
-	IMX_IO_ADDRESS(x, MXC91231_SPBA0) ?:				\
-	IMX_IO_ADDRESS(x, MXC91231_SPBA1) ?:				\
-	IMX_IO_ADDRESS(x, MXC91231_AIPS2))
+#define MXC91231_IO_P2V(x)	(					\
+	IMX_IO_P2V_MODULE(x, MXC91231_L2CC) ?:				\
+	IMX_IO_P2V_MODULE(x, MXC91231_X_MEMC) ?:			\
+	IMX_IO_P2V_MODULE(x, MXC91231_ROMP) ?:				\
+	IMX_IO_P2V_MODULE(x, MXC91231_AVIC) ?:				\
+	IMX_IO_P2V_MODULE(x, MXC91231_AIPS1) ?:				\
+	IMX_IO_P2V_MODULE(x, MXC91231_SPBA0) ?:				\
+	IMX_IO_P2V_MODULE(x, MXC91231_SPBA1) ?:				\
+	IMX_IO_P2V_MODULE(x, MXC91231_AIPS2))
+#define MXC91231_IO_ADDRESS(x)		IOMEM(MXC91231_IO_P2V(x))
 
 /*
  * Interrupt numbers
Signature · 1 line
1.7.2.3
#15 lore raw

PATCH 3/7 imx: use MXxy_IO_P2V macros to setup static mappings

In reply to Uwe Kleine-König

This makes less code rely on the virtual constants.

To further simplify code and reduce the needed boilerplate when defining the static mappings a new helper macro is defined in mach/hardware.h.

---
 arch/arm/mach-imx/mm-imx1.c               |    7 +---
 arch/arm/mach-imx/mm-imx21.c              |   21 ++----------
 arch/arm/mach-imx/mm-imx27.c              |   21 ++----------
 arch/arm/mach-mx25/mm.c                   |   25 +++----------
 arch/arm/mach-mx3/mm.c                    |   53 ++++++++++------------------
 arch/arm/mach-mx5/mm.c                    |   35 ++++---------------
 arch/arm/mach-mxc91231/mm.c               |   53 +++++-----------------------
 arch/arm/plat-mxc/include/mach/hardware.h |    7 ++++
 8 files changed, 56 insertions(+), 166 deletions(-)
arch/arm/mach-imx/mm-imx1.c +1 -6
index 9be92b9..729ae09 100644
@@ -25,12 +25,7 @@
 #include <mach/hardware.h>
 
 static struct map_desc imx_io_desc[] __initdata = {
-	{
-		.virtual = MX1_IO_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX1_IO_BASE_ADDR),
-		.length = MX1_IO_SIZE,
-		.type = MT_DEVICE
-	}
+	imx_map_entry(MX1, IO, MT_DEVICE),
 };
 
 void __init mx1_map_io(void)
arch/arm/mach-imx/mm-imx21.c +3 -18
index 12faeeaa..e728af8 100644
@@ -35,33 +35,18 @@ static struct map_desc imx21_io_desc[] __initdata = {
 	 * - ROM Patch
 	 * - and some reserved space
 	 */
-	{
-		.virtual = MX21_AIPI_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX21_AIPI_BASE_ADDR),
-		.length = MX21_AIPI_SIZE,
-		.type = MT_DEVICE
-	},
+	imx_map_entry(MX21, AIPI, MT_DEVICE),
 	/*
 	 * this fixed mapping covers:
 	 * - CSI
 	 * - ATA
 	 */
-	{
-		.virtual = MX21_SAHB1_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX21_SAHB1_BASE_ADDR),
-		.length = MX21_SAHB1_SIZE,
-		.type = MT_DEVICE
-	},
+	imx_map_entry(MX21, SAHB1, MT_DEVICE),
 	/*
 	 * this fixed mapping covers:
 	 * - EMI
 	 */
-	{
-		.virtual = MX21_X_MEMC_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX21_X_MEMC_BASE_ADDR),
-		.length = MX21_X_MEMC_SIZE,
-		.type = MT_DEVICE
-	},
+	imx_map_entry(MX21, X_MEMC, MT_DEVICE),
 };
 
 /*
arch/arm/mach-imx/mm-imx27.c +3 -18
index a246229..374e48b 100644
@@ -35,33 +35,18 @@ static struct map_desc imx27_io_desc[] __initdata = {
 	 * - ROM Patch
 	 * - and some reserved space
 	 */
-	{
-		.virtual = MX27_AIPI_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX27_AIPI_BASE_ADDR),
-		.length = MX27_AIPI_SIZE,
-		.type = MT_DEVICE
-	},
+	imx_map_entry(MX27, AIPI, MT_DEVICE),
 	/*
 	 * this fixed mapping covers:
 	 * - CSI
 	 * - ATA
 	 */
-	{
-		.virtual = MX27_SAHB1_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX27_SAHB1_BASE_ADDR),
-		.length = MX27_SAHB1_SIZE,
-		.type = MT_DEVICE
-	},
+	imx_map_entry(MX27, SAHB1, MT_DEVICE),
 	/*
 	 * this fixed mapping covers:
 	 * - EMI
 	 */
-	{
-		.virtual = MX27_X_MEMC_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX27_X_MEMC_BASE_ADDR),
-		.length = MX27_X_MEMC_SIZE,
-		.type = MT_DEVICE
-	},
+	imx_map_entry(MX27, X_MEMC, MT_DEVICE),
 };
 
 /*
arch/arm/mach-mx25/mm.c +6 -19
index bb67711..11cd335 100644
@@ -30,25 +30,12 @@
 
 /*
  * This table defines static virtual address mappings for I/O regions.
- * These are the mappings common across all MX3 boards.
+ * These are the mappings common across all MX25 boards.
  */
-static struct map_desc mxc_io_desc[] __initdata = {
-	{
-		.virtual	= MX25_AVIC_BASE_ADDR_VIRT,
-		.pfn		= __phys_to_pfn(MX25_AVIC_BASE_ADDR),
-		.length		= MX25_AVIC_SIZE,
-		.type		= MT_DEVICE_NONSHARED
-	}, {
-		.virtual	= MX25_AIPS1_BASE_ADDR_VIRT,
-		.pfn		= __phys_to_pfn(MX25_AIPS1_BASE_ADDR),
-		.length		= MX25_AIPS1_SIZE,
-		.type		= MT_DEVICE_NONSHARED
-	}, {
-		.virtual	= MX25_AIPS2_BASE_ADDR_VIRT,
-		.pfn		= __phys_to_pfn(MX25_AIPS2_BASE_ADDR),
-		.length		= MX25_AIPS2_SIZE,
-		.type		= MT_DEVICE_NONSHARED
-	},
+static struct map_desc mx25_io_desc[] __initdata = {
+	imx_map_entry(MX25, AVIC, MT_DEVICE_NONSHARED),
+	imx_map_entry(MX25, AIPS1, MT_DEVICE_NONSHARED),
+	imx_map_entry(MX25, AIPS2, MT_DEVICE_NONSHARED),
 };
 
 /*
@@ -62,7 +49,7 @@ void __init mx25_map_io(void)
 	mxc_iomux_v3_init(MX25_IO_ADDRESS(MX25_IOMUXC_BASE_ADDR));
 	mxc_arch_reset_init(MX25_IO_ADDRESS(MX25_WDOG_BASE_ADDR));
 
-	iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
+	iotable_init(mx25_io_desc, ARRAY_SIZE(mx25_io_desc));
 }
 
 int imx25_register_gpios(void);
arch/arm/mach-mx3/mm.c +19 -34

76 lines not on this page · raw message

arch/arm/mach-mx5/mm.c +7 -28
index bc3f30d..01dff26 100644
@@ -23,33 +23,12 @@
 /*
  * Define the MX51 memory map.
  */
-static struct map_desc mxc_io_desc[] __initdata = {
-	{
-		.virtual = MX51_IRAM_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_IRAM_BASE_ADDR),
-		.length = MX51_IRAM_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX51_DEBUG_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_DEBUG_BASE_ADDR),
-		.length = MX51_DEBUG_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX51_AIPS1_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_AIPS1_BASE_ADDR),
-		.length = MX51_AIPS1_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX51_SPBA0_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_SPBA0_BASE_ADDR),
-		.length = MX51_SPBA0_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX51_AIPS2_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_AIPS2_BASE_ADDR),
-		.length = MX51_AIPS2_SIZE,
-		.type = MT_DEVICE
-	},
+static struct map_desc mx51_io_desc[] __initdata = {
+	imx_map_entry(MX51, IRAM, MT_DEVICE),
+	imx_map_entry(MX51, DEBUG, MT_DEVICE),
+	imx_map_entry(MX51, AIPS1, MT_DEVICE),
+	imx_map_entry(MX51, SPBA0, MT_DEVICE),
+	imx_map_entry(MX51, AIPS2, MT_DEVICE),
 };
 
 /*
@@ -62,7 +41,7 @@ void __init mx51_map_io(void)
 	mxc_set_cpu_type(MXC_CPU_MX51);
 	mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR));
 	mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG_BASE_ADDR));
-	iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
+	iotable_init(mx51_io_desc, ARRAY_SIZE(mx51_io_desc));
 }
 
 int imx51_register_gpios(void);
arch/arm/mach-mxc91231/mm.c +10 -43

65 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/hardware.h +7 -0
index 4bbe506..409cec6 100644
@@ -66,4 +66,11 @@
 
 #include <mach/mxc.h>
 
+#define imx_map_entry(soc, name, _type)	{				\
+	.virtual = soc ## _IO_P2V(soc ## _ ## name ## _BASE_ADDR),	\
+	.pfn = __phys_to_pfn(soc ## _ ## name ## _BASE_ADDR),		\
+	.length = soc ## _ ## name ## _SIZE,				\
+	.type = _type,							\
+}
+
 #endif /* __ASM_ARCH_MXC_HARDWARE_H__ */
Signature · 1 line
1.7.2.3
#16 lore raw

PATCH 3/7 imx: use MXxy_IO_P2V macros to setup static mappings

Hi Uwe,

Quoted 1 line

-----Original Message-----

From: [email protected] [mailto:linux-arm-kernel-

Quoted 277 lines

bounces at lists.infradead.org] On Behalf Of Uwe Kleine-K?nig
Sent: Tuesday, October 26, 2010 3:50 AM
To: linux-arm-kernel at lists.infradead.org
Cc: kernel at pengutronix.de
Subject: [PATCH 3/7] imx: use MXxy_IO_P2V macros to setup static mappings

This makes less code rely on the virtual constants.

To further simplify code and reduce the needed boilerplate when defining the static mappings a new helper macro is defined in mach/hardware.h.

---

arch/arm/mach-imx/mm-imx1.c               |    7 +---
arch/arm/mach-imx/mm-imx21.c              |   21 ++----------
arch/arm/mach-imx/mm-imx27.c              |   21 ++----------
arch/arm/mach-mx25/mm.c                   |   25 +++----------
arch/arm/mach-mx3/mm.c                    |   53 ++++++++++------------------
arch/arm/mach-mx5/mm.c                    |   35 ++++---------------
arch/arm/mach-mxc91231/mm.c               |   53 +++++-----------------------
arch/arm/plat-mxc/include/mach/hardware.h |    7 ++++
8 files changed, 56 insertions(+), 166 deletions(-)
arch/arm/mach-imx/mm-imx1.c +1 -6
index 9be92b9..729ae09 100644
@@ -25,12 +25,7 @@
 #include <mach/hardware.h>
 
 static struct map_desc imx_io_desc[] __initdata = {
-	{
-		.virtual = MX1_IO_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX1_IO_BASE_ADDR),
-		.length = MX1_IO_SIZE,
-		.type = MT_DEVICE
-	}
+	imx_map_entry(MX1, IO, MT_DEVICE),
 };
 
 void __init mx1_map_io(void)
arch/arm/mach-imx/mm-imx21.c +3 -18
index 12faeeaa..e728af8 100644
@@ -35,33 +35,18 @@ static struct map_desc imx21_io_desc[] __initdata = {
 	 * - ROM Patch
 	 * - and some reserved space
 	 */
-	{
-		.virtual = MX21_AIPI_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX21_AIPI_BASE_ADDR),
-		.length = MX21_AIPI_SIZE,
-		.type = MT_DEVICE
-	},
+	imx_map_entry(MX21, AIPI, MT_DEVICE),
 	/*
 	 * this fixed mapping covers:
 	 * - CSI
 	 * - ATA
 	 */
-	{
-		.virtual = MX21_SAHB1_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX21_SAHB1_BASE_ADDR),
-		.length = MX21_SAHB1_SIZE,
-		.type = MT_DEVICE
-	},
+	imx_map_entry(MX21, SAHB1, MT_DEVICE),
 	/*
 	 * this fixed mapping covers:
 	 * - EMI
 	 */
-	{
-		.virtual = MX21_X_MEMC_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX21_X_MEMC_BASE_ADDR),
-		.length = MX21_X_MEMC_SIZE,
-		.type = MT_DEVICE
-	},
+	imx_map_entry(MX21, X_MEMC, MT_DEVICE),
 };
 
 /*
arch/arm/mach-imx/mm-imx27.c +3 -18
index a246229..374e48b 100644
@@ -35,33 +35,18 @@ static struct map_desc imx27_io_desc[] __initdata = {
 	 * - ROM Patch
 	 * - and some reserved space
 	 */
-	{
-		.virtual = MX27_AIPI_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX27_AIPI_BASE_ADDR),
-		.length = MX27_AIPI_SIZE,
-		.type = MT_DEVICE
-	},
+	imx_map_entry(MX27, AIPI, MT_DEVICE),
 	/*
 	 * this fixed mapping covers:
 	 * - CSI
 	 * - ATA
 	 */
-	{
-		.virtual = MX27_SAHB1_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX27_SAHB1_BASE_ADDR),
-		.length = MX27_SAHB1_SIZE,
-		.type = MT_DEVICE
-	},
+	imx_map_entry(MX27, SAHB1, MT_DEVICE),
 	/*
 	 * this fixed mapping covers:
 	 * - EMI
 	 */
-	{
-		.virtual = MX27_X_MEMC_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX27_X_MEMC_BASE_ADDR),
-		.length = MX27_X_MEMC_SIZE,
-		.type = MT_DEVICE
-	},
+	imx_map_entry(MX27, X_MEMC, MT_DEVICE),
 };
 
 /*
arch/arm/mach-mx25/mm.c +6 -19
index bb67711..11cd335 100644
@@ -30,25 +30,12 @@
 
 /*
 * This table defines static virtual address mappings for I/O regions.
- * These are the mappings common across all MX3 boards.
+ * These are the mappings common across all MX25 boards.
 */
-static struct map_desc mxc_io_desc[] __initdata = {
-	{
-		.virtual	= MX25_AVIC_BASE_ADDR_VIRT,
-		.pfn		= __phys_to_pfn(MX25_AVIC_BASE_ADDR),
-		.length		= MX25_AVIC_SIZE,
-		.type		= MT_DEVICE_NONSHARED
-	}, {
-		.virtual	= MX25_AIPS1_BASE_ADDR_VIRT,
-		.pfn		= __phys_to_pfn(MX25_AIPS1_BASE_ADDR),
-		.length		= MX25_AIPS1_SIZE,
-		.type		= MT_DEVICE_NONSHARED
-	}, {
-		.virtual	= MX25_AIPS2_BASE_ADDR_VIRT,
-		.pfn		= __phys_to_pfn(MX25_AIPS2_BASE_ADDR),
-		.length		= MX25_AIPS2_SIZE,
-		.type		= MT_DEVICE_NONSHARED
-	},
+static struct map_desc mx25_io_desc[] __initdata = {
+	imx_map_entry(MX25, AVIC, MT_DEVICE_NONSHARED),
+	imx_map_entry(MX25, AIPS1, MT_DEVICE_NONSHARED),
+	imx_map_entry(MX25, AIPS2, MT_DEVICE_NONSHARED),
 };
 
 /*
@@ -62,7 +49,7 @@ void __init mx25_map_io(void)
 	mxc_iomux_v3_init(MX25_IO_ADDRESS(MX25_IOMUXC_BASE_ADDR));
 	mxc_arch_reset_init(MX25_IO_ADDRESS(MX25_WDOG_BASE_ADDR));
 
-	iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
+	iotable_init(mx25_io_desc, ARRAY_SIZE(mx25_io_desc));
 }
 
 int imx25_register_gpios(void);
arch/arm/mach-mx3/mm.c +19 -34
index 809ee40..193c18c 100644
@@ -36,40 +36,16 @@
 * @ingroup Memory
 */
 
-/*!
- * This table defines static virtual address mappings for I/O regions.
- * These are the mappings common across all MX3 boards.
- */
-static struct map_desc mxc_io_desc[] __initdata = {
-	{
-		.virtual = MX3x_X_MEMC_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX3x_X_MEMC_BASE_ADDR),
-		.length = MX3x_X_MEMC_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX3x_AVIC_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX3x_AVIC_BASE_ADDR),
-		.length = MX3x_AVIC_SIZE,
-		.type = MT_DEVICE_NONSHARED
-	}, {
-		.virtual = MX3x_AIPS1_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX3x_AIPS1_BASE_ADDR),
-		.length = MX3x_AIPS1_SIZE,
-		.type = MT_DEVICE_NONSHARED
-	}, {
-		.virtual = MX3x_AIPS2_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX3x_AIPS2_BASE_ADDR),
-		.length = MX3x_AIPS2_SIZE,
-		.type = MT_DEVICE_NONSHARED
-	}, {
-		.virtual = MX3x_SPBA0_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX3x_SPBA0_BASE_ADDR),
-		.length = MX3x_SPBA0_SIZE,
-		.type = MT_DEVICE_NONSHARED
-	},
+#ifdef CONFIG_ARCH_MX31
+static struct map_desc mx31_io_desc[] __initdata = {
+	imx_map_entry(MX31, X_MEMC, MT_DEVICE),
+	imx_map_entry(MX31, AVIC, MT_DEVICE_NONSHARED),
+	imx_map_entry(MX31, AIPS1, MT_DEVICE_NONSHARED),
+	imx_map_entry(MX31, AIPS2, MT_DEVICE_NONSHARED),
+	imx_map_entry(MX31, SPBA0, MT_DEVICE_NONSHARED),
 };
 
-/*!
+/*
 * This function initializes the memory map. It is called during the
 * system startup to create static physical to virtual memory mappings
 * for the IO modules.
@@ -79,17 +55,26 @@ void __init mx31_map_io(void)
 	mxc_set_cpu_type(MXC_CPU_MX31);
 	mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR));
 
-	iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
+	iotable_init(mx31_io_desc, ARRAY_SIZE(mx31_io_desc));
 }
+#endif
 
 #ifdef CONFIG_ARCH_MX35
+static struct map_desc mx35_io_desc[] __initdata = {
+	imx_map_entry(MX35, X_MEMC, MT_DEVICE),
+	imx_map_entry(MX35, AVIC, MT_DEVICE_NONSHARED),
+	imx_map_entry(MX35, AIPS1, MT_DEVICE_NONSHARED),
+	imx_map_entry(MX35, AIPS2, MT_DEVICE_NONSHARED),
+	imx_map_entry(MX35, SPBA0, MT_DEVICE_NONSHARED),
+};
+
 void __init mx35_map_io(void)
 {
 	mxc_set_cpu_type(MXC_CPU_MX35);
 	mxc_iomux_v3_init(MX35_IO_ADDRESS(MX35_IOMUXC_BASE_ADDR));
 	mxc_arch_reset_init(MX35_IO_ADDRESS(MX3x_WDOG_BASE_ADDR));
 
-	iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
+	iotable_init(mx35_io_desc, ARRAY_SIZE(mx35_io_desc));
 }
 #endif
 
arch/arm/mach-mx5/mm.c +0 -19
index bc3f30d..01dff26 100644
@@ -23,33 +23,12 @@
 /*
 * Define the MX51 memory map.
 */
-static struct map_desc mxc_io_desc[] __initdata = {
-	{
-		.virtual = MX51_IRAM_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_IRAM_BASE_ADDR),
-		.length = MX51_IRAM_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX51_DEBUG_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_DEBUG_BASE_ADDR),
-		.length = MX51_DEBUG_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX51_AIPS1_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_AIPS1_BASE_ADDR),
-		.length = MX51_AIPS1_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX51_SPBA0_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_SPBA0_BASE_ADDR),

arch/arm/mach-mx5/mm.c line 27

Quoted 10 lines
arch/arm/mach-mx5/mm.c +2 -8
-		.length = MX51_SPBA0_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX51_AIPS2_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_AIPS2_BASE_ADDR),
-		.length = MX51_AIPS2_SIZE,
-		.type = MT_DEVICE
-	},
+static struct map_desc mx51_io_desc[] __initdata = {
+	imx_map_entry(MX51, IRAM, MT_DEVICE),

Do you still see a need a statically map IRAM? I added the iram allocator functions so that users of IRAM can dynamically allocate it.

Quoted 107 lines
arch/arm/mach-mx5/mm.c +5 -1
+	imx_map_entry(MX51, DEBUG, MT_DEVICE),
+	imx_map_entry(MX51, AIPS1, MT_DEVICE),
+	imx_map_entry(MX51, SPBA0, MT_DEVICE),
+	imx_map_entry(MX51, AIPS2, MT_DEVICE),
 };
 
 /*
@@ -62,7 +41,7 @@ void __init mx51_map_io(void)
 	mxc_set_cpu_type(MXC_CPU_MX51);
 	mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR));
 	mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG_BASE_ADDR));
-	iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
+	iotable_init(mx51_io_desc, ARRAY_SIZE(mx51_io_desc));
 }
 
 int imx51_register_gpios(void);
arch/arm/mach-mxc91231/mm.c +10 -43
index aeccfd7..7652c30 100644
@@ -27,48 +27,15 @@
 /*
 * This structure defines the MXC memory map.
 */
-static struct map_desc mxc_io_desc[] __initdata = {
-	{
-		.virtual	= MXC91231_L2CC_BASE_ADDR_VIRT,
-		.pfn		= __phys_to_pfn(MXC91231_L2CC_BASE_ADDR),
-		.length		= MXC91231_L2CC_SIZE,
-		.type		= MT_DEVICE,
-	}, {
-		.virtual	= MXC91231_X_MEMC_BASE_ADDR_VIRT,
-		.pfn		= __phys_to_pfn(MXC91231_X_MEMC_BASE_ADDR),
-		.length		= MXC91231_X_MEMC_SIZE,
-		.type		= MT_DEVICE,
-	}, {
-		.virtual	= MXC91231_ROMP_BASE_ADDR_VIRT,
-		.pfn		= __phys_to_pfn(MXC91231_ROMP_BASE_ADDR),
-		.length		= MXC91231_ROMP_SIZE,
-		.type		= MT_DEVICE,
-	}, {
-		.virtual	= MXC91231_AVIC_BASE_ADDR_VIRT,
-		.pfn		= __phys_to_pfn(MXC91231_AVIC_BASE_ADDR),
-		.length		= MXC91231_AVIC_SIZE,
-		.type		= MT_DEVICE,
-	}, {
-		.virtual	= MXC91231_AIPS1_BASE_ADDR_VIRT,
-		.pfn		= __phys_to_pfn(MXC91231_AIPS1_BASE_ADDR),
-		.length		= MXC91231_AIPS1_SIZE,
-		.type		= MT_DEVICE,
-	}, {
-		.virtual	= MXC91231_SPBA0_BASE_ADDR_VIRT,
-		.pfn		= __phys_to_pfn(MXC91231_SPBA0_BASE_ADDR),
-		.length		= MXC91231_SPBA0_SIZE,
-		.type		= MT_DEVICE,
-	}, {
-		.virtual	= MXC91231_SPBA1_BASE_ADDR_VIRT,
-		.pfn		= __phys_to_pfn(MXC91231_SPBA1_BASE_ADDR),
-		.length		= MXC91231_SPBA1_SIZE,
-		.type		= MT_DEVICE,
-	}, {
-		.virtual	= MXC91231_AIPS2_BASE_ADDR_VIRT,
-		.pfn		= __phys_to_pfn(MXC91231_AIPS2_BASE_ADDR),
-		.length		= MXC91231_AIPS2_SIZE,
-		.type		= MT_DEVICE,
-	},
+static struct map_desc mxc91231_io_desc[] __initdata = {
+	imx_map_entry(MXC91231, L2CC, MT_DEVICE),
+	imx_map_entry(MXC91231, X_MEMC, MT_DEVICE),
+	imx_map_entry(MXC91231, ROMP, MT_DEVICE),
+	imx_map_entry(MXC91231, AVIC, MT_DEVICE),
+	imx_map_entry(MXC91231, AIPS1, MT_DEVICE),
+	imx_map_entry(MXC91231, SPBA0, MT_DEVICE),
+	imx_map_entry(MXC91231, SPBA1, MT_DEVICE),
+	imx_map_entry(MXC91231, AIPS2, MT_DEVICE),
 };
 
 /*
@@ -80,7 +47,7 @@ void __init mxc91231_map_io(void)
 {
 	mxc_set_cpu_type(MXC_CPU_MXC91231);
 
-	iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
+	iotable_init(mxc91231_io_desc, ARRAY_SIZE(mxc91231_io_desc));
 }
 
 int mxc91231_register_gpios(void);
arch/arm/plat-mxc/include/mach/hardware.h +7 -1
index 4bbe506..409cec6 100644
@@ -66,4 +66,11 @@
 
 #include <mach/mxc.h>
 
+#define imx_map_entry(soc, name, _type)	{				\
+	.virtual = soc ## _IO_P2V(soc ## _ ## name ## _BASE_ADDR),	\
+	.pfn = __phys_to_pfn(soc ## _ ## name ## _BASE_ADDR),		\
+	.length = soc ## _ ## name ## _SIZE,				\
+	.type = _type,							\
+}
+
 #endif /* __ASM_ARCH_MXC_HARDWARE_H__ */
--

1.7.2.3

Quoted 4 lines

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

Thanks,
Dinh

#17 lore raw

PATCH 3/7 imx: use MXxy_IO_P2V macros to setup static mappings

Hello Dinh,

Quoted 32 lines
Quoted 32 lines
arch/arm/mach-mx5/mm.c +0 -24
index bc3f30d..01dff26 100644
@@ -23,33 +23,12 @@
 /*
 * Define the MX51 memory map.
 */
-static struct map_desc mxc_io_desc[] __initdata = {
-	{
-		.virtual = MX51_IRAM_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_IRAM_BASE_ADDR),
-		.length = MX51_IRAM_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX51_DEBUG_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_DEBUG_BASE_ADDR),
-		.length = MX51_DEBUG_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX51_AIPS1_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_AIPS1_BASE_ADDR),
-		.length = MX51_AIPS1_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX51_SPBA0_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_SPBA0_BASE_ADDR),
-		.length = MX51_SPBA0_SIZE,
-		.type = MT_DEVICE
-	}, {
-		.virtual = MX51_AIPS2_BASE_ADDR_VIRT,
-		.pfn = __phys_to_pfn(MX51_AIPS2_BASE_ADDR),
Quoted 8 lines

arch/arm/mach-mx5/mm.c line 27

Quoted 5 lines
arch/arm/mach-mx5/mm.c +2 -3
-		.length = MX51_AIPS2_SIZE,
-		.type = MT_DEVICE
-	},
+static struct map_desc mx51_io_desc[] __initdata = {
+	imx_map_entry(MX51, IRAM, MT_DEVICE),

Do you still see a need a statically map IRAM? I added the iram allocator functions so that users of IRAM can dynamically allocate it.

No I don't, IMHO it shouldn't have been there in the first place. Maybe it even *must* go away to become reliable, don't know for sure though. But this patch is not the right one to fix it. So if you want to send a patch that removes unneeded mappings that's fine. (Preferably on mxc91231 that has more mappings than all the other SoCs.)

Best regards
Uwe

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

PATCH 4/7 imx: remove last explicit users of virtual base address defines

In reply to Uwe Kleine-König

This allows changing the mapping without the need to adapt all users.

While at it remove some unneeded casts to void __iomem *, this is already taken care for in the IO_ADDRESS macros

---
 arch/arm/mach-imx/devices.c           |    8 ++++----
 arch/arm/mach-mx25/devices.c          |    8 ++++----
 arch/arm/mach-mx25/mm.c               |    2 +-
 arch/arm/plat-mxc/include/mach/mx25.h |    9 ++++-----
 4 files changed, 13 insertions(+), 14 deletions(-)
arch/arm/mach-imx/devices.c +4 -4
index fba5047..e69e46e 100644
@@ -159,22 +159,22 @@ struct platform_device imx_usb_device = {
 static struct mxc_gpio_port imx_gpio_ports[] = {
 	{
 		.chip.label = "gpio-0",
-		.base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR),
+		.base = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR),
 		.irq = MX1_GPIO_INT_PORTA,
 		.virtual_irq_start = MXC_GPIO_IRQ_START,
 	}, {
 		.chip.label = "gpio-1",
-		.base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x100),
+		.base = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x100),
 		.irq = MX1_GPIO_INT_PORTB,
 		.virtual_irq_start = MXC_GPIO_IRQ_START + 32,
 	}, {
 		.chip.label = "gpio-2",
-		.base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x200),
+		.base = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x200),
 		.irq = MX1_GPIO_INT_PORTC,
 		.virtual_irq_start = MXC_GPIO_IRQ_START + 64,
 	}, {
 		.chip.label = "gpio-3",
-		.base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x300),
+		.base = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x300),
 		.irq = MX1_GPIO_INT_PORTD,
 		.virtual_irq_start = MXC_GPIO_IRQ_START + 96,
 	}
arch/arm/mach-mx25/devices.c +4 -4
index 1d0eb3e..92eb1a9 100644
@@ -182,22 +182,22 @@ struct platform_device mxc_pwm_device3 = {
 static struct mxc_gpio_port imx_gpio_ports[] = {
 	{
 		.chip.label = "gpio-0",
-		.base = (void __iomem *)MX25_GPIO1_BASE_ADDR_VIRT,
+		.base = MX25_IO_ADDRESS(MX25_GPIO1_BASE_ADDR),
 		.irq = 52,
 		.virtual_irq_start = MXC_GPIO_IRQ_START,
 	}, {
 		.chip.label = "gpio-1",
-		.base = (void __iomem *)MX25_GPIO2_BASE_ADDR_VIRT,
+		.base = MX25_IO_ADDRESS(MX25_GPIO2_BASE_ADDR),
 		.irq = 51,
 		.virtual_irq_start = MXC_GPIO_IRQ_START + 32,
 	}, {
 		.chip.label = "gpio-2",
-		.base = (void __iomem *)MX25_GPIO3_BASE_ADDR_VIRT,
+		.base = MX25_IO_ADDRESS(MX25_GPIO3_BASE_ADDR),
 		.irq = 16,
 		.virtual_irq_start = MXC_GPIO_IRQ_START + 64,
 	}, {
 		.chip.label = "gpio-3",
-		.base = (void __iomem *)MX25_GPIO4_BASE_ADDR_VIRT,
+		.base = MX25_IO_ADDRESS(MX25_GPIO4_BASE_ADDR),
 		.irq = 23,
 		.virtual_irq_start = MXC_GPIO_IRQ_START + 96,
 	}
arch/arm/mach-mx25/mm.c +1 -1
index 11cd335..2edec6c 100644
@@ -56,7 +56,7 @@ int imx25_register_gpios(void);
 
 void __init mx25_init_irq(void)
 {
-	mxc_init_irq((void __iomem *)MX25_AVIC_BASE_ADDR_VIRT);
+	mxc_init_irq(MX25_IO_ADDRESS(MX25_AVIC_BASE_ADDR));
 	imx25_register_gpios();
 }
 
arch/arm/plat-mxc/include/mach/mx25.h +4 -5
index 6f9e1d4..08b5a3a 100644
@@ -21,13 +21,12 @@
 
 #define MX25_CRM_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0x80000)
 #define MX25_GPT1_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0x90000)
+#define MX25_GPIO4_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0x9c000)
+#define MX25_GPIO3_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xa4000)
+#define MX25_GPIO1_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xcc000)
+#define MX25_GPIO2_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xd0000)
 #define MX25_WDOG_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xdc000)
 
-#define MX25_GPIO1_BASE_ADDR_VIRT	(MX25_AIPS2_BASE_ADDR_VIRT + 0xcc000)
-#define MX25_GPIO2_BASE_ADDR_VIRT	(MX25_AIPS2_BASE_ADDR_VIRT + 0xd0000)
-#define MX25_GPIO3_BASE_ADDR_VIRT	(MX25_AIPS2_BASE_ADDR_VIRT + 0xa4000)
-#define MX25_GPIO4_BASE_ADDR_VIRT	(MX25_AIPS2_BASE_ADDR_VIRT + 0x9c000)
-
 #define MX25_IO_P2V(x)	(					\
 	IMX_IO_P2V_MODULE(x, MX25_AIPS1) ?:			\
 	IMX_IO_P2V_MODULE(x, MX25_AIPS2) ?:			\
Signature · 1 line
1.7.2.3
#19 lore raw

PATCH 5/7 RFC/RFT: imx: change static io mapping to use a function

In reply to Uwe Kleine-König

Now only the virtual addresses [0xf4000000, 0xf5ffffff] are used for static per-SoC mappings. The few mappings of whole chip selects are moved accordingly.

The now wrong defines for virtual base addresses are removed.

---
 arch/arm/plat-mxc/include/mach/hardware.h |   67 +++++++++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/mx1.h      |    5 +--
 arch/arm/plat-mxc/include/mach/mx21.h     |    9 +---
 arch/arm/plat-mxc/include/mach/mx25.h     |   13 ++----
 arch/arm/plat-mxc/include/mach/mx27.h     |    9 +---
 arch/arm/plat-mxc/include/mach/mx2x.h     |   36 +---------------
 arch/arm/plat-mxc/include/mach/mx31.h     |   16 +------
 arch/arm/plat-mxc/include/mach/mx35.h     |   17 +------
 arch/arm/plat-mxc/include/mach/mx3x.h     |   65 +--------------------------
 arch/arm/plat-mxc/include/mach/mx51.h     |   38 +---------------
 arch/arm/plat-mxc/include/mach/mxc91231.h |   22 +---------
 11 files changed, 89 insertions(+), 208 deletions(-)
arch/arm/plat-mxc/include/mach/hardware.h +67 -0
index 409cec6..2f59b63 100644
@@ -32,6 +32,73 @@
 	(((addr) - module ## _BASE_ADDR) < module ## _SIZE ?		\
 	 (addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0)
 
+/*
+ * This is rather complicated for humans and ugly to verify, but for a machine
+ * it's OK.  Still more as it is usually only applied to constants.  The upsides
+ * on using this approach are:
+ *
+ *  - same mapping on all i.MX machines
+ *  - works for assembler, too
+ *  - no need to nurture #defines for virtual addresses
+ *
+ * The downside it, it's hard to verify (but I have a script for that).
+ *
+ * Obviously this needs to be injective for each SoC.  In general it maps the
+ * whole address space to [0xf4000000, 0xf5ffffff].  So [0xf6000000,0xfeffffff]
+ * is free for per-machine use (e.g. KZM_ARM11_01 uses 64MiB there).
+ *
+ * It applies the following mappings for the different SoCs:
+ *
+ * mx1:
+ *	IO	0x00200000+0x100000	->	0xf4000000+0x100000
+ * mx21:
+ *	AIPI	0x10000000+0x100000	->	0xf4400000+0x100000
+ *	SAHB1	0x80000000+0x100000	->	0xf4000000+0x100000
+ *	X_MEMC	0xdf000000+0x004000	->	0xf5f00000+0x004000
+ * mx25:
+ *	AIPS1	0x43f00000+0x100000	->	0xf5300000+0x100000
+ *	AIPS2	0x53f00000+0x100000	->	0xf5700000+0x100000
+ *	AVIC	0x68000000+0x100000	->	0xf5800000+0x100000
+ * mx27:
+ *	AIPI	0x10000000+0x100000	->	0xf4400000+0x100000
+ *	SAHB1	0x80000000+0x100000	->	0xf4000000+0x100000
+ *	X_MEMC	0xd8000000+0x100000	->	0xf5c00000+0x100000
+ * mx31:
+ *	AIPS1	0x43f00000+0x100000	->	0xf5300000+0x100000
+ *	AIPS2	0x53f00000+0x100000	->	0xf5700000+0x100000
+ *	AVIC	0x68000000+0x100000	->	0xf5800000+0x100000
+ *	X_MEMC	0xb8000000+0x010000	->	0xf4c00000+0x010000
+ *	SPBA0	0x50000000+0x100000	->	0xf5400000+0x100000
+ * mx35:
+ *	AIPS1	0x43f00000+0x100000	->	0xf5300000+0x100000
+ *	AIPS2	0x53f00000+0x100000	->	0xf5700000+0x100000
+ *	AVIC	0x68000000+0x100000	->	0xf5800000+0x100000
+ *	X_MEMC	0xb8000000+0x010000	->	0xf4c00000+0x010000
+ *	SPBA0	0x50000000+0x100000	->	0xf5400000+0x100000
+ * mx51:
+ *	IRAM	0x1ffe0000+0x020000	->	0xf4fe0000+0x020000
+ *	DEBUG	0x60000000+0x100000	->	0xf5000000+0x100000
+ *	SPBA0	0x70000000+0x100000	->	0xf5400000+0x100000
+ *	AIPS1	0x73f00000+0x100000	->	0xf5700000+0x100000
+ *	AIPS2	0x83f00000+0x100000	->	0xf4300000+0x100000
+ * mxc91231:
+ *	L2CC	0x30000000+0x010000	->	0xf4400000+0x010000
+ *	X_MEMC	0xb8000000+0x010000	->	0xf4c00000+0x010000
+ *	ROMP	0x60000000+0x010000	->	0xf5000000+0x010000
+ *	AVIC	0x68000000+0x010000	->	0xf5800000+0x010000
+ *	AIPS1	0x43f00000+0x100000	->	0xf5300000+0x100000
+ *	SPBA0	0x50000000+0x100000	->	0xf5400000+0x100000
+ *	SPBA1	0x52000000+0x100000	->	0xf5600000+0x100000
+ *	AIPS2	0x53f00000+0x100000	->	0xf5700000+0x100000
+ */
+#define IMX_IO_P2V(x)	(						\
+			0xf4000000 + 					\
+			(((x) & 0x50000000) >> 6) +			\
+			(((x) & 0x0b000000) >> 4) +			\
+			(((x) & 0x000fffff)))
+
+#define IMX_IO_ADDRESS(x)	IOMEM(IMX_IO_P2V(x))
+
 #ifdef CONFIG_ARCH_MX5
 #include <mach/mx51.h>
 #endif
arch/arm/plat-mxc/include/mach/mx1.h +1 -4
index 6faa7d2..6541798 100644
@@ -19,7 +19,6 @@
  */
 #define MX1_IO_BASE_ADDR	0x00200000
 #define MX1_IO_SIZE		SZ_1M
-#define MX1_IO_BASE_ADDR_VIRT	VMALLOC_END
 
 #define MX1_CS0_PHYS		0x10000000
 #define MX1_CS0_SIZE		0x02000000
@@ -73,8 +72,7 @@
 #define MX1_CSI_BASE_ADDR		(0x24000 + MX1_IO_BASE_ADDR)
 
 /* macro to get at IO space when running virtually */
-#define MX1_IO_P2V(x)	(						\
-	IMX_IO_P2V_MODULE(x, MX1_IO))
+#define MX1_IO_P2V(x)			IMX_IO_P2V(x)
 #define MX1_IO_ADDRESS(x) 		IOMEM(MX1_IO_P2V(x))
 
 /* fixed interrput numbers */
@@ -171,7 +169,6 @@
 /* these should go away */
 #define IMX_IO_PHYS MX1_IO_BASE_ADDR
 #define IMX_IO_SIZE MX1_IO_SIZE
-#define IMX_IO_BASE MX1_IO_BASE_ADDR_VIRT
 #define IMX_CS0_PHYS MX1_CS0_PHYS
 #define IMX_CS0_SIZE MX1_CS0_SIZE
 #define IMX_CS1_PHYS MX1_CS1_PHYS
arch/arm/plat-mxc/include/mach/mx21.h +1 -8
index aed0277..b417e32 100644
@@ -26,7 +26,6 @@
 #define __MACH_MX21_H__
 
 #define MX21_AIPI_BASE_ADDR		0x10000000
-#define MX21_AIPI_BASE_ADDR_VIRT	0xf4000000
 #define MX21_AIPI_SIZE			SZ_1M
 #define MX21_DMA_BASE_ADDR			(MX21_AIPI_BASE_ADDR + 0x01000)
 #define MX21_WDOG_BASE_ADDR			(MX21_AIPI_BASE_ADDR + 0x02000)
@@ -64,7 +63,6 @@
 #define MX21_AVIC_BASE_ADDR		0x10040000
 
 #define MX21_SAHB1_BASE_ADDR		0x80000000
-#define MX21_SAHB1_BASE_ADDR_VIRT	0xf4100000
 #define MX21_SAHB1_SIZE			SZ_1M
 #define MX21_CSI_BASE_ADDR			(MX2x_SAHB1_BASE_ADDR + 0x0000)
 
@@ -82,7 +80,6 @@
 
 /* NAND, SDRAM, WEIM etc controllers */
 #define MX21_X_MEMC_BASE_ADDR		0xdf000000
-#define MX21_X_MEMC_BASE_ADDR_VIRT	0xf4200000
 #define MX21_X_MEMC_SIZE		SZ_256K
 
 #define MX21_SDRAMC_BASE_ADDR		(MX21_X_MEMC_BASE_ADDR + 0x0000)
@@ -92,10 +89,7 @@
 
 #define MX21_IRAM_BASE_ADDR		0xffffe800	/* internal ram */
 
-#define MX21_IO_P2V(x)	(						\
-	IMX_IO_P2V_MODULE(x, MX21_AIPI) ?:				\
-	IMX_IO_P2V_MODULE(x, MX21_SAHB1) ?:				\
-	IMX_IO_P2V_MODULE(x, MX21_X_MEMC))
+#define MX21_IO_P2V(x)			IMX_IO_P2V(x)
 #define MX21_IO_ADDRESS(x)		IOMEM(MX21_IO_P2V(x))
 
 /* fixed interrupt numbers */
@@ -197,7 +191,6 @@
 #define PCMCIA_MEM_BASE_ADDR MX21_PCMCIA_MEM_BASE_ADDR
 #define CS5_BASE_ADDR MX21_CS5_BASE_ADDR
 #define X_MEMC_BASE_ADDR MX21_X_MEMC_BASE_ADDR
-#define X_MEMC_BASE_ADDR_VIRT MX21_X_MEMC_BASE_ADDR_VIRT
 #define X_MEMC_SIZE MX21_X_MEMC_SIZE
 #define SDRAMC_BASE_ADDR MX21_SDRAMC_BASE_ADDR
 #define EIM_BASE_ADDR MX21_EIM_BASE_ADDR
arch/arm/plat-mxc/include/mach/mx25.h +4 -9
index 08b5a3a..aac6a9c 100644
@@ -2,13 +2,11 @@
 #define __MACH_MX25_H__
 
 #define MX25_AIPS1_BASE_ADDR		0x43f00000
-#define MX25_AIPS1_BASE_ADDR_VIRT	0xfc000000
+#define MX25_AIPS1_BASE_ADDR_VIRT	0xf5300000
 #define MX25_AIPS1_SIZE			SZ_1M
 #define MX25_AIPS2_BASE_ADDR		0x53f00000
-#define MX25_AIPS2_BASE_ADDR_VIRT	0xfc200000
 #define MX25_AIPS2_SIZE			SZ_1M
 #define MX25_AVIC_BASE_ADDR		0x68000000
-#define MX25_AVIC_BASE_ADDR_VIRT	0xfc400000
 #define MX25_AVIC_SIZE			SZ_1M
 
 #define MX25_I2C1_BASE_ADDR		(MX25_AIPS1_BASE_ADDR + 0x80000)
@@ -27,12 +25,6 @@
 #define MX25_GPIO2_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xd0000)
 #define MX25_WDOG_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xdc000)
 
-#define MX25_IO_P2V(x)	(					\
-	IMX_IO_P2V_MODULE(x, MX25_AIPS1) ?:			\
-	IMX_IO_P2V_MODULE(x, MX25_AIPS2) ?:			\
-	IMX_IO_P2V_MODULE(x, MX25_AVIC))
-#define MX25_IO_ADDRESS(x)		IOMEM(MX25_IO_P2V(x))
-
 #define MX25_AIPS1_IO_ADDRESS(x) \
 	(((x) - MX25_AIPS1_BASE_ADDR) + MX25_AIPS1_BASE_ADDR_VIRT)
 
@@ -58,6 +50,9 @@
 #define MX25_OTG_BASE_ADDR		0x53ff4000
 #define MX25_CSI_BASE_ADDR		0x53ff8000
 
+#define MX25_IO_P2V(x)			IMX_IO_P2V(x)
+#define MX25_IO_ADDRESS(x)		IOMEM(MX25_IO_P2V(x))
+
 #define MX25_INT_CSPI3		0
 #define MX25_INT_I2C1		3
 #define MX25_INT_I2C2		4
arch/arm/plat-mxc/include/mach/mx27.h +1 -8
index c769cc8..e817289 100644
@@ -29,7 +29,6 @@
 #endif
 
 #define MX27_AIPI_BASE_ADDR		0x10000000
-#define MX27_AIPI_BASE_ADDR_VIRT	0xf4000000
 #define MX27_AIPI_SIZE			SZ_1M
 #define MX27_DMA_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x01000)
 #define MX27_WDOG_BASE_ADDR			(MX27_AIPI_BASE_ADDR + 0x02000)
@@ -87,7 +86,6 @@
 #define MX27_ROMP_BASE_ADDR		0x10041000
 
 #define MX27_SAHB1_BASE_ADDR		0x80000000
-#define MX27_SAHB1_BASE_ADDR_VIRT	0xf4100000
 #define MX27_SAHB1_SIZE			SZ_1M
 #define MX27_CSI_BASE_ADDR			(MX27_SAHB1_BASE_ADDR + 0x0000)
 #define MX27_ATA_BASE_ADDR			(MX27_SAHB1_BASE_ADDR + 0x1000)
@@ -105,7 +103,6 @@
 
 /* NAND, SDRAM, WEIM, M3IF, EMI controllers */
 #define MX27_X_MEMC_BASE_ADDR		0xd8000000
-#define MX27_X_MEMC_BASE_ADDR_VIRT	0xf4200000
 #define MX27_X_MEMC_SIZE		SZ_1M
 #define MX27_NFC_BASE_ADDR			(MX27_X_MEMC_BASE_ADDR)
 #define MX27_SDRAMC_BASE_ADDR			(MX27_X_MEMC_BASE_ADDR + 0x1000)
@@ -123,10 +120,7 @@
 /* IRAM */
 #define MX27_IRAM_BASE_ADDR		0xffff4c00	/* internal ram */
 
-#define MX27_IO_P2V(x)	(						\
-	IMX_IO_P2V_MODULE(x, MX27_AIPI) ?:				\
-	IMX_IO_P2V_MODULE(x, MX27_SAHB1) ?:				\
-	IMX_IO_P2V_MODULE(x, MX27_X_MEMC))
+#define MX27_IO_P2V(x)			IMX_IO_P2V(x)
 #define MX27_IO_ADDRESS(x)		IOMEM(MX27_IO_P2V(x))
 
 #ifndef __ASSEMBLER__
@@ -280,7 +274,6 @@ extern int mx27_revision(void);
 #define CS4_BASE_ADDR MX27_CS4_BASE_ADDR
 #define CS5_BASE_ADDR MX27_CS5_BASE_ADDR
 #define X_MEMC_BASE_ADDR MX27_X_MEMC_BASE_ADDR
-#define X_MEMC_BASE_ADDR_VIRT MX27_X_MEMC_BASE_ADDR_VIRT
 #define X_MEMC_SIZE MX27_X_MEMC_SIZE
 #define NFC_BASE_ADDR MX27_NFC_BASE_ADDR
 #define SDRAMC_BASE_ADDR MX27_SDRAMC_BASE_ADDR
arch/arm/plat-mxc/include/mach/mx2x.h +2 -34
index afb895a..46eeeb2 100644
@@ -27,7 +27,7 @@
 
 /* Register offsets */
 #define MX2x_AIPI_BASE_ADDR		0x10000000
-#define MX2x_AIPI_BASE_ADDR_VIRT	0xf4000000
+#define MX2x_AIPI_BASE_ADDR_VIRT	0xf4400000
 #define MX2x_AIPI_SIZE			SZ_1M
 #define MX2x_DMA_BASE_ADDR			(MX2x_AIPI_BASE_ADDR + 0x01000)
 #define MX2x_WDOG_BASE_ADDR			(MX2x_AIPI_BASE_ADDR + 0x02000)
@@ -65,43 +65,12 @@
 #define MX2x_AVIC_BASE_ADDR		0x10040000
 
 #define MX2x_SAHB1_BASE_ADDR		0x80000000
-#define MX2x_SAHB1_BASE_ADDR_VIRT	0xf4100000
 #define MX2x_SAHB1_SIZE			SZ_1M
 #define MX2x_CSI_BASE_ADDR			(MX2x_SAHB1_BASE_ADDR + 0x0000)
 
-/*
- * This macro defines the physical to virtual address mapping for all the
- * peripheral modules. It is used by passing in the physical address as x
- * and returning the virtual address. If the physical address is not mapped,
- * it returns 0xDEADBEEF
- */
-#define IO_ADDRESS(x)   \
-	(void __force __iomem *) \
-	(((x >= AIPI_BASE_ADDR) && (x < (AIPI_BASE_ADDR + AIPI_SIZE))) ? \
-		AIPI_IO_ADDRESS(x) : \
-	((x >= SAHB1_BASE_ADDR) && (x < (SAHB1_BASE_ADDR + SAHB1_SIZE))) ? \
-		SAHB1_IO_ADDRESS(x) : \
-	((x >= X_MEMC_BASE_ADDR) && (x < (X_MEMC_BASE_ADDR + X_MEMC_SIZE))) ? \
-		X_MEMC_IO_ADDRESS(x) : 0xDEADBEEF)
-
-/* define the address mapping macros: in physical address order */
-#define AIPI_IO_ADDRESS(x)  \
+#define AIPI_IO_ADDRESS(x)	\
 	(((x) - AIPI_BASE_ADDR) + AIPI_BASE_ADDR_VIRT)
 
-#define AVIC_IO_ADDRESS(x)	AIPI_IO_ADDRESS(x)
-
-#define SAHB1_IO_ADDRESS(x)  \
-	(((x) - SAHB1_BASE_ADDR) + SAHB1_BASE_ADDR_VIRT)
-
-#define CS4_IO_ADDRESS(x)  \
-	(((x) - CS4_BASE_ADDR) + CS4_BASE_ADDR_VIRT)
-
-#define X_MEMC_IO_ADDRESS(x)  \
-	(((x) - X_MEMC_BASE_ADDR) + X_MEMC_BASE_ADDR_VIRT)
-
-#define PCMCIA_IO_ADDRESS(x) \
-	(((x) - X_MEMC_BASE_ADDR) + X_MEMC_BASE_ADDR_VIRT)
-
 /* fixed interrupt numbers */
 #define MX2x_INT_CSPI3		6
 #define MX2x_INT_GPIO		8
@@ -215,7 +184,6 @@
 #define MAX_BASE_ADDR MX2x_MAX_BASE_ADDR
 #define AVIC_BASE_ADDR MX2x_AVIC_BASE_ADDR
 #define SAHB1_BASE_ADDR MX2x_SAHB1_BASE_ADDR
-#define SAHB1_BASE_ADDR_VIRT MX2x_SAHB1_BASE_ADDR_VIRT
 #define SAHB1_SIZE MX2x_SAHB1_SIZE
 #define CSI_BASE_ADDR MX2x_CSI_BASE_ADDR
 #define MXC_INT_CSPI3 MX2x_INT_CSPI3
arch/arm/plat-mxc/include/mach/mx31.h +3 -13
index eb4a28d..9ed9975 100644
@@ -15,7 +15,6 @@
 #define MX31_L2CC_SIZE			SZ_1M
 
 #define MX31_AIPS1_BASE_ADDR		0x43f00000
-#define MX31_AIPS1_BASE_ADDR_VIRT	0xfc000000
 #define MX31_AIPS1_SIZE			SZ_1M
 #define MX31_MAX_BASE_ADDR			(MX31_AIPS1_BASE_ADDR + 0x04000)
 #define MX31_EVTMON_BASE_ADDR			(MX31_AIPS1_BASE_ADDR + 0x08000)
@@ -41,7 +40,6 @@
 #define MX31_ECT_IP2_BASE_ADDR			(MX31_AIPS1_BASE_ADDR + 0xbc000)
 
 #define MX31_SPBA0_BASE_ADDR		0x50000000
-#define MX31_SPBA0_BASE_ADDR_VIRT	0xfc100000
 #define MX31_SPBA0_SIZE			SZ_1M
 #define MX31_MMC_SDHC1_BASE_ADDR		(MX31_SPBA0_BASE_ADDR + 0x04000)
 #define MX31_MMC_SDHC2_BASE_ADDR		(MX31_SPBA0_BASE_ADDR + 0x08000)
@@ -55,7 +53,6 @@
 #define MX31_SPBA_CTRL_BASE_ADDR		(MX31_SPBA0_BASE_ADDR + 0x3c000)
 
 #define MX31_AIPS2_BASE_ADDR		0x53f00000
-#define MX31_AIPS2_BASE_ADDR_VIRT	0xfc200000
 #define MX31_AIPS2_SIZE			SZ_1M
 #define MX31_CCM_BASE_ADDR			(MX31_AIPS2_BASE_ADDR + 0x80000)
 #define MX31_CSPI3_BASE_ADDR			(MX31_AIPS2_BASE_ADDR + 0x84000)
@@ -84,7 +81,6 @@
 #define MX31_ROMP_SIZE			SZ_1M
 
 #define MX31_AVIC_BASE_ADDR		0x68000000
-#define MX31_AVIC_BASE_ADDR_VIRT	0xfc400000
 #define MX31_AVIC_SIZE			SZ_1M
 
 #define MX31_IPU_MEM_BASE_ADDR		0x70000000
@@ -97,15 +93,14 @@
 #define MX31_CS3_BASE_ADDR		0xb2000000
 
 #define MX31_CS4_BASE_ADDR		0xb4000000
-#define MX31_CS4_BASE_ADDR_VIRT		0xf4000000
+#define MX31_CS4_BASE_ADDR_VIRT		0xf6000000
 #define MX31_CS4_SIZE			SZ_32M
 
 #define MX31_CS5_BASE_ADDR		0xb6000000
-#define MX31_CS5_BASE_ADDR_VIRT		0xf6000000
+#define MX31_CS5_BASE_ADDR_VIRT		0xf8000000
 #define MX31_CS5_SIZE			SZ_32M
 
 #define MX31_X_MEMC_BASE_ADDR		0xb8000000
-#define MX31_X_MEMC_BASE_ADDR_VIRT	0xfc320000
 #define MX31_X_MEMC_SIZE		SZ_64K
 #define MX31_NFC_BASE_ADDR			(MX31_X_MEMC_BASE_ADDR + 0x0000)
 #define MX31_ESDCTL_BASE_ADDR			(MX31_X_MEMC_BASE_ADDR + 0x1000)
@@ -121,12 +116,7 @@
 
 #define MX31_PCMCIA_MEM_BASE_ADDR	0xbc000000
 
-#define MX31_IO_P2V(x)	(						\
-	IMX_IO_P2V_MODULE(x, MX31_AIPS1) ?:				\
-	IMX_IO_P2V_MODULE(x, MX31_AIPS2) ?:				\
-	IMX_IO_P2V_MODULE(x, MX31_AVIC) ?:				\
-	IMX_IO_P2V_MODULE(x, MX31_X_MEMC) ?:				\
-	IMX_IO_P2V_MODULE(x, MX31_SPBA0))
+#define MX31_IO_P2V(x)			IMX_IO_P2V(x)
 #define MX31_IO_ADDRESS(x)		IOMEM(MX31_IO_P2V(x))
 
 #ifndef __ASSEMBLER__
arch/arm/plat-mxc/include/mach/mx35.h +3 -14
index ce1a24b..3678ca3 100644
@@ -11,7 +11,6 @@
 #define MX35_L2CC_SIZE			SZ_1M
 
 #define MX35_AIPS1_BASE_ADDR		0x43f00000
-#define MX35_AIPS1_BASE_ADDR_VIRT	0xfc000000
 #define MX35_AIPS1_SIZE			SZ_1M
 #define MX35_MAX_BASE_ADDR			(MX35_AIPS1_BASE_ADDR + 0x04000)
 #define MX35_EVTMON_BASE_ADDR			(MX35_AIPS1_BASE_ADDR + 0x08000)
@@ -33,7 +32,6 @@
 #define MX35_ECT_IP2_BASE_ADDR			(MX35_AIPS1_BASE_ADDR + 0xbc000)
 
 #define MX35_SPBA0_BASE_ADDR		0x50000000
-#define MX35_SPBA0_BASE_ADDR_VIRT	0xfc100000
 #define MX35_SPBA0_SIZE			SZ_1M
 #define MX35_UART3_BASE_ADDR			(MX35_SPBA0_BASE_ADDR + 0x0c000)
 #define MX35_CSPI2_BASE_ADDR			(MX35_SPBA0_BASE_ADDR + 0x10000)
@@ -44,7 +42,6 @@
 #define MX35_SPBA_CTRL_BASE_ADDR		(MX35_SPBA0_BASE_ADDR + 0x3c000)
 
 #define MX35_AIPS2_BASE_ADDR		0x53f00000
-#define MX35_AIPS2_BASE_ADDR_VIRT	0xfc200000
 #define MX35_AIPS2_SIZE			SZ_1M
 #define MX35_CCM_BASE_ADDR			(MX35_AIPS2_BASE_ADDR + 0x80000)
 #define MX35_GPT1_BASE_ADDR			(MX35_AIPS2_BASE_ADDR + 0x90000)
@@ -72,11 +69,9 @@
 #define MX35_OTG_BASE_ADDR		0x53ff4000
 
 #define MX35_ROMP_BASE_ADDR		0x60000000
-#define MX35_ROMP_BASE_ADDR_VIRT	0xfc500000
 #define MX35_ROMP_SIZE			SZ_1M
 
 #define MX35_AVIC_BASE_ADDR		0x68000000
-#define MX35_AVIC_BASE_ADDR_VIRT	0xfc400000
 #define MX35_AVIC_SIZE			SZ_1M
 
 /*
@@ -92,18 +87,17 @@
 #define MX35_CS3_BASE_ADDR		0xb2000000
 
 #define MX35_CS4_BASE_ADDR		0xb4000000
-#define MX35_CS4_BASE_ADDR_VIRT		0xf4000000
+#define MX35_CS4_BASE_ADDR_VIRT		0xf6000000
 #define MX35_CS4_SIZE			SZ_32M
 
 #define MX35_CS5_BASE_ADDR		0xb6000000
-#define MX35_CS5_BASE_ADDR_VIRT		0xf6000000
+#define MX35_CS5_BASE_ADDR_VIRT		0xf8000000
 #define MX35_CS5_SIZE			SZ_32M
 
 /*
  * NAND, SDRAM, WEIM, M3IF, EMI controllers
  */
 #define MX35_X_MEMC_BASE_ADDR		0xb8000000
-#define MX35_X_MEMC_BASE_ADDR_VIRT	0xfc320000
 #define MX35_X_MEMC_SIZE		SZ_64K
 #define MX35_ESDCTL_BASE_ADDR			(MX35_X_MEMC_BASE_ADDR + 0x1000)
 #define MX35_WEIM_BASE_ADDR			(MX35_X_MEMC_BASE_ADDR + 0x2000)
@@ -114,12 +108,7 @@
 #define MX35_NFC_BASE_ADDR		0xbb000000
 #define MX35_PCMCIA_MEM_BASE_ADDR	0xbc000000
 
-#define MX35_IO_P2V(x)	(						\
-	IMX_IO_P2V_MODULE(x, MX35_AIPS1) ?:				\
-	IMX_IO_P2V_MODULE(x, MX35_AIPS2) ?:				\
-	IMX_IO_P2V_MODULE(x, MX35_AVIC) ?:				\
-	IMX_IO_P2V_MODULE(x, MX35_X_MEMC) ?:				\
-	IMX_IO_P2V_MODULE(x, MX35_SPBA0))
+#define MX35_IO_P2V(x)			IMX_IO_P2V(x)
 #define MX35_IO_ADDRESS(x)		IOMEM(MX35_IO_P2V(x))
 
 /*
arch/arm/plat-mxc/include/mach/mx3x.h +3 -62

146 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/mx51.h +2 -36
index e93cf5b..1b8715f 100644
@@ -2,31 +2,6 @@
 #define __MACH_MX51_H__
 
 /*
- * MX51 memory map:
- *
- *
- * Virt		Phys		Size	What
- * ---------------------------------------------------------------------------
- * fa3e0000	1ffe0000	128K	IRAM (SCCv2 RAM)
- *         	30000000	256M	GPU
- *         	40000000	512M	IPU
- * fa200000	60000000	1M	DEBUG
- * fb100000	70000000	1M	SPBA 0
- * fb000000	73f00000	1M	AIPS 1
- * fb200000	83f00000	1M	AIPS 2
- *		8fffc000	16K	TZIC (interrupt controller)
- *         	90000000	256M	CSD0 SDRAM/DDR
- *         	a0000000	256M	CSD1 SDRAM/DDR
- *         	b0000000	128M	CS0 Flash
- *         	b8000000	128M	CS1 Flash
- *         	c0000000	128M	CS2 Flash
- *         	c8000000	64M	CS3 Flash
- *         	cc000000	32M	CS4 SRAM
- *         	ce000000	32M	CS5 SRAM
- *		cfff0000	64K	NFC (NAND Flash AXI)
- */
-
-/*
  * IROM
  */
 #define MX51_IROM_BASE_ADDR		0x0
@@ -36,7 +11,6 @@
  * IRAM
  */
 #define MX51_IRAM_BASE_ADDR		0x1ffe0000	/* internal ram */
-#define MX51_IRAM_BASE_ADDR_VIRT	0xfa3e0000
 #define MX51_IRAM_PARTITIONS		16
 #define MX51_IRAM_SIZE		(MX51_IRAM_PARTITIONS * SZ_8K)	/* 128KB */
 
@@ -45,7 +19,6 @@
 #define MX51_IPU_CTRL_BASE_ADDR		0x40000000
 
 #define MX51_DEBUG_BASE_ADDR		0x60000000
-#define MX51_DEBUG_BASE_ADDR_VIRT	0xfa200000
 #define MX51_DEBUG_SIZE			SZ_1M
 
 #define MX51_ETB_BASE_ADDR		(MX51_DEBUG_BASE_ADDR + 0x01000)
@@ -61,7 +34,6 @@
  * SPBA global module enabled #0
  */
 #define MX51_SPBA0_BASE_ADDR		0x70000000
-#define MX51_SPBA0_BASE_ADDR_VIRT	0xfb100000
 #define MX51_SPBA0_SIZE			SZ_1M
 
 #define MX51_ESDHC1_BASE_ADDR		(MX51_SPBA0_BASE_ADDR + 0x04000)
@@ -81,7 +53,7 @@
  * AIPS 1
  */
 #define MX51_AIPS1_BASE_ADDR		0x73f00000
-#define MX51_AIPS1_BASE_ADDR_VIRT	0xfb000000
+#define MX51_AIPS1_BASE_ADDR_VIRT	0xf5700000
 #define MX51_AIPS1_SIZE			SZ_1M
 
 #define MX51_OTG_BASE_ADDR		(MX51_AIPS1_BASE_ADDR + 0x80000)
@@ -109,7 +81,6 @@
  * AIPS 2
  */
 #define MX51_AIPS2_BASE_ADDR		0x83f00000
-#define MX51_AIPS2_BASE_ADDR_VIRT	0xfb200000
 #define MX51_AIPS2_SIZE			SZ_1M
 
 #define MX51_PLL1_BASE_ADDR		(MX51_AIPS2_BASE_ADDR + 0x80000)
@@ -163,12 +134,7 @@
 #define MX51_GPU2D_BASE_ADDR		0xd0000000
 #define MX51_TZIC_BASE_ADDR		0xe0000000
 
-#define MX51_IO_P2V(x)	(						\
-	IMX_IO_P2V_MODULE(x, MX51_IRAM) ?:				\
-	IMX_IO_P2V_MODULE(x, MX51_DEBUG) ?:				\
-	IMX_IO_P2V_MODULE(x, MX51_SPBA0) ?:				\
-	IMX_IO_P2V_MODULE(x, MX51_AIPS1) ?:				\
-	IMX_IO_P2V_MODULE(x, MX51_AIPS2))
+#define MX51_IO_P2V(x)			IMX_IO_P2V(x)
 #define MX51_IO_ADDRESS(x)		IOMEM(MX51_IO_P2V(x))
 
 /* This is currently used in <mach/debug-macro.S>, but should go away */
arch/arm/plat-mxc/include/mach/mxc91231.h +2 -20
index 49e5e25..765190f 100644
@@ -21,14 +21,12 @@
  * L2CC
  */
 #define MXC91231_L2CC_BASE_ADDR		0x30000000
-#define MXC91231_L2CC_BASE_ADDR_VIRT	0xF9000000
 #define MXC91231_L2CC_SIZE		SZ_64K
 
 /*
  * AIPS 1
  */
 #define MXC91231_AIPS1_BASE_ADDR	0x43F00000
-#define MXC91231_AIPS1_BASE_ADDR_VIRT	0xFC000000
 #define MXC91231_AIPS1_SIZE		SZ_1M
 
 #define MXC91231_AIPS1_CTRL_BASE_ADDR	MXC91231_AIPS1_BASE_ADDR
@@ -53,7 +51,6 @@
  * AIPS 2
  */
 #define MXC91231_AIPS2_BASE_ADDR	0x53F00000
-#define MXC91231_AIPS2_BASE_ADDR_VIRT	0xFC100000
 #define MXC91231_AIPS2_SIZE		SZ_1M
 
 #define MXC91231_GEMK_BASE_ADDR		(MXC91231_AIPS2_BASE_ADDR + 0x8C000)
@@ -79,7 +76,6 @@
  * SPBA global module 0
  */
 #define MXC91231_SPBA0_BASE_ADDR	0x50000000
-#define MXC91231_SPBA0_BASE_ADDR_VIRT	0xFC200000
 #define MXC91231_SPBA0_SIZE		SZ_1M
 
 #define MXC91231_MMC_SDHC1_BASE_ADDR	(MXC91231_SPBA0_BASE_ADDR + 0x04000)
@@ -109,7 +105,6 @@
  * SPBA global module 1
  */
 #define MXC91231_SPBA1_BASE_ADDR	0x52000000
-#define MXC91231_SPBA1_BASE_ADDR_VIRT	0xFC300000
 #define MXC91231_SPBA1_SIZE		SZ_1M
 
 #define MXC91231_MQSPI_BASE_ADDR	(MXC91231_SPBA1_BASE_ADDR + 0x34000)
@@ -144,18 +139,15 @@
  * ROMP and AVIC
  */
 #define MXC91231_ROMP_BASE_ADDR		0x60000000
-#define MXC91231_ROMP_BASE_ADDR_VIRT	0xFC400000
 #define MXC91231_ROMP_SIZE		SZ_64K
 
 #define MXC91231_AVIC_BASE_ADDR		0x68000000
-#define MXC91231_AVIC_BASE_ADDR_VIRT	0xFC410000
 #define MXC91231_AVIC_SIZE		SZ_64K
 
 /*
  * NAND, SDRAM, WEIM, M3IF, EMI controllers
  */
 #define MXC91231_X_MEMC_BASE_ADDR	0xB8000000
-#define MXC91231_X_MEMC_BASE_ADDR_VIRT	0xFC420000
 #define MXC91231_X_MEMC_SIZE		SZ_64K
 
 #define MXC91231_NFC_BASE_ADDR		(MXC91231_X_MEMC_BASE_ADDR + 0x0000)
@@ -183,19 +175,9 @@
 /*
  * This macro defines the physical to virtual address mapping for all the
  * peripheral modules. It is used by passing in the physical address as x
- * and returning the virtual address. If the physical address is not mapped,
- * it returns 0.
+ * and returning the virtual address.
  */
-
-#define MXC91231_IO_P2V(x)	(					\
-	IMX_IO_P2V_MODULE(x, MXC91231_L2CC) ?:				\
-	IMX_IO_P2V_MODULE(x, MXC91231_X_MEMC) ?:			\
-	IMX_IO_P2V_MODULE(x, MXC91231_ROMP) ?:				\
-	IMX_IO_P2V_MODULE(x, MXC91231_AVIC) ?:				\
-	IMX_IO_P2V_MODULE(x, MXC91231_AIPS1) ?:				\
-	IMX_IO_P2V_MODULE(x, MXC91231_SPBA0) ?:				\
-	IMX_IO_P2V_MODULE(x, MXC91231_SPBA1) ?:				\
-	IMX_IO_P2V_MODULE(x, MXC91231_AIPS2))
+#define MXC91231_IO_P2V(x)		IMX_IO_P2V(x)
 #define MXC91231_IO_ADDRESS(x)		IOMEM(MXC91231_IO_P2V(x))
 
 /*
Signature · 1 line
1.7.2.3
#20 lore raw

PATCH 6/7 imx/debug-macro: rework using the new io mapping macro

In reply to Uwe Kleine-König

This gets rid of the last user of IMX_NEEDS_DEPRECATED_SYMBOLS.

---
 arch/arm/plat-mxc/include/mach/debug-macro.S |   23 +++++++----------------
 arch/arm/plat-mxc/include/mach/mx25.h        |    4 ----
 arch/arm/plat-mxc/include/mach/mx2x.h        |    5 -----
 arch/arm/plat-mxc/include/mach/mx3x.h        |    5 -----
 arch/arm/plat-mxc/include/mach/mx51.h        |    5 -----
 5 files changed, 7 insertions(+), 35 deletions(-)
arch/arm/plat-mxc/include/mach/debug-macro.S +7 -16
index 2560640..8170894 100644
@@ -10,58 +10,49 @@
  * published by the Free Software Foundation.
  *
  */
-#define IMX_NEEDS_DEPRECATED_SYMBOLS
+#include <mach/hardware.h>
 
 #ifdef CONFIG_ARCH_MX1
-#include <mach/mx1.h>
-#define UART_PADDR	UART1_BASE_ADDR
-#define UART_VADDR	IO_ADDRESS(UART1_BASE_ADDR)
+#define UART_PADDR	MX1_UART1_BASE_ADDR
 #endif
 
 #ifdef CONFIG_ARCH_MX25
 #ifdef UART_PADDR
 #error "CONFIG_DEBUG_LL is incompatible with multiple archs"
 #endif
-#include <mach/mx25.h>
 #define UART_PADDR	MX25_UART1_BASE_ADDR
-#define UART_VADDR	MX25_AIPS1_IO_ADDRESS(MX25_UART1_BASE_ADDR)
 #endif
 
 #ifdef CONFIG_ARCH_MX2
 #ifdef UART_PADDR
 #error "CONFIG_DEBUG_LL is incompatible with multiple archs"
 #endif
-#include <mach/mx2x.h>
-#define UART_PADDR	UART1_BASE_ADDR
-#define UART_VADDR	AIPI_IO_ADDRESS(UART1_BASE_ADDR)
+#define UART_PADDR	MX2x_UART1_BASE_ADDR
 #endif
 
 #ifdef CONFIG_ARCH_MX3
 #ifdef UART_PADDR
 #error "CONFIG_DEBUG_LL is incompatible with multiple archs"
 #endif
-#include <mach/mx3x.h>
-#define UART_PADDR	UART1_BASE_ADDR
-#define UART_VADDR	AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
+#define UART_PADDR	MX3x_UART1_BASE_ADDR
 #endif
 
 #ifdef CONFIG_ARCH_MX5
 #ifdef UART_PADDR
 #error "CONFIG_DEBUG_LL is incompatible with multiple archs"
 #endif
-#include <mach/mx51.h>
 #define UART_PADDR	MX51_UART1_BASE_ADDR
-#define UART_VADDR	MX51_AIPS1_IO_ADDRESS(MX51_UART1_BASE_ADDR)
 #endif
 
 #ifdef CONFIG_ARCH_MXC91231
 #ifdef UART_PADDR
 #error "CONFIG_DEBUG_LL is incompatible with multiple archs"
 #endif
-#include <mach/mxc91231.h>
 #define UART_PADDR	MXC91231_UART2_BASE_ADDR
-#define UART_VADDR	MXC91231_IO_ADDRESS(MXC91231_UART2_BASE_ADDR)
 #endif
+
+#define UART_VADDR	IMX_IO_ADDRESS(UART_PADDR)
+
 		.macro	addruart, rx, tmp
 		mrc	p15, 0, \rx, c1, c0
 		tst	\rx, #1			@ MMU enabled?
arch/arm/plat-mxc/include/mach/mx25.h +0 -4
index aac6a9c..a2404b0 100644
@@ -2,7 +2,6 @@
 #define __MACH_MX25_H__
 
 #define MX25_AIPS1_BASE_ADDR		0x43f00000
-#define MX25_AIPS1_BASE_ADDR_VIRT	0xf5300000
 #define MX25_AIPS1_SIZE			SZ_1M
 #define MX25_AIPS2_BASE_ADDR		0x53f00000
 #define MX25_AIPS2_SIZE			SZ_1M
@@ -25,9 +24,6 @@
 #define MX25_GPIO2_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xd0000)
 #define MX25_WDOG_BASE_ADDR		(MX25_AIPS2_BASE_ADDR + 0xdc000)
 
-#define MX25_AIPS1_IO_ADDRESS(x) \
-	(((x) - MX25_AIPS1_BASE_ADDR) + MX25_AIPS1_BASE_ADDR_VIRT)
-
 #define MX25_UART1_BASE_ADDR		0x43f90000
 #define MX25_UART2_BASE_ADDR		0x43f94000
 #define MX25_AUDMUX_BASE_ADDR		0x43fb0000
arch/arm/plat-mxc/include/mach/mx2x.h +0 -5
index 46eeeb2..a056948 100644
@@ -27,7 +27,6 @@
 
 /* Register offsets */
 #define MX2x_AIPI_BASE_ADDR		0x10000000
-#define MX2x_AIPI_BASE_ADDR_VIRT	0xf4400000
 #define MX2x_AIPI_SIZE			SZ_1M
 #define MX2x_DMA_BASE_ADDR			(MX2x_AIPI_BASE_ADDR + 0x01000)
 #define MX2x_WDOG_BASE_ADDR			(MX2x_AIPI_BASE_ADDR + 0x02000)
@@ -68,9 +67,6 @@
 #define MX2x_SAHB1_SIZE			SZ_1M
 #define MX2x_CSI_BASE_ADDR			(MX2x_SAHB1_BASE_ADDR + 0x0000)
 
-#define AIPI_IO_ADDRESS(x)	\
-	(((x) - AIPI_BASE_ADDR) + AIPI_BASE_ADDR_VIRT)
-
 /* fixed interrupt numbers */
 #define MX2x_INT_CSPI3		6
 #define MX2x_INT_GPIO		8
@@ -148,7 +144,6 @@
 #ifdef IMX_NEEDS_DEPRECATED_SYMBOLS
 /* these should go away */
 #define AIPI_BASE_ADDR MX2x_AIPI_BASE_ADDR
-#define AIPI_BASE_ADDR_VIRT MX2x_AIPI_BASE_ADDR_VIRT
 #define AIPI_SIZE MX2x_AIPI_SIZE
 #define DMA_BASE_ADDR MX2x_DMA_BASE_ADDR
 #define WDOG_BASE_ADDR MX2x_WDOG_BASE_ADDR
arch/arm/plat-mxc/include/mach/mx3x.h +0 -5
index da22cd4..3d6cc45 100644
@@ -44,7 +44,6 @@
  * AIPS 1
  */
 #define MX3x_AIPS1_BASE_ADDR		0x43f00000
-#define MX3x_AIPS1_BASE_ADDR_VIRT	0xf5300000
 #define MX3x_AIPS1_SIZE			SZ_1M
 #define MX3x_MAX_BASE_ADDR			(MX3x_AIPS1_BASE_ADDR + 0x04000)
 #define MX3x_EVTMON_BASE_ADDR			(MX3x_AIPS1_BASE_ADDR + 0x08000)
@@ -141,9 +140,6 @@
 
 #define MX3x_PCMCIA_MEM_BASE_ADDR	0xbc000000
 
-#define AIPS1_IO_ADDRESS(x)  \
-	(((x) - AIPS1_BASE_ADDR) + AIPS1_BASE_ADDR_VIRT)
-
 /*
  * Interrupt numbers
  */
@@ -230,7 +226,6 @@ static inline int mx35_revision(void)
 #define L2CC_BASE_ADDR MX3x_L2CC_BASE_ADDR
 #define L2CC_SIZE MX3x_L2CC_SIZE
 #define AIPS1_BASE_ADDR MX3x_AIPS1_BASE_ADDR
-#define AIPS1_BASE_ADDR_VIRT MX3x_AIPS1_BASE_ADDR_VIRT
 #define AIPS1_SIZE MX3x_AIPS1_SIZE
 #define MAX_BASE_ADDR MX3x_MAX_BASE_ADDR
 #define EVTMON_BASE_ADDR MX3x_EVTMON_BASE_ADDR
arch/arm/plat-mxc/include/mach/mx51.h +0 -5
index 1b8715f..636347c 100644
@@ -53,7 +53,6 @@
  * AIPS 1
  */
 #define MX51_AIPS1_BASE_ADDR		0x73f00000
-#define MX51_AIPS1_BASE_ADDR_VIRT	0xf5700000
 #define MX51_AIPS1_SIZE			SZ_1M
 
 #define MX51_OTG_BASE_ADDR		(MX51_AIPS1_BASE_ADDR + 0x80000)
@@ -137,10 +136,6 @@
 #define MX51_IO_P2V(x)			IMX_IO_P2V(x)
 #define MX51_IO_ADDRESS(x)		IOMEM(MX51_IO_P2V(x))
 
-/* This is currently used in <mach/debug-macro.S>, but should go away */
-#define MX51_AIPS1_IO_ADDRESS(x)  \
-	(((x) - MX51_AIPS1_BASE_ADDR) + MX51_AIPS1_BASE_ADDR_VIRT)
-
 /*
  * defines for SPBA modules
  */
Signature · 1 line
1.7.2.3
#21 lore raw

PATCH 6/7 imx/debug-macro: rework using the new io mapping macro

Quoted 10 lines · Uwe Kleine-K?nig

This gets rid of the last user of IMX_NEEDS_DEPRECATED_SYMBOLS.

---
 arch/arm/plat-mxc/include/mach/debug-macro.S |   23 +++++++----------------
 arch/arm/plat-mxc/include/mach/mx25.h        |    4 ----
 arch/arm/plat-mxc/include/mach/mx2x.h        |    5 -----
 arch/arm/plat-mxc/include/mach/mx3x.h        |    5 -----
 arch/arm/plat-mxc/include/mach/mx51.h        |    5 -----
 5 files changed, 7 insertions(+), 35 deletions(-)

Note this patch conflicts with

0ea1293 (arm: return both physical and virtual addresses from addruart)

But it's easy to resolve. If (and when) we agree that we want to change the io mapping I can provide an up to date patch if need be.

Best regards
Uwe

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

PATCH 7/7 imx: remove deprecated symbols as all users are gone now

In reply to Uwe Kleine-König
---
 arch/arm/plat-mxc/include/mach/mx1.h  |  127 ---------------------------------
 arch/arm/plat-mxc/include/mach/mx21.h |   34 ---------
 arch/arm/plat-mxc/include/mach/mx27.h |   69 ------------------
 arch/arm/plat-mxc/include/mach/mx2x.h |  112 -----------------------------
 arch/arm/plat-mxc/include/mach/mx31.h |   32 --------
 arch/arm/plat-mxc/include/mach/mx35.h |   16 ----
 arch/arm/plat-mxc/include/mach/mx3x.h |  114 -----------------------------
 7 files changed, 0 insertions(+), 504 deletions(-)
arch/arm/plat-mxc/include/mach/mx1.h +0 -127
index 6541798..ed2fb91 100644
@@ -165,131 +165,4 @@
  */
 #define USBD_INT0		MX1_USBD_INT0
 
-#ifdef IMX_NEEDS_DEPRECATED_SYMBOLS
-/* these should go away */
-#define IMX_IO_PHYS MX1_IO_BASE_ADDR
-#define IMX_IO_SIZE MX1_IO_SIZE
-#define IMX_CS0_PHYS MX1_CS0_PHYS
-#define IMX_CS0_SIZE MX1_CS0_SIZE
-#define IMX_CS1_PHYS MX1_CS1_PHYS
-#define IMX_CS1_SIZE MX1_CS1_SIZE
-#define IMX_CS2_PHYS MX1_CS2_PHYS
-#define IMX_CS2_SIZE MX1_CS2_SIZE
-#define IMX_CS3_PHYS MX1_CS3_PHYS
-#define IMX_CS3_SIZE MX1_CS3_SIZE
-#define IMX_CS4_PHYS MX1_CS4_PHYS
-#define IMX_CS4_SIZE MX1_CS4_SIZE
-#define IMX_CS5_PHYS MX1_CS5_PHYS
-#define IMX_CS5_SIZE MX1_CS5_SIZE
-#define AIPI1_BASE_ADDR MX1_AIPI1_BASE_ADDR
-#define WDT_BASE_ADDR MX1_WDT_BASE_ADDR
-#define TIM1_BASE_ADDR MX1_TIM1_BASE_ADDR
-#define TIM2_BASE_ADDR MX1_TIM2_BASE_ADDR
-#define RTC_BASE_ADDR MX1_RTC_BASE_ADDR
-#define LCDC_BASE_ADDR MX1_LCDC_BASE_ADDR
-#define UART1_BASE_ADDR MX1_UART1_BASE_ADDR
-#define UART2_BASE_ADDR MX1_UART2_BASE_ADDR
-#define PWM_BASE_ADDR MX1_PWM_BASE_ADDR
-#define DMA_BASE_ADDR MX1_DMA_BASE_ADDR
-#define AIPI2_BASE_ADDR MX1_AIPI2_BASE_ADDR
-#define SIM_BASE_ADDR MX1_SIM_BASE_ADDR
-#define USBD_BASE_ADDR MX1_USBD_BASE_ADDR
-#define SPI1_BASE_ADDR MX1_SPI1_BASE_ADDR
-#define MMC_BASE_ADDR MX1_MMC_BASE_ADDR
-#define ASP_BASE_ADDR MX1_ASP_BASE_ADDR
-#define BTA_BASE_ADDR MX1_BTA_BASE_ADDR
-#define I2C_BASE_ADDR MX1_I2C_BASE_ADDR
-#define SSI_BASE_ADDR MX1_SSI_BASE_ADDR
-#define SPI2_BASE_ADDR MX1_SPI2_BASE_ADDR
-#define MSHC_BASE_ADDR MX1_MSHC_BASE_ADDR
-#define CCM_BASE_ADDR MX1_CCM_BASE_ADDR
-#define SCM_BASE_ADDR MX1_SCM_BASE_ADDR
-#define GPIO_BASE_ADDR MX1_GPIO_BASE_ADDR
-#define EIM_BASE_ADDR MX1_EIM_BASE_ADDR
-#define SDRAMC_BASE_ADDR MX1_SDRAMC_BASE_ADDR
-#define MMA_BASE_ADDR MX1_MMA_BASE_ADDR
-#define AVIC_BASE_ADDR MX1_AVIC_BASE_ADDR
-#define CSI_BASE_ADDR MX1_CSI_BASE_ADDR
-#define IO_ADDRESS(x) MX1_IO_ADDRESS(x)
-#define AVIC_IO_ADDRESS(x) IO_ADDRESS(x)
-#define INT_SOFTINT MX1_INT_SOFTINT
-#define CSI_INT MX1_CSI_INT
-#define DSPA_MAC_INT MX1_DSPA_MAC_INT
-#define DSPA_INT MX1_DSPA_INT
-#define COMP_INT MX1_COMP_INT
-#define MSHC_XINT MX1_MSHC_XINT
-#define GPIO_INT_PORTA MX1_GPIO_INT_PORTA
-#define GPIO_INT_PORTB MX1_GPIO_INT_PORTB
-#define GPIO_INT_PORTC MX1_GPIO_INT_PORTC
-#define LCDC_INT MX1_LCDC_INT
-#define SIM_INT MX1_SIM_INT
-#define SIM_DATA_INT MX1_SIM_DATA_INT
-#define RTC_INT MX1_RTC_INT
-#define RTC_SAMINT MX1_RTC_SAMINT
-#define UART2_MINT_PFERR MX1_UART2_MINT_PFERR
-#define UART2_MINT_RTS MX1_UART2_MINT_RTS
-#define UART2_MINT_DTR MX1_UART2_MINT_DTR
-#define UART2_MINT_UARTC MX1_UART2_MINT_UARTC
-#define UART2_MINT_TX MX1_UART2_MINT_TX
-#define UART2_MINT_RX MX1_UART2_MINT_RX
-#define UART1_MINT_PFERR MX1_UART1_MINT_PFERR
-#define UART1_MINT_RTS MX1_UART1_MINT_RTS
-#define UART1_MINT_DTR MX1_UART1_MINT_DTR
-#define UART1_MINT_UARTC MX1_UART1_MINT_UARTC
-#define UART1_MINT_TX MX1_UART1_MINT_TX
-#define UART1_MINT_RX MX1_UART1_MINT_RX
-#define VOICE_DAC_INT MX1_VOICE_DAC_INT
-#define VOICE_ADC_INT MX1_VOICE_ADC_INT
-#define PEN_DATA_INT MX1_PEN_DATA_INT
-#define PWM_INT MX1_PWM_INT
-#define SDHC_INT MX1_SDHC_INT
-#define I2C_INT MX1_INT_I2C
-#define CSPI_INT MX1_CSPI_INT
-#define SSI_TX_INT MX1_SSI_TX_INT
-#define SSI_TX_ERR_INT MX1_SSI_TX_ERR_INT
-#define SSI_RX_INT MX1_SSI_RX_INT
-#define SSI_RX_ERR_INT MX1_SSI_RX_ERR_INT
-#define TOUCH_INT MX1_TOUCH_INT
-#define USBD_INT1 MX1_USBD_INT1
-#define USBD_INT2 MX1_USBD_INT2
-#define USBD_INT3 MX1_USBD_INT3
-#define USBD_INT4 MX1_USBD_INT4
-#define USBD_INT5 MX1_USBD_INT5
-#define USBD_INT6 MX1_USBD_INT6
-#define BTSYS_INT MX1_BTSYS_INT
-#define BTTIM_INT MX1_BTTIM_INT
-#define BTWUI_INT MX1_BTWUI_INT
-#define TIM2_INT MX1_TIM2_INT
-#define TIM1_INT MX1_TIM1_INT
-#define DMA_ERR MX1_DMA_ERR
-#define DMA_INT MX1_DMA_INT
-#define GPIO_INT_PORTD MX1_GPIO_INT_PORTD
-#define WDT_INT MX1_WDT_INT
-#define DMA_REQ_UART3_T MX1_DMA_REQ_UART3_T
-#define DMA_REQ_UART3_R MX1_DMA_REQ_UART3_R
-#define DMA_REQ_SSI2_T MX1_DMA_REQ_SSI2_T
-#define DMA_REQ_SSI2_R MX1_DMA_REQ_SSI2_R
-#define DMA_REQ_CSI_STAT MX1_DMA_REQ_CSI_STAT
-#define DMA_REQ_CSI_R MX1_DMA_REQ_CSI_R
-#define DMA_REQ_MSHC MX1_DMA_REQ_MSHC
-#define DMA_REQ_DSPA_DCT_DOUT MX1_DMA_REQ_DSPA_DCT_DOUT
-#define DMA_REQ_DSPA_DCT_DIN MX1_DMA_REQ_DSPA_DCT_DIN
-#define DMA_REQ_DSPA_MAC MX1_DMA_REQ_DSPA_MAC
-#define DMA_REQ_EXT MX1_DMA_REQ_EXT
-#define DMA_REQ_SDHC MX1_DMA_REQ_SDHC
-#define DMA_REQ_SPI1_R MX1_DMA_REQ_SPI1_R
-#define DMA_REQ_SPI1_T MX1_DMA_REQ_SPI1_T
-#define DMA_REQ_SSI_T MX1_DMA_REQ_SSI_T
-#define DMA_REQ_SSI_R MX1_DMA_REQ_SSI_R
-#define DMA_REQ_ASP_DAC MX1_DMA_REQ_ASP_DAC
-#define DMA_REQ_ASP_ADC MX1_DMA_REQ_ASP_ADC
-#define DMA_REQ_USP_EP(x) MX1_DMA_REQ_USP_EP(x)
-#define DMA_REQ_SPI2_R MX1_DMA_REQ_SPI2_R
-#define DMA_REQ_SPI2_T MX1_DMA_REQ_SPI2_T
-#define DMA_REQ_UART2_T MX1_DMA_REQ_UART2_T
-#define DMA_REQ_UART2_R MX1_DMA_REQ_UART2_R
-#define DMA_REQ_UART1_T MX1_DMA_REQ_UART1_T
-#define DMA_REQ_UART1_R MX1_DMA_REQ_UART1_R
-#endif /* ifdef IMX_NEEDS_DEPRECATED_SYMBOLS */
-
 #endif /* ifndef __MACH_MX1_H__ */
arch/arm/plat-mxc/include/mach/mx21.h +0 -34
index b417e32..a82f590 100644
@@ -179,38 +179,4 @@
 #define MX21_DMA_REQ_CSI_STAT	30
 #define MX21_DMA_REQ_CSI_RX	31
 
-#ifdef IMX_NEEDS_DEPRECATED_SYMBOLS
-/* these should go away */
-#define SDRAM_BASE_ADDR MX21_SDRAM_BASE_ADDR
-#define CSD1_BASE_ADDR MX21_CSD1_BASE_ADDR
-#define CS0_BASE_ADDR MX21_CS0_BASE_ADDR
-#define CS1_BASE_ADDR MX21_CS1_BASE_ADDR
-#define CS2_BASE_ADDR MX21_CS2_BASE_ADDR
-#define CS3_BASE_ADDR MX21_CS3_BASE_ADDR
-#define CS4_BASE_ADDR MX21_CS4_BASE_ADDR
-#define PCMCIA_MEM_BASE_ADDR MX21_PCMCIA_MEM_BASE_ADDR
-#define CS5_BASE_ADDR MX21_CS5_BASE_ADDR
-#define X_MEMC_BASE_ADDR MX21_X_MEMC_BASE_ADDR
-#define X_MEMC_SIZE MX21_X_MEMC_SIZE
-#define SDRAMC_BASE_ADDR MX21_SDRAMC_BASE_ADDR
-#define EIM_BASE_ADDR MX21_EIM_BASE_ADDR
-#define PCMCIA_CTL_BASE_ADDR MX21_PCMCIA_CTL_BASE_ADDR
-#define NFC_BASE_ADDR MX21_NFC_BASE_ADDR
-#define IRAM_BASE_ADDR MX21_IRAM_BASE_ADDR
-#define MXC_INT_FIRI MX21_INT_FIRI
-#define MXC_INT_BMI MX21_INT_BMI
-#define MXC_INT_EMMAENC MX21_INT_EMMAENC
-#define MXC_INT_EMMADEC MX21_INT_EMMADEC
-#define MXC_INT_USBWKUP MX21_INT_USBWKUP
-#define MXC_INT_USBDMA MX21_INT_USBDMA
-#define MXC_INT_USBHOST MX21_INT_USBHOST
-#define MXC_INT_USBFUNC MX21_INT_USBFUNC
-#define MXC_INT_USBMNP MX21_INT_USBMNP
-#define MXC_INT_USBCTRL MX21_INT_USBCTRL
-#define MXC_INT_USBCTRL MX21_INT_USBCTRL
-#define DMA_REQ_FIRI_RX MX21_DMA_REQ_FIRI_RX
-#define DMA_REQ_BMI_TX MX21_DMA_REQ_BMI_TX
-#define DMA_REQ_BMI_RX MX21_DMA_REQ_BMI_RX
-#endif
-
 #endif /* ifndef __MACH_MX21_H__ */
arch/arm/plat-mxc/include/mach/mx27.h +0 -69

73 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/mx2x.h +0 -112

116 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/mx31.h +0 -32
index 9ed9975..6d4b98f 100644
@@ -215,36 +215,4 @@ static inline void mx31_setup_weimcs(size_t cs,
 #define MX31_SYSTEM_REV_MIN		MX31_CHIP_REV_1_0
 #define MX31_SYSTEM_REV_NUM		3
 
-#ifdef IMX_NEEDS_DEPRECATED_SYMBOLS
-/* these should go away */
-#define ATA_BASE_ADDR MX31_ATA_BASE_ADDR
-#define UART4_BASE_ADDR MX31_UART4_BASE_ADDR
-#define UART5_BASE_ADDR MX31_UART5_BASE_ADDR
-#define MMC_SDHC1_BASE_ADDR MX31_MMC_SDHC1_BASE_ADDR
-#define MMC_SDHC2_BASE_ADDR MX31_MMC_SDHC2_BASE_ADDR
-#define SIM1_BASE_ADDR MX31_SIM1_BASE_ADDR
-#define IIM_BASE_ADDR MX31_IIM_BASE_ADDR
-#define CSPI3_BASE_ADDR MX31_CSPI3_BASE_ADDR
-#define FIRI_BASE_ADDR MX31_FIRI_BASE_ADDR
-#define SCM_BASE_ADDR MX31_SCM_BASE_ADDR
-#define SMN_BASE_ADDR MX31_SMN_BASE_ADDR
-#define MPEG4_ENC_BASE_ADDR MX31_MPEG4_ENC_BASE_ADDR
-#define MXC_INT_MPEG4_ENCODER MX31_INT_MPEG4_ENCODER
-#define MXC_INT_FIRI MX31_INT_FIRI
-#define MXC_INT_MBX MX31_INT_MBX
-#define MXC_INT_CSPI3 MX31_INT_CSPI3
-#define MXC_INT_SIM2 MX31_INT_SIM2
-#define MXC_INT_SIM1 MX31_INT_SIM1
-#define MXC_INT_CCM_DVFS MX31_INT_CCM_DVFS
-#define MXC_INT_USB1 MX31_INT_USB1
-#define MXC_INT_USB2 MX31_INT_USB2
-#define MXC_INT_USB3 MX31_INT_USB3
-#define MXC_INT_USB4 MX31_INT_USB4
-#define MXC_INT_MSHC2 MX31_INT_MSHC2
-#define MXC_INT_UART4 MX31_INT_UART4
-#define MXC_INT_UART5 MX31_INT_UART5
-#define MXC_INT_CCM MX31_INT_CCM
-#define MXC_INT_PCMCIA MX31_INT_PCMCIA
-#endif
-
 #endif /* ifndef __MACH_MX31_H__ */
arch/arm/plat-mxc/include/mach/mx35.h +0 -16
index 3678ca3..9067225 100644
@@ -183,20 +183,4 @@
 #define MX35_SYSTEM_REV_MIN		MX3x_CHIP_REV_1_0
 #define MX35_SYSTEM_REV_NUM		3
 
-#ifdef IMX_NEEDS_DEPRECATED_SYMBOLS
-/* these should go away */
-#define MXC_FEC_BASE_ADDR MX35_FEC_BASE_ADDR
-#define MXC_INT_OWIRE MX35_INT_OWIRE
-#define MXC_INT_GPU2D MX35_INT_GPU2D
-#define MXC_INT_ASRC MX35_INT_ASRC
-#define MXC_INT_USBHS MX35_INT_USBHS
-#define MXC_INT_USBOTG MX35_INT_USBOTG
-#define MXC_INT_ESAI MX35_INT_ESAI
-#define MXC_INT_CAN1 MX35_INT_CAN1
-#define MXC_INT_CAN2 MX35_INT_CAN2
-#define MXC_INT_MLB MX35_INT_MLB
-#define MXC_INT_SPDIF MX35_INT_SPDIF
-#define MXC_INT_FEC MX35_INT_FEC
-#endif
-
 #endif /* ifndef __MACH_MX35_H__ */
arch/arm/plat-mxc/include/mach/mx3x.h +0 -114

118 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#23 lore raw

PATCH 2/3 mx1: fix build when DEBUG_LL is enabled

In reply to Russell King - ARM Linux

Commit "mx1: prefix SOC specific defines with MX1_ and deprecate old names" redefined the IO_ADDRESS macro in a way that is incompatible with debug-macro.S. Use MX1_IO_ADDRESS instead.

---
 arch/arm/plat-mxc/include/mach/debug-macro.S |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/plat-mxc/include/mach/debug-macro.S +1 -1
index 133d66b..4c7d9f8 100644
@@ -15,7 +15,7 @@
 #ifdef CONFIG_ARCH_MX1
 #include <mach/mx1.h>
 #define UART_PADDR	UART1_BASE_ADDR
-#define UART_VADDR	IO_ADDRESS(UART1_BASE_ADDR)
+#define UART_VADDR	MX1_IO_ADDRESS(UART1_BASE_ADDR)
 #endif
 
 #ifdef CONFIG_ARCH_MX25
Signature · 1 line
1.7.0
#24 lore raw

PATCH 3/3 mx25: fix build when DEBUG_LL is enabled

In reply to Russell King - ARM Linux

From: Alex Greshgorin <[email protected]>

Commit "imx25: redefine MX25_IO_ADDRESS using IMX_IO_ADDRESS" removed the MX25_AIPS1_IO_ADDRESS macro which is used in debug-macro.S. Include mach/hardware.h, and use the higher level IMX_IO_ADDRESS which is assembly compatible

---
 arch/arm/plat-mxc/include/mach/debug-macro.S |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/plat-mxc/include/mach/debug-macro.S +2 -2
index 4c7d9f8..da75db8 100644
@@ -22,9 +22,9 @@
 #ifdef UART_PADDR
 #error "CONFIG_DEBUG_LL is incompatible with multiple archs"
 #endif
-#include <mach/mx25.h>
+#include <mach/hardware.h>
 #define UART_PADDR	UART1_BASE_ADDR
-#define UART_VADDR	MX25_AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
+#define UART_VADDR	IMX_IO_ADDRESS(UART1_BASE_ADDR, MX25_AIPS1)
 #endif
 
 #ifdef CONFIG_ARCH_MX2
Signature · 1 line
1.7.0