RE: 8250_early for big-endian

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From: Alan Cox [mailto:alan@xxxxxxxxxxxxxxxxxxx] 
>Sent: Thursday, October 25, 2012 1:18 PM

>If you make the symbols global then they need a prefix to avoid clashes - just rename them something like serial8250_early_in/serial8250_early_out

> and of course they ought to be in the header files somewhere...

Thanks for your comments. I polished my patch and below is the updated.
Please comment on this patch.

>From 0ebe0d2d39d76a1d2983321599e138474f5e96d3 Mon Sep 17 00:00:00 2001
From: Noam Camus <noamc@xxxxxxxxxx>
Date: Mon, 29 Oct 2012 17:16:58 +0200
Subject: [PATCH] tty/8250_early: Turn serial_in/serial_out to weak symbols to allow platforms to override them.

Now one can replace default methods with similar fit to its needs.
e.g. choose other regshift, register offset, or any other manipulation.

This is useful for big endian platforms wishing to use the early serial driver.
Platform that needs to swab bytes before the register accesses.

Signed-off-by: Noam Camus <noamc@xxxxxxxxxx>
---
 drivers/tty/serial/8250/8250_early.c |    4 ++--
 include/linux/serial_8250.h          |    2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
index eaafb98..a359504 100644
--- a/drivers/tty/serial/8250/8250_early.c
+++ b/drivers/tty/serial/8250/8250_early.c
@@ -48,7 +48,7 @@ struct early_serial8250_device {

 static struct early_serial8250_device early_device;

-static unsigned int __init serial_in(struct uart_port *port, int offset)
+unsigned int __weak __init serial8250_early_in(struct uart_port *port, int offset)
 {
        switch (port->iotype) {
        case UPIO_MEM:
@@ -62,7 +62,7 @@ static unsigned int __init serial_in(struct uart_port *port, int offset)
        }
 }

-static void __init serial_out(struct uart_port *port, int offset, int value)
+void __weak __init serial8250_early_out(struct uart_port *port, int offset, int value)
 {
        switch (port->iotype) {
        case UPIO_MEM:
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index c174c90..c490d20 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -105,6 +105,8 @@ extern int early_serial_setup(struct uart_port *port);

 extern int serial8250_find_port(struct uart_port *p);
 extern int serial8250_find_port_for_earlycon(void);
+extern unsigned int serial8250_early_in(struct uart_port *port, int offset);
+extern void serial8250_early_out(struct uart_port *port, int offset, int value);
 extern int setup_early_serial8250_console(char *cmdline);
 extern void serial8250_do_set_termios(struct uart_port *port,
                struct ktermios *termios, struct ktermios *old);
-- 
1.7.1

Regards,
Noam
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux