annotate linux-patch/orig-202007/ftdi_sio.c.patch @ 176:fb2f6497ba53 default tip

doc/Linux-DTR-RTS-flaw: point to new location of this article
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 11 Dec 2023 19:37:20 +0000
parents e2161ac7d641
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
73
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 --- ftdi_sio.c.orig 2016-06-24 09:18:38.000000000 -0800
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 +++ ftdi_sio.c 2020-07-28 15:33:04.022945400 -0800
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 @@ -73,6 +73,8 @@
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 this value */
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 int force_rtscts; /* if non-zero, force RTS-CTS to always
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 be enabled */
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 + int no_auto_dtr_rts; /* if non-zero, suppress automatic assertion
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 + of DTR & RTS on device open */
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 unsigned int latency; /* latency setting in use */
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 unsigned short max_packet_size;
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 @@ -83,15 +85,19 @@
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 struct ftdi_sio_quirk {
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 int (*probe)(struct usb_serial *);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 /* Special settings for probed ports. */
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 - void (*port_probe)(struct ftdi_private *);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 + void (*port_probe)(struct usb_serial_port *, struct ftdi_private *);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 };
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 static int ftdi_jtag_probe(struct usb_serial *serial);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 static int ftdi_NDI_device_setup(struct usb_serial *serial);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 static int ftdi_stmclite_probe(struct usb_serial *serial);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 static int ftdi_8u2232c_probe(struct usb_serial *serial);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 -static void ftdi_USB_UIRT_setup(struct ftdi_private *priv);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 -static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 +static void ftdi_USB_UIRT_setup(struct usb_serial_port *port,
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 + struct ftdi_private *priv);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 +static void ftdi_HE_TIRA1_setup(struct usb_serial_port *port,
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 + struct ftdi_private *priv);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 +static void ftdi_duart28c_setup(struct usb_serial_port *port,
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 + struct ftdi_private *priv);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 static struct ftdi_sio_quirk ftdi_jtag_quirk = {
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 .probe = ftdi_jtag_probe,
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 @@ -117,6 +123,10 @@
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 .probe = ftdi_8u2232c_probe,
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 };
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 +static struct ftdi_sio_quirk ftdi_duart28c_quirk = {
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 + .port_probe = ftdi_duart28c_setup,
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 +};
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 +
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 /*
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 * The 8U232AM has the same API as the sio except for:
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 * - it can support MUCH higher baudrates; up to:
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 @@ -1008,6 +1018,13 @@
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 { USB_DEVICE(ICPDAS_VID, ICPDAS_I7560U_PID) },
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 { USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) },
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 { USB_DEVICE(ICPDAS_VID, ICPDAS_I7563U_PID) },
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 + /* FreeCalypso USB adapters */
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 + { USB_DEVICE(FTDI_VID, FTDI_FALCONIA_JTAG_BUF_PID),
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 + { USB_DEVICE(FTDI_VID, FTDI_FALCONIA_JTAG_UNBUF_PID),
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 + { USB_DEVICE(FTDI_VID, FTDI_FALCONIA_DUART28C_PID),
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 + .driver_info = (kernel_ulong_t)&ftdi_duart28c_quirk },
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 { } /* Terminating entry */
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 };
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 @@ -1804,7 +1821,7 @@
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 priv->flags = ASYNC_LOW_LATENCY;
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 if (quirk && quirk->port_probe)
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 - quirk->port_probe(priv);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 + quirk->port_probe(port, priv);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 usb_set_serial_port_data(port, priv);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 @@ -1820,7 +1837,8 @@
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 /* Setup for the USB-UIRT device, which requires hardwired
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 * baudrate (38400 gets mapped to 312500) */
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 /* Called from usbserial:serial_probe */
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 -static void ftdi_USB_UIRT_setup(struct ftdi_private *priv)
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 +static void ftdi_USB_UIRT_setup(struct usb_serial_port *port,
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 + struct ftdi_private *priv)
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 {
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 priv->flags |= ASYNC_SPD_CUST;
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 priv->custom_divisor = 77;
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 @@ -1830,7 +1848,8 @@
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 /* Setup for the HE-TIRA1 device, which requires hardwired
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 * baudrate (38400 gets mapped to 100000) and RTS-CTS enabled. */
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 -static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv)
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 +static void ftdi_HE_TIRA1_setup(struct usb_serial_port *port,
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 + struct ftdi_private *priv)
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 {
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 priv->flags |= ASYNC_SPD_CUST;
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 priv->custom_divisor = 240;
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 @@ -1926,6 +1945,37 @@
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 return 0;
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 }
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 +/*
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 + * FreeCalypso DUART28C is an FT2232D-based USB to dual UART adapter
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 + * with a special quirk: Channel B RTS and DTR outputs (BDBUS2 and BDBUS4
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 + * on the chip) have been repurposed to drive power and reset controls
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 + * on Calypso targets. The circuit is wired such that BDBUS[24] high
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 + * (RTS/DTR inactive) is the normal state with power/reset control
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 + * NOT activated, whereas BDBUS[24] low (RTS or DTR active) turn ON
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 + * the corresponding power/reset control drivers.
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 + *
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 + * A special ftdi_sio driver quirk is needed in order to suppress
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 + * automatic assertion of DTR & RTS on device open: this device's
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 + * special power and reset control drivers MUST NOT be activated
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 + * when the port is ordinarily opened for plain serial communication,
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 + * instead they must only be activated when a special userspace
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 + * application explicitly requests such activation with a TIOCMBIS ioctl.
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 + *
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 + * The special quirk must be applied only to FT2232D Channel B:
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 + * Channel A is wired normally, with the chip's ADBUS2 and ADBUS4 outputs
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 + * actually being RTS and DTR rather than something else.
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 + */
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 +static void ftdi_duart28c_setup(struct usb_serial_port *port,
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 + struct ftdi_private *priv)
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 +{
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 + struct usb_serial *serial = port->serial;
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 + struct usb_device *udev = serial->dev;
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 + struct usb_interface *interface = serial->interface;
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 +
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 + if (interface == udev->actconfig->interface[1])
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 + priv->no_auto_dtr_rts = 1;
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 +}
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 +
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 static int ftdi_sio_port_remove(struct usb_serial_port *port)
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 {
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 struct ftdi_private *priv = usb_get_serial_port_data(port);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 @@ -1976,9 +2026,10 @@
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 }
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 }
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 /* drop RTS and DTR */
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 - if (on)
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 - set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 - else
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 + if (on) {
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 + if (!priv->no_auto_dtr_rts)
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 + set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 + } else
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 }
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 @@ -2316,7 +2367,8 @@
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 dev_err(ddev, "%s urb failed to set baudrate\n", __func__);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 mutex_unlock(&priv->cfg_lock);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 /* Ensure RTS and DTR are raised when baudrate changed from 0 */
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 - if (old_termios && (old_termios->c_cflag & CBAUD) == B0)
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 + if (old_termios && (old_termios->c_cflag & CBAUD) == B0
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 + && !priv->no_auto_dtr_rts)
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 }
749e1a14aa24 linux-patch: publishing currently used ftdi_sio driver patch
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150