[Bug 197165] Wrong linkup status register used for mge controller

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Jan 29 08:48:38 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197165

            Bug ID: 197165
           Summary: Wrong linkup status register used for mge controller
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: arm
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: arm
          Assignee: freebsd-arm at FreeBSD.org
          Reporter: callthethunder at gmail.com

Hello!
I have a problem with mge driver on armada xp soc.
Board: RD-AXP-GP rev 1.0
SoC:   MV78460 B0
       running 4 CPUs
       Custom configuration

in file
sys/dev/mge/if_mge.c

    for (;;) {
        reg_val = MGE_READ(sc, MGE_PORT_STATUS);
        if (reg_val & MGE_STATUS_LINKUP)
            break;
        DELAY(100);
        if (--count == 0) {
            if_printf(sc->ifp, "Timeout on link-up\n");
            break;
        }
    }

#define MGE_PORT_STATUS            0x444
#define MGE_STATUS_LINKUP        (1 << 1)

For linkup status used bit 1 of MGE_PORT_STATUS, but according to marvel
documentation the value of this bit in undefined. 
http://www.marvell.com/embedded-processors/armada-xp/assets/ARMADA-XP-Functional-SpecDatasheet.pdf
Serial Registers
Ethernet Port Status 0 (PS0) Register (i=0–3)
Offset: Port2: 0x00032444, Port3: 0x00036444, Port0: 0x00072444, Port1:
0x00076444 Offset Formula: 0x00072444+0x4000*(i%2)+floor((3-i) / 2)*0x40000 -
0x40000: where i (0-3) represents Port
Bit    Field        Type/InitVal    Description
31:17    Reserved    RO 
            0x0        Reserved

16    RxFIFOEmpty    RO 
            0x1        RX Fifo Empty
                    When set to "1", indicates that the port Receive FIFO is
empty.

15:9    Reserved    RO 
            0x0        Reserved

8    TxFIFOEmp    RO 
            0x0        TX Fifo Empty
                    When set to "1", indicates that the port Transmit FIFO is
empty.

7:1    Reserved    RO 
            0x0        Reserved

0    TxInProg    RO 
            0x0        Transmit in Progress
                    When equal to "1", indicates that the port’s transmitter is
in an active transmission state.

You need to use one of MAC Registers instead.
According to this documentation linkup status is bit 0 of Port Status Register.
Port Status Register0 (i=0–3)
Offset: Port2: 0x00032C10, Port3: 0x00036C10, Port0: 0x00072C10, Port1:
0x00076C10 Offset Formula: 0x00072C10+0x4000*(i%2)+floor((3-i) / 2)*0x40000 -
0x40000: where i (0-3) represents Port
Bit    Field    Type/InitVal    Description
0    LinkUp    RO 
        0x0        Indicates the port link status. 
                0 = False: Link is down.
                1 = True: Link is up.

It works in case of my board.

diff --git a/sys/dev/mge/if_mge.c b/sys/dev/mge/if_mge.c
--- a/sys/dev/mge/if_mge.c
+++ b/sys/dev/mge/if_mge.c
@@ -965,8 +965,8 @@ mge_init_locked(void *arg)
        MGE_WRITE(sc, MGE_PORT_SERIAL_CTRL, reg_val);
        count = 0x100000;
        for (;;) {
-        reg_val = MGE_READ(sc, MGE_PORT_STATUS);
-        if (reg_val & MGE_STATUS_LINKUP)
+               reg_val = MGE_READ(sc, 0xc10);
+               if (reg_val & 1)
                        break;
                DELAY(100);
                if (--count == 0) {

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-arm mailing list