* [U-Boot] RFC, dm: devices and device_info platdata manual relocation
@ 2016-05-14 10:59 Angelo Dureghello
2016-06-17 3:49 ` Simon Glass
0 siblings, 1 reply; 3+ messages in thread
From: Angelo Dureghello @ 2016-05-14 10:59 UTC (permalink / raw)
To: u-boot
Hi all,
i have seen, updating u-boot in NOR parallel flash,
that the U_BOOT_DEVICE structure "platdata" ptr is
still pointing to flash, so the update (rewriting
flash) die silently and fails.
I have found a workaround using misc_init_r that works
in my board.c, as below, but i don't like too much the solution:
...
#include <dm/platform_data/serial_coldfire.h>
...
DECLARE_GLOBAL_DATA_PTR;
....
int misc_init_r(void)
{
/*
* FIXME: relocation seems not working properly on m68k,
* so relocating manually
*/
struct udevice *dev;
int retval;
printf("misc_init_r(): entering\n");
retval = uclass_find_device(UCLASS_SERIAL, 0, &dev);
if (!retval) {
printf("misc_init_r(): relocating serial device\n");
dev->platdata += gd->reloc_off;
}
return 0;
}
static struct coldfire_serial_platdata mcf5307_serial_plat = {
.base = CONFIG_SYS_UART_BASE,
.port = 0,
.baudrate = CONFIG_BAUDRATE,
};
U_BOOT_DEVICE(coldfire_serial) = {
.name = "serial_coldfire",
.platdata = &mcf5307_serial_plat,
};
So, i can keep this changes in my board, but, i am wondering if
manual-reloc of devices structures is maybe responsibility of
drivers/core/root.c, something like
int dm_init(void)
{
.....
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
fix_drivers();
fix_uclass();
fix_devices(); <-------------
#endif
.....
Every comment is welcome.
Regards,
Angelo Dureghello
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] RFC, dm: devices and device_info platdata manual relocation
2016-05-14 10:59 [U-Boot] RFC, dm: devices and device_info platdata manual relocation Angelo Dureghello
@ 2016-06-17 3:49 ` Simon Glass
2016-06-17 12:39 ` Angelo Dureghello
0 siblings, 1 reply; 3+ messages in thread
From: Simon Glass @ 2016-06-17 3:49 UTC (permalink / raw)
To: u-boot
Hi Angelo,
On 14 May 2016 at 04:59, Angelo Dureghello <angelo@sysam.it> wrote:
> Hi all,
>
> i have seen, updating u-boot in NOR parallel flash,
> that the U_BOOT_DEVICE structure "platdata" ptr is
> still pointing to flash, so the update (rewriting
> flash) die silently and fails.
>
> I have found a workaround using misc_init_r that works
> in my board.c, as below, but i don't like too much the solution:
>
> ...
> #include <dm/platform_data/serial_coldfire.h>
> ...
>
> DECLARE_GLOBAL_DATA_PTR;
> ....
>
> int misc_init_r(void)
> {
> /*
> * FIXME: relocation seems not working properly on m68k,
> * so relocating manually
> */
> struct udevice *dev;
> int retval;
>
> printf("misc_init_r(): entering\n");
>
> retval = uclass_find_device(UCLASS_SERIAL, 0, &dev);
>
> if (!retval) {
> printf("misc_init_r(): relocating serial device\n");
>
> dev->platdata += gd->reloc_off;
> }
>
> return 0;
> }
>
> static struct coldfire_serial_platdata mcf5307_serial_plat = {
> .base = CONFIG_SYS_UART_BASE,
> .port = 0,
> .baudrate = CONFIG_BAUDRATE,
> };
>
> U_BOOT_DEVICE(coldfire_serial) = {
> .name = "serial_coldfire",
> .platdata = &mcf5307_serial_plat,
> };
>
>
> So, i can keep this changes in my board, but, i am wondering if manual-reloc
> of devices structures is maybe responsibility of
> drivers/core/root.c, something like
>
> int dm_init(void)
>
> {
>
> .....
> #if defined(CONFIG_NEEDS_MANUAL_RELOC)
> fix_drivers();
> fix_uclass();
> fix_devices(); <-------------
> #endif
>
> .....
>
> Every comment is welcome.
I believe you have sent a patch for this and is has been applied, correct?
Regards,
Simon
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] RFC, dm: devices and device_info platdata manual relocation
2016-06-17 3:49 ` Simon Glass
@ 2016-06-17 12:39 ` Angelo Dureghello
0 siblings, 0 replies; 3+ messages in thread
From: Angelo Dureghello @ 2016-06-17 12:39 UTC (permalink / raw)
To: u-boot
Hi Simon,
On 17/06/2016 05:49, Simon Glass wrote:
> Hi Angelo,
>
> On 14 May 2016 at 04:59, Angelo Dureghello <angelo@sysam.it> wrote:
>> Hi all,
>>
>> i have seen, updating u-boot in NOR parallel flash,
>> that the U_BOOT_DEVICE structure "platdata" ptr is
>> still pointing to flash, so the update (rewriting
>> flash) die silently and fails.
>>
>> I have found a workaround using misc_init_r that works
>> in my board.c, as below, but i don't like too much the solution:
>>
>> ...
>> #include <dm/platform_data/serial_coldfire.h>
>> ...
>>
>> DECLARE_GLOBAL_DATA_PTR;
>> ....
>>
>> int misc_init_r(void)
>> {
>> /*
>> * FIXME: relocation seems not working properly on m68k,
>> * so relocating manually
>> */
>> struct udevice *dev;
>> int retval;
>>
>> printf("misc_init_r(): entering\n");
>>
>> retval = uclass_find_device(UCLASS_SERIAL, 0, &dev);
>>
>> if (!retval) {
>> printf("misc_init_r(): relocating serial device\n");
>>
>> dev->platdata += gd->reloc_off;
>> }
>>
>> return 0;
>> }
>>
>> static struct coldfire_serial_platdata mcf5307_serial_plat = {
>> .base = CONFIG_SYS_UART_BASE,
>> .port = 0,
>> .baudrate = CONFIG_BAUDRATE,
>> };
>>
>> U_BOOT_DEVICE(coldfire_serial) = {
>> .name = "serial_coldfire",
>> .platdata = &mcf5307_serial_plat,
>> };
>>
>>
>> So, i can keep this changes in my board, but, i am wondering if manual-reloc
>> of devices structures is maybe responsibility of
>> drivers/core/root.c, something like
>>
>> int dm_init(void)
>>
>> {
>>
>> .....
>> #if defined(CONFIG_NEEDS_MANUAL_RELOC)
>> fix_drivers();
>> fix_uclass();
>> fix_devices(); <-------------
>> #endif
>>
>> .....
>>
>> Every comment is welcome.
>
> I believe you have sent a patch for this and is has been applied, correct?
>
Yes, it's already applied.
I thought to provide directly the patch, to facilitate
things and since u-boot on amcore board was not relocating
correctly.
Many Thanks !
Regards
angelo
> Regards,
> Simon
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-17 12:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-14 10:59 [U-Boot] RFC, dm: devices and device_info platdata manual relocation Angelo Dureghello
2016-06-17 3:49 ` Simon Glass
2016-06-17 12:39 ` Angelo Dureghello
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox