public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
* linux powerpc and device trees
@ 2008-05-23 14:53 - Reyneke
  2008-05-23 15:06 ` Laurent Pinchart
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: - Reyneke @ 2008-05-23 14:53 UTC (permalink / raw)
  To: linuxppc-embedded


Hi All,

I am busy with a platform move from the arch/ppc to arch/powerpc tree of th=
e linux kernel. Being relatively new to device trees, I'm trying to ensure =
I have all the steps covered. The platform is very similar to the AMCC Sequ=
ioa (440EPx) and that board has been used as reference for the code changes=
 required. Kernel version is 2.6.25, using u-boot 1.2.0 (CONFIG_OF_xxx enab=
led, debug output on).

My understanding of the whole powerpc branch boot process is as follows:

1. Add platform to arch/powerpc/platforms/4xx
2. Create a .dts in arch/powerpc/boot/dts
3. Setup .config and compile uImage
4. Compile device tree blob using dtc
5. As test, tftp uImage, RootFS, and deviceblob to system memory
6. Use u-boot's bootm command to boot kernel

Every seems OK, until you get to the boot part. The boot hangs:

Verifying Checksum ... OK
Booting using flat device tree at 0x3000000
## initrd at 0x02000040 ... 0x027FEDF7 (len=3D8383928=3D0x7FEDB8)
Loading Ramdisk to 0f332000, end 0fb30db8 ... OK
## Transferring control to Linux (at address 00000000) ...


Using various diagnostics like BDI, ft_dump_blob etc I can see that u-boot =
does what I expect it to do, and the device tree blob looks valid. Tracing =
into the kernel init all looks fine until you hit MMU_init - at this point =
it looks like the total memory is calculated as 0. Evaluating the .dts file=
 the following lines are immediately suspect:

memory {
device_type =3D "memory";
reg =3D ; /* Filled in by zImage */
};

This is where I am unclear as to how to prepare the device tree. Is step (4=
) correct since I'm using uImage? Where is the memory information suppose t=
o come from? Previously U-boot passes this kind of data to the kernel via b=
d_t - how does it work now using device trees?

Cheers
Jan


_________________________________________________________________

http://clk.atdmt.com/UKM/go/msnnkmgl0010000007ukm/direct/01/=

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

* Re: linux powerpc and device trees
  2008-05-23 14:53 linux powerpc and device trees - Reyneke
@ 2008-05-23 15:06 ` Laurent Pinchart
  2008-05-23 15:06 ` Marco Stornelli
  2008-05-23 17:49 ` Josh Boyer
  2 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2008-05-23 15:06 UTC (permalink / raw)
  To: linuxppc-embedded; +Cc: - Reyneke

[-- Attachment #1: Type: text/plain, Size: 2622 bytes --]

Hi Jan,

On Friday 23 May 2008 16:53, - Reyneke wrote:
> 
> Hi All,
> 
> I am busy with a platform move from the arch/ppc to arch/powerpc tree of the 
linux kernel. Being relatively new to device trees, I'm trying to ensure I 
have all the steps covered. The platform is very similar to the AMCC Sequioa 
(440EPx) and that board has been used as reference for the code changes 
required. Kernel version is 2.6.25, using u-boot 1.2.0 (CONFIG_OF_xxx 
enabled, debug output on).
> 
> My understanding of the whole powerpc branch boot process is as follows:
> 
> 1. Add platform to arch/powerpc/platforms/4xx
> 2. Create a .dts in arch/powerpc/boot/dts
> 3. Setup .config and compile uImage
> 4. Compile device tree blob using dtc
> 5. As test, tftp uImage, RootFS, and deviceblob to system memory
> 6. Use u-boot's bootm command to boot kernel
> 
> Every seems OK, until you get to the boot part. The boot hangs:
> 
> Verifying Checksum ... OK
> Booting using flat device tree at 0x3000000
> ## initrd at 0x02000040 ... 0x027FEDF7 (len=8383928=0x7FEDB8)
> Loading Ramdisk to 0f332000, end 0fb30db8 ... OK
> ## Transferring control to Linux (at address 00000000) ...
> 
> 
> Using various diagnostics like BDI, ft_dump_blob etc I can see that u-boot
> does what I expect it to do, and the device tree blob looks valid. Tracing
> into the kernel init all looks fine until you hit MMU_init - at this point
> it looks like the total memory is calculated as 0. Evaluating the .dts file
> the following lines are immediately suspect:    
> 
> memory {
> device_type = "memory";
> reg = ; /* Filled in by zImage */
> };
> 
> This is where I am unclear as to how to prepare the device tree. Is step (4)
> correct since I'm using uImage? Where is the memory information suppose to
> come from? Previously U-boot passes this kind of data to the kernel via
> bd_t - how does it work now using device trees?   

U-Boot has to fill the device tree. This is done in the ft_board_setup() 
function that every board has to implement. Here is what mine looks like (for 
an MPC8248).

void ft_board_setup(void *blob, bd_t *bd)
{
        DECLARE_GLOBAL_DATA_PTR;

        ft_cpu_setup(blob, bd);
        fdt_fixup_ethernet(blob, bd);
        fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);

        do_fixup_by_compat_u32(blob, "fsl,cpm-brg", "clock-frequency",
                gd->brg_clk, 1);
}

Best regards,

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: linux powerpc and device trees
  2008-05-23 14:53 linux powerpc and device trees - Reyneke
  2008-05-23 15:06 ` Laurent Pinchart
@ 2008-05-23 15:06 ` Marco Stornelli
  2008-05-23 17:49 ` Josh Boyer
  2 siblings, 0 replies; 5+ messages in thread
From: Marco Stornelli @ 2008-05-23 15:06 UTC (permalink / raw)
  To: - Reyneke; +Cc: linuxppc-embedded

- Reyneke ha scritto:
> Hi All,
> 
> I am busy with a platform move from the arch/ppc to arch/powerpc tree of the linux kernel. Being relatively new to device trees, I'm trying to ensure I have all the steps covered. The platform is very similar to the AMCC Sequioa (440EPx) and that board has been used as reference for the code changes required. Kernel version is 2.6.25, using u-boot 1.2.0 (CONFIG_OF_xxx enabled, debug output on).
> 
> My understanding of the whole powerpc branch boot process is as follows:
> 
> 1. Add platform to arch/powerpc/platforms/4xx
> 2. Create a .dts in arch/powerpc/boot/dts
> 3. Setup .config and compile uImage
> 4. Compile device tree blob using dtc
> 5. As test, tftp uImage, RootFS, and deviceblob to system memory
> 6. Use u-boot's bootm command to boot kernel
> 
> Every seems OK, until you get to the boot part. The boot hangs:
> 
> Verifying Checksum ... OK
> Booting using flat device tree at 0x3000000
> ## initrd at 0x02000040 ... 0x027FEDF7 (len=8383928=0x7FEDB8)
> Loading Ramdisk to 0f332000, end 0fb30db8 ... OK
> ## Transferring control to Linux (at address 00000000) ...
> 
> 
> Using various diagnostics like BDI, ft_dump_blob etc I can see that u-boot does what I expect it to do, and the device tree blob looks valid. Tracing into the kernel init all looks fine until you hit MMU_init - at this point it looks like the total memory is calculated as 0. Evaluating the .dts file the following lines are immediately suspect:
> 
> memory {
> device_type = "memory";
> reg = ; /* Filled in by zImage */
> };
> 
> This is where I am unclear as to how to prepare the device tree. Is step (4) correct since I'm using uImage? Where is the memory information suppose to come from? Previously U-boot passes this kind of data to the kernel via bd_t - how does it work now using device trees?
> 
> Cheers
> Jan
> 
> 
> _________________________________________________________________
> 
> http://clk.atdmt.com/UKM/go/msnnkmgl0010000007ukm/direct/01/
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs•org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
> 
Some information aren't statically filled in the dts but they are added 
dynamicly by U-Boot. This stuff has to be done in proper U-Boot 
functions. I suggest you to check these functions comparing them even 
with other boards.

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

* Re: linux powerpc and device trees
  2008-05-23 14:53 linux powerpc and device trees - Reyneke
  2008-05-23 15:06 ` Laurent Pinchart
  2008-05-23 15:06 ` Marco Stornelli
@ 2008-05-23 17:49 ` Josh Boyer
  2 siblings, 0 replies; 5+ messages in thread
From: Josh Boyer @ 2008-05-23 17:49 UTC (permalink / raw)
  To: - Reyneke; +Cc: linuxppc-embedded

On Fri, 23 May 2008 14:53:44 +0000
- Reyneke <reynekejunk@hotmail•com> wrote:

> memory {
> device_type = "memory";
> reg = ; /* Filled in by zImage */
> };
> 
> This is where I am unclear as to how to prepare the device tree. Is step (4) correct since I'm using uImage? Where is the memory information suppose to come from? Previously U-boot passes this kind of data to the kernel via bd_t - how does it work now using device trees?

As others have noted, U-Boot can fill in the device tree parts that are
missing if your version of U-Boot is FDT capable.  If not, you need to
use a cuImage wrapper to do that part for you.  See
arch/powerpc/boot/cuboot-sequoia.c for examples.

josh

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

* Re: linux powerpc and device trees
@ 2008-05-27 13:42 - Reyneke
  0 siblings, 0 replies; 5+ messages in thread
From: - Reyneke @ 2008-05-27 13:42 UTC (permalink / raw)
  To: linuxppc-embedded


Thanks everyone for the feedback provided. Looks like the bootloader/kernel=
 cross over is now working OK.

My advice to anyone else doing this move - upgrade to the latest version of=
 u-boot before doing the kernel move.


> I am busy with a platform move from the arch/ppc to arch/powerpc tree of =
the linux kernel. Being relatively new to device trees, I'm trying to ensur=
e I have all the steps covered. The platform is very similar to the AMCC Se=
quioa (440EPx) and that board has been used as reference for the code chang=
es required. Kernel version is 2.6.25, using u-boot 1.2.0 (CONFIG_OF_xxx en=
abled, debug output on).

.
.

> This is where I am unclear as to how to prepare the device tree. Is step =
(4) correct since I'm using uImage? Where is the memory information suppose=
 to come from? Previously U-boot passes this kind of data to the kernel via=
 bd_t - how does it work now using device trees?
>=20
> Cheers
> Jan


_________________________________________________________________

http://clk.atdmt.com/UKM/go/msnnkmgl0010000009ukm/direct/01/=

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

end of thread, other threads:[~2008-05-27 13:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-23 14:53 linux powerpc and device trees - Reyneke
2008-05-23 15:06 ` Laurent Pinchart
2008-05-23 15:06 ` Marco Stornelli
2008-05-23 17:49 ` Josh Boyer
  -- strict thread matches above, loose matches on Subject: below --
2008-05-27 13:42 - Reyneke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox