linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pxa/zeus: Allow use of 8250-compatible UART in uncompress
@ 2009-12-10  6:39 Marc Zyngier
  2009-12-10  7:12 ` Daniel Mack
  0 siblings, 1 reply; 4+ messages in thread
From: Marc Zyngier @ 2009-12-10  6:39 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Marc Zyngier <maz@misterjones.org>
---
 arch/arm/mach-pxa/include/mach/uncompress.h |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h 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>
 
-#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;
+	}
 }
 
 /*
-- 
1.6.0.4



-- 
I'm the slime oozin' out from your TV set...

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] pxa/zeus: Allow use of 8250-compatible UART in uncompress
  2009-12-10  6:39 [PATCH] pxa/zeus: Allow use of 8250-compatible UART in uncompress Marc Zyngier
@ 2009-12-10  7:12 ` Daniel Mack
  2009-12-10  8:09   ` Marc Zyngier
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Mack @ 2009-12-10  7:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Dec 10, 2009 at 07:39:22AM +0100, Marc Zyngier wrote:
> 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 ...

> diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h 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>
>  
> -#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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] pxa/zeus: Allow use of 8250-compatible UART in uncompress
  2009-12-10  7:12 ` Daniel Mack
@ 2009-12-10  8:09   ` Marc Zyngier
  2009-12-10  8:19     ` Daniel Mack
  0 siblings, 1 reply; 4+ messages in thread
From: Marc Zyngier @ 2009-12-10  8:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 10 Dec 2009 15:12:08 +0800
Daniel Mack <daniel@caiaq.de> wrote:

> On Thu, Dec 10, 2009 at 07:39:22AM +0100, Marc Zyngier wrote:
> > 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...

> I didn't, but ...
> 
> > diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h
> > 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>
> >  
> > -#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?

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.
-- 
And if you don't know where you're going, any road will take you
there...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] pxa/zeus: Allow use of 8250-compatible UART in uncompress
  2009-12-10  8:09   ` Marc Zyngier
@ 2009-12-10  8:19     ` Daniel Mack
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Mack @ 2009-12-10  8:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Dec 10, 2009 at 09:09:49AM +0100, Marc Zyngier wrote:
> On Thu, 10 Dec 2009 15:12:08 +0800
> Daniel Mack <daniel@caiaq.de> 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?
> 
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-12-10  8:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-10  6:39 [PATCH] pxa/zeus: Allow use of 8250-compatible UART in uncompress Marc Zyngier
2009-12-10  7:12 ` Daniel Mack
2009-12-10  8:09   ` Marc Zyngier
2009-12-10  8:19     ` Daniel Mack

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).