Subject: Re: [RFC] GPIO-based flow control in the cpm_uart driver

From: Anton Vorontsov <[email-masked]>
Date: Tue, 15 Apr 2008 18:30:37 +0400

On Tue, Apr 15, 2008 at 03:47:41PM +0200, Laurent Pinchart wrote:
> On Tuesday 15 April 2008 15:40, Anton Vorontsov wrote:
> > On Tue, Apr 15, 2008 at 03:22:33PM +0200, Laurent Pinchart wrote:
> > > Hi everybody,
> > > 
> > > I'm implementing flow control and modem control lines support in the
> > > cpm_uart driver.
> > > 
> > > The implementation is based on the GPIO lib. Modem control lines are
> > > described in the device tree as GPIO resources and accessed through the OF
> > > GPIO bindings. The I/O ports have to be initialized as GPIOs in the 
> > > platform-specific code.
> > > 
> > > Reading and writing the modem control lines isn't an issue, but activating 
> > > hardware flow control is more complex. The driver needs to turn dedicated 
> > > functions on and off for the RTS and CTS signals, and the GPIO API doesn't 
> > > provide a way to access the PPAR* registers (which does make sense -
> > > although arguably - as PPAR* control specific functions, not GPIOs).
> > > 
> > > Hardcoding RTS and CTS lines control in the driver is not an option I want
> > > to consider. Extending the GPIO API to handled special functions has been
> > > nacked in the past (see 
> > > http://ozlabs.org/pipermail/linuxppc-dev/2008-February/051241.html). An 
> > > option would be to export gpio_to_chip from drivers/gpio/gpiolib.c and use 
> > > cpm1/2_set_pin in the cpm_uart driver.
> > 
> > Since you have successfuly ported QE USB controller onto CPM USB
> > hardware, now it's obvious that we will need generic gpio_set_dedicated()
> > function. So I would rather beg David to accept gpio_set_dedicated()
> > approach instead of exporting gpio_to_chip(). That way we'll kill two
> > birds with one stone.
> 
> Or maybe some kind of gpio_set_option() with flags specific to the 
> controller ? This could be used to enable open-drain outputs or internal 
> pull-ups for instance.

Yes, probably this name. The purpose will be the same anyway. ;-)

-- 
Anton Vorontsov
email: [email-masked]
irc://irc.freenode.net/bd2