All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] i2c issues with efikamx and mainline uboot
@ 2013-11-19 13:17 Konstantinos Margaritis
  2013-11-19 15:37 ` Marek Vasut
  2013-11-19 17:02 ` Fabio Estevam
  0 siblings, 2 replies; 6+ messages in thread
From: Konstantinos Margaritis @ 2013-11-19 13:17 UTC (permalink / raw)
  To: u-boot

(Disclaimer: u-boot newbie)

Hi all,

With Marek's huge help (thanks Marek!) I've tried to merge his tree [1]
that provides lcd support for the efikamx/efikasb with recent mainline
uboot. It boots, but I've hit some wall now and couldn't get passed it,
so I thought I'd ask for some expert advice, Marek suggested I mail
here and CC himself and Stefano as well.

So, I've migrated the structures to the iomux v3 coding conventions,
added some missing defines for iomuxes used, etc. I've forked the code
in github [2] and am doing all the changes there, in the hope that I can
at some point submit it back to mainline. I also want to to enable
multi-host USB support for the platform so that tftp booting will be at
last possible, but that's going to happen later, I want to be done with
LCD first.

The result boots, but in short it fails to initialise the LCD (for the
efikamx, didn't test efikasb yet). I noticed that amongst many changes,
in drivers/i2c/mxc_i2c.c, i2c_imx_bus_busy() in Marek's tree () got
sort of replaced with wait_for_sr_state(), which does the same
thing but is more generic -or so I understand, please correct me if I'm
wrong in my interpretation.

So what's the problem? Well, I2CR_MSTA (master mode) is set, but
I2SR_IBB fails to get set. In every case I get this result in the
I2SR register:

I2SR = 81 -> I2SR_ICF | I2SR_RX_NO_AK, ie. 

which according to the iMX515 Reference Manual corresponds to:

"Transfer is complete, and set by the falling edge of the ninth clock
of a byte transfer." + "A ?No acknowledge? signal was detected
at the ninth clock."

so a previous answer didn't send an acknowledge or rather the
opposite it sent a NACK. 

I'm at a loss here, attaching a boot log where I added some printfs
around. I'd appreciate any pointer as to what I'm doing wrong.

Thanks

Konstantinos

[1] git://git.denx.de/u-boot-marex.git branch: efikasb2
[2] https://github.com/markos/u-boot branch: efikamx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: efikamx-uboot-lcd.log
Type: application/octet-stream
Size: 51228 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131119/17e9e6ab/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131119/17e9e6ab/attachment.pgp>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] i2c issues with efikamx and mainline uboot
  2013-11-19 13:17 [U-Boot] i2c issues with efikamx and mainline uboot Konstantinos Margaritis
@ 2013-11-19 15:37 ` Marek Vasut
  2013-11-19 17:02   ` Benoît Thébaudeau
  2013-11-19 17:02 ` Fabio Estevam
  1 sibling, 1 reply; 6+ messages in thread
From: Marek Vasut @ 2013-11-19 15:37 UTC (permalink / raw)
  To: u-boot

Dear Konstantinos Margaritis,

> (Disclaimer: u-boot newbie)
> 
> Hi all,
> 
> With Marek's huge help (thanks Marek!) I've tried to merge his tree [1]
> that provides lcd support for the efikamx/efikasb with recent mainline
> uboot. It boots, but I've hit some wall now and couldn't get passed it,
> so I thought I'd ask for some expert advice, Marek suggested I mail
> here and CC himself and Stefano as well.
> 
> So, I've migrated the structures to the iomux v3 coding conventions,
> added some missing defines for iomuxes used, etc. I've forked the code
> in github [2] and am doing all the changes there, in the hope that I can
> at some point submit it back to mainline. I also want to to enable
> multi-host USB support for the platform so that tftp booting will be at
> last possible, but that's going to happen later, I want to be done with
> LCD first.
> 
> The result boots, but in short it fails to initialise the LCD (for the
> efikamx, didn't test efikasb yet). I noticed that amongst many changes,
> in drivers/i2c/mxc_i2c.c, i2c_imx_bus_busy() in Marek's tree () got
> sort of replaced with wait_for_sr_state(), which does the same
> thing but is more generic -or so I understand, please correct me if I'm
> wrong in my interpretation.
> 
> So what's the problem? Well, I2CR_MSTA (master mode) is set, but
> I2SR_IBB fails to get set. In every case I get this result in the
> I2SR register:
> 
> I2SR = 81 -> I2SR_ICF | I2SR_RX_NO_AK, ie.
> 
> which according to the iMX515 Reference Manual corresponds to:
> 
> "Transfer is complete, and set by the falling edge of the ninth clock
> of a byte transfer." + "A ?No acknowledge? signal was detected
> at the ninth clock."
> 
> so a previous answer didn't send an acknowledge or rather the
> opposite it sent a NACK.
> 
> I'm at a loss here, attaching a boot log where I added some printfs
> around. I'd appreciate any pointer as to what I'm doing wrong.

Honestly, I have a feeling the MX51 I2C controller might be broken. Isn't there 
maybe something in the ERRATA for MX51 (I know it's HUGE) ?

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] i2c issues with efikamx and mainline uboot
  2013-11-19 15:37 ` Marek Vasut
@ 2013-11-19 17:02   ` Benoît Thébaudeau
  2013-11-20 23:15     ` Konstantinos Margaritis
  0 siblings, 1 reply; 6+ messages in thread
From: Benoît Thébaudeau @ 2013-11-19 17:02 UTC (permalink / raw)
  To: u-boot

Dear Marek Vasut,

On Tuesday, November 19, 2013 4:37:00 PM, Marek Vasut wrote:
> Dear Konstantinos Margaritis,
> 
> > (Disclaimer: u-boot newbie)
> > 
> > Hi all,
> > 
> > With Marek's huge help (thanks Marek!) I've tried to merge his tree [1]
> > that provides lcd support for the efikamx/efikasb with recent mainline
> > uboot. It boots, but I've hit some wall now and couldn't get passed it,
> > so I thought I'd ask for some expert advice, Marek suggested I mail
> > here and CC himself and Stefano as well.
> > 
> > So, I've migrated the structures to the iomux v3 coding conventions,
> > added some missing defines for iomuxes used, etc. I've forked the code
> > in github [2] and am doing all the changes there, in the hope that I can
> > at some point submit it back to mainline. I also want to to enable
> > multi-host USB support for the platform so that tftp booting will be at
> > last possible, but that's going to happen later, I want to be done with
> > LCD first.
> > 
> > The result boots, but in short it fails to initialise the LCD (for the
> > efikamx, didn't test efikasb yet). I noticed that amongst many changes,
> > in drivers/i2c/mxc_i2c.c, i2c_imx_bus_busy() in Marek's tree () got
> > sort of replaced with wait_for_sr_state(), which does the same
> > thing but is more generic -or so I understand, please correct me if I'm
> > wrong in my interpretation.
> > 
> > So what's the problem? Well, I2CR_MSTA (master mode) is set, but
> > I2SR_IBB fails to get set. In every case I get this result in the
> > I2SR register:
> > 
> > I2SR = 81 -> I2SR_ICF | I2SR_RX_NO_AK, ie.
> > 
> > which according to the iMX515 Reference Manual corresponds to:
> > 
> > "Transfer is complete, and set by the falling edge of the ninth clock
> > of a byte transfer." + "A ?No acknowledge? signal was detected
> > at the ninth clock."
> > 
> > so a previous answer didn't send an acknowledge or rather the
> > opposite it sent a NACK.
> > 
> > I'm at a loss here, attaching a boot log where I added some printfs
> > around. I'd appreciate any pointer as to what I'm doing wrong.
> 
> Honestly, I have a feeling the MX51 I2C controller might be broken. Isn't
> there
> maybe something in the ERRATA for MX51 (I know it's HUGE) ?

I use the i.MX515, and the I?C worked fine at some point in mainline U-Boot. If
it does not work for you now, it's either because of a software regression, or
because of some board-specific issue, e.g. pads. SION may have to be set for
I?C.

Best regards,
Beno?t

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] i2c issues with efikamx and mainline uboot
  2013-11-19 13:17 [U-Boot] i2c issues with efikamx and mainline uboot Konstantinos Margaritis
  2013-11-19 15:37 ` Marek Vasut
@ 2013-11-19 17:02 ` Fabio Estevam
  1 sibling, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2013-11-19 17:02 UTC (permalink / raw)
  To: u-boot

On Tue, Nov 19, 2013 at 11:17 AM, Konstantinos Margaritis
<markos@freevec.org> wrote:
> (Disclaimer: u-boot newbie)
>
> Hi all,
>
> With Marek's huge help (thanks Marek!) I've tried to merge his tree [1]
> that provides lcd support for the efikamx/efikasb with recent mainline
> uboot. It boots, but I've hit some wall now and couldn't get passed it,
> so I thought I'd ask for some expert advice, Marek suggested I mail
> here and CC himself and Stefano as well.

I see that you use '#define CONFIG_I2C_MXC', which is deprecated. Now
we use '#define CONFIG_SYS_I2C_MXC' instead.

It would be better if you could use Stefano's u-boot-imx tree to base
your work, and post the patches to the list so that we can comment.

Regards,

Fabio Estevam

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] i2c issues with efikamx and mainline uboot
  2013-11-19 17:02   ` Benoît Thébaudeau
@ 2013-11-20 23:15     ` Konstantinos Margaritis
  2013-11-21  0:09       ` Benoît Thébaudeau
  0 siblings, 1 reply; 6+ messages in thread
From: Konstantinos Margaritis @ 2013-11-20 23:15 UTC (permalink / raw)
  To: u-boot

On Tue, 19 Nov 2013 18:02:19 +0100 (CET)
Beno?t Th?baudeau <benoit.thebaudeau@advansee.com> wrote:
> I use the i.MX515, and the I?C worked fine at some point in mainline
> U-Boot. If it does not work for you now, it's either because of a
> software regression, or because of some board-specific issue, e.g.
> pads. SION may have to be set for I?C.

Hi Beno?t,

By "SION may have to be set for I?C", do you mean that
IOMUX_CONFIG_SION might have to be defined and ORed in the MX51 pads
in arch/arm/include/asm/arch-mx5/iomux-mx51.h just is it is set in
arch/arm/include/asm/arch-mx5/iomux-mx53.h, for example:

MX53_PAD_KEY_COL3__I2C2_SCL = IOMUX_PAD(0x364, 0x03C, 4 |
IOMUX_CONFIG_SION, 0x81C, 0, NO_PAD_CTRL),

How do I know in which ones do I have to set SION? I've added some
pad defines in the mx51 file, needed for LCD bringup, and I hope I did
it the right way -at least I followed the RM as close as I could and
Marek was of tremendous help here, but I didn't even know about that
SION thing while doing that. I'd gladly try it out, before following
Fabio's advice and try to merge the patches to the u-boot-imx tree
-tried already but they don't apply cleanly, I'll have to do it when I
get more free time, most likely during the weekend.

Regards

Konstantinos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131121/f72684af/attachment.pgp>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] i2c issues with efikamx and mainline uboot
  2013-11-20 23:15     ` Konstantinos Margaritis
@ 2013-11-21  0:09       ` Benoît Thébaudeau
  0 siblings, 0 replies; 6+ messages in thread
From: Benoît Thébaudeau @ 2013-11-21  0:09 UTC (permalink / raw)
  To: u-boot

Dear Konstantinos Margaritis,

On Thursday, November 21, 2013 12:15:18 AM, Konstantinos Margaritis wrote:
> On Tue, 19 Nov 2013 18:02:19 +0100 (CET)
> Beno?t Th?baudeau <benoit.thebaudeau@advansee.com> wrote:
> > I use the i.MX515, and the I?C worked fine at some point in mainline
> > U-Boot. If it does not work for you now, it's either because of a
> > software regression, or because of some board-specific issue, e.g.
> > pads. SION may have to be set for I?C.
> 
> Hi Beno?t,
> 
> By "SION may have to be set for I?C", do you mean that
> IOMUX_CONFIG_SION might have to be defined and ORed in the MX51 pads
> in arch/arm/include/asm/arch-mx5/iomux-mx51.h just is it is set in
> arch/arm/include/asm/arch-mx5/iomux-mx53.h, for example:
> 
> MX53_PAD_KEY_COL3__I2C2_SCL = IOMUX_PAD(0x364, 0x03C, 4 |
> IOMUX_CONFIG_SION, 0x81C, 0, NO_PAD_CTRL),

Correct.

> How do I know in which ones do I have to set SION? I've added some
> pad defines in the mx51 file, needed for LCD bringup, and I hope I did
> it the right way -at least I followed the RM as close as I could and
> Marek was of tremendous help here, but I didn't even know about that
> SION thing while doing that. I'd gladly try it out, before following
> Fabio's advice and try to merge the patches to the u-boot-imx tree
> -tried already but they don't apply cleanly, I'll have to do it when I
> get more free time, most likely during the weekend.

The normal rule is that SION is required whenever a pin is in input and output
at the same time. E.g., this is the case when you want to read the actual level
on a GPIO pin in output mode. This is also the case for both I?C pins (SDA and
SCL):
 - SDA is either the master or the slave output depending on the time slot,
 - SCL may be stretched by the slave if it is too slow compared to the master
   requests.
In both cases, the pad may set some level, but the IP also needs to read back
the actual level in order to work correctly. Also make sure that SDA and SCL are
configured in open drain mode, and that there is a pull-up (either enabled in
the SoC pad, or as an external resistor on the board) on both.

Best regards,
Beno?t

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-11-21  0:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-19 13:17 [U-Boot] i2c issues with efikamx and mainline uboot Konstantinos Margaritis
2013-11-19 15:37 ` Marek Vasut
2013-11-19 17:02   ` Benoît Thébaudeau
2013-11-20 23:15     ` Konstantinos Margaritis
2013-11-21  0:09       ` Benoît Thébaudeau
2013-11-19 17:02 ` Fabio Estevam

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.