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