All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: narmstrong@baylibre.com, vivien.didelot@savoirfairelinux.com,
	netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH RFC 00/28] DSA: Restructure probing
Date: Fri, 25 Dec 2015 14:00:19 -0800	[thread overview]
Message-ID: <567DBC73.9040104@gmail.com> (raw)
In-Reply-To: <20151225113123.GA7422@lunn.ch>

Le 25/12/2015 03:31, Andrew Lunn a écrit :
>>> One of my aims is to abstract away the MDIO bus from DSA. How you talk
>>> to the switch is a switch device property. SF2 has a different way to
>>> talk to the switch, memory mapped IO, etc.
>>
>> I appreciate you trying to see my point of view and mentioning the
>> driver that I care about, but I am not just after SF2 here, just any
>> kind of switch in general: PCIe, SPI, I2C, GPIO, MDIO, MMIO is precisely
>> what I would like to solve instead of narrow MDIO and distributed case
>> that DSA currently deals with, and MMIO with some help from the of_*
>> routines which do not need any kind of bus probing and struct device
>> creation (most often).
> 
> And this is achieved with the new structure. How you access the switch
> is part of the switch device binding, be it an MDIO bus/addr, an MMIO
> reg property, or an i2c client, etc. The switch driver registers a set
> of ops which are neutral to the switch access mechanism.

I am not really questioning whether the abstraction is working, this
clearly does, what I am wondering is if the use of the component
framework requires us to have master and slaves be implemented as strict
platform devices, or if we have a choice in how we mix things together,
like master is a platform device, but slaves could be I2C, SPI client or
even platform devices themselves? That was not quite obvious to me by
looking at the patches, sorry.

If it is the former, then this does not really allow us to make this
framework usable to a wider class of devices. Also, one could imagine
that you could make the master network device's "struct device" be the
master device in the component framework terminology, such that you
could eliminate this synthetic "dsa" platform device.

> 
> In the DSA node, the mdio bus is now only required when using
> backwards compatibility. The reg property is a bit odd, since it is
> used for linking DSA ports together. So currently it is kept, but only
> one of the two fields is used. We could in a later patchset change
> this, since there are currently no in kernel devices with multiple
> switches, so we don't have to worry about breaking the binding.

Sure, that would work.

> 
>>> Anyway, who do you think the device tree binding will look? Maybe take
>>> the .dts file in patches 2 and 20 to build an example?
>>
>> The binding would look pretty much the same as what the current DSA and
>> your proposed binding look like, except that instead of encoding the
>> MDIO address *and* the switch index in tree in the same "reg" properties
>> (which was wrong along, but I did not really knew it back in 2009 or
>> so), the two would be different properties.
> 
> Agreed, as explained above.
>  
>> When you parse the Device Tree you can determine what is the position of
>> the switch in the switch tree by looking at its ports sub-nodes and see
>> if they have a "link" property which links them to another device,
>> eventually, in case where there is not a one to one, but one to many
>> connection, an additional property can help you figure out how to
>> flatten things out.
>>
>> So in practical terms, this could wind up looking like this:
>>
>> mdio_bus@deadbeef {
>> 	compatible = "acme,mdiobus";
>> 	..
>> 	switch0@0 {
>> 		compatible = "marvell,mv88e6131";
>> 		reg = <0>;
>> 		dsa,addr = <1>;
> 
> This is not sufficient. It does not tell you which DSA cluster this
> switch belongs to.

Would it work if we added an additional digit which is the cluster id or
do you need a node grouping switches in a cluster with each other like
you proposed in patch 20?

The question being mostly, if we have the cluster id, address/index in
switch tree, and a double linked list using phandles, is that good
enough to figure out a topology or shall we really have nodes and
sub-nodes with that (we would still need a list one linked list of
phandles to figure out which ports are "dsa").

> 
>>
>> 		switch0port5: port@5 {
>> 				reg = <5>;
>> 				label = "dsa";
>> 				link = <&switch1port9>;
>> 			};
>> 		};
>> 	};
>> };
> 
> Just for clarification, where are the cpu ports and normal user ports?
> Here as well?

I purposely omitted them to make the example simpler to read.

> 
> Making MDIO controlled switches hang of MDIO can be done, but it does
> require some bigger changes to the mdio code. I will need to look at
> this again, but i think it starts in of_mdiobus_register_phy() which
> needs to look a the compatibility field, and do something different to
> phy_device_register(). mdio_unregister() will also need some work,
> since it only expects phy devices on the mdio bus.

Correct, and this is really where I would start before we go on with the
probing restructuring, because that could impact how the new DSA binding
will have to be (re)defined. Right now, converting the Marvell drivers
into individual platform devices is kind of a temporary solution because
we do not have have a proper MDIO device model which is not a PHY.

There are lots of good patches in this series that should probably be
merged right away since they are all improvements.
-- 
Florian

  reply	other threads:[~2015-12-25 22:00 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-23 12:56 [PATCH RFC 00/28] DSA: Restructure probing Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 01/28] component: remove old add_components method Andrew Lunn
2015-12-23 13:21   ` Russell King - ARM Linux
2015-12-23 15:57     ` Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 02/28] ARM: VF610: Add Zodiac Inflight Innovations development boards Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 03/28] net: dsa: Move platform data allocation for OF Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 04/28] dsa: Rename mv88e6123_61_65 to mv88e6123 to be consistent Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 05/28] net: dsa: Pass the dsa device to the switch drivers Andrew Lunn
2015-12-23 20:36   ` Florian Fainelli
2015-12-23 12:56 ` [PATCH RFC 06/28] net: dsa: Have the switch driver allocate there own private memory Andrew Lunn
2015-12-23 20:39   ` Florian Fainelli
2015-12-23 12:56 ` [PATCH RFC 07/28] net: dsa: Remove allocation of driver " Andrew Lunn
2015-12-23 20:39   ` Florian Fainelli
2015-12-23 12:56 ` [PATCH RFC 08/28] net: dsa: Keep the mii bus and address in the private structure Andrew Lunn
2015-12-23 20:40   ` Florian Fainelli
2016-01-21 20:41   ` Vivien Didelot
2016-01-21 20:50     ` Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 09/28] net: dsa: Add basic support for component master support Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 10/28] net: dsa: Keep a reference to the switch device for component matching Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 11/28] net: dsa: Add slave component matches based on a phandle to the slave Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 12/28] net: dsa: Make dsa,mii-bus optional Andrew Lunn
2015-12-23 20:42   ` Florian Fainelli
2015-12-23 12:56 ` [PATCH RFC 13/28] net: dsa: Add register/unregister functions for switch drivers Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 14/28] net: dsa: Rename DSA probe function Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 15/28] of_mdio: Add "mii-bus" and address property parser Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 16/28] dsa: mv88e6xxx: Use bus in mv88e6xxx_lookup_name() Andrew Lunn
2016-01-21 20:54   ` Vivien Didelot
2015-12-23 12:56 ` [PATCH RFC 17/28] dsa: mv88e6xxx: Add shared code for binding/unbinding a switch driver Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 18/28] dsa: Add platform device support to Marvell switches Andrew Lunn
2016-01-21 21:05   ` Vivien Didelot
2015-12-23 12:56 ` [PATCH RFC 19/28] net: dsa: bcm_sf2: make it a real platform driver Andrew Lunn
2015-12-23 20:32   ` Florian Fainelli
2015-12-23 12:56 ` [PATCH RFC 20/28] vf610: Zii: Convert rev b to switches as individual devices Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 21/28] net: dsa: Add some debug prints for error cases Andrew Lunn
2015-12-23 20:42   ` Florian Fainelli
2015-12-23 12:56 ` [PATCH RFC 22/28] net: dsa: Setup the switches after all have been probed Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 23/28] net: dsa: Only setup platform switches, not device switches Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 24/28] net: dsa: If a switch fails to probe, defer probing Andrew Lunn
2015-12-23 20:46   ` Florian Fainelli
2015-12-23 12:56 ` [PATCH RFC 25/28] Documentation: DSA: Describe how probe of DSA and switches work Andrew Lunn
2015-12-23 20:48   ` Florian Fainelli
2015-12-23 22:53     ` Andrew Lunn
2015-12-25  1:29       ` Florian Fainelli
2015-12-25 10:00         ` Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 26/28] dsa: Convert mv88e6xxx into a library allowing driver modules Andrew Lunn
2015-12-25 21:47   ` Florian Fainelli
2016-01-21 21:29     ` Vivien Didelot
2016-01-21 21:54       ` Andrew Lunn
2015-12-23 12:56 ` [PATCH RFC 27/28] dsa: slave: Don't reference NULL pointer during phy_disconnect Andrew Lunn
2015-12-23 20:45   ` Florian Fainelli
2015-12-23 12:56 ` [PATCH RFC 28/28] dsa: Destroy fixed link phys after the phy has been disconnected Andrew Lunn
2015-12-23 20:45   ` Florian Fainelli
2015-12-23 20:44 ` [PATCH RFC 00/28] DSA: Restructure probing Florian Fainelli
2015-12-23 22:33   ` Andrew Lunn
2015-12-23 23:13     ` Florian Fainelli
2015-12-24 12:58       ` Andrew Lunn
2015-12-25  1:47         ` Florian Fainelli
2015-12-25 11:31           ` Andrew Lunn
2015-12-25 22:00             ` Florian Fainelli [this message]
2015-12-25 23:41               ` Andrew Lunn

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=567DBC73.9040104@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=narmstrong@baylibre.com \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.com \
    /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.