How to move from /ppc/ to /powerpc/
Hi!
I have a custom board on which I currently run Linux 2.6.18-rc6 configured for MPC834x_SYS in the /ppc/ tree, which just a few minor changes. Now I'm interested to move to using the /powerpc/ source tree instead, but I can't figure out exactly what steps are necessary to do this.
Does anyone run a MPC834x_SYS built with ARCH=powerpc?
I boot the board with U-Boot (version 1.1.4, customized), and I assume that I need to add some stuff for this new device tree thing, but I can't figure out exactly what the kernel will expect.
Does anyone have some pointers on how to do this?
Cheers // Fredrik Roubert
Signature · 2 lines
Visserij 192 | +32 473 344527 / +46 708 776974 BE-9000 Gent | http://www.df.lth.se/~roubert/
Quoted 10 lines · On Tue, 12 Sep 2006 17:33:16 +0200 Fredrik Roubert <[email protected]> wrote:
Hi!
I have a custom board on which I currently run Linux 2.6.18-rc6 configured for
MPC834x_SYSin the /ppc/ tree, which just a few minor changes. Now I'm interested to move to using the /powerpc/ source tree instead, but I can't figure out exactly what steps are necessary to do this.Does anyone run a
MPC834x_SYSbuilt with ARCH=powerpc?
yes
Quoted 3 lines
I boot the board with U-Boot (version 1.1.4, customized), and I assume that I need to add some stuff for this new device tree thing, but I can't figure out exactly what the kernel will expect.
the kernel expects a pointer to a device tree instead of a bd_t. The 8349EMDS device tree source is now in linux/arch/powerpc/boot/dts. You'll need the device tree compiler (dtc) from jdl.com to build your flat device tree binary (dtb; what the kernel expects).
Quoted 3 lines
Does anyone have some pointers on how to do this?
Matt's u-boot patches address the issue well for 85xx, they are straightforward to adapt to 83xx:
http://sourceforge.net/mailarchive/forum.php?thread_id=15518792&forum_id=12898
they allow you to tftp the dtb into mem, and "bootm ${loadaddr} - ${oftaddr}" to start an ARCH=powerpc kernel.
Quoted 1 line
Cheers // Fredrik Roubert
Kim
Quoted 8 lines · Kim Phillips
Quoted 3 lines
I boot the board with U-Boot (version 1.1.4, customized), and I assume that I need to add some stuff for this new device tree thing, but I can't figure out exactly what the kernel will expect.
the kernel expects a pointer to a device tree instead of a
bd_t. The 8349EMDS device tree source is now in linux/arch/powerpc/boot/dts. You'll need the device tree compiler (dtc) from jdl.com to build your flat device tree binary (dtb; what the kernel expects).
And you should read:
linux-2.6/Documentation/powerpc/booting-without-of.txt
jdl
Quoted 10 lines · On Tue, 12 Sep 2006 17:33:16 +0200 Fredrik Roubert <[email protected]> wrote:
Hi!
I have a custom board on which I currently run Linux 2.6.18-rc6 configured for
MPC834x_SYSin the /ppc/ tree, which just a few minor changes. Now I'm interested to move to using the /powerpc/ source tree instead, but I can't figure out exactly what steps are necessary to do this.Does anyone run a
MPC834x_SYSbuilt with ARCH=powerpc?
Actually it was the first ppc board actually moved over to powerpc.
Quoted 3 lines
I boot the board with U-Boot (version 1.1.4, customized), and I assume that I need to add some stuff for this new device tree thing, but I can't figure out exactly what the kernel will expect.
You'll need to replace u-boot with custom one that is able to deal with dts. There are 2 ways ATM - use bootm dts approach, which could load device tree from external source, and built-in that makes in compiled into u-boot.
Both patches against u-boot should be searched in u-boot mailing list archives. For 83xx both way work just fine.
Signature · 2 lines
Sincerely, Vitaly
Quoted 1 line · Kim Phillips
The 8349EMDS device tree source is now in linux/arch/powerpc/boot/dts.
Is that the right dts to use for a MPC8349SYS board?
I tried compiling it like this:
$ dtc -f -I dts -O dtb mpc8349emds.dts > devices.dtb DTC: dts->dtb on file "mpc8349emds.dts" Warning: No cpu has "linux,boot-cpu" property ERROR: Missing /chosen node Input tree has errors
Is that really correct? Should I invoke dtc in some other way or modify the dts or use some other dts file?
Quoted 7 lines
Matt's u-boot patches address the issue well for 85xx, they are straightforward to adapt to 83xx:
http://sourceforge.net/mailarchive/forum.php?thread_id=15518792&forum_id=12898
they allow you to tftp the dtb into mem, and "bootm ${loadaddr} - ${oftaddr}" to start an ARCH=powerpc kernel.
OK, I've adapted and applied those patches now. However, when I try to boot with the dtd I generated above, then the kernel just hangs. For now, I assume that is because of errors in the dtd and not in u-boot ...
Cheers // Fredrik Roubert
Signature · 2 lines
Visserij 192 | +32 473 344527 / +46 708 776974 BE-9000 Gent | http://www.df.lth.se/~roubert/
Quoted 8 lines · Fredrik Roubert
Quoted 1 line · Kim Phillips
The 8349EMDS device tree source is now in linux/arch/powerpc/boot/dts.
Is that the right dts to use for a MPC8349SYS board?
I tried compiling it like this:
Quoted 8 lines
$ dtc -f -I dts -O dtb mpc8349emds.dts > devices.dtb DTC: dts->dtb on file "mpc8349emds.dts" Warning: No cpu has "linux,boot-cpu" property ERROR: Missing /chosen node Input tree has errorsIs that really correct? Should I invoke dtc in some other way or modify the dts or use some other dts file?
You must use the -V 16 flag too. Likely, -b 0 as well.
jdl
Quoted 5 lines · Fredrik Roubert
OK, I've adapted and applied those patches now. However, when I try to boot with the dtd I generated above, then the kernel just hangs. For now, I assume that is because of errors in the dtd and not in u-boot ...
Could you supply us with the output form u-boot before starting the kernel?
-Matthew
Hi!
Now I've written an adapted DTS (see attachment) for my custom board, based on the mpc8349emds.dts from the kernel source. I use Matthew McClintock's patches to U-Boot to load the kernel with the DTD.
I compile the DTS using the following command line:
dtc -V 16 -I dts -O dtb px5500.dts > px5500.dtb
I've compiled an unmodified 2.6.18 kernel configured for powerpc and the MPC834x SYS platform. The system boots OK and I can log in using SSH. However, I have problems with the serial console. During boot, I get the following printout:
Booting using flat device tree at 0x400000
Using MPC834x SYS machine description
Linux version 2.6.18 (frer@milou) (gcc version 4.1.1) #1 PREEMPT Thu Sep 21 17:31:30 CEST 2006setup_arch: bootmemmpc834x_sys_setup_arch()
Found MPC83xx PCI host bridge at 0x00000000ff408500. Firmware bus number: 0->0
arch: exit
Built 1 zonelists. Total pages: 32768
Kernel command line: root=/dev/nfs rw nfsroot=150.158.215.227:/home/rootfs/dev-ds ip=150.158.211.83:150.158.215.227:150.158.212.1:255.255.248.0:dev-ds:eth0:off console=ttyS0,115200 console=ttyS0,115200 rtc-x1205.force=0,0x6f IPIC (128 IRQ sources) at fdefc700
PID hash table entries: 1024 (order: 10, 4096 bytes)
The serial console stops working after the call to console_init().
Except for the serial console, the system seems to be running fine. Does anyone have any ideas about what might be wrong and how I could try to track this problem down?
Cheers // Fredrik Roubert
Signature · 2 lines
Visserij 192 | +32 473 344527 / +46 708 776974 BE-9000 Gent | http://www.df.lth.se/~roubert/
/ {
model = "PX5500";
#address-cells = <1>;
#size-cells = <1>;
cpus {
#cpus = <1>;
#address-cells = <1>;
#size-cells = <0>;
PowerPC,8349@0 {
device_type = "cpu";
reg = <0>;
d-cache-line-size = <20>; // 32 bytes
i-cache-line-size = <20>; // 32 bytes
d-cache-size = <8000>; // L1, 32K
i-cache-size = <8000>; // L1, 32K
timebase-frequency = <0>; // from bootloader
bus-frequency = <0>; // from bootloader
clock-frequency = <0>; // from bootloader
32-bit;
linux,boot-cpu;
};
};
memory {
device_type = "memory";
reg = <00000000 08000000>; // 128MB at 0
};
chosen {
name = "chosen";
linux,platform = <00000600>;
linux,stdout-path = "/soc8349@ff400000/serial@4500";
bootargs = "root=/dev/nfs rw nfsroot=150.158.215.227:/home/rootfs/dev-ds ip=150.158.211.83:150.158.215.227:150.158.212.1:255.255.248.0:dev-ds:eth0:off console=ttyS0,115200 console=ttyS0,115200 rtc-x1205.force=0,0x6f";
};
soc8349@ff400000 {
#address-cells = <1>;
#size-cells = <1>;
#interrupt-cells = <2>;
device_type = "soc";
ranges = <0 ff400000 00100000>;
reg = <ff400000 00000200>;
bus-frequency = <0>;
i2c@3000 {
device_type = "i2c";
compatible = "fsl-i2c";
reg = <3000 100>;
interrupts = <e 8>;
interrupt-parent = <700>;
dfsrr;
};
mdio@24520 {
device_type = "mdio";
compatible = "gianfar";
reg = <24520 20>;
#address-cells = <1>;
#size-cells = <0>;
linux,phandle = <24520>;
ethernet-phy@0 {
linux,phandle = <2452000>;
interrupt-parent = <700>;
interrupts = <11 2>;
reg = <1>;
device_type = "ethernet-phy";
};
ethernet-phy@1 {
linux,phandle = <2452001>;
interrupt-parent = <700>;
interrupts = <12 2>;
reg = <3>;
device_type = "ethernet-phy";
};
};
ethernet@24000 {
device_type = "network";
model = "TSEC";
compatible = "gianfar";
reg = <24000 1000>;
address = [ 00 00 00 00 00 00 ];
local-mac-address = [ 00 11 00 11 ff a1 ];
interrupts = <20 8 21 8 22 8>;
interrupt-parent = <700>;
phy-handle = <2452000>;
};
ethernet@25000 {
#address-cells = <1>;
#size-cells = <0>;
device_type = "network";
model = "TSEC";
compatible = "gianfar";
reg = <25000 1000>;
address = [ 00 00 00 00 00 00 ];
local-mac-address = [ 00 11 00 11 ff a2 ];
interrupts = <23 8 24 8 25 8>;
interrupt-parent = <700>;
phy-handle = <2452001>;
};
serial@4500 {
device_type = "serial";
compatible = "ns16550";
reg = <4500 100>;
clock-frequency = <0>;
interrupts = <9 8>;
interrupt-parent = <700>;
};
serial@4600 {
device_type = "serial";
compatible = "ns16550";
reg = <4600 100>;
clock-frequency = <0>;
interrupts = <a 8>;
interrupt-parent = <700>;
};
pci@8500 {
interrupt-map-mask = <f800 0 0 7>;
interrupt-map = <
/* IDSEL 0x0e */
7000 0 0 1 700 17 8
7000 0 0 2 700 00 8
7000 0 0 3 700 00 8
7000 0 0 4 700 00 8>;
interrupt-parent = <700>;
interrupts = <42 8>;
bus-range = <0 0>;
ranges = <02000000 0 a0000000 a0000000 0 10000000
42000000 0 80000000 80000000 0 10000000
01000000 0 00000000 e2000000 0 00100000>;
clock-frequency = <3f940aa>;
#interrupt-cells = <1>;
#size-cells = <2>;
#address-cells = <3>;
reg = <8500 100>;
compatible = "83xx";
device_type = "pci";
};
/* IPIC
* interrupts cell = <intr #, sense>
* sense values match linux IORESOURCE_IRQ_* defines:
* sense == 8: Level, low assertion
* sense == 2: Edge, high-to-low change
*/
pic@700 {
linux,phandle = <700>;
interrupt-controller;
#address-cells = <0>;
#interrupt-cells = <2>;
reg = <700 100>;
built-in;
device_type = "ipic";
};
};
};Quoted 9 lines · Fredrik Roubert
chosen {
name = "chosen";
linux,platform = <00000600>;
linux,stdout-path = "/soc8349@ff400000/serial@4500";
bootargs = "root=/dev/nfs rw
nfsroot=150.158.215.227:/home/rootfs/dev-ds
ip=150.158.211.83:150.158.215.227:150.158.212.1:255.255.248.0:dev-ds:eth0:off console=ttyS0,115200 console=ttyS0,115200 rtc-x1205.force=0,0x6f";
};Fredrik,
It looks like you already have your chosen node in your DTS file. With my u-boot patches the appropriate chosen node is added to the flat tree based off the u-boot environment.
-Matthew
Quoted 3 lines · Matthew McClintock
It looks like you already have your chosen node in your DTS file. With my u-boot patches the appropriate chosen node is added to the flat tree based off the u-boot environment.
Ah, that's true, in ft_setup(), I didn't see that. Thanks! (I'd been thinking about how the command line should be passed from U-Boot, but decided to postpone that investigation until I solved the serial console problem.)
However, the code in ft_setup() doesn't assign "linux,stdout-path", so if I remove the chosen node from my DTS, then I get no print-out on the serial console at all. (But the rest of the system appears to run fine and I can log in using SSH.) Can this be a clue to someone as to what could be the problem with my serial console?
Cheers // Fredrik Roubert
Signature · 2 lines
Visserij 192 | +32 473 344527 / +46 708 776974 BE-9000 Gent | http://www.df.lth.se/~roubert/
Quoted 11 lines · Fredrik Roubert
Quoted 3 lines · Matthew McClintock
It looks like you already have your chosen node in your DTS file. With my u-boot patches the appropriate chosen node is added to the flat tree based off the u-boot environment.
Ah, that's true, in
ft_setup(), I didn't see that. Thanks! (I'd been thinking about how the command line should be passed from U-Boot, but decided to postpone that investigation until I solved the serial console problem.)
Quoted 8 lines
However, the code in
ft_setup()doesn't assign "linux,stdout-path", so if I remove the chosen node from my DTS, then I get no print-out on the serial console at all. (But the rest of the system appears to run fine and I can log in using SSH.) Can this be a clue to someone as to what could be the problem with my serial console?From
u-boot/common/ft_build.c:
#ifdef OF_STDOUT_PATH
ft_prop_str(&cxt, "linux,stdout-path", OF_STDOUT_PATH);#endif
There is a define for adding that to the /chosen node. Add this to your u-boot include file and the console should show up.
Good Luck.
-Matthew
Quoted 3 lines · Matthew McClintock
#ifdef OF_STDOUT_PATH ft_prop_str(&cxt, "linux,stdout-path", OF_STDOUT_PATH);#endif
Great! I had missed those lines (while manually applying your patches to my own modified U-Boot 1.1.4 sources) ...
Now I'm back to the state of last Thursday (except for getting rid of the unnecessary chosen node and getting bootargs passed nicely), which means that the serial console initially works, but stops working after the call to console_init() in start_kernel().
Cheers // Fredrik Roubert
Signature · 2 lines
Visserij 192 | +32 473 344527 / +46 708 776974 BE-9000 Gent | http://www.df.lth.se/~roubert/
Quoted 4 lines · Fredrik Roubert
Now I'm back to the state of last Thursday (except for getting rid of the unnecessary chosen node and getting bootargs passed nicely), which means that the serial console initially works, but stops working after the call to
console_init()instart_kernel().
Do you have all the other OF related defines in your u-boot config file?
#define OF_CPU "PowerPC,8540@0" #define OF_SOC "soc8540@e0000000" #define OF_TBCLK (bd->bi_busfreq / 8) #define OF_STDOUT_PATH "/soc8540@e0000000/serial@4500"
Maybe you are not properly setting up entries in the flat device tree passed to the kernel. So when the kernel takes over and re-initializes the serial port the speed is all messed up.
Can you verify the flat device tree passed to the kernel is correct? Specifically these properties:
timebase-frequency = <0>; // from bootloader
bus-frequency = <0>; // from bootloader
clock-frequency = <0>; // from bootloader-Matthew
Quoted 6 lines · Matthew McClintock
Can you verify the flat device tree passed to the kernel is correct? Specifically these properties:
timebase-frequency = <0>; // from bootloader bus-frequency = <0>; // from bootloader clock-frequency = <0>; // from bootloader
Right on target! These values were not set up correctly, and after fixing that I can now boot an unmodified powerpc 2.6.18 kernel.
Thank you so very much!
Are your flat device tree patches going to be included in the mainline U-Boot in the future, or is it likely that some other method will be used?
Cheers // Fredrik Roubert
Signature · 2 lines
Visserij 192 | +32 473 344527 / +46 708 776974 BE-9000 Gent | http://www.df.lth.se/~roubert/
Quoted 6 lines · Fredrik Roubert
Quoted 4 lines
Matt's u-boot patches address the issue well for 85xx, they are straightforward to adapt to 83xx:
http://sourceforge.net/mailarchive/forum.php?thread_id=15518792&forum_id=12898
OK, I've adapted and applied those patches now.
In case someone else also is interested in using Matt's flat device tree patches with U-Boot 1.1.4, I've posted my backport of the relevant parts of the patch to the u-boot-users mailing list now.
Cheers // Fredrik Roubert
Signature · 2 lines
Visserij 192 | +32 473 344527 / +46 708 776974 BE-9000 Gent | http://www.df.lth.se/~roubert/