Re: [RFC 0/2] sandbox: add gpio support with libftdi1

2017-02-16 Thread Ian Abbott

On 16/02/17 07:34, Sascha Hauer wrote:

Hi Antony,

On Wed, Feb 15, 2017 at 10:12:25AM +0300, Antony Pavlov wrote:

This patch series makes it possible to use FT2232H ACBUS[7:0]
pins as gpio pins from sandbox barebox.

I have tested output gpio functionality by connecting
a LED to ACBUS[0] and lightening it with gpio_direction_output
and gpio_set_value barebox commands.

Also I have performed input test with ACBUS[0] -> ACBUS[1] loopback.

The main goal of adding gpio functionality to sandbox barebox
is using it for connecting real i2c and spi devices to sandbox barebox
(not tested yet).


I just read that the FT2232H can even do native I2C and SPI, so no gpio
bitbanging would be necessary. Would it be possible to use this mode
instead?

Otherwise I think there should be a possibility to specify which, if
any, FT2232H chip barebox uses.


The MPSSE mode of the FT2232H can sort of do native I2C, but not in a 
strictly conforming way.  The I2C SDA needs to be connected to two pins 
on the FT2232H, one for output and one for input, and there is a 
"Drive-Only-Zero" option for the output to ensure it is only driven low, 
and tri-stated high.  However, the I2C SCL is only connected to an 
output pin on the FT2232H, and is always driven in both directions. 
Therefore, it does not support "clock-stretching" by I2C slaves (where a 
slave pulls the SCL line low until it is ready), because it cannot read 
back the state of the SCL line.  Worse, if an I2C slave is doing 
clock-stretching by driving SCL low, this will contend with the FT2232H 
driving SCL high at the same time.


--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [RFC 0/2] sandbox: add gpio support with libftdi1

2017-02-16 Thread Sascha Hauer
On Thu, Feb 16, 2017 at 11:28:35AM +0300, Antony Pavlov wrote:
> On Thu, 16 Feb 2017 08:34:30 +0100
> Sascha Hauer  wrote:
> 
> > Hi Antony,
> > 
> > On Wed, Feb 15, 2017 at 10:12:25AM +0300, Antony Pavlov wrote:
> > > This patch series makes it possible to use FT2232H ACBUS[7:0]
> > > pins as gpio pins from sandbox barebox.
> > > 
> > > I have tested output gpio functionality by connecting
> > > a LED to ACBUS[0] and lightening it with gpio_direction_output
> > > and gpio_set_value barebox commands.
> > > 
> > > Also I have performed input test with ACBUS[0] -> ACBUS[1] loopback.
> > > 
> > > The main goal of adding gpio functionality to sandbox barebox
> > > is using it for connecting real i2c and spi devices to sandbox barebox
> > > (not tested yet).
> > 
> > I just read that the FT2232H can even do native I2C and SPI, so no gpio
> > bitbanging would be necessary.
> 
> I suppose that gpio support itself is valuable.
> 
> > Would it be possible to use this mode instead?
> 
> Yes, FT2232H has MPSSE acellerator.
> Using MPSSE one can increase FT2232 I2C/SPI performance dramatically.
> I have compared two FT2232 I2C realizations (bitbang and libmpsse,
> see https://github.com/frantony/mprog/tree/master/i2c_access).
> on reading of 8 KiB data block from I2C eeprom. libmpsse's bandwidth is 6 KiB 
> per second,
> bitbang's bandwidth is only 73 bytes per second (nearly 100 times worse).
> 
> Alas, I have no time to realize ftdi fast i2c/spi support for barebox in the 
> nearest future

Don't worry, I was only curious.

> 
> > Otherwise I think there should be a possibility to specify which, if
> > any, FT2232H chip barebox uses.
> 
> I'll add cmdline options to select FT2232H chips on USB bus in v2 patchseries.
> Also I'll check i2c bitbang support. I can connect ds1307 rtc or at24 eeprom).

Ok.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [RFC 0/2] sandbox: add gpio support with libftdi1

2017-02-16 Thread Antony Pavlov
On Thu, 16 Feb 2017 08:34:30 +0100
Sascha Hauer  wrote:

> Hi Antony,
> 
> On Wed, Feb 15, 2017 at 10:12:25AM +0300, Antony Pavlov wrote:
> > This patch series makes it possible to use FT2232H ACBUS[7:0]
> > pins as gpio pins from sandbox barebox.
> > 
> > I have tested output gpio functionality by connecting
> > a LED to ACBUS[0] and lightening it with gpio_direction_output
> > and gpio_set_value barebox commands.
> > 
> > Also I have performed input test with ACBUS[0] -> ACBUS[1] loopback.
> > 
> > The main goal of adding gpio functionality to sandbox barebox
> > is using it for connecting real i2c and spi devices to sandbox barebox
> > (not tested yet).
> 
> I just read that the FT2232H can even do native I2C and SPI, so no gpio
> bitbanging would be necessary.

I suppose that gpio support itself is valuable.

> Would it be possible to use this mode instead?

Yes, FT2232H has MPSSE acellerator.
Using MPSSE one can increase FT2232 I2C/SPI performance dramatically.
I have compared two FT2232 I2C realizations (bitbang and libmpsse,
see https://github.com/frantony/mprog/tree/master/i2c_access).
on reading of 8 KiB data block from I2C eeprom. libmpsse's bandwidth is 6 KiB 
per second,
bitbang's bandwidth is only 73 bytes per second (nearly 100 times worse).

Alas, I have no time to realize ftdi fast i2c/spi support for barebox in the 
nearest future

> Otherwise I think there should be a possibility to specify which, if
> any, FT2232H chip barebox uses.

I'll add cmdline options to select FT2232H chips on USB bus in v2 patchseries.
Also I'll check i2c bitbang support. I can connect ds1307 rtc or at24 eeprom).

-- 
Best regards,
  Antony Pavlov

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [RFC 0/2] sandbox: add gpio support with libftdi1

2017-02-15 Thread Sascha Hauer
Hi Antony,

On Wed, Feb 15, 2017 at 10:12:25AM +0300, Antony Pavlov wrote:
> This patch series makes it possible to use FT2232H ACBUS[7:0]
> pins as gpio pins from sandbox barebox.
> 
> I have tested output gpio functionality by connecting
> a LED to ACBUS[0] and lightening it with gpio_direction_output
> and gpio_set_value barebox commands.
> 
> Also I have performed input test with ACBUS[0] -> ACBUS[1] loopback.
> 
> The main goal of adding gpio functionality to sandbox barebox
> is using it for connecting real i2c and spi devices to sandbox barebox
> (not tested yet).

I just read that the FT2232H can even do native I2C and SPI, so no gpio
bitbanging would be necessary. Would it be possible to use this mode
instead?

Otherwise I think there should be a possibility to specify which, if
any, FT2232H chip barebox uses.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox