linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] [POWERPC] Add support of platforms without PHY to gianfar driver
@ 2007-07-25 17:43 Vitaly Bordug
  2007-07-25 17:43 ` [PATCH 2/2] [POWERPC] Remove dummy network phy from MPC8313E-RDB Vitaly Bordug
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Vitaly Bordug @ 2007-07-25 17:43 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linuxppc-dev, linux-kernel, netdev


Gianfar driver is now able to work without real phy subnode,
that is necessary to cope with fixed-link situation, when
SoC is connected to the Ethernet inteface or embedded switch 
without any PHY. In this case, fixed-speed property will
describe such a situation for gianfar driver.

The property is in form <duplexity speed>

Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>

---

 arch/powerpc/sysdev/fsl_soc.c |   39 +++++++++++++++++++++++----------------
 drivers/net/gianfar.c         |   17 ++++++++++++++---
 2 files changed, 37 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index cad1757..6864534 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -255,29 +255,36 @@ static int __init gfar_of_init(void)
 			    FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
 
 		ph = of_get_property(np, "phy-handle", NULL);
-		phy = of_find_node_by_phandle(*ph);
+		if (ph == NULL) {
+			unsigned int *bus_id;
 
-		if (phy == NULL) {
-			ret = -ENODEV;
-			goto unreg;
-		}
+			bus_id = of_get_property(np, "fixed_speed",NULL);
+			gfar_data.bus_id = (bus_id[0]<<16) | bus_id[1];
+		} else {
+			phy = of_find_node_by_phandle(*ph);
 
-		mdio = of_get_parent(phy);
+			if (phy == NULL) {
+				ret = -ENODEV;
+				goto unreg;
+			}
+
+			mdio = of_get_parent(phy);
+
+			id = of_get_property(phy, "reg", NULL);
+			ret = of_address_to_resource(mdio, 0, &res);
+			if (ret) {
+				of_node_put(phy);
+				of_node_put(mdio);
+				goto unreg;
+			}
+
+			gfar_data.phy_id = *id;
+			gfar_data.bus_id = res.start;
 
-		id = of_get_property(phy, "reg", NULL);
-		ret = of_address_to_resource(mdio, 0, &res);
-		if (ret) {
 			of_node_put(phy);
 			of_node_put(mdio);
-			goto unreg;
 		}
 
-		gfar_data.phy_id = *id;
-		gfar_data.bus_id = res.start;
-
-		of_node_put(phy);
-		of_node_put(mdio);
-
 		ret =
 		    platform_device_add_data(gfar_dev, &gfar_data,
 					     sizeof(struct
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 1b854bf..cf08ced 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -93,6 +93,7 @@
 #include <linux/crc32.h>
 #include <linux/mii.h>
 #include <linux/phy.h>
+#include <linux/phy_fixed.h>
 
 #include "gianfar.h"
 #include "gianfar_mii.h"
@@ -445,11 +446,21 @@ static int init_phy(struct net_device *dev)
 	priv->oldspeed = 0;
 	priv->oldduplex = -1;
 
-	snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, priv->einfo->bus_id, priv->einfo->phy_id);
-
 	interface = gfar_get_interface(dev);
 
-	phydev = phy_connect(dev, phy_id, &adjust_link, 0, interface);
+	if (priv->einfo->phy_id) {
+		snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, priv->einfo->bus_id, priv->einfo->phy_id);
+		phydev = phy_connect(dev, phy_id, &adjust_link, 0, interface);
+	} else {
+		struct fixed_info *phyinfo;
+		int phy_addr = (priv->einfo->bus_id >> 16);
+		
+		phyinfo = fixed_mdio_get_phydev(phy_addr-1);
+		phydev = phyinfo->phydev;
+		snprintf(phydev->dev.bus_id, BUS_ID_SIZE, PHY_ID_FMT,
+			(priv->einfo->bus_id & 0xffff) , phy_addr);
+		memset(phyinfo->regs,0xff,sizeof(phyinfo->regs[0])*phyinfo->regs_num);
+	}
 
 	if (IS_ERR(phydev)) {
 		printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);

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

* [PATCH 2/2] [POWERPC] Remove dummy network phy from MPC8313E-RDB
  2007-07-25 17:43 [PATCH 1/2] [POWERPC] Add support of platforms without PHY to gianfar driver Vitaly Bordug
@ 2007-07-25 17:43 ` Vitaly Bordug
  2007-07-25 21:21 ` [PATCH 1/2] [POWERPC] Add support of platforms without PHY to gianfar driver Jeff Garzik
  2007-07-27  0:04 ` Kim Phillips
  2 siblings, 0 replies; 6+ messages in thread
From: Vitaly Bordug @ 2007-07-25 17:43 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linuxppc-dev, linux-kernel, netdev


Cleaned up inexistent network phy from the target dts, added
necessary property to gianfar node there.

Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>

---

 arch/powerpc/boot/dts/mpc8313erdb.dts |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts b/arch/powerpc/boot/dts/mpc8313erdb.dts
index a1533cc..b602a8b 100644
--- a/arch/powerpc/boot/dts/mpc8313erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8313erdb.dts
@@ -98,12 +98,6 @@
 			reg = <24520 20>;
 			#address-cells = <1>;
 			#size-cells = <0>;
-			phy1: ethernet-phy@1 {
-				interrupt-parent = < &ipic >;
-				interrupts = <13 8>;
-				reg = <1>;
-				device_type = "ethernet-phy";
-			};
 			phy4: ethernet-phy@4 {
 				interrupt-parent = < &ipic >;
 				interrupts = <14 8>;
@@ -120,7 +114,7 @@
 			local-mac-address = [ 00 00 00 00 00 00 ];
 			interrupts = <25 8 24 8 23 8>;
 			interrupt-parent = < &ipic >;
-			phy-handle = < &phy1 >;
+			fixed_speed = <1 1000>;
 		};
 
 		ethernet@25000 {

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

* Re: [PATCH 1/2] [POWERPC] Add support of platforms without PHY to gianfar driver
  2007-07-25 17:43 [PATCH 1/2] [POWERPC] Add support of platforms without PHY to gianfar driver Vitaly Bordug
  2007-07-25 17:43 ` [PATCH 2/2] [POWERPC] Remove dummy network phy from MPC8313E-RDB Vitaly Bordug
@ 2007-07-25 21:21 ` Jeff Garzik
  2007-07-27  4:16   ` Kumar Gala
  2007-07-27  0:04 ` Kim Phillips
  2 siblings, 1 reply; 6+ messages in thread
From: Jeff Garzik @ 2007-07-25 21:21 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: linuxppc-dev, linux-kernel, netdev

I'll let paulus and linuxppc merge this one (or not)...

	Jeff

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

* Re: [PATCH 1/2] [POWERPC] Add support of platforms without PHY to gianfar driver
  2007-07-25 17:43 [PATCH 1/2] [POWERPC] Add support of platforms without PHY to gianfar driver Vitaly Bordug
  2007-07-25 17:43 ` [PATCH 2/2] [POWERPC] Remove dummy network phy from MPC8313E-RDB Vitaly Bordug
  2007-07-25 21:21 ` [PATCH 1/2] [POWERPC] Add support of platforms without PHY to gianfar driver Jeff Garzik
@ 2007-07-27  0:04 ` Kim Phillips
  2007-07-27 23:10   ` Vitaly Bordug
  2 siblings, 1 reply; 6+ messages in thread
From: Kim Phillips @ 2007-07-27  0:04 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: linuxppc-dev, Jeff Garzik

On Wed, 25 Jul 2007 21:43:12 +0400
Vitaly Bordug <vitb@kernel.crashing.org> wrote:

> 
> Gianfar driver is now able to work without real phy subnode,
> that is necessary to cope with fixed-link situation, when
> SoC is connected to the Ethernet inteface or embedded switch 
> without any PHY. In this case, fixed-speed property will
> describe such a situation for gianfar driver.
> 
> The property is in form <duplexity speed>
> 
> Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
> 
> ---
> 
>  arch/powerpc/sysdev/fsl_soc.c |   39 +++++++++++++++++++++++----------------
>  drivers/net/gianfar.c         |   17 ++++++++++++++---

please run this through checkpatch.pl until it passes.

<snip>
> +			bus_id = of_get_property(np, "fixed_speed",NULL);

hyphens are preferred for new properties.  Plus, isn't fixed-link a
better name?  unless you instead want to put speed first and make
duplexity an optional second, or possibly even a string.

Also, can we get this new property documented in b-w-of in a separate
patch?

Kim

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

* Re: [PATCH 1/2] [POWERPC] Add support of platforms without PHY to gianfar driver
  2007-07-25 21:21 ` [PATCH 1/2] [POWERPC] Add support of platforms without PHY to gianfar driver Jeff Garzik
@ 2007-07-27  4:16   ` Kumar Gala
  0 siblings, 0 replies; 6+ messages in thread
From: Kumar Gala @ 2007-07-27  4:16 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev, linux-kernel, linuxppc-dev


On Jul 25, 2007, at 4:21 PM, Jeff Garzik wrote:

> I'll let paulus and linuxppc merge this one (or not)...

That would most likely be me, than paulus.  Since this is for a  
Freescale PPC SoC.

- k

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

* Re: [PATCH 1/2] [POWERPC] Add support of platforms without PHY to gianfar driver
  2007-07-27  0:04 ` Kim Phillips
@ 2007-07-27 23:10   ` Vitaly Bordug
  0 siblings, 0 replies; 6+ messages in thread
From: Vitaly Bordug @ 2007-07-27 23:10 UTC (permalink / raw)
  To: Kim Phillips; +Cc: linuxppc-dev, Jeff Garzik

On Thu, 26 Jul 2007 19:04:17 -0500
Kim Phillips wrote:

> On Wed, 25 Jul 2007 21:43:12 +0400
> Vitaly Bordug <vitb@kernel.crashing.org> wrote:
> 
> > 
> > Gianfar driver is now able to work without real phy subnode,
> > that is necessary to cope with fixed-link situation, when
> > SoC is connected to the Ethernet inteface or embedded switch 
> > without any PHY. In this case, fixed-speed property will
> > describe such a situation for gianfar driver.
> > 
> > The property is in form <duplexity speed>
> > 
> > Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
> > 
> > ---
> > 
> >  arch/powerpc/sysdev/fsl_soc.c |   39
> > +++++++++++++++++++++++----------------
> > drivers/net/gianfar.c         |   17 ++++++++++++++---
> 
> please run this through checkpatch.pl until it passes.
> 
> <snip>
> > +			bus_id = of_get_property(np,
> > "fixed_speed",NULL);
> 
> hyphens are preferred for new properties.  Plus, isn't fixed-link a
> better name?  unless you instead want to put speed first and make
> duplexity an optional second, or possibly even a string.
> 
> Also, can we get this new property documented in b-w-of in a separate
> patch?
> 
yes, fixed-link is better name.
I'll redo the patch, thx

> Kim


-- 
Sincerely, Vitaly

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

end of thread, other threads:[~2007-07-27 23:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-25 17:43 [PATCH 1/2] [POWERPC] Add support of platforms without PHY to gianfar driver Vitaly Bordug
2007-07-25 17:43 ` [PATCH 2/2] [POWERPC] Remove dummy network phy from MPC8313E-RDB Vitaly Bordug
2007-07-25 21:21 ` [PATCH 1/2] [POWERPC] Add support of platforms without PHY to gianfar driver Jeff Garzik
2007-07-27  4:16   ` Kumar Gala
2007-07-27  0:04 ` Kim Phillips
2007-07-27 23:10   ` Vitaly Bordug

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).