diff -Naur linux-source-2.4.26-vrs1-pxa1-arcom3/drivers/char/serial.c linux-source-2.4.26-vrs1-pxa1-arcom3-hail/drivers/char/serial.c --- linux-source-2.4.26-vrs1-pxa1-arcom3/drivers/char/serial.c 2005-09-11 21:37:43.000000000 -0700 +++ linux-source-2.4.26-vrs1-pxa1-arcom3-hail/drivers/char/serial.c 2005-09-11 21:37:08.000000000 -0700 @@ -245,6 +245,8 @@ #include #include #include +#define _INCLUDE_ONCE_serial +#include "/cross/app/Hail/spec/serial.hail.h" #if defined(CONFIG_MAC_SERIAL) #define SERIAL_DEV_OFFSET ((_machine == _MACH_prep || _machine == _MACH_chrp) ? 0 : 2) @@ -513,9 +515,13 @@ return; save_flags(flags); cli(); + /* whyuan if (info->IER & UART_IER_THRI) { info->IER &= ~UART_IER_THRI; - serial_out(info, UART_IER, info->IER); + serial_out(info, UART_IER, info->IER); */ + if (mem_get_IER_THRI(info->IER)) { + mem_set_IER_THRI(&info->IER, 0); + set_IER(info->IER); } if (info->state->type == PORT_16C950) { info->ACR |= UART_ACR_TXDIS; @@ -535,9 +541,13 @@ save_flags(flags); cli(); if (info->xmit.head != info->xmit.tail && info->xmit.buf + /* whyuan && !(info->IER & UART_IER_THRI)) { info->IER |= UART_IER_THRI; - serial_out(info, UART_IER, info->IER); + serial_out(info, UART_IER, info->IER); */ + && !mem_get_IER_THRI(info->IER)) { + mem_set_IER_THRI(&info->IER, 1); + set_IER(info->IER); } if (info->state->type == PORT_16C950) { info->ACR &= ~UART_ACR_TXDIS; @@ -594,7 +604,10 @@ if (tty->flip.count >= TTY_FLIPBUF_SIZE) return; // if TTY_DONT_FLIP is set } - ch = serial_inp(info, UART_RX); +/* whyuan + ch = serial_inp(info, UART_RX); */ + ch = get_RX_RX(); + *tty->flip.char_buf_ptr = ch; icount->rx++; @@ -602,13 +615,19 @@ printk("DR%02x:%02x...", ch, *status); #endif *tty->flip.flag_buf_ptr = 0; + /* whyuan: TODO!!! if (*status & (UART_LSR_BI | UART_LSR_PE | - UART_LSR_FE | UART_LSR_OE)) { + UART_LSR_FE | UART_LSR_OE)) { */ + if (mem_get_LSR_BI(*status) | mem_get_LSR_PE(*status) | + mem_get_LSR_FE(*status) | mem_get_LSR_OE(*status)) { /* * For statistics only */ + /* whyuan: if (*status & UART_LSR_BI) { - *status &= ~(UART_LSR_FE | UART_LSR_PE); + *status &= ~(UART_LSR_FE | UART_LSR_PE); */ + if (mem_get_LSR_BI(*status)) { + mem_set_LSR_FE(status, 0); mem_set_LSR_PE(status, 0); icount->brk++; /* * We do the SysRQ and SAK checking @@ -627,17 +646,25 @@ #endif if (info->flags & ASYNC_SAK) do_SAK(tty); - } else if (*status & UART_LSR_PE) + } + /* whyuan + else if (*status & UART_LSR_PE) icount->parity++; else if (*status & UART_LSR_FE) icount->frame++; if (*status & UART_LSR_OE) - icount->overrun++; + icount->overrun++; */ + else if (mem_get_LSR_PE(*status)) + icount->parity++; + else if (mem_get_LSR_FE(*status)) + icount->frame++; + if (mem_get_LSR_OE(*status)) + icount->overrun++; /* * Mask off conditions which should be ignored. */ - *status &= info->read_status_mask; + *status &= info->read_status_mask; /* whyuan TODO!!! */ #ifdef CONFIG_SERIAL_CONSOLE if (info->line == sercons.index) { @@ -646,16 +673,23 @@ lsr_break_flag = 0; } #endif - if (*status & (UART_LSR_BI)) { + /*whyuan + if (*status & (UART_LSR_BI)) { */ + if (mem_get_LSR_BI(*status)) { #ifdef SERIAL_DEBUG_INTR printk("handling break...."); #endif *tty->flip.flag_buf_ptr = TTY_BREAK; - } else if (*status & UART_LSR_PE) + } + /* whyuan + else if (*status & UART_LSR_PE) *tty->flip.flag_buf_ptr = TTY_PARITY; else if (*status & UART_LSR_FE) - *tty->flip.flag_buf_ptr = TTY_FRAME; - } + *tty->flip.flag_buf_ptr = TTY_FRAME; */ + else if (mem_get_LSR_PE(*status)) + *tty->flip.flag_buf_ptr = TTY_PARITY; + else if (mem_get_LSR_FE(*status)) + *tty->flip.flag_buf_ptr = TTY_FRAME; } #if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) if (break_pressed && info->line == sercons.index) { if (ch != 0 && @@ -672,7 +706,9 @@ tty->flip.char_buf_ptr++; tty->flip.count++; } - if ((*status & UART_LSR_OE) && + /*whyuan + if ((*status & UART_LSR_OE) && */ + if (mem_get_LSR_OE(*status) && (tty->flip.count < TTY_FLIPBUF_SIZE)) { /* * Overrun is special, since it's reported @@ -687,8 +723,11 @@ #if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) ignore_char: #endif + /* whyuan *status = serial_inp(info, UART_LSR); - } while ((*status & UART_LSR_DR) && (max_count-- > 0)); + } while ((*status & UART_LSR_DR) && (max_count-- > 0)); */ + *status = get_LSR(); + } while (mem_get_LSR_DR(*status) && (max_count-- > 0)); #if (LINUX_VERSION_CODE > 131394) /* 2.1.66 */ tty_flip_buffer_push(tty); #else @@ -701,7 +740,9 @@ int count; if (info->x_char) { - serial_outp(info, UART_TX, info->x_char); + /* whyuan + serial_outp(info, UART_TX, info->x_char);*/ + set_TX_TX(info->x_char); info->state->icount.tx++; info->x_char = 0; if (intr_done) @@ -711,14 +752,19 @@ if (info->xmit.head == info->xmit.tail || info->tty->stopped || info->tty->hw_stopped) { + /* whyuan info->IER &= ~UART_IER_THRI; - serial_out(info, UART_IER, info->IER); + serial_out(info, UART_IER, info->IER);*/ + mem_set_IER_THRI(&info->IER, 0); + set_IER(info->IER); return; } count = info->xmit_fifo_size; do { - serial_out(info, UART_TX, info->xmit.buf[info->xmit.tail]); + /* whyuan + serial_out(info, UART_TX, info->xmit.buf[info->xmit.tail]); */ + set_TX_TX(info->xmit.buf[info->xmit.tail]); info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); info->state->icount.tx++; if (info->xmit.head == info->xmit.tail) @@ -737,8 +783,11 @@ *intr_done = 0; if (info->xmit.head == info->xmit.tail) { + /* whyuan info->IER &= ~UART_IER_THRI; - serial_out(info, UART_IER, info->IER); + serial_out(info, UART_IER, info->IER);*/ + mem_set_IER_THRI(&info->IER, 0); + set_IER(info->IER); } } @@ -747,34 +796,53 @@ int status; struct async_icount *icount; - status = serial_in(info, UART_MSR); - - if (status & UART_MSR_ANY_DELTA) { + /* whyuan + status = serial_in(info, UART_MSR); */ + status = get_MSR(); + + /* whyuan TODO + if (status & UART_MSR_ANY_DELTA) { */ + if (mem_get_MSR_DDCD(status) | mem_get_MSR_TERI(status) | mem_get_MSR_DDSR(status) | mem_get_MSR_DCTS(status) ) { icount = &info->state->icount; /* update input line counters */ + /* whyuan if (status & UART_MSR_TERI) icount->rng++; if (status & UART_MSR_DDSR) icount->dsr++; - if (status & UART_MSR_DDCD) { + if (status & UART_MSR_DDCD) { */ + if (mem_get_MSR_TERI(status)) + icount->rng++; + if (mem_get_MSR_DDSR(status)) + icount->dsr++; + if (mem_get_MSR_DDCD(status)) { icount->dcd++; #ifdef CONFIG_HARD_PPS if ((info->flags & ASYNC_HARDPPS_CD) && - (status & UART_MSR_DCD)) + /* whyuan + (status & UART_MSR_DCD)) */ + mem_get_MSR_DCD(status)) */ hardpps(); #endif } - if (status & UART_MSR_DCTS) + /* whyuan + if (status & UART_MSR_DCTS) */ + if (mem_get_MSR_DCTS(status)) icount->cts++; wake_up_interruptible(&info->delta_msr_wait); } - if ((info->flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) { + /* whyuan + if ((info->flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) { */ + if ((info->flags & ASYNC_CHECK_CD) && mem_get_MSR_DDCD(status)) { #if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR)) printk("ttys%d CD now %s...", info->line, - (status & UART_MSR_DCD) ? "on" : "off"); + /*whyuan (status & UART_MSR_DCD) ? "on" : "off"); */ + mem_get_MSR_DCD(status) ? "on" : "off"); */ #endif - if (status & UART_MSR_DCD) + /* whyuan + if (status & UART_MSR_DCD) */ + if (mem_get_MSR_DCD(status)) wake_up_interruptible(&info->open_wait); else if (!((info->flags & ASYNC_CALLOUT_ACTIVE) && (info->flags & ASYNC_CALLOUT_NOHUP))) { @@ -787,29 +855,37 @@ } if (info->flags & ASYNC_CTS_FLOW) { if (info->tty->hw_stopped) { - if (status & UART_MSR_CTS) { + /* whyuan if (status & UART_MSR_CTS) {*/ + if (mem_get_MSR_CTS(status)) { #if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) printk("CTS tx start..."); #endif info->tty->hw_stopped = 0; + /* whyuan info->IER |= UART_IER_THRI; - serial_out(info, UART_IER, info->IER); + serial_out(info, UART_IER, info->IER); */ + mem_set_IER_THRI(&info->IER, 1); + set_IER(info->IER); rs_sched_event(info, RS_EVENT_WRITE_WAKEUP); return; } } else { - if (!(status & UART_MSR_CTS)) { + /* whyuan + if (!(status & UART_MSR_CTS)) { */ + if (!mem_get_MSR_CTS(status)) { #if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) printk("CTS tx stop..."); #endif info->tty->hw_stopped = 1; + /* whyuan info->IER &= ~UART_IER_THRI; - serial_out(info, UART_IER, info->IER); + serial_out(info, UART_IER, info->IER); */ + mem_set_IER_THRI(&info->IER, 0); + set_IER(info->IER); } } } } - #ifdef CONFIG_SERIAL_SHARE_IRQ /* * This is the serial driver's generic interrupt routine @@ -840,8 +916,11 @@ #endif do { + /* whyuan if (!info->tty || - ((iir=serial_in(info, UART_IIR)) & UART_IIR_NO_INT)) { + ((iir=serial_in(info, UART_IIR)) & UART_IIR_NO_INT)) { */ + iir=get_IIR(); + if (!info->tty || mem_get_IIR_NO_INT(iir)) { if (!end_mark) end_mark = info; goto next; @@ -853,20 +932,30 @@ info->last_active = jiffies; - status = serial_inp(info, UART_LSR); + /* whyuan + status = serial_inp(info, UART_LSR); */ + status = get_LSR(); #ifdef SERIAL_DEBUG_INTR printk("status = %x...", status); #endif - if (status & UART_LSR_DR) + /* whyuan + if (status & UART_LSR_DR) */ + if(mem_get_LSR_DR(status)) receive_chars(info, &status, regs); check_modem_status(info); #ifdef CONFIG_MELAN - if ((status & UART_LSR_THRE) || + /* whyuan + if ((status & UART_LSR_THRE) || */ + if (mem_get_LSR_THRE(status)) || /* for buggy ELAN processors */ - ((iir & UART_IIR_ID) == UART_IIR_THRI)) + /* whyuan + ((iir & UART_IIR_ID) == UART_IIR_THRI))*/ + (mem_get_IIR_ID(iir) == UART_IIR_THRI)) transmit_chars(info, 0); #else - if (status & UART_LSR_THRE) + /* whyuan + if (status & UART_LSR_THRE) */ + if (mem_get_LSR_THRE(status)) transmit_chars(info, 0); #endif @@ -923,22 +1012,34 @@ first_multi = inb(multi->port_monitor); #endif - iir = serial_in(info, UART_IIR); + /*whyuan + iir = serial_in(info, UART_IIR); */ + iir = get_IIR(); do { - status = serial_inp(info, UART_LSR); + /*whyuan + status = serial_inp(info, UART_LSR); */ + status = get_LSR(); #ifdef SERIAL_DEBUG_INTR printk("status = %x...", status); #endif - if (status & UART_LSR_DR) + /* whyuan + if (status & UART_LSR_DR) */ + if (mem_get_LSR_DR(status)) receive_chars(info, &status, regs); check_modem_status(info); #ifdef CONFIG_MELAN - if ((status & UART_LSR_THRE) || + /* whyuan + if ((status & UART_LSR_THRE) || */ + if (mem_get_LSR_THRE(status) || /* For buggy ELAN processors */ - ((iir & UART_IIR_ID) == UART_IIR_THRI)) + /* whyuan + ((iir & UART_IIR_ID) == UART_IIR_THRI)) */ + (mem_get_IIR_ID(iir) == UART_IIR_THRI)) transmit_chars(info, 0); #else - if (status & UART_LSR_THRE) + /* whyuan + if (status & UART_LSR_THRE) */ + if (mem_get_LSR_THRE(status)) transmit_chars(info, 0); #endif if (pass_counter++ > RS_ISR_PASS_LIMIT) { @@ -947,11 +1048,16 @@ #endif break; } - iir = serial_in(info, UART_IIR); + /* whyuan + iir = serial_in(info, UART_IIR); */ + iir = get_IIR(); #ifdef SERIAL_DEBUG_INTR printk("IIR = %x...", iir); #endif - } while ((iir & UART_IIR_NO_INT) == 0); + } + /* whyuan + while ((iir & UART_IIR_NO_INT) == 0); */ + while (mem_get_IIR_NO_INT(iir) == 0); info->last_active = jiffies; #ifdef CONFIG_SERIAL_MULTIPORT if (multi->port_monitor) @@ -1115,9 +1221,13 @@ #ifdef CONFIG_SERIAL_SHARE_IRQ if (info->next_port) { do { - serial_out(info, UART_IER, 0); + /* whyuan + serial_out(info, UART_IER, 0); info->IER |= UART_IER_THRI; - serial_out(info, UART_IER, info->IER); + serial_out(info, UART_IER, info->IER); */ + set_IER(0); + mem_set_IER_THRI(&info->IER, 1); + set_IER(info->IER); info = info->next_port; } while (info); #ifdef CONFIG_SERIAL_MULTIPORT @@ -1349,6 +1459,7 @@ /* * Clear the interrupt registers. */ + /* whyuan: TODO: seems set sth in info */ (void) serial_inp(info, UART_LSR); (void) serial_inp(info, UART_RX); (void) serial_inp(info, UART_IIR); @@ -1417,7 +1528,9 @@ /* * Now, initialize the UART */ - serial_outp(info, UART_LCR, UART_LCR_WLEN8); /* reset DLAB */ + /* whyuan + serial_outp(info, UART_LCR, UART_LCR_WLEN8); */ /* reset DLAB */ + set_LCR_WLS(UART_LCR_WLEN8); info->MCR = 0; if (info->tty->termios->c_cflag & CBAUD) @@ -1435,7 +1548,9 @@ info->MCR ^= UART_MCR_OUT2; } info->MCR |= ALPHA_KLUDGE_MCR; /* Don't ask */ - serial_outp(info, UART_MCR, info->MCR); + /* whyuan + serial_outp(info, UART_MCR, info->MCR); */ + set_MCR(info->MCR); /* * Finally, enable interrupts @@ -1565,7 +1680,9 @@ } info->IER = 0; - serial_outp(info, UART_IER, 0x00); /* disable all intrs */ + /* whyuan + serial_outp(info, UART_IER, 0x00); */ /* disable all intrs */ + set_IER(0); #ifdef CONFIG_SERIAL_MANY_PORTS if (info->flags & ASYNC_FOURPORT) { /* reset interrupts on the AST Fourport board */ @@ -1579,17 +1696,26 @@ info->MCR |= ALPHA_KLUDGE_MCR; /* Don't ask */ /* disable break condition */ - serial_out(info, UART_LCR, serial_inp(info, UART_LCR) & ~UART_LCR_SBC); + /* whyuan + serial_out(info, UART_LCR, serial_inp(info, UART_LCR) & ~UART_LCR_SBC); */ + set_LCR_SBC(0); if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS); - serial_outp(info, UART_MCR, info->MCR); + /* whyuan serial_outp(info, UART_MCR, info->MCR);*/ + set_MCR(info->MCR); /* disable FIFO's */ + /* whyuan serial_outp(info, UART_FCR, (UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT)); serial_outp(info, UART_FCR, 0); + */ + set_FCR(UART_FCR_ENABLE_FIFO | + UART_FCR_CLEAR_RCVR | + UART_FCR_CLEAR_XMIT); + set_FCR(0); #ifdef CONFIG_SERIAL_RSA /* @@ -1808,7 +1934,8 @@ info->flags |= ASYNC_CHECK_CD; info->IER |= UART_IER_MSI; } - serial_out(info, UART_IER, info->IER); + /* whyuan serial_out(info, UART_IER, info->IER);*/ + set_IER(info->IER); /* * Set up parity check flag @@ -1847,6 +1974,8 @@ serial_outp(info, UART_EFR, (cflag & CRTSCTS) ? UART_EFR_CTS : 0); } + /* whyuan */ +#if 0 serial_outp(info, UART_LCR, cval | UART_LCR_DLAB); /* set DLAB */ serial_outp(info, UART_DLL, quot & 0xff); /* LS of divisor */ serial_outp(info, UART_DLM, quot >> 8); /* MS of divisor */ @@ -1861,6 +1990,22 @@ } serial_outp(info, UART_FCR, fcr); /* set fcr */ } +#else + set_LCR(cval | UART_LCR_DLAB); /* set DLAB */ + set_DLL(quot & 0xff); /* LS of divisor */ + set_DLM(quot >> 8); /* MS of divisor */ + if (info->state->type == PORT_16750) + set_FCR(fcr); /* set fcr */ + set_LCR(cval); /* reset DLAB */ + info->LCR = cval; /* Save LCR */ + if (info->state->type != PORT_16750) { + if (fcr & UART_FCR_ENABLE_FIFO) { + /* emulated UARTs (Lucent Venus 167x) need two steps */ + set_FCR(UART_FCR_ENABLE_FIFO); + } + set_FCR(fcr); /* set fcr */ + } +#endif restore_flags(flags); } @@ -1903,8 +2048,12 @@ return; save_flags(flags); cli(); + /* whyuan info->IER |= UART_IER_THRI; - serial_out(info, UART_IER, info->IER); + serial_out(info, UART_IER, info->IER); */ + mem_set_IER_THRI(&info->IER, 1); + set_IER(info->IER); + if (pxa_buggy_port(info->state->type)) rs_interrupt_single(info->state->irq, NULL, NULL); restore_flags(flags); @@ -1980,9 +2129,14 @@ if (info->xmit.head != info->xmit.tail && !tty->stopped && !tty->hw_stopped + /* whyuan && !(info->IER & UART_IER_THRI)) { info->IER |= UART_IER_THRI; - serial_out(info, UART_IER, info->IER); + serial_out(info, UART_IER, info->IER); */ + && !mem_get_IER_THRI(info->IER)) { + mem_set_IER_THRI(&info->IER, 1); + set_IER(info->IER); + if (pxa_buggy_port(info->state->type)) { save_flags(flags); cli(); rs_interrupt_single(info->state->irq, NULL, NULL); @@ -2043,8 +2197,12 @@ info->x_char = ch; if (ch) { /* Make sure transmit interrupts are on */ + /* whyuan info->IER |= UART_IER_THRI; - serial_out(info, UART_IER, info->IER); + serial_out(info, UART_IER, info->IER); */ + mem_set_IER_THRI(&info->IER, 1); + set_IER(info->IER); + if (pxa_buggy_port(info->state->type)) rs_interrupt_single(info->state->irq, NULL, NULL); } @@ -2079,7 +2237,9 @@ info->MCR &= ~UART_MCR_RTS; save_flags(flags); cli(); - serial_out(info, UART_MCR, info->MCR); + /* whyuan + serial_out(info, UART_MCR, info->MCR); */ + set_MCR(info->MCR); restore_flags(flags); } @@ -2104,9 +2264,14 @@ rs_send_xchar(tty, START_CHAR(tty)); } if (tty->termios->c_cflag & CRTSCTS) - info->MCR |= UART_MCR_RTS; + /* whyuan + info->MCR |= UART_MCR_RTS; */ + mem_set_MCR_RTS(&info->MCR, 1); save_flags(flags); cli(); - serial_out(info, UART_MCR, info->MCR); + /* whyuan + serial_out(info, UART_MCR, info->MCR); */ + set_MCR(info->MCR); + restore_flags(flags); } @@ -2307,7 +2472,9 @@ unsigned long flags; save_flags(flags); cli(); - status = serial_in(info, UART_LSR); + /* whyuan + status = serial_in(info, UART_LSR); */ + status = get_LSR(); restore_flags(flags); result = ((status & UART_LSR_TEMT) ? TIOCSER_TEMT : 0); @@ -2337,7 +2504,9 @@ control = info->MCR; save_flags(flags); cli(); - status = serial_in(info, UART_MSR); + /* whyuan + status = serial_in(info, UART_MSR); */ + status = get_MSR(); restore_flags(flags); result = ((control & UART_MCR_RTS) ? TIOCM_RTS : 0) | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0) @@ -2414,7 +2583,9 @@ } save_flags(flags); cli(); info->MCR |= ALPHA_KLUDGE_MCR; /* Don't ask */ - serial_out(info, UART_MCR, info->MCR); + /* whyuan + serial_out(info, UART_MCR, info->MCR); */ + set_MCR(info->MCR); restore_flags(flags); return 0; } @@ -2480,7 +2651,9 @@ info->LCR |= UART_LCR_SBC; else info->LCR &= ~UART_LCR_SBC; - serial_out(info, UART_LCR, info->LCR); + /* whyuan + serial_out(info, UART_LCR, info->LCR); */ + set_LCR(info->LCR); restore_flags(flags); } #endif @@ -2705,8 +2878,11 @@ cprev = info->state->icount; restore_flags(flags); /* Force modem status interrupts on */ + /* whyuan info->IER |= UART_IER_MSI; - serial_out(info, UART_IER, info->IER); + serial_out(info, UART_IER, info->IER); */ + mem_set_IER_MSI(&info->IER, 1); + set_IER(info->IER); while (1) { interruptible_sleep_on(&info->delta_msr_wait); /* see if a signal did it */ @@ -2783,7 +2959,9 @@ !(cflag & CBAUD)) { info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS); save_flags(flags); cli(); - serial_out(info, UART_MCR, info->MCR); + /* whyuan + serial_out(info, UART_MCR, info->MCR); */ + set_MCR(info->MCR); restore_flags(flags); } @@ -2796,7 +2974,9 @@ info->MCR |= UART_MCR_RTS; } save_flags(flags); cli(); - serial_out(info, UART_MCR, info->MCR); + /* whyuan + serial_out(info, UART_MCR, info->MCR); */ + set_MCR(info->MCR); restore_flags(flags); } @@ -3112,9 +3292,13 @@ save_flags(flags); cli(); if (!(info->flags & ASYNC_CALLOUT_ACTIVE) && (tty->termios->c_cflag & CBAUD)) + /* whyuan serial_out(info, UART_MCR, serial_inp(info, UART_MCR) | - (UART_MCR_DTR | UART_MCR_RTS)); + (UART_MCR_DTR | UART_MCR_RTS)); */ + set_MCR( + get_MCR() | + (UART_MCR_DTR | UART_MCR_RTS)); restore_flags(flags); set_current_state(TASK_INTERRUPTIBLE); if (tty_hung_up_p(filp) || @@ -3347,8 +3531,11 @@ info->tty = 0; } save_flags(flags); cli(); + /* whyuan status = serial_in(info, UART_MSR); - control = info != &scr_info ? info->MCR : serial_in(info, UART_MCR); + control = info != &scr_info ? info->MCR : serial_in(info, UART_MCR); */ + status = get_MSR(); + control = info != &scr_info ? info->MCR : get_MCR(); restore_flags(flags); stat_buf[0] = 0; @@ -3517,6 +3704,7 @@ /* forget possible initially masked and pending IRQ */ probe_irq_off(probe_irq_on()); + /* whyuan to do */ save_mcr = serial_inp(&scr_info, UART_MCR); save_ier = serial_inp(&scr_info, UART_IER); serial_outp(&scr_info, UART_MCR, UART_MCR_OUT1 | UART_MCR_OUT2); @@ -3645,6 +3833,7 @@ /* Save the DLL and DLM */ + /* whyuan serial_outp(info, UART_LCR, UART_LCR_DLAB); scratch3 = serial_inp(info, UART_DLL); scratch4 = serial_inp(info, UART_DLM); @@ -3654,6 +3843,16 @@ scratch2 = serial_inp(info, UART_DLL); scratch = serial_inp(info, UART_DLM); serial_outp(info, UART_LCR, 0); + */ + set_LCR(UART_LCR_DLAB); + scratch3 = get_DLL(); + scratch4 = get_DLM(); + + set_DLL(0); + set_DLM(0); + scratch2 = get_DLL(); + scratch = get_DLM(); + set_LCR(0); if (scratch == 0x10 || scratch == 0x14) { if (scratch == 0x10) @@ -3664,10 +3863,15 @@ /* Restore the DLL and DLM */ + /* whyuan serial_outp(info, UART_LCR, UART_LCR_DLAB); serial_outp(info, UART_DLL, scratch3); serial_outp(info, UART_DLM, scratch4); - serial_outp(info, UART_LCR, 0); + serial_outp(info, UART_LCR, 0); */ + set_LCR(UART_LCR_DLAB); + set_DLL(scratch3); + set_DLM(scratch4); + set_LCR(0); /* * We distinguish between the '654 and the '650 by counting * how many bytes are in the FIFO. I'm using this for now, @@ -5882,7 +6086,8 @@ unsigned int status, tmout = 1000000; do { - status = serial_in(info, UART_LSR); + /* whyuan status = serial_in(info, UART_LSR); */ + status = get_LSR(); if (status & UART_LSR_BI) lsr_break_flag = UART_LSR_BI; @@ -5916,11 +6121,14 @@ /* * First save the IER then disable the interrupts */ - ier = serial_in(info, UART_IER); + /* whyuan ier = serial_in(info, UART_IER); serial_out(info, UART_IER, 0x00); if (pxa_port(info->state->type)) - serial_out(info, UART_IER, UART_IER_UUE); - + serial_out(info, UART_IER, UART_IER_UUE);*/ + ier = get_IER(); + set_IER(0x00); + if (pxa_port(info->state->type)) + set_IER(UART_IER_UUE); /* * Now, do each character */ @@ -6066,6 +6274,8 @@ * Disable UART interrupts, set DTR and RTS high * and set speed. */ + /* whyuan */ +#if 0 serial_out(info, UART_LCR, cval | UART_LCR_DLAB); /* set DLAB */ serial_out(info, UART_DLL, quot & 0xff); /* LS of divisor */ serial_out(info, UART_DLM, quot >> 8); /* MS of divisor */ @@ -6074,11 +6284,21 @@ if (pxa_port(info->state->type)) serial_out(info, UART_IER, UART_IER_UUE); serial_out(info, UART_MCR, UART_MCR_DTR | UART_MCR_RTS); - +#else + set_LCR(cval | UART_LCR_DLAB); /* set DLAB */ + set_DLL(quot & 0xff); /* LS of divisor */ + set_DLM(quot >> 8); /* MS of divisor */ + set_LCR(cval); /* reset DLAB */ + set_IER(0); + if (pxa_port(info->state->type)) + set_IER(UART_IER_UUE); + set_MCR(UART_MCR_DTR | UART_MCR_RTS); +#endif /* * If we read 0xff from the LSR, there is no UART here. */ - if (serial_in(info, UART_LSR) == 0xff) + /* whyaunn if (serial_in(info, UART_LSR) == 0xff)*/ + if (get_LSR() == 0xff) return -1; return 0; @@ -6098,6 +6318,7 @@ */ void __init serial_console_init(void) { + printk("HAIL, whyuan\n"); register_console(&sercons); } #endif