All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 1/2] spidernet: enable support for bcm5461 ethernet phy
       [not found] <20060504155034.486042000@>
@ 2006-05-04  9:59 ` Jens Osterkamp
  2006-05-24  5:29   ` Jeff Garzik
  2006-05-04  9:59 ` [patch 2/2] spidernet: introduce new setting Jens Osterkamp
  1 sibling, 1 reply; 4+ messages in thread
From: Jens Osterkamp @ 2006-05-04  9:59 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev, arndb, utz.bacher

From: Jens Osterkamp <Jens.Osterkamp@de.ibm.com>

A newer board revision changed the type of ethernet phy.
Moreover, this generalizes the way that a phy gets switched
into fiber mode when autodetection is not available.

Signed-off-by: Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>

---
Index: linus-2.6/drivers/net/sungem_phy.c
===================================================================
--- linus-2.6.orig/drivers/net/sungem_phy.c
+++ linus-2.6/drivers/net/sungem_phy.c
@@ -329,6 +329,30 @@ static int bcm5421_init(struct mii_phy* 
 	return 0;
 }
 
+static int bcm5421_enable_fiber(struct mii_phy* phy)
+{
+	/* enable fiber mode */
+	phy_write(phy, MII_NCONFIG, 0x9020);
+	/* LEDs active in both modes, autosense prio = fiber */
+	phy_write(phy, MII_NCONFIG, 0x945f);
+
+	/* switch off fibre autoneg */
+	phy_write(phy, MII_NCONFIG, 0xfc01);
+	phy_write(phy, 0x0b, 0x0004);
+
+	return 0;
+}
+
+static int bcm5461_enable_fiber(struct mii_phy* phy)
+{
+        phy_write(phy, MII_NCONFIG, 0xfc0c);
+        phy_write(phy, MII_BMCR, 0x4140);
+        phy_write(phy, MII_NCONFIG, 0xfc0b);
+	phy_write(phy, MII_BMCR, 0x0140);
+
+	return 0;
+}
+
 static int bcm54xx_setup_aneg(struct mii_phy *phy, u32 advertise)
 {
 	u16 ctl, adv;
@@ -762,6 +786,7 @@ static struct mii_phy_ops bcm5421_phy_op
 	.setup_forced	= bcm54xx_setup_forced,
 	.poll_link	= genmii_poll_link,
 	.read_link	= bcm54xx_read_link,
+	.enable_fiber   = bcm5421_enable_fiber,
 };
 
 static struct mii_phy_def bcm5421_phy_def = {
@@ -792,6 +817,25 @@ static struct mii_phy_def bcm5421k2_phy_
 	.ops		= &bcm5421k2_phy_ops
 };
 
+static struct mii_phy_ops bcm5461_phy_ops = {
+	.init		= bcm5421_init,
+	.suspend	= generic_suspend,
+	.setup_aneg	= bcm54xx_setup_aneg,
+	.setup_forced	= bcm54xx_setup_forced,
+	.poll_link	= genmii_poll_link,
+	.read_link	= bcm54xx_read_link,
+	.enable_fiber   = bcm5461_enable_fiber,
+};
+
+static struct mii_phy_def bcm5461_phy_def = {
+	.phy_id		= 0x002060c0,
+	.phy_id_mask	= 0xfffffff0,
+	.name		= "BCM5461",
+	.features	= MII_GBIT_FEATURES,
+	.magic_aneg	= 1,
+	.ops		= &bcm5461_phy_ops
+};
+
 /* Broadcom BCM 5462 built-in Vesta */
 static struct mii_phy_ops bcm5462V_phy_ops = {
 	.init		= bcm5421_init,
@@ -857,6 +901,7 @@ static struct mii_phy_def* mii_phy_table
 	&bcm5411_phy_def,
 	&bcm5421_phy_def,
 	&bcm5421k2_phy_def,
+	&bcm5461_phy_def,
 	&bcm5462V_phy_def,
 	&marvell_phy_def,
 	&genmii_phy_def,
Index: linus-2.6/drivers/net/spider_net.c
===================================================================
--- linus-2.6.orig/drivers/net/spider_net.c
+++ linus-2.6/drivers/net/spider_net.c
@@ -1792,15 +1792,7 @@ spider_net_setup_phy(struct spider_net_c
 	if (phy->def->ops->setup_forced)
 		phy->def->ops->setup_forced(phy, SPEED_1000, DUPLEX_FULL);
 
-	/* the following two writes could be moved to sungem_phy.c */
-	/* enable fiber mode */
-	spider_net_write_phy(card->netdev, 1, MII_NCONFIG, 0x9020);
-	/* LEDs active in both modes, autosense prio = fiber */
-	spider_net_write_phy(card->netdev, 1, MII_NCONFIG, 0x945f);
-
-	/* switch off fibre autoneg */
-	spider_net_write_phy(card->netdev, 1, MII_NCONFIG, 0xfc01);
-	spider_net_write_phy(card->netdev, 1, 0x0b, 0x0004);
+	phy->def->ops->enable_fiber(phy);
 
 	phy->def->ops->read_link(phy);
 	pr_info("Found %s with %i Mbps, %s-duplex.\n", phy->def->name,
Index: linus-2.6/drivers/net/sungem_phy.h
===================================================================
--- linus-2.6.orig/drivers/net/sungem_phy.h
+++ linus-2.6/drivers/net/sungem_phy.h
@@ -12,6 +12,7 @@ struct mii_phy_ops
 	int		(*setup_forced)(struct mii_phy *phy, int speed, int fd);
 	int		(*poll_link)(struct mii_phy *phy);
 	int		(*read_link)(struct mii_phy *phy);
+	int		(*enable_fiber)(struct mii_phy *phy);
 };
 
 /* Structure used to statically define an mii/gii based PHY */

--


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

* [patch 2/2] spidernet: introduce new setting
       [not found] <20060504155034.486042000@>
  2006-05-04  9:59 ` [patch 1/2] spidernet: enable support for bcm5461 ethernet phy Jens Osterkamp
@ 2006-05-04  9:59 ` Jens Osterkamp
  1 sibling, 0 replies; 4+ messages in thread
From: Jens Osterkamp @ 2006-05-04  9:59 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev, arndb, utz.bacher

From: Jens Osterkamp <jens.osterkamp@de.ibm.com>

We found a new chip setting that we need in order
to make the driver work more reliable.

Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>

Index: linux-2.6.17-rc3/drivers/net/spider_net.c
===================================================================
--- linux-2.6.17-rc3.orig/drivers/net/spider_net.c
+++ linux-2.6.17-rc3/drivers/net/spider_net.c
@@ -1652,6 +1652,8 @@ spider_net_enable_card(struct spider_net
 		{ SPIDER_NET_GFTRESTRT, SPIDER_NET_RESTART_VALUE },
 
 		{ SPIDER_NET_GMRWOLCTRL, 0 },
+		{ SPIDER_NET_GTESTMD, 0x10000000 },
+		{ SPIDER_NET_GTTQMSK, 0x00400040 },
 		{ SPIDER_NET_GTESTMD, 0 },
 
 		{ SPIDER_NET_GMACINTEN, 0 },
Index: linux-2.6.17-rc3/drivers/net/spider_net.h
===================================================================
--- linux-2.6.17-rc3.orig/drivers/net/spider_net.h
+++ linux-2.6.17-rc3/drivers/net/spider_net.h
@@ -120,6 +120,8 @@ extern char spider_net_driver_name[];
 #define SPIDER_NET_GMRUAFILnR		0x00000500
 #define SPIDER_NET_GMRUA0FIL15R		0x00000578
 
+#define SPIDER_NET_GTTQMSK		0x00000934
+
 /* RX DMA controller registers, all 0x00000a.. are for DMA controller A,
  * 0x00000b.. for DMA controller B, etc. */
 #define SPIDER_NET_GDADCHA		0x00000a00

--


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

* Re: [patch 1/2] spidernet: enable support for bcm5461 ethernet phy
  2006-05-04  9:59 ` [patch 1/2] spidernet: enable support for bcm5461 ethernet phy Jens Osterkamp
@ 2006-05-24  5:29   ` Jeff Garzik
  2006-05-24 21:23     ` Jens Osterkamp
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Garzik @ 2006-05-24  5:29 UTC (permalink / raw)
  To: Jens.Osterkamp; +Cc: netdev, arndb, utz.bacher

Jens Osterkamp wrote:
> From: Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
> 
> A newer board revision changed the type of ethernet phy.
> Moreover, this generalizes the way that a phy gets switched
> into fiber mode when autodetection is not available.
> 
> Signed-off-by: Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
> Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
> 
> ---
> Index: linus-2.6/drivers/net/sungem_phy.c
> ===================================================================
> --- linus-2.6.orig/drivers/net/sungem_phy.c
> +++ linus-2.6/drivers/net/sungem_phy.c
> @@ -329,6 +329,30 @@ static int bcm5421_init(struct mii_phy* 
>  	return 0;
>  }
>  
> +static int bcm5421_enable_fiber(struct mii_phy* phy)
> +{
> +	/* enable fiber mode */
> +	phy_write(phy, MII_NCONFIG, 0x9020);
> +	/* LEDs active in both modes, autosense prio = fiber */
> +	phy_write(phy, MII_NCONFIG, 0x945f);
> +
> +	/* switch off fibre autoneg */
> +	phy_write(phy, MII_NCONFIG, 0xfc01);
> +	phy_write(phy, 0x0b, 0x0004);
> +
> +	return 0;
> +}
> +
> +static int bcm5461_enable_fiber(struct mii_phy* phy)
> +{
> +        phy_write(phy, MII_NCONFIG, 0xfc0c);
> +        phy_write(phy, MII_BMCR, 0x4140);
> +        phy_write(phy, MII_NCONFIG, 0xfc0b);
> +	phy_write(phy, MII_BMCR, 0x0140);

NAK, failed to apply.  Also, the whitespace above is borked.

	Jeff




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

* Re: [patch 1/2] spidernet: enable support for bcm5461 ethernet phy
  2006-05-24  5:29   ` Jeff Garzik
@ 2006-05-24 21:23     ` Jens Osterkamp
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Osterkamp @ 2006-05-24 21:23 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Arnd Bergmann, netdev, Utz Bacher

Jeff Garzik <jgarzik@pobox.com> wrote on 05/24/2006 07:29:24 AM:

> NAK, failed to apply.  Also, the whitespace above is borked.

I think the patch is already in 2.6.17-rc4. I will send send a patch to
turn the whitespaces into
tabs.

Jens


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

end of thread, other threads:[~2006-05-24 21:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20060504155034.486042000@>
2006-05-04  9:59 ` [patch 1/2] spidernet: enable support for bcm5461 ethernet phy Jens Osterkamp
2006-05-24  5:29   ` Jeff Garzik
2006-05-24 21:23     ` Jens Osterkamp
2006-05-04  9:59 ` [patch 2/2] spidernet: introduce new setting Jens Osterkamp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.