Commit fd47ff55 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'usb-5.15-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull more USB updates from Greg KH:
 "Here are some straggler USB-serial changes for 5.15-rc1.

  These were not included in the first pull request as they came in
  "late" from Johan and I had missed them in my pull request earlier
  this week.

  Nothing big in here, just some USB to serial driver updates and fixes.
  All of these were in linux-next before I pulled them into my tree, and
  have been in linux-next all this week from my tree with no reported
  problems"

* tag 'usb-5.15-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  USB: serial: pl2303: fix GL type detection
  USB: serial: replace symbolic permissions by octal permissions
  USB: serial: cp210x: determine fw version for CP2105 and CP2108
  USB: serial: cp210x: clean up type detection
  USB: serial: cp210x: clean up set-chars request
  USB: serial: cp210x: clean up control-request timeout
  USB: serial: cp210x: fix flow-control error handling
  USB: serial: cp210x: fix control-characters error handling
  USB: serial: io_edgeport: drop unused descriptor helper
parents 6b6dc4f4 1b4f3dfb
...@@ -400,6 +400,7 @@ struct cp210x_special_chars { ...@@ -400,6 +400,7 @@ struct cp210x_special_chars {
}; };
/* CP210X_VENDOR_SPECIFIC values */ /* CP210X_VENDOR_SPECIFIC values */
#define CP210X_GET_FW_VER 0x000E
#define CP210X_READ_2NCONFIG 0x000E #define CP210X_READ_2NCONFIG 0x000E
#define CP210X_GET_FW_VER_2N 0x0010 #define CP210X_GET_FW_VER_2N 0x0010
#define CP210X_READ_LATCH 0x00C2 #define CP210X_READ_LATCH 0x00C2
...@@ -638,7 +639,7 @@ static int cp210x_read_reg_block(struct usb_serial_port *port, u8 req, ...@@ -638,7 +639,7 @@ static int cp210x_read_reg_block(struct usb_serial_port *port, u8 req,
result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
req, REQTYPE_INTERFACE_TO_HOST, 0, req, REQTYPE_INTERFACE_TO_HOST, 0,
port_priv->bInterfaceNumber, dmabuf, bufsize, port_priv->bInterfaceNumber, dmabuf, bufsize,
USB_CTRL_SET_TIMEOUT); USB_CTRL_GET_TIMEOUT);
if (result == bufsize) { if (result == bufsize) {
memcpy(buf, dmabuf, bufsize); memcpy(buf, dmabuf, bufsize);
result = 0; result = 0;
...@@ -1145,33 +1146,6 @@ static void cp210x_disable_event_mode(struct usb_serial_port *port) ...@@ -1145,33 +1146,6 @@ static void cp210x_disable_event_mode(struct usb_serial_port *port)
port_priv->event_mode = false; port_priv->event_mode = false;
} }
static int cp210x_set_chars(struct usb_serial_port *port,
struct cp210x_special_chars *chars)
{
struct cp210x_port_private *port_priv = usb_get_serial_port_data(port);
struct usb_serial *serial = port->serial;
void *dmabuf;
int result;
dmabuf = kmemdup(chars, sizeof(*chars), GFP_KERNEL);
if (!dmabuf)
return -ENOMEM;
result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
CP210X_SET_CHARS, REQTYPE_HOST_TO_INTERFACE, 0,
port_priv->bInterfaceNumber,
dmabuf, sizeof(*chars), USB_CTRL_SET_TIMEOUT);
kfree(dmabuf);
if (result < 0) {
dev_err(&port->dev, "failed to set special chars: %d\n", result);
return result;
}
return 0;
}
static bool cp210x_termios_change(const struct ktermios *a, const struct ktermios *b) static bool cp210x_termios_change(const struct ktermios *a, const struct ktermios *b)
{ {
bool iflag_change, cc_change; bool iflag_change, cc_change;
...@@ -1192,6 +1166,7 @@ static void cp210x_set_flow_control(struct tty_struct *tty, ...@@ -1192,6 +1166,7 @@ static void cp210x_set_flow_control(struct tty_struct *tty,
struct cp210x_flow_ctl flow_ctl; struct cp210x_flow_ctl flow_ctl;
u32 flow_repl; u32 flow_repl;
u32 ctl_hs; u32 ctl_hs;
bool crtscts;
int ret; int ret;
/* /*
...@@ -1218,9 +1193,12 @@ static void cp210x_set_flow_control(struct tty_struct *tty, ...@@ -1218,9 +1193,12 @@ static void cp210x_set_flow_control(struct tty_struct *tty,
chars.bXonChar = START_CHAR(tty); chars.bXonChar = START_CHAR(tty);
chars.bXoffChar = STOP_CHAR(tty); chars.bXoffChar = STOP_CHAR(tty);
ret = cp210x_set_chars(port, &chars); ret = cp210x_write_reg_block(port, CP210X_SET_CHARS, &chars,
if (ret) sizeof(chars));
return; if (ret) {
dev_err(&port->dev, "failed to set special chars: %d\n",
ret);
}
} }
mutex_lock(&port_priv->mutex); mutex_lock(&port_priv->mutex);
...@@ -1249,14 +1227,14 @@ static void cp210x_set_flow_control(struct tty_struct *tty, ...@@ -1249,14 +1227,14 @@ static void cp210x_set_flow_control(struct tty_struct *tty,
flow_repl |= CP210X_SERIAL_RTS_FLOW_CTL; flow_repl |= CP210X_SERIAL_RTS_FLOW_CTL;
else else
flow_repl |= CP210X_SERIAL_RTS_INACTIVE; flow_repl |= CP210X_SERIAL_RTS_INACTIVE;
port_priv->crtscts = true; crtscts = true;
} else { } else {
ctl_hs &= ~CP210X_SERIAL_CTS_HANDSHAKE; ctl_hs &= ~CP210X_SERIAL_CTS_HANDSHAKE;
if (port_priv->rts) if (port_priv->rts)
flow_repl |= CP210X_SERIAL_RTS_ACTIVE; flow_repl |= CP210X_SERIAL_RTS_ACTIVE;
else else
flow_repl |= CP210X_SERIAL_RTS_INACTIVE; flow_repl |= CP210X_SERIAL_RTS_INACTIVE;
port_priv->crtscts = false; crtscts = false;
} }
if (I_IXOFF(tty)) { if (I_IXOFF(tty)) {
...@@ -1279,8 +1257,12 @@ static void cp210x_set_flow_control(struct tty_struct *tty, ...@@ -1279,8 +1257,12 @@ static void cp210x_set_flow_control(struct tty_struct *tty,
flow_ctl.ulControlHandshake = cpu_to_le32(ctl_hs); flow_ctl.ulControlHandshake = cpu_to_le32(ctl_hs);
flow_ctl.ulFlowReplace = cpu_to_le32(flow_repl); flow_ctl.ulFlowReplace = cpu_to_le32(flow_repl);
cp210x_write_reg_block(port, CP210X_SET_FLOW, &flow_ctl, ret = cp210x_write_reg_block(port, CP210X_SET_FLOW, &flow_ctl,
sizeof(flow_ctl)); sizeof(flow_ctl));
if (ret)
goto out_unlock;
port_priv->crtscts = crtscts;
out_unlock: out_unlock:
mutex_unlock(&port_priv->mutex); mutex_unlock(&port_priv->mutex);
} }
...@@ -2111,12 +2093,26 @@ static int cp210x_get_fw_version(struct usb_serial *serial, u16 value) ...@@ -2111,12 +2093,26 @@ static int cp210x_get_fw_version(struct usb_serial *serial, u16 value)
return 0; return 0;
} }
static void cp210x_determine_quirks(struct usb_serial *serial) static void cp210x_determine_type(struct usb_serial *serial)
{ {
struct cp210x_serial_private *priv = usb_get_serial_data(serial); struct cp210x_serial_private *priv = usb_get_serial_data(serial);
int ret; int ret;
ret = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST,
CP210X_GET_PARTNUM, &priv->partnum,
sizeof(priv->partnum));
if (ret < 0) {
dev_warn(&serial->interface->dev,
"querying part number failed\n");
priv->partnum = CP210X_PARTNUM_UNKNOWN;
return;
}
switch (priv->partnum) { switch (priv->partnum) {
case CP210X_PARTNUM_CP2105:
case CP210X_PARTNUM_CP2108:
cp210x_get_fw_version(serial, CP210X_GET_FW_VER);
break;
case CP210X_PARTNUM_CP2102N_QFN28: case CP210X_PARTNUM_CP2102N_QFN28:
case CP210X_PARTNUM_CP2102N_QFN24: case CP210X_PARTNUM_CP2102N_QFN24:
case CP210X_PARTNUM_CP2102N_QFN20: case CP210X_PARTNUM_CP2102N_QFN20:
...@@ -2140,18 +2136,9 @@ static int cp210x_attach(struct usb_serial *serial) ...@@ -2140,18 +2136,9 @@ static int cp210x_attach(struct usb_serial *serial)
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
result = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST,
CP210X_GET_PARTNUM, &priv->partnum,
sizeof(priv->partnum));
if (result < 0) {
dev_warn(&serial->interface->dev,
"querying part number failed\n");
priv->partnum = CP210X_PARTNUM_UNKNOWN;
}
usb_set_serial_data(serial, priv); usb_set_serial_data(serial, priv);
cp210x_determine_quirks(serial); cp210x_determine_type(serial);
cp210x_init_max_speed(serial); cp210x_init_max_speed(serial);
result = cp210x_gpio_init(serial); result = cp210x_gpio_init(serial);
......
...@@ -1199,9 +1199,9 @@ MODULE_AUTHOR(DRIVER_AUTHOR); ...@@ -1199,9 +1199,9 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC); MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_param(stats, bool, S_IRUGO | S_IWUSR); module_param(stats, bool, 0644);
MODULE_PARM_DESC(stats, "Enable statistics or not"); MODULE_PARM_DESC(stats, "Enable statistics or not");
module_param(interval, int, S_IRUGO | S_IWUSR); module_param(interval, int, 0644);
MODULE_PARM_DESC(interval, "Overrides interrupt interval"); MODULE_PARM_DESC(interval, "Overrides interrupt interval");
module_param(unstable_bauds, bool, S_IRUGO | S_IWUSR); module_param(unstable_bauds, bool, 0644);
MODULE_PARM_DESC(unstable_bauds, "Allow unstable baud rates"); MODULE_PARM_DESC(unstable_bauds, "Allow unstable baud rates");
...@@ -2938,5 +2938,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR); ...@@ -2938,5 +2938,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC); MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_param(ndi_latency_timer, int, S_IRUGO | S_IWUSR); module_param(ndi_latency_timer, int, 0644);
MODULE_PARM_DESC(ndi_latency_timer, "NDI device latency timer override"); MODULE_PARM_DESC(ndi_latency_timer, "NDI device latency timer override");
...@@ -1444,5 +1444,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR); ...@@ -1444,5 +1444,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC); MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_param(initial_mode, int, S_IRUGO); module_param(initial_mode, int, 0444);
MODULE_PARM_DESC(initial_mode, "Initial mode"); MODULE_PARM_DESC(initial_mode, "Initial mode");
...@@ -389,39 +389,6 @@ static void update_edgeport_E2PROM(struct edgeport_serial *edge_serial) ...@@ -389,39 +389,6 @@ static void update_edgeport_E2PROM(struct edgeport_serial *edge_serial)
release_firmware(fw); release_firmware(fw);
} }
#if 0
/************************************************************************
*
* Get string descriptor from device
*
************************************************************************/
static int get_string_desc(struct usb_device *dev, int Id,
struct usb_string_descriptor **pRetDesc)
{
struct usb_string_descriptor StringDesc;
struct usb_string_descriptor *pStringDesc;
dev_dbg(&dev->dev, "%s - USB String ID = %d\n", __func__, Id);
if (!usb_get_descriptor(dev, USB_DT_STRING, Id, &StringDesc,
sizeof(StringDesc)))
return 0;
pStringDesc = kmalloc(StringDesc.bLength, GFP_KERNEL);
if (!pStringDesc)
return -1;
if (!usb_get_descriptor(dev, USB_DT_STRING, Id, pStringDesc,
StringDesc.bLength)) {
kfree(pStringDesc);
return -1;
}
*pRetDesc = pStringDesc;
return 0;
}
#endif
static void dump_product_info(struct edgeport_serial *edge_serial, static void dump_product_info(struct edgeport_serial *edge_serial,
struct edgeport_product_info *product_info) struct edgeport_product_info *product_info)
{ {
......
...@@ -2746,9 +2746,9 @@ MODULE_DESCRIPTION(DRIVER_DESC); ...@@ -2746,9 +2746,9 @@ MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_FIRMWARE("edgeport/down3.bin"); MODULE_FIRMWARE("edgeport/down3.bin");
module_param(ignore_cpu_rev, bool, S_IRUGO | S_IWUSR); module_param(ignore_cpu_rev, bool, 0644);
MODULE_PARM_DESC(ignore_cpu_rev, MODULE_PARM_DESC(ignore_cpu_rev,
"Ignore the cpu revision when connecting to a device"); "Ignore the cpu revision when connecting to a device");
module_param(default_uart_mode, int, S_IRUGO | S_IWUSR); module_param(default_uart_mode, int, 0644);
MODULE_PARM_DESC(default_uart_mode, "Default uart_mode, 0=RS232, ..."); MODULE_PARM_DESC(default_uart_mode, "Default uart_mode, 0=RS232, ...");
...@@ -599,10 +599,10 @@ MODULE_AUTHOR(DRIVER_AUTHOR); ...@@ -599,10 +599,10 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC); MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_param(connect_retries, int, S_IRUGO|S_IWUSR); module_param(connect_retries, int, 0644);
MODULE_PARM_DESC(connect_retries, MODULE_PARM_DESC(connect_retries,
"Maximum number of connect retries (one second each)"); "Maximum number of connect retries (one second each)");
module_param(initial_wait, int, S_IRUGO|S_IWUSR); module_param(initial_wait, int, 0644);
MODULE_PARM_DESC(initial_wait, MODULE_PARM_DESC(initial_wait,
"Time to wait before attempting a connection (in seconds)"); "Time to wait before attempting a connection (in seconds)");
...@@ -1188,20 +1188,20 @@ MODULE_AUTHOR("Alain Degreffe eczema@ecze.com"); ...@@ -1188,20 +1188,20 @@ MODULE_AUTHOR("Alain Degreffe eczema@ecze.com");
MODULE_DESCRIPTION(DRIVER_DESC); MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_param(xmas, bool, S_IRUGO | S_IWUSR); module_param(xmas, bool, 0644);
MODULE_PARM_DESC(xmas, "Xmas colors enabled or not"); MODULE_PARM_DESC(xmas, "Xmas colors enabled or not");
module_param(boost, int, S_IRUGO | S_IWUSR); module_param(boost, int, 0644);
MODULE_PARM_DESC(boost, "Card overclock boost (in percent 100-500)"); MODULE_PARM_DESC(boost, "Card overclock boost (in percent 100-500)");
module_param(clockmode, int, S_IRUGO | S_IWUSR); module_param(clockmode, int, 0644);
MODULE_PARM_DESC(clockmode, "Card clock mode (1=3.579 MHz, 2=3.680 MHz, " MODULE_PARM_DESC(clockmode, "Card clock mode (1=3.579 MHz, 2=3.680 MHz, "
"3=6 Mhz)"); "3=6 Mhz)");
module_param(cdmode, int, S_IRUGO | S_IWUSR); module_param(cdmode, int, 0644);
MODULE_PARM_DESC(cdmode, "Card detect mode (0=none, 1=CD, 2=!CD, 3=DSR, " MODULE_PARM_DESC(cdmode, "Card detect mode (0=none, 1=CD, 2=!CD, 3=DSR, "
"4=!DSR, 5=CTS, 6=!CTS, 7=RING, 8=!RING)"); "4=!DSR, 5=CTS, 6=!CTS, 7=RING, 8=!RING)");
module_param(vcc_default, int, S_IRUGO | S_IWUSR); module_param(vcc_default, int, 0644);
MODULE_PARM_DESC(vcc_default, "Set default VCC (either 3 for 3.3V or 5 " MODULE_PARM_DESC(vcc_default, "Set default VCC (either 3 for 3.3V or 5 "
"for 5V). Default to 5."); "for 5V). Default to 5.");
...@@ -433,6 +433,7 @@ static int pl2303_detect_type(struct usb_serial *serial) ...@@ -433,6 +433,7 @@ static int pl2303_detect_type(struct usb_serial *serial)
switch (bcdDevice) { switch (bcdDevice) {
case 0x100: case 0x100:
case 0x305: case 0x305:
case 0x405:
/* /*
* Assume it's an HXN-type if the device doesn't * Assume it's an HXN-type if the device doesn't
* support the old read request value. * support the old read request value.
......
...@@ -1056,5 +1056,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR); ...@@ -1056,5 +1056,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC); MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
module_param(nmea, bool, S_IRUGO | S_IWUSR); module_param(nmea, bool, 0644);
MODULE_PARM_DESC(nmea, "NMEA streaming"); MODULE_PARM_DESC(nmea, "NMEA streaming");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment