2021-08-04 08:51 AM
Hello!
I have an issue on a custom board with STM32MP153CAB and KSZ8081RNB.
TF-A, FIP and kernel were built in Developer package. Linux distribution was built as startard configuration st-image-core in Distribution package.
Clocks and device trees are configured like specified in https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration#RMII_with_25MHz_on_ETH_CLK_-28no_PHY_Crystal-29-2C_REF_CLK_from_PHY_-28Reference_clock_-28standard_RMII_clock_name-29_is_provided_by_a_RCC_SoC_internal_clock-29
Here are fragments of device tree for U-Boot and kernel (generated by STM32CubeIDE and manually edited):
eth1_pins_mx: eth1_mx-0 {
pins1 {
pinmux = <STM32_PINMUX('A', 1, AF11)>, /* ETH1_REF_CLK */
<STM32_PINMUX('C', 1, AF11)>, /* ETH1_MDC */
<STM32_PINMUX('G', 8, AF2)>, /* ETH1_CLK */
<STM32_PINMUX('G', 13, AF11)>, /* ETH1_TXD0 */
<STM32_PINMUX('G', 14, AF11)>; /* ETH1_TXD1 */
bias-disable;
drive-push-pull;
slew-rate = <1>;
};
pins2 {
pinmux = <STM32_PINMUX('A', 2, AF11)>; /* ETH1_MDIO */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
pins3 {
pinmux = <STM32_PINMUX('A', 7, AF11)>, /* ETH1_CRS_DV */
<STM32_PINMUX('C', 4, AF11)>, /* ETH1_RXD0 */
<STM32_PINMUX('C', 5, AF11)>; /* ETH1_RXD1 */
bias-disable;
};
pins4 {
pinmux = <STM32_PINMUX('B', 11, AF11)>; /* ETH1_TX_EN */
};
};
eth1_sleep_pins_mx: eth1_sleep_mx-0 {
pins {
pinmux = <STM32_PINMUX('A', 1, ANALOG)>, /* ETH1_REF_CLK */
<STM32_PINMUX('A', 2, ANALOG)>, /* ETH1_MDIO */
<STM32_PINMUX('A', 7, ANALOG)>, /* ETH1_CRS_DV */
<STM32_PINMUX('B', 11, ANALOG)>, /* ETH1_TX_EN */
<STM32_PINMUX('C', 1, ANALOG)>, /* ETH1_MDC */
<STM32_PINMUX('C', 4, ANALOG)>, /* ETH1_RXD0 */
<STM32_PINMUX('C', 5, ANALOG)>, /* ETH1_RXD1 */
<STM32_PINMUX('G', 8, ANALOG)>, /* ETH1_CLK */
<STM32_PINMUX('G', 13, ANALOG)>, /* ETH1_TXD0 */
<STM32_PINMUX('G', 14, ANALOG)>; /* ETH1_TXD1 */
};
};
ðernet0{
pinctrl-names = "default", "sleep";
pinctrl-0 = <ð1_pins_mx>;
pinctrl-1 = <ð1_sleep_pins_mx>;
status = "okay";
/* USER CODE BEGIN ethernet0 */
phy-mode = "rmii";
max-speed = <100>;
phy-handle = <&phy0>;
local-mac-address = [XX XX XX XX XX XX];
mdio0 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "snps,dwmac-mdio";
phy0: ethernet-phy@1 {
reg = <1>;
clocks = <&rcc ETHCK_K>;
clock-names = "rmii-ref";
};
};
/* USER CODE END ethernet0 */
};
At first, I tested it in U-Boot.
After power on and reset it seems like MPU does not see PHY (and leds on RJ-45 are off). "mdio list" command shows only this:
ethernet@5800a000:
After I set ipaddr and make ping, leds on RJ-45 become on and the answer to ping is received. The same thing after dhcp or bootp command.
"mdio list" now shows:
ethernet@5800a000:
1 - Micrel KSZ8081 <--> ethernet@5800a000
When kernel loads, the following log appears:
...
[ 2.828774] stm32-dwmac 5800a000.ethernet: IRQ eth_lpi not found
[ 2.833564] stm32-dwmac 5800a000.ethernet: PTP uses main clock
[ 2.839294] stm32-dwmac 5800a000.ethernet: no reset control found
[ 2.845980] stm32-dwmac 5800a000.ethernet: User ID: 0x40, Synopsys ID: 0x42
[ 2.852185] stm32-dwmac 5800a000.ethernet: DWMAC4/5
[ 2.857216] stm32-dwmac 5800a000.ethernet: DMA HW capability register supported
[ 2.864426] stm32-dwmac 5800a000.ethernet: RX Checksum Offload Engine supported
[ 2.871772] stm32-dwmac 5800a000.ethernet: TX Checksum insertion supported
[ 2.878618] stm32-dwmac 5800a000.ethernet: Wake-Up On Lan supported
[ 2.884974] stm32-dwmac 5800a000.ethernet: TSO supported
[ 2.890173] stm32-dwmac 5800a000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[ 2.897994] stm32-dwmac 5800a000.ethernet: Enabled Flow TC (entries=2)
[ 2.904475] stm32-dwmac 5800a000.ethernet: TSO feature enabled
[ 2.910324] stm32-dwmac 5800a000.ethernet: Using 32 bits DMA width
[ 2.917336] libphy: stmmac: probed
...
[ 14.178529] stm32-dwmac 5800a000.ethernet eth0: PHY [stmmac-0:01] driver [Micrel KSZ8081 or KSZ8091] (irq=POLL)
[ 14.264265] stm32-dwmac 5800a000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported
[ 14.333679] stm32-dwmac 5800a000.ethernet eth0: registered PTP clock
[ 14.369464] stm32-dwmac 5800a000.ethernet eth0: configuring for phy/rmii link mode
...
And I can not make ethernet work in kernel though it must start work automatically with DHCP.
ifconfig says that link is up, but ethtool shows that link is not detected. Autonegotiation does not start on "ethtool -r eth0".
I launched the same linux image (with my builds of TF-A, FIP and device trees) on STM32MP157C-DK2 board. Ethernet starts work immediately after kernel booting or cable plugging in RJ-45. In U-Boot it works the same way as on my board.
What can be the isuue?
Solved! Go to Solution.
2021-09-16 01:08 AM
Thank you for help and tips!
2021-09-22 08:51 AM
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'