uart_cpm scc Rx problem after second open of the device

Alexandros Kostopoulos akostop at inaccessnetworks.com
Tue Aug 29 00:04:16 EST 2006


I experienced a problem with the cpm_uart scc driver (kernel version  
2.6.13) while running the driver for a serial port NOT configured as a  
console.
The problem is as follows:
The first time the device (/dev/ttyCPM0) is opened, everything works ok.  
The second time, however, the device is opened, receive does not work. The  
device can only transmit, but doesn't receive anything.

Well, by looking into the code, I found out that the ENR (Receiver enable)  
bit of the GSMR-L register is only set in cpm_uart_init_scc and NOT in
cpm_uart_startup, as I think it should. Then, the bit is cleared on  
cpm_uart_shutdown. Thus, the first time the device is opened, the bit is  
set (and so, the device normally receives data), but the second time the  
device is opened, the bit is NOT set and the device cannot receive  
anything from the serial port.

The diff of my code against the original 2.6.13 code follows (although i  
saw that the 2.6.17 code is exactly the same as far as the ENR bit is
concerned):

Index: cpm_uart_core.c
===================================================================
--- cpm_uart_core.c     (revision 79)
+++ cpm_uart_core.c     (revision 105)
@@ -393,6 +393,7 @@
                 pinfo->smcp->smc_smcm |= SMCM_RX;
                 pinfo->smcp->smc_smcmr |= SMCMR_REN;
         } else {
+        pinfo->sccp->scc_gsmrl |= (SCC_GSMRL_ENR);
                 pinfo->sccp->scc_sccm |= UART_SCCM_RX;
         }


Am I missing something here?

Thanks for any comments,
Alex.



More information about the Linuxppc-dev mailing list