Skip to contentSkip to conversation

pxa/zeus: Allow use of 8250-compatible UART in uncompress

PATCH New Marc Zyngier 2 participants 4 messages Dec 10, 2009

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

PATCH 1/1 pxa/zeus: Allow use of 8250-compatible UART in uncompress

Zeus console port is wired to a 8250-compatible device (pxa UARTs are reserved to other uses). This patch allows such a configuration in the uncompress sequence.

---
 arch/arm/mach-pxa/include/mach/uncompress.h |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)
arch/arm/mach-pxa/include/mach/uncompress.h +15 -5
index 237734b..dc94a34 100644
@@ -13,17 +13,21 @@
 #include <mach/regs-uart.h>
 #include <asm/mach-types.h>
 
-#define __REG(x)       ((volatile unsigned long *)x)
+#define __REG(x)       ((volatile char *)x)
 
-static volatile unsigned long *UART = FFUART;
+static volatile char *UART = FFUART;
+static int shift = 2;
+static int is_pxa_uart = 1;
+
+#define UART_REG(x)	UART[(x) << shift]
 
 static inline void putc(char c)
 {
-	if (!(UART[UART_IER] & IER_UUE))
+	if (is_pxa_uart && !(UART_REG(UART_IER) & IER_UUE))
 		return;
-	while (!(UART[UART_LSR] & LSR_TDRQ))
+	while (!(UART_REG(UART_LSR) & LSR_TDRQ))
 		barrier();
-	UART[UART_TX] = c;
+	UART_REG(UART_TX) = c;
 }
 
 /*
@@ -39,6 +43,12 @@ static inline void arch_decomp_setup(void)
 	    || machine_is_csb726() || machine_is_stargate2()
 	    || machine_is_cm_x300() || machine_is_balloon3())
 		UART = STUART;
+
+	if (machine_is_arcom_zeus()) {
+		UART = __REG(0x10000000);
+		is_pxa_uart = 0;
+		shift = 1;
+	}
 }
 
 /*
Signature · 6 lines
1.6.0.4



-- 
I'm the slime oozin' out from your TV set...
#1 lore raw

PATCH 1/1 pxa/zeus: Allow use of 8250-compatible UART in uncompress

Quoted 3 lines · Marc Zyngier

Zeus console port is wired to a 8250-compatible device (pxa UARTs are reserved to other uses). This patch allows such a configuration in the uncompress sequence.

Was that tested for regressions with PXA UARTs?

I didn't, but ...

Quoted 7 lines
arch/arm/mach-pxa/include/mach/uncompress.h +0 -0
index 237734b..dc94a34 100644
@@ -13,17 +13,21 @@
 #include <mach/regs-uart.h>
 #include <asm/mach-types.h>

arch/arm/mach-pxa/include/mach/uncompress.h line 22

Quoted 10 lines
arch/arm/mach-pxa/include/mach/uncompress.h +6 -2
 
-#define __REG(x)       ((volatile unsigned long *)x)
+#define __REG(x)       ((volatile char *)x)
 
-static volatile unsigned long *UART = FFUART;
+static volatile char *UART = FFUART;
+static int shift = 2;
+static int is_pxa_uart = 1;
+
+#define UART_REG(x)	UART[(x) << shift]

... with UART being char* now (and as UART_REG is just a macro) it will only be 8 bits in width, and hence all logic that accesses bits beyond that scope wil fail. Tricky casting might help here, but your referencing that as an array, so the value will be &= 0xff. Or did I overlook anything?

I'd say you'll need an inline function for that.

Daniel

#2 lore raw

PATCH 1/1 pxa/zeus: Allow use of 8250-compatible UART in uncompress

Quoted 6 lines · On Thu, 10 Dec 2009 15:12:08 +0800 Daniel Mack <[email protected]> wrote:
Quoted 3 lines · Marc Zyngier

Zeus console port is wired to a 8250-compatible device (pxa UARTs are reserved to other uses). This patch allows such a configuration in the uncompress sequence.

Was that tested for regressions with PXA UARTs?

Indeed. Tested with an Arcom Viper (PXA-255, console on FFUART). I should have mentioned it in the commit message...

Quoted 13 lines

I didn't, but ...

Quoted 11 lines
(quoted diff) +0 -0

b/arch/arm/mach-pxa/include/mach/uncompress.h index 237734b..dc94a34 100644 --- a/arch/arm/mach-pxa/include/mach/uncompress.h +++ b/arch/arm/mach-pxa/include/mach/uncompress.h @@ -13,17 +13,21 @@
#include <mach/regs-uart.h>
#include <asm/mach-types.h>

arch/arm/mach-pxa/include/mach/uncompress.h +1 -1
-#define __REG(x)       ((volatile unsigned long *)x)
+#define __REG(x)       ((volatile char *)x)
Quoted 12 lines

arch/arm/mach-pxa/include/mach/uncompress.h line 22

Quoted 6 lines
arch/arm/mach-pxa/include/mach/uncompress.h +5 -1
-static volatile unsigned long *UART = FFUART;
+static volatile char *UART = FFUART;
+static int shift = 2;
+static int is_pxa_uart = 1;
+
+#define UART_REG(x)	UART[(x) << shift]

... with UART being char* now (and as UART_REG is just a macro) it will only be 8 bits in width, and hence all logic that accesses bits beyond that scope wil fail. Tricky casting might help here, but your referencing that as an array, so the value will be &= 0xff. Or did I overlook anything?

Well, all registers are actually 8bit wide. So I feel like using char* is actually one step closer to the actual behavior of the hardware. Unless I in turn overlooked something else... ;-)

	M.
Signature · 2 lines
And if you don't know where you're going, any road will take you
there...
#3 lore raw

PATCH 1/1 pxa/zeus: Allow use of 8250-compatible UART in uncompress

Quoted 9 lines · Marc Zyngier
Quoted 5 lines · On Thu, 10 Dec 2009 15:12:08 +0800 Daniel Mack <[email protected]> wrote:

... with UART being char* now (and as UART_REG is just a macro) it will only be 8 bits in width, and hence all logic that accesses bits beyond that scope wil fail. Tricky casting might help here, but your referencing that as an array, so the value will be &= 0xff. Or did I overlook anything?

Quoted 3 lines

Well, all registers are actually 8bit wide. So I feel like using char* is actually one step closer to the actual behavior of the hardware. Unless I in turn overlooked something else... ;-)

Ah ok, I missed that. Would be good to hve a comment stating that, for the next one to stumble over it :)

Daniel