All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Joakim Tjernlund" <joakim.tjernlund@transmode.se>
To: <cbou@mail.ru>, "'Jochen Friedrich'" <jochen@scram.de>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	'Jeff Garzik' <jeff@garzik.org>,
	linuxppc-dev@ozlabs.org
Subject: RE: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHYlayer functionality
Date: Sun, 2 Dec 2007 12:54:36 +0100	[thread overview]
Message-ID: <051e01c834da$1cce82f0$5267a8c0@Jocke> (raw)
In-Reply-To: <20071201213403.GA2350@zarina>

[SNIP]
> ^^ the correct solution is to implement arch_initcall function
> which will create fixed PHYs, and then leave only
> snprintf(fpi->bus_id, 16, PHY_ID_FMT, 0, *data); part in the
> fs_enet's find_phy().
> 
> Try add something like this to the fsl_soc.c (compile untested):
> 
> - - - -
> static int __init of_add_fixed_phys(void)
> {
> 	struct device_node *np;
> 	const u32 *prop;
> 	struct fixed_phy_status status = {};
> 
> 	while ((np = of_find_node_by_name(NULL, "ethernet"))) {
> 		data  = of_get_property(np, "fixed-link", NULL);
> 		if (!data)
> 			continue;
> 
> 		status.link = 1;
> 		status.duplex = data[1];
> 		status.speed  = data[2];

What about Pause and Asym_Pause? Dunno why so few, if any, eth drivers
impl. it, but the PHY lib supports it.
Even if fixed PHYs doesn't support it directly I think the OF interface
should have it.

    - fixed-link : <a b c d e> where a is emulated phy id - choose any,
      but unique to the all specified fixed-links, b is duplex - 0 half,
      1 full, c is link speed - d#10/d#100/d#1000, d is pause - 0 no pause,
      1 pause, d asym_pause - 0 no asym_pause, 1 asym_pause.

Jocke

> 
> 		ret = fixed_phy_add(PHY_POLL, data[0], &status);
> 		if (ret)
> 			return ret;
> 	}
> 
> 	return 0;
> }
> arch_initcall(of_add_fixed_phys);
> - - - -
> 
> And remove fixed_phy_add() from the fs_enet. This should work
> nicely and also should be ideologically correct. ;-)
> 
> > 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?
> 
> We should mark fixed.c as bool. Fake/virtual/fixed/platform PHYs
> creation is architecture code anyway, can't be =m.
> 
> -- 
> Anton Vorontsov
> email: cbou@mail.ru
> backup email: ya-cbou@yandex.ru
> irc://irc.freenode.net/bd2

WARNING: multiple messages have this Message-ID (diff)
From: "Joakim Tjernlund" <joakim.tjernlund@transmode.se>
To: <cbou@mail.ru>, "'Jochen Friedrich'" <jochen@scram.de>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"'Jeff Garzik'" <jeff@garzik.org>, <linuxppc-dev@ozlabs.org>
Subject: RE: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHYlayer functionality
Date: Sun, 2 Dec 2007 12:54:36 +0100	[thread overview]
Message-ID: <051e01c834da$1cce82f0$5267a8c0@Jocke> (raw)
In-Reply-To: <20071201213403.GA2350@zarina>

[SNIP]
> ^^ the correct solution is to implement arch_initcall function
> which will create fixed PHYs, and then leave only
> snprintf(fpi->bus_id, 16, PHY_ID_FMT, 0, *data); part in the
> fs_enet's find_phy().
> 
> Try add something like this to the fsl_soc.c (compile untested):
> 
> - - - -
> static int __init of_add_fixed_phys(void)
> {
> 	struct device_node *np;
> 	const u32 *prop;
> 	struct fixed_phy_status status = {};
> 
> 	while ((np = of_find_node_by_name(NULL, "ethernet"))) {
> 		data  = of_get_property(np, "fixed-link", NULL);
> 		if (!data)
> 			continue;
> 
> 		status.link = 1;
> 		status.duplex = data[1];
> 		status.speed  = data[2];

What about Pause and Asym_Pause? Dunno why so few, if any, eth drivers
impl. it, but the PHY lib supports it.
Even if fixed PHYs doesn't support it directly I think the OF interface
should have it.

    - fixed-link : <a b c d e> where a is emulated phy id - choose any,
      but unique to the all specified fixed-links, b is duplex - 0 half,
      1 full, c is link speed - d#10/d#100/d#1000, d is pause - 0 no pause,
      1 pause, d asym_pause - 0 no asym_pause, 1 asym_pause.

Jocke

> 
> 		ret = fixed_phy_add(PHY_POLL, data[0], &status);
> 		if (ret)
> 			return ret;
> 	}
> 
> 	return 0;
> }
> arch_initcall(of_add_fixed_phys);
> - - - -
> 
> And remove fixed_phy_add() from the fs_enet. This should work
> nicely and also should be ideologically correct. ;-)
> 
> > 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?
> 
> We should mark fixed.c as bool. Fake/virtual/fixed/platform PHYs
> creation is architecture code anyway, can't be =m.
> 
> -- 
> Anton Vorontsov
> email: cbou@mail.ru
> backup email: ya-cbou@yandex.ru
> irc://irc.freenode.net/bd2


  parent reply	other threads:[~2007-12-02 11:54 UTC|newest]

Thread overview: 38+ 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
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     ` Joakim Tjernlund [this message]
2007-12-02 11:54       ` [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHYlayer functionality 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

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='051e01c834da$1cce82f0$5267a8c0@Jocke' \
    --to=joakim.tjernlund@transmode.se \
    --cc=cbou@mail.ru \
    --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.