All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] I2C on iMX25
Date: Mon, 24 Sep 2012 14:35:49 +0200 (CEST)	[thread overview]
Message-ID: <2127748113.5053277.1348490149890.JavaMail.root@advansee.com> (raw)
In-Reply-To: <50604561.70505@arcor.de>

On Monday, September 24, 2012 1:34:57 PM, Matthias Wei?er wrote:
> Am 24.09.2012 13:05, schrieb Beno?t Th?baudeau:
> > Hi Stefano, Matthias,
> >
> > On Monday, September 24, 2012 11:45:33 AM, Stefano Babic wrote:
> >> On 24/09/2012 11:32, Matthias Wei?er wrote:
> >> > Hi Stefano
> >> >
> >>
> >> Hi Matthias,
> >>
> >> > I am currently in the process of updating my zmx25 board support
> >> > for a new
> >> > hardware revision where I need I2C access. I2C on imx25
> >> > currently
> >> > fails
> >> > to build:
> >> >
> >> > mxc_i2c.c: In function 'i2c_imx_get_clk':
> >> > mxc_i2c.c:101:31: error: 'MXC_IPG_PERCLK' undeclared (first use
> >> > in
> >> > this
> >> > function)
> >>
> >> Ok, I see.
> >
> > I had the same issue a while ago. I have a fix for that. I will try
> > to post it
> > tonight.
> >
> >> > I can easily fix this by replacing MXC_IPG_PERCLK with
> >> > MXC_I2C_CLK.
> >> > But
> >> > MXC_I2C_CLK is only defined for imx25. So, this change will
> >> > break
> >> > all other
> >> > imx chips.
> >>
> >> But this seems the right solution. The mxc_get_clk() gets as
> >> parameter
> >> an enum representing a peripheral or a special clock name, valid
> >> for
> >> a
> >> SOC. The driver should use the peripheral name.
> >
> > Yes and no. The best would be to add a clock abstraction function
> > imx_get_i2cclk(), like what exists for UART. This is what I did.
> 
> What is the advantage of such a function over
> i2c_imx_get_clk(MXC_I2C_CLK)?

Not to introduce a clock ID that does not match register controls, but this is
really a nit. The MXC_I2C_CLK solution is less noisy than adding a new function,
so let's stick to it, all the more Stefano prefers it. I will update my local
patch with that before posting it.

> >> Really I think the right way is to add MXC_I2C_CLK to the other
> >> SOCs,
> >> adding the case in their specific mxc_get_clock() implementation,
> >> for
> >> example for mx6 something like this:
> >>
> >> diff --git a/arch/arm/cpu/armv7/mx5/clock.c
> >> b/arch/arm/cpu/armv7/mx5/clock.c
> >> index c67c3cf..8fa737a 100644
> >> --- a/arch/arm/cpu/armv7/mx5/clock.c
> >> +++ b/arch/arm/cpu/armv7/mx5/clock.c
> >> @@ -482,6 +482,7 @@ unsigned int mxc_get_clock(enum mxc_clock clk)
> >>         case MXC_IPG_CLK:
> >>                 return get_ipg_clk();
> >>         case MXC_IPG_PERCLK:
> >> +       case MXC_I2C_CLK:
> >>                 return get_ipg_per_clk();
> >>         case MXC_UART_CLK:
> >>                 return get_uart_clk();
> >>
> >>
> >> and updating the mxc_i2c driver to follow the same rule.
> >
> > That can be a good solution. What do you think about my
> > imx_get_i2cclk()?
> >
> > Also, note that there are some broken clocks for i.MX25. I?C is one
> > of them. It
> > should be:
> > 	case MXC_I2C_CLK:
> > 		return imx_get_perclk(I2C_PER_CLK);
> 
> Why that? My understanding is that imx_get_perclk picks the right
> clock
> as long as the 16 first entries of enum mxc_clock ar in the rigth
> order.

You're right. I looked too quickly at my local changes when I said that this
clock was broken. It works. What I did locally is split the per clocks away from
enum mxc_clock to be cleaner than having a mix of all types of clocks, but this
is actually only cosmetic, and I'm not sure I will keep this change.

Best regards,
Beno?t

  reply	other threads:[~2012-09-24 12:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-24  9:32 [U-Boot] I2C on iMX25 Matthias Weißer
2012-09-24  9:45 ` Stefano Babic
2012-09-24 11:04   ` Matthias Weißer
2012-09-24 11:05   ` Benoît Thébaudeau
2012-09-24 11:34     ` Matthias Weißer
2012-09-24 12:35       ` Benoît Thébaudeau [this message]
2012-09-24 11:54     ` Stefano Babic

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=2127748113.5053277.1348490149890.JavaMail.root@advansee.com \
    --to=benoit.thebaudeau@advansee.com \
    --cc=u-boot@lists.denx.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 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.