Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jan 2015 08:48:38 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-arm@FreeBSD.org
Subject:   [Bug 197165] Wrong linkup status register used for mge controller
Message-ID:  <bug-197165-7@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D197165

            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@FreeBSD.org
          Reporter: callthethunder@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 =3D MGE_READ(sc, MGE_PORT_STATUS);
        if (reg_val & MGE_STATUS_LINKUP)
            break;
        DELAY(100);
        if (--count =3D=3D 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.=20
http://www.marvell.com/embedded-processors/armada-xp/assets/ARMADA-XP-Funct=
ional-SpecDatasheet.pdf
Serial Registers
Ethernet Port Status 0 (PS0) Register (i=3D0=E2=80=933)
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=20
            0x0        Reserved

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

15:9    Reserved    RO=20
            0x0        Reserved

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

7:1    Reserved    RO=20
            0x0        Reserved

0    TxInProg    RO=20
            0x0        Transmit in Progress
                    When equal to "1", indicates that the port=E2=80=99s tr=
ansmitter 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 Regis=
ter.
Port Status Register0 (i=3D0=E2=80=933)
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=20
        0x0        Indicates the port link status.=20
                0 =3D False: Link is down.
                1 =3D 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 =3D 0x100000;
        for (;;) {
-        reg_val =3D MGE_READ(sc, MGE_PORT_STATUS);
-        if (reg_val & MGE_STATUS_LINKUP)
+               reg_val =3D MGE_READ(sc, 0xc10);
+               if (reg_val & 1)
                        break;
                DELAY(100);
                if (--count =3D=3D 0) {

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-197165-7>