From: Andy Green <andy.green@linaro.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Roger Quadros <rogerq@ti.com>,
linux-omap@vger.kernel.org, linux-usb@vger.kernel.org,
gregkh@linuxfoundation.org, keshava_mgowda@ti.com, balbi@ti.com
Subject: Re: [try#1 PATCH 5/7] omap4: panda: add smsc95xx regulator and reset dependent on root hub
Date: Fri, 30 Nov 2012 04:58:51 +0800 [thread overview]
Message-ID: <50B7CC8B.5050802@linaro.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1211291247130.1535-100000@iolanthe.rowland.org>
On 11/30/2012 01:57 AM, the mail apparently from Alan Stern included:
> On Thu, 29 Nov 2012, Andy Green wrote:
>
>> However I think what you're saying about binding to hub power is good.
>> The hub ports are not devices, but it would be possible to bind an asset
>> array to them and make the pre- and post- code functions.
>
> In the 3.6 kernel, hub ports are not devices. In 3.7 they are -- that
> is, each hub port has its own struct device.
Right, I should have seen this in hub.c before. It's much better like that.
>> I think it will be possible to address objections around the "pathiness"
>> by being able to seed the path match with a platform_device pointer
>> (there exists in the board file time a platform_device for ehci-omap.0
>> ...) and just matching the remainder on a single usb device's name, like
>> "*-1.1-1".
>
> Can you think of a way to do this without checking for a match every
> time a new device is registered? For instance, in this case it would
> be preferable to do this match only for descendants of ehci-omap.0. To
> match the port device, the string would have to be something like
> "*-0:1.0/port2".
Yes. How about adding a third callback to struct device_asset, along
the lines of
int (*pre_child_register)(struct device *child);
then, in register_device() we add code that before we get down to it, we
walk up the new device's parents calling ->pre_child_register() on any
assets the parents may have. In the typical case that's a rapid NOP
once per device registration.
However... if we had arranged back at boot time that the ehci-omap.0
struct device had an asset with only pre_device_register callback set,
we can use that asset's .name for the right-justified child device name
we are looking for like "-0:1.0/port2", and its .asset member to point
to another asset table the pre_child_register callback will attach to
the child device if the name matches. So in the board file:
struct device_asset ehci_omap0_smsc_hub_port_assets[] = {
/* the smsc regulator and clock assets destined for the hub port */
{ }
};
/* below is attached to ehci-omap.0 like in try#1 */
struct device_asset ehci_omap0_assets[] = {
{
.name = "-0:1.0/port2",
.asset = ehci_omap0_smsc_hub_port_assets,
.pre_child_register = device_asset_attach_to_child,
},
{ }
};
In that way we can project as many stashed asset tables on to
dynamically probed devices as we like from the platform_devices at boot
time. Only children of the right platform devices do any checking or
processing.
> In fact, if the match were anchored at the end of the string, we
> wouldn't need the wildcard at all -- at least, not in this case. The
> string could simply be "-0:1.0/port2". But that's only if the match is
> restricted to devices below ehci-omap.0.
It's a good idea, it won't get fooled by a hub getting plugged there
which has its own port2 either, the -0:1.0 bit will have been elaborated
for the subsequent hub "path" and won't match.
It may be neater to split out the device_asset callbacks to an ..._ops
struct.
struct device_asset_ops {
int (*pre_probe)(struct device *device, struct device_asset *asset);
void (*post_remove)(struct device *device, struct device_asset *asset);
int (*pre_child_register)(struct device *child);
};
struct device_asset {
...
struct device_asset_ops *ops;
};
that also lets us export and set one thing to select say regulator
"handler", instead of n callbacks that must match.
Something else I think mux would be a great target for device_asset
support. That way it could become normal for mux function to get set as
part of the specific device instantiation, so if you know you have an
8-bit ULPI PHY that will be logically created by the platform_device,
you can attach ULPI-mode mux config appropriate for your exact SoC as an
asset to the platform_device.
When the device is destroyed, balls can go back to safe mode and save
power, and if the balls are muxed with other things again the right mux
asset can be associated with that so it switches automagically according
to what you are doing. That's a lot better than forcing them once at
boot which is the current method. Are there any gotchas with that?
-Andy
--
Andy Green | TI Landing Team Leader
Linaro.org │ Open source software for ARM SoCs | Follow Linaro
http://facebook.com/pages/Linaro/155974581091106 -
http://twitter.com/#!/linaroorg - http://linaro.org/linaro-blog
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-11-29 20:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-28 12:59 [try#1 PATCH 0/7] Introduce device_asset and use to control Panda HUB+ETH power and clock Andy Green
2012-11-28 12:59 ` [try#1 PATCH 1/7] drivers: base: introduce device assets Andy Green
2012-11-28 12:59 ` [try#1 PATCH 3/7] clk: add default device asset handlers Andy Green
[not found] ` <20121128124744.29569.52739.stgit-Ak/hGR4SqtBG2qbu2SEcwgC/G2K4zDHf@public.gmane.org>
2012-11-28 12:59 ` [try#1 PATCH 2/7] regulator: core: " Andy Green
2012-11-28 12:59 ` [try#1 PATCH 4/7] usb: omap ehci: remove all regulator control from ehci omap Andy Green
2012-11-28 12:59 ` [try#1 PATCH 5/7] omap4: panda: add smsc95xx regulator and reset dependent on root hub Andy Green
[not found] ` <20121128125955.29569.25431.stgit-Ak/hGR4SqtBG2qbu2SEcwgC/G2K4zDHf@public.gmane.org>
2012-11-28 15:06 ` Roger Quadros
2012-11-29 5:55 ` Andy Green
[not found] ` <50B6F8CF.8020304-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-29 17:57 ` Alan Stern
2012-11-29 20:58 ` Andy Green [this message]
2012-11-30 7:38 ` "Andy Green (林安廸)"
2012-11-30 16:35 ` Alan Stern
2012-11-28 13:00 ` [try#1 PATCH 6/7] omap4 panda add smsc95xx clock " Andy Green
2012-11-28 13:00 ` [try#1 PATCH 7/7] config omap2plus add ehci bits Andy Green
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=50B7CC8B.5050802@linaro.org \
--to=andy.green@linaro.org \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=keshava_mgowda@ti.com \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rogerq@ti.com \
--cc=stern@rowland.harvard.edu \
/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).