[PATCH] b44: power down PHY when interface down

Stephen Hemminger shemminger at linux-foundation.org
Sat Jun 30 05:13:02 PDT 2007


On Sat, 30 Jun 2007 14:47:35 +0300
"Török Edvin" <edwintorok at gmail.com> wrote:

> When the interface is down (or driver removed), the BroadCom 44xx card remains
> powered on, and both its MAC and PHY is using up power.
> This patch makes the driver issue a MAC_CTRL_PHY_PDOWN when the interface
> is halted, and does a partial chip reset turns off the activity LEDs too.
> 
> Applies to 2.6.22-rc6, or current git head.
> 
> Tested on a Broadcom BCM4401-B0 card, it saves ~0.5W (measured using powertop).
> 
> Signed-off-by: Torok Edwin <edwintorok at gmail.com>
> ---
>  b44.c |   25 ++++++++++++++++++++-----
>   1 file changed, 20 insertions(+), 5 deletions(-)
> diff --git a/drivers/net/b44.c b/drivers/net/b44.c
> index 879a2ff..00d0f57 100644
> --- a/drivers/net/b44.c
> +++ b/drivers/net/b44.c
> @@ -113,6 +113,8 @@ static void b44_init_rings(struct b44 *);
>  #define B44_FULL_RESET		1
>  #define B44_FULL_RESET_SKIP_PHY	2
>  #define B44_PARTIAL_RESET	3
> +#define B44_CHIP_RESET_FULL     4
> +#define B44_CHIP_RESET_PARTIAL  5
> 
>  static void b44_init_hw(struct b44 *, int);
> 
> @@ -1283,7 +1285,7 @@ static void b44_clear_stats(struct b44 *bp)
>  }
> 
>  /* bp->lock is held. */
> -static void b44_chip_reset(struct b44 *bp)
> +static void b44_chip_reset(struct b44 *bp, int reset_kind)
>  {
>  	if (ssb_is_core_up(bp)) {
>  		bw32(bp, B44_RCV_LAZY, 0);
> @@ -1307,6 +1309,10 @@ static void b44_chip_reset(struct b44 *bp)
> 
>  	b44_clear_stats(bp);
> 
> +	if (reset_kind == B44_CHIP_RESET_PARTIAL)
> +		return;/* don't enable PHY if we are doing a partial reset
> +		, we are probably going to power down */
> +

This is a non-standard formatting for comments, please follow
Coding style:


Linux style for comments is the C89 "/* ... */" style.
Don't use C99-style "// ..." comments.

The preferred style for long (multi-line) comments is:

	/*
	 * This is the preferred style for multi-line
	 * comments in the Linux kernel source code.
	 * Please use it consistently.
	 *
	 * Description:  A column of asterisks on the left side,
	 * with beginning and ending almost-blank lines.
	 */





More information about the Power mailing list