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

Next file: linux/arch/ppc/config.in
Previous file: linux/arch/ppc/8xx_io/commproc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.13/linux/arch/ppc/8xx_io/uart.c linux/arch/ppc/8xx_io/uart.c
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.uart.c 1.16 09/14/01 18:01:17 trini
+ * BK Id: SCCS/s.uart.c 1.19 10/26/01 09:59:32 trini
  */
 /*
  *  UART driver for MPC860 CPM SCC or SMC
@@ -94,10 +94,10 @@
 static int serial_refcount;
 static int serial_console_setup(struct console *co, char *options);
 
-static int serial_console_wait_key(struct console *co);
 static void serial_console_write(struct console *c, const char *s,
 				unsigned count);
 static kdev_t serial_console_device(struct console *c);
+static int serial_console_wait_key(struct console *co);
 
 #if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
 static unsigned long break_pressed; /* break, really ... */
@@ -481,7 +481,9 @@
 			tty->flip.count++;
 		}
 
+#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
 	ignore_char:	
+#endif
 		/* This BD is ready to be used again.  Clear status.
 		 * Get next BD.
 		 */
@@ -876,7 +878,7 @@
 static void change_speed(ser_info_t *info)
 {
 	int	baud_rate;
-	unsigned cflag, cval, scval, prev_mode;
+	unsigned cflag, cval, scval, prev_mode, new_mode;
 	int	i, bits, sbits, idx;
 	unsigned long	flags;
 	struct serial_state *state;
@@ -917,10 +919,10 @@
 		cval |= SMCMR_PEN;
 		scval |= SCU_PMSR_PEN;
 		bits++;
-	}
-	if (!(cflag & PARODD)) {
-		cval |= SMCMR_PM_EVEN;
-		scval |= (SCU_PMSR_REVP | SCU_PMSR_TEVP);
+		if (!(cflag & PARODD)) {
+			cval |= SMCMR_PM_EVEN;
+			scval |= (SCU_PMSR_REVP | SCU_PMSR_TEVP);
+		}
 	}
 
 	/* Determine divisor based on baud rate */
@@ -993,7 +995,13 @@
 	idx = PORT_NUM(state->smc_scc_num);
 	if (state->smc_scc_num & NUM_IS_SCC) {
 		sccp = &cpmp->cp_scc[idx];
-		sccp->scc_pmsr = (sbits << 12) | scval;
+		new_mode = (sbits << 12) | scval;
+		prev_mode = sccp->scc_pmsr;
+		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)
+			sccp->scc_pmsr = new_mode;
 	}
 	else {
 		smcp = &cpmp->cp_smc[idx];
@@ -1003,8 +1011,13 @@
 		 * present.
 		 */
 		prev_mode = smcp->smc_smcmr;
-		smcp->smc_smcmr = smcr_mk_clen(bits) | cval |  SMCMR_SM_UART;
-		smcp->smc_smcmr |= (prev_mode & (SMCMR_REN | SMCMR_TEN));
+		new_mode = smcr_mk_clen(bits) | cval |  SMCMR_SM_UART;
+		new_mode |= (prev_mode & (SMCMR_REN | SMCMR_TEN));
+		if (!(prev_mode & SMCMR_PEN))
+			/* If parity is disabled, mask out even/odd */
+			prev_mode &= ~SMCMR_PM_EVEN;
+		if (prev_mode != new_mode)
+			smcp->smc_smcmr = new_mode;
 	}
 
 	m8xx_cpm_setbrg((state - rs_table), baud_rate);

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