This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM6442: CPSW Ethernet U-boot

Part Number: AM6442
Other Parts Discussed in Thread: DP83869

Hi,

I have a custom PCB with AM6442 SoC and a DP83869 PHY connected to CPSW.

The interface is 1000M RGMII, copper.

I'm using Linux SDK 08.00.00.004.

I'm trying to bring up the ehternet interface in U-boot.

I could not find a driver for this PHY in the SDK, so I'm using the following patch:

https://patches.linaro.org/project/u-boot/patch/20200420185310.6630-3-dmurphy@ti.com/

I had to fix this patch in order to work in U-boot, for example:

* Usage of CONFIG_OF_MDIO, which is never defined in U-boot, this is a Linux macro. (replaced it with CONFIG_DM_ETH).

* Usage of of_property_read_u32 and of_property_read_bool, which are Linux kernel functions, not U-boot's (replaced with the U-boot equivalent ofnode_read_u32 and ofnode_read_bool)

* Some differences in struct dp83869_private and ofnode of_node.

After All these changes, U-boot compiles without any error or warnings.

But, when I use this U-boot, I get am65_cpsw_nuss_slave errors:

Net:   phy_device_create, PHY probe failed
phy_device_create, PHY probe failed
phy_device_create, PHY probe failed
phy_device_create, PHY probe failed
phy_device_create, PHY probe failed
phy_device_create, PHY probe failed
Could not get PHY for ethernet@8000000: addr 0
am65_cpsw_nuss_slave ethernet@8000000: phy_connect() failed
No ethernet found.

I tried to debug this, without success.

I tried to use generic PHY driver and implement a board_phy_config function in my board directory.

I wrote to the MDIO register following DP83869's datasheet instructions(RGMII to COPPER) without sucess

https://www.ti.com/lit/ds/symlink/dp83869hm.pdf#page=38

Datasheet instructions:

9.4.8.1 RGMII-to-Copper Ethernet Mode
After configuring register 0x01DF, perform the following operations.
• Write 0x1140 to register 0x0000
• Write 0x5048 to register 0x0010
• Write 0x0B00 to register 0x0009

Attaching registers dump:

=> mii read 0 0
1140

=> mii read 0 0x10
5048

=> mii read 0 0x9
0B00


=> mii dump 0 0
0.     (1140)                 -- PHY control register --
  (8000:0000) 0.15    =     0     reset
  (4000:0000) 0.14    =     0     loopback
  (2040:0040) 0. 6,13 =   b10    speed selection = 1000 Mbps
  (1000:1000) 0.12    =     1     A/N enable
  (0800:0000) 0.11    =     0     power-down
  (0400:0000) 0.10    =     0     isolate
  (0200:0000) 0. 9    =     0     restart A/N
  (0100:0100) 0. 8    =     1     duplex = full
  (0080:0000) 0. 7    =     0     collision test enable
  (003f:0000) 0. 5- 0 =     0     (reserved)


=> mii dump 0 1
1.     (796d)                 -- PHY status register --
  (8000:0000) 1.15    =     0     100BASE-T4 able
  (4000:4000) 1.14    =     1     100BASE-X  full duplex able
  (2000:2000) 1.13    =     1     100BASE-X  half duplex able
  (1000:1000) 1.12    =     1     10 Mbps    full duplex able
  (0800:0800) 1.11    =     1     10 Mbps    half duplex able
  (0400:0000) 1.10    =     0     100BASE-T2 full duplex able
  (0200:0000) 1. 9    =     0     100BASE-T2 half duplex able
  (0100:0100) 1. 8    =     1     extended status
  (0080:0000) 1. 7    =     0     (reserved)
  (0040:0040) 1. 6    =     1     MF preamble suppression
  (0020:0020) 1. 5    =     1     A/N complete
  (0010:0000) 1. 4    =     0     remote fault
  (0008:0008) 1. 3    =     1     A/N able
  (0004:0004) 1. 2    =     1     link status
  (0002:0000) 1. 1    =     0     jabber detect
  (0001:0001) 1. 0    =     1     extended capabilities
  
  
  
  
 

Then, I try to use dhcp command without success:

=> dhcp
ethernet@8000000 Waiting for PHY auto negotiation to complete.. done
link up on port 1, speed 1000, full duplex
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
BOOTP broadcast 6
BOOTP broadcast 7
BOOTP broadcast 8
BOOTP broadcast 9
BOOTP broadcast 10
BOOTP broadcast 11

I suspect that MAC is not sending the packets, I sniffed the network from a different machine in the same LAN, and got nothing..

The ethernet interface works in Linux, so this is a SW issue

# udhcpc
udhcpc: started, v1.31.1
[   11.960157] TI DP83869 8000f00.mdio:00: attached PHY driver [TI DP83869] (mii_bus:phy_addr=8000f00.mdio:00, irq=POLL)
[   11.973963] am65-cpsw-nuss 8000000.ethernet eth0: Link is Down
udhcpc: sending discover
udhcpc: sending discover
[   16.066844] am65-cpsw-nuss 8000000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
udhcpc: sending discover
udhcpc: sending select for 192.168.15.118
udhcpc: lease of 192.168.15.118 obtained, lease time 86400
deleting routers
adding dns 192.168.15.1
# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=115 time=53.0 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=115 time=52.7 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=115 time=52.1 ms

How can I fix this?

Thanks.

  • Update,

    I'm getting responses to the bootp packets, but all the responses are filtered.

    U-boot output: (DEBUG enabled for clocks and bootp)

    => dhcp
    clk_enable(clk=00000000bdee2048)
    clk_set_defaults(dma-controller@485c0000)
    clk_set_default_parents: could not read assigned-clock-parents for 00000000bdeda590
    link up on port 1, speed 1000, full duplex
    BOOTP broadcast 1
    DHCPHandler: got packet: (src=5353, dst=5353, len=39) state: 3
    Filtering pkt = -1
    DHCPHandler: got packet: (src=5353, dst=5353, len=39) state: 3
    Filtering pkt = -1
    BOOTP broadcast 2
    DHCPHandler: got packet: (src=137, dst=137, len=50) state: 3
    Filtering pkt = -1
    DHCPHandler: got packet: (src=5353, dst=5353, len=39) state: 3
    Filtering pkt = -1
    DHCPHandler: got packet: (src=5353, dst=5353, len=39) state: 3
    Filtering pkt = -1
    DHCPHandler: got packet: (src=63091, dst=5355, len=33) state: 3
    Filtering pkt = -1
    DHCPHandler: got packet: (src=55156, dst=5355, len=33) state: 3
    Filtering pkt = -1
    DHCPHandler: got packet: (src=137, dst=137, len=50) state: 3
    Filtering pkt = -1
    BOOTP broadcast 3
    DHCPHandler: got packet: (src=63091, dst=5355, len=33) state: 3
    Filtering pkt = -1
    DHCPHandler: got packet: (src=55156, dst=5355, len=33) state: 3
    Filtering pkt = -1
    DHCPHandler: got packet: (src=137, dst=137, len=50) state: 3
    Filtering pkt = -1
    DHCPHandler: got packet: (src=5353, dst=5353, len=39) state: 3
    Filtering pkt = -1
    DHCPHandler: got packet: (src=5353, dst=5353, len=39) state: 3
    Filtering pkt = -1
    BOOTP broadcast 4
    DHCPHandler: got packet: (src=137, dst=137, len=50) state: 3
    Filtering pkt = -1
    DHCPHandler: got packet: (src=137, dst=137, len=50) state: 3
    Filtering pkt = -1
    DHCPHandler: got packet: (src=5353, dst=5353, len=39) state: 3
    Filtering pkt = -1
    DHCPHandler: got packet: (src=58852, dst=5355, len=33) state: 3
    Filtering pkt = -1
    DHCPHandler: got packet: (src=58852, dst=5355, len=33) state: 3
    Filtering pkt = -1
    
    Abort
    

  • Found the problem.

    I had to configure the following PHY registers:

    0x0, 0x9, 0x10, 0x1df, 0x86, 0x32