Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09ce3512 authored by Steffen Klassert's avatar Steffen Klassert Committed by Linus Torvalds
Browse files

[PATCH] 3c59x: fix networking for 10base2 NICs



The "3c59x: use mii_check_media" patch introduced a netif_carrier_off in
vortex_up.  10base2 stoped working because of this.  This is removed.

Tx/Rx reset is back in vortex_up because the 3c900B-Combo stops working after
changing from half duplex to full duplex when Tx/Rx reset is done with
vortex_timer.

Also brought back some mii stuff to be sure that it does not break something
else.

Thanks to Pete Clements <clem@clem.clem-digital.net> for reporting and testing.

Signed-off-by: default avatarSteffen Klassert <klassert@mathematik.tu-chemnitz.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0000754c
Loading
Loading
Loading
Loading
+12 −9
Original line number Original line Diff line number Diff line
@@ -788,7 +788,7 @@ struct vortex_private {
	int options;						/* User-settable misc. driver options. */
	int options;						/* User-settable misc. driver options. */
	unsigned int media_override:4, 		/* Passed-in media type. */
	unsigned int media_override:4, 		/* Passed-in media type. */
		default_media:4,				/* Read from the EEPROM/Wn3_Config. */
		default_media:4,				/* Read from the EEPROM/Wn3_Config. */
		full_duplex:1, force_fd:1, autoselect:1,
		full_duplex:1, autoselect:1,
		bus_master:1,					/* Vortex can only do a fragment bus-m. */
		bus_master:1,					/* Vortex can only do a fragment bus-m. */
		full_bus_master_tx:1, full_bus_master_rx:2, /* Boomerang  */
		full_bus_master_tx:1, full_bus_master_rx:2, /* Boomerang  */
		flow_ctrl:1,					/* Use 802.3x flow control (PAUSE only) */
		flow_ctrl:1,					/* Use 802.3x flow control (PAUSE only) */
@@ -1633,12 +1633,6 @@ vortex_set_duplex(struct net_device *dev)
			((vp->full_duplex && vp->flow_ctrl && vp->partner_flow_ctrl) ?
			((vp->full_duplex && vp->flow_ctrl && vp->partner_flow_ctrl) ?
					0x100 : 0),
					0x100 : 0),
			ioaddr + Wn3_MAC_Ctrl);
			ioaddr + Wn3_MAC_Ctrl);

	issue_and_wait(dev, TxReset);
	/*
	 * Don't reset the PHY - that upsets autonegotiation during DHCP operations.
	 */
	issue_and_wait(dev, RxReset|0x04);
}
}


static void vortex_check_media(struct net_device *dev, unsigned int init)
static void vortex_check_media(struct net_device *dev, unsigned int init)
@@ -1663,7 +1657,7 @@ vortex_up(struct net_device *dev)
	struct vortex_private *vp = netdev_priv(dev);
	struct vortex_private *vp = netdev_priv(dev);
	void __iomem *ioaddr = vp->ioaddr;
	void __iomem *ioaddr = vp->ioaddr;
	unsigned int config;
	unsigned int config;
	int i;
	int i, mii_reg1, mii_reg5;


	if (VORTEX_PCI(vp)) {
	if (VORTEX_PCI(vp)) {
		pci_set_power_state(VORTEX_PCI(vp), PCI_D0);	/* Go active */
		pci_set_power_state(VORTEX_PCI(vp), PCI_D0);	/* Go active */
@@ -1723,14 +1717,23 @@ vortex_up(struct net_device *dev)
		printk(KERN_DEBUG "vortex_up(): writing 0x%x to InternalConfig\n", config);
		printk(KERN_DEBUG "vortex_up(): writing 0x%x to InternalConfig\n", config);
	iowrite32(config, ioaddr + Wn3_Config);
	iowrite32(config, ioaddr + Wn3_Config);


	netif_carrier_off(dev);
	if (dev->if_port == XCVR_MII || dev->if_port == XCVR_NWAY) {
	if (dev->if_port == XCVR_MII || dev->if_port == XCVR_NWAY) {
		EL3WINDOW(4);
		EL3WINDOW(4);
		mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
		mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA);
		vp->partner_flow_ctrl = ((mii_reg5 & 0x0400) != 0);

		vortex_check_media(dev, 1);
		vortex_check_media(dev, 1);
	}
	}
	else
	else
		vortex_set_duplex(dev);
		vortex_set_duplex(dev);


	issue_and_wait(dev, TxReset);
	/*
	 * Don't reset the PHY - that upsets autonegotiation during DHCP operations.
	 */
	issue_and_wait(dev, RxReset|0x04);



	iowrite16(SetStatusEnb | 0x00, ioaddr + EL3_CMD);
	iowrite16(SetStatusEnb | 0x00, ioaddr + EL3_CMD);