From: Martyn Welch <martyn.welch@collabora.co.uk>
To: Johan Hovold <johan@kernel.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: Re: [PATCH v4] USB: serial: cp210x: Adding GPIO support for CP2105
Date: Thu, 24 Mar 2016 18:01:50 +0000 [thread overview]
Message-ID: <56F42B8E.2090404@collabora.co.uk> (raw)
In-Reply-To: <56AF52E0.2080507@collabora.co.uk>
On 01/02/16 12:43, Martyn Welch wrote:
> On 31/01/16 19:54, Johan Hovold wrote:
>> On Mon, Jan 18, 2016 at 02:14:37PM +0000, Martyn Welch wrote:
<snip>
>>> +
>>> + /* 2 banks of GPIO - One for the pins taken from each serial
>>> port */
>>> + if (port_priv->bInterfaceNumber == 0 && (buf[0] & 0xFF) != 0) {
>>
>> No need to AND a u8 with 0xff.
>>
>>> + port_priv->gc.label = "cp210x_eci";
>>> + port_priv->gc.ngpio = 2;
>>> + } else if (port_priv->bInterfaceNumber == 1 &&
>>> + (buf[1] & 0xFF) != 0) {
>>> + port_priv->gc.label = "cp210x_sci";
>>> + port_priv->gc.ngpio = 3;
>>> + } else {
>>> + result = 0;
>>> + goto err;
>>> + }
>>
>> So this is cp2105 specific. Also cp2102, cp2103 and cp2108 supports
>> gpios. You don't have to add support for all types at once, but at least
>> make sure whatever design decisions you make allows for easy extension
>> to these types.
>>
>
> The cp2105 is the only one of these devices that muxes GPIO with serial
> control signals. The cp2102, cp2103 and cp2108 provide both GPIO and
> serial control signals separately, so the logic to configure the GPIO
> for those devices will be much simpler. (Hence why I called this
> cp210x_shared_gpio_init, as I figured the best approach for supporting
> the other devices would be through a separate init routine).
>
>> What about the other configurations supported for these pins (e.g.
>> traffic indication, rs485, ...). Would you also end up with non-zero
>> values for those?
>>
>
> Will investigate.
>
Sorry for the long delay - I got diverted by other things.
I've now worked out how to both program a device for these alternate
modes (it's not clear in the data sheet and the configuration GUI
available for Linux at least doesn't seem to be able to configure
devices into these modes) and worked out how to check which GPIO are
being used by them.
The configuration allows one or both of the 2 ECI GPIO to be used and
one or both of the first 2 SCI GPIO to be used. i.e. I could have:
ECI:
- Both GPIO available.
- GPIO 0 available.
- GPIO 1 available.
SCI:
- All 3 GPIO available.
- GPIO 0 & 2 available.
- GPIO 1 & 2 available.
- GPIO 2 available.
Can anyone provide some advise on best to map this into the GPIO framework?
Martyn
prev parent reply other threads:[~2016-03-24 18:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-18 14:14 [PATCH v4] USB: serial: cp210x: Adding GPIO support for CP2105 Martyn Welch
2016-01-31 19:54 ` Johan Hovold
2016-02-01 12:43 ` Martyn Welch
2016-02-02 10:41 ` Karl Palsson
2016-02-02 10:45 ` Martyn Welch
[not found] ` <56AF52E0.2080507-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>
2016-02-28 12:26 ` Johan Hovold
2016-03-24 18:01 ` Martyn Welch [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56F42B8E.2090404@collabora.co.uk \
--to=martyn.welch@collabora.co.uk \
--cc=gnurou@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.