cavium: generic 8250 serial driver changes
We are in the process of preparing kernel support for the Cavium
Networks OCTEON processor for inclusion in the main-line kernel
sources. The main (perhaps only) place this affects the non-processor
specific parts of the kernel is in the 8250 serial driver. The OCTEON
contains several on-chip UARTS that require processor specific register
access code.It is our thought that rather than pollute the 8250 driver with yet
another one-off register access method, we would change the driver to
access the UART registers via function pointers setup at driver
initialization time. A side benefit of this is that it makes it easy
to move some of the existing register access code back to platform
specific files.Patch 1 makes the register access functions replaceable.
Patch 2 is a completely untested prototype that moves the UPIO_TSI
back to platform specific code.This part tested on 2.6.27-rc8 on i686.
In order to use Cavium OCTEON specific serial i/o drivers, we first patch
the 8250 driver to use replaceable i/o functions.Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Tomaso Paoletti <tpaoletti@caviumnetworks.com>
---
drivers/serial/8250.c | 185 +++++++++++++++++++++++++++++--------------
include/linux/serial_8250.h | 2 +
include/linux/serial_core.h | 2 +
3 files changed, 131 insertions(+), 58 deletions(-)diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 9ccc563..02771d6 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -288,16 +288,16 @@ static const u8 au_io_out_map[] = {
};/* sane hardware needs no mapping */
-static inline int map_8250_in_reg(struct uart_8250_port *up, int offset)
+static inline int map_8250_in_reg(struct uart_port *p, int offset)
{
- if (up->port.iotype != UPIO_AU)
+ if (p->iotype != UPIO_AU)
return offset;
return au_io_in_map[offset];
}-static inline int map_8250_out_reg(struct uart_8250_port *...
This is a completely untested example of how the processor specific
code could be removed from the 8250 UART driver if the first part of
the patch were accepted.The register access code is moved from drivers/serial/8250.c to
arch/powerpc/kernel/legacy_serial.cSigned-off-by: David Daney <ddaney@caviumnetworks.com>
---
arch/powerpc/kernel/legacy_serial.c | 35 +++++++++++++++++++++++++++--------
drivers/serial/8250.c | 25 -------------------------
drivers/serial/serial_core.c | 2 --
include/linux/serial_core.h | 5 ++---
4 files changed, 29 insertions(+), 38 deletions(-)diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 9ddfaef..3a56fc1 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -46,10 +46,27 @@ static struct __initdata of_device_id legacy_serial_parents[] = {
static unsigned int legacy_serial_count;
static int legacy_serial_console = -1;+static unsigned int tsi_serial_in(struct uart_port *up, int offset)
+{
+ unsigned int tmp;
+ if (offset == UART_IIR) {
+ tmp = readl(p->membase + (UART_IIR & ~3));
+ return (tmp >> 16) & 0xff; /* UART_IIR % 4 == 2 */
+ } else
+ return readb(p->membase + offset);
+}
+
+static void tsi_serial_out(struct uart_port *up, int offset, int value)
+{
+ if (!((offset == UART_IER) && (value & UART_IER_UUE)))
+ writeb(value, p->membase + offset);
+}
+
static int __init add_legacy_port(struct device_node *np, int want_index,
int iotype, phys_addr_t base,
phys_addr_t taddr, unsigned long irq,
- upf_t flags, int irq_check_parent)
+ upf_t flags, int irq_check_parent,
+ int tsi_war)
{
const u32 *clk, *spd;
u32 clock = BASE_BAUD * 16;
@@ -105,6 +122,10 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
legacy_serial_ports[index].uartclk = clock;
legacy_serial_ports[index].irq = irq;
legacy_seria...
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| debian developer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Adrian Bunk | Re: LSM conversion to static interface |
git: | |
| Gerrit Renker | [PATCH 26/37] dccp: Integration of dynamic feature activation - part 1 (socket set... |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Frans Pop | svc: failed to register lockdv1 RPC service (errno 97). |
| Linus Torvalds | Re: [GIT]: Networking |
