From owner-freebsd-arm@FreeBSD.ORG Thu Jan 29 08:48:38 2015 Return-Path: Delivered-To: freebsd-arm@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7B176BEC for ; Thu, 29 Jan 2015 08:48:38 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 62A2D6EA for ; Thu, 29 Jan 2015 08:48:38 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id t0T8mcTe009082 for ; Thu, 29 Jan 2015 08:48:38 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-arm@FreeBSD.org Subject: [Bug 197165] Wrong linkup status register used for mge controller Date: Thu, 29 Jan 2015 08:48:38 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: arm X-Bugzilla-Version: 11.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: callthethunder@gmail.com X-Bugzilla-Status: New X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-arm@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2015 08:48:38 -0000 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.=