linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] eepro100.c - Add option to disable power saving in 2.4.7-ac7
@ 2001-08-06 15:48 Martin Knoblauch
  2001-08-06 16:10 ` Andrey Savochkin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Martin Knoblauch @ 2001-08-06 15:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Kai Germaschewski, Alan Cox

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

Hi,

 after realizing that my first attempt for this patch was to
enthusiastic, I have no a somewhat stripped down version. Compiles
against 2.4.7-ac7.

 The patch adds the option "power_save" to eepro100. If "1" (default),
power save handling is done as normal. If "0", no power saving is done.
This is to workaround some flaky eepro100 adapters that do not survive
D0->D2-D0 transitions.

Martin
-- 
------------------------------------------------------------------
Martin Knoblauch         |    email:  Martin.Knoblauch@TeraPort.de
TeraPort GmbH            |    Phone:  +49-89-510857-309
C+ITS                    |    Fax:    +49-89-510857-111
http://www.teraport.de   |    Mobile: +49-170-4904759

[-- Attachment #2: eepro100-power_save.txt --]
[-- Type: text/plain, Size: 3246 bytes --]

--- linux-2.4.7-ac7/drivers/net/eepro100.c-orig-ac7	Mon Aug  6 10:36:54 2001
+++ linux-2.4.7-ac7/drivers/net/eepro100.c	Mon Aug  6 17:32:38 2001
@@ -60,6 +60,8 @@
 static int full_duplex[] = {-1, -1, -1, -1, -1, -1, -1, -1};
 static int options[] = {-1, -1, -1, -1, -1, -1, -1, -1};
 static int debug = -1;			/* The debug level */
+/* power_save option */
+static int power_save = 1;
 
 /* A few values that may be tweaked. */
 /* The ring sizes should be a power of two for efficiency. */
@@ -125,6 +127,7 @@
 MODULE_PARM(rx_copybreak, "i");
 MODULE_PARM(max_interrupt_work, "i");
 MODULE_PARM(multicast_filter_limit, "i");
+MODULE_PARM(power_save, "i");
 MODULE_PARM_DESC(debug, "eepro100 debug level (0-6)");
 MODULE_PARM_DESC(options, "eepro100: Bits 0-3: tranceiver type, bit 4: full duplex, bit 5: 100Mbps");
 MODULE_PARM_DESC(full_duplex, "eepro100 full duplex setting(s) (1)");
@@ -136,6 +139,7 @@
 MODULE_PARM_DESC(rx_copybreak, "eepro100 copy breakpoint for copy-only-tiny-frames");
 MODULE_PARM_DESC(max_interrupt_work, "eepro100 maximum events handled per interrupt");
 MODULE_PARM_DESC(multicast_filter_limit, "eepro100 maximum number of filtered multicast addresses");
+MODULE_PARM_DESC(power_save, "Disable/Enable power saving (0,1). Default 1.");
 
 #define RUN_AT(x) (jiffies + (x))
 
@@ -778,7 +782,11 @@
 	udelay(10);
 
 	/* Put chip into power state D2 until we open() it. */
-	pci_set_power_state(pdev, 2);
+	if ((power_save < 0) || (power_save > 1))
+	  power_save = 1;
+	printk(KERN_INFO "  power_save = %d.\n",power_save);
+	if (power_save)
+	  pci_set_power_state(pdev, 2);
 
 	pci_set_drvdata (pdev, dev);
 
@@ -902,7 +910,8 @@
 
 	MOD_INC_USE_COUNT;
 
-	pci_set_power_state(sp->pdev, 0);
+	if (power_save)
+	  pci_set_power_state(sp->pdev, 0);
 
 	/* Set up the Tx queue early.. */
 	sp->cur_tx = 0;
@@ -1833,7 +1842,8 @@
 	if (speedo_debug > 0)
 		printk(KERN_DEBUG "%s: %d multicast blocks dropped.\n", dev->name, i);
 
-	pci_set_power_state(sp->pdev, 2);
+	if (power_save)
+	  pci_set_power_state(sp->pdev, 2);
 
 	MOD_DEC_USE_COUNT;
 
@@ -1902,12 +1912,14 @@
 		   They are currently serialized only with MDIO access from the
 		   timer routine.  2000/05/09 SAW */
 		saved_acpi = sp->pdev->current_state;
-		pci_set_power_state(sp->pdev, 0);
+		if (power_save)
+		  pci_set_power_state(sp->pdev, 0);
 		t = del_timer_sync(&sp->timer);
 		data->val_out = mdio_read(ioaddr, data->phy_id & 0x1f, data->reg_num & 0x1f);
 		if (t)
 			add_timer(&sp->timer); /* may be set to the past  --SAW */
-		pci_set_power_state(sp->pdev, saved_acpi);
+		if (power_save)
+		  pci_set_power_state(sp->pdev, saved_acpi);
 		return 0;
 
 	case SIOCSMIIREG:		/* Write MII PHY register. */
@@ -1915,12 +1927,14 @@
 		if (!capable(CAP_NET_ADMIN))
 			return -EPERM;
 		saved_acpi = sp->pdev->current_state;
-		pci_set_power_state(sp->pdev, 0);
+		if (power_save)
+		  pci_set_power_state(sp->pdev, 0);
 		t = del_timer_sync(&sp->timer);
 		mdio_write(ioaddr, data->phy_id, data->reg_num, data->val_in);
 		if (t)
 			add_timer(&sp->timer); /* may be set to the past  --SAW */
-		pci_set_power_state(sp->pdev, saved_acpi);
+		if (power_save)
+		  pci_set_power_state(sp->pdev, saved_acpi);
 		return 0;
 	default:
 		return -EOPNOTSUPP;

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

* Re: eepro100.c - Add option to disable power saving in 2.4.7-ac7
  2001-08-06 15:48 [PATCH] eepro100.c - Add option to disable power saving in 2.4.7-ac7 Martin Knoblauch
@ 2001-08-06 16:10 ` Andrey Savochkin
  2001-08-06 16:49 ` [PATCH] " Kai Germaschewski
  2001-08-07 20:55 ` [PATCH] eepro100.c - Add option to disable power saving in 2.4.7-ac7 Admin Mailing Lists
  2 siblings, 0 replies; 6+ messages in thread
From: Andrey Savochkin @ 2001-08-06 16:10 UTC (permalink / raw)
  To: Martin Knoblauch, linux-kernel

Hi,

Making it an option looks like a reasonable idea.
However, could you mind the indentation style of the driver, please?

On Mon, Aug 06, 2001 at 05:48:04PM +0200, Martin Knoblauch wrote:
>  after realizing that my first attempt for this patch was to
> enthusiastic, I have no a somewhat stripped down version. Compiles
> against 2.4.7-ac7.
> 
>  The patch adds the option "power_save" to eepro100. If "1" (default),
> power save handling is done as normal. If "0", no power saving is done.
> This is to workaround some flaky eepro100 adapters that do not survive
> D0->D2-D0 transitions.
[snip]
> @@ -1833,7 +1842,8 @@
>  	if (speedo_debug > 0)
>  		printk(KERN_DEBUG "%s: %d multicast blocks dropped.\n", dev->name, i);
>  
> -	pci_set_power_state(sp->pdev, 2);
> +	if (power_save)
> +	  pci_set_power_state(sp->pdev, 2);
>  
>  	MOD_DEC_USE_COUNT;
>  

Best regards
		Andrey

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

* Re: [PATCH] eepro100.c - Add option to disable power saving in 2.4.7-ac7
  2001-08-06 15:48 [PATCH] eepro100.c - Add option to disable power saving in 2.4.7-ac7 Martin Knoblauch
  2001-08-06 16:10 ` Andrey Savochkin
@ 2001-08-06 16:49 ` Kai Germaschewski
  2001-08-07 10:35   ` [PATCH] eepro100.c - Add option to disable power saving in2.4.7-ac7 Martin Knoblauch
  2001-08-07 20:55 ` [PATCH] eepro100.c - Add option to disable power saving in 2.4.7-ac7 Admin Mailing Lists
  2 siblings, 1 reply; 6+ messages in thread
