From dinesh@alphaque.com  Tue Jan 13 00:57:33 2004
Return-Path: <dinesh@alphaque.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id C18D716A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Jan 2004 00:57:33 -0800 (PST)
Received: from ns2.alphaque.com (ns2.alphaque.com [202.75.47.153])
	by mx1.FreeBSD.org (Postfix) with SMTP id 9891643D4C
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Jan 2004 00:57:21 -0800 (PST)
	(envelope-from dinesh@alphaque.com)
Received: (qmail 5570 invoked by uid 0); 13 Jan 2004 08:57:20 -0000
Received: from lucifer.net-gw.com (HELO prophet.alphaque.com) (202.75.47.153)
  by lucifer.net-gw.com with SMTP; 13 Jan 2004 08:57:20 -0000
Received: from prophet.alphaque.com (localhost.alphaque.com [127.0.0.1])
	by prophet.alphaque.com (8.12.10/8.12.9) with ESMTP id i0D8tLab046490;
	Tue, 13 Jan 2004 16:55:21 +0800 (MYT)
	(envelope-from dinesh@alphaque.com)
Received: (from dinesh@localhost)
	by prophet.alphaque.com (8.12.10/8.12.9/Submit) id i0D8tL7t046489;
	Tue, 13 Jan 2004 16:55:21 +0800 (MYT)
Message-Id: <200401130855.i0D8tL7t046489@prophet.alphaque.com>
Date: Tue, 13 Jan 2004 16:55:21 +0800 (MYT)
From: Dinesh Nair <dinesh@alphaque.com>
Reply-To: Dinesh Nair <dinesh@alphaque.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: dinesh@alphaque.com
Subject: [patch] Enabling HomePNA PHY on aue(4) for HomePNA connections
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         61300
>Category:       kern
>Synopsis:       [aue] [patch] Enabling HomePNA PHY on aue(4) for HomePNA connections
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 13 01:00:29 PST 2004
>Closed-Date:    
>Last-Modified:  Sun Oct 23 21:22:22 GMT 2005
>Originator:     Dinesh Nair
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
www.alphaque.com
>Environment:
System: FreeBSD prophet.alphaque.com 4.9-STABLE FreeBSD 4.9-STABLE #14: Thu Jan 8 21:14:15 MYT 2004 dinesh@prophet.alphaque.com:/usr/src/sys/compile/ALPHAQUE i386


	
>Description:
The ADMtek AN986 Pegasus USB Ethernet driver aue(4) currently has no support
for the HomePNA PHY interface for the PegasusII chipset. This means that
users who are using this USB device for HomePNA usage will not be able to
do so. The following patch addresses this lack of functionality by enabling
the HomePNA PHY with the 'ifconfig aueX media homepna' command, and enabling
the Ethernet PHY with the 'ifconfig aueX media auto' command. auto is also
synonymous with 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX. Reference
was made to the ADM8511 Datasheet at
http://www.admtek.com.tw/download/nic/adm8511/ADM8511_DSH_204.pdf.

Do note that upon USB attach, the HomePNA PHY is disabled and the
Ethernet PHY is enabled by default.

This PR contains a patch to /usr/src/sys/dev/usb/if_aue.c to enable the
HomePNA PHY as per the Description above.
>How-To-Repeat:
	Attach device to USB and configure for HomePNA
>Fix:

Apply the following patch to /usr/src/sys/dev/usb/if_aue.c

--- if_aue.c.patch begins here ---
--- if_aue.c.org	Thu Jan  8 19:29:27 2004
+++ if_aue.c	Fri Jan  9 01:55:48 2004
@@ -118,7 +118,7 @@
     { USB_VENDOR_ACCTON,	USB_PRODUCT_ACCTON_USB320_EC,	  0 },
     { USB_VENDOR_ACCTON,	USB_PRODUCT_ACCTON_SS1001,	  PII },
     { USB_VENDOR_ADMTEK,	USB_PRODUCT_ADMTEK_PEGASUS,	  PNA },
-    { USB_VENDOR_ADMTEK,	USB_PRODUCT_ADMTEK_PEGASUSII,	  PII },
+    { USB_VENDOR_ADMTEK,	USB_PRODUCT_ADMTEK_PEGASUSII, PNA|PII },
     { USB_VENDOR_BELKIN,	USB_PRODUCT_BELKIN_USB2LAN,       PII },
     { USB_VENDOR_BILLIONTON,	USB_PRODUCT_BILLIONTON_USB100,	  0 },
     { USB_VENDOR_BILLIONTON,	USB_PRODUCT_BILLIONTON_USBLP100,  PNA },
@@ -492,6 +492,26 @@
 	mii = device_get_softc(sc->aue_miibus);
 
 	AUE_CLRBIT(sc, AUE_CTL0, AUE_CTL0_RX_ENB|AUE_CTL0_TX_ENB);
+
+	/*
+	 * If media type is set to HomePNA, 
+	 * set GPIO0 and GPI01 output value to 1 and 
+	 * enable MII and USB test mode
+	 *
+	 * Patched by Dinesh Nair <dinesh@alphaque.com>
+	 * Fri Jan  9 01:55:25 MYT 2004
+	 * 
+	 */
+	if (IFM_SUBTYPE(mii->mii_media_active) == IFM_homePNA) {
+		if (sc->aue_info->aue_flags & (PNA|PII)) {
+			csr_write_1(sc, AUE_GPIO1, 0x34);
+			csr_write_1(sc, AUE_REG_81, 6);
+		}
+	} else {
+		csr_write_1(sc, AUE_GPIO1, 0x26);
+		csr_write_1(sc, AUE_REG_81, 2);
+	}
+
 	if (IFM_SUBTYPE(mii->mii_media_active) == IFM_100_TX) {
 		AUE_SETBIT(sc, AUE_CTL1, AUE_CTL1_SPEEDSEL);
 	} else {
@@ -576,12 +596,10 @@
 	/* Magic constants taken from Linux driver. */
 	csr_write_1(sc, AUE_REG_1D, 0);
 	csr_write_1(sc, AUE_REG_7B, 2);
-#if 0
-	if ((sc->aue_flags & HAS_HOME_PNA) && mii_mode)
-		csr_write_1(sc, AUE_REG_81, 6);
-	else
-#endif
+
+	if (sc->aue_info->aue_flags & PNA) {
 		csr_write_1(sc, AUE_REG_81, 2);
+	}
 }
 
 Static void
--- if_aue.c.patch ends here ---


>Release-Note:
>Audit-Trail:

From: Dinesh Nair <dinesh@alphaque.com>
To: FreeBSD-gnats-submit@FreeBSD.org, <freebsd-bugs@FreeBSD.org>
Cc:  
Subject: Re: kern/61300: [patch] Enabling HomePNA PHY on aue(4) for HomePNA
 connections
Date: Tue, 13 Jan 2004 17:13:46 +0800 (MYT)

 the problem report for the aue(4) man page patch to address this new
 functionality is at docs/61301
 
 Regards,                           /\_/\   "All dogs go to heaven."
 dinesh@alphaque.com                (0 0)    http://www.alphaque.com/
 +==========================----oOO--(_)--OOo----==========================+
 | for a in past present future; do                                        |
 |   for b in clients employers associates relatives neighbours pets; do   |
 |   echo "The opinions here in no way reflect the opinions of my $a $b."  |
 | done; done                                                              |
 +=========================================================================+
 
>Unformatted:
