USB: serial: xr: add type abstraction
authorJohan Hovold <johan@kernel.org>
Mon, 12 Apr 2021 09:55:51 +0000 (11:55 +0200)
committerJohan Hovold <johan@kernel.org>
Tue, 13 Apr 2021 16:36:31 +0000 (18:36 +0200)
commitf865e614604cb6b5ea76462ad314c90a62b918c4
treec17013f95d3794741f96021f3a76c4d90cdc2971
parent958d6b958574a7b609982f1499bf3d792284ce7b
USB: serial: xr: add type abstraction

There are at least four types of Maxlinear/Exar USB UARTs which differ
in various ways such as in their register layouts:

XR21V141X
XR21B142X
XR21B1411
XR22804

It is not clear whether the device type can be inferred from the
descriptors so encode it in the device-id table for now.

Add a type structure that can be used to abstract the register layout
and other features, and use it when accessing the XR21V141X UART
registers that are shared by all types.

Note that the currently supported XR21V141X type is the only type that
has a set of UART Manager registers and that these will need to be
handled specifically.

Similarly, XR21V141X is the only type which has the divisor registers
and that needs to use the format register when configuring the line
settings.

Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/xr_serial.c