From: Kai Germaschewski @ 2001-08-06 16:49 UTC (permalink / raw)
  To: Martin Knoblauch; +Cc: linux-kernel, Alan Cox, Andrey Savochkin

On Mon, 6 Aug 2001, Martin Knoblauch wrote:

>  after realizing that my first attempt for this patch was to
> enthusiastic, I have no a somewhat stripped down version. Compiles
> against 2.4.7-ac7.

I have an even smaller version. You can select the D state for sleeping as 
a parameter, 0 should fix Martin's flaky hardware, 2 is the default - 
current behavior.

--Kai

--- linux-2.4.7-ac2/drivers/net/eepro100.c	Sat Jul 28 10:24:55 2001
+++ linux-2.4.7-ac2.work/drivers/net/eepro100.c	Mon Aug  6 18:49:11 2001
@@ -60,6 +60,8 @@
 static int full_duplex[] = {-1, -1, -1, -1, -1, -1, -1, -1};
 static int options[] = {-1, -1, -1, -1, -1, -1, -1, -1};
 static int debug = -1;			/* The debug level */
+/* power save D state when device is not open */
+static unsigned int sleep_state = 2;
 
 /* A few values that may be tweaked. */
 /* The ring sizes should be a power of two for efficiency. */
@@ -125,6 +127,7 @@
 MODULE_PARM(rx_copybreak, "i");
 MODULE_PARM(max_interrupt_work, "i");
 MODULE_PARM(multicast_filter_limit, "i");
+MODULE_PARM(sleep_state, "i");
 MODULE_PARM_DESC(debug, "eepro100 debug level (0-6)");
 MODULE_PARM_DESC(options, "eepro100: Bits 0-3: tranceiver type, bit 4: full duplex, bit 5: 100Mbps");
 MODULE_PARM_DESC(full_duplex, "eepro100 full duplex setting(s) (1)");
@@ -136,6 +139,7 @@
 MODULE_PARM_DESC(rx_copybreak, "eepro100 copy breakpoint for copy-only-tiny-frames");
 MODULE_PARM_DESC(max_interrupt_work, "eepro100 maximum events handled per interrupt");
 MODULE_PARM_DESC(multicast_filter_limit, "eepro100 maximum number of filtered multicast addresses");
+MODULE_PARM_DESC(sleep_state, "eepro100 power save D state (default 2)");
 
 #define RUN_AT(x) (jiffies + (x))
 
@@ -777,8 +781,10 @@
 	inl(ioaddr + SCBPort);
 	udelay(10);
 
-	/* Put chip into power state D2 until we open() it. */
-	pci_set_power_state(pdev, 2);
+	if (sleep_state > 2)
+		sleep_state = 2;
+	/* Put chip into power saving state until we open() it. */
+	pci_set_power_state(pdev, sleep_state);
 
 	pci_set_drvdata (pdev, dev);
 
@@ -1833,7 +1839,7 @@
 	if (speedo_debug > 0)
 		printk(KERN_DEBUG "%s: %d multicast blocks dropped.\n", dev->name, i);
 
-	pci_set_power_state(sp->pdev, 2);
+	pci_set_power_state(sp->pdev, sleep_state);
 
 	MOD_DEC_USE_COUNT;
 


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

* Re: [PATCH] eepro100.c - Add option to disable power saving in2.4.7-ac7
  2001-08-06 16:49 ` [PATCH] " Kai Germaschewski
@ 2001-08-07 10:35   ` Martin Knoblauch
  0 siblings, 0 replies; 6+ messages in thread
From: Martin Knoblauch @ 2001-08-07 10:35 UTC (permalink / raw)
  To: Kai Germaschewski; +Cc: linux-kernel, Alan Cox, Andrey Savochkin

Kai Germaschewski wrote:
> 
> On Mon, 6 Aug 2001, Martin Knoblauch wrote:
> 
> >  after realizing that my first attempt for this patch was to
> > enthusiastic, I have no a somewhat stripped down version. Compiles
> > against 2.4.7-ac7.
> 
> I have an even smaller version. You can select the D state for sleeping as
> a parameter, 0 should fix Martin's flaky hardware, 2 is the default -
> current behavior.
> 
> --Kai
> 
> --- linux-2.4.7-ac2/drivers/net/eepro100.c      Sat Jul 28 10:24:55 2001
> +++ linux-2.4.7-ac2.work/drivers/net/eepro100.c Mon Aug  6 18:49:11 2001
> @@ -60,6 +60,8 @@
>  static int full_duplex[] = {-1, -1, -1, -1, -1, -1, -1, -1};
>  static int options[] = {-1, -1, -1, -1, -1, -1, -1, -1};
>  static int debug = -1;                 /* The debug level */
> +/* power save D state when device is not open */
> +static unsigned int sleep_state = 2;
> 
>  /* A few values that may be tweaked. */
>  /* The ring sizes should be a power of two for efficiency. */
> @@ -125,6 +127,7 @@
>  MODULE_PARM(rx_copybreak, "i");
>  MODULE_PARM(max_interrupt_work, "i");
>  MODULE_PARM(multicast_filter_limit, "i");
> +MODULE_PARM(sleep_state, "i");
>  MODULE_PARM_DESC(debug, "eepro100 debug level (0-6)");
>  MODULE_PARM_DESC(options, "eepro100: Bits 0-3: tranceiver type, bit 4: full duplex, bit 5: 100Mbps");
>  MODULE_PARM_DESC(full_duplex, "eepro100 full duplex setting(s) (1)");
> @@ -136,6 +139,7 @@
>  MODULE_PARM_DESC(rx_copybreak, "eepro100 copy breakpoint for copy-only-tiny-frames");
>  MODULE_PARM_DESC(max_interrupt_work, "eepro100 maximum events handled per interrupt");
>  MODULE_PARM_DESC(multicast_filter_limit, "eepro100 maximum number of filtered multicast addresses");
> +MODULE_PARM_DESC(sleep_state, "eepro100 power save D state (default 2)");
> 
>  #define RUN_AT(x) (jiffies + (x))
> 
> @@ -777,8 +781,10 @@
>         inl(ioaddr + SCBPort);
>         udelay(10);
> 
> -       /* Put chip into power state D2 until we open() it. */
> -       pci_set_power_state(pdev, 2);
> +       if (sleep_state > 2)
> +               sleep_state = 2;
> +       /* Put chip into power saving state until we open() it. */
> +       pci_set_power_state(pdev, sleep_state);
> 
>         pci_set_drvdata (pdev, dev);
> 
> @@ -1833,7 +1839,7 @@
>         if (speedo_debug > 0)
>                 printk(KERN_DEBUG "%s: %d multicast blocks dropped.\n", dev->name, i);
> 
> -       pci_set_power_state(sp->pdev, 2);
> +       pci_set_power_state(sp->pdev, sleep_state);
> 
>         MOD_DEC_USE_COUNT;
> 


 Great. Will definitely do the job for me and others with "funny" acting
eepro100s.

Martin
-- 
------------------------------------------------------------------
Martin Knoblauch         |    email:  Martin.Knoblauch@TeraPort.de
TeraPort GmbH            |    Phone:  +49-89-510857-309
C+ITS                    |    Fax:    +49-89-510857-111
http://www.teraport.de   |    Mobile: +49-170-4904759

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

* Re: [PATCH] eepro100.c - Add option to disable power saving in 2.4.7-ac7
  2001-08-06 15:48 [PATCH] eepro100.c - Add option to disable power saving in 2.4.7-ac7 Martin Knoblauch
  2001-08-06 16:10 ` Andrey Savochkin
  2001-08-06 16:49 ` [PATCH] " Kai Germaschewski
@ 2001-08-07 20:55 ` Admin Mailing Lists
  2001-08-08  7:26   ` [PATCH] eepro100.c - Add option to disable power saving in2.4.7-ac7 Martin Knoblauch
  2 siblings, 1 reply; 6+ messages in thread
From: Admin Mailing Lists @ 2001-08-07 20:55 UTC (permalink / raw)
  To: Martin Knoblauch; +Cc: linux-kernel


On Mon, 6 Aug 2001, Martin Knoblauch wrote:

> Hi,
> 
>  after realizing that my first attempt for this patch was to
> enthusiastic, I have no a somewhat stripped down version. Compiles
> against 2.4.7-ac7.
> 
>  The patch adds the option "power_save" to eepro100. If "1" (default),
> power save handling is done as normal. If "0", no power saving is done.
> This is to workaround some flaky eepro100 adapters that do not survive
> D0->D2-D0 transitions.
> 

i'm assuming if APM isn't configured in the kernel, these options dont
matter?

-Tony
.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-.
Anthony J. Biacco                       Network Administrator/Engineer
thelittleprince@asteroid-b612.org       Intergrafix Internet Services

    "Dream as if you'll live forever, live as if you'll die today"
http://www.asteroid-b612.org                http://www.intergrafix.net
.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-.


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

* Re: [PATCH] eepro100.c - Add option to disable power saving in2.4.7-ac7
  2001-08-07 20:55 ` [PATCH] eepro100.c - Add option to disable power saving in 2.4.7-ac7 Admin Mailing Lists
@ 2001-08-08  7:26   ` Martin Knoblauch
  0 siblings, 0 replies; 6+ messages in thread
From: Martin Knoblauch @ 2001-08-08  7:26 UTC (permalink / raw)
  To: Admin Mailing Lists; +Cc: linux-kernel

Admin Mailing Lists wrote:
> 
> On Mon, 6 Aug 2001, Martin Knoblauch wrote:
> 
> > Hi,
> >
> >  after realizing that my first attempt for this patch was to
> > enthusiastic, I have no a somewhat stripped down version. Compiles
> > against 2.4.7-ac7.
> >
> >  The patch adds the option "power_save" to eepro100. If "1" (default),
> > power save handling is done as normal. If "0", no power saving is done.
> > This is to workaround some flaky eepro100 adapters that do not survive
> > D0->D2-D0 transitions.
> >
> 
> i'm assuming if APM isn't configured in the kernel, these options dont
> matter?
> 

 hmm. I would assume that your assumption is correct.

Martin
-- 
------------------------------------------------------------------
Martin Knoblauch         |    email:  Martin.Knoblauch@TeraPort.de
TeraPort GmbH            |    Phone:  +49-89-510857-309
C+ITS                    |    Fax:    +49-89-510857-111
http://www.teraport.de   |    Mobile: +49-170-4904759

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

end of thread, other threads:[~2001-08-08  7:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-06 15:48 [PATCH] eepro100.c - Add option to disable power saving in 2.4.7-ac7 Martin Knoblauch
2001-08-06 16:10 ` Andrey Savochkin
2001-08-06 16:49 ` [PATCH] " Kai Germaschewski
2001-08-07 10:35   ` [PATCH] eepro100.c - Add option to disable power saving in2.4.7-ac7 Martin Knoblauch
2001-08-07 20:55 ` [PATCH] eepro100.c - Add option to disable power saving in 2.4.7-ac7 Admin Mailing Lists
2001-08-08  7:26   ` [PATCH] eepro100.c - Add option to disable power saving in2.4.7-ac7 Martin Knoblauch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).