Author: avg
Date: Mon May 21 21:02:10 2018
New Revision: 334001
URL: https://svnweb.freebsd.org/changeset/base/334001

Log:
  uchcom: remove UCHCOM_REG_BREAK2 alias of UCHCOM_REG_LCR1
  
  Also, add definitions for more bits of UCHCOM_REG_LCR1 as seen in the
  Linux driver.  UCHCOM_LCR1_PARENB definition was different from that in
  the Linux driver and clashed with newly added UCHCOM_LCR1_RX.  I took a
  liberty to change UCHCOM_LCR1_PARENB to the Linux definition as it was
  unused in the driver anyway.  This change should make
  uchcom_cfg_set_break() easier to understand.
  
  Approved by:  hselasky
  MFC after:    2 weeks

Modified:
  head/sys/dev/usb/serial/uchcom.c

Modified: head/sys/dev/usb/serial/uchcom.c
==============================================================================
--- head/sys/dev/usb/serial/uchcom.c    Mon May 21 21:00:13 2018        
(r334000)
+++ head/sys/dev/usb/serial/uchcom.c    Mon May 21 21:02:10 2018        
(r334001)
@@ -122,7 +122,6 @@ SYSCTL_INT(_hw_usb_uchcom, OID_AUTO, debug, CTLFLAG_RW
 #define        UCHCOM_REG_BPS_MOD      0x14
 #define        UCHCOM_REG_BPS_PAD      0x0F
 #define        UCHCOM_REG_BREAK1       0x05
-#define        UCHCOM_REG_BREAK2       0x18
 #define        UCHCOM_REG_LCR1         0x18
 #define        UCHCOM_REG_LCR2         0x25
 
@@ -135,12 +134,14 @@ SYSCTL_INT(_hw_usb_uchcom, OID_AUTO, debug, CTLFLAG_RW
 #define        UCHCOM_DTR_MASK         0x20
 #define        UCHCOM_RTS_MASK         0x40
 
-#define        UCHCOM_BRK1_MASK        0x01
-#define        UCHCOM_BRK2_MASK        0x40
+#define        UCHCOM_BRK_MASK         0x01
 
 #define        UCHCOM_LCR1_MASK        0xAF
 #define        UCHCOM_LCR2_MASK        0x07
-#define        UCHCOM_LCR1_PARENB      0x80
+#define        UCHCOM_LCR1_RX          0x80
+#define        UCHCOM_LCR1_TX          0x40
+#define        UCHCOM_LCR1_PARENB      0x08
+#define        UCHCOM_LCR1_CS8         0x03
 #define        UCHCOM_LCR2_PAREVEN     0x07
 #define        UCHCOM_LCR2_PARODD      0x06
 #define        UCHCOM_LCR2_PARMARK     0x05
@@ -556,17 +557,17 @@ uchcom_cfg_set_break(struct ucom_softc *ucom, uint8_t 
        uint8_t brk1;
        uint8_t brk2;
 
-       uchcom_read_reg(sc, UCHCOM_REG_BREAK1, &brk1, UCHCOM_REG_BREAK2, &brk2);
+       uchcom_read_reg(sc, UCHCOM_REG_BREAK1, &brk1, UCHCOM_REG_LCR1, &brk2);
        if (onoff) {
                /* on - clear bits */
-               brk1 &= ~UCHCOM_BRK1_MASK;
-               brk2 &= ~UCHCOM_BRK2_MASK;
+               brk1 &= ~UCHCOM_BRK_MASK;
+               brk2 &= ~UCHCOM_LCR1_TX;
        } else {
                /* off - set bits */
-               brk1 |= UCHCOM_BRK1_MASK;
-               brk2 |= UCHCOM_BRK2_MASK;
+               brk1 |= UCHCOM_BRK_MASK;
+               brk2 |= UCHCOM_LCR1_TX;
        }
-       uchcom_write_reg(sc, UCHCOM_REG_BREAK1, brk1, UCHCOM_REG_BREAK2, brk2);
+       uchcom_write_reg(sc, UCHCOM_REG_BREAK1, brk1, UCHCOM_REG_LCR1, brk2);
 }
 
 static int
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to