[PATCH] CPM initial console on ttyS instead of ttyCPM

Nathael Pajani nathael.pajani at cpe.fr
Tue Dec 20 00:09:27 EST 2005


Hi!

here is a patch to have the CPM consoles on /dev/ttyS* instead of /dev/ttyCPM*
Of course, it depends on not already having a 8250 like uart configured, in which case it falls back to ttyCPM.

Signed-off-by: Nathael Pajani <nathael.pajani at cpe.fr>

diff -urpN linux-2.6.13.2_light/drivers/serial/cpm_uart/cpm_uart_core.c ecrin-2.6.13.2_light/drivers/serial/cpm_uart/cpm_uart_core.c
--- linux-2.6.13.2_light/drivers/serial/cpm_uart/cpm_uart_core.c	2005-12-16 12:08:48.867092000 +0100
+++ ecrin-2.6.13.2_light/drivers/serial/cpm_uart/cpm_uart_core.c	2005-12-16 11:53:13.140613000 +0100
@@ -70,10 +70,11 @@ static void cpm_uart_init_scc(struct uar
 static void cpm_uart_initbd(struct uart_cpm_port *pinfo);
 
 /**************************************************************/
+/*cpm2_immr = (cpm2_map_t *)ioremap(CPM_MAP_ADDR, CPM_MAP_SIZE)*/
 
 static inline unsigned long cpu2cpm_addr(void *addr)
 {
-	if ((unsigned long)addr >= CPM_ADDR)
+	if( (unsigned long)addr >= CPM_ADDR )
 		return (unsigned long)addr;
 	return virt_to_bus(addr);
 }
@@ -1072,13 +1073,13 @@ static void cpm_uart_console_write(struc
 }
 
 /*
- * Setup console. Be careful is called early !
+ * Setup console. Be careful this is called early !
  */
 static int __init cpm_uart_console_setup(struct console *co, char *options)
 {
 	struct uart_port *port;
 	struct uart_cpm_port *pinfo;
-	int baud = 38400;
+	int baud = 9600;	/* NATH: was 38400 */
 	int bits = 8;
 	int parity = 'n';
 	int flow = 'n';
@@ -1136,7 +1137,11 @@ static int __init cpm_uart_console_setup
 
 static struct uart_driver cpm_reg;
 static struct console cpm_scc_uart_console = {
+#ifndef CONFIG_SERIAL_8250
+	.name           = "ttyS",
+#else
 	.name		= "ttyCPM",
+#endif
 	.write		= cpm_uart_console_write,
 	.device		= uart_console_device,
 	.setup		= cpm_uart_console_setup,
@@ -1163,8 +1168,14 @@ console_initcall(cpm_uart_console_init);
 
 static struct uart_driver cpm_reg = {
 	.owner		= THIS_MODULE,
+#ifndef CONFIG_SERIAL_8250
+	.driver_name    = "serial",
+/*	.devfs_name     = "tts/", */
+	.dev_name       = "ttyS",
+#else
 	.driver_name	= "ttyCPM",
 	.dev_name	= "ttyCPM",
+#endif
 	.major		= SERIAL_CPM_MAJOR,
 	.minor		= SERIAL_CPM_MINOR,
 	.cons		= CPM_UART_CONSOLE,
@@ -1174,7 +1185,7 @@ static int __init cpm_uart_init(void)
 {
 	int ret, i;
 
-	printk(KERN_INFO "Serial: CPM driver $Revision: 0.01 $\n");
+	printk(KERN_INFO "Serial: CPM driver $Revision: 0.01b $\n");
 
 #ifndef CONFIG_SERIAL_CPM_CONSOLE
 	ret = cpm_uart_init_portdesc();
diff -urpN linux-2.6.13.2_light/drivers/serial/cpm_uart/cpm_uart_cpm2.h ecrin-2.6.13.2_light/drivers/serial/cpm_uart/cpm_uart_cpm2.h
--- linux-2.6.13.2_light/drivers/serial/cpm_uart/cpm_uart_cpm2.h	2005-12-16 12:08:48.883093000 +0100
+++ ecrin-2.6.13.2_light/drivers/serial/cpm_uart/cpm_uart_cpm2.h	2005-12-16 11:53:13.144613000 +0100
@@ -20,9 +20,6 @@
 #define SCC3_IRQ	SIU_INT_SCC3
 #define SCC4_IRQ	SIU_INT_SCC4
 
-/* the CPM address */
-#define CPM_ADDR	CPM_MAP_ADDR
-
 static inline void cpm_set_brg(int brg, int baud)
 {
 	cpm_setbrg(brg, baud);
diff -urpN linux-2.6.13.2_light/drivers/serial/cpm_uart/cpm_uart.h ecrin-2.6.13.2_light/drivers/serial/cpm_uart/cpm_uart.h
--- linux-2.6.13.2_light/drivers/serial/cpm_uart/cpm_uart.h	2005-12-16 12:08:48.863092000 +0100
+++ ecrin-2.6.13.2_light/drivers/serial/cpm_uart/cpm_uart.h	2005-12-16 11:53:13.140613000 +0100
@@ -17,8 +17,13 @@
 #include "cpm_uart_cpm1.h"
 #endif
 
-#define SERIAL_CPM_MAJOR	204
-#define SERIAL_CPM_MINOR	46
+#ifndef CONFIG_SERIAL_8250
+#define SERIAL_CPM_MAJOR        TTY_MAJOR
+#define SERIAL_CPM_MINOR        64
+#else
+#define SERIAL_CPM_MAJOR        204
+#define SERIAL_CPM_MINOR        46
+#endif
 
 #define IS_SMC(pinfo) 		(pinfo->flags & FLAG_SMC)
 #define IS_DISCARDING(pinfo)	(pinfo->flags & FLAG_DISCARDING)
diff -urpN linux-2.6.13.2_light/drivers/serial/cpm_uart/Makefile ecrin-2.6.13.2_light/drivers/serial/cpm_uart/Makefile
--- linux-2.6.13.2_light/drivers/serial/cpm_uart/Makefile	2005-12-16 12:08:48.859091000 +0100
+++ ecrin-2.6.13.2_light/drivers/serial/cpm_uart/Makefile	2005-12-16 11:53:13.140613000 +0100
@@ -1,5 +1,5 @@
 #
-# Makefile for the Motorola 8xx FEC ethernet controller
+# Makefile for the CPM ethernet controllers
 #
 
 obj-$(CONFIG_SERIAL_CPM) += cpm_uart.o


---- 
Nathael PAJANI
Ingénieur CPE Lyon
nathael.pajani at cpe.fr



More information about the Linuxppc-embedded mailing list