comparison 4.4.14/0002-USB-serial-ftdi_sio-pass-port-to-quirk-port_probe-fu.patch @ 0:713fe1e8df41

initial import of formal patches from freecalypso-hwlab repo
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 11 Dec 2023 05:55:17 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:713fe1e8df41
1 From 13701049a8f24450d69b6eeac6cfab5951abc604 Mon Sep 17 00:00:00 2001
2 From: "Mychaela N. Falconia" <falcon@freecalypso.org>
3 Date: Fri, 2 Oct 2020 17:38:56 +0000
4 Subject: [PATCH 2/3] USB: serial: ftdi_sio: pass port to quirk port_probe
5 functions
6
7 The original code passed only the pointer to the ftdi_private struct
8 to quirk port_probe functions. However, some quirks may need to be
9 applied conditionally only to some channels of a multichannel FT2232x
10 or FT4232H device, and if a given quirk's port_probe function needs
11 to figure out which channel of a multichannel device is currently
12 being considered, it needs access to the port pointer passed to the
13 ftdi_sio_port_probe() function, so it can traverse USB data structures
14 from there.
15
16 Signed-off-by: Mychaela N. Falconia <falcon@freecalypso.org>
17 ---
18 drivers/usb/serial/ftdi_sio.c | 20 ++++++++++++--------
19 1 file changed, 12 insertions(+), 8 deletions(-)
20
21 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
22 index 984a93c38365..60d1831ee8c3 100644
23 --- a/drivers/usb/serial/ftdi_sio.c
24 +++ b/drivers/usb/serial/ftdi_sio.c
25 @@ -83,15 +83,15 @@ struct ftdi_private {
26 struct ftdi_sio_quirk {
27 int (*probe)(struct usb_serial *);
28 /* Special settings for probed ports. */
29 - void (*port_probe)(struct ftdi_private *);
30 + void (*port_probe)(struct usb_serial_port *);
31 };
32
33 static int ftdi_jtag_probe(struct usb_serial *serial);
34 static int ftdi_NDI_device_setup(struct usb_serial *serial);
35 static int ftdi_stmclite_probe(struct usb_serial *serial);
36 static int ftdi_8u2232c_probe(struct usb_serial *serial);
37 -static void ftdi_USB_UIRT_setup(struct ftdi_private *priv);
38 -static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv);
39 +static void ftdi_USB_UIRT_setup(struct usb_serial_port *port);
40 +static void ftdi_HE_TIRA1_setup(struct usb_serial_port *port);
41
42 static struct ftdi_sio_quirk ftdi_jtag_quirk = {
43 .probe = ftdi_jtag_probe,
44 @@ -1808,11 +1808,11 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
45
46 priv->flags = ASYNC_LOW_LATENCY;
47
48 - if (quirk && quirk->port_probe)
49 - quirk->port_probe(priv);
50 -
51 usb_set_serial_port_data(port, priv);
52
53 + if (quirk && quirk->port_probe)
54 + quirk->port_probe(port);
55 +
56 ftdi_determine_type(port);
57 ftdi_set_max_packet_size(port);
58 if (read_latency_timer(port) < 0)
59 @@ -1825,8 +1825,10 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
60 /* Setup for the USB-UIRT device, which requires hardwired
61 * baudrate (38400 gets mapped to 312500) */
62 /* Called from usbserial:serial_probe */
63 -static void ftdi_USB_UIRT_setup(struct ftdi_private *priv)
64 +static void ftdi_USB_UIRT_setup(struct usb_serial_port *port)
65 {
66 + struct ftdi_private *priv = usb_get_serial_port_data(port);
67 +
68 priv->flags |= ASYNC_SPD_CUST;
69 priv->custom_divisor = 77;
70 priv->force_baud = 38400;
71 @@ -1835,8 +1837,10 @@ static void ftdi_USB_UIRT_setup(struct ftdi_private *priv)
72 /* Setup for the HE-TIRA1 device, which requires hardwired
73 * baudrate (38400 gets mapped to 100000) and RTS-CTS enabled. */
74
75 -static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv)
76 +static void ftdi_HE_TIRA1_setup(struct usb_serial_port *port)
77 {
78 + struct ftdi_private *priv = usb_get_serial_port_data(port);
79 +
80 priv->flags |= ASYNC_SPD_CUST;
81 priv->custom_divisor = 240;
82 priv->force_baud = 38400;
83 --
84 2.9.0
85