mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Clément Leger" <cleger@kalray.eu>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH] Net: add mdio_i2c driver.
Date: Fri, 17 Nov 2017 09:52:14 +0100 (CET)	[thread overview]
Message-ID: <1782166044.55530197.1510908734299.JavaMail.zimbra@kalray.eu> (raw)
In-Reply-To: <20171117083340.6jtpf2dix5pukaks@pengutronix.de>

Hi Sascha,

Indeed, I though about that and I was facing another problem.
The mdio to i2c driver does not have a specific address.
ie, it is not a device but rather a bus.
If I put the mdio_i2c  node under the i2c bus, then I should assign
it an i2c address. This address should represent the phy address.
However, this would means I would have one mdio-i2c driver per phy.

ie:
i2c_bus {
  mdio_i2c1 {
    reg = <0x0>;
    compatible = <virtual,mdio-i2c>;
    phy1 {
      reg = <0x0>; //?
    };
  mdio_i2c1 {
    reg = <0x1>;
    compatible = <virtual,mdio-i2c>;
    phy1 {
      reg = <0x1>; // ?
    };
  };
  misc_device {
    reg = <0x3>;
  };
  ...
};

my_net_work_device {
  phy-handle = <&myphy>;
}

Note that I don't have a particular preference but I was just not fund
of assigning twice the same address. If you prefer this way I 
modify it. 

Clément

----- Mail original -----
De: "Sascha Hauer" <s.hauer@pengutronix.de>
À: "Clément Leger" <cleger@kalray.eu>
Cc: "Barebox List" <barebox@lists.infradead.org>
Envoyé: Vendredi 17 Novembre 2017 09:33:40
Objet: Re: [PATCH] Net: add mdio_i2c driver.

Hi Clément,

On Tue, Nov 14, 2017 at 02:34:51PM +0100, Clément Leger wrote:
> From 1238b5c70d29762074bc71ac25623b958af9010a Mon Sep 17 00:00:00 2001
> From: Clement Leger <clement.leger@kalray.eu>
> Date: Wed, 8 Nov 2017 09:13:10 +0100
> Subject: [PATCH] Net: add mdio_i2c driver (i2c to mdio bridge).
> 
> +++ b/dts/Bindings/net/mdio-i2c.txt
> @@ -0,0 +1,19 @@
> +MDIO on I2C Bus
> +This compatible allows to use phy devices connected to an i2c bus
> +and expecting to be use with mdio protocol.
> +
> +Currently defined compatibles:
> +- virtual,mdio-i2c
> +
> +Required properties:
> +- i2c-bus: A phandle on the I2C bus acting as a MDIO bridge where phys
> +           are connected to.
> +
> +Example:
> +
> +mdio0@i2c {
> +	compatible = "virtual,mdio-i2c";
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +	i2c-bus = <&i2c_bus>;
> +};

The binding looks the wrong way round. Ethernet phys should be child
nodes of the bus providing the control port to them. So, the mdio-i2c
device should be a child node of the i2c bus on which it is attached.
Instead of providing a phandle from the mdio phy to the i2c bus you
then provide a "phy-handle" phandle from the network controller to the
mdio-i2c. The "phy-handle" phandle is evaluated from the barebox phy
code already, so once you register a mdio-bus the connection between the
ethernet device and the mdio bus should just work.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2017-11-17  8:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14 13:34 Clément Leger
2017-11-17  8:33 ` Sascha Hauer
2017-11-17  8:52   ` Clément Leger [this message]
2017-11-17  9:06     ` Sascha Hauer
2017-11-17  9:34       ` Clément Leger
2017-11-17  9:39         ` Sascha Hauer
2017-11-17 10:05           ` Clément Leger

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=1782166044.55530197.1510908734299.JavaMail.zimbra@kalray.eu \
    --to=cleger@kalray.eu \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox