Hi,
I'm trying to bring up my T113-s3 based board and cannot get the EMAC
to initialize.
Some info about my board:
I'm using a RTL8201F phy on the PG pins in RMII mode and want to use
the EPHY-25M clock output on PG11 to drive the phy so no external
crystal is needed.
Kernel:
https://github.com/smaeul/linux.git at b466df90d48fb7ef03f331e0c73c8012ac03a12e
DTS snippets:
emac: ethernet@4500000 {
compatible = "allwinner,sun20i-d1-emac",
"allwinner,sun50i-a64-emac";
reg = <0x4500000 0x10000>;
interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "macirq";
clocks = <&ccu CLK_BUS_EMAC>;
clock-names = "stmmaceth";
resets = <&ccu RST_BUS_EMAC>;
reset-names = "stmmaceth";
syscon = <&syscon>;
status = "disabled";
mdio: mdio {
compatible = "snps,dwmac-mdio";
#address-cells = <1>;
#size-cells = <0>;
};
};
&pio {
rmii_pg_pins: rmii-pg-pins {
pins = "PG0", "PG1", "PG2", "PG3", "PG4",
"PG5", "PG11", "PG12", "PG13", "PG14", "PG15";
function = "emac";
};
};
&emac {
pinctrl-0 = <&rmii_pg_pins>;
pinctrl-names = "default";
phy-handle = <&rtl8201f>;
phy-mode = "rmii";
phy-supply = <®_vcc_3v3>;
clocks = <&ccu CLK_BUS_EMAC>, <&ccu CLK_EMAC_25M>;
clock-names = "stmmaceth", "ephy25m";
status = "okay";
};
&mdio {
status = "okay";
reset-gpios = <&pio 6 7 GPIO_ACTIVE_LOW>; /* PG7 */
reset-assert-us = <10000>;
reset-post-delay-us = <150000>;
reset-deassert-us = <150000>;
rtl8201f: ethernet-phy@0 {
compatible = "ethernet-phy-id001c.c816"; /* RTL8201F */
reg = <0>;
};
};
When the kernel driver loads, I end up with sun8i_dwmac_reset() failing because bit 0 in EMAC_BASIC_CTL1 is stuck on and never self-clears:
[ 1.984000] dwmac-sun8i 4500000.ethernet: EMAC reset timeout
I can also manually attempt to bring the EMAC online with:
$ sudo devmem 0x0200197c 32 0x00000000 #EMAC_BGR_REG reset
$ sudo devmem 0x0200197c 32 0x00010000 #EMAC_BGR_REG enable clock
$ sudo devmem 0x0200197c 32 0x00010001 #EMAC_BGR_REG release reset
$ sudo devmem 0x02001970 32 0xc0000000 #EMAC_25M_CLK_REG setup EPHY-25M
$ sudo devmem 0x03000030 32 0x00012000 #EMAC_EPHY_CLK_REG0 setup RMII mode, external PHY
$ sudo devmem 0x04500004 32 0x08000001 #EMAC_BASIC_CTL1 attempt soft reset
pinctrl is setup:
$ sudo devmem 0x02000120 32
0x1F444444
$ sudo devmem 0x02000124 32
0x44444FFF
clocks and reset:
$ sudo devmem 0x0200197c 32
0x00010001
$ sudo devmem 0x02001970 32
0xC0000000
syscon:
$ sudo devmem 0x03000030 32
0x00012000
soft reset is stuck:
$ sudo devmem 0x04500004 32
0x08000001
Has anyone succesfully got the T113/D1 EMAC to work, especially in RMII mode?
--
Dave