# HG changeset patch # User Mychaela Falconia # Date 1593139982 0 # Node ID 17b7b92e7dba46399258d28fc2776e9414da92f0 # Parent 140a0d24a64ceef14b73cb8e7f7b2ae8ecc570d2 uartfax.c: fix for old Openmoko bug with Auto-CTS Openmoko made the change of enabling hardware assisted CTS flow control in the UART when RTS/CTS flow control is used - it is a change which we have retained in FreeCalypso - but they forgot to turn this hw mode off if RTS/CTS flow control is deselected at the application level. We (FreeCalypso) are now fixing the latter defect ourselves. diff -r 140a0d24a64c -r 17b7b92e7dba src/cs/drivers/drv_app/uart/uartfax.c --- a/src/cs/drivers/drv_app/uart/uartfax.c Thu Jun 25 05:36:24 2020 +0000 +++ b/src/cs/drivers/drv_app/uart/uartfax.c Fri Jun 26 02:53:02 2020 +0000 @@ -3623,25 +3623,49 @@ uart, IER, READ_UART_REGISTER (uart, IER) | IER_SLEEP); */ #endif - + + /* + * Openmoko made the change of enabling hardware assisted CTS + * flow control in the UART when RTS/CTS flow control is used - + * it is a change which we have retained in FreeCalypso - + * but they forgot to turn this hw mode off if RTS/CTS flow control + * is deselected at the application level. We (FreeCalypso) + * are now fixing the latter defect ourselves. + */ if (fcMode == fc_rts) { -#if 1 // Dmitriy: enable hardware assisted CTS - volatile SYS_UWORD8 oldValue; + /* begin Openmoko change */ + SYS_UWORD8 oldValue; oldValue = READ_UART_REGISTER (uart, LCR); - + // LCR value to allow acces to EFR - + WRITE_UART_REGISTER (uart, LCR, 0xBF); - + // enable hardware assisted CTS - + SET_BIT (uart, EFR, AUTO_CTS_BIT); - - WRITE_UART_REGISTER (uart, LCR, oldValue); -#endif + + WRITE_UART_REGISTER (uart, LCR, oldValue); + /* end Openmoko change */ + if (uart->rts_level) uart->tx_stopped_by_driver = 1; + } else { + /* FreeCalypso addition: turn off OM-added Auto-CTS */ + SYS_UWORD8 oldValue; + + oldValue = READ_UART_REGISTER (uart, LCR); + + // LCR value to allow acces to EFR + + WRITE_UART_REGISTER (uart, LCR, 0xBF); + + // disable hardware assisted CTS + + RESET_BIT (uart, EFR, AUTO_CTS_BIT); + + WRITE_UART_REGISTER (uart, LCR, oldValue); } /*