最近升级LTIB的kernel,原来是2.6.23,这也是8313的最新BSP支持的版本,太老了,很多bug。还有一个原因就是,8313的Silicon Revision从Rev.A 到Rev.C修正了好多bug,软件还没有改,我在用新Silicon发现网络,USB,RTC都有问题。比如Rev.C中USB只支持24M和48M晶振,2.6.23中arch/powerpc/platform/83xx/usb.c居然只有48M,虽然也有补丁,但是Freescale的Linux kernel developer实在不怎么样。
废话少说,先试2.6.29,因为dts文件从这个版本开始和2.6.23有比较大的区别。
旧的DTS中网络部分例子
mdio@24520 {
device_type = "mdio";
compatible = "gianfar";
reg = <24520 20>;
#address-cells = <1>;
#size-cells = <0>;
linux,phandle = <24520>;
ethernet-phy@0 {
linux,phandle = <2452001>;
interrupt-parent = < &ipic >;
interrupts = <13 2>;
reg = <0>;
device_type = "ethernet-phy";
};
ethernet-phy@1 {
linux,phandle = <2452004>;
interrupt-parent = < &ipic >;
interrupts = <14 2>;
reg = <1>;
device_type = "ethernet-phy";
};
};
ptimer: ptimer@24e00 {
device_type = "timer";
reg = <24e00 b0>;
};
ethernet@24000 {
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <24000 1000>;
ptimer-handle = < &ptimer >;
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = <25 8 24 8 23 8>;
interrupt-parent = < &ipic >;
phy-handle = <2452001>;
sleep = <b00 20000000>;
fsl,magic-packet;
};
ethernet@25000 {
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <25000 1000>;
ptimer-handle = < &ptimer >;
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = <22 8 21 8 20 8>;
interrupt-parent = < &ipic >;
phy-handle = <2452004>;
sleep = <b00 10000000>;
fsl,magic-packet;
};
而2.6.29的dts我修改后是
enet0: ethernet@24000 {
#address-cells = <1>;
#size-cells = <1>;
sleep = <&pmc 0x20000000>;
ranges;
cell-index = <0>;
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <0x24000 0x1000>;
local-mac-address = [ 00 01 02 03 04 05 ];
interrupts = <37 0x8 36 0x8 35 0x8>;
interrupt-parent = <&ipic>;
tbi-handle = < &tbi0 >;
phy-handle = < &phy0 >;
fsl,magic-packet;
mdio@24520 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,gianfar-mdio";
reg = <0x24520 0x20>;
phy0: ethernet-phy@0 {
interrupt-parent = <&ipic>;
interrupts = <20 0x8>;
reg = <0x0>;
device_type = "ethernet-phy";
};
tbi0: tbi-phy@11 {
reg = <0x11>;
device_type = "tbi-phy";
};
};
};
enet1: ethernet@25000 {
#address-cells = <1>;
#size-cells = <1>;
cell-index = <1>;
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <0x25000 0x1000>;
local-mac-address = [ 06 07 08 09 0a 0b ];
interrupts = <34 0x8 33 0x8 32 0x8>;
interrupt-parent = <&ipic>;
tbi-handle = < &tbi1 >;
phy-handle = < &phy1 >;
sleep = <&pmc 0x10000000>;
fsl,magic-packet;
mdio@25520 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,gianfar-mdio";
reg = <0x25520 0x20>;
phy1: ethernet-phy@1 {
interrupt-parent = <&ipic>;
interrupts = <20 0x8>;
reg = <0x1>;
device_type = "ethernet-phy";
};
tbi1: tbi-phy@11 {
reg = <0x11>;
device_type = "tbi-phy";
};
};
};
可以看到,在新格式下,每个PHY都要建一个mdio节点,其中,mdio中子节点的reg代表此PHY在MDIO的总线地址,必须和节点开始符合,比如phy1: ethernet-phy@1,那么reg必须是1,不能是别的。还有TBI节点是新出现的,以前没有。新Silicon和旧Silicon的中断不一样,以上interrupts = <34 0x8 33 0x8 32 0x8>;是旧的,新Silicon必须改写,参见官方文档,freescale的东西经常有bug,文档还少,再次表示愤慨。。。
备注说明:
上面说的不完全准确,如果MDIO没有连接到25520,启动的时候内核会报错,这个要看具体硬件连接了,8313ERDB的评估板只用了24520,如果两个PHY都连在这个地址,需要把第一个MDIO里面增加一个eth1,这个可以举一反三。
V1的device tree 十六进制都要加0x前缀,这个和以前不一样。