Commit Graph

7 Commits

Author SHA1 Message Date
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 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
Johan Hovold cac4cea513 USB: serial: f81534: use calc_num_endpoints to verify endpoints
Simplify the endpoint sanity check by letting core verify that the
required endpoints are present and moving the max-packet check to
calc_num_ports.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 11:00:08 +02:00
Johan Hovold 07814246dd USB: serial: allow subdrivers to modify port-endpoint mapping
Allow subdrivers to modify the port-endpoint mapping by passing the
endpoint descriptors to calc_num_ports.

The callback can now also be used to verify that the required endpoints
exists and abort probing otherwise.

This will allow us to get rid of a few hacks in subdrivers that are
already modifying the port-endpoint mapping (or aborting probe due to
missing endpoints), but only after the port structures have been setup.

Signed-off-by: Johan Hovold <johan@kernel.org>
2017-03-28 10:54:39 +02:00
Geert Uytterhoeven 4271576316 USB: serial: f81534: detect errors from f81534_logic_to_phy_port()
With gcc 4.1.2:

    drivers/usb/serial/f81534.c: In function ‘f81534_port_probe’:
    drivers/usb/serial/f81534.c:1250: warning: comparison is always false due to limited range of data type

f81534_logic_to_phy_port() may return a negative error value, which is
ignored by assigning it to u8 f81534_port_private.phy_num.

Use an intermediate variable of type int to fix this.
While at it, forward the actual error code instead of converting it to
-ENODEV, and drop the useless check for F81534_NUM_PORT, as the callee
always returns a valid port number in case of success.

Fixes: 0c9bd6004d ("USB: serial: add Fintek F81532/534 driver")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2017-01-02 10:31:08 +01:00
Ji-Ze Hong (Peter Hong) 0c9bd6004d USB: serial: add Fintek F81532/534 driver
This driver is for Fintek F81532/F81534 USB to Serial Ports IC.

F81532 spec:
https://drive.google.com/file/d/0B8vRwwYO7aMFOTRRMmhWQVNvajQ/view?usp=
sharing

F81534 spec:
https://drive.google.com/file/d/0B8vRwwYO7aMFV29pQWJqbVBNc00/view?usp=
sharing

Features:
1. F81532 is 1-to-2 & F81534 is 1-to-4 serial ports IC
2. Support Baudrate from B50 to B115200.

Signed-off-by: Ji-Ze Hong (Peter Hong) <hpeter+linux_kernel@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-11-29 11:13:16 +01:00