diff mbox

[RFC] usb: dwc3: Get PHY from platform specific dwc3 dt node.

Message ID 1359631232-7107-1-git-send-email-gautam.vivek@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vivek Gautam Jan. 31, 2013, 11:20 a.m. UTC
With device tree support in place for dwc3-core layer,
it gets PHY from "synopsis-dwc3" node.
Some controllers may not have separate memory maps and interrupts
for dwc3 core and platform glue layers. In such case only glue
layer's node will exist.
Moreover, SoCs having multiple dwc3 controllers will have multiple
PHYs, which eventually be added using usb_add_phy_dev(), and not
using usb_add_phy(). So each dwc3 controller won't be able to
get PHYs by simply calling devm_usb_get_phy() also.
In such cases, dwc3 should expect PHYs from its parent's node.
So, adding provision for getting PHY from platform specific
device tree node.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
---

Based on 'usb-next'.

 drivers/usb/dwc3/core.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Comments

Kishon Vijay Abraham I Jan. 31, 2013, 11:34 a.m. UTC | #1
Hi,

On Thursday 31 January 2013 04:50 PM, Vivek Gautam wrote:
> With device tree support in place for dwc3-core layer,
> it gets PHY from "synopsis-dwc3" node.
> Some controllers may not have separate memory maps and interrupts
> for dwc3 core and platform glue layers. In such case only glue
> layer's node will exist.

Not really. As long as you have dwc3 core as a separate device, you can 
add a node for it.
Just that the glue should create a device for dwc3 core using 
of_platform_populate.(You can have a look at 
drivers/usb/dwc3/dwc3-omap.c in usb-next)
> Moreover, SoCs having multiple dwc3 controllers will have multiple
> PHYs, which eventually be added using usb_add_phy_dev(), and not
> using usb_add_phy(). So each dwc3 controller won't be able to
> get PHYs by simply calling devm_usb_get_phy() also.
No. We have added usb_get_phy_dev() for that purpose in the case of non-dt.
I think, instead you can have a patch to use devm_usb_get_phy_dev() here 
and in exynos platform specific code use usb_bind_phy() to bind the phy 
and controller till you change it to dt.
> In such cases, dwc3 should expect PHYs from its parent's node.
NAK.

Thanks
Kishon
--
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
Vivek Gautam Jan. 31, 2013, 3:23 p.m. UTC | #2
Hi Kishon,


On Thu, Jan 31, 2013 at 5:04 PM, kishon <kishon@ti.com> wrote:
> Hi,
>

Thanks for your quick help.

>
> On Thursday 31 January 2013 04:50 PM, Vivek Gautam wrote:
>>
>> With device tree support in place for dwc3-core layer,
>> it gets PHY from "synopsis-dwc3" node.
>> Some controllers may not have separate memory maps and interrupts
>> for dwc3 core and platform glue layers. In such case only glue
>> layer's node will exist.
>
>
> Not really. As long as you have dwc3 core as a separate device, you can add
> a node for it.
> Just that the glue should create a device for dwc3 core using
> of_platform_populate.(You can have a look at drivers/usb/dwc3/dwc3-omap.c in
> usb-next)
>

Right, we should be doing this way.

>> Moreover, SoCs having multiple dwc3 controllers will have multiple
>> PHYs, which eventually be added using usb_add_phy_dev(), and not
>> using usb_add_phy(). So each dwc3 controller won't be able to
>> get PHYs by simply calling devm_usb_get_phy() also.
>
> No. We have added usb_get_phy_dev() for that purpose in the case of non-dt.
> I think, instead you can have a patch to use devm_usb_get_phy_dev() here and
> in exynos platform specific code use usb_bind_phy() to bind the phy and
> controller till you change it to dt.
>

We have dt support for dwc3-exynos, in such case we should go ahead with
of_platform_populate(), right ?
But if when i use of_platform_populate() i will not be able to set
dma_mask to dwc3->dev. :-(
And setting it in dwc3_probe() won't be good idea, isn't it ?

>> In such cases, dwc3 should expect PHYs from its parent's node.
>
> NAK.
>
> Thanks
> Kishon
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Felipe Balbi Jan. 31, 2013, 3:25 p.m. UTC | #3
Hi,

On Thu, Jan 31, 2013 at 08:53:27PM +0530, Vivek Gautam wrote:
> >> Moreover, SoCs having multiple dwc3 controllers will have multiple
> >> PHYs, which eventually be added using usb_add_phy_dev(), and not
> >> using usb_add_phy(). So each dwc3 controller won't be able to
> >> get PHYs by simply calling devm_usb_get_phy() also.
> >
> > No. We have added usb_get_phy_dev() for that purpose in the case of non-dt.
> > I think, instead you can have a patch to use devm_usb_get_phy_dev() here and
> > in exynos platform specific code use usb_bind_phy() to bind the phy and
> > controller till you change it to dt.
> >
> 
> We have dt support for dwc3-exynos, in such case we should go ahead with
> of_platform_populate(), right ?
> But if when i use of_platform_populate() i will not be able to set
> dma_mask to dwc3->dev. :-(

do you have a special need for dma_mask because OF already sets it.
Vivek Gautam Jan. 31, 2013, 3:30 p.m. UTC | #4
Hi Felipe,


On Thu, Jan 31, 2013 at 8:55 PM, Felipe Balbi <balbi@ti.com> wrote:
> Hi,
>
> On Thu, Jan 31, 2013 at 08:53:27PM +0530, Vivek Gautam wrote:
>> >> Moreover, SoCs having multiple dwc3 controllers will have multiple
>> >> PHYs, which eventually be added using usb_add_phy_dev(), and not
>> >> using usb_add_phy(). So each dwc3 controller won't be able to
>> >> get PHYs by simply calling devm_usb_get_phy() also.
>> >
>> > No. We have added usb_get_phy_dev() for that purpose in the case of non-dt.
>> > I think, instead you can have a patch to use devm_usb_get_phy_dev() here and
>> > in exynos platform specific code use usb_bind_phy() to bind the phy and
>> > controller till you change it to dt.
>> >
>>
>> We have dt support for dwc3-exynos, in such case we should go ahead with
>> of_platform_populate(), right ?
>> But if when i use of_platform_populate() i will not be able to set
>> dma_mask to dwc3->dev. :-(
>
> do you have a special need for dma_mask because OF already sets it.
>
If i am not wrong of_platform_device_create_pdata() will set
"dev->dev.coherent_dma_mask = DMA_BIT_MASK(32)"
and not dma_mask.
I fact we had some discussion sometime back when we needed the same
for dwc3-exynos in the thread:
[PATCH v2 1/2] USB: dwc3-exynos: Add support for device tree

But couldn't get final node on it.
So suggestions here please. :-)
Felipe Balbi Jan. 31, 2013, 3:38 p.m. UTC | #5
On Thu, Jan 31, 2013 at 09:00:37PM +0530, Vivek Gautam wrote:
> Hi Felipe,
> 
> 
> On Thu, Jan 31, 2013 at 8:55 PM, Felipe Balbi <balbi@ti.com> wrote:
> > Hi,
> >
> > On Thu, Jan 31, 2013 at 08:53:27PM +0530, Vivek Gautam wrote:
> >> >> Moreover, SoCs having multiple dwc3 controllers will have multiple
> >> >> PHYs, which eventually be added using usb_add_phy_dev(), and not
> >> >> using usb_add_phy(). So each dwc3 controller won't be able to
> >> >> get PHYs by simply calling devm_usb_get_phy() also.
> >> >
> >> > No. We have added usb_get_phy_dev() for that purpose in the case of non-dt.
> >> > I think, instead you can have a patch to use devm_usb_get_phy_dev() here and
> >> > in exynos platform specific code use usb_bind_phy() to bind the phy and
> >> > controller till you change it to dt.
> >> >
> >>
> >> We have dt support for dwc3-exynos, in such case we should go ahead with
> >> of_platform_populate(), right ?
> >> But if when i use of_platform_populate() i will not be able to set
> >> dma_mask to dwc3->dev. :-(
> >
> > do you have a special need for dma_mask because OF already sets it.
> >
> If i am not wrong of_platform_device_create_pdata() will set
> "dev->dev.coherent_dma_mask = DMA_BIT_MASK(32)"
> and not dma_mask.
> I fact we had some discussion sometime back when we needed the same
> for dwc3-exynos in the thread:
> [PATCH v2 1/2] USB: dwc3-exynos: Add support for device tree
> 
> But couldn't get final node on it.
> So suggestions here please. :-)

hmm.. you're right there. Grant, Rob ? Any hints ?
Kishon Vijay Abraham I Feb. 1, 2013, 5:21 a.m. UTC | #6
Hi,

On Thursday 31 January 2013 09:08 PM, Felipe Balbi wrote:
> On Thu, Jan 31, 2013 at 09:00:37PM +0530, Vivek Gautam wrote:
>> Hi Felipe,
>>
>>
>> On Thu, Jan 31, 2013 at 8:55 PM, Felipe Balbi <balbi@ti.com> wrote:
>>> Hi,
>>>
>>> On Thu, Jan 31, 2013 at 08:53:27PM +0530, Vivek Gautam wrote:
>>>>>> Moreover, SoCs having multiple dwc3 controllers will have multiple
>>>>>> PHYs, which eventually be added using usb_add_phy_dev(), and not
>>>>>> using usb_add_phy(). So each dwc3 controller won't be able to
>>>>>> get PHYs by simply calling devm_usb_get_phy() also.
>>>>>
>>>>> No. We have added usb_get_phy_dev() for that purpose in the case of non-dt.
>>>>> I think, instead you can have a patch to use devm_usb_get_phy_dev() here and
>>>>> in exynos platform specific code use usb_bind_phy() to bind the phy and
>>>>> controller till you change it to dt.
>>>>>
>>>>
>>>> We have dt support for dwc3-exynos, in such case we should go ahead with
>>>> of_platform_populate(), right ?
>>>> But if when i use of_platform_populate() i will not be able to set
>>>> dma_mask to dwc3->dev. :-(

You can do something like this

static u64 dwc3_exynos_dma_mask = DMA_BIT_MASK(32);

static int dwc3_exynos_set_dmamask(struct device *dev, void *c)
{
	dev->dma_mask = &dwc3_exynos_dma_mask;

	return 0;
}

And in your probe after of_platform_populate, you can add

device_for_each_child(&pdev->dev, NULL, dwc3_exynos_set_dmamask);

Here pdev is the platform device of dwc3-exynos. By this way all the 
children of dwc3-exynos will have dma_mask set to the required value.

I'm not sure if there is any other better way to achieve the same 
(without patching of.c ;-))

Thanks
Kishon
--
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
Vivek Gautam Feb. 1, 2013, 6:22 a.m. UTC | #7
Hi Kishon,


On Fri, Feb 1, 2013 at 10:51 AM, kishon <kishon@ti.com> wrote:
> Hi,
>
>
> On Thursday 31 January 2013 09:08 PM, Felipe Balbi wrote:
>>
>> On Thu, Jan 31, 2013 at 09:00:37PM +0530, Vivek Gautam wrote:
>>>
>>> Hi Felipe,
>>>
>>>
>>> On Thu, Jan 31, 2013 at 8:55 PM, Felipe Balbi <balbi@ti.com> wrote:
>>>>
>>>> Hi,
>>>>
>>>> On Thu, Jan 31, 2013 at 08:53:27PM +0530, Vivek Gautam wrote:
>>>>>>>
>>>>>>> Moreover, SoCs having multiple dwc3 controllers will have multiple
>>>>>>> PHYs, which eventually be added using usb_add_phy_dev(), and not
>>>>>>> using usb_add_phy(). So each dwc3 controller won't be able to
>>>>>>> get PHYs by simply calling devm_usb_get_phy() also.
>>>>>>
>>>>>>
>>>>>> No. We have added usb_get_phy_dev() for that purpose in the case of
>>>>>> non-dt.
>>>>>> I think, instead you can have a patch to use devm_usb_get_phy_dev()
>>>>>> here and
>>>>>> in exynos platform specific code use usb_bind_phy() to bind the phy
>>>>>> and
>>>>>> controller till you change it to dt.
>>>>>>
>>>>>
>>>>> We have dt support for dwc3-exynos, in such case we should go ahead
>>>>> with
>>>>> of_platform_populate(), right ?
>>>>> But if when i use of_platform_populate() i will not be able to set
>>>>> dma_mask to dwc3->dev. :-(
>
>
> You can do something like this
>
> static u64 dwc3_exynos_dma_mask = DMA_BIT_MASK(32);
>
> static int dwc3_exynos_set_dmamask(struct device *dev, void *c)
> {
>         dev->dma_mask = &dwc3_exynos_dma_mask;
>
>         return 0;
> }
>
> And in your probe after of_platform_populate, you can add
>
> device_for_each_child(&pdev->dev, NULL, dwc3_exynos_set_dmamask);
>
> Here pdev is the platform device of dwc3-exynos. By this way all the
> children of dwc3-exynos will have dma_mask set to the required value.
>

Nice idea, thanks :-)
hmm.. so i can patch this now, and get things working ;-)

> I'm not sure if there is any other better way to achieve the same (without
> patching of.c ;-))
>
Vivek Gautam Feb. 1, 2013, 6:24 a.m. UTC | #8
Hi Balbi,


On Fri, Feb 1, 2013 at 11:52 AM, Vivek Gautam <gautamvivek1987@gmail.com> wrote:
> Hi Kishon,
>
>
> On Fri, Feb 1, 2013 at 10:51 AM, kishon <kishon@ti.com> wrote:
>> Hi,
>>
>>
>> On Thursday 31 January 2013 09:08 PM, Felipe Balbi wrote:
>>>
>>> On Thu, Jan 31, 2013 at 09:00:37PM +0530, Vivek Gautam wrote:
>>>>
>>>> Hi Felipe,
>>>>
>>>>
>>>> On Thu, Jan 31, 2013 at 8:55 PM, Felipe Balbi <balbi@ti.com> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> On Thu, Jan 31, 2013 at 08:53:27PM +0530, Vivek Gautam wrote:
>>>>>>>>
>>>>>>>> Moreover, SoCs having multiple dwc3 controllers will have multiple
>>>>>>>> PHYs, which eventually be added using usb_add_phy_dev(), and not
>>>>>>>> using usb_add_phy(). So each dwc3 controller won't be able to
>>>>>>>> get PHYs by simply calling devm_usb_get_phy() also.
>>>>>>>
>>>>>>>
>>>>>>> No. We have added usb_get_phy_dev() for that purpose in the case of
>>>>>>> non-dt.
>>>>>>> I think, instead you can have a patch to use devm_usb_get_phy_dev()
>>>>>>> here and
>>>>>>> in exynos platform specific code use usb_bind_phy() to bind the phy
>>>>>>> and
>>>>>>> controller till you change it to dt.
>>>>>>>
>>>>>>
>>>>>> We have dt support for dwc3-exynos, in such case we should go ahead
>>>>>> with
>>>>>> of_platform_populate(), right ?
>>>>>> But if when i use of_platform_populate() i will not be able to set
>>>>>> dma_mask to dwc3->dev. :-(
>>
>>
>> You can do something like this
>>
>> static u64 dwc3_exynos_dma_mask = DMA_BIT_MASK(32);
>>
>> static int dwc3_exynos_set_dmamask(struct device *dev, void *c)
>> {
>>         dev->dma_mask = &dwc3_exynos_dma_mask;
>>
>>         return 0;
>> }
>>
>> And in your probe after of_platform_populate, you can add
>>
>> device_for_each_child(&pdev->dev, NULL, dwc3_exynos_set_dmamask);
>>
>> Here pdev is the platform device of dwc3-exynos. By this way all the
>> children of dwc3-exynos will have dma_mask set to the required value.
>>
>
> Nice idea, thanks :-)
> hmm.. so i can patch this now, and get things working ;-)
>

If this is fine with you shall i go ahead and post a patch for the same ? ;-)


>> I'm not sure if there is any other better way to achieve the same (without
>> patching of.c ;-))
>>
>
Felipe Balbi Feb. 1, 2013, 8:50 a.m. UTC | #9
On Fri, Feb 01, 2013 at 11:54:01AM +0530, Vivek Gautam wrote:
> Hi Balbi,
> 
> 
> On Fri, Feb 1, 2013 at 11:52 AM, Vivek Gautam <gautamvivek1987@gmail.com> wrote:
> > Hi Kishon,
> >
> >
> > On Fri, Feb 1, 2013 at 10:51 AM, kishon <kishon@ti.com> wrote:
> >> Hi,
> >>
> >>
> >> On Thursday 31 January 2013 09:08 PM, Felipe Balbi wrote:
> >>>
> >>> On Thu, Jan 31, 2013 at 09:00:37PM +0530, Vivek Gautam wrote:
> >>>>
> >>>> Hi Felipe,
> >>>>
> >>>>
> >>>> On Thu, Jan 31, 2013 at 8:55 PM, Felipe Balbi <balbi@ti.com> wrote:
> >>>>>
> >>>>> Hi,
> >>>>>
> >>>>> On Thu, Jan 31, 2013 at 08:53:27PM +0530, Vivek Gautam wrote:
> >>>>>>>>
> >>>>>>>> Moreover, SoCs having multiple dwc3 controllers will have multiple
> >>>>>>>> PHYs, which eventually be added using usb_add_phy_dev(), and not
> >>>>>>>> using usb_add_phy(). So each dwc3 controller won't be able to
> >>>>>>>> get PHYs by simply calling devm_usb_get_phy() also.
> >>>>>>>
> >>>>>>>
> >>>>>>> No. We have added usb_get_phy_dev() for that purpose in the case of
> >>>>>>> non-dt.
> >>>>>>> I think, instead you can have a patch to use devm_usb_get_phy_dev()
> >>>>>>> here and
> >>>>>>> in exynos platform specific code use usb_bind_phy() to bind the phy
> >>>>>>> and
> >>>>>>> controller till you change it to dt.
> >>>>>>>
> >>>>>>
> >>>>>> We have dt support for dwc3-exynos, in such case we should go ahead
> >>>>>> with
> >>>>>> of_platform_populate(), right ?
> >>>>>> But if when i use of_platform_populate() i will not be able to set
> >>>>>> dma_mask to dwc3->dev. :-(
> >>
> >>
> >> You can do something like this
> >>
> >> static u64 dwc3_exynos_dma_mask = DMA_BIT_MASK(32);
> >>
> >> static int dwc3_exynos_set_dmamask(struct device *dev, void *c)
> >> {
> >>         dev->dma_mask = &dwc3_exynos_dma_mask;
> >>
> >>         return 0;
> >> }
> >>
> >> And in your probe after of_platform_populate, you can add
> >>
> >> device_for_each_child(&pdev->dev, NULL, dwc3_exynos_set_dmamask);
> >>
> >> Here pdev is the platform device of dwc3-exynos. By this way all the
> >> children of dwc3-exynos will have dma_mask set to the required value.
> >>
> >
> > Nice idea, thanks :-)
> > hmm.. so i can patch this now, and get things working ;-)
> >
> 
> If this is fine with you shall i go ahead and post a patch for the same ? ;-)

should be fine, but we can wait a bit to see if DeviceTree folks reply,
your patch will only go on v3.10 anyway.

cheers
Vivek Gautam Feb. 1, 2013, 8:53 a.m. UTC | #10
On Fri, Feb 1, 2013 at 2:20 PM, Felipe Balbi <balbi@ti.com> wrote:
> On Fri, Feb 01, 2013 at 11:54:01AM +0530, Vivek Gautam wrote:
>> Hi Balbi,
>>
>>
>> On Fri, Feb 1, 2013 at 11:52 AM, Vivek Gautam <gautamvivek1987@gmail.com> wrote:
>> > Hi Kishon,
>> >
>> >
>> > On Fri, Feb 1, 2013 at 10:51 AM, kishon <kishon@ti.com> wrote:
>> >> Hi,
>> >>
>> >>
>> >> On Thursday 31 January 2013 09:08 PM, Felipe Balbi wrote:
>> >>>
>> >>> On Thu, Jan 31, 2013 at 09:00:37PM +0530, Vivek Gautam wrote:
>> >>>>
>> >>>> Hi Felipe,
>> >>>>
>> >>>>
>> >>>> On Thu, Jan 31, 2013 at 8:55 PM, Felipe Balbi <balbi@ti.com> wrote:
>> >>>>>
>> >>>>> Hi,
>> >>>>>
>> >>>>> On Thu, Jan 31, 2013 at 08:53:27PM +0530, Vivek Gautam wrote:
>> >>>>>>>>
>> >>>>>>>> Moreover, SoCs having multiple dwc3 controllers will have multiple
>> >>>>>>>> PHYs, which eventually be added using usb_add_phy_dev(), and not
>> >>>>>>>> using usb_add_phy(). So each dwc3 controller won't be able to
>> >>>>>>>> get PHYs by simply calling devm_usb_get_phy() also.
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> No. We have added usb_get_phy_dev() for that purpose in the case of
>> >>>>>>> non-dt.
>> >>>>>>> I think, instead you can have a patch to use devm_usb_get_phy_dev()
>> >>>>>>> here and
>> >>>>>>> in exynos platform specific code use usb_bind_phy() to bind the phy
>> >>>>>>> and
>> >>>>>>> controller till you change it to dt.
>> >>>>>>>
>> >>>>>>
>> >>>>>> We have dt support for dwc3-exynos, in such case we should go ahead
>> >>>>>> with
>> >>>>>> of_platform_populate(), right ?
>> >>>>>> But if when i use of_platform_populate() i will not be able to set
>> >>>>>> dma_mask to dwc3->dev. :-(
>> >>
>> >>
>> >> You can do something like this
>> >>
>> >> static u64 dwc3_exynos_dma_mask = DMA_BIT_MASK(32);
>> >>
>> >> static int dwc3_exynos_set_dmamask(struct device *dev, void *c)
>> >> {
>> >>         dev->dma_mask = &dwc3_exynos_dma_mask;
>> >>
>> >>         return 0;
>> >> }
>> >>
>> >> And in your probe after of_platform_populate, you can add
>> >>
>> >> device_for_each_child(&pdev->dev, NULL, dwc3_exynos_set_dmamask);
>> >>
>> >> Here pdev is the platform device of dwc3-exynos. By this way all the
>> >> children of dwc3-exynos will have dma_mask set to the required value.
>> >>
>> >
>> > Nice idea, thanks :-)
>> > hmm.. so i can patch this now, and get things working ;-)
>> >
>>
>> If this is fine with you shall i go ahead and post a patch for the same ? ;-)
>
> should be fine, but we can wait a bit to see if DeviceTree folks reply,
> your patch will only go on v3.10 anyway.
>

Yeah, sure. No problem at all.
For the time being i will continue to use this change for my other
development work too. :-)
Felipe Balbi Feb. 1, 2013, 9:43 a.m. UTC | #11
Hi,

On Fri, Feb 01, 2013 at 02:23:28PM +0530, Vivek Gautam wrote:
> >> >>>>> On Thu, Jan 31, 2013 at 08:53:27PM +0530, Vivek Gautam wrote:
> >> >>>>>>>>
> >> >>>>>>>> Moreover, SoCs having multiple dwc3 controllers will have multiple
> >> >>>>>>>> PHYs, which eventually be added using usb_add_phy_dev(), and not
> >> >>>>>>>> using usb_add_phy(). So each dwc3 controller won't be able to
> >> >>>>>>>> get PHYs by simply calling devm_usb_get_phy() also.
> >> >>>>>>>
> >> >>>>>>>
> >> >>>>>>> No. We have added usb_get_phy_dev() for that purpose in the case of
> >> >>>>>>> non-dt.
> >> >>>>>>> I think, instead you can have a patch to use devm_usb_get_phy_dev()
> >> >>>>>>> here and
> >> >>>>>>> in exynos platform specific code use usb_bind_phy() to bind the phy
> >> >>>>>>> and
> >> >>>>>>> controller till you change it to dt.
> >> >>>>>>>
> >> >>>>>>
> >> >>>>>> We have dt support for dwc3-exynos, in such case we should go ahead
> >> >>>>>> with
> >> >>>>>> of_platform_populate(), right ?
> >> >>>>>> But if when i use of_platform_populate() i will not be able to set
> >> >>>>>> dma_mask to dwc3->dev. :-(
> >> >>
> >> >>
> >> >> You can do something like this
> >> >>
> >> >> static u64 dwc3_exynos_dma_mask = DMA_BIT_MASK(32);
> >> >>
> >> >> static int dwc3_exynos_set_dmamask(struct device *dev, void *c)
> >> >> {
> >> >>         dev->dma_mask = &dwc3_exynos_dma_mask;
> >> >>
> >> >>         return 0;
> >> >> }
> >> >>
> >> >> And in your probe after of_platform_populate, you can add
> >> >>
> >> >> device_for_each_child(&pdev->dev, NULL, dwc3_exynos_set_dmamask);
> >> >>
> >> >> Here pdev is the platform device of dwc3-exynos. By this way all the
> >> >> children of dwc3-exynos will have dma_mask set to the required value.
> >> >>
> >> >
> >> > Nice idea, thanks :-)
> >> > hmm.. so i can patch this now, and get things working ;-)
> >> >
> >>
> >> If this is fine with you shall i go ahead and post a patch for the same ? ;-)
> >
> > should be fine, but we can wait a bit to see if DeviceTree folks reply,
> > your patch will only go on v3.10 anyway.
> >
> 
> Yeah, sure. No problem at all.
> For the time being i will continue to use this change for my other
> development work too. :-)

Sure, makes sense ;-)
Vivek Gautam Feb. 28, 2013, 2:39 p.m. UTC | #12
Hi,

On Thu, Jan 31, 2013 at 9:08 PM, Felipe Balbi <balbi@ti.com> wrote:
> On Thu, Jan 31, 2013 at 09:00:37PM +0530, Vivek Gautam wrote:
>> Hi Felipe,
>>
>>
>> On Thu, Jan 31, 2013 at 8:55 PM, Felipe Balbi <balbi@ti.com> wrote:
>> > Hi,
>> >
>> > On Thu, Jan 31, 2013 at 08:53:27PM +0530, Vivek Gautam wrote:
>> >> >> Moreover, SoCs having multiple dwc3 controllers will have multiple
>> >> >> PHYs, which eventually be added using usb_add_phy_dev(), and not
>> >> >> using usb_add_phy(). So each dwc3 controller won't be able to
>> >> >> get PHYs by simply calling devm_usb_get_phy() also.
>> >> >
>> >> > No. We have added usb_get_phy_dev() for that purpose in the case of non-dt.
>> >> > I think, instead you can have a patch to use devm_usb_get_phy_dev() here and
>> >> > in exynos platform specific code use usb_bind_phy() to bind the phy and
>> >> > controller till you change it to dt.
>> >> >
>> >>
>> >> We have dt support for dwc3-exynos, in such case we should go ahead with
>> >> of_platform_populate(), right ?
>> >> But if when i use of_platform_populate() i will not be able to set
>> >> dma_mask to dwc3->dev. :-(
>> >
>> > do you have a special need for dma_mask because OF already sets it.
>> >
>> If i am not wrong of_platform_device_create_pdata() will set
>> "dev->dev.coherent_dma_mask = DMA_BIT_MASK(32)"
>> and not dma_mask.
>> I fact we had some discussion sometime back when we needed the same
>> for dwc3-exynos in the thread:
>> [PATCH v2 1/2] USB: dwc3-exynos: Add support for device tree
>>
>> But couldn't get final node on it.
>> So suggestions here please. :-)
>
> hmm.. you're right there. Grant, Rob ? Any hints ?
>

Any suggestions on this ?

> --
> balbi
Felipe Balbi March 1, 2013, 6:41 a.m. UTC | #13
Hi,

On Thu, Feb 28, 2013 at 08:09:33PM +0530, Vivek Gautam wrote:
> On Thu, Jan 31, 2013 at 9:08 PM, Felipe Balbi <balbi@ti.com> wrote:
> > On Thu, Jan 31, 2013 at 09:00:37PM +0530, Vivek Gautam wrote:
> >> Hi Felipe,
> >>
> >>
> >> On Thu, Jan 31, 2013 at 8:55 PM, Felipe Balbi <balbi@ti.com> wrote:
> >> > Hi,
> >> >
> >> > On Thu, Jan 31, 2013 at 08:53:27PM +0530, Vivek Gautam wrote:
> >> >> >> Moreover, SoCs having multiple dwc3 controllers will have multiple
> >> >> >> PHYs, which eventually be added using usb_add_phy_dev(), and not
> >> >> >> using usb_add_phy(). So each dwc3 controller won't be able to
> >> >> >> get PHYs by simply calling devm_usb_get_phy() also.
> >> >> >
> >> >> > No. We have added usb_get_phy_dev() for that purpose in the case of non-dt.
> >> >> > I think, instead you can have a patch to use devm_usb_get_phy_dev() here and
> >> >> > in exynos platform specific code use usb_bind_phy() to bind the phy and
> >> >> > controller till you change it to dt.
> >> >> >
> >> >>
> >> >> We have dt support for dwc3-exynos, in such case we should go ahead with
> >> >> of_platform_populate(), right ?
> >> >> But if when i use of_platform_populate() i will not be able to set
> >> >> dma_mask to dwc3->dev. :-(
> >> >
> >> > do you have a special need for dma_mask because OF already sets it.
> >> >
> >> If i am not wrong of_platform_device_create_pdata() will set
> >> "dev->dev.coherent_dma_mask = DMA_BIT_MASK(32)"
> >> and not dma_mask.
> >> I fact we had some discussion sometime back when we needed the same
> >> for dwc3-exynos in the thread:
> >> [PATCH v2 1/2] USB: dwc3-exynos: Add support for device tree
> >>
> >> But couldn't get final node on it.
> >> So suggestions here please. :-)
> >
> > hmm.. you're right there. Grant, Rob ? Any hints ?
> >
> 
> Any suggestions on this ?

anyone ?
Felipe Balbi March 4, 2013, 3:02 p.m. UTC | #14
Hi,

On Fri, Mar 01, 2013 at 08:41:29AM +0200, Felipe Balbi wrote:
> > >> >> >> Moreover, SoCs having multiple dwc3 controllers will have multiple
> > >> >> >> PHYs, which eventually be added using usb_add_phy_dev(), and not
> > >> >> >> using usb_add_phy(). So each dwc3 controller won't be able to
> > >> >> >> get PHYs by simply calling devm_usb_get_phy() also.
> > >> >> >
> > >> >> > No. We have added usb_get_phy_dev() for that purpose in the case of non-dt.
> > >> >> > I think, instead you can have a patch to use devm_usb_get_phy_dev() here and
> > >> >> > in exynos platform specific code use usb_bind_phy() to bind the phy and
> > >> >> > controller till you change it to dt.
> > >> >> >
> > >> >>
> > >> >> We have dt support for dwc3-exynos, in such case we should go ahead with
> > >> >> of_platform_populate(), right ?
> > >> >> But if when i use of_platform_populate() i will not be able to set
> > >> >> dma_mask to dwc3->dev. :-(
> > >> >
> > >> > do you have a special need for dma_mask because OF already sets it.
> > >> >
> > >> If i am not wrong of_platform_device_create_pdata() will set
> > >> "dev->dev.coherent_dma_mask = DMA_BIT_MASK(32)"
> > >> and not dma_mask.
> > >> I fact we had some discussion sometime back when we needed the same
> > >> for dwc3-exynos in the thread:
> > >> [PATCH v2 1/2] USB: dwc3-exynos: Add support for device tree
> > >>
> > >> But couldn't get final node on it.
> > >> So suggestions here please. :-)
> > >
> > > hmm.. you're right there. Grant, Rob ? Any hints ?
> > >
> > 
> > Any suggestions on this ?
> 
> anyone ?

ping ?
diff mbox

Patch

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 9999094..75439c0 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -423,6 +423,11 @@  static int dwc3_probe(struct platform_device *pdev)
 	if (node) {
 		dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
 		dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 1);
+	} else if (dev->parent->of_node) {
+		dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev->parent,
+								"usb-phy", 0);
+		dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev->parent,
+								"usb-phy", 1);
 	} else {
 		dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
 		dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);