AM335X AR8031千兆能linkup,数据不通,百兆时正常

1、SDK使用的是ti-processor-sdk-linux-am335x-evm-02.00.01.07

2、原理图参考的是TMDSSK3358_3H0009_REV1_2B_SCH.pdf

3、下面是设备树的配置(网口部分),参考的是SDK软件包里的am335x-evmsk.dts

&mac {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&cpsw_default>;
pinctrl-1 = <&cpsw_sleep>;
//dual_emac = <1>;
status = "okay";
active_slave = <1>; // -> select EMAC1.
};

&davinci_mdio {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&davinci_mdio_default>;
pinctrl-1 = <&davinci_mdio_sleep>;
status = "okay";
};


&cpsw_emac1 {
phy_id = <&davinci_mdio>, <1>;
phy-mode = "rgmii-txid";
dual_emac_res_vlan = <1>;
};

cpsw_default: cpsw_default {
pinctrl-single,pins = <
/* Slave 2 */
0x40 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a0.rgmii2_tctl */
0x44 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a1.rgmii2_rctl */
0x48 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a2.rgmii2_td3 */
0x4c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a3.rgmii2_td2 */
0x50 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a4.rgmii2_td1 */
0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a5.rgmii2_td0 */
0x58 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a6.rgmii2_tclk */
0x5c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a7.rgmii2_rclk */
0x60 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a8.rgmii2_rd3 */
0x64 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a9.rgmii2_rd2 */
0x68 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a10.rgmii2_rd1 */
0x6c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a11.rgmii2_rd0 */

>;
};

cpsw_sleep: cpsw_sleep {
pinctrl-single,pins = <
/* Slave 2 reset value*/
0x40 (PIN_INPUT_PULLDOWN | MUX_MODE7)
0x44 (PIN_INPUT_PULLDOWN | MUX_MODE7)
0x48 (PIN_INPUT_PULLDOWN | MUX_MODE7)
0x4c (PIN_INPUT_PULLDOWN | MUX_MODE7)
0x50 (PIN_INPUT_PULLDOWN | MUX_MODE7)
0x54 (PIN_INPUT_PULLDOWN | MUX_MODE7)
0x58 (PIN_INPUT_PULLDOWN | MUX_MODE7)
0x5c (PIN_INPUT_PULLDOWN | MUX_MODE7)
0x60 (PIN_INPUT_PULLDOWN | MUX_MODE7)
0x64 (PIN_INPUT_PULLDOWN | MUX_MODE7)
0x68 (PIN_INPUT_PULLDOWN | MUX_MODE7)
0x6c (PIN_INPUT_PULLDOWN | MUX_MODE7)
>;
};

5 个回复

  • 状元 193057 points
    请先检查 一下网口电路那块有没有虚焊的地方?网口时钟是多少?打印信息是什么?
  • 回复 Shine:

    1、用示波器测试RGMII的TX_CLK和RX_CLK,频率都是125MHZ

    2、AR8031的mode配置如下(和DEMO参考原理图一致)

    0000 1000 BASE-T, RGMII

    3、下面是启动打印信息

    Uncompressing Linux... done, booting the kernel.
    [ 0.000000] Booting Linux on physical CPU 0x0
    [ 0.000000] Initializing cgroup subsys cpuset
    [ 0.000000] Initializing cgroup subsys cpu
    [ 0.000000] Initializing cgroup subsys cpuacct
    [ 0.000000] Linux version 4.1.13M_CPU_AM_V1.0.0.3-g8dc6617 (gk@ubuntu64) (gcc version 4.9.3 20150413 (prerelease) (Linaro GCC 4.9-2015.05) ) #15 PREEMPT Tue Aug 6 09:47:21 CST 2019
    [ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
    [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
    [ 0.000000] Machine model: TI AM335x EVM-SK
    [ 0.000000] cma: Reserved 24 MiB at 0x8b800000
    [ 0.000000] Memory policy: Data cache writeback
    [ 0.000000] CPU: All CPU(s) started in SVC mode.
    [ 0.000000] AM335X ES2.1 (neon )
    [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 64960
    [ 0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/ram0
    [ 0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
    [ 0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
    [ 0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
    [ 0.000000] Memory: 195588K/262144K available (7163K kernel code, 290K rwdata, 1776K rodata, 288K init, 235K bss, 41980K reserved, 24576K cma-reserved, 0K highmem)
    [ 0.000000] Virtual kernel memory layout:
    [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
    [ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
    [ 0.000000] vmalloc : 0xd0800000 - 0xff000000 ( 744 MB)
    [ 0.000000] lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
    [ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
    [ 0.000000] .text : 0xc0008000 - 0xc08c30ac (8941 kB)
    [ 0.000000] .init : 0xc08c4000 - 0xc090c000 ( 288 kB)
    [ 0.000000] .data : 0xc090c000 - 0xc0954be8 ( 291 kB)
    [ 0.000000] .bss : 0xc0957000 - 0xc0991cdc ( 236 kB)
    [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    [ 0.000000] Preemptible hierarchical RCU implementation.
    [ 0.000000] Additional per-CPU info printed with stalls.
    [ 0.000000] NR_IRQS:16 nr_irqs:16 16
    [ 0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
    [ 0.000000] OMAP clockevent source: timer2 at 24000000 Hz
    [ 0.000019] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
    [ 0.000044] clocksource timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
    [ 0.000058] OMAP clocksource: timer1 at 24000000 Hz
    [ 0.000279] Console: colour dummy device 80x30
    [ 0.000307] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
    [ 0.000316] This ensures that you still see kernel messages. Please
    [ 0.000323] update your kernel commandline.
    [ 0.000347] Calibrating delay loop... 597.60 BogoMIPS (lpj=2988032)
    [ 0.118886] pid_max: default: 32768 minimum: 301
    [ 0.119012] Security Framework initialized
    [ 0.119082] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [ 0.119096] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [ 0.119961] Initializing cgroup subsys blkio
    [ 0.119990] Initializing cgroup subsys memory
    [ 0.120042] Initializing cgroup subsys devices
    [ 0.120062] Initializing cgroup subsys freezer
    [ 0.120079] Initializing cgroup subsys perf_event
    [ 0.120113] CPU: Testing write buffer coherency: ok
    [ 0.120573] Setting up static identity map for 0x80008200 - 0x80008270
    [ 0.122496] devtmpfs: initialized
    [ 0.135043] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
    [ 0.147248] omap_hwmod: tptc0 using broken dt data from edma
    [ 0.147396] omap_hwmod: tptc1 using broken dt data from edma
    [ 0.147525] omap_hwmod: tptc2 using broken dt data from edma
    [ 0.152501] omap_hwmod: debugss: _wait_target_disable failed
    [ 0.209416] clocksource jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    [ 0.212155] pinctrl core: initialized pinctrl subsystem
    [ 0.213713] NET: Registered protocol family 16
    [ 0.216520] DMA: preallocated 256 KiB pool for atomic coherent allocations
    [ 0.217876] before arch_cpu_idle_prepare
    [ 0.217892] before cpu_idle_loop
    [ 0.217900] entering into cpu_idle_loop
    [ 0.238888] cpuidle: using governor ladder
    [ 0.268880] cpuidle: using governor menu
    [ 0.273697] OMAP GPIO hardware version 0.1
    [ 0.286376] No ATAGs?
    [ 0.286411] hw-breakpoint: debug architecture 0x4 unsupported.
    [ 0.329883] edma-dma-engine edma-dma-engine.0: TI EDMA DMA engine driver
    [ 0.335547] vgaarb: loaded
    [ 0.336249] SCSI subsystem initialized
    [ 0.337134] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins, deferring probe
    [ 0.337369] pps_core: LinuxPPS API ver. 1 registered
    [ 0.337382] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
    [ 0.337423] PTP clock support registered
    [ 0.337957] Advanced Linux Sound Architecture Driver Initialized.
    [ 0.339080] Switched to clocksource timer1
    [ 0.352859] NET: Registered protocol family 2
    [ 0.353908] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
    [ 0.353954] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
    [ 0.353991] TCP: Hash tables configured (established 2048 bind 2048)
    [ 0.354082] UDP hash table entries: 256 (order: 0, 4096 bytes)
    [ 0.354109] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    [ 0.354314] NET: Registered protocol family 1
    [ 0.354787] RPC: Registered named UNIX socket transport module.
    [ 0.354807] RPC: Registered udp transport module.
    [ 0.354815] RPC: Registered tcp transport module.
    [ 0.354824] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [ 0.355262] Trying to unpack rootfs image as initramfs...
    [ 0.356757] rootfs image is not initramfs (no cpio magic); looks like an initrd
    [ 0.596885] Freeing initrd memory: 29436K (cd26c000 - cef2b000)
    [ 0.597365] CPU PMU: Failed to parse /pmu/interrupt-affinity[0]
    [ 0.597429] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
    [ 0.600163] futex hash table entries: 256 (order: -1, 3072 bytes)
    [ 0.600256] audit: initializing netlink subsys (disabled)
    [ 0.600348] audit: type=2000 audit(0.600:1): initialized
    [ 0.610059] VFS: Disk quotas dquot_6.6.0
    [ 0.610331] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
    [ 0.613248] NFS: Registering the id_resolver key type
    [ 0.613336] Key type id_resolver registered
    [ 0.613346] Key type id_legacy registered
    [ 0.613450] jffs2: version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
    [ 0.618166] NET: Registered protocol family 38
    [ 0.618258] io scheduler noop registered
    [ 0.618276] io scheduler deadline registered
    [ 0.618353] io scheduler cfq registered (default)
    [ 0.619943] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
    [ 0.624467] Serial: 8250/16550 driver, 10 ports, IRQ sharing enabled
    [ 0.628969] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 155, base_baud = 3000000) is a 8250
    [ 1.273063] console_name:ttyS;console_index:0
    [ 1.277442] console [ttyS0] enabled
    [ 1.280968] we really not attempt to ungister earlycon0
    [ 1.287406] 48022000.serial: ttyS1 at MMIO 0x48022000 (irq = 156, base_baud = 3000000) is a 8250
    [ 1.298288] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
    [ 1.305256] [drm] Initialized drm 1.1.0 20060810
    [ 1.309994] Error: Driver 'tfp410' is already registered, aborting...
    [ 1.317915] tilcdc 4830e000.lcdc: no encoders/connectors found
    [ 1.323944] tilcdc 4830e000.lcdc: failed to initialize mode setting
    [ 1.344267] brd: module loaded
    [ 1.354069] loop: module loaded
    [ 1.359054] mtdoops: mtd device (mtddev=name/number) must be supplied
    [ 1.369994] e1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI
    [ 1.377092] e1000: Copyright (c) 1999-2006 Intel Corporation.
    [ 1.383000] e1000e: Intel(R) PRO/1000 Network Driver - 2.3.2-k
    [ 1.388860] e1000e: Copyright(c) 1999 - 2014 Intel Corporation.
    [ 1.459161] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
    [ 1.465307] davinci_mdio 4a101000.mdio: detected phy mask fffffffd
    [ 1.472078] libphy: 4a101000.mdio: probed
    [ 1.476114] davinci_mdio 4a101000.mdio: phy[1]: device 4a101000.mdio:01, driver Atheros 8031 ethernet
    [ 1.486053] cpsw 4a100000.ethernet: Missing slave[0] phy_id property
    [ 1.492657] cpsw 4a100000.ethernet: Detected MACID = 78:b6:c1:04:44:72
    [ 1.501202] i2c /dev entries driver
    [ 1.504772] pps_ldisc: PPS line discipline registered
    [ 1.512248] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
    [ 1.520600] omap_hsmmc 48060000.mmc: Got CD GPIO
    [ 1.525795] SD_VCC: supplied by vbat
    [ 1.609841] omap-aes 53500000.aes: OMAP AES hw accel rev: 3.2
    [ 1.618599] omap-sham 53100000.sham: hw accel on OMAP rev 4.3
    [ 1.628819] remoteproc0: wkup_m3 is available
    [ 1.633521] remoteproc0: Note: remoteproc is still under development and considered experimental.
    [ 1.642692] remoteproc0: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
    [ 1.653480] remoteproc0: Direct firmware load for am335x-pm-firmware.elf failed with error -2
    [ 1.669858] oprofile: using arm/armv7
    [ 1.673674] GACT probability on
    [ 1.676848] Mirror/redirect action on
    [ 1.680709] remoteproc0: Falling back to user helper
    [ 1.686299] Simple TC action Loaded
    [ 1.691019] netem: version 1.3
    [ 1.694249] u32 classifier
    [ 1.696976] input device check on
    [ 1.700698] Actions configured
    [ 1.704529] Initializing XFRM netlink socket
    [ 1.708899] mmc1: MAN_BKOPS_EN bit is not set
    [ 1.713374] NET: Registered protocol family 17
    [ 1.717894] NET: Registered protocol family 15
    [ 1.722606] NET: Registered protocol family 33
    [ 1.727114] Key type rxrpc registered
    [ 1.730855] Key type rxrpc_s registered
    [ 1.735299] RxRPC: Registered security type 2 'rxkad'
    [ 1.740701] NET: Registered protocol family 35
    [ 1.745401] Key type dns_resolver registered
    [ 1.749844] mmc1: new high speed MMC card at address 0001
    [ 1.756188] omap_voltage_late_init: Voltage driver support not added
    [ 1.762744] mmcblk0: mmc1:0001 P1XXXX 3.60 GiB
    [ 1.767960] cpu cpu0: of_pm_voltdm_notifier_register: Failed to get cpu0 regulator/voltdm: -517
    [ 1.776914] mmcblk0boot0: mmc1:0001 P1XXXX partition 1 16.0 MiB
    [ 1.783139] mmcblk0boot1: mmc1:0001 P1XXXX partition 2 16.0 MiB
    [ 1.789173] cpu cpu0: cpu0 clock notifier not ready, retry
    [ 1.795153] ThumbEE CPU extension supported.
    [ 1.800477] Registering SWP/SWPB emulation handler
    [ 1.808434] mmcblk0: p1 p2 p3 p4 < p5 p6 p7 p8 p9 p10 >
    [ 1.839361] tps65910 0-002d: No interrupt support, no core IRQ
    [ 1.870522] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
    [ 1.876516] vdd_mpu: supplied by vbat
    [ 1.886494] SD_VCC: disabling
    [ 1.889653] v3_3d: disabling
    [ 1.892673] ALSA device list:
    [ 1.895656] No soundcards found.
    [ 1.899855] RAMDISK: gzip image found at block 0
    [ 6.725062] VFS: Mounted root (ext2 filesystem) readonly on device 1:0.
    [ 6.732267] devtmpfs: mounted
    [ 6.735915] Freeing unused kernel memory: 288K (c08c4000 - c090c000)
    [ 6.742392] be ready...
    INIT: version 2.88 booting
    rror opening /dev/fb0: No such file or directory6
    7tarting udevE
    ror opening /dev/fb0: No such file or directory
    ootlogd: cannot allocate pseudo tty: No such file or directory

    ootlogd: cannot allocate pseudo tty: No such file or directory
    [ 15.0476opulating dev cached
    mLSA: Restoring mixer settings...a
    lusr/sbin/alsactl: load_state:1729: eo soundcards found...
    .wclock: can't open '/dev/misc/rtc': No such file or directory
    hri Jan 8 23:20:04 UTC 2016s
    /wclock: can't open '/dev/misc/rtc': No such file or directory
    INIT: Entering runlevel: 5
    Configuring network interfaces... [ 17.783750] net eth0: initializing cpsw version 1.12 (0)
    [ 17.791090] libphy: PHY not found
    [ 17.794519] net eth0: phy not found on slave 0
    [ 17.879892] net eth0: phy found : id is : 0x4dd074
    udhcpc (v1.23.1) started
    Sending discover...
    Sending discover...
    [ 21.880104] cpsw 4a100000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
    Sending discover...
    No lease, forking to background
    ifconfig: SIOCGIFFLAGS: No such device
    done.
    Starting system message bus: dbus.
    Starting telnet daemon.
    Starting rpcbind daemon...rpcbind: cannot create socket for udp6
    rpcbind: cannot create socket for tcp6
    done.
    starting statd: done
    hwclock: can't open '/dev/misc/rtc': No such file or directory
    Starting syslogd/klogd: done

    下面是ethtool工具查看网卡状态

    root@am335x-evm:~#
    root@am335x-evm:~# ifconfig
    eth0 Link encap:Ethernet HWaddr 78:B6:C1:04:44:72
    inet addr:10.10.10.10 Bcast:10.255.255.255 Mask:255.0.0.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:342 (342.0 B)
    Interrupt:171

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    UP LOOPBACK RUNNING MTU:65536 Metric:1
    RX packets:10 errors:0 dropped:0 overruns:0 frame:0
    TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:700 (700.0 B) TX bytes:700 (700.0 B)

    root@am335x-evm:~# ethtool eth0
    Settings for eth0:
    Supported ports: [ TP MII ]
    Supported link modes: 10baseT/Half 10baseT/Full
    100baseT/Half 100baseT/Full
    1000baseT/Full
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Advertised link modes: 10baseT/Half 10baseT/Full
    100baseT/Half 100baseT/Full
    1000baseT/Full
    Advertised pause frame use: No
    Advertised auto-negotiation: Yes
    Link partner advertised link modes: 10baseT/Half 10baseT/Full
    100baseT/Half 100baseT/Full
    1000baseT/Half 1000baseT/Full
    Link partner advertised pause frame use: No
    Link partner advertised auto-negotiation: Yes
    Speed: 1000Mb/s
    Duplex: Full
    Port: MII
    PHYAD: 1
    Transceiver: external
    Auto-negotiation: on
    Supports Wake-on: g
    Wake-on: d
    Current message level: 0x00000000 (0)

    Link detected: yes
    root@am335x-evm:~#

  • 回复 gavin gavin:

    拔掉AM3352的网线
    当am335x的网口接入百兆电口时,ping PC的地址正常
    root@am335x-evm:~# [ 373.879934] cpsw 4a100000.ethernet eth0: Link is Down
    [ 385.880128] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off

    root@am335x-evm:~# ping 10.10.10.55
    PING 10.10.10.55 (10.10.10.55): 56 data bytes
    64 bytes from 10.10.10.55: seq=0 ttl=128 time=2.441 ms
    64 bytes from 10.10.10.55: seq=1 ttl=128 time=0.655 ms
    64 bytes from 10.10.10.55: seq=2 ttl=128 time=0.600 ms
    64 bytes from 10.10.10.55: seq=3 ttl=128 time=0.557 ms
  • 回复 Shine:

    还没有,我这边先用心的sdk调试下,看下结果怎么样