From: Johan Hovold <johan@kernel.org>
To: Stefan Agner <stefan@agner.ch>
Cc: Johan Hovold <johan@kernel.org>,
linus.walleij@linaro.org, gnurou@gmail.com,
grant.likely@secretlab.ca, gregkh@linuxfoundation.org,
x-linux@infra-silbe.de, hachti@hachti.de,
linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org, Johan Hovold <jhovold@gmail.com>
Subject: Re: [PATCH 0/2] FTDI CBUS GPIO support
Date: Wed, 24 Jun 2015 09:56:48 +0200 [thread overview]
Message-ID: <20150624075648.GD4976@localhost> (raw)
In-Reply-To: <77568c206b51c50da927d69ea6b15957@agner.ch>
On Wed, Jun 24, 2015 at 12:08:50AM +0200, Stefan Agner wrote:
> On 2015-06-23 11:22, Johan Hovold wrote:
> > On Mon, Jun 22, 2015 at 10:11:35PM +0200, Stefan Agner wrote:
> >> On 2015-06-22 19:26, Johan Hovold wrote:
> >
> >> > Instead, hang the gpio chip directly off the usb interface (not the
> >> > port), add a new config option, and keep the gpio implementation under
> >> > drivers/usb/serial (possibly in its own file ftdi_sio-gpio.c).
> >>
> >> Agreed sounds like a good plan. Will try this approach in v2.
> >>
> >> Except I don't think hanging it directly to the USB interface is the
> >> right thing to do.
> >>
> >> Looking at the block diagram of FT232R or FT232H, the CBUS pins seem to
> >> be part of the UART/FIFO controller. And I think the dual UART FT2232D
> >> actually supports controlling the CBUS pins of the two UART controllers
> >> individually, at least the block diagram thereof suggests so.
> >
> > The port is a Linux abstraction, and for FTDI we happen to have exactly
> > one port child device per USB interface. As I see it, the gpio
> > controller for the CBUS pins should be a sibling rather than a child
> > device to the port.
> >
> > Note that we'd still have two gpio-controllers on FT2232D (one per USB
> > interface).
>
> I did some research. I think the FT2232D or FT2232H devices do not
> support the CBUS Bit Bang mode. For instance the D2XX Programmer's Guide
> indicates that on page 69 (CBUS Bit Bang Mode (FT232R and FT232H devices
> only)) as well as the AN_184 "FTDI Device Input Output Pin States", does
> not mention that the CBUS pins as EEPROM selectable (the same document
> does so for FT232R/FT232H devices)...
>
> I don't have such a device, hence I can't try it out...
Just make sure to only register the gpio chip for device types that
support it (and devices that are configured for it...).
> > I'm aware that this requires some restructuring of the ftdi_sio-driver
> > (e.g. the device type and ftdi-interface number should be a feature of
> > the usb-serial rather than usb-serial-port device).
>
> The findings above probably do not change the fact that we should not
> use the Linux port abstraction to attach the GPIO controller...
>
> I looked into that a bit more in depth. Do I see things right that the
> multi-port devices have multiple USB interfaces, which leads to
> usb_serial_probe and in turn ftdi_sio_probe getting called multiple
> times by the USB stack? If yes, I think I have the bigger picture to go
> ahead and try to implement it accordingly.
Yes, that is correct.
Johan
next prev parent reply other threads:[~2015-06-24 7:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-20 22:12 [PATCH 0/2] FTDI CBUS GPIO support Stefan Agner
2015-06-20 22:12 ` [PATCH 1/2] USB: ftdi_sio: add CBUS mode for FT232R devices Stefan Agner
2015-06-30 6:46 ` Linus Walleij
2015-06-30 6:54 ` Johan Hovold
2015-06-20 22:12 ` [PATCH 2/2] gpio: gpio-ftdi-cbus: add driver for FTDI CBUS GPIOs Stefan Agner
2015-07-15 7:42 ` Linus Walleij
[not found] ` <1434838377-8042-1-git-send-email-stefan-XLVq0VzYD2Y@public.gmane.org>
2015-06-20 23:49 ` [PATCH 0/2] FTDI CBUS GPIO support Peter Stuge
[not found] ` <20150620234957.25729.qmail-Y+HMSxxDrH8@public.gmane.org>
2015-06-21 19:44 ` Stefan Agner
[not found] ` <a35f48994dedc061b54ca9ea255fdd4e-XLVq0VzYD2Y@public.gmane.org>
2015-08-23 8:52 ` Grant Likely
2015-06-22 17:26 ` Johan Hovold
2015-06-22 20:11 ` Stefan Agner
2015-06-23 9:22 ` Johan Hovold
2015-06-23 22:08 ` Stefan Agner
2015-06-24 7:56 ` Johan Hovold [this message]
2015-06-21 2:22 ` Philipp Hachtmann
[not found] ` <55861FFC.30704-c1YPqJpaggmzQB+pC5nmwQ@public.gmane.org>
2015-06-21 19:39 ` Stefan Agner
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=20150624075648.GD4976@localhost \
--to=johan@kernel.org \
--cc=gnurou@gmail.com \
--cc=grant.likely@secretlab.ca \
--cc=gregkh@linuxfoundation.org \
--cc=hachti@hachti.de \
--cc=jhovold@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stefan@agner.ch \
--cc=x-linux@infra-silbe.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).