Re: AX88790 L phy workaround

2006-09-23 Thread Todd Blumer
On 9/17/06, Matthew Wilcox <[EMAIL PROTECTED]> wrote:
> On Tue, Sep 12, 2006 at 05:33:53PM -0400, Todd Blumer wrote:
> > Here's a patch (against 2.6.15) that works with the Socket Rugged CF
> > 10/100 Card. Comments welcome.
> > +  * The AX88790L has a bug in the auto-negotiation (AN). A work-around
> > +  * is to turn off the phy, wait 2.5 secs, then re-enable AN. Once this
> > +  * action is taken, AN works fine.
> > + mdelay(2500);
>
> mdelay is going to busy-wait for 2.5 seconds; can you not msleep()
> instead?  I don't think you're holding any locks at this point, nor do I
> think you're in interrupt context, so sleeping should be OK.
>
Yes, you are correct, and that works fine. Thanks.

___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


Re: AX88790 L phy workaround

2006-09-17 Thread Matthew Wilcox
On Tue, Sep 12, 2006 at 05:33:53PM -0400, Todd Blumer wrote:
> Here's a patch (against 2.6.15) that works with the Socket Rugged CF
> 10/100 Card. Comments welcome.
> +  * The AX88790L has a bug in the auto-negotiation (AN). A work-around
> +  * is to turn off the phy, wait 2.5 secs, then re-enable AN. Once this
> +  * action is taken, AN works fine.
> + mdelay(2500);

mdelay is going to busy-wait for 2.5 seconds; can you not msleep()
instead?  I don't think you're holding any locks at this point, nor do I
think you're in interrupt context, so sleeping should be OK.

___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


Re: AX88790 L phy workaround

2006-09-12 Thread Todd Blumer

On 9/12/06, Todd Blumer <[EMAIL PROTECTED]> wrote:

I am in need of adding driver support for the Socket Rugged CF
Ethernet card. It uses the AX88790 L chip. Socket indicates that this
chip has a Phy bug and they provide a workaround.
ftp://ftp.socketcom.com/ea/Rugged_10-100_Driver_Changes_07-2006.zip
I'm guessing that  the problem is only in a recent revision (the L
revision?) of the chip since I don't see such a workaround in the
standard axnet_cs.c driver.

Has anyone done this workaround? Any other comments or suggestions?
Otherwise, I'll try to implement these changes and submit a patch.


Here's a patch (against 2.6.15) that works with the Socket Rugged CF
10/100 Card. Comments welcome.

--
Todd Blumer
SDG Systems
Index: drivers/net/pcmcia/axnet_cs.c
===
--- drivers/net/pcmcia/axnet_cs.c	(revision 332)
+++ drivers/net/pcmcia/axnet_cs.c	(working copy)
@@ -13,6 +13,10 @@
 
 axnet_cs.c 1.28 2002/06/29 06:27:37
 
+Changelog:
+
+Todd Blumer		: added PHY bug workaround for AX88790
+
 The network driver code is based on Donald Becker's NE2000 code:
 
 Written 1992,1993 by Donald Becker.
@@ -59,6 +63,18 @@
 #define AXNET_START_PG	0x40	/* First page of TX buffer */
 #define AXNET_STOP_PG	0x80	/* Last page +1 of RX ring */
 
+#define AXNET_PHY_MR0		0
+#define AXNET_MR0_SW_RESET	(1<<15)
+#define AXNET_MR0_LOOPBACK	(1<<14)
+#define AXNET_MR0_SPEED100	(1<<13)
+#define AXNET_MR0_NWAY_ENA	(1<<12)
+#define AXNET_MR0_PWRDN		(1<<11)
+#define AXNET_MR0_ISOLATE	(1<<10)
+#define AXNET_MR0_REDONWAY	(1<<9)
+#define AXNET_MR0_FULL_DUP	(1<<8)
+#define AXNET_MR0_COLTST	(1<<7)
+/* remaining bits are reserved */
+
 #define AXNET_RDC_TIMEOUT 0x02	/* Max wait in jiffies for Tx RDC */
 
 #define IS_AX88190	0x0001
@@ -439,6 +455,22 @@
 }
 
 info->phy_id = (i < 32) ? i : -1;
+if ((info->flags & IS_AX88790) && (info->phy_id != -1)) {
+	int data;
+	/*
+	 * The AX88790L has a bug in the auto-negotiation (AN). A work-around
+	 * is to turn off the phy, wait 2.5 secs, then re-enable AN. Once this
+	 * action is taken, AN works fine.
+	 *
+	 * Note: this chip is in the Socket Rugged CF Ethernet card
+	 */
+	data = mdio_read(dev->base_addr+ AXNET_MII_EEP, info->phy_id, AXNET_PHY_MR0);
+	mdio_write(dev->base_addr + AXNET_MII_EEP,
+	info->phy_id, AXNET_PHY_MR0, data | AXNET_MR0_PWRDN );
+	mdelay(2500);
+	mdio_write(dev->base_addr + AXNET_MII_EEP,
+	info->phy_id, AXNET_PHY_MR0, data | AXNET_MR0_REDONWAY | AXNET_MR0_NWAY_ENA);
+}
 link->dev = &info->node;
 link->state &= ~DEV_CONFIG_PENDING;
 SET_NETDEV_DEV(dev, &handle_to_dev(handle));
@@ -852,6 +884,7 @@
 	PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0309),
 	PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1106),
 	PCMCIA_DEVICE_MANF_CARD(0x8a01, 0xc1ab),
+	PCMCIA_DEVICE_MANF_CARD(0x0104, 0x02d2), /* "Socket", "CF 10/100 Ethernet Card", "Revision B", "05/11/06" */
 	PCMCIA_DEVICE_PROD_ID124("Fast Ethernet", "16-bit PC Card", "AX88190", 0xb4be14e3, 0x9a12eb6a, 0xab9be5ef),
 	PCMCIA_DEVICE_PROD_ID12("ASIX", "AX88190", 0x0959823b, 0xab9be5ef),
 	PCMCIA_DEVICE_PROD_ID12("Billionton", "LNA-100B", 0x552ab682, 0xbc3b87e1),
___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia