📄 1003.uart.patch
字号:
diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/config-tango2.in linuxmips-2.4.30/arch/mips/config-tango2.in--- linuxmips-2.4.30.ref/arch/mips/config-tango2.in 2007-02-28 15:19:28.000000000 -0800+++ linuxmips-2.4.30/arch/mips/config-tango2.in 2007-02-28 15:29:24.000000000 -0800@@ -63,5 +63,7 @@ bool 'Map DRAM1 with TLB (\"no\" for CPU remap instead)' CONFIG_TANGO2_USE_TLB_REMAP_DRAM1 fi +#define_bool CONFIG_UART_USE_SYSCLK y+ endmenu diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/tango2/prom.c linuxmips-2.4.30/arch/mips/tango2/prom.c--- linuxmips-2.4.30.ref/arch/mips/tango2/prom.c 2007-02-28 15:19:29.000000000 -0800+++ linuxmips-2.4.30/arch/mips/tango2/prom.c 2007-02-28 15:29:24.000000000 -0800@@ -59,6 +59,8 @@ unsigned int xenv_uart_console_port = 0; unsigned int xenv_uart_used_ports = 1; +extern void tango2_init_uart_ports(void);+ static unsigned int xenv_enabled_devices = 0; static unsigned int xenv_isaide_timing_slot = 0; static unsigned int xenv_isaide_irq = 0;@@ -405,6 +407,9 @@ } } }++ /* Call out to initialize serial ports data */+ tango2_init_uart_ports(); } #endif diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/drivers/char/Config.in linuxmips-2.4.30/drivers/char/Config.in--- linuxmips-2.4.30.ref/drivers/char/Config.in 2005-02-11 13:09:56.000000000 -0800+++ linuxmips-2.4.30/drivers/char/Config.in 2007-02-28 15:29:24.000000000 -0800@@ -25,6 +25,34 @@ tristate ' Dual serial port support' CONFIG_DUALSP_SERIAL fi fi+if [ "$CONFIG_TANGO2" = "y" ]; then+ if [ ! "$CONFIG_TANGO2_XENV" = "y" ]; then+ if [ "$CONFIG_SERIAL" = "y" ]; then+ int ' Default Baudrate' CONFIG_TANGO2_BASE_BAUD 115200+ int ' Number of serial ports (1 or 2)' CONFIG_SERIAL_TANGO2_UARTNR 1+ bool ' Swap serial ports' CONFIG_SERIAL_TANGO2_SWAPPORT+ if [ "$CONFIG_SERIAL_TANGO2_UARTNR" = "1" ]; then+ if [ "$CONFIG_SERIAL_TANGO2_SWAPPORT" = "y" ]; then+ bool ' Enable GPIO full functionality on UART0' CONFIG_TANGO2_UART0_AS_GPIO_FULL+ bool ' Enable GPIO partial functionality on UART1' CONFIG_TANGO2_UART1_AS_GPIO_PARTIAL+ else+ bool ' Enable GPIO full functionality on UART1' CONFIG_TANGO2_UART1_AS_GPIO_FULL+ bool ' Enable GPIO partial functionality on UART0' CONFIG_TANGO2_UART0_AS_GPIO_PARTIAL+ fi+ else+ bool 'Enable GPIO partial functionality on UART0' CONFIG_TANGO2_UART0_AS_GPIO_PARTIAL+ bool 'Enable GPIO partial functionality on UART1' CONFIG_TANGO2_UART1_AS_GPIO_PARTIAL+ fi+ else+ bool 'Enable GPIO full functionality on UART0' CONFIG_TANGO2_UART0_AS_GPIO_FULL+ bool 'Enable GPIO full functionality on UART1' CONFIG_TANGO2_UART1_AS_GPIO_FULL+ fi+ else+ int ' Default Baudrate' CONFIG_TANGO2_BASE_BAUD 115200+ define_bool CONFIG_SERIAL_TANGO2_SWAPPORT n+ define_int CONFIG_SERIAL_TANGO2_UARTNR 1+ fi+fi dep_mbool 'Extended dumb serial driver options' CONFIG_SERIAL_EXTENDED $CONFIG_SERIAL if [ "$CONFIG_SERIAL_EXTENDED" = "y" ]; then bool ' Support more than 4 serial ports' CONFIG_SERIAL_MANY_PORTSdiff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/drivers/char/serial.c linuxmips-2.4.30/drivers/char/serial.c--- linuxmips-2.4.30.ref/drivers/char/serial.c 2004-12-26 20:13:43.000000000 -0800+++ linuxmips-2.4.30/drivers/char/serial.c 2007-02-28 15:59:51.000000000 -0800@@ -124,10 +124,12 @@ #ifndef CONFIG_SERIAL_SHARE_IRQ #define CONFIG_SERIAL_SHARE_IRQ #endif+#ifndef CONFIG_TANGO2 #ifndef CONFIG_SERIAL_MANY_PORTS #define CONFIG_SERIAL_MANY_PORTS #endif #endif+#endif #ifdef CONFIG_SERIAL_ACPI #define ENABLE_SERIAL_ACPI@@ -295,6 +297,17 @@ static void change_speed(struct async_struct *info, struct termios *old); static void rs_wait_until_sent(struct tty_struct *tty, int timeout); +#ifdef CONFIG_TANGO2+#include <asm/tango2/rmdefs.h>+#if defined(CONFIG_TANGO2_SIG_BLOCK) || defined(CONFIG_TANGO2_XENV)+extern unsigned long em8xxx_baudrates[2];+#endif+#if defined(CONFIG_TANGO2_XENV)+extern unsigned int xenv_uart_console_port;+extern unsigned int xenv_uart_used_ports;+#endif+#endif+ /* * Here we define the default xmit fifo size used for each type of * UART@@ -306,7 +319,11 @@ { "16550", 1, 0 }, { "16550A", 16, UART_CLEAR_FIFO | UART_USE_FIFO }, { "cirrus", 1, 0 }, /* usurped by cyclades.c */+#ifdef CONFIG_TANGO2+ { "ST16650", 1, UART_CLEAR_FIFO | UART_STARTECH | UART_USE_FIFO }, +#else { "ST16650", 1, UART_CLEAR_FIFO | UART_STARTECH }, +#endif { "ST16650V2", 32, UART_CLEAR_FIFO | UART_USE_FIFO | UART_STARTECH }, { "TI16750", 64, UART_CLEAR_FIFO | UART_USE_FIFO},@@ -397,6 +414,46 @@ static struct semaphore tmp_buf_sem = MUTEX; #endif +#if defined(CONFIG_TANGO2_XENV)+/* Change rs_table[] based on xenv block before serial port initialization starts */+void tango2_init_uart_ports(void)+{+ int idx = 0;++ /* Find the index of the entry */+ for (idx = 0; idx < serial_nr_ports; idx++) {+ if (rs_table[idx].iomem_base == (unsigned char *)(REG_BASE_cpu_block+CPU_UART0_base))+ break;+ }++ if (xenv_uart_console_port == 0) {+ rs_table[idx].irq = IRQ_CONTROLLER_IRQ_BASE+LOG2_CPU_UART0_INT;+ rs_table[idx].iomem_base = (unsigned char *)(REG_BASE_cpu_block+CPU_UART0_base);+ rs_table[idx].baud_base = em8xxx_baudrates[0];+ rs_table[idx + 1].irq = IRQ_CONTROLLER_IRQ_BASE+LOG2_CPU_UART1_INT;+ rs_table[idx + 1].iomem_base = (unsigned char *)(REG_BASE_cpu_block+CPU_UART1_base);+ rs_table[idx + 1].baud_base = em8xxx_baudrates[1];+ } else {+ rs_table[idx].irq = IRQ_CONTROLLER_IRQ_BASE+LOG2_CPU_UART1_INT;+ rs_table[idx].iomem_base = (unsigned char *)(REG_BASE_cpu_block+CPU_UART1_base);+ rs_table[idx].baud_base = em8xxx_baudrates[1];+ rs_table[idx + 1].irq = IRQ_CONTROLLER_IRQ_BASE+LOG2_CPU_UART0_INT;+ rs_table[idx + 1].iomem_base = (unsigned char *)(REG_BASE_cpu_block+CPU_UART0_base);+ rs_table[idx + 1].baud_base = em8xxx_baudrates[0];+ }++ /* Only one UART port is used? */+ if ((xenv_uart_used_ports == 1) || ((xenv_uart_used_ports == 2) && (xenv_uart_console_port != 0))) {+ if (serial_nr_ports > 2) {+ /* Move the rest of data forward by one slot */+ for (idx += 2; idx < serial_nr_ports; idx++) {+ memcpy(&rs_table[idx - 1], &rs_table[idx], sizeof(struct serial_state));+ }+ }+ serial_nr_ports--;+ }+}+#endif static inline int serial_paranoia_check(struct async_struct *info, kdev_t device, const char *routine)@@ -444,8 +501,18 @@ return inb(info->port+1); #endif case SERIAL_IO_MEM:+#ifdef CONFIG_TANGO2+ {+ unsigned long a=(unsigned long) info->iomem_base + (offset<<info->iomem_reg_shift);+ unsigned long v=gbus_read_uint32(pGBus, a);++ //if ((offset!=UART_IER)&&(offset!=UART_LSR)) emprintk("*%p reads %p\n",a,v);+ return v;+ }+#else return readb((unsigned long) info->iomem_base + (offset<<info->iomem_reg_shift));+#endif /* CONFIG_TANGO2 */ default: return inb(info->port + offset); }@@ -462,9 +529,42 @@ break; #endif case SERIAL_IO_MEM:+#ifdef CONFIG_TANGO2+ {+#ifdef CONFIG_UART_USE_SYSCLK+ extern unsigned long em8xxx_sys_frequency;+#endif+ unsigned long a=(unsigned long) info->iomem_base + (offset<<info->iomem_reg_shift);++ if (offset==UART_DL) {+#ifdef CONFIG_QUICKTURN+ //emprintk("converting %d to %d\n",value,TANGO2_CPU_FREQUENCY/16/(TANGO2_BASE_BAUD*value));+ value=13;+#elif defined(CONFIG_TANGO2_SMP863X)+ unsigned int div;+#ifdef CONFIG_UART_USE_SYSCLK+ div = em8xxx_sys_frequency / (16 * info->state->baud_base);+#else+ div = ((TANGO2_BASE_FREQUENCY * 10) / ((16 * info->state->baud_base) / value)); + if ((div % 10) < 5)+ div = (div / 10);+ else+ div = (div / 10) + 1;+#endif+ value = div;+#else+#error emhack not ported+#endif /* CONFIG_QUICKTURN */+ }+ //if ((offset!=UART_IER)&&(offset!=UART_TX)) emprintk("*%p = %p\n",a,value);+ gbus_write_uint32(pGBus, a, value);+ break;+ }+#else writeb(value, (unsigned long) info->iomem_base + (offset<<info->iomem_reg_shift)); break;+#endif /* CONFIG_TANGO2 */ default: outb(value, info->port+offset); }@@ -1666,6 +1766,7 @@ unsigned cflag, cval, fcr = 0; int bits; unsigned long flags;+// struct serial_state *async_s_state = info->state; if (!info->tty || !info->tty->termios) return;@@ -1700,7 +1801,12 @@ /* Determine divisor based on baud rate */ baud = tty_get_baud_rate(info->tty); if (!baud)+#if defined(CONFIG_TANGO2_SIG_BLOCK) || defined(CONFIG_TANGO2_XENV)+ baud = em8xxx_baudrates[((info->state->iomem_base == (unsigned char *)(REG_BASE_cpu_block+CPU_UART1_base)) ? 1 : 0)]; +#else baud = 9600; /* B0 transition handled in rs_set_termios */+#endif+ #ifdef CONFIG_SERIAL_RSA if ((info->state->type == PORT_RSA) && (info->state->baud_base != SERIAL_RSA_BAUD_BASE) &&@@ -1736,7 +1842,11 @@ info->tty->termios->c_cflag |= (old_termios->c_cflag & CBAUD); baud = tty_get_baud_rate(info->tty); if (!baud)+#if defined(CONFIG_TANGO2_SIG_BLOCK) || defined(CONFIG_TANGO2_XENV)+ baud = em8xxx_baudrates[((info->state->iomem_base == (unsigned char *)(REG_BASE_cpu_block+CPU_UART1_base)) ? 1 : 0)]; +#else baud = 9600;+#endif if (baud == 38400 && ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) quot = info->state->custom_divisor;@@ -1751,6 +1861,7 @@ /* As a last resort, if the quotient is zero, default to 9600 bps */ if (!quot) quot = baud_base / 9600;+ /* * Work around a bug in the Oxford Semiconductor 952 rev B * chip which causes it to seriously miscalculate baud rates@@ -1833,8 +1944,12 @@ (cflag & CRTSCTS) ? UART_EFR_CTS : 0); } serial_outp(info, UART_LCR, cval | UART_LCR_DLAB); /* set DLAB */+#ifdef CONFIG_TANGO2+ serial_out(info, UART_DL, quot);+#else serial_outp(info, UART_DLL, quot & 0xff); /* LS of divisor */ serial_outp(info, UART_DLM, quot >> 8); /* MS of divisor */+#endif /* CONFIG_TANGO2 */ if (info->state->type == PORT_16750) serial_outp(info, UART_FCR, fcr); /* set fcr */ serial_outp(info, UART_LCR, cval); /* reset DLAB */@@ -2174,7 +2289,7 @@ /* Make sure address is not already in use */ if (new_serial.type) {- for (i = 0 ; i < NR_PORTS; i++)+ for (i = 0 ; i < serial_nr_ports; i++) if ((state != &rs_table[i]) && (rs_table[i].io_type == SERIAL_IO_PORT) && (rs_table[i].port == new_port) &&@@ -3189,7 +3304,7 @@ MOD_INC_USE_COUNT; line = MINOR(tty->device) - tty->driver.minor_start;- if ((line < 0) || (line >= NR_PORTS)) {+ if ((line < 0) || (line >= serial_nr_ports)) { MOD_DEC_USE_COUNT; return -ENODEV; }@@ -3373,7 +3488,7 @@ len += sprintf(page, "serinfo:1.0 driver:%s%s revision:%s\n", serial_version, LOCAL_VERSTRING, serial_revdate);- for (i = 0; i < NR_PORTS && len < 4000; i++) {+ for (i = 0; i < serial_nr_ports && len < 4000; i++) { l = line_info(page + len, &rs_table[i]); len += l; if (len+begin > off+count)@@ -3536,10 +3651,16 @@ UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT); serial_outp(info, UART_MCR, UART_MCR_LOOP); serial_outp(info, UART_LCR, UART_LCR_DLAB);+#ifdef CONFIG_TANGO2+ old_dll = serial_inp(info, UART_DL)&0xff;+ old_dlm = serial_inp(info, UART_DL)>>8;+ serial_outp(info, UART_DL, 0x01);+#else old_dll = serial_inp(info, UART_DLL); old_dlm = serial_inp(info, UART_DLM); serial_outp(info, UART_DLL, 0x01); serial_outp(info, UART_DLM, 0x00);+#endif /* CONFIG_TANGO2 */ serial_outp(info, UART_LCR, 0x03); for (count = 0; count < 256; count++) serial_outp(info, UART_TX, count);@@ -3550,8 +3671,12 @@ serial_outp(info, UART_FCR, old_fcr); serial_outp(info, UART_MCR, old_mcr); serial_outp(info, UART_LCR, UART_LCR_DLAB);+#ifdef CONFIG_TANGO2+ serial_outp(info, UART_DL, (old_dlm<<8)|old_dll);+#else serial_outp(info, UART_DLL, old_dll); serial_outp(info, UART_DLM, old_dlm);+#endif /* CONFIG_TANGO2 */ return count; }@@ -3618,6 +3743,14 @@ /* Save the DLL and DLM */ serial_outp(info, UART_LCR, UART_LCR_DLAB);+#ifdef CONFIG_TANGO2+ scratch3 = serial_inp(info, UART_DL)&0xff;+ scratch4 = serial_inp(info, UART_DL)>>8;++ serial_outp(info, UART_DL, 0);+ scratch2 = serial_inp(info, UART_DL)&0xff;+ scratch = serial_inp(info, UART_DL)>>8;+#else scratch3 = serial_inp(info, UART_DLL); scratch4 = serial_inp(info, UART_DLM); @@ -3625,6 +3758,7 @@ serial_outp(info, UART_DLM, 0); scratch2 = serial_inp(info, UART_DLL); scratch = serial_inp(info, UART_DLM);+#endif /* CONFIG_TANGO2 */ serial_outp(info, UART_LCR, 0); if (scratch == 0x10 || scratch == 0x14) {@@ -3637,8 +3771,12 @@ /* Restore the DLL and DLM */ serial_outp(info, UART_LCR, UART_LCR_DLAB);+#ifdef CONFIG_TANGO2+ serial_outp(info, UART_DL, (scratch4<<8)|scratch3);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -