From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 7/7] tegra: Enable I2C on Seaboard
Date: Fri, 13 Jan 2012 08:34:18 +0100 [thread overview]
Message-ID: <4F0FDE7A.3070705@denx.de> (raw)
In-Reply-To: <CAPnjgZ1aAiooQ5aVFwMum=7ZRjZy5xsOb=P2-U3=TPU_YHZuQg@mail.gmail.com>
Hello Simon,
Simon Glass wrote:
> +U-Boot, which I seemed to have dropped by mistake
>
> Hi Stephen,
>
> On Thu, Jan 12, 2012 at 10:59 AM, Stephen Warren <swarren@nvidia.com> wrote:
>> Simon Glass wrote at Wednesday, January 11, 2012 8:00 PM:
>>> On Mon, Jan 9, 2012 at 1:45 PM, Stephen Warren <swarren@nvidia.com> wrote:
>>>> On 12/26/2011 11:11 AM, Simon Glass wrote:
>>>>> This enables I2C on Seaboard.
>>>> ...
>>>>> diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h
>>>> ...
>>>>> +#define CONFIG_SYS_I2C_INIT_BOARD
>>>> I don't think that option is correct for Seaboard; the description in
>>>> the README indicates this causes a function named i2c_init_board() to be
>>>> called from boards/xxx/board.c, which is supposed to use GPIOs to unhang
>>>> the I2C bus. However, this raises a couple of issues:
>>>>
>>>> 1) Patch 5 in this series calls i2c_init_board() ifdef CONFIG_TEGRA2_I2C
>>>> rather than depending on this CONFIG option.
>>>>
>>>> 2) Tegra's i2c_init_board() doesn't appear to be anything to do with bus
>>>> unhanging, but is instead regular I2C initialization. Perhaps the
>>>> function should be renamed?
>>> I have had a bit of a look at this. From what I can see the problem is
>>> that i2c_init() is passed a bus speed, but this is just
>>> CONFIG_SYS_I2C_SPEED. We want to control the speed individually for
>>> each port. Yes would could use i2c_init() and ignore the speed, but
>>> that seems odd also. At least with the way it is we don't ignore the
>>> setting.
>>>
>>> We also don't define CONFIG_HARD_I2C which again seems odd, but I
>>> suppose is for the same reason (we don't want to call i2c_init()).
>> Hmm. It sounds like we should replace CONFIG_TEGRA2_I2C with
>> CONFIG_HARD_I2C given the README description of the latter?
>
> Well we could, but we would need to ignore the speed argument. Do you
> think that is better?
Without defining CONFIG_HARD_i2C, i2c_init() never gets called ...
naming CONFIG_TEGRA2_I2C is absolutely OK for enabling the tegra i2c
driver.
>>> Also U-Boot tends to call i2c_init() before every use of i2c, whereas
>>> we just want to init once and be done with it.
>>>
>>> I think the function name is correct, but perhaps I should change the
>>> #ifdef you mention in 1 above to CONFIG_SYS_I2C_INIT_BOARD. But for
>>> i2c to function on Tegra boards, this must be defined, so in fact this
>>> might be counterproductive. So perhaps a check that it is defined is
>>> best?
>> But README explicitly says that i2c_init_board() is for bus unhanging
>> which isn't what the Tegra implementation does. How can the function
>> name be correct given that?
>>
> Well we should rename the function IMO. It seems to me that with a a
> name like that it is for initing i2c on the board.
Yes, the name is missleading. On the other hand is a deblocking also
some sort of "init" ... but I see no problem in using the i2c_init_board()
for doing board specific i2c inits too ... maybe the README should be
adapted ... but this problem results, that you don't want to use
i2c_init() ...
>> Don't we just want to make i2c_init() use a global/static variable to
>> determine whether the device has already been initialized, and defer all
>> the init until first usage or something like that? That seems in line
>> with U-Boot's desire not to initialize drivers until they're actually
>> used.
Yep, that would be inline with that ... but how would you use "i2c reset"
command? That only calls i2c_init() ... so, you never can reset/reinit
your i2c bus controller.
> Actually that might work - if we keep i2c_init() a no-op, and wait
> until we get a request for a bus before we look up the fdt and init
> that port. But I suspect we might need to init port 0 immediately
> since there is no explicit call to i2c_set_bus_num() for that. It's a
> little wonky whatever we do. What do you think?
Yep, the clean way would be to use the multibus/multiadapter branch:
http://git.denx.de/?p=u-boot/u-boot-i2c.git;a=shortlog;h=refs/heads/multibus_v2_20111112
but as I said in a previous EMail ... there is some work to do,
before it is mainline acceptable ...
[...]
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
prev parent reply other threads:[~2012-01-13 7:34 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-26 18:11 [U-Boot] [PATCH 0/7] tegra: Add I2C driver and associated parts Simon Glass
2011-12-26 18:11 ` [U-Boot] [PATCH 1/7] tegra: Rename NV_PA_PMC_BASE to TEGRA2_PMC_BASE Simon Glass
2011-12-26 19:12 ` Marek Vasut
2012-01-09 21:34 ` Stephen Warren
2011-12-26 18:11 ` [U-Boot] [PATCH 2/7] tegra: fdt: Add extra I2C definitions for U-Boot Simon Glass
2011-12-26 19:12 ` Marek Vasut
2011-12-27 4:35 ` Stephen Warren
2011-12-27 5:15 ` Simon Glass
2011-12-29 6:40 ` Stephen Warren
2011-12-29 7:11 ` Simon Glass
2011-12-26 18:11 ` [U-Boot] [PATCH 3/7] tegra: Add I2C support to funcmux Simon Glass
2012-01-09 21:36 ` Stephen Warren
2012-01-09 21:40 ` Simon Glass
2012-01-09 22:56 ` Simon Glass
2011-12-26 18:11 ` [U-Boot] [PATCH 4/7] tegra: Add I2C driver Simon Glass
2011-12-26 19:15 ` Marek Vasut
2012-01-08 16:57 ` Simon Glass
2012-01-08 17:06 ` Marek Vasut
2012-01-08 18:16 ` Simon Glass
2012-01-08 5:57 ` Mike Frysinger
2012-01-08 16:46 ` Simon Glass
2012-01-09 22:07 ` Stephen Warren
2012-01-12 4:17 ` Simon Glass
2012-01-12 19:14 ` Stephen Warren
2012-01-13 7:12 ` Heiko Schocher
2012-01-13 14:49 ` Simon Glass
2012-01-13 15:27 ` Heiko Schocher
2012-02-03 23:18 ` Simon Glass
2011-12-26 18:11 ` [U-Boot] [PATCH 5/7] tegra: Initialise I2C on Nvidia boards Simon Glass
2011-12-26 18:11 ` [U-Boot] [PATCH 6/7] tegra: Select I2C ordering for Seaboard Simon Glass
2012-01-09 21:42 ` Stephen Warren
2011-12-26 18:11 ` [U-Boot] [PATCH 7/7] tegra: Enable I2C on Seaboard Simon Glass
2012-01-09 21:45 ` Stephen Warren
[not found] ` <CAPnjgZ3jTm6j-fK_Kn==W3uGr=8pREEWXawP39kojLzzSH07wQ@mail.gmail.com>
[not found] ` <74CDBE0F657A3D45AFBB94109FB122FF17801D1D4A@HQMAIL01.nvidia.com>
2012-01-12 19:10 ` Simon Glass
2012-01-12 19:21 ` Stephen Warren
2012-01-12 19:28 ` Simon Glass
2012-01-13 7:34 ` Heiko Schocher [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=4F0FDE7A.3070705@denx.de \
--to=hs@denx.de \
--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