linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Uartlite: Add macros for register names
@ 2007-10-02 16:44 Grant Likely
  2007-10-02 16:44 ` [PATCH 2/2] Uartlite: Revert register io access changes Grant Likely
  0 siblings, 1 reply; 3+ messages in thread
From: Grant Likely @ 2007-10-02 16:44 UTC (permalink / raw)
  To: linuxppc-dev, jwboyer, jacmet

From: Grant Likely <grant.likely@secretlab.ca>

Add macros to define register names to improve readability.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/boot/uartlite.c |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/boot/uartlite.c b/arch/powerpc/boot/uartlite.c
index f4249a7..38a470b 100644
--- a/arch/powerpc/boot/uartlite.c
+++ b/arch/powerpc/boot/uartlite.c
@@ -16,30 +16,45 @@
 #include "io.h"
 #include "ops.h"
 
+#define ULITE_RX		0x00
+#define ULITE_TX		0x04
+#define ULITE_STATUS		0x08
+#define ULITE_CONTROL		0x0c
+
+#define ULITE_STATUS_RXVALID	0x01
+#define ULITE_STATUS_TXFULL	0x08
+
+#define ULITE_CONTROL_RST_RX	0x02
+
 static void * reg_base;
 
 static int uartlite_open(void)
 {
 	/* Clear the RX FIFO */
-	out_be32(reg_base + 0x0C, 0x2);
+	out_be32(reg_base + ULITE_CONTROL, ULITE_CONTROL_RST_RX);
 	return 0;
 }
 
 static void uartlite_putc(unsigned char c)
 {
-	while ((in_be32(reg_base + 0x8) & 0x08) != 0); /* spin */
-	out_be32(reg_base + 0x4, c);
+	u32 reg = ULITE_STATUS_TXFULL;
+	while (reg & ULITE_STATUS_TXFULL) /* spin on TXFULL bit */
+		reg = in_be32(reg_base + ULITE_STATUS);
+	out_be32(reg_base + ULITE_TX, c);
 }
 
 static unsigned char uartlite_getc(void)
 {
-	while ((in_be32(reg_base + 0x8) & 0x01) == 0); /* spin */
-	return in_be32(reg_base);
+	u32 reg = ULITE_STATUS_RXVALID;
+	while (reg & ULITE_STATUS_RXVALID) /* spin on RXVALID bit */
+		reg = in_be32(reg_base + ULITE_STATUS);
+	return in_be32(reg_base + ULITE_RX);
 }
 
 static u8 uartlite_tstc(void)
 {
-	return ((in_be32(reg_base + 0x8) & 0x01) != 0);
+	u32 reg = in_be32(reg_base + ULITE_STATUS);
+	return reg & ULITE_STATUS_RXVALID;
 }
 
 int uartlite_console_init(void *devp, struct serial_console_data *scdp)

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

* [PATCH 2/2] Uartlite: Revert register io access changes
  2007-10-02 16:44 [PATCH 1/2] Uartlite: Add macros for register names Grant Likely
@ 2007-10-02 16:44 ` Grant Likely
  2007-10-02 16:46   ` Grant Likely
  0 siblings, 1 reply; 3+ messages in thread
From: Grant Likely @ 2007-10-02 16:44 UTC (permalink / raw)
  To: linuxppc-dev, jwboyer, jacmet

From: Grant Likely <grant.likely@secretlab.ca>

Reverts commit 58205d2b1256a32c9e8b02587f8ef3cdcf1eb8bd

This driver is used by devices other than the xilinx opb-uartlite which
depend on bytewise access to the registers.  The change to 32 bit access
does not work on these devices.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 0 files changed, 0 insertions(+), 0 deletions(-)

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

* Re: [PATCH 2/2] Uartlite: Revert register io access changes
  2007-10-02 16:44 ` [PATCH 2/2] Uartlite: Revert register io access changes Grant Likely
@ 2007-10-02 16:46   ` Grant Likely
  0 siblings, 0 replies; 3+ messages in thread
From: Grant Likely @ 2007-10-02 16:46 UTC (permalink / raw)
  To: linuxppc-dev, jwboyer, jacmet

On 10/2/07, Grant Likely <grant.likely@secretlab.ca> wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
>
> Reverts commit 58205d2b1256a32c9e8b02587f8ef3cdcf1eb8bd
>
> This driver is used by devices other than the xilinx opb-uartlite which
> depend on bytewise access to the registers.  The change to 32 bit access
> does not work on these devices.
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>
>  0 files changed, 0 insertions(+), 0 deletions(-)

Oops.... let me try that again.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

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

end of thread, other threads:[~2007-10-02 16:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-02 16:44 [PATCH 1/2] Uartlite: Add macros for register names Grant Likely
2007-10-02 16:44 ` [PATCH 2/2] Uartlite: Revert register io access changes Grant Likely
2007-10-02 16:46   ` Grant Likely

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).