本文涉及 SSD202 做为主处理器芯片。
1 硬件设计
-
拥有一路内置MAC+PHY电路的接口,P107-109,实现100M网口。
-
拥有一路内置MAC的接口,它与TTL-RGB接口复用,外接PHY芯片IP01GR。
理论上,该处理器可以实现基础2个网口功能。
2 内核设置
2.1 DTS配置
2.1.1 引脚配置
ETH0:arch\arm\boot\dts\infinity2m-ssc011a-s01a-padmux-display-doubleNet.dtsi
固定功能引脚,不复用。
//<PAD_ETH_RN >, // ETH: default not-GPIO
//<PAD_ETH_RP >, // ETH: default not-GPIO
//<PAD_ETH_TN >, // ETH: default not-GPIO
//<PAD_ETH_TP >, // ETH: default not-GPIO
ETH1: arch\arm\boot\dts\infinity2m-ssc011a-s01a-padmux-rgb565-rmii-doublenet.dtsi,注意:有其它文件使用PINMUX_FOR_ETH1_MODE_3不确定具体用哪个。
<PAD_GPIO0 PINMUX_FOR_ETH1_MODE_4 MDRV_PUSE_NA >,
<PAD_GPIO1 PINMUX_FOR_ETH1_MODE_4 MDRV_PUSE_NA >,
<PAD_TTL16 PINMUX_FOR_GPIO_MODE MDRV_PUSE_EMAC1_PHY_RESET>,
<PAD_TTL17 PINMUX_FOR_ETH1_MODE_4 MDRV_PUSE_NA >,
<PAD_TTL18 PINMUX_FOR_ETH1_MODE_4 MDRV_PUSE_NA >,
<PAD_TTL19 PINMUX_FOR_ETH1_MODE_4 MDRV_PUSE_NA >,
<PAD_TTL20 PINMUX_FOR_ETH1_MODE_4 MDRV_PUSE_NA >,
<PAD_TTL21 PINMUX_FOR_ETH1_MODE_4 MDRV_PUSE_NA >,
<PAD_TTL22 PINMUX_FOR_ETH1_MODE_4 MDRV_PUSE_NA >,
<PAD_TTL23 PINMUX_FOR_ETH1_MODE_4 MDRV_PUSE_NA >,
通过上面定义处理器的网络相关引脚。
2.1.2 网络功能支持
参考自 : infinity2m-doublenet.dtsi
emac0: emac0 {
compatible = "sstar-emac";
interrupts = <GIC_SPI INT_IRQ_EMAC IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI INT_FIQ_LAN_ESD IRQ_TYPE_LEVEL_HIGH>;
clocks = <&CLK_emac_ahb>,<&CLK_emac_tx>,<&CLK_emac_rx>;
reg = <0x1F2A2000 0x800>, <0x1F343C00 0x600>, <0x1F006200 0x600>;
pad = <0x1F203C38 0x0001 0x0000>; // pad selection from 0x0001
phy-handle = <&phy0>;
status = "ok";
mdio-bus@emac0 {
phy0: ethernet-phy@0 {
phy-mode = "mii";
};
};
};
emac1: emac1 {
compatible = "sstar-emac";
interrupts = <GIC_SPI INT_IRQ_EMAC_1 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI INT_FIQ_LAN_ESD IRQ_TYPE_LEVEL_HIGH>;
clocks = <&CLK_emac_ahb>,<&CLK_emac1_tx>,<&CLK_emac1_rx>,<&CLK_emac1_tx_ref>,<&CLK_emac1_rx_ref>;
reg = <0x1F2A2800 0x800>, <0x1F344200 0x600>, <0x00000000 0x000>;
pad = <0x1F203C38 0x0F00 0x0300>; // pad selection from 0x0100/0x0200/0x0300/0x0400/0x0500/0x0600/0x0700/0x0800/0x0900
status = "ok";
phy-handle = <&phy1>;
mdio-bus@emac1 {
phy1: ethernet-phy@1 {
phy-mode = "rmii";
};
};
};
2.2 内核配置
ETH0 芯片网卡驱动支持:
EMAC
SSTAR 10/100 PHYs
ETH1:
开启IP101的驱动支持 ICPlus PHYs
2 系统启动
网络相关的:
libphy.ko mii.ko of_mdio.ko kdrv_emac.ko
ETH0:
kdrv_emac.ko sstar_100_phy.ko
ETH1
icplus.ko*
kdrv_emac 30335 0 - Live 0xbf977000
sstar_100_phy 1890 1 - Live 0xbf89b000
of_mdio 5815 3 kdrv_emac, Live 0xbf972000
fixed_phy 2661 1 of_mdio, Live 0xbf897000
libphy 24566 5 kdrv_emac,sstar_100_phy,of_mdio,fixed_phy, Live 0xbf88c000
# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:30:1B:BA:02:DB
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:35
eth1 Link encap:Ethernet HWaddr 00:30:1B:BA:02:DB
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:37
lo Link encap:Local Loopback
LOOPBACK MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
# ifconfig eth0 192.168.250.139 netmask 255.255.255.0 up
# ip route add default dev eth0
# ping 192.168.250.1
PING 192.168.250.1 (192.168.250.1): 56 data bytes
64 bytes from 192.168.250.1: seq=0 ttl=64 time=1.479 ms
64 bytes from 192.168.250.1: seq=1 ttl=64 time=0.308 ms