public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] Add Wake on LAN support to sis900 (2)
       [not found] <200601050223.k052Ngu2003866@hera.kernel.org>
@ 2006-02-24  2:57 ` Dave Jones
  2006-02-24  8:34   ` Daniele Venzano
  2006-02-24 10:03   ` Daniele Venzano
  0 siblings, 2 replies; 5+ messages in thread
From: Dave Jones @ 2006-02-24  2:57 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Daniele Venzano, Jeff Garzik, jreiser

The patch below applied on Jan 5th causes some systems to no longer boot.
See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=179601
for details.

Thanks go to John Reiser for his debugging with git bisect
to narrow this one down.

John got bitten by udev complaining about the kernel being
'too old', but I think that's just a side-effect. It's too
much of a coincidence for git to finger a SiS related patch,
and John's target system being SiS based.

		Dave



On Wed, Jan 04, 2006 at 06:23:42PM -0800, Linux Kernel wrote:
 > tree 93e543532a6c2959602d3d01384544c398b4f551
 > parent 7380a78a973a8109c13cb0e47617c456b6f6e1f5
 > author Daniele Venzano <venza@brownhat.org> Tue, 11 Oct 2005 09:44:30 +0200
 > committer Jeff Garzik <jgarzik@pobox.com> Sat, 29 Oct 2005 00:48:19 -0400
 > 
 > [PATCH] Add Wake on LAN support to sis900 (2)
 > 
 > Sorry, but that day I had smoked somthing too heavy for me, the patch
 > didn't apply. Here's a new one.
 > 
 > The patch availble below adds support for Wake on LAN to the sis900
 > driver. Some register addresses were added to sis900.h and two new
 > functions were implemented in sis900.c. WoL status is controlled by
 > ethtool.
 > Patch is against 2.6.13.
 > 
 > Comments are welcome, but also consider for inclusion in the -mm series.
 > 
 > Signed-off-by: Daniele Venzano <venza@brownhat.org>
 > 
 > --
 > Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
 > 
 >  drivers/net/sis900.c |   73 +++++++++++++++++++++++++++++++++++++++++++++++++--
 >  drivers/net/sis900.h |   45 +++++++++++++++++++++++++++++++
 >  2 files changed, 116 insertions(+), 2 deletions(-)
 > 
 > diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
 > index 1d4d886..3d95fa2 100644
 > --- a/drivers/net/sis900.c
 > +++ b/drivers/net/sis900.c
 > @@ -1,6 +1,6 @@
 >  /* sis900.c: A SiS 900/7016 PCI Fast Ethernet driver for Linux.
 >     Copyright 1999 Silicon Integrated System Corporation 
 > -   Revision:	1.08.08 Jan. 22 2005
 > +   Revision:	1.08.09 Sep. 19 2005
 >     
 >     Modified from the driver which is originally written by Donald Becker.
 >     
 > @@ -17,6 +17,7 @@
 >     SiS 7014 Single Chip 100BASE-TX/10BASE-T Physical Layer Solution,
 >     preliminary Rev. 1.0 Jan. 18, 1998
 >  
 > +   Rev 1.08.09 Sep. 19 2005 Daniele Venzano add Wake on LAN support
 >     Rev 1.08.08 Jan. 22 2005 Daniele Venzano use netif_msg for debugging messages
 >     Rev 1.08.07 Nov.  2 2003 Daniele Venzano <webvenza@libero.it> add suspend/resume support
 >     Rev 1.08.06 Sep. 24 2002 Mufasa Yang bug fix for Tx timeout & add SiS963 support
 > @@ -76,7 +77,7 @@
 >  #include "sis900.h"
 >  
 >  #define SIS900_MODULE_NAME "sis900"
 > -#define SIS900_DRV_VERSION "v1.08.08 Jan. 22 2005"
 > +#define SIS900_DRV_VERSION "v1.08.09 Sep. 19 2005"
 >  
 >  static char version[] __devinitdata =
 >  KERN_INFO "sis900.c: " SIS900_DRV_VERSION "\n";
 > @@ -538,6 +539,11 @@ static int __devinit sis900_probe(struct
 >  		printk("%2.2x:", (u8)net_dev->dev_addr[i]);
 >  	printk("%2.2x.\n", net_dev->dev_addr[i]);
 >  
 > +	/* Detect Wake on Lan support */
 > +	ret = inl(CFGPMC & PMESP);
 > +	if (netif_msg_probe(sis_priv) && (ret & PME_D3C) == 0)
 > +		printk(KERN_INFO "%s: Wake on LAN only available from suspend to RAM.", net_dev->name);
 > +
 >  	return 0;
 >  
 >   err_unmap_rx:
 > @@ -2015,6 +2021,67 @@ static int sis900_nway_reset(struct net_
 >  	return mii_nway_restart(&sis_priv->mii_info);
 >  }
 >  
 > +/**
 > + *	sis900_set_wol - Set up Wake on Lan registers
 > + *	@net_dev: the net device to probe
 > + *	@wol: container for info passed to the driver
 > + *
 > + *	Process ethtool command "wol" to setup wake on lan features.
 > + *	SiS900 supports sending WoL events if a correct packet is received,
 > + *	but there is no simple way to filter them to only a subset (broadcast,
 > + *	multicast, unicast or arp).
 > + */
 > + 
 > +static int sis900_set_wol(struct net_device *net_dev, struct ethtool_wolinfo *wol)
 > +{
 > +	struct sis900_private *sis_priv = net_dev->priv;
 > +	long pmctrl_addr = net_dev->base_addr + pmctrl;
 > +	u32 cfgpmcsr = 0, pmctrl_bits = 0;
 > +
 > +	if (wol->wolopts == 0) {
 > +		pci_read_config_dword(sis_priv->pci_dev, CFGPMCSR, &cfgpmcsr);
 > +		cfgpmcsr |= ~PME_EN;
 > +		pci_write_config_dword(sis_priv->pci_dev, CFGPMCSR, cfgpmcsr);
 > +		outl(pmctrl_bits, pmctrl_addr);
 > +		if (netif_msg_wol(sis_priv))
 > +			printk(KERN_DEBUG "%s: Wake on LAN disabled\n", net_dev->name);
 > +		return 0;
 > +	}
 > +
 > +	if (wol->wolopts & (WAKE_MAGICSECURE | WAKE_UCAST | WAKE_MCAST
 > +				| WAKE_BCAST | WAKE_ARP))
 > +		return -EINVAL;
 > +
 > +	if (wol->wolopts & WAKE_MAGIC)
 > +		pmctrl_bits |= MAGICPKT;
 > +	if (wol->wolopts & WAKE_PHY)
 > +		pmctrl_bits |= LINKON;
 > +	
 > +	outl(pmctrl_bits, pmctrl_addr);
 > +
 > +	pci_read_config_dword(sis_priv->pci_dev, CFGPMCSR, &cfgpmcsr);
 > +	cfgpmcsr |= PME_EN;
 > +	pci_write_config_dword(sis_priv->pci_dev, CFGPMCSR, cfgpmcsr);
 > +	if (netif_msg_wol(sis_priv))
 > +		printk(KERN_DEBUG "%s: Wake on LAN enabled\n", net_dev->name);
 > +
 > +	return 0;
 > +}
 > +
 > +static void sis900_get_wol(struct net_device *net_dev, struct ethtool_wolinfo *wol)
 > +{
 > +	long pmctrl_addr = net_dev->base_addr + pmctrl;
 > +	u32 pmctrl_bits;
 > +
 > +	pmctrl_bits = inl(pmctrl_addr);
 > +	if (pmctrl_bits & MAGICPKT)
 > +		wol->wolopts |= WAKE_MAGIC;
 > +	if (pmctrl_bits & LINKON)
 > +		wol->wolopts |= WAKE_PHY;
 > +
 > +	wol->supported = (WAKE_PHY | WAKE_MAGIC);
 > +}
 > +
 >  static struct ethtool_ops sis900_ethtool_ops = {
 >  	.get_drvinfo 	= sis900_get_drvinfo,
 >  	.get_msglevel	= sis900_get_msglevel,
 > @@ -2023,6 +2090,8 @@ static struct ethtool_ops sis900_ethtool
 >  	.get_settings	= sis900_get_settings,
 >  	.set_settings	= sis900_set_settings,
 >  	.nway_reset	= sis900_nway_reset,
 > +	.get_wol	= sis900_get_wol,
 > +	.set_wol	= sis900_set_wol
 >  };
 >  
 >  /**
 > diff --git a/drivers/net/sis900.h b/drivers/net/sis900.h
 > index de3c067..4233ea5 100644
 > --- a/drivers/net/sis900.h
 > +++ b/drivers/net/sis900.h
 > @@ -33,6 +33,7 @@ enum sis900_registers {
 >          rxcfg=0x34,             //Receive Configuration Register
 >          flctrl=0x38,            //Flow Control Register
 >          rxlen=0x3c,             //Receive Packet Length Register
 > +        cfgpmcsr=0x44,          //Configuration Power Management Control/Status Register
 >          rfcr=0x48,              //Receive Filter Control Register
 >          rfdr=0x4C,              //Receive Filter Data Register
 >          pmctrl=0xB0,            //Power Management Control Register
 > @@ -140,6 +141,50 @@ enum sis96x_eeprom_command {
 >  	EEREQ = 0x00000400, EEDONE = 0x00000200, EEGNT = 0x00000100
 >  };
 >  
 > +/* PCI Registers */
 > +enum sis900_pci_registers {
 > +	CFGPMC 	 = 0x40,
 > +	CFGPMCSR = 0x44
 > +};
 > +
 > +/* Power management capabilities bits */
 > +enum sis900_cfgpmc_register_bits {
 > +	PMVER	= 0x00070000, 
 > +	DSI	= 0x00100000,
 > +	PMESP	= 0xf8000000
 > +};
 > +
 > +enum sis900_pmesp_bits {
 > +	PME_D0 = 0x1,
 > +	PME_D1 = 0x2,
 > +	PME_D2 = 0x4,
 > +	PME_D3H = 0x8,
 > +	PME_D3C = 0x10
 > +};
 > +
 > +/* Power management control/status bits */
 > +enum sis900_cfgpmcsr_register_bits {
 > +	PMESTS = 0x00004000,
 > +	PME_EN = 0x00000100, // Power management enable
 > +	PWR_STA = 0x00000003 // Current power state
 > +};
 > +
 > +/* Wake-on-LAN support. */
 > +enum sis900_power_management_control_register_bits {
 > +	LINKLOSS  = 0x00000001,
 > +	LINKON    = 0x00000002,
 > +	MAGICPKT  = 0x00000400,
 > +	ALGORITHM = 0x00000800,
 > +	FRM1EN    = 0x00100000,
 > +	FRM2EN    = 0x00200000,
 > +	FRM3EN    = 0x00400000,
 > +	FRM1ACS   = 0x01000000,
 > +	FRM2ACS   = 0x02000000,
 > +	FRM3ACS   = 0x04000000,
 > +	WAKEALL   = 0x40000000,
 > +	GATECLK   = 0x80000000
 > +};
 > +
 >  /* Management Data I/O (mdio) frame */
 >  #define MIIread         0x6000
 >  #define MIIwrite        0x5002
 > -
 > To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
 > the body of a message to majordomo@vger.kernel.org
 > More majordomo info at  http://vger.kernel.org/majordomo-info.html
---end quoted text---

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add Wake on LAN support to sis900 (2)
@ 2006-02-24  8:15 Chuck Ebbert
  0 siblings, 0 replies; 5+ messages in thread
From: Chuck Ebbert @ 2006-02-24  8:15 UTC (permalink / raw)
  To: Dave Jones; +Cc: Daniele Venzano, Jeff Garzik, John Reiser, linux-kernel

In-Reply-To: <20060224025759.GA14027@redhat.com>

On Thu, 23 Feb 2006 at 21:57:59 -0500, Dave Jones wrote:
> The patch below applied on Jan 5th causes some systems to no longer boot.
> See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=179601
> for details.
> 
> Thanks go to John Reiser for his debugging with git bisect
> to narrow this one down.
> ...
> > --- a/drivers/net/sis900.c
> > +++ b/drivers/net/sis900.c
> ...
> > @@ -538,6 +539,11 @@ static int __devinit sis900_probe(struct
> >             printk("%2.2x:", (u8)net_dev->dev_addr[i]);
> >     printk("%2.2x.\n", net_dev->dev_addr[i]);
> >  
> > +   /* Detect Wake on Lan support */
> > +   ret = inl(CFGPMC & PMESP);

 What is this?  It appears to be doing 'inl(0)'.

> > +   if (netif_msg_probe(sis_priv) && (ret & PME_D3C) == 0)
> > +           printk(KERN_INFO "%s: Wake on LAN only available from suspend to RAM.", net_dev->name);
> > +
> >     return 0;
> >  
> >   err_unmap_rx:

-- 
Chuck
"Equations are the Devil's sentences."  --Stephen Colbert


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add Wake on LAN support to sis900 (2)
  2006-02-24  2:57 ` [PATCH] Add Wake on LAN support to sis900 (2) Dave Jones
