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: Thu, 01 Aug 2013 17:06:03 +0200 [thread overview]
Message-ID: <51FA795B.3060002@denx.de> (raw)
In-Reply-To: <CAPnjgZ3DkWtmzgfx2A1Ph1sKwBpoGyu+STSXo83UgkxNdKRcbw@mail.gmail.com>
Hello Simon,
Am 01.08.2013 16:22, schrieb Simon Glass:
> Hi,
>
> On Thu, Aug 1, 2013 at 2:38 AM, Heiko Schocher<hs@denx.de> wrote:
>
>> Hello Albert,
>>
>> Am 01.08.2013 08:53, schrieb Albert ARIBAUD:
>>
>> Hi Heiko,
>>>
>>> On Thu, 01 Aug 2013 08:02:42 +0200, Heiko Schocher<hs@denx.de> wrote:
>>>
>>> I suppose you could. It seems conceptually /far/ simpler to just scan
>>>>> the DT once up-front rather than having to defer all this stuff until
>>>>>
>>>>
>>>> on the other hand we ring for every ms boot time ... and here we want
>>>> to scan a complete dt with maybe a lot of nodes, we do not want to
>>>> use?
>>>>
>>>
>>> Scanning all of DT seems to imply it has no strict or standard
>>> ordering. Could we mandate, suggest, of make it so that all entries in
>>> the DT needed at _f time are put first, and even maybe place an "end of
>>> _f" custom marker in DT to delimit them? (I assume that, for the sake of
>>>
>>
>> I do not know, if this is possible, as I think the DT used in U-Boot
>> should be the same as used in linux ... or?
>>
>>
>> Postel-ism, anything in DT which is not understandable is skipped, so
>>> other users of the DT than us would not even be annoyed by such a
>>> marker)
>>>
>>> This way, we'd avoid wasting time scanning most of the DT in this case.
>>>
>>
>> Hmm.. why should we introduce such things, instead of scanning the
>> node only if we need it?
>>
>> We have "only" the problem, that we could not write to data at this
>> moment ... but this problem should be solved in a seperate topic.
>> I2C is usable before relocation, the problem is in conjunction with
>> dt, that we can not save for example the base address of the controller,
>> which we get from the DT ... If I understand it correct!
>>
>> So we need an option when using dt, that we have (small ram) in which
>> we can write some parameters parsed from dt ...
>>
>> I think this problem have all subsystems used before relocation.
>> (for example: environment on a spi flash?)
>>
>>
> I think using a small RAM is a good approach. At least it is better than
> pretending there is no RAM at all. We currently have no facility to
> allocate RAM before relocation, other than to use the .data section. We can
> use global_data but that won't scale well for many drivers adding their own
> stuff in there. Samsung's driver uses .data, I don't think it is a big deal.
>
> One option I should mention is to decode the I2C FDT nodes each time it is
> needed prior to relocation (i.e. to the stack), use it for the transaction,
> and throw it away. This is quite painful IMO this it involves putting calls
> in the driver to check if we are pre-reloc and have a stack space used
> every time. On tegra20 this would be 130 bytes or so. I mention it because
> console working this way for a while (decoding the console again on every
> byte).
>
> Options as I see it:
>
> - just fudge it for now and use .data (deal with it later with driver model)
> - change the meaning of board_init_f() such that memory may be available
> (e.g. if run from SPL)
> - decode the FDT nodes every time we need them (ick)
Why? after relocation it is needed exactly once.
You can do something like that in the i2c_init function:
+ bus = tegra_i2c_get_bus(adap);
+ if (bus)
+ return 0;
If you get a bus with tegra_i2c_get_bus(adap), it is "fdt initialized"
If you not get a bus ... init it ... only once
The problem before relocation could be solved with .data or later
with the driver model ...
> - adjust the ordering so that I2C normally happens post reloc except for
> specific platforms with a CONFIG defined (Heiko, the difference as I
> understand it is that with your patch CONFIG_HARD_I2C or CONFIG_SOFT_I2C
> are now defined, and so I2C happens prior to reloc now)
Hmm.. BTW: CONFIG_SOFT_I2C is no longer in the code :-)
And there are a lot of boards that use i2c before relocation, that is
not a new feature.
The problem pop up, because in arch/arm/lib/board.c at init_func_i2c()
the new code calls i2c_init_all() instead i2c_init() ...
This i2c_init_all() was introduced to init fix the SPD EEPROM bus
and call i2c_init_board() before it...
So we can call here again i2c_init() I think ... but, i2c_init()
also calls i2c_init_bus() and this i2c_init from the tegra driver,
which sets speed and return 0 ... what is not really clean, it
just works, because tegra_i2c_set_bus_speed() checks if the
bus is valid, if not only returns ...
but i2c_init_board is not called so early, which is the cause
for our problem with the tegra driver and the new framework,
as i2c_init_board() hysterically was introduced to unblock
blocked i2c busses (Correct me, if I am wrong)
My prefered way is still:
- replace i2c_init_all() through i2c_init() in
arch/arm/lib/board.c at init_func_i2c()
to get tegra again working
In the long term when all i2c drivers use the new framework
init_func_i2c() will no longer necessary :-)
As the goal is to change the i2c api, so all i2c functions
pass "bus" as a parameter, and i2c_set_bus_num() get
a static function in drivers/i2c/i2c_core.c
no need longer for storing the old bus, setting the new bus,
doing i2c work, set the old bus, as this sequence is spread
over the hole u-boot code.
- decoding fdt node in tegra_i2c_init, as I think
it is the right place for it. optional more or less, but
to prevent in future again such "order" problems ...
>> As Wolfgang said:
>> "Agreed - actually we're entering an area hear that smells pretty
>> strong like device model reorganization :-)"
>>
>> BTW: How is this problem solved with the device model approach?
>
>
> More that we need to solve it, probably with a limited malloc() pre-reloc.
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
next prev parent reply other threads:[~2013-08-01 15:06 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 [this message]
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
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=51FA795B.3060002@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 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.