patch-2.4.22 linux-2.4.22/arch/ppc/8xx_io/uart.c

Next file: linux-2.4.22/arch/ppc/Makefile
Previous file: linux-2.4.22/arch/ppc/8xx_io/fec.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.21/arch/ppc/8xx_io/uart.c linux-2.4.22/arch/ppc/8xx_io/uart.c
@@ -112,7 +112,7 @@
 #undef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
 
 #define _INLINE_ inline
-  
+
 #define DBG_CNT(s)
 
 /* We overload some of the items in the data structure to meet our
@@ -281,7 +281,7 @@
 
 	if (serial_paranoia_check(info, tty->device, "rs_stop"))
 		return;
-	
+
 	save_flags(flags); cli();
 	idx = PORT_NUM(info->state->smc_scc_num);
 	if (PORT_IS_SCC(info->state->smc_scc_num)) {
@@ -305,7 +305,7 @@
 
 	if (serial_paranoia_check(info, tty->device, "rs_stop"))
 		return;
-	
+
 	idx = PORT_NUM(info->state->smc_scc_num);
 	save_flags(flags); cli();
 	if (PORT_IS_SCC(info->state->smc_scc_num)) {
@@ -331,7 +331,7 @@
  * rs_interrupt() should try to keep the interrupt handler as fast as
  * possible.  After you are done making modifications, it is not a bad
  * idea to do:
- * 
+ *
  * gcc -S -DKERNEL -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer serial.c
  *
  * and look at the resulting assemble code in serial.s.
@@ -477,7 +477,7 @@
 			}
 #if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
 			if (break_pressed && info->line == sercons.index) {
-				if (ch != 0 && time_before(jiffies, 
+				if (ch != 0 && time_before(jiffies,
 							break_pressed + HZ*5)) {
 					handle_sysrq(ch, regs, NULL, NULL);
 					break_pressed = 0;
@@ -495,7 +495,7 @@
 		}
 
 #if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
-	ignore_char:	
+	ignore_char:
 #endif
 		/* This BD is ready to be used again.  Clear status.
 		 * Get next BD.
@@ -543,7 +543,7 @@
 
 static _INLINE_ void transmit_chars(ser_info_t *info, struct pt_regs *regs)
 {
-	
+
 	if ((info->flags & TX_WAKEUP) ||
 	    (info->tty->flags & (1 << TTY_DO_WRITE_WAKEUP))) {
 		rs_sched_event(info, RS_EVENT_WRITE_WAKEUP);
@@ -561,7 +561,7 @@
 {
 	int	status;
 	struct	async_icount *icount;
-	
+
 	status = serial_in(info, UART_MSR);
 
 	if (status & UART_MSR_ANY_DELTA) {
@@ -588,7 +588,7 @@
 #if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR))
 		printk("ttys%d CD now %s...", info->line,
 		       (status & UART_MSR_DCD) ? "on" : "off");
-#endif		
+#endif
 		if (status & UART_MSR_DCD)
 			wake_up_interruptible(&info->open_wait);
 		else if (!((info->flags & ASYNC_CALLOUT_ACTIVE) &&
@@ -637,7 +637,7 @@
 	ser_info_t *info;
 	volatile smc_t	*smcp;
 	volatile scc_t	*sccp;
-	
+
 	info = (ser_info_t *)dev_id;
 
 	idx = PORT_NUM(info->state->smc_scc_num);
@@ -663,7 +663,7 @@
 			transmit_chars(info, regs);
 		smcp->smc_smce = events;
 	}
-	
+
 #ifdef SERIAL_DEBUG_INTR
 	printk("rs_interrupt_single(%d, %x)...",
 					info->state->smc_scc_num, events);
@@ -702,7 +702,7 @@
 {
 	ser_info_t	*info = (ser_info_t *) private_;
 	struct tty_struct	*tty;
-	
+
 	tty = info->tty;
 	if (!tty)
 		return;
@@ -722,13 +722,13 @@
  *
  * 	serial interrupt routine -> (scheduler tqueue) ->
  * 	do_serial_hangup() -> tty->hangup() -> rs_hangup()
- * 
+ *
  */
 static void do_serial_hangup(void *private_)
 {
 	struct async_struct	*info = (struct async_struct *) private_;
 	struct tty_struct	*tty;
-	
+
 	tty = info->tty;
 	if (tty)
 		tty_hangup(tty);
@@ -777,7 +777,7 @@
 	if (info->tty->termios->c_cflag & CBAUD)
 		info->MCR = UART_MCR_DTR | UART_MCR_RTS;
 #endif
-	
+
 	if (info->tty)
 		clear_bit(TTY_IO_ERROR, &info->tty->flags);
 
@@ -785,7 +785,7 @@
 	 * and set the speed of the serial port
 	 */
 	change_speed(info);
-	
+
 	idx = PORT_NUM(info->state->smc_scc_num);
 	if (PORT_IS_SCC(info->state->smc_scc_num)) {
 		sccp = &cpmp->cp_scc[idx];
@@ -820,7 +820,7 @@
 	info->flags |= ASYNC_INITIALIZED;
 	restore_flags(flags);
 	return 0;
-	
+
 errout:
 	restore_flags(flags);
 	return retval;
@@ -847,7 +847,7 @@
 	printk("Shutting down serial port %d (irq %d)....", info->line,
 	       state->irq);
 #endif
-	
+
 	save_flags(flags); cli(); /* Disable interrupts */
 
 	idx = PORT_NUM(state->smc_scc_num);
@@ -876,7 +876,7 @@
 #endif
 			smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
 	}
-	
+
 	if (info->tty)
 		set_bit(TTY_IO_ERROR, &info->tty->flags);
 
@@ -977,7 +977,7 @@
 		info->read_status_mask |= BD_SC_FR | BD_SC_PR;
 	if (I_BRKINT(info->tty) || I_PARMRK(info->tty))
 		info->read_status_mask |= BD_SC_BR;
-	
+
 	/*
 	 * Characters to ignore
 	 */
@@ -987,7 +987,7 @@
 	if (I_IGNBRK(info->tty)) {
 		info->ignore_status_mask |= BD_SC_BR;
 		/*
-		 * If we're ignore parity and break indicators, ignore 
+		 * If we're ignore parity and break indicators, ignore
 		 * overruns too.  (For real raw support).
 		 */
 		if (I_IGNPAR(info->tty))
@@ -1010,7 +1010,7 @@
 		sccp = &cpmp->cp_scc[idx];
 		new_mode = (sbits << 12) | scval;
 		prev_mode = sccp->scc_pmsr;
-		if (!(prev_mode & SCU_PMSR_PEN)) 
+		if (!(prev_mode & SCU_PMSR_PEN))
 			/* If parity is disabled, mask out even/odd */
 			prev_mode &= ~(SCU_PMSR_TPM|SCU_PMSR_RPM);
 		if (prev_mode != new_mode)
@@ -1023,9 +1023,9 @@
 		 * enables, because we want to put them back if they were
 		 * present.
 		 */
-		prev_mode = smcp->smc_smcmr;
-		new_mode = smcr_mk_clen(bits) | cval |  SMCMR_SM_UART;
-		new_mode |= (prev_mode & (SMCMR_REN | SMCMR_TEN));
+		prev_mode = smcp->smc_smcmr & (SMCMR_REN | SMCMR_TEN);
+		new_mode = smcr_mk_clen(bits) | cval | SMCMR_SM_UART
+			| prev_mode;
 		if (!(prev_mode & SMCMR_PEN))
 			/* If parity is disabled, mask out even/odd */
 			prev_mode &= ~SMCMR_PM_EVEN;
@@ -1075,7 +1075,7 @@
 	volatile cbd_t *bdp;
 
 #ifdef CONFIG_KGDB_CONSOLE
-        /* Try to let stub handle output. Returns true if it did. */ 
+        /* Try to let stub handle output. Returns true if it did. */
         if (kgdb_output_string(buf, count))
             return ret;
 #endif
@@ -1083,7 +1083,7 @@
 	if (serial_paranoia_check(info, tty->device, "rs_write"))
 		return 0;
 
-	if (!tty) 
+	if (!tty)
 		return 0;
 
 	bdp = info->tx_cur;
@@ -1151,7 +1151,7 @@
 static int rs_8xx_chars_in_buffer(struct tty_struct *tty)
 {
 	ser_info_t *info = (ser_info_t *)tty->driver_data;
-				
+
 	if (serial_paranoia_check(info, tty->device, "rs_chars_in_buffer"))
 		return 0;
 	return 0;
@@ -1160,7 +1160,7 @@
 static void rs_8xx_flush_buffer(struct tty_struct *tty)
 {
 	ser_info_t *info = (ser_info_t *)tty->driver_data;
-				
+
 	if (serial_paranoia_check(info, tty->device, "rs_flush_buffer"))
 		return;
 
@@ -1207,7 +1207,7 @@
 /*
  * ------------------------------------------------------------
  * rs_throttle()
- * 
+ *
  * This routine is called by the upper-layer tty layer to signal that
  * incoming characters should be throttled.
  * ------------------------------------------------------------
@@ -1217,14 +1217,14 @@
 	ser_info_t *info = (ser_info_t *)tty->driver_data;
 #ifdef SERIAL_DEBUG_THROTTLE
 	char	buf[64];
-	
+
 	printk("throttle %s: %d....\n", _tty_name(tty, buf),
 	       tty->ldisc.chars_in_buffer(tty));
 #endif
 
 	if (serial_paranoia_check(info, tty->device, "rs_throttle"))
 		return;
-	
+
 	if (I_IXOFF(tty))
 		rs_8xx_send_xchar(tty, STOP_CHAR(tty));
 
@@ -1243,14 +1243,14 @@
 	ser_info_t *info = (ser_info_t *)tty->driver_data;
 #ifdef SERIAL_DEBUG_THROTTLE
 	char	buf[64];
-	
+
 	printk("unthrottle %s: %d....\n", _tty_name(tty, buf),
 	       tty->ldisc.chars_in_buffer(tty));
 #endif
 
 	if (serial_paranoia_check(info, tty->device, "rs_unthrottle"))
 		return;
-	
+
 	if (I_IXOFF(tty)) {
 		if (info->x_char)
 			info->x_char = 0;
@@ -1281,7 +1281,7 @@
  * 	    release the bus after transmitting. This must be done when
  * 	    the transmit shift register is empty, not be done when the
  * 	    transmit holding register is empty.  This functionality
- * 	    allows an RS485 driver to be written in user space. 
+ * 	    allows an RS485 driver to be written in user space.
  */
 static int get_lsr_info(struct async_struct * info, unsigned int *value)
 {
@@ -1331,7 +1331,7 @@
 		return error;
 #ifdef modem_control
 	switch (cmd) {
-	case TIOCMBIS: 
+	case TIOCMBIS:
 		if (arg & TIOCM_RTS)
 			info->MCR |= UART_MCR_RTS;
 		if (arg & TIOCM_DTR)
@@ -1464,7 +1464,7 @@
 		if (tty->flags & (1 << TTY_IO_ERROR))
 		    return -EIO;
 	}
-	
+
 	switch (cmd) {
 		case TCSBRK:	/* SVID version: non-zero arg --> no break */
 			retval = tty_check_change(tty);
@@ -1543,7 +1543,7 @@
 				cli();
 				cnow = info->state->icount; /* atomic copy */
 				sti();
-				if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && 
+				if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
 				    cnow.dcd == cprev.dcd && cnow.cts == cprev.cts)
 					return -EIO; /* no change => error */
 				if ( ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
@@ -1559,7 +1559,7 @@
 			return 0;
 #endif
 
-		/* 
+		/*
 		 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
 		 * Return: write counters to the user passed counter struct
 		 * NB: both 1->0 and 0->1 transitions are counted except for
@@ -1593,7 +1593,7 @@
 	ser_info_t *info = (ser_info_t *)tty->driver_data;
 
 	if (   (tty->termios->c_cflag == old_termios->c_cflag)
-	    && (   RELEVANT_IFLAG(tty->termios->c_iflag) 
+	    && (   RELEVANT_IFLAG(tty->termios->c_iflag)
 		== RELEVANT_IFLAG(old_termios->c_iflag)))
 	  return;
 
@@ -1608,7 +1608,7 @@
 		serial_out(info, UART_MCR, info->MCR);
 		sti();
 	}
-	
+
 	/* Handle transition away from B0 status */
 	if (!(old_termios->c_cflag & CBAUD) &&
 	    (tty->termios->c_cflag & CBAUD)) {
@@ -1621,7 +1621,7 @@
 		serial_out(info, UART_MCR, info->MCR);
 		sti();
 	}
-	
+
 	/* Handle turning off CRTSCTS */
 	if ((old_termios->c_cflag & CRTSCTS) &&
 	    !(tty->termios->c_cflag & CRTSCTS)) {
@@ -1646,7 +1646,7 @@
 /*
  * ------------------------------------------------------------
  * rs_close()
- * 
+ *
  * This routine is called when the serial port gets closed.  First, we
  * wait for the last remaining data to be sent.  Then, we unlink its
  * async structure from the interrupt chain if necessary, and we free
@@ -1666,16 +1666,16 @@
 		return;
 
 	state = info->state;
-	
+
 	save_flags(flags); cli();
-	
+
 	if (tty_hung_up_p(filp)) {
 		DBG_CNT("before DEC-hung");
 		MOD_DEC_USE_COUNT;
 		restore_flags(flags);
 		return;
 	}
-	
+
 #ifdef SERIAL_DEBUG_OPEN
 	printk("rs_close ttys%d, count = %d\n", info->line, state->count);
 #endif
@@ -1712,7 +1712,7 @@
 	if (info->flags & ASYNC_CALLOUT_ACTIVE)
 		info->state->callout_termios = *tty->termios;
 	/*
-	 * Now we wait for the transmit buffer to clear; and we notify 
+	 * Now we wait for the transmit buffer to clear; and we notify
 	 * the line discipline to only process XON/XOFF characters.
 	 */
 	tty->closing = 1;
@@ -1775,7 +1775,7 @@
 	unsigned long orig_jiffies, char_time;
 	/*int lsr;*/
 	volatile cbd_t *bdp;
-	
+
 	if (serial_paranoia_check(info, tty->device, "rs_wait_until_sent"))
 		return;
 
@@ -1789,7 +1789,7 @@
 	 * Set the check interval to be 1/5 of the estimated time to
 	 * send a single character, and make it at least 1.  The check
 	 * interval should also be less than the timeout.
-	 * 
+	 *
 	 * Note: we have to use pretty tight timings here to satisfy
 	 * the NIST-PCTS.
 	 */
@@ -1843,12 +1843,12 @@
 {
 	ser_info_t *info = (ser_info_t *)tty->driver_data;
 	struct serial_state *state = info->state;
-	
+
 	if (serial_paranoia_check(info, tty->device, "rs_hangup"))
 		return;
 
 	state = info->state;
-	
+
 	rs_8xx_flush_buffer(tty);
 	shutdown(info);
 	info->event = 0;
@@ -1909,7 +1909,7 @@
 		info->flags |= ASYNC_CALLOUT_ACTIVE;
 		return 0;
 	}
-	
+
 	/*
 	 * If non-blocking mode is set, or the port is not enabled,
 	 * then make the check up front and then exit.
@@ -1932,7 +1932,7 @@
 		if (tty->termios->c_cflag & CLOCAL)
 			do_clocal = 1;
 	}
-	
+
 	/*
 	 * Block waiting for the carrier detect and the line to become
 	 * free (i.e., not in use by the callout).  While we are in
@@ -1948,7 +1948,7 @@
 	       state->line, state->count);
 #endif
 	cli();
-	if (!tty_hung_up_p(filp)) 
+	if (!tty_hung_up_p(filp))
 		state->count--;
 	sti();
 	info->blocked_open++;
@@ -1967,7 +1967,7 @@
 			if (info->flags & ASYNC_HUP_NOTIFY)
 				retval = -EAGAIN;
 			else
-				retval = -ERESTARTSYS;	
+				retval = -ERESTARTSYS;
 #else
 			retval = -EAGAIN;
 #endif
@@ -2068,7 +2068,7 @@
 	    (info->flags & ASYNC_SPLIT_TERMIOS)) {
 		if (tty->driver.subtype == SERIAL_TYPE_NORMAL)
 			*tty->termios = info->state->normal_termios;
-		else 
+		else
 			*tty->termios = info->state->callout_termios;
 		change_speed(info);
 	}
@@ -2121,7 +2121,7 @@
 	status = serial_in(info, UART_MSR);
 	control = info ? info->MCR : serial_in(info, UART_MCR);
 	sti();
-	
+
 	stat_buf[0] = 0;
 	stat_buf[1] = 0;
 	if (control & UART_MCR_RTS)
@@ -2147,12 +2147,12 @@
 
 	if (state->icount.frame)
 		ret += sprintf(buf+ret, " fe:%d", state->icount.frame);
-	
+
 	if (state->icount.parity)
 		ret += sprintf(buf+ret, " pe:%d", state->icount.parity);
-	
+
 	if (state->icount.brk)
-		ret += sprintf(buf+ret, " brk:%d", state->icount.brk);	
+		ret += sprintf(buf+ret, " brk:%d", state->icount.brk);
 
 	if (state->icount.overrun)
 		ret += sprintf(buf+ret, " oe:%d", state->icount.overrun);
@@ -2278,7 +2278,7 @@
 		else
 			cp = __va(bdp->cbd_bufaddr);
 		*cp = *s;
-		
+
 		bdp->cbd_datlen = 1;
 		bdp->cbd_sc |= BD_SC_READY;
 
@@ -2318,7 +2318,7 @@
 				unsigned count)
 {
 #ifdef CONFIG_KGDB_CONSOLE
-	/* Try to let stub handle output. Returns true if it did. */ 
+	/* Try to let stub handle output. Returns true if it did. */
 	if (kgdb_output_string(s, count))
 		return;
 #endif
@@ -2536,13 +2536,13 @@
 	volatile	scc_t		*scp;
 	volatile	scc_uart_t	*sup;
 	volatile	immap_t		*immap;
-	
+
 	init_bh(SERIAL_BH, do_serial_bh);
 
 	show_serial_version();
 
 	/* Initialize the tty_driver structure */
-	
+
 	__clear_user(&serial_driver,sizeof(struct tty_driver));
 	serial_driver.magic = TTY_DRIVER_MAGIC;
 	serial_driver.driver_name = "serial";
@@ -2582,7 +2582,7 @@
 	serial_driver.hangup = rs_8xx_hangup;
 	serial_driver.wait_until_sent = rs_8xx_wait_until_sent;
 	serial_driver.read_proc = rs_8xx_read_proc;
-	
+
 	/*
 	 * The callout device is just like normal device except for
 	 * major number and the subtype code.
@@ -2602,7 +2602,7 @@
 		panic("Couldn't register serial driver\n");
 	if (tty_register_driver(&callout_driver))
 		panic("Couldn't register callout driver\n");
-	
+
 	cp = cpmp;	/* Get pointer to Communication Processor */
 	immap = (immap_t *)IMAP_ADDR;	/* and to internal registers */
 
@@ -2663,7 +2663,7 @@
 		state->closing_wait = 30*HZ;
 		state->callout_termios = callout_driver.init_termios;
 		state->normal_termios = serial_driver.init_termios;
-		state->icount.cts = state->icount.dsr = 
+		state->icount.cts = state->icount.dsr =
 			state->icount.rng = state->icount.dcd = 0;
 		state->icount.rx = state->icount.tx = 0;
 		state->icount.frame = state->icount.parity = 0;
@@ -2800,7 +2800,7 @@
 				 * Enable receive and transmit.
 				 */
 				scp->scc_gsmrh = 0;
-				scp->scc_gsmrl = 
+				scp->scc_gsmrl =
 					(SCC_GSMRL_MODE_UART | SCC_GSMRL_TDCR_16 | SCC_GSMRL_RDCR_16);
 
 				/* Disable all interrupts and clear all pending
@@ -3028,7 +3028,7 @@
 		 * Enable receive and transmit.
 		 */
 		scp->scc_gsmrh = 0;
-		scp->scc_gsmrl = 
+		scp->scc_gsmrl =
 			(SCC_GSMRL_MODE_UART | SCC_GSMRL_TDCR_16 | SCC_GSMRL_RDCR_16);
 
 		/* Disable all interrupts and clear all pending

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)