All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trent Piepho <tpiepho@impinj.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/2] wandboard: Don't use I2C speed Kconfig settings with DM_I2C
Date: Thu, 9 May 2019 16:31:28 +0000	[thread overview]
Message-ID: <1557419488.31309.86.camel@impinj.com> (raw)
In-Reply-To: <20190509082017.6dc6df23@crub>

On Thu, 2019-05-09 at 08:20 +0200, Anatolij Gustschin wrote:
> On Wed, 8 May 2019 23:30:01 +0000
> Trent Piepho tpiepho at impinj.com wrote:
> ...
> > diff --git a/board/wandboard/wandboard.c
> > b/board/wandboard/wandboard.c
> > index 69fbc8b690..9d7a94ff9d 100644
> > --- a/board/wandboard/wandboard.c
> > +++ b/board/wandboard/wandboard.c
> > @@ -46,6 +46,15 @@ DECLARE_GLOBAL_DATA_PTR;
> >  #define ETH_PHY_AR8035_POWER	IMX_GPIO_NR(7, 13)
> >  #define REV_DETECTION		IMX_GPIO_NR(2, 28)
> >  
> > +/* Speed defined in Kconfig is only applicable when not using
> > DM_I2C.  */
> > +#ifdef CONFIG_DM_I2C
> > +#define I2C1_SPEED_NON_DM	0
> > +#define I2C2_SPEED_NON_DM	0
> > +#else
> > +#define I2C1_SPEED_NON_DM	CONFIG_SYS_MXC_I2C1_SPEED
> > +#define I2C2_SPEED_NON_DM	CONFIG_SYS_MXC_I2C2_SPEED
> 
> Shouldn't we change this to
> 
> #ifdef CONFIG_DM_I2C
> #define I2C2_SPEED_NON_DM	0
> #define I2C3_SPEED_NON_DM	0
> #else
> #define I2C2_SPEED_NON_DM	CONFIG_SYS_MXC_I2C2_SPEED
> #define I2C3_SPEED_NON_DM	CONFIG_SYS_MXC_I2C3_SPEED
> #endif
> ...
> setup_i2c(1, I2C2_SPEED_NON_DM, 0x7f, &mx6q_i2c2_pad_info);
> setup_i2c(2, I2C3_SPEED_NON_DM, 0x7f, &mx6q_i2c3_pad_info);
> ?
> 
> Because the first argument to setup_i2c() is the bus number
> which starts counting from 0, but the CONFIG_SYS_MXC_I2C*
> start counting from 1. This doesn't affect the actual
> configuration since the speed value is currently the same
> for all buses. But it is more accurate.

Seems like it should have been, but the existing code uses I2C1_SPEED
and I2C2_SPEED.  Probably a bug.  But if I change it here, then it will
affect existing config files, which were done when the bug existed.

Also I see it calls setup_i2c(1, ...) twice, which seems like another
bug.

      reply	other threads:[~2019-05-09 16:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08 23:30 [U-Boot] [PATCH v2 1/2] wandboard: Don't use I2C speed Kconfig settings with DM_I2C Trent Piepho
2019-05-08 23:30 ` [U-Boot] [PATCH v2 2/2] i2c: mxc: Hide kconfig based control in DM_I2C mode Trent Piepho
2019-05-09  6:20 ` [U-Boot] [PATCH v2 1/2] wandboard: Don't use I2C speed Kconfig settings with DM_I2C Anatolij Gustschin
2019-05-09 16:31   ` Trent Piepho [this message]

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=1557419488.31309.86.camel@impinj.com \
    --to=tpiepho@impinj.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.