annotate linux-patch/minpatch-4.9.240/0002-USB-serial-ftdi_sio-pass-port-to-quirk-port_probe-fu.patch @ 136:a21d348e01db

fc-uicc-tool: pb-dump command ported over
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 04 Feb 2021 03:40:55 +0000
parents d7a1e7a6d6ba
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
83
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 From 214b1d2da22e380b05ecf6e546962ca867e3a60e Mon Sep 17 00:00:00 2001
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 From: "Mychaela N. Falconia" <falcon@freecalypso.org>
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 Date: Fri, 2 Oct 2020 17:38:56 +0000
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 Subject: [PATCH 2/3] USB: serial: ftdi_sio: pass port to quirk port_probe
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 functions
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 The original code passed only the pointer to the ftdi_private struct
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 to quirk port_probe functions. However, some quirks may need to be
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 applied conditionally only to some channels of a multichannel FT2232x
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 or FT4232H device, and if a given quirk's port_probe function needs
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 to figure out which channel of a multichannel device is currently
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 being considered, it needs access to the port pointer passed to the
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 ftdi_sio_port_probe() function, so it can traverse USB data structures
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 from there.
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 Signed-off-by: Mychaela N. Falconia <falcon@freecalypso.org>
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 ---
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 drivers/usb/serial/ftdi_sio.c | 20 ++++++++++++--------
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 1 file changed, 12 insertions(+), 8 deletions(-)
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
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
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 index c9f979063af1..878ab4e5625c 100644
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 --- a/drivers/usb/serial/ftdi_sio.c
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 +++ b/drivers/usb/serial/ftdi_sio.c
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 @@ -83,15 +83,15 @@ struct ftdi_private {
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 struct ftdi_sio_quirk {
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 int (*probe)(struct usb_serial *);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 /* Special settings for probed ports. */
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 - void (*port_probe)(struct ftdi_private *);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 + void (*port_probe)(struct usb_serial_port *);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 };
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 static int ftdi_jtag_probe(struct usb_serial *serial);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 static int ftdi_NDI_device_setup(struct usb_serial *serial);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 static int ftdi_stmclite_probe(struct usb_serial *serial);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 static int ftdi_8u2232c_probe(struct usb_serial *serial);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 -static void ftdi_USB_UIRT_setup(struct ftdi_private *priv);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 -static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 +static void ftdi_USB_UIRT_setup(struct usb_serial_port *port);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 +static void ftdi_HE_TIRA1_setup(struct usb_serial_port *port);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 static const struct ftdi_sio_quirk ftdi_jtag_quirk = {
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 .probe = ftdi_jtag_probe,
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 @@ -1833,11 +1833,11 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 mutex_init(&priv->cfg_lock);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 - if (quirk && quirk->port_probe)
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 - quirk->port_probe(priv);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 -
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 usb_set_serial_port_data(port, priv);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 + if (quirk && quirk->port_probe)
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 + quirk->port_probe(port);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 +
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 ftdi_determine_type(port);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 ftdi_set_max_packet_size(port);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 if (read_latency_timer(port) < 0)
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 @@ -1850,8 +1850,10 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 /* Setup for the USB-UIRT device, which requires hardwired
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 * baudrate (38400 gets mapped to 312500) */
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 /* Called from usbserial:serial_probe */
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 -static void ftdi_USB_UIRT_setup(struct ftdi_private *priv)
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 +static void ftdi_USB_UIRT_setup(struct usb_serial_port *port)
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 {
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 + struct ftdi_private *priv = usb_get_serial_port_data(port);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 +
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 priv->flags |= ASYNC_SPD_CUST;
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 priv->custom_divisor = 77;
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 priv->force_baud = 38400;
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 @@ -1860,8 +1862,10 @@ static void ftdi_USB_UIRT_setup(struct ftdi_private *priv)
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 /* Setup for the HE-TIRA1 device, which requires hardwired
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 * baudrate (38400 gets mapped to 100000) and RTS-CTS enabled. */
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 -static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv)
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 +static void ftdi_HE_TIRA1_setup(struct usb_serial_port *port)
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 {
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 + struct ftdi_private *priv = usb_get_serial_port_data(port);
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 +
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 priv->flags |= ASYNC_SPD_CUST;
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 priv->custom_divisor = 240;
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 priv->force_baud = 38400;
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 --
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 2.9.0
d7a1e7a6d6ba linux-patch: current best offering of minpatch-*
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85