devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon@ti.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: linux-usb@vger.kernel.org, mchehab@redhat.com,
	linux-doc@vger.kernel.org, tony@atomide.com,
	linux@arm.linux.org.uk, javier@dowhile0.org, cesarb@cesarb.net,
	arnd@arndb.de, eballetbo@gmail.com,
	devicetree-discuss@lists.ozlabs.org, rob.herring@calxeda.com,
	swarren@nvidia.com, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, b-cousson@ti.com,
	gregkh@linuxfoundation.org, broonie@opensource.wolfsonmicro.com,
	linux-kernel@vger.kernel.org, balbi@ti.com,
	santosh.shilimkar@ti.com, rob@landley.net,
	akpm@linux-foundation.org, davem@davemloft.net
Subject: Re: [PATCH v3 1/6] drivers: phy: add generic PHY framework
Date: Mon, 22 Apr 2013 11:39:57 +0530	[thread overview]
Message-ID: <5174D435.7080408@ti.com> (raw)
In-Reply-To: <20130419090933.AB4253E116D@localhost>

Hi,

On Friday 19 April 2013 02:39 PM, Grant Likely wrote:
> On Tue, 16 Apr 2013 15:48:07 +0530, Kishon Vijay Abraham I <kishon@ti.com> wrote:
>> On Tuesday 16 April 2013 01:20 AM, Grant Likely wrote:
>>> On Mon, 15 Apr 2013 17:56:10 +0530, Kishon Vijay Abraham I <kishon@ti.com> wrote:
>>>> On Monday 15 April 2013 05:04 PM, Grant Likely wrote:
>>>>> On Wed, 20 Mar 2013 14:42:00 +0530, Kishon Vijay Abraham I <kishon@ti.com> wrote:
>>>> We have decided not to implement the PHY layer as a separate bus layer.
>>>> The PHY provider can be part of any other bus. Making the PHY layer as a
>>>> bus will make the PHY provider to be part of multiple buses which will
>>>> lead to bad design. All we are trying to do here is keep the pool of PHY
>>>> devices under PHY class in this layer and help any controller that wants
>>>> to use the PHY to get it.
>>>
>>> If you're using a class, then you already have your list of registered
>>> phy devices! :-) No need to create another global list that you need to
>>> manage.
>>
>> right. We already use _class_dev_iter_ for finding the phy device.
>> .
>> .
>> +static struct phy *of_phy_lookup(struct device *dev, struct device_node
>> *node)
>> +{
>> +	struct phy *phy;
>> +	struct class_dev_iter iter;
>> +
>> +	class_dev_iter_init(&iter, phy_class, NULL, NULL);
>> +	while ((dev = class_dev_iter_next(&iter))) {
>> +		phy = container_of(dev, struct phy, dev);
>> +		if (node != phy->of_node)
>> +			continue;
>> +
>> +		class_dev_iter_exit(&iter);
>> +		return phy;
>> +	}
>> +
>> +	class_dev_iter_exit(&iter);
>> +	return ERR_PTR(-EPROBE_DEFER);
>> +}
>> .
>> .
>>
>> however we can't get rid of the other list (phy_bind_list) where we
>> maintain the phy binding information. It's used for the non-dt boot case.
>
> Why? If you're using a class, then it is always there. Why would non-DT
> and DT be different in this regard? (more below)
>
>>>>> Since there is at most a 1:N relationship between host controllers and
>>>>> PHYs, there shouldn't be any need for a separate structure to describe
>>>>> binding. Put the inding data into the struct phy itself. Each host
>>>>> controller can have a list of phys that it is bound to.
>>>>
>>>> No. Having the host controller to have a list of phys wont be a good
>>>> idea IMHO. The host controller is just an IP and the PHY to which it
>>>> will be connected can vary from board to board, platform to platform. So
>>>> ideally this binding should come from platform initialization code/dt data.
>>>
>>> That is not what I mean. I mean the host controller instance should
>>> contain a list of all the PHYs that are attached to it. There should not
>>
>> Doesn't sound correct IMO. The host controller instance need not know
>> anything about the PHY instances that is connected to it. Think of it
>> similar to regulator, the controller wouldn't know which regulator it is
>> connected to, all it has to know is it just has a regulator connected to
>> it. It's up-to the regulator framework to give the controller the
>> correct regulator. It's similar here. It makes sense for me to keep a
>> list in the PHY framework in order for it to return the correct PHY (but
>> note that this list is not needed for dt boot).
>
> With regulators and clocks it makes sense to have a global
> registration place becase both implement an interconnected network
> independent of the device that use them. (clocks depend on other clocks;
> regulators depend on other regulators).
>
> Phys are different. There is a 1:N relationship between host controllers
> and phys, and you don't get a interconnected network of PHYs. Its a bad
> idea to keep the binding data separate from the actual host controller
> when there is nothing else that actually needs to use the data. It
> creates a new set of data structures that need housekeeping to keep them
> in sync with the actual device structures. It really is just a bad idea
> and it becomes more difficult (in the non-DT case) to determine what
> data is associated with a given host controller. You can't tell by
> looking at the struct device.
>
> Instead, for the non-DT case, do what we've always done for describing
> connections. Put the phy reference into the host controllers
> platform_data structure.
hmm... my only concern here is there is no way we can enforce the phy 
reference is added in the platform_data structure.
That is what it is there for. That completely
> eliminates the need to housekeep a new set of data structures.

Ok. Makes sense.

Thanks
Kishon

  reply	other threads:[~2013-04-22  6:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-20  9:11 [PATCH v3 0/6] Generic PHY Framework Kishon Vijay Abraham I
2013-03-20  9:12 ` [PATCH v3 1/6] drivers: phy: add generic PHY framework Kishon Vijay Abraham I
2013-03-20 22:36   ` Sylwester Nawrocki
2013-03-21  5:46     ` kishon
     [not found]   ` <1363770725-13717-2-git-send-email-kishon-l0cyMroinI0@public.gmane.org>
2013-04-15 11:34     ` Grant Likely
2013-04-15 12:26       ` Kishon Vijay Abraham I
2013-04-15 19:50         ` Grant Likely
2013-04-16 10:18           ` Kishon Vijay Abraham I
2013-04-19  9:09             ` Grant Likely
2013-04-22  6:09               ` Kishon Vijay Abraham I [this message]
2013-03-20  9:12 ` [PATCH v3 3/6] usb: otg: twl4030: use the new " Kishon Vijay Abraham I
2013-03-20  9:12 ` [PATCH v3 4/6] ARM: OMAP: USB: Add phy binding information Kishon Vijay Abraham I
2013-03-20 16:51   ` Tony Lindgren
2013-03-21  5:48     ` kishon
2013-03-20  9:12 ` [PATCH v3 5/6] ARM: dts: omap: update usb_otg_hs data Kishon Vijay Abraham I
2013-03-20 20:59   ` Stephen Warren
2013-03-21  6:23     ` kishon
2013-03-21 17:10       ` Stephen Warren
     [not found]         ` <514B3EEF.3080705-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-03-22  9:20           ` Kishon Vijay Abraham I
     [not found] ` <1363770725-13717-1-git-send-email-kishon-l0cyMroinI0@public.gmane.org>
2013-03-20  9:12   ` [PATCH v3 2/6] usb: phy: omap-usb2: use the new generic PHY framework Kishon Vijay Abraham I
2013-03-20  9:12   ` [PATCH v3 6/6] usb: musb: omap2430: " Kishon Vijay Abraham I
2013-04-19 10:52   ` [PATCH v3 0/6] Generic PHY Framework Sekhar Nori
2013-04-15 10:20 ` Grant Likely
2013-04-15 10:36   ` Kishon Vijay Abraham I
2013-04-15 11:27     ` Sylwester Nawrocki
2013-04-15 12:26     ` Grant Likely
2013-04-15 12:33       ` Kishon Vijay Abraham I

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=5174D435.7080408@ti.com \
    --to=kishon@ti.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=b-cousson@ti.com \
    --cc=balbi@ti.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=cesarb@cesarb.net \
    --cc=davem@davemloft.net \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=eballetbo@gmail.com \
    --cc=grant.likely@secretlab.ca \
    --cc=gregkh@linuxfoundation.org \
    --cc=javier@dowhile0.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mchehab@redhat.com \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=santosh.shilimkar@ti.com \
    --cc=swarren@nvidia.com \
    --cc=tony@atomide.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 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).