public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 8/9] tegra: i2c: Enable new CONFIG_SYS_I2C framework
Date: Wed, 31 Jul 2013 07:03:32 +0200	[thread overview]
Message-ID: <51F89AA4.20401@denx.de> (raw)
In-Reply-To: <51F81B51.6010305@wwwdotorg.org>

Hello Stephen,

Am 30.07.2013 22:00, schrieb Stephen Warren:
> On 07/30/2013 01:22 PM, Stephen Warren wrote:
>> On 07/29/2013 10:28 PM, Heiko Schocher wrote:
>>> Hello Stephen,
>>>
>>> Am 29.07.2013 18:12, schrieb Stephen Warren:
>>>> On 05/04/2013 06:01 AM, Heiko Schocher wrote:
>>>>> From: Simon Glass<sjg@chromium.org>
>>>>>
>>>>> This enables CONFIG_SYS_I2C on Tegra, updating existing boards and
>>>>> the Tegra
>>>>> i2c driver to support this.
>>>>
>>>> Heiko, the latest U-Boot tree hangs during boot on Tegra, and "git
>>>> bisect" points at this patch. Olof reported the issue to me.
>>>> Can you take a look at the code and see what might be wrong? Thanks.
>>>>
>>>> I suspect some kind of initialization ordering issue, since the boot
>>>> messages are:
>>>>
>>>> -----
>>>> U-Boot SPL 2013.07-rc3-00038-g880540d (Jul 29 2013 - 10:04:37)
>>>> U-Boot 2013.07-rc3-00038-g880540d (Jul 29 2013 - 10:04:37)
>>>>
>>>> TEGRA30
>>>> Board: NVIDIA Beaver
>>>> I2C:   Caller requested bad clock: periph=-49, parent=2
>>>> -----
>>>>
>>>> ... and that "bad clock" message implies to me that the I2C driver is
>>>> initializing before it has parsed the correct clock ID out of device
>>>> tree.
>>>
>>> Hmm... looking in the patch ... I can see nothing which changes
>>> some initializing order ...
>>
>> Yes, there's some initialization order issue; before this patch, I see
>> the I2C controller initialization, followed by some usage of it:
>>
>> ----------
>> U-Boot SPL 2013.07-rc3-00036-gd84eb85-dirty (Jul 30 2013 - 13:04:47)
>> U-Boot 2013.07-rc3-00036-gd84eb85-dirty (Jul 30 2013 - 13:04:47)
>>
>> TEGRA30
>> Board: NVIDIA Beaver
>> DRAM:  2 GiB
>> i2c: controller bus 0 at 7000d000, periph_id 47, speed 100000: ok
>> i2c: controller bus 1 at 7000c000, periph_id 12, speed 100000: ok
>> i2c: controller bus 2 at 7000c400, periph_id 54, speed 100000: ok
>> i2c: controller bus 3 at 7000c500, periph_id 67, speed 100000: ok
>> i2c: controller bus 4 at 7000c700, periph_id 103, speed 100000: ok
>> MMC:   i2c_write: chip=0x2d, addr=0x32, len=0x1
>> ----------
>>
>> However with this patch applied, something starts using the controller
>> immediately, without it having been "probed" from device-tree:
>>
>> ----------
>> U-Boot SPL 2013.07-rc3-00037-g1f2ba72-dirty (Jul 30 2013 - 13:08:28)
>> U-Boot 2013.07-rc3-00037-g1f2ba72-dirty (Jul 30 2013 - 13:08:28)
>>
>> TEGRA30
>> Board: NVIDIA Beaver
>> I2C:   i2c_init(speed=100000, slaveaddr=0xfe)
>> ----------
>>
>> i2c_init touches HW, but since process_nodes() hasn't run, none of the
>> parameters like register address or clock ID are yet known.
>>
>> I think this call comes from init_sequence_f[] ->  init_func_i2c() ->
>> i2c_init() ->  i2c_init() == __i2c_init() ->  i2c_init_bus() ->
>> I2C_ADAP->init(), although I didn't validate that in the running code,
>> just by code inspection.
>
> Oh, with the options Tegra has enabled, perhaps the call sequence is:
>
> board_init_f() (which uses init_sequence_f[]) ->  init_func_i2c() ->
> i2c_init_all(), which then calls:
>
> * i2c_init_board(), which is supposed to parse DT
> * i2c_set_bus_num(), which will call I2C_ADAP->init
>
> However, according to the comments near the top of arch/arm/lib/crt0.S,
> board_init_f() is called in an environment where variable data (.data,
> .bss) is not available, hence i2c_init_board() cannot possibly operate
> correctly since its whole purpose is to fill in variable data structures
> from DT.

Yes, you are right, this would not work on tegra.

> I think the only way to solve this is not to use DT to instantiate
> devices, or to move the I2C initialization after relocation etc.,
> although the latter won't work on boards that need I2C up in order to
> initialize DRAM.

Yes.

> It seems like much of U-Boot's initialization architecture simply wasn't
> designed to accommodate dynamically initializing devices from DT.

Yes.

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  parent reply	other threads:[~2013-07-31  5:03 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-04 12:01 [U-Boot] [PATCH v3 0/9] Bring in new I2C framework Heiko Schocher
2013-05-04 12:01 ` [U-Boot] [PATCH v3 1/9] i2c: add i2c_core and prepare for new multibus support Heiko Schocher
2013-05-04 12:01 ` [U-Boot] [PATCH v3 2/9] i2c: common changes for multibus/multiadapter support Heiko Schocher
2013-05-06 16:39   ` Daniel Schwierzeck
2013-05-07 13:05     ` Heiko Schocher
2013-05-11 21:17   ` Simon Glass
2013-05-13  4:47     ` Heiko Schocher
2013-05-11 21:33   ` Simon Glass
2013-05-13  5:41     ` Heiko Schocher
2013-05-04 12:01 ` [U-Boot] [PATCH v3 3/9] i2c, soft-i2c: switch to new " Heiko Schocher
2013-05-04 12:01 ` [U-Boot] [PATCH v3 4/9] i2c, fsl_i2c: " Heiko Schocher
2013-05-04 12:01 ` [U-Boot] [PATCH v3 5/9] i2c, multibus: get rid of CONFIG_I2C_MUX Heiko Schocher
2013-05-06 12:23   ` Holger Brunck
2013-05-06 13:57     ` Heiko Schocher
2013-05-04 12:01 ` [U-Boot] [PATCH v3 6/9] i2c, multibus, keymile: get rid of EEprom_ivm envvariable Heiko Schocher
2013-05-06 12:24   ` Holger Brunck
2013-05-06 13:58     ` Heiko Schocher
2013-05-04 12:01 ` [U-Boot] [PATCH v3 7/9] tegra: i2c: Add function to know about current bus Heiko Schocher
2013-05-04 12:01 ` [U-Boot] [PATCH v3 8/9] tegra: i2c: Enable new CONFIG_SYS_I2C framework Heiko Schocher
2013-05-06 19:08   ` Stephen Warren
2013-05-07  8:01     ` [U-Boot] [PATCH v3 8/9] tegra: i2c: Enable new CONFIG_SYS_I2Cframework Marc Dietrich
2013-05-07 14:55       ` Stephen Warren
2013-05-07 16:17         ` Simon Glass
2013-05-08  4:11         ` Heiko Schocher
2013-05-07 13:07     ` [U-Boot] [PATCH v3 8/9] tegra: i2c: Enable new CONFIG_SYS_I2C framework Heiko Schocher
     [not found]     ` <5FBF8E85CA34454794F0F7ECBA79798F37ACAFEF3F@HQMAIL04.nvidia.com>
2013-05-07 13:12       ` Heiko Schocher
2013-07-29 16:12   ` Stephen Warren
2013-07-30  4:28     ` Heiko Schocher
2013-07-30  4:34       ` Simon Glass
2013-07-30 18:56       ` Stephen Warren
2013-07-31  4:29         ` Heiko Schocher
2013-07-30 19:22       ` Stephen Warren
2013-07-30 20:00         ` Stephen Warren
2013-07-30 21:21           ` Simon Glass
2013-07-30 21:32             ` Stephen Warren
2013-07-30 21:46               ` Simon Glass
2013-07-30 21:51                 ` Stephen Warren
2013-07-30 22:05                   ` Simon Glass
2013-07-31  5:46                     ` Heiko Schocher
2013-07-31 19:31                       ` Stephen Warren
2013-08-01  4:32                         ` Heiko Schocher
2013-08-01  5:39                           ` Stephen Warren
2013-08-01  6:02                             ` Heiko Schocher
2013-08-01  6:53                               ` Albert ARIBAUD
2013-08-01  8:38                                 ` Heiko Schocher
2013-08-01 14:22                                   ` Simon Glass
2013-08-01 15:06                                     ` Heiko Schocher
2013-08-01 20:16                                     ` Albert ARIBAUD
2013-08-02 19:32                                       ` Simon Glass
2013-08-01 20:14                                   ` Albert ARIBAUD
2013-08-01 20:34                                 ` Stephen Warren
2013-08-01 20:32                               ` Stephen Warren
2013-08-02  4:40                                 ` Heiko Schocher
2013-08-02 19:35                                   ` Simon Glass
2013-08-02 21:43                                   ` Stephen Warren
2013-08-03  3:55                                     ` Heiko Schocher
2013-08-05 15:40                                       ` Simon Glass
2013-08-05 17:28                                         ` Stephen Warren
2013-08-05 20:12                                           ` Simon Glass
2013-08-05 20:15                                             ` Stephen Warren
2013-08-05 17:59                                       ` Stephen Warren
2013-07-30 22:09                   ` Albert ARIBAUD
2013-07-30 22:11                     ` Simon Glass
2013-07-31  5:18                     ` Wolfgang Denk
2013-07-31  5:55                       ` Heiko Schocher
2013-07-31  7:06                       ` Albert ARIBAUD
2013-07-31  7:36                         ` Heiko Schocher
2013-07-31  8:16                           ` Albert ARIBAUD
2013-07-31  8:31                             ` Heiko Schocher
2013-07-31  9:38                               ` Albert ARIBAUD
2013-07-31 12:30                                 ` Simon Glass
2013-07-31 13:03                                   ` Heiko Schocher
2013-07-31 19:41                               ` Stephen Warren
2013-08-01  4:32                                 ` Heiko Schocher
2013-07-31 19:39                         ` Wolfgang Denk
2013-07-31  5:52                     ` Heiko Schocher
2013-07-31  5:03           ` Heiko Schocher [this message]
2013-08-05 19:21           ` Stephen Warren
2013-08-05 20:08             ` Tom Rini
2013-08-05 21:06               ` Stephen Warren
2013-08-05 23:18               ` Stephen Warren
2013-07-30 21:19         ` Simon Glass
2013-07-30 21:21           ` Stephen Warren
2013-07-30 21:45             ` Simon Glass
2013-07-31  5:01         ` Heiko Schocher
2013-05-04 12:01 ` [U-Boot] [PATCH v3 9/9] i2c, ppc4xx_i2c: switch to new multibus/multiadapter support Heiko Schocher
2013-05-06  6:52   ` Stefan Roese
2013-05-06  8:57 ` [U-Boot] [PATCH v3 0/9] Bring in new I2C framework Dirk Eibach
2013-05-06 14:11   ` Heiko Schocher
2013-05-17 13:17 ` Piotr Wilczek
2013-05-18 17:41   ` Simon Glass
2013-05-20  6:13     ` Piotr Wilczek
2013-06-19 22:07       ` Simon Glass
2013-06-20  3:38         ` Heiko Schocher
2013-06-20  5:50           ` Minkyu Kang
2013-06-20  6:41             ` Piotr Wilczek
2013-06-20  7:14               ` Heiko Schocher
2013-06-20  8:34                 ` Piotr Wilczek
2013-06-20  9:19                   ` Heiko Schocher
2013-06-20  5:52           ` Piotr Wilczek
2013-06-20  6:52           ` Dirk Eibach
2013-06-20  7:59             ` Heiko Schocher
2013-06-20  8:20               ` Dirk Eibach
2013-06-20  9:11                 ` 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=51F89AA4.20401@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