public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Trent Piepho <tpiepho@impinj.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] i2c: mxc: Hide kconfig based control in DM_I2C mode
Date: Tue, 30 Apr 2019 17:21:35 +0000	[thread overview]
Message-ID: <1556644895.31309.24.camel@impinj.com> (raw)
In-Reply-To: <9d8dcbca-2741-ba4e-2221-d59341137666@denx.de>

On Tue, 2019-04-30 at 09:20 +0200, Heiko Schocher wrote:
> > Am 12.04.2019 um 21:19 schrieb Trent Piepho:
> > > These options only apply when not using DM_I2C.  When using device
> > > trees, the dt will enable and control the speeds of the I2C
> > > controller(s) and these configuration options have no effect.
> > > 
> > > So disable them in DM_I2C mode.  Otherwise they show up as decoys, and
> > > make it look like one is enabling I2C controllers and setting the speed
> > > when really it's doing nothing.

>         arm:  +   wandboard
> +board/wandboard/wandboard.c: In function 'board_init':
> +board/wandboard/wandboard.c:466:15: error: 'CONFIG_SYS_MXC_I2C1_SPEED' undeclared (first use in 
> this function); did you mean 'CONFIG_SYS_MMC_ENV_DEV'?
> +  setup_i2c(1, CONFIG_SYS_MXC_I2C1_SPEED, 0x7f, &mx6dl_i2c2_pad_info);
> +               ^~~~~~~~~~~~~~~~~~~~~~~~~
> +               CONFIG_SYS_MMC_ENV_DEV
> +board/wandboard/wandboard.c:466:15: note: each undeclared identifier is reported only once for each 
> function it appears in
> +board/wandboard/wandboard.c:469:16: error: 'CONFIG_SYS_MXC_I2C2_SPEED' undeclared (first use in 
> this function); did you mean 'CONFIG_SYS_MXC_I2C1_SPEED'?
> +   setup_i2c(2, CONFIG_SYS_MXC_I2C2_SPEED, 0x7f, &mx6q_i2c3_pad_info);
> +                ^~~~~~~~~~~~~~~~~~~~~~~~~
> +                CONFIG_SYS_MXC_I2C1_SPEED
> +make[2]: *** [board/wandboard/wandboard.o] Error 1
> +make[1]: *** [board/wandboard] Error 2
> +make: *** [sub-make] Error 2
> 
> Please check.

This is caused by a conflict with "imx6: wandboard: convert to DM_I2C",
which was applied after I sent my patch.  

I'm not sure if that commit is correct. Copying Anatolij.

It's the only place where non-DM_I2C code uses the kconfig based
configuration of I2C.  If we look at the code in question:

setup_i2c(1, CONFIG_SYS_MXC_I2C1_SPEED, 0x7f, &mx6dl_i2c2_pad_info);

Seems a bit odd bus 1 is being configured with i2c*2* pad info?  But
let's take a look at setup_i2c().

int setup_i2c(unsigned i2c_index, int speed, int slave_addr,
              struct i2c_pads_info *p)
{
        ....
        /* Enable i2c clock */
        ret = enable_i2c_clk(1, i2c_index);
        if (ret)
                goto err_clk;

        /* Make sure bus is idle */
        ret = force_idle_bus(p);
        if (ret)
                goto err_idle;

#ifndef CONFIG_DM_I2C
        bus_i2c_init(i2c_index, speed, slave_addr, force_idle_bus, p);
#endif
        return 0;
         
err_idle:
err_clk:
        gpio_free(p->scl.gp);
err_req:
        gpio_free(p->sda.gp);

        return ret;
}

Nothing in the elided section uses "speed".  It's only used in the
bus_i2c_init() call, and that call is not made when using DM_I2C!

So while the wandboard code references CONFIG_SYS_MXC_I2C1_SPEED when
using DM_i2C, it's never used by anything.

So I believe I'm still correct, even after the wandboard change that
CONFIG_SYS_MXC_I2C1_SPEED et al are decoys that aren't used.

  reply	other threads:[~2019-04-30 17:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12 19:19 [U-Boot] [PATCH] i2c: mxc: Hide kconfig based control in DM_I2C mode Trent Piepho
2019-04-30  4:24 ` Heiko Schocher
2019-04-30  7:20   ` Heiko Schocher
2019-04-30 17:21     ` Trent Piepho [this message]
2019-05-02  5:39       ` Heiko Schocher
2019-05-02  6:11         ` Anatolij Gustschin
2019-05-03 20:16           ` Trent Piepho
2019-05-06  8:58             ` Heiko Schocher

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=1556644895.31309.24.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox