From: Vitaly Bordug <vitb@kernel.crashing.org>
To: Jochen Friedrich <jochen@scram.de>
Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org,
Jeff Garzik <jeff@garzik.org>,
netdev@vger.kernel.org
Subject: Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality
Date: Sat, 1 Dec 2007 22:07:02 +0300 [thread overview]
Message-ID: <20071201220702.5b9e9b4d@kernel.crashing.org> (raw)
In-Reply-To: <47516646.9000803@scram.de>
On Sat, 01 Dec 2007 14:48:54 +0100
Jochen Friedrich wrote:
> Hi Vitaly,
>
> > With that patch fixed.c now fully emulates MDIO bus, thus no need
> > to duplicate PHY layer functionality. That, in turn, drastically
> > simplifies the code, and drops down line count.
> >
> > As an additional bonus, now there is no need to register MDIO bus
> > for each PHY, all emulated PHYs placed on the platform fixed MDIO
> > bus. There is also no more need to pre-allocate PHYs via .config
> > option, this is all now handled dynamically.
> >
> > p.s. Don't even try to understand patch content! Better: apply patch
> > and look into resulting drivers/net/phy/fixed.c.
> >
> If i understand your code correctly, you seem to rely on the fact
> that fixed_phy_add() is called before the fixed MDIO bus is scanned
> for devices. How is this supposed to work for modules or for the
> PPC_CPM_NEW_BINDING mode where the device tree is no longer scanned
> during fs_soc initialization but during device initialization?
>
Well, this is kind of known issue - to work it around for now, place PHY lib after fs_enet in
Makefile. This way it works for me for _NEW_BINDING and mpc866ads.
> I tried to add fixed-phy support to fs_enet, but the fixed phy is not
> found this way.
>
The point is I have the code and it works now(for fs_enet etc.), but I need to find the way for the fixed phy pinning to work in either order with phylib. If you have ideas, please go ahead :)
> --- a/drivers/net/fs_enet/fs_enet-main.c
> +++ b/drivers/net/fs_enet/fs_enet-main.c
> @@ -36,6 +36,7 @@
> #include <linux/fs.h>
> #include <linux/platform_device.h>
> #include <linux/phy.h>
> +#include <linux/phy_fixed.h>
>
> #include <linux/vmalloc.h>
> #include <asm/pgtable.h>
> @@ -1174,8 +1175,24 @@ static int __devinit find_phy(struct
> device_node *np, struct device_node *phynode, *mdionode;
> struct resource res;
> int ret = 0, len;
> + const u32 *data;
> + struct fixed_phy_status status = {};
> +
> + data = of_get_property(np, "fixed-link", NULL);
> + if (data) {
> + status.link = 1;
> + status.duplex = data[1];
> + status.speed = data[2];
> +
> + ret = fixed_phy_add(PHY_POLL, data[0], &status);
> + if (ret)
> + return ret;
> +
> + snprintf(fpi->bus_id, 16, PHY_ID_FMT, 0, *data);
> + return 0;
> + }
>
> - const u32 *data = of_get_property(np, "phy-handle", &len);
> + data = of_get_property(np, "phy-handle", &len);
> if (!data || len != 4)
> return -EINVAL;
>
> Thanks,
> Jochen
--
Sincerely, Vitaly
WARNING: multiple messages have this Message-ID (diff)
From: Vitaly Bordug <vitb@kernel.crashing.org>
To: Jochen Friedrich <jochen@scram.de>
Cc: Jeff Garzik <jeff@garzik.org>,
linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, Scott Wood <scottwood@freescale.com>
Subject: Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality
Date: Sat, 1 Dec 2007 22:07:02 +0300 [thread overview]
Message-ID: <20071201220702.5b9e9b4d@kernel.crashing.org> (raw)
In-Reply-To: <47516646.9000803@scram.de>
On Sat, 01 Dec 2007 14:48:54 +0100
Jochen Friedrich wrote:
> Hi Vitaly,
>
> > With that patch fixed.c now fully emulates MDIO bus, thus no need
> > to duplicate PHY layer functionality. That, in turn, drastically
> > simplifies the code, and drops down line count.
> >
> > As an additional bonus, now there is no need to register MDIO bus
> > for each PHY, all emulated PHYs placed on the platform fixed MDIO
> > bus. There is also no more need to pre-allocate PHYs via .config
> > option, this is all now handled dynamically.
> >
> > p.s. Don't even try to understand patch content! Better: apply patch
> > and look into resulting drivers/net/phy/fixed.c.
> >
> If i understand your code correctly, you seem to rely on the fact
> that fixed_phy_add() is called before the fixed MDIO bus is scanned
> for devices. How is this supposed to work for modules or for the
> PPC_CPM_NEW_BINDING mode where the device tree is no longer scanned
> during fs_soc initialization but during device initialization?
>
Well, this is kind of known issue - to work it around for now, place PHY lib after fs_enet in
Makefile. This way it works for me for _NEW_BINDING and mpc866ads.
> I tried to add fixed-phy support to fs_enet, but the fixed phy is not
> found this way.
>
The point is I have the code and it works now(for fs_enet etc.), but I need to find the way for the fixed phy pinning to work in either order with phylib. If you have ideas, please go ahead :)
> --- a/drivers/net/fs_enet/fs_enet-main.c
> +++ b/drivers/net/fs_enet/fs_enet-main.c
> @@ -36,6 +36,7 @@
> #include <linux/fs.h>
> #include <linux/platform_device.h>
> #include <linux/phy.h>
> +#include <linux/phy_fixed.h>
>
> #include <linux/vmalloc.h>
> #include <asm/pgtable.h>
> @@ -1174,8 +1175,24 @@ static int __devinit find_phy(struct
> device_node *np, struct device_node *phynode, *mdionode;
> struct resource res;
> int ret = 0, len;
> + const u32 *data;
> + struct fixed_phy_status status = {};
> +
> + data = of_get_property(np, "fixed-link", NULL);
> + if (data) {
> + status.link = 1;
> + status.duplex = data[1];
> + status.speed = data[2];
> +
> + ret = fixed_phy_add(PHY_POLL, data[0], &status);
> + if (ret)
> + return ret;
> +
> + snprintf(fpi->bus_id, 16, PHY_ID_FMT, 0, *data);
> + return 0;
> + }
>
> - const u32 *data = of_get_property(np, "phy-handle", &len);
> + data = of_get_property(np, "phy-handle", &len);
> if (!data || len != 4)
> return -EINVAL;
>
> Thanks,
> Jochen
--
Sincerely, Vitaly
next prev parent reply other threads:[~2007-12-01 19:07 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-26 14:29 [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality Vitaly Bordug
2007-11-26 14:29 ` Vitaly Bordug
2007-11-26 14:29 ` [PATCH 2/3] [POWERPC] fsl_soc: add support for gianfar for fixed-link property Vitaly Bordug
2007-11-26 14:29 ` Vitaly Bordug
2007-11-26 15:04 ` Joakim Tjernlund
2007-11-26 15:04 ` [PATCH 2/3] [POWERPC] fsl_soc: add support for gianfar forfixed-link property Joakim Tjernlund
2007-11-27 11:39 ` [PATCH 2/3] [POWERPC] fsl_soc: add support for gianfar for fixed-link property Anton Vorontsov
2007-11-27 11:39 ` Anton Vorontsov
2007-11-27 13:17 ` Joakim Tjernlund
2007-11-27 13:17 ` Joakim Tjernlund
2007-11-27 13:59 ` Anton Vorontsov
2007-11-27 13:59 ` Anton Vorontsov
2007-11-27 14:01 ` Joakim Tjernlund
2007-11-27 14:01 ` Joakim Tjernlund
2007-11-26 14:29 ` [PATCH 3/3] [POWERPC] MPC8349E-mITX: Vitesse 7385 PHY is not connected to the MDIO bus Vitaly Bordug
2007-11-26 14:29 ` Vitaly Bordug
2007-12-01 13:48 ` [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality Jochen Friedrich
2007-12-01 13:48 ` Jochen Friedrich
2007-12-01 19:07 ` Vitaly Bordug [this message]
2007-12-01 19:07 ` Vitaly Bordug
2007-12-01 21:34 ` Anton Vorontsov
2007-12-01 21:34 ` Anton Vorontsov
2007-12-01 22:22 ` Vitaly Bordug
2007-12-01 22:22 ` Vitaly Bordug
2007-12-01 23:27 ` Stephen Rothwell
2007-12-01 23:27 ` Stephen Rothwell
2007-12-02 11:54 ` [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHYlayer functionality Joakim Tjernlund
2007-12-02 11:54 ` Joakim Tjernlund
2007-12-02 12:13 ` Anton Vorontsov
2007-12-02 12:13 ` Anton Vorontsov
2007-12-01 21:59 ` [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality Jeff Garzik
2007-12-01 21:59 ` Jeff Garzik
2007-12-01 22:16 ` Vitaly Bordug
2007-12-01 22:16 ` Vitaly Bordug
2007-12-04 20:07 ` Jeff Garzik
2007-12-04 20:07 ` Jeff Garzik
2007-12-05 1:22 ` Vitaly Bordug
2007-12-05 1:22 ` Vitaly Bordug
-- strict thread matches above, loose matches on Subject: below --
2007-12-06 22:51 Vitaly Bordug
2007-12-06 22:51 ` Vitaly Bordug
2008-01-18 6:45 ` Kumar Gala
2008-01-18 6:45 ` Kumar Gala
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071201220702.5b9e9b4d@kernel.crashing.org \
--to=vitb@kernel.crashing.org \
--cc=jeff@garzik.org \
--cc=jochen@scram.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.