public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 8250: Add PowerPC-style MMIO support to the 8250 driver
@ 2008-07-24 12:11 Laurent Pinchart
  2008-07-24 12:14 ` Russell King
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2008-07-24 12:11 UTC (permalink / raw)
  To: linux-serial; +Cc: Alan Cox, rmk

[-- Attachment #1: Type: text/plain, Size: 1758 bytes --]

This patch adds support for memory-mapped 8250-like UARTs on PowerPC platforms.

Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com>
---
 drivers/serial/8250.c       |   10 ++++++++++
 include/linux/serial_core.h |    1 +
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index be95e55..5e0e382 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -380,6 +380,10 @@ static unsigned int serial_in(struct uart_8250_port *up, int offset)
 		} else
 			return readb(up->port.membase + offset);
 
+#ifdef CONFIG_PPC
+	case UPIO_PPC_MMIO:
+		return in_8(up->port.membase + offset);
+#endif
 	default:
 		return inb(up->port.iobase + offset);
 	}
@@ -429,6 +433,12 @@ serial_out(struct uart_8250_port *up, int offset, int value)
 			value = serial_in(up, UART_IER);
 		break;
 
+#ifdef CONFIG_PPC
+	case UPIO_PPC_MMIO:
+		out_8(up->port.membase + offset, value);
+		break;
+#endif
+
 	default:
 		outb(value, up->port.iobase + offset);
 	}
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index d8f31de..1d8b940 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -261,6 +261,7 @@ struct uart_port {
 #define UPIO_TSI		(5)			/* Tsi108/109 type IO */
 #define UPIO_DWAPB		(6)			/* DesignWare APB UART */
 #define UPIO_RM9000		(7)			/* RM9000 type IO */
+#define UPIO_PPC_MMIO		(8)			/* PowerPC-style MMIO */
 
 	unsigned int		read_status_mask;	/* driver specific */
 	unsigned int		ignore_status_mask;	/* driver specific */
-- 
1.5.0


-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH] 8250: Add PowerPC-style MMIO support to the 8250 driver
  2008-07-24 12:11 [PATCH] 8250: Add PowerPC-style MMIO support to the 8250 driver Laurent Pinchart
@ 2008-07-24 12:14 ` Russell King
  2008-07-24 12:34   ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King @ 2008-07-24 12:14 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-serial, Alan Cox

On Thu, Jul 24, 2008 at 02:11:15PM +0200, Laurent Pinchart wrote:
> This patch adds support for memory-mapped 8250-like UARTs on PowerPC platforms.

What is different about in_8() from readb() ?  Why can't PowerPC use
readb()?

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:

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

* Re: [PATCH] 8250: Add PowerPC-style MMIO support to the 8250 driver
  2008-07-24 12:14 ` Russell King
@ 2008-07-24 12:34   ` Laurent Pinchart
  0 siblings, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2008-07-24 12:34 UTC (permalink / raw)
  To: Russell King; +Cc: linux-serial, Alan Cox

[-- Attachment #1: Type: text/plain, Size: 1525 bytes --]

On Thursday 24 July 2008, Russell King wrote:
> On Thu, Jul 24, 2008 at 02:11:15PM +0200, Laurent Pinchart wrote:
> > This patch adds support for memory-mapped 8250-like UARTs on PowerPC
> > platforms. 
> 
> What is different about in_8() from readb() ?  Why can't PowerPC use
> readb()?

If I'm not mistaken, readb/readw/readl/writeb/writew/writel are PCI accessors, at least on the PowerPC platform.

I took a closer look at the read*/write* functions. When both PCI indirect IO and PCI extended error handling are disabled, read*/write* are translated to little-endian MMIO accessors (in_8, in_le16, in_le32, out_8, out_le16, out_le32). This is the case for most embedded PowerPC platforms where a 8250-like UART is likely to be connected directly to the MMIO space.

When PCI indirect IO or PCI extended error handling are enabled, the read*/write* functions perform PCI-specific logic. They can't be used as generic MMIO accessors.

As my platform (an MPC8248 processor) has no PCI support, and as all 8250 access operations are 8-bit wide, readb/writeb will perform correctly.

I suppose we can drop the patch until someone with an embedded PowerPC platform requiring PCI indirect IO or PCI extended error handling comes up and complain. Those platforms are quite unlikely to have a 8250-like UART connected directly to the MMIO space.

Best regards,

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

end of thread, other threads:[~2008-07-24 12:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-24 12:11 [PATCH] 8250: Add PowerPC-style MMIO support to the 8250 driver Laurent Pinchart
2008-07-24 12:14 ` Russell King
2008-07-24 12:34   ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox