Re: [PATCH 7/7] microblaze: Add support for little-endian Microblaze
From: Grant Likely
Date: Wed Sep 29 2010 - 03:48:32 EST
On Wed, Sep 29, 2010 at 4:31 PM, Michal Simek <monstr@xxxxxxxxx> wrote:
>
>
> 2010/9/29 Grant Likely <grant.likely@xxxxxxxxxxxx>
>>
>> On Wed, Sep 29, 2010 at 03:52:18PM +1000, Michal Simek wrote:
>> > Microblaze little-endian toolchain exports __MICROBLAZEEL__
>> > which is used in the kernel to identify little/big endian.
>> >
>> > The most of the changes are in loading values from DTB which
>> > is always big endian.
>> >
>> > Little endian platforms are based on new AXI bus which has
>> > impact to early uartlite initialization.
>> >
>> > Signed-off-by: Michal Simek <monstr@xxxxxxxxx>
>>
>> Hi Michal,
>>
>> Looks pretty good, but a few comments below.
>>
>> > @@ -87,7 +88,7 @@ static int __init early_init_dt_scan_serial(unsigned
>> > long node,
>> > /* this function is looking for early uartlite console - Microblaze
>> > specific */
>> > int __init early_uartlite_console(void)
>> > {
>> > - return of_scan_flat_dt(early_init_dt_scan_serial, NULL);
>> > + return be32_to_cpu(of_scan_flat_dt(early_init_dt_scan_serial,
>> > NULL));
>>
>> of_scan_flat_dt returns a rc that should already by in cpu endianess.
>> of_scan_flat_dt needs to be fixed instead.
>
> It is easy to do it. I will generate patch for it. It is in drivers/of/fdt.c
Oops, I told you the wrong thing. the fix needs to be made in
early_init_dt_scan_serial(). of_scan_flat_dt() is just fine.
>> diff --git a/arch/microblaze/kernel/vmlinux.lds.S
>> b/arch/microblaze/kernel/vmlinux.lds.S
>> index 20b0552..96a88c3 100644
>> --- a/arch/microblaze/kernel/vmlinux.lds.S
>> +++ b/arch/microblaze/kernel/vmlinux.lds.S
>> @@ -15,7 +15,11 @@ ENTRY(microblaze_start)
>> #include <asm-generic/vmlinux.lds.h>
>> #include <asm/thread_info.h>
>>
>> +#ifdef __MICROBLAZEEL__
>> +jiffies = jiffies_64;
>> +#else
>> jiffies = jiffies_64 + 4;
>> +#endif
>
>> I comment would go nicely hear to explain to reviewers what this is
>> about.
>
> 1. It is the same what ARM and MIPS (maybe other) have.
>
> 2. Look at this example
> Store 64 bit value ("0x12345678 90abcdef") on little and big endian.
>
> a) big endian
> it is just copying values to the memory.
> 0x0 = 0x12345678
> 0x4 = 0x90abcdef
>
> Address 0 is start of jiffies_64
> and you just want to point on the last (smallest) 32 bit which is on offset
> 0x4 - which is jiffies.
>
> b) little endian
> The same case for little endian
> 0x0 = 0xefcdab90
> 0x4 = 0x78563412
>
> Address 0 is start of jiffies_64
> and you just want to point on the last (smallest) 32 bit which is on offset
> 0x0 - which is jiffies.
Ah, okay. jiffies_64 is a pointer (I couldn't be bothered to look at
the definition of jiffies it in context).
g.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/