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.

Linux boot / Ethernet PHY adjusting

Other Parts Discussed in Thread: AM3359, DP83640

Hello!

I'm trying to customuz linux boot for my bord (AM3359). I use Linux from ti-sdk-am335x-evm-05.07.00.00/board-support/board-port-labs/sitara-board-port-linux. I follow Sitara "Linux Training: Linux Board Port" when porting linux.

Ethernet PHY on my board have bus address = 31 (all pins pull up).

Linux booting log:

Booting from network ...                                                           
link up on port 0, speed 100, full duplex                                          
BOOTP broadcast 1                                                                  
DHCP client bound to address 192.168.1.100
link up on port 0, speed 100, full duplex                                          
Using cpsw device
TFTP from server 192.168.1.150; our IP address is 192.168.1.100
Filename 'uImage_evm'.
Load address: 0x80007fc0
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################
done
Bytes transferred = 3162328 (3040d8 hex)
## Booting kernel from Legacy Image at 80007fc0 ...
   Image Name:   Linux-3.2.0-g99070aa-dirty
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3162264 Bytes = 3 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   XIP Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Linux version 3.2.0-g99070aa-dirty (yura@yura-NB) (gcc version 4.5.3 2013
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c53c7d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine: am335xevm
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] AM335X ES1.0 (sgx neon )
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 1308
[    0.000000] Kernel command line: rootdelay=15 console=ttyO0,115200n8 root=/dev/nfs np
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 512MB = 512MB total
[    0.000000] Memory: 513160k/513160k available, 11128k reserved, 0K highmem
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     vmalloc : 0xe0800000 - 0xff000000   ( 488 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc059d000   (5716 kB)
[    0.000000]       .init : 0xc059d000 - 0xc05db000   ( 248 kB)
[    0.000000]       .data : 0xc05dc000 - 0xc0642708   ( 410 kB)
[    0.000000]        .bss : 0xc064272c - 0xc066f524   ( 180 kB)
[    0.000000] NR_IRQS:396
[    0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
[    0.000000] Total of 128 interrupts on 1 active controller
[    0.000000] OMAP clockevent source: GPTIMER2 at 24000000 Hz
[    0.000000] OMAP clocksource: GPTIMER1 at 32768 Hz
[    0.000000] sched_clock: 32 bits at 32kHz, resolution 30517ns, wraps every 131071999s
[    0.000000] Console: colour dummy device 80x30
[    0.000152] Calibrating delay loop... 718.02 BogoMIPS (lpj=3590144)
[    0.058929] pid_max: default: 32768 minimum: 301
[    0.059082] Security Framework initialized
[    0.059173] Mount-cache hash table entries: 512
[    0.059570] CPU: Testing write buffer coherency: ok
[    0.080139] omap_hwmod: pruss: failed to hardreset
[    0.081329] print_constraints: dummy:
[    0.081695] NET: Registered protocol family 16
[    0.083801] OMAP GPIO hardware version 0.1
[    0.086395] omap_mux_init: Add partition: #1: core, flags: 0
[    0.088684]  omap_hsmmc.0: alias fck already exists
[    0.089935]  omap2_mcspi.1: alias fck already exists
[    0.090148]  omap2_mcspi.2: alias fck already exists
[    0.091033]  edma.0: alias fck already exists
[    0.091064]  edma.0: alias fck already exists
[    0.091064]  edma.0: alias fck already exists
[    0.117736] bio: create slab <bio-0> at 0
[    0.119995] SCSI subsystem initialized
[    0.121612] usbcore: registered new interface driver usbfs
[    0.121917] usbcore: registered new interface driver hub
[    0.122100] usbcore: registered new device driver usb
[    0.123901] Advanced Linux Sound Architecture Driver Version 1.0.24.
[    0.125000] Switching to clocksource gp timer
[    0.140350] musb-hdrc: version 6.0, ?dma?, otg (peripheral+host)
[    0.140747] NET: Registered protocol family 2
[    0.140960] IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.141296] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
[    0.141571] TCP bind hash table entries: 16384 (order: 4, 65536 bytes)
[    0.141754] TCP: Hash tables configured (established 16384 bind 16384)
[    0.141754] TCP reno registered
[    0.141784] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.141815] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.141998] NET: Registered protocol family 1
[    0.142242] RPC: Registered named UNIX socket transport module.
[    0.142272] RPC: Registered udp transport module.
[    0.142272] RPC: Registered tcp transport module.
[    0.142303] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.142547] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.163696] VFS: Disk quotas dquot_6.5.2
[    0.163787] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.164337] msgmni has been set to 1002
[    0.167572] alg: No test for stdrng (krng)
[    0.168273] io scheduler noop registered
[    0.168304] io scheduler deadline registered
[    0.168365] io scheduler cfq registered (default)
[    0.170227] omap_uart.0: ttyO0 at MMIO 0x44e09000 (irq = 72) is a OMAP UART0
[    0.634033] console [ttyO0] enabled
[    0.638244] omap_uart.1: ttyO1 at MMIO 0x48022000 (irq = 73) is a OMAP UART1
[    0.646087] omap_uart.2: ttyO2 at MMIO 0x48024000 (irq = 74) is a OMAP UART2
[    0.653869] omap_uart.3: ttyO3 at MMIO 0x481a6000 (irq = 44) is a OMAP UART3
[    0.661651] omap_uart.4: ttyO4 at MMIO 0x481a8000 (irq = 45) is a OMAP UART4
[    0.669433] omap_uart.5: ttyO5 at MMIO 0x481aa000 (irq = 46) is a OMAP UART5
[    0.677734] omap4_rng omap4_rng: OMAP4 Random Number Generator ver. 2.00
[    0.693878] brd: module loaded
[    0.701904] loop: module loaded
[    0.705352] i2c-core: driver [tsl2550] using legacy suspend method
[    0.711853] i2c-core: driver [tsl2550] using legacy resume method
[    0.719970] mtdoops: mtd device (mtddev=name/number) must be supplied
[    0.727081] omap2-nand driver initializing
[    0.731506] OneNAND driver initializing
[    0.736755] CAN device driver interface
[    0.740753] CAN bus driver for Bosch D_CAN controller 1.0
[    0.795532] davinci_mdio davinci_mdio.0: davinci mdio revision 1.6
[    0.801971] davinci_mdio davinci_mdio.0: detected phy mask 7fffffff
[    0.809173] davinci_mdio.0: probed
[    0.812744] davinci_mdio davinci_mdio.0: phy[31]: device 0:1f, driver unknown
[    0.820526] usbcore: registered new interface driver zd1201
[    0.826568] usbcore: registered new interface driver cdc_ether
[    0.832794] usbcore: registered new interface driver cdc_eem
[    0.838867] usbcore: registered new interface driver dm9601
[    0.844726] cdc_ncm: 04-Aug-2011
[    0.848266] usbcore: registered new interface driver cdc_ncm
[    0.854156] Initializing USB Mass Storage driver...
[    0.859405] usbcore: registered new interface driver usb-storage
[    0.865692] USB Mass Storage support registered.
[    0.870941] mousedev: PS/2 mouse device common for all mice
[    0.877838] omap_rtc am33xx-rtc: rtc core: registered am33xx-rtc as rtc0
[    0.885009] i2c /dev entries driver
[    0.888824] Linux video capture interface: v2.00
[    0.893951] usbcore: registered new interface driver uvcvideo
[    0.899963] USB Video Class driver (1.1.1)
[    0.905151] OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
[    0.911682] _regulator_get: deviceless supply vdd_mpu not found, using dummy regulatr
[    0.920410] cpuidle: using governor ladder
[    0.925140] cpuidle: using governor menu
[    0.931396] omap4_aes_mod_init: loading AM33X AES driver
[    0.937072] omap4-aes omap4-aes: AM33X AES hw accel rev: 3.02
[    0.943603] omap4_aes_probe: probe() done
[    0.948028] omap4_sham_mod_init: loading AM33X SHA/MD5 driver
[    0.954132] omap4-sham omap4-sham: AM33X SHA/MD5 hw accel rev: 4.03
[    0.965576] omap4_sham_probe: probe() done
[    0.972167] usbcore: registered new interface driver usbhid
[    0.978027] usbhid: USB HID core driver
[    0.982543] usbcore: registered new interface driver snd-usb-audio
[    0.990478] ALSA device list:
[    0.993560]   No soundcards found.
[    0.997131] oprofile: hardware counters not available
[    1.002410] oprofile: using timer interrupt.
[    1.006896] nf_conntrack version 0.5.0 (8018 buckets, 32072 max)
[    1.013702] ip_tables: (C) 2000-2006 Netfilter Core Team
[    1.019378] TCP cubic registered
[    1.022735] NET: Registered protocol family 17
[    1.027404] can: controller area network core (rev 20090105 abi 8)
[    1.033935] NET: Registered protocol family 29
[    1.038574] can: raw protocol (rev 20090105)
[    1.043029] can: broadcast manager protocol (rev 20090105 t)
[    1.049011] Registering the dns_resolver key type
[    1.053985] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[    1.062011] ThumbEE CPU extension supported.
[    1.066528] mux: Failed to setup hwmod io irq -22
[    1.072052] Power Management for AM33XX family
[    1.076934] Trying to load am335x-pm-firmware.bin (60 secs timeout)
[    1.083587] Copied the M3 firmware to UMEM
[    1.088592] sr_init: platform driver register failed
[    1.097381] clock: disabling unused clocks to save power
[    1.115356] Detected MACID=0:17:ea:97:c2:a2
[    1.120788] cpsw: Detected MACID = 00:17:ea:97:c2:a3
[    1.127014] omap_rtc am33xx-rtc: setting system clock to 2000-01-01 00:00:01 UTC (94)
[    1.140045] PHY 31:00 not found
[    1.150054] PHY 31:01 not found
[  121.176208] Sending DHCP requests ...... timed out!
[  204.652008] IP-Config: Retrying forever (NFS root)...
[  204.660980] PHY 31:00 not found
[  204.670623] PHY 31:01 not found
[  324.696197] Sending DHCP requests ...... timed out!
[  404.521850] IP-Config: Retrying forever (NFS root)...
.................

------------------------------------------------------------------------------------------------------------------------------------

Phy setup from device.c:

#define AM33XX_EMAC_MDIO_FREQ        (1000000)
/* Port Vlan IDs for Dual Mac Mode */
#define CPSW_PORT_VLAN_SLAVE_0        2
#define CPSW_PORT_VLAN_SLAVE_1        3

/* TODO : Verify the offsets */
static struct cpsw_slave_data am33xx_cpsw_slaves[] = {
    {
        .slave_reg_ofs  = 0x208,
        .sliver_reg_ofs = 0xd80,
        .phy_id        = "31:00",
        .dual_emac_reserved_vlan = CPSW_PORT_VLAN_SLAVE_0,
    },
    {
        .slave_reg_ofs  = 0x308,
        .sliver_reg_ofs = 0xdc0,
        .phy_id        = "31:01",
        .dual_emac_reserved_vlan = CPSW_PORT_VLAN_SLAVE_1,
    },
};

static struct cpsw_platform_data am33xx_cpsw_pdata = {
    .ss_reg_ofs        = 0,
    .channels        = 8,
    .cpdma_reg_ofs        = 0x800,
    .slaves            = 2,
    .slave_data        = am33xx_cpsw_slaves,
    .ale_reg_ofs        = 0xd00,
    .ale_entries        = 1024,
    .host_port_reg_ofs      = 0x108,
    .hw_stats_reg_ofs       = 0x900,
    .cpts_reg_ofs        = 0xc00,
    .cpts_clock_mult    = 0x80000000,
    .cpts_clock_shift    = 29,
    .bd_ram_ofs        = 0x2000,
    .bd_ram_size        = SZ_8K,
    .rx_descs               = 64,
    .mac_control            = BIT(5), /* MIIEN */
    .gigabit_en        = 1,
    .host_port_num        = 0,
    .no_bd_ram        = false,
    .version        = CPSW_VERSION_2,
};

Do I correct change marked variable?

Thank you!

  • Your phy connect to MII1 or MII2?

    The struct should be 

        {
            .slave_reg_ofs  = 0x208,
            .sliver_reg_ofs = 0xd80,
            .phy_id        = "0:31",
            .dual_emac_reserved_vlan = CPSW_PORT_VLAN_SLAVE_0,
        },


    question : why need change this " .ss_reg_ofs        = 0," ?

  • I thought, that it is offset of CPSW_SS Registers, that has offset address 0x4A10_0000 (offset 0 ???)

    Another question: Shall i change

    static struct cpsw_platform_data am33xx_cpsw_pdata = {
    ...
        .slaves            = 1,
    ...

  • The question is still actual.

    static struct cpsw_slave_data am33xx_cpsw_slaves[] = {
        {
            .slave_reg_ofs  = 0x208,
            .sliver_reg_ofs = 0xd80,
            .phy_id        = "0:31",
            .dual_emac_reserved_vlan = CPSW_PORT_VLAN_SLAVE_0,
        },
    };

    static struct cpsw_platform_data am33xx_cpsw_pdata = {
        .ss_reg_ofs        = 0x1200,
        .channels        = 8,
        .cpdma_reg_ofs        = 0x800,
        .slaves            = 1,
        .slave_data        = am33xx_cpsw_slaves,
        .ale_reg_ofs        = 0xd00,
        .ale_entries        = 1024,
        .host_port_reg_ofs      = 0x108,
        .hw_stats_reg_ofs       = 0x900,
        .cpts_reg_ofs        = 0xc00,
        .cpts_clock_mult    = 0x80000000,
        .cpts_clock_shift    = 29,
        .bd_ram_ofs        = 0x2000,
        .bd_ram_size        = SZ_8K,
        .rx_descs               = 64,
        .mac_control            = BIT(5), /* MIIEN */
        .gigabit_en        = 1,
        .host_port_num        = 0,
        .no_bd_ram        = false,
        .version        = CPSW_VERSION_2,
    };

    I use DP83640 as PHY with address = 31 (all pins pulled up).

    I found that the error occurs in the function ./drivers/net/ethernet/ti/cpsw.c:

    static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv)
    {
        void __iomem        *regs = priv->regs;
        int            slave_num = slave->slave_num;
        struct cpsw_slave_data    *data = priv->data.slave_data + slave_num;

        slave->data    = data;
        slave->regs    = regs + data->slave_reg_ofs; // error occures here!!!
        slave->sliver    = regs + data->sliver_reg_ofs;
        slave->port_vlan = data->dual_emac_reserved_vlan;
    }

    Where is mistake?

    Thanks!

    PS. am33xx_cpsw_slaves[]  can be found at address 97ea1700.

    Unable to handle kernel paging request at virtual address 97ea1700

  • I fix my problem. The major cause of bug  was using decimal value in phy_id instead hexadecimal.

     .slave_reg_ofs  = 0x200

    .host_port_reg_ofs      = 0x100

    .phy_id        = "0:1f", (in hex!!!!!!!)

    And I add to am33xx_cpse\w_slaves[] struct second item (without it I was catching kernel panic - I don't understand why, because .slave in am33xx_cpsw_pdata equals to 1)

  • Nice catch K Y.

    I'm sure this thread will help others with the same issue so I'm tagging it for easy searching in the future.

  • Hi all,

    In my case initially ethernet works on PHY Address 0 but in very rare scenario sometimes PHY address comes at 2.

    My question is how to support for address 0 as well as Address 2 ? means whenever address changes to 2,ethernet should work,currently my Ethernet stops working when it comes at address 2

    The PHY on the Beaglebone board apparently does not come up at address 0 on the MDIO control bus.  From the previous power up tests, it seems to come up at address 2, possibly because of the way the PHY turns the configuration pins around at reset from inputs into outputs.  When I previously discussed this with the application engineer from Micrel (PHY vendor), he suggested that maybe the software could automatically detect which address the PHY is on (like 0 or 1 or 2, etc.) and use that from then on instead if always being on address 0.  I don’t know how feasible that is from a U-boot and Linux standpoint

    kindly reply

     

    Regards,

    Sarang K. 

  • Hi,

    I am reading your thread, I am curious to know if you found the root cause of the PHY micrel with address 0 ? we have the same issue and we cant use a Micrel PHY with address 0 using the u-boot of am335x evm sk.

    thanks.