[SPARC64]: Serial Console for E250 Patch
authorEddie C. Dost <ecd@brainaid.de>
Wed, 18 Jan 2006 22:54:31 +0000 (14:54 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Jan 2006 22:54:31 +0000 (14:54 -0800)
From: Eddie C. Dost <ecd@brainaid.de>

I have the following patch for serial console over the RSC
(remote system controller) on my E250 machine. It basically adds
support for input-device=rsc and output-device=rsc from OBP, and
allows 115200,8,n,1,- serial mode setting.

Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc64/kernel/setup.c
arch/sparc64/prom/console.c
drivers/serial/suncore.c
drivers/serial/sunsab.c
include/asm-sparc64/oplib.h

index 250745896aeec4959087f544e8e46914bd6d2fdd..054461e6946d3334bfb0a3d56f878edfdae5c2b9 100644 (file)
@@ -561,6 +561,8 @@ static int __init set_preferred_console(void)
                serial_console = 1;
        } else if (idev == PROMDEV_ITTYB && odev == PROMDEV_OTTYB) {
                serial_console = 2;
+       } else if (idev == PROMDEV_IRSC && odev == PROMDEV_ORSC) {
+               serial_console = 3;
        } else {
                prom_printf("Inconsistent console: "
                            "input %d, output %d\n",
index eae5db8dda56468ecaee4db7dfcf8fd01e60f6df..ac6d035dd150e6c8cbe2f7747c2e6873dc886fe6 100644 (file)
@@ -99,8 +99,12 @@ prom_query_input_device(void)
        if (!strncmp(propb, "keyboard", 8))
                return PROMDEV_ITTYA;
 
+       if (!strncmp (propb, "rsc", 3))
+               return PROMDEV_IRSC;
+
        if (strncmp (propb, "tty", 3) || !propb[3])
                return PROMDEV_I_UNK;
+
        switch (propb[3]) {
                case 'a': return PROMDEV_ITTYA;
                case 'b': return PROMDEV_ITTYB;
@@ -136,8 +140,12 @@ prom_query_output_device(void)
        if (!strncmp(propb, "screen", 6))
                return PROMDEV_OTTYA;
 
+       if (!strncmp (propb, "rsc", 3))
+               return PROMDEV_ORSC;
+
        if (strncmp (propb, "tty", 3) || !propb[3])
                return PROMDEV_O_UNK;
+
        switch (propb[3]) {
                case 'a': return PROMDEV_OTTYA;
                case 'b': return PROMDEV_OTTYB;
index 5fc4a62173d9c6f0d3b626f135c0a6f478a3626f..fa4ae94243c21a070bf25d23af022648258172e7 100644 (file)
@@ -34,6 +34,7 @@ sunserial_console_termios(struct console *con)
        char *mode_prop = "ttyX-mode";
        char *cd_prop = "ttyX-ignore-cd";
        char *dtr_prop = "ttyX-rts-dtr-off";
+       char *ssp_console_modes_prop = "ssp-console-modes";
        int baud, bits, stop, cflag;
        char parity;
        int carrier = 0;
@@ -43,14 +44,39 @@ sunserial_console_termios(struct console *con)
        if (!serial_console)
                return;
 
-       if (serial_console == 1) {
+       switch (serial_console) {
+       case PROMDEV_OTTYA:
                mode_prop[3] = 'a';
                cd_prop[3] = 'a';
                dtr_prop[3] = 'a';
-       } else {
+               break;
+
+       case PROMDEV_OTTYB:
                mode_prop[3] = 'b';
                cd_prop[3] = 'b';
                dtr_prop[3] = 'b';
+               break;
+
+       case PROMDEV_ORSC:
+
+               nd = prom_pathtoinode("rsc");
+               if (!nd) {
+                       strcpy(mode, "115200,8,n,1,-");
+                       goto no_options;
+               }
+
+               if (!prom_node_has_property(nd, ssp_console_modes_prop)) {
+                       strcpy(mode, "115200,8,n,1,-");
+                       goto no_options;
+               }
+
+               memset(mode, 0, sizeof(mode));
+               prom_getstring(nd, ssp_console_modes_prop, mode, sizeof(mode));
+               goto no_options;
+
+       default:
+               strcpy(mode, "9600,8,n,1,-");
+               goto no_options;
        }
 
        topnd = prom_getchild(prom_root_node);
@@ -110,6 +136,10 @@ no_options:
                case 9600: cflag |= B9600; break;
                case 19200: cflag |= B19200; break;
                case 38400: cflag |= B38400; break;
+               case 57600: cflag |= B57600; break;
+               case 115200: cflag |= B115200; break;
+               case 230400: cflag |= B230400; break;
+               case 460800: cflag |= B460800; break;
                default: baud = 9600; cflag |= B9600; break;
        }
 
index 7e773ff76c6106721f42b0dce9aa5cd1f43c123c..8bcaebcc0ad7b20e1986df7e74c4968071b14fe9 100644 (file)
@@ -897,9 +897,6 @@ static int sunsab_console_setup(struct console *con, char *options)
 
        sunserial_console_termios(con);
 
-       /* Firmware console speed is limited to 150-->38400 baud so
-        * this hackish cflag thing is OK.
-        */
        switch (con->cflag & CBAUD) {
        case B150: baud = 150; break;
        case B300: baud = 300; break;
@@ -910,6 +907,10 @@ static int sunsab_console_setup(struct console *con, char *options)
        default: case B9600: baud = 9600; break;
        case B19200: baud = 19200; break;
        case B38400: baud = 38400; break;
+       case B57600: baud = 57600; break;
+       case B115200: baud = 115200; break;
+       case B230400: baud = 230400; break;
+       case B460800: baud = 460800; break;
        };
 
        /*
index d02f1e8ae1a6cd9bbbe8c46a47be25ae9aa2ccaa..3c59b2693fb9639df36b711fc057642a342d2e40 100644 (file)
@@ -163,6 +163,7 @@ enum prom_input_device {
        PROMDEV_IKBD,                   /* input from keyboard */
        PROMDEV_ITTYA,                  /* input from ttya */
        PROMDEV_ITTYB,                  /* input from ttyb */
+       PROMDEV_IRSC,                   /* input from rsc */
        PROMDEV_I_UNK,
 };
 
@@ -174,6 +175,7 @@ enum prom_output_device {
        PROMDEV_OSCREEN,                /* to screen */
        PROMDEV_OTTYA,                  /* to ttya */
        PROMDEV_OTTYB,                  /* to ttyb */
+       PROMDEV_ORSC,                   /* to rsc */
        PROMDEV_O_UNK,
 };