@ 2006-02-24  8:34   ` Daniele Venzano
  2006-02-24 10:03   ` Daniele Venzano
  1 sibling, 0 replies; 5+ messages in thread
From: Daniele Venzano @ 2006-02-24  8:34 UTC (permalink / raw)
  To: Dave Jones; +Cc: Linux Kernel Mailing List, Jeff Garzik, jreiser

Il giorno 24/feb/06, alle ore 03:57, Dave Jones ha scritto:

> The patch below applied on Jan 5th causes some systems to no longer  
> boot.
> See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=179601
> for details.
I'm aware of the problem (found by Lennert Buytenhek, bugzilla:  
5977). Obviously the patch I made was lost or I just forgot to send  
it away. In a few minutes I hope to send the patch, I have to check  
that it still applies.

Thanks.
--
Daniele Venzano
http://www.brownhat.org


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add Wake on LAN support to sis900 (2)
  2006-02-24  2:57 ` [PATCH] Add Wake on LAN support to sis900 (2) Dave Jones
  2006-02-24  8:34   ` Daniele Venzano
@ 2006-02-24 10:03   ` Daniele Venzano
  2006-02-25  0:08     ` John Reiser
  1 sibling, 1 reply; 5+ messages in thread
From: Daniele Venzano @ 2006-02-24 10:03 UTC (permalink / raw)
  To: Jeff Garzik, netdev; +Cc: Linux Kernel Mailing List, Dave Jones

[-- Attachment #1: Type: text/plain, Size: 399 bytes --]

Attached you find the patch that fixes two bugs in the WoL  
implementation of sis900. The first causes hangs on some system on  
driver load, the second causes troubles when disabling WoL support.  
Both fixes are one liner and really simple. Patch is against latest  
netdev-2.6 tree.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: Daniele Venzano <venza@brownhat.org>


[-- Attachment #2: sis900_wol_fix.diff --]
[-- Type: application/octet-stream, Size: 852 bytes --]

--- new/drivers/net/sis900.c.old	2006-02-24 10:46:06.000000000 +0100
+++ new/drivers/net/sis900.c	2006-02-24 09:57:57.000000000 +0100
@@ -540,7 +540,7 @@ static int __devinit sis900_probe(struct
 	printk("%2.2x.\n", net_dev->dev_addr[i]);
 
 	/* Detect Wake on Lan support */
-	ret = inl(CFGPMC & PMESP);
+	ret = (inl(net_dev->base_addr + CFGPMC) & PMESP) >> 27;
 	if (netif_msg_probe(sis_priv) && (ret & PME_D3C) == 0)
 		printk(KERN_INFO "%s: Wake on LAN only available from suspend to RAM.", net_dev->name);
 
@@ -2040,7 +2040,7 @@ static int sis900_set_wol(struct net_dev
 
 	if (wol->wolopts == 0) {
 		pci_read_config_dword(sis_priv->pci_dev, CFGPMCSR, &cfgpmcsr);
-		cfgpmcsr |= ~PME_EN;
+		cfgpmcsr &= ~PME_EN;
 		pci_write_config_dword(sis_priv->pci_dev, CFGPMCSR, cfgpmcsr);
 		outl(pmctrl_bits, pmctrl_addr);
 		if (netif_msg_wol(sis_priv))

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add Wake on LAN support to sis900 (2)
  2006-02-24 10:03   ` Daniele Venzano
@ 2006-02-25  0:08     ` John Reiser
  0 siblings, 0 replies; 5+ messages in thread
From: John Reiser @ 2006-02-25  0:08 UTC (permalink / raw)
  To: Daniele Venzano
  Cc: Jeff Garzik, netdev, Linux Kernel Mailing List, Dave Jones

Daniele Venzano wrote:
> Attached you find the patch that fixes two bugs in the WoL 
> implementation of sis900. The first causes hangs on some system on 
> driver load, the second causes troubles when disabling WoL support. 
> Both fixes are one liner and really simple. Patch is against latest 
> netdev-2.6 tree.

Thank you for your prompt attention.  The patch works for me
(my SiS 730 board now boots again) when applied to Fedora Core
kernel-2.6.15-1.1977_FC5 which claims to be 2.6.16rc4-git6
of 2006-02-23.

-- 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-02-25  0:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200601050223.k052Ngu2003866@hera.kernel.org>
2006-02-24  2:57 ` [PATCH] Add Wake on LAN support to sis900 (2) Dave Jones
2006-02-24  8:34   ` Daniele Venzano
2006-02-24 10:03   ` Daniele Venzano
2006-02-25  0:08     ` John Reiser
2006-02-24  8:15 Chuck Ebbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox