summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2019-01-24 13:48:39 +0000
committerJohan Hovold <johan@kernel.org>2019-01-25 10:35:04 +0100
commita49e1abf07701600ad5ef990e56d676cbab91bf5 (patch)
tree7d32e6637dbb62ae82a9b1afd02cd47e762f71f5 /drivers/usb
parent49a57857aeea06ca831043acbb0fa5e0f50602fd (diff)
downloadlinux-stable-a49e1abf07701600ad5ef990e56d676cbab91bf5.tar.gz
linux-stable-a49e1abf07701600ad5ef990e56d676cbab91bf5.tar.bz2
linux-stable-a49e1abf07701600ad5ef990e56d676cbab91bf5.zip
USB: serial: cp210x: support all gpios on CP2102N QFN28 package
The QFN28 package version of the CP2102N has three additional gpio pins. Add support for these. Signed-off-by: Mans Rullgard <mans@mansr.com> Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/serial/cp210x.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index c0777a374a88..336a3c0f9f2c 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -1574,12 +1574,6 @@ static int cp2102n_gpioconf_init(struct usb_serial *serial)
if (config_version != 0x01)
return -ENOTSUPP;
- /*
- * We only support 4 GPIOs even on the QFN28 package, because
- * config locations of GPIOs 4-6 determined using reverse
- * engineering revealed conflicting offsets with other
- * documented functions. So we'll just play it safe for now.
- */
priv->gc.ngpio = 4;
/*
@@ -1594,6 +1588,19 @@ static int cp2102n_gpioconf_init(struct usb_serial *serial)
/* 0 indicates GPIO mode, 1 is alternate function */
priv->gpio_altfunc = (gpio_ctrl >> 2) & 0x0f;
+ if (priv->partnum == CP210X_PARTNUM_CP2102N_QFN28) {
+ /*
+ * For the QFN28 package, GPIO4-6 are controlled by
+ * the low three bits of the mode/latch fields.
+ * Contrary to the document linked above, the bits for
+ * the SUSPEND pins are elsewhere. No alternate
+ * function is available for these pins.
+ */
+ priv->gc.ngpio = 7;
+ gpio_latch |= (gpio_rst_latch & 7) << 4;
+ priv->gpio_pushpull |= (gpio_pushpull & 7) << 4;
+ }
+
/*
* The CP2102N does not strictly has input and output pin modes,
* it only knows open-drain and push-pull modes which is set at