[vortex] 3Com 3c905C, 3c59x.c:v0.99H and WOL - fix.
Georg Engstrand
georg@magic.no
Thu, 28 Sep 2000 14:18:52 +0200
This is a multi-part message in MIME format.
--------------6805F8BAE2B8A8485CDBE081
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Andrew Morton wrote:
>
> I thought RedHat were shipping 3com's 3c90x driver. Maybe they've
> changed.
>
They do, but there's no WOL stuff there. At least I didn't manage to get it
working. I know of others having had the same problem...
>
> Please post the diffs.
>
> I removed the WOL stuff because it was instantaneously powering down my
> 3c905B, necessitating a reboot. I guess I should resurrect it, but
> unless I can work out why the 905B was doing this, I'll make it a module
> option.
The WOL diff is for the 3c59x.c modified 24jun00 by Andrew Morton.
Patch command:
patch -p0 3c59x.c < 3c59x.c-v0.99H-WOL.diff
--
Georg Engstrand, georg@magic.no
--------------6805F8BAE2B8A8485CDBE081
Content-Type: text/plain; charset=us-ascii;
name="3c59x.c-v0.99H-WOL.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="3c59x.c-v0.99H-WOL.diff"
17a18,22
> 27.09.2000 <2.2.16> Georg Engstrand <georg@magic.no>
> - Added WOL
> */
>
> /*
58c63
< "3c59x.c:v0.99H 24Jun00 Donald Becker and others http://www.scyld.com/network/vortex.html\n";
---
> "3c59x.c:v0.99H-WOL 27sep00 Donald Becker and others http://www.scyld.com/network/vortex.html\n";
488c493
< enum ChipCaps { CapBusMaster=0x20 };
---
> enum ChipCaps { CapBusMaster=0x20, CapPwrMgmt=0x200 };
576a582,583
> static void acpi_wake(int pci_bus, int pci_devfn);
> static void acpi_set_WOL(struct device *dev);
733a741,743
> /* The Cyclone requires config space re-write if powered down. */
> acpi_wake(pci_bus, pci_device_fn);
>
1032a1043,1045
> if (vp->capabilities & CapPwrMgmt)
> acpi_set_WOL(dev);
>
1065a1079,1081
> /* Should be if(HAS_ACPI) */
> acpi_wake(vp->pci_bus, vp->pci_devfn);
>
2113a2130,2131
> if (vp->capabilities & CapPwrMgmt)
> acpi_set_WOL(dev);
2317a2336,2381
> }
>
> /* ACPI: Advanced Configuration and Power Interface. */
> /* Set Wake-On-LAN mode and put the board into D3 (power-down) state. */
> static void acpi_set_WOL(struct device *dev)
> {
> struct vortex_private *vp = (struct vortex_private *)dev->priv;
> long ioaddr = dev->base_addr;
>
> /* Power up on: 1==Downloaded Filter, 2==Magic Packets, 4==Link Status. */
> EL3WINDOW(7);
> outw(2, ioaddr + 0x0c);
> /* The RxFilter must accept the WOL frames. */
> outw(SetRxFilter|RxStation|RxMulticast|RxBroadcast, ioaddr + EL3_CMD);
> outw(RxEnable, ioaddr + EL3_CMD);
> /* Change the power state to D3; RxEnable doesn't take effect. */
> pcibios_write_config_word(vp->pci_bus, vp->pci_devfn, 0xe0, 0x8103);
> }
>
> /* Change from D3 (sleep) to D0 (active).
> Problem: The Cyclone forgets all PCI config info during the transition! */
> static void acpi_wake(int bus, int devfn)
> {
> u32 base0, base1, romaddr;
> u16 pci_command, pwr_command;
> u8 pci_latency, pci_cacheline, irq;
>
> pcibios_read_config_word(bus, devfn, 0xe0, &pwr_command);
> if ((pwr_command & 3) == 0)
> return;
> pcibios_read_config_word( bus, devfn, PCI_COMMAND, &pci_command);
> pcibios_read_config_dword(bus, devfn, PCI_BASE_ADDRESS_0, &base0);
> pcibios_read_config_dword(bus, devfn, PCI_BASE_ADDRESS_1, &base1);
> pcibios_read_config_dword(bus, devfn, PCI_ROM_ADDRESS, &romaddr);
> pcibios_read_config_byte( bus, devfn, PCI_LATENCY_TIMER, &pci_latency);
> pcibios_read_config_byte( bus, devfn, PCI_CACHE_LINE_SIZE, &pci_cacheline);
> pcibios_read_config_byte( bus, devfn, PCI_INTERRUPT_LINE, &irq);
>
> pcibios_write_config_word( bus, devfn, 0xe0, 0x0000);
> pcibios_write_config_dword(bus, devfn, PCI_BASE_ADDRESS_0, base0);
> pcibios_write_config_dword(bus, devfn, PCI_BASE_ADDRESS_1, base1);
> pcibios_write_config_dword(bus, devfn, PCI_ROM_ADDRESS, romaddr);
> pcibios_write_config_byte( bus, devfn, PCI_INTERRUPT_LINE, irq);
> pcibios_write_config_byte( bus, devfn, PCI_LATENCY_TIMER, pci_latency);
> pcibios_write_config_byte( bus, devfn, PCI_CACHE_LINE_SIZE, pci_cacheline);
> pcibios_write_config_word( bus, devfn, PCI_COMMAND, pci_command | 5);
--------------6805F8BAE2B8A8485CDBE081--