From: Roger Quadros <rogerq@ti.com>
To: Benoit Cousson <b-cousson@ti.com>
Cc: tony@atomide.com, balbi@ti.com, keshava_mgowda@ti.com,
linux-omap@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH 1/4] ARM: OMAP: usb-host: Device tree support for USB Host
Date: Fri, 16 Nov 2012 14:05:52 +0200 [thread overview]
Message-ID: <50A62C20.3030700@ti.com> (raw)
In-Reply-To: <50A61E3F.5050908@ti.com>
On 11/16/2012 01:06 PM, Benoit Cousson wrote:
> On 11/16/2012 11:55 AM, Roger Quadros wrote:
>> Hi Benoit,
>>
>> On 11/16/2012 12:30 PM, Benoit Cousson wrote:
>>> Hi Roger,
>>>
>>> On 11/15/2012 03:56 PM, Roger Quadros wrote:
>>>> Provides a means for the OMAP USB host subsystem to be initialized
>>>> from Device tree. This is a first step for device tree migration where
>>>> we specify only the board specific stuff. Things like I/O address space
>>>> and interrupts are not yet specified in the device tree but can be
>>>> done as a next step.
>>>>
>>>> This patch will allow boards to be booted with our without device tree
>>>> and have USB host functional.
>>>>
>>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>>>> ---
>>>> .../devicetree/bindings/arm/omap/usb-host.txt | 60 +++++++++++++++++
>>>> arch/arm/mach-omap2/board-generic.c | 1 +
>>>> arch/arm/mach-omap2/common.h | 2 +
>>>> arch/arm/mach-omap2/usb-host.c | 71 ++++++++++++++++++++
>>>> 4 files changed, 134 insertions(+), 0 deletions(-)
>>>> create mode 100644 Documentation/devicetree/bindings/arm/omap/usb-host.txt
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/arm/omap/usb-host.txt b/Documentation/devicetree/bindings/arm/omap/usb-host.txt
>>>> new file mode 100644
>>>> index 0000000..f25cfa4
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/arm/omap/usb-host.txt
>>>> @@ -0,0 +1,60 @@
>>>> +* usb-host - OMAP USB Host Subsystem
>>>> +
>>>> +The OMAP USB host subsystem consists of the following modules
>>>> +1) USBTLL (Tranceiverless interface)
>>>> +2) USBHOST (Host Controller module) which includes both EHCI and OHCI controllers
>>>> +
>>>> +THe USB Host subsystem can be connected to the external world using 3 PORTs that could
>>>> +be configured in various modes like UTMI+ for external PHY, ULPI transceiverless link (TLL),
>>>> +Serial TLL, High-speed interchip (HSIC), etc.
>>>> +
>>>> +Required proprties:
>>>> +- compatible: Must be "ti,usb-host";
>>>> +- num_ports: Number of physical ports available
>>>> +
>>>> +Optional properties:
>>>> +- 1 child node for each available port. These child nodes are usually supplied by the
>>>> + board support device tree as they are specific to how the ports are wired on the board
>>>> +
>>>> + - mode: Integer specifying the mode in which the port is used
>>>> + * OMAP_USBHS_PORT_MODE_UNUSED = 0,
>>>> + * OMAP_EHCI_PORT_MODE_PHY = 1,
>>>> + * OMAP_EHCI_PORT_MODE_TLL = 2,
>>>> + * OMAP_EHCI_PORT_MODE_HSIC = 3,
>>>> + * OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0 = 4,
>>>> + * OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM = 5,
>>>> + * OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0 = 6,
>>>> + * OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM = 7,
>>>> + * OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0 = 8,
>>>> + * OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM = 9,
>>>> + * OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0 = 10,
>>>> + * OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM = 11,
>>>> + * OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0 = 12,
>>>> + * OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM = 13,
>>>> + - clk: Name of the clock that needs to be active when using the port
>>>> + - clkrate: Frequency at which the above clk needs to be run at
>>>> +
>>>> +
>>>> +Example:
>>>> +
>>>> +/* In the OMAP Core tree */
>>>> +usbhost: usb-host {
>>>> + compatible = "ti,usb-host";
>>>> + num_ports = <3>;
>>>> +};
>>>> +
>>>> +/* In the Board tree */
>>>> +&usbhost {
>>>> + port@0 {
>>>> + mode = <1>;
>>>> + clk = "auxclk3_ck";
>>>> + clkrate = <19200000>;
>>>> + };
>>>> + port@1 {
>>>> + mode = <0>;
>>>> + };
>>>> + port@2 {
>>>> + mode = <0>;
>>>> + };
>>>> +};
>>>> +
>>>> diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
>>>> index 601ecdf..4e53b62 100644
>>>> --- a/arch/arm/mach-omap2/board-generic.c
>>>> +++ b/arch/arm/mach-omap2/board-generic.c
>>>> @@ -40,6 +40,7 @@ static void __init omap_generic_init(void)
>>>> omap_sdrc_init(NULL, NULL);
>>>>
>>>> of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
>>>> + usbhost_init_of();
>>>
>>> You should never have to add that kind of hacks in generic board file.
>>> Why do you need that during board init?
>>>
>>> In theory, the of_platform_populate will create all the devices, and
>>> during the driver probe you will create the sub nodes.
>>>
>>
>> OK. I was thinking of this as a temporary fix till the USB host drivers
>> support OF nodes natively. Maybe I should work on fixing up the host
>> drivers instead.
>
> Well, yeah, that's clearly better.
>
>> But I'm not sure how the PM runtime calls map to omap_device/hwmod
>> framework when device tree boot is used. I can see that the device tree
>> node can specify "ti,hwmods = " parameter. Just can't seem to figure out
>> how all this adds up :P
>
> It is done auto-magically in the omap_device code. As soon as you add
> the "ti,hwmods: attribute, an omap_device will be created instead of a
> regular platform_device. A custom PM domain is added to handle the
> pm_runtime callback for OMAP IPs. And every omap_device belongs to that
> PM domain.
>
Thanks. Just figured out it happens through BUS_NOTIFY_ADD_DEVICE ->
_omap_device_notifier_call() - > omap_device_build_from_dt()
cheers,
-roger
next prev parent reply other threads:[~2012-11-16 12:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-15 14:56 [PATCH 0/4] Device tree support for OMAP USB Host Roger Quadros
2012-11-15 14:56 ` [PATCH 2/4] ARM: OMAP4: USB: Add pin mux configuration for panda board Roger Quadros
[not found] ` <1352991396-19589-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2012-11-15 14:56 ` [PATCH 1/4] ARM: OMAP: usb-host: Device tree support for USB Host Roger Quadros
2012-11-16 10:30 ` Benoit Cousson
2012-11-16 10:55 ` Roger Quadros
2012-11-16 11:06 ` Benoit Cousson
2012-11-16 12:05 ` Roger Quadros [this message]
2012-11-15 14:56 ` [PATCH 3/4] ARM/dts: omap4-panda: Add USB Host support Roger Quadros
2012-11-15 14:56 ` [PATCH 4/4] regulator: fixed: Properly use input_supply parameter from device tree Roger Quadros
[not found] ` <1352991396-19589-5-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2012-11-15 19:11 ` Laxman Dewangan
[not found] ` <50A53E7F.6070705-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-11-16 10:23 ` Roger Quadros
2012-12-15 14:55 ` Mark Brown
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=50A62C20.3030700@ti.com \
--to=rogerq@ti.com \
--cc=b-cousson@ti.com \
--cc=balbi@ti.com \
--cc=keshava_mgowda@ti.com \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--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 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.