All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] DM: Problem with DT bus translation dev_get_addr()
@ 2015-09-01  6:25 Stefan Roese
  2015-09-01 15:23 ` Stefan Roese
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Roese @ 2015-09-01  6:25 UTC (permalink / raw)
  To: u-boot

Hi Simon,

I'm currently enabling DM support for the Marvell MVEBU SoC's I've
been working lately on (Armada XP and 38x right now). A problem I'm
facing here is the bus translation, as this is quite complex for these
SoC's. With multiple levels of translation ranges (multiple simple-bus
nodes to walk through).

The current implementation in dev_get_addr() does not work. This has
2 reasons:

a) It only translates 1 simple-bus node - we need to walk the
    complete DT to get the correct address.

b) The "ranges" property can have different sizes for "address"
    and "size" in all these busses / nodes. And also multiple
    ranges tuples are allowed and used in these dts files.

Of course this can be solved in the current implementation (device.c /
simple_bus.c). But especially b) is not that trivial to solve in
a generic way.

So my main question is, why don't you use fdt_translate_address()
from fdt_support.c instead of implementing your own translation
function simple_bus_translate()? Is this a size question because
this may be used in SPL as well?

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] DM: Problem with DT bus translation dev_get_addr()
  2015-09-01  6:25 [U-Boot] DM: Problem with DT bus translation dev_get_addr() Stefan Roese
@ 2015-09-01 15:23 ` Stefan Roese
  2015-09-01 15:30   ` Simon Glass
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Roese @ 2015-09-01 15:23 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On 01.09.2015 08:25, Stefan Roese wrote:
> I'm currently enabling DM support for the Marvell MVEBU SoC's I've
> been working lately on (Armada XP and 38x right now). A problem I'm
> facing here is the bus translation, as this is quite complex for these
> SoC's. With multiple levels of translation ranges (multiple simple-bus
> nodes to walk through).
>
> The current implementation in dev_get_addr() does not work. This has
> 2 reasons:
>
> a) It only translates 1 simple-bus node - we need to walk the
>     complete DT to get the correct address.
>
> b) The "ranges" property can have different sizes for "address"
>     and "size" in all these busses / nodes. And also multiple
>     ranges tuples are allowed and used in these dts files.
>
> Of course this can be solved in the current implementation (device.c /
> simple_bus.c). But especially b) is not that trivial to solve in
> a generic way.
>
> So my main question is, why don't you use fdt_translate_address()
> from fdt_support.c instead of implementing your own translation
> function simple_bus_translate()? Is this a size question because
> this may be used in SPL as well?

The attached small patch demonstrates the usage of 
fdt_translate_address() and enables bus translation on the MVEBU platforms.

Thanks,
Stefan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-use-translate_bus-from-fdt_common.c-testing-only.patch
Type: text/x-diff
Size: 1137 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150901/cd5e1473/attachment.patch>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] DM: Problem with DT bus translation dev_get_addr()
  2015-09-01 15:23 ` Stefan Roese
@ 2015-09-01 15:30   ` Simon Glass
  2015-09-01 16:52     ` Stefan Roese
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Glass @ 2015-09-01 15:30 UTC (permalink / raw)
  To: u-boot

Hi Stefan,

On 1 September 2015 at 09:23, Stefan Roese <sr@denx.de> wrote:
> Hi Simon,
>
> On 01.09.2015 08:25, Stefan Roese wrote:
>>
>> I'm currently enabling DM support for the Marvell MVEBU SoC's I've
>> been working lately on (Armada XP and 38x right now). A problem I'm
>> facing here is the bus translation, as this is quite complex for these
>> SoC's. With multiple levels of translation ranges (multiple simple-bus
>> nodes to walk through).
>>
>> The current implementation in dev_get_addr() does not work. This has
>> 2 reasons:
>>
>> a) It only translates 1 simple-bus node - we need to walk the
>>     complete DT to get the correct address.
>>
>> b) The "ranges" property can have different sizes for "address"
>>     and "size" in all these busses / nodes. And also multiple
>>     ranges tuples are allowed and used in these dts files.
>>
>> Of course this can be solved in the current implementation (device.c /
>> simple_bus.c). But especially b) is not that trivial to solve in
>> a generic way.
>>
>> So my main question is, why don't you use fdt_translate_address()
>> from fdt_support.c instead of implementing your own translation
>> function simple_bus_translate()? Is this a size question because
>> this may be used in SPL as well?
>
>
> The attached small patch demonstrates the usage of fdt_translate_address()
> and enables bus translation on the MVEBU platforms.

Thanks for digging into this.

One concern I have is fdt_parent_offset(). That function is very slow
- we should use dev->parent->of_offset instead with driver model.

Other than that I think this is fine. But yes it should be enabled by
CONFIG because the code size gets a lot larger and many platforms
don't need it. Perhaps we should have a new CONFIG_SPL_OF_TRANSLATE?

Regards,
Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] DM: Problem with DT bus translation dev_get_addr()
  2015-09-01 15:30   ` Simon Glass
@ 2015-09-01 16:52     ` Stefan Roese
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2015-09-01 16:52 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On 01.09.2015 17:30, Simon Glass wrote:
>>> So my main question is, why don't you use fdt_translate_address()
>>> from fdt_support.c instead of implementing your own translation
>>> function simple_bus_translate()? Is this a size question because
>>> this may be used in SPL as well?
>>
>>
>> The attached small patch demonstrates the usage of fdt_translate_address()
>> and enables bus translation on the MVEBU platforms.
>
> Thanks for digging into this.
>
> One concern I have is fdt_parent_offset(). That function is very slow
> - we should use dev->parent->of_offset instead with driver model.
>
> Other than that I think this is fine. But yes it should be enabled by
> CONFIG because the code size gets a lot larger and many platforms
> don't need it. Perhaps we should have a new CONFIG_SPL_OF_TRANSLATE?

Okay. I'll try to prepare a patch for this tomorrow. Stay tuned... ;)

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-01 16:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-01  6:25 [U-Boot] DM: Problem with DT bus translation dev_get_addr() Stefan Roese
2015-09-01 15:23 ` Stefan Roese
2015-09-01 15:30   ` Simon Glass
2015-09-01 16:52     ` Stefan Roese

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.