Commit graph

2934 commits

Author SHA1 Message Date
Stefan Triller 9585e340db USB: serial: cp210x: add support for Qivicon USB ZigBee dongle
The German Telekom offers a ZigBee USB Stick under the brand name Qivicon
for their SmartHome Home Base in its 1. Generation. The productId is not
known by the according kernel module, this patch adds support for it.

Signed-off-by: Stefan Triller <github@stefantriller.de>
Reviewed-by: Frans Klaver <fransklaver@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-07-17 12:40:56 +02:00
Joe Perches 4abf87f41a USB: serial: safe_serial: move __inline__ before return type
Make the code like the rest of the kernel.
Also use inline instead of __inline__.

Link: http://lkml.kernel.org/r/a5072b74b6c293e6ec93c4900482e9d3267f15b2.1499284835.git.joe@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-12 16:26:04 -07:00
Linus Torvalds 6481352082 USB fixes for 4.13-rc1
Here are some remaining USB fixes for 4.13-rc1.  They were originally
 scheduled for 4.12-final, but I didn't send them to you in time.
 Because of that, they were in a separate branch from the larger USB set
 of patches, so here they are in a separate pull request.
 
 Nothing major here a all, just 3 small patches:
 	- some usb-serial new device ids
 	- xhci bugfix for some crazy AMD hardware
 
 All of these have been in linux-next for a long time with no reported
 issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWV9FRg8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ylHxgCfTT31v4FaxH2k76qA1ZnHdXWHqyQAn3oyOE4T
 uJhpp1FbFR1VNXM/jRox
 =PCPm
 -----END PGP SIGNATURE-----

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

Pull USB fixes from Greg KH:
 "Here are some remaining USB fixes for 4.13-rc1. They were originally
  scheduled for 4.12-final, but I didn't send them to you in time.
  Because of that, they were in a separate branch from the larger USB
  set of patches, so here they are in a separate pull request.

  Nothing major here a all, just three small patches:

   - some usb-serial new device ids
   - xhci bugfix for some crazy AMD hardware

  All of these have been in linux-next for a long time with no reported
  issues"

* tag 'usb-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  xhci: Limit USB2 port wake support for AMD Promontory hosts
  USB: serial: qcserial: new Sierra Wireless EM7305 device ID
  USB: serial: option: add two Longcheer device ids
2017-07-07 13:42:04 -07:00
Linus Torvalds 9a715cd543 TTY/Serial patches for 4.13-rc1
Here is the large tty/serial patchset for 4.13-rc1.
 
 A lot of tty and serial driver updates are in here, along with some
 fixups for some __get/put_user usages that were reported.  Nothing huge,
 just lots of development by a number of different developers, full
 details in the shortlog.
 
 All of these have been in linux-next for a while.  There will be a merge
 issue with the arm-soc tree in the include/linux/platform_data/atmel.h
 file.  Stephen has sent out a fixup for it, so it shouldn't be that
 difficult to merge.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWVpZ9w8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ylkTgCfV2HhbxIph/aEL1nJmwW64oCXFrMAoK59ZH65
 tBZIosv0d91K1A+mObBT
 =adPL
 -----END PGP SIGNATURE-----

Merge tag 'tty-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty/serial updates from Greg KH:
 "Here is the large tty/serial patchset for 4.13-rc1.

  A lot of tty and serial driver updates are in here, along with some
  fixups for some __get/put_user usages that were reported. Nothing
  huge, just lots of development by a number of different developers,
  full details in the shortlog.

  All of these have been in linux-next for a while"

* tag 'tty-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (71 commits)
  tty: serial: lpuart: add a more accurate baud rate calculation method
  tty: serial: lpuart: add earlycon support for imx7ulp
  tty: serial: lpuart: add imx7ulp support
  dt-bindings: serial: fsl-lpuart: add i.MX7ULP support
  tty: serial: lpuart: add little endian 32 bit register support
  tty: serial: lpuart: refactor lpuart32_{read|write} prototype
  tty: serial: lpuart: introduce lpuart_soc_data to represent SoC property
  serial: imx-serial - move DMA buffer configuration to DT
  serial: imx: Enable RTSD only when needed
  serial: imx: Remove unused members from imx_port struct
  serial: 8250: 8250_omap: Fix race b/w dma completion and RX timeout
  serial: 8250: Fix THRE flag usage for CAP_MINI
  tty/serial: meson_uart: update to stable bindings
  dt-bindings: serial: Add bindings for the Amlogic Meson UARTs
  serial: Delete dead code for CIR serial ports
  serial: sirf: make of_device_ids const
  serial/mpsc: switch to dma_alloc_attrs
  tty: serial: Add Actions Semi Owl UART earlycon
  dt-bindings: serial: Document Actions Semi Owl UARTs
  tty/serial: atmel: make the driver DT only
  ...
2017-07-03 20:04:16 -07:00
Jeremie Rapin fd90f73a99 USB: serial: cp210x: add ID for CEL EM3588 USB ZigBee stick
Added the USB serial device ID for the CEL ZigBee EM3588
radio stick.

Signed-off-by: Jeremie Rapin <rapinj@gmail.com>
Cc: stable <stable@vger.kernel.org>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-28 20:14:00 +02:00
Johan Hovold c22ac6d29f USB: serial: propagate late probe errors
Propagate errnos for late probe errors (e.g. -ENOMEM on allocation
failures) instead of always returning -EIO.

Note that some drivers are currently returning -ENODEV from their attach
callbacks when a device is not supported, but this has also been mapped
to -EIO.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-06-21 09:40:07 +02:00
Johan Hovold 45e5d4d418 USB: serial: refactor port endpoint setup
Make the probe callback more readable by refactoring the port
endpoint-resource setup by adding four helper functions.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-06-21 09:38:58 +02:00
Bjørn Mork 996fab55d8 USB: serial: qcserial: new Sierra Wireless EM7305 device ID
A new Sierra Wireless EM7305 device ID used in a Toshiba laptop.

Reported-by: Petr Kloc <petr_kloc@yahoo.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-06-14 09:27:57 +02:00
Johan Hovold 8fb060da71 USB: serial: option: add two Longcheer device ids
Add two Longcheer device-id entries which specifically enables a
Telewell TW-3G HSPA+ branded modem (0x9801).

Reported-by: Teemu Likonen <tlikonen@iki.fi>
Reported-by: Bjørn Mork <bjorn@mork.no>
Reported-by: Lars Melin <larsm17@gmail.com>
Tested-by: Teemu Likonen <tlikonen@iki.fi>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-06-14 09:23:57 +02:00
Johan Hovold 83c9a2d1a6 USB: serial: ftdi_sio: remove broken alt-speed handling
Remove the broken alt_speed code, and warn when trying to set the line
speed using TIOCSSERIAL and SPD flags.

The use of SPD flags to set the line speed has been deprecated since
v2.1.69 and support for alt_speed (e.g. "warp") has even been removed
from TTY core in v3.10 by commit 6865ff222c ("TTY: do not warn about
setting speed via SPD_*"), effectively breaking all driver
implementations of this except for serial core.

Also remove the verbose and outdated comment on how to set baud rates.

Note that setting a custom divisor will continue to work with the
caveat that 38400 must again be selected every time the divisor is
changed since v2.6.24 and commit 669a6db103 ("USB: ftd_sio: cleanups
and updates for new termios work") which started reporting back the
actual baud rate used.

Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13 11:49:58 +02:00
Johan Hovold f3e8ae657e USB: serial: ftdi_sio: simplify TIOCSSERIAL flag logic
Simplify TIOCSSERIAL flag logic somewhat.

Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13 11:49:58 +02:00
Magnus Lynch 08f741a933 USB: serial: qcserial: expose methods for modem control
The qcserial driver fails to expose the .tiocmget and .tiocmset methods
available from usb_wwan. These methods are required by ioctl commands
dealing with the modem control signals DTR, RTS, etc.

With these methods not set ioctl calls intended to control the DTR state
will fail. For example, pppd drops and raises DTR in preparation to
dialing the modem, which handles the case of the modem already being
connected by making it hang up and return to command mode. DTR control
being unavailable will lead to a protracted failure to connect as the
modem will be stuck in a state not responsive to command.

I have tested that with this patch the described case is handled
successfully. There is an analogous method for .ioctl available from
usb_wwan (as used in option.c) but I conservatively omitted that for
lack of familiarity.

Signed-off-by: Magnus Lynch <maglyx@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-06-13 09:06:25 +02:00
Maksim Salau 4cd4475eff USB: serial: upd78f0730: make constants static
Some local constants don't change from call to call and are good
candidates to become static. This will prevent copying of these
constants to stack during runtime.

Signed-off-by: Maksim Salau <maksim.salau@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-06-01 11:07:50 +02:00
Bjørn Mork 8d7a10dd32 USB: serial: qcserial: add more Lenovo EM74xx device IDs
In their infinite wisdom, and never ending quest for end user frustration,
Lenovo has decided to use new USB device IDs for the wwan modules in
their 2017 laptops.  The actual hardware is still the Sierra Wireless
EM7455 or EM7430, depending on region.

Cc: <stable@vger.kernel.org>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-05-17 17:10:57 +02:00
Andrey Korolyov 5f63424ab7 USB: serial: ftdi_sio: add Olimex ARM-USB-TINY(H) PIDs
This patch adds support for recognition of ARM-USB-TINY(H) devices which
are almost identical to ARM-USB-OCD(H) but lacking separate barrel jack
and serial console.

By suggestion from Johan Hovold it is possible to replace
ftdi_jtag_quirk with a bit more generic construction. Since all
Olimex-ARM debuggers has exactly two ports, we could safely always use
only second port within the debugger family.

Signed-off-by: Andrey Korolyov <andrey@xdel.ru>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-05-17 10:31:20 +02:00
Johan Hovold 6aeb75e6ad USB: serial: io_ti: fix div-by-zero in set_termios
Fix a division-by-zero in set_termios when debugging is enabled and a
high-enough speed has been requested so that the divisor value becomes
zero.

Instead of just fixing the offending debug statement, cap the baud rate
at the base as a zero divisor value also appears to crash the firmware.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>     # 2.6.12
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-05-15 11:52:04 +02:00
Johan Hovold 26cede3436 USB: serial: mct_u232: fix big-endian baud-rate handling
Drop erroneous cpu_to_le32 when setting the baud rate, something which
corrupted the divisor on big-endian hosts.

Found using sparse:

	warning: incorrect type in argument 1 (different base types)
	    expected unsigned int [unsigned] [usertype] val
	    got restricted __le32 [usertype] <noident>

Fixes: af2ac1a091 ("USB: serial mct_usb232: move DMA buffers to heap")
Cc: stable <stable@vger.kernel.org>     # 2.6.34
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-By: Pete Zaitcev <zaitcev@yahoo.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-05-15 11:51:15 +02:00
Johan Hovold ad0ccac76d USB: serial: ir-usb: fix big-endian baud-rate debug printk
Add missing endianness conversion when printing the supported baud
rates.

Found using sparse:

	warning: restricted __le16 degrades to integer

Fixes: e0d795e4f3 ("usb: irda: cleanup on ir-usb module")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-05-15 11:50:34 +02:00
Anthony Mallet bb246681b3 USB: serial: ftdi_sio: fix setting latency for unprivileged users
Commit 557aaa7ffa ("ft232: support the ASYNC_LOW_LATENCY
flag") enables unprivileged users to set the FTDI latency timer,
but there was a logic flaw that skipped sending the corresponding
USB control message to the device.

Specifically, the device latency timer would not be updated until next
open, something which was later also inadvertently broken by commit
c19db4c9e4 ("USB: ftdi_sio: set device latency timeout at port
probe").

A recent commit c6dce26266 ("USB: serial: ftdi_sio: fix extreme
low-latency setting") disabled the low-latency mode by default so we now
need this fix to allow unprivileged users to again enable it.

Signed-off-by: Anthony Mallet <anthony.mallet@laas.fr>
[johan: amend commit message]
Fixes: 557aaa7ffa ("ft232: support the ASYNC_LOW_LATENCY flag")
Fixes: c19db4c9e4 ("USB: ftdi_sio: set device latency timeout at port probe").
Cc: stable <stable@vger.kernel.org>     # 2.6.31
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-05-15 10:20:25 +02:00
Daniele Palmas 40dd46048c usb: serial: option: add Telit ME910 support
This patch adds support for Telit ME910 PID 0x1100.

Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-05-15 10:02:26 +02:00
Linus Torvalds 8f28472a73 USB patches for 4.12-rc1
Here is the big USB patchset for 4.12-rc1.
 
 Lots of good stuff here, after many many many attempts, the kernel
 finally has a working typeC interface, many thanks to the Heikki and
 Guenter and others who have taken the time to get this merged.  It
 wasn't an easy path for them at all.
 
 There's also a staging driver that uses this new api, which is why it's
 coming in through this tree.
 
 Along with that, there's the usual huge number of changes for gadget
 drivers, xhci, and other stuff.  Johan also finally refactored pretty
 much every driver that was looking at USB endpoints to do it in a common
 way, which will help prevent any "badly-formed" devices from causing
 problems in drivers.  That too wasn't a simple task.
 
 All of these have been in linux-next for a while with no reported
 issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWQvEIQ8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+yny4gCePCXxnrQdMWE+IMXf1H1hMubLkVkAn0ZWgQkq
 BspgO7ZmGb+9Fpf6YvNz
 =nwAu
 -----END PGP SIGNATURE-----

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

Pull USB updates from Greg KH:
 "Here is the big USB patchset for 4.12-rc1.

  Lots of good stuff here, after many many many attempts, the kernel
  finally has a working typeC interface, many thanks to Heikki and
  Guenter and others who have taken the time to get this merged. It
  wasn't an easy path for them at all.

  There's also a staging driver that uses this new api, which is why
  it's coming in through this tree.

  Along with that, there's the usual huge number of changes for gadget
  drivers, xhci, and other stuff. Johan also finally refactored pretty
  much every driver that was looking at USB endpoints to do it in a
  common way, which will help prevent any "badly-formed" devices from
  causing problems in drivers. That too wasn't a simple task.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'usb-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (263 commits)
  staging: typec: Fairchild FUSB302 Type-c chip driver
  staging: typec: Type-C Port Controller Interface driver (tcpci)
  staging: typec: USB Type-C Port Manager (tcpm)
  usb: host: xhci: remove #ifdef around PM functions
  usb: musb: don't mark of_dev_auxdata as initdata
  usb: misc: legousbtower: Fix buffers on stack
  USB: Revert "cdc-wdm: fix "out-of-sync" due to missing notifications"
  usb: Make sure usb/phy/of gets built-in
  USB: storage: e-mail update in drivers/usb/storage/unusual_devs.h
  usb: host: xhci: print correct command ring address
  usb: host: xhci: delete sp_dma_buffers for scratchpad
  usb: host: xhci: using correct specification chapter reference for DCBAAP
  xhci: switch to pci_alloc_irq_vectors
  usb: host: xhci-plat: set resume_quirk() for R-Car controllers
  usb: host: xhci-plat: add resume_quirk()
  usb: host: xhci-plat: enable clk in resume timing
  usb: host: plat: Enable xHCI plat runtime PM
  USB: serial: ftdi_sio: add device ID for Microsemi/Arrow SF2PLUS Dev Kit
  USB: serial: constify static arrays
  usb: fix some references for /proc/bus/usb
  ...
2017-05-04 18:03:51 -07:00
Linus Torvalds 7d6a31c394 Merge branch 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 debug updates from Ingo Molnar:
 "The biggest update is the addition of USB3 debug port based
  early-console.

  Greg was fine with the USB changes and with the routing of these
  patches:

    https://www.spinics.net/lists/linux-usb/msg155093.html"

* 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  usb/doc: Add document for USB3 debug port usage
  usb/serial: Add DBC debug device support to usb_debug
  x86/earlyprintk: Add support for earlyprintk via USB3 debug port
  usb/early: Add driver for xhci debug capability
  x86/timers: Add simple udelay calibration
2017-05-01 23:00:21 -07:00
Greg Kroah-Hartman 8ebe0e20bf USB-serial updates for v4.12-rc1
Here are the USB-serial updates for 4.12, including:
 
  - support for devices with up to 16 ports (e.g. some Moxa devices)
 
  - support for endpoint sanity checks in core, which allows for code sharing
    and avoids allocating resources for rejected interfaces
 
  - support for endpoint-port remapping, which allows some driver hacks to
    be removed as well as omninet to use the generic write implementation
 
  - removal of an obsolete tty open-race workaround which prevented a
    port from being opened immediately after having been registered
 
  - generic-driver support for interfaces with just a bulk-in endpoint
 
  - improved ftdi_sio event-char and latency-timer handling
 
  - improved ftdi_sio support for some broken BM chips
 
 Included are also various clean ups and a new ftdi_sio device id.
 
 All have been in linux-next with no reported issues.
 
 Signed-off-by: Johan Hovold <johan@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEHszNKQClByu0A+9RQQ3kT97htJUFAlj4xWkRHGpvaGFuQGtl
 cm5lbC5vcmcACgkQQQ3kT97htJX65A/+PHZaJ3roe7ue+T7NoxBd1MzrvwUiVHR7
 jtBbL5Jd/Glq5symeOM6oAnCmHszaS2Ch8YShdD5bEhT3339zNDo7X31cj07RUqS
 gw0UuEhDlvmYPAygm0omDPsHAJ9IDfYvvJ2GZk7lkHMhDbFL9j4S5ZJLqP1YFESs
 7/FT0AadaLT/lXRqW+y38SeGJJ/1tDhhyMFX8vAiD9jBWw6jCmvEGKcT8gQGFfhC
 iH7ZW/KrAzDCLRLv7g/ZdcB5FeShC++w9cDcKjq//EFZeiFujXtZMmD0EZOiavwf
 BW9hwSXZXZcDm5lLWH4QYMD/kX/wrgE6HPBnAqPe1jltq1O5ngspvfJtrvXsEJtI
 uA3MDw72EHbEVpRS5/IJVQoqjQuQuqTCZW0Ru+BNsS7duLNophcFqxZ5VVXS2LPm
 g9wS0z3PeNfKoPfqoEXCUqpHELpefAWMqDVXb6/Udf+Gv1jfcwDnKttMGGliqWMr
 cEA3Jdkq1P0kXgydA1Heb+0yHWwgiII57t0zBrNfQ5RSwGgxB9Tnj+ogljrh4l2U
 jrcyMJAWxOUFyTr+2z8RqgeuuCl5yzeTvWX3Qn3CdM/AcsjjmDqpEFW8TlTM9JBM
 kMp6QnVoyNsNtn8aXzPc2YkwWGWPGX9oclvhgsMyMSege4XnKaqejfKMl7d0XEk0
 NSD25i74wQc=
 =cSzy
 -----END PGP SIGNATURE-----

Merge tag 'usb-serial-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-next

Johan writes:

USB-serial updates for v4.12-rc1

Here are the USB-serial updates for 4.12, including:

 - support for devices with up to 16 ports (e.g. some Moxa devices)

 - support for endpoint sanity checks in core, which allows for code sharing
   and avoids allocating resources for rejected interfaces

 - support for endpoint-port remapping, which allows some driver hacks to
   be removed as well as omninet to use the generic write implementation

 - removal of an obsolete tty open-race workaround which prevented a
   port from being opened immediately after having been registered

 - generic-driver support for interfaces with just a bulk-in endpoint

 - improved ftdi_sio event-char and latency-timer handling

 - improved ftdi_sio support for some broken BM chips

Included are also various clean ups and a new ftdi_sio device id.

All have been in linux-next with no reported issues.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-04-20 17:22:51 +02:00
Marek Vasut 31c5d1922b USB: serial: ftdi_sio: add device ID for Microsemi/Arrow SF2PLUS Dev Kit
This development kit has an FT4232 on it with a custom USB VID/PID.
The FT4232 provides four UARTs, but only two are used. The UART 0
is used by the FlashPro5 programmer and UART 2 is connected to the
SmartFusion2 CortexM3 SoC UART port.

Note that the USB VID is registered to Actel according to Linux USB
VID database, but that was acquired by Microsemi.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-04-19 09:58:50 +02:00
Johan Hovold 4f37fa549d USB: serial: constify static arrays
Declare three immutable static driver arrays as const.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-04-19 09:45:43 +02:00
Johan Hovold 185fcb3fbe USB: serial: quatech2: drop redundant tty_buffer_request_room
Drop redundant calls to tty_buffer_request_room and use the more
efficient tty_insert_flip_char when inserting single characters.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-04-10 09:42:00 +02:00
Johan Hovold 7aac5e7d20 USB: serial: iuu_phoenix: drop excessive sanity checks
The transfer buffers and URBs are allocated and initialised by USB
serial core during probe, and there's no need to check for NULL transfer
buffers in the bulk-in completion handlers.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-04-10 09:42:00 +02:00
Johan Hovold e1fdd5b262 USB: serial: drop obsolete open-race workaround
Commit a65a6f14dc ("USB: serial: fix race between probe and open")
fixed a race between probe and open, which could lead to crashes when a
not yet fully initialised port was being opened.

This race was later incidentally closed by commit 7e73eca6a7 ("TTY:
move cdev_add to tty_register_device") which moved character-device
registration from tty_register_driver to tty_register_device, which
isn't called until the port has been fully set up.

Remove the now redundant workaround which had the negative side effect
of not allowing a port to be opened immediately after user space had
been notified of a new tty device.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-31 13:14:39 +02:00
Johan Hovold bc242fc107 USB: serial: drop termios-flag debugging
Drop some unnecessary termios-flag debugging that have been faithfully
reproduced in a few old drivers, including the "clfag" typo and all.

This also addresses a compiler warning on sparc where tcflag_t is
unsigned long and would have required an explicit cast.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-29 16:14:35 +02:00
Johan Hovold d5ccfce092 USB: serial: f81534: clean up port bulk-out setup
Setup each port to use the first bulk-out endpoint in calc_num_ports so
that core allocates the corresponding port resources for us.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:14:13 +02:00
Johan Hovold 5e07240a12 USB: serial: f81534: clean up calc_num_ports
Clean up calc_num_ports with respect to handling older chips that lack
config data.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:14:13 +02:00
Johan Hovold d69f138747 USB: serial: mxuport: clean up port bulk-out setup
Setup each port to use the first bulk-out endpoint in calc_num_ports so
that core allocates the corresponding port resources for us.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:14:13 +02:00
Johan Hovold 6b0464c9d7 USB: serial: mxuport: add endpoint sanity check
Add an explicit sanity check to make sure we have the expected
endpoints. This will provide a descriptive error message in case an
expected endpoint is missing when probing.

Note that the driver already gracefully fails to probe (albeit with a
less descriptive error message) if a bulk-in endpoint is missing, and an
attempt to write to a port whose device lack a bulk-out endpoint would
fail with -ENODEV.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:14:12 +02:00
Johan Hovold bc4c2c15cb USB: serial: mxuport: register two ports for unknown devices
Print a message and register two ports for interfaces for which we do
not know how many ports there are instead of binding, allocating
resources, but not register any ports.

This provides a hint that anyone adding a dynamic device id must also
provide a reference id (driver info) from which the port count can be
retrieved, for example:

	echo <vid> <pid> 0 0x110A 0x1410 > new_id

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:14:12 +02:00
Johan Hovold ea3c6ebdcb USB: serial: visor: clean up treo endpoint hack
Use the new endpoint-remap functionality to configure the ports for
treo devices instead of poking around in the port structures after the
ports have been setup.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:14:11 +02:00
Johan Hovold da2befa6d5 USB: serial: visor: clean up clie_5 endpoint hack
Use the new endpoint-remap functionality to configure the ports for
clie_5 devices.

Note that the same bulk-out endpoint is being used for both ports.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:14:11 +02:00
Johan Hovold a5b669f4c6 USB: serial: visor: drop redundant calc_num_ports callback
Drop the redundant calc_num_ports callback from the clie_5 type, for
which the callback always returns zero and hence falls back to the type
num_ports value (2).

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:14:11 +02:00
Johan Hovold c0dcf242d2 USB: serial: ti_usb_3410_5052: always require a bulk-out endpoint
These devices always require at least one bulk-out endpoint so let core
verify that.

This avoids attempting to send bulk data to the default pipe when
downloading firmware in boot mode.

Note that further endpoints are still needed when not in boot mode.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:14:10 +02:00
Johan Hovold d27444152c USB: serial: omninet: use generic write implementation
Now that the endpoint-port mapping has been properly set up during
probe, we can switch to using the more efficient generic write
implementation.

Note that this currently means that chars_in_buffer now overcounts
slightly as we always write a full endpoint-sized packet.

Also add a copyright entry.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:13:55 +02:00
Johan Hovold 2dc1071b34 USB: serial: omninet: clean up port setup
These devices use the second bulk-out endpoint for writing. Instead of
using the resources of the second port structure setup by core, use the
new endpoint-remap functionality to simply ignore the first bulk-out
endpoint. This specifically avoids allocating resources for the unused
endpoint.

Note that the disconnect callback was always redundant as all URBs would
have been killed by USB core on disconnect.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:00:12 +02:00
Johan Hovold 9525402023 USB: serial: mos7840: clean up endpoint sanity check
Clean up the endpoint sanity check by letting core verify the single
interrupt endpoint, and verifying the bulk endpoints in calc_num_ports
after having determined the number of ports.

Note that the static type num_ports field was neither correct or used
(since calc_num_ports never returns zero).

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:00:12 +02:00
Johan Hovold 6a1eaf19f5 USB: serial: mos7720: always require an interrupt endpoint
This driver have treated the interrupt endpoint as optional despite it
always being present (according to the datasheet). Let's consider it
mandatory instead.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:00:12 +02:00
Johan Hovold d760557d38 USB: serial: mos7720: clean up mcs7715 port setup
Clean up the mcs7715 port setup by using the new endpoint-remap
functionality provided by core. Instead of poking around in internal
port-structure fields, simply swap the endpoint descriptors of the two
ports in calc_num_ports before the port structures are even allocated.

Note that we still need to override the default interrupt completion
handler.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:00:11 +02:00
Johan Hovold 772b2c5d6c USB: serial: io_ti: drop redundant read-urb check
Drop the redundant read-urb check from open. The presence of a bulk-in
endpoint is now verified during probe and core has allocated the
corresponding resources.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:00:11 +02:00
Johan Hovold 9c8299b43e USB: serial: io_ti: verify interrupt endpoint at probe
Verify that the required interrupt endpoint is present at probe rather
than at open to avoid allocating resources for an unusable device.

Note that the endpoint is only required when in download mode.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:00:11 +02:00
Johan Hovold 8d9c4d9ebf USB: serial: io_ti: always require a bulk-out endpoint
These devices always require at least one bulk-out endpoint so let core
verify that.

This avoids attempting to send bulk data to the default pipe when
downloading firmware in boot mode.

Note that further endpoints are still needed when not in boot mode.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:00:10 +02:00
Johan Hovold 49f4ff2d74 USB: serial: io_ti: use calc_num_endpoints to verify endpoints
Use the calc_num_ports rather than attach callback to verify that the
required endpoints are present when in download mode.

This avoids allocating port resources for interfaces that won't be bound.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:00:10 +02:00
Johan Hovold 204cc473bc USB: serial: ipaq: always register a single port
Use the calc_num_ports callback to ignore unused endpoints.

The driver binds to any interface with at least one bulk-in and one
bulk-out endpoint, but some devices can have three or more endpoints of
which only either the first or second pair of endpoints is needed.

This avoids allocating resources for unused endpoints, and specifically
a port is no longer registered for the unused first endpoint pair when
there are more than three endpoints.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:00:09 +02:00
Johan Hovold 03b72aecad USB: serial: ipaq: use calc_num_endpoints to verify endpoints
Use the calc_num_ports rather than attach callback to determine which
interface to bind to in order to avoid allocating port-resources for
interfaces that won't be bound.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:00:09 +02:00
Johan Hovold 2f16621b9a USB: serial: f81534: abort probe on early errors
We can now abort probe early after an error in calc_num_ports by
returning an errno instead of attempting to continue probing but not
register any ports.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:00:08 +02:00