diff mbox

[4/5] usb: ehci-s5p: Change to use phy provided by the generic phy framework

Message ID 1382710529-12082-5-git-send-email-k.debski@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kamil Debski Oct. 25, 2013, 2:15 p.m. UTC
Change the phy provider used from the old usb phy specific to a new one
using the generic phy framework.

Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/usb/host/ehci-s5p.c |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Comments

Kishon Vijay Abraham I Oct. 25, 2013, 3:52 p.m. UTC | #1
Hi,

On Friday 25 October 2013 07:45 PM, Kamil Debski wrote:
> Change the phy provider used from the old usb phy specific to a new one
> using the generic phy framework.

looks good :-)

Thanks
Kishon

> 
> Signed-off-by: Kamil Debski <k.debski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/usb/host/ehci-s5p.c |   21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
> index 7cc26e6..76606ff 100644
> --- a/drivers/usb/host/ehci-s5p.c
> +++ b/drivers/usb/host/ehci-s5p.c
> @@ -19,6 +19,7 @@
>  #include <linux/module.h>
>  #include <linux/of.h>
>  #include <linux/of_gpio.h>
> +#include <linux/phy/phy.h>
>  #include <linux/platform_device.h>
>  #include <linux/platform_data/usb-ehci-s5p.h>
>  #include <linux/usb/phy.h>
> @@ -45,7 +46,7 @@ static struct hc_driver __read_mostly s5p_ehci_hc_driver;
>  
>  struct s5p_ehci_hcd {
>  	struct clk *clk;
> -	struct usb_phy *phy;
> +	struct phy *phy;
>  	struct usb_otg *otg;
>  	struct s5p_ehci_platdata *pdata;
>  };
> @@ -77,10 +78,11 @@ static int s5p_ehci_probe(struct platform_device *pdev)
>  {
>  	struct s5p_ehci_platdata *pdata = pdev->dev.platform_data;
>  	struct s5p_ehci_hcd *s5p_ehci;
> +	struct phy *phy;
>  	struct usb_hcd *hcd;
>  	struct ehci_hcd *ehci;
>  	struct resource *res;
> -	struct usb_phy *phy;
> +	const char *phy_name;
>  	int irq;
>  	int err;
>  
> @@ -103,14 +105,14 @@ static int s5p_ehci_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  	}
>  	s5p_ehci = to_s5p_ehci(hcd);
> -
> +	phy_name = of_get_property(pdev->dev.of_node, "phy-names", NULL);
> +	phy =  devm_phy_get(&pdev->dev, phy_name);
>  	if (of_device_is_compatible(pdev->dev.of_node,
>  					"samsung,exynos5440-ehci")) {
>  		s5p_ehci->pdata = &empty_platdata;
>  		goto skip_phy;
>  	}
>  
> -	phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
>  	if (IS_ERR(phy)) {
>  		/* Fallback to pdata */
>  		if (!pdata) {
> @@ -122,7 +124,6 @@ static int s5p_ehci_probe(struct platform_device *pdev)
>  		}
>  	} else {
>  		s5p_ehci->phy = phy;
> -		s5p_ehci->otg = phy->otg;
>  	}
>  
>  skip_phy:
> @@ -166,7 +167,7 @@ skip_phy:
>  		s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
>  
>  	if (s5p_ehci->phy)
> -		usb_phy_init(s5p_ehci->phy);
> +		phy_power_on(s5p_ehci->phy);
>  	else if (s5p_ehci->pdata->phy_init)
>  		s5p_ehci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST);
>  
> @@ -188,7 +189,7 @@ skip_phy:
>  
>  fail_add_hcd:
>  	if (s5p_ehci->phy)
> -		usb_phy_shutdown(s5p_ehci->phy);
> +		phy_power_off(s5p_ehci->phy);
>  	else if (s5p_ehci->pdata->phy_exit)
>  		s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
>  fail_io:
> @@ -209,7 +210,7 @@ static int s5p_ehci_remove(struct platform_device *pdev)
>  		s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
>  
>  	if (s5p_ehci->phy)
> -		usb_phy_shutdown(s5p_ehci->phy);
> +		phy_power_off(s5p_ehci->phy);
>  	else if (s5p_ehci->pdata->phy_exit)
>  		s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
>  
> @@ -244,7 +245,7 @@ static int s5p_ehci_suspend(struct device *dev)
>  		s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
>  
>  	if (s5p_ehci->phy)
> -		usb_phy_shutdown(s5p_ehci->phy);
> +		phy_power_off(s5p_ehci->phy);
>  	else if (s5p_ehci->pdata->phy_exit)
>  		s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
>  
> @@ -265,7 +266,7 @@ static int s5p_ehci_resume(struct device *dev)
>  		s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
>  
>  	if (s5p_ehci->phy)
> -		usb_phy_init(s5p_ehci->phy);
> +		phy_power_on(s5p_ehci->phy);
>  	else if (s5p_ehci->pdata->phy_init)
>  		s5p_ehci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST);
>  
> 

--
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
Jingoo Han Oct. 26, 2013, 1:27 a.m. UTC | #2
On Friday, October 25, 2013 11:15 PM, Kamil Debski wrote:
> 
> Change the phy provider used from the old usb phy specific to a new one
> using the generic phy framework.
> 
> Signed-off-by: Kamil Debski <k.debski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/usb/host/ehci-s5p.c |   21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)

Hi Kamil Debski,
It looks good. :-)

However, could you re-basing against Greg's 'usb-next' branch?
Now, the file name of 'ehci-s5p.c' is renamed to 'ehci-exynos.c'.
Also, 'Generic PHY Framework' was already merged to Greg's
'usb-next' branch.

Thank you.

Best regards,
Jingoo Han

--
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
Vivek Gautam Oct. 26, 2013, 9:41 a.m. UTC | #3
Hi Kamil,


On Fri, Oct 25, 2013 at 7:45 PM, Kamil Debski <k.debski@samsung.com> wrote:
> Change the phy provider used from the old usb phy specific to a new one
> using the generic phy framework.
>
> Signed-off-by: Kamil Debski <k.debski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/usb/host/ehci-s5p.c |   21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
> index 7cc26e6..76606ff 100644
> --- a/drivers/usb/host/ehci-s5p.c
> +++ b/drivers/usb/host/ehci-s5p.c
> @@ -19,6 +19,7 @@
>  #include <linux/module.h>
>  #include <linux/of.h>
>  #include <linux/of_gpio.h>
> +#include <linux/phy/phy.h>
>  #include <linux/platform_device.h>
>  #include <linux/platform_data/usb-ehci-s5p.h>
>  #include <linux/usb/phy.h>
> @@ -45,7 +46,7 @@ static struct hc_driver __read_mostly s5p_ehci_hc_driver;
>
>  struct s5p_ehci_hcd {
>         struct clk *clk;
> -       struct usb_phy *phy;
> +       struct phy *phy;
>         struct usb_otg *otg;
>         struct s5p_ehci_platdata *pdata;
>  };
> @@ -77,10 +78,11 @@ static int s5p_ehci_probe(struct platform_device *pdev)
>  {
>         struct s5p_ehci_platdata *pdata = pdev->dev.platform_data;
>         struct s5p_ehci_hcd *s5p_ehci;
> +       struct phy *phy;

just a nit here:
Lets keep the pointer to 'phy' and 'phy_name' together ?
and move this above phy_name ?

>         struct usb_hcd *hcd;
>         struct ehci_hcd *ehci;
>         struct resource *res;
> -       struct usb_phy *phy;
> +       const char *phy_name;
>         int irq;
>         int err;
>
> @@ -103,14 +105,14 @@ static int s5p_ehci_probe(struct platform_device *pdev)
>                 return -ENOMEM;
>         }
>         s5p_ehci = to_s5p_ehci(hcd);
> -
> +       phy_name = of_get_property(pdev->dev.of_node, "phy-names", NULL);
> +       phy =  devm_phy_get(&pdev->dev, phy_name);

Below check for exynos5440 was supposed to skip any request phy.
So shouldn't we place above two assignments to the original place
where devm_usb_get_phy()
was called ?
May be i am not getting you intention of changing the place.

>         if (of_device_is_compatible(pdev->dev.of_node,
>                                         "samsung,exynos5440-ehci")) {
>                 s5p_ehci->pdata = &empty_platdata;
>                 goto skip_phy;
>         }
>
> -       phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
>         if (IS_ERR(phy)) {
>                 /* Fallback to pdata */
>                 if (!pdata) {
> @@ -122,7 +124,6 @@ static int s5p_ehci_probe(struct platform_device *pdev)
>                 }
>         } else {
>                 s5p_ehci->phy = phy;
> -               s5p_ehci->otg = phy->otg;
>         }
>
>  skip_phy:
> @@ -166,7 +167,7 @@ skip_phy:
>                 s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);

Lets remove this line and similar calls to 'set_host()' in the driver,
since we don't have
s5p_ehci->otg anymore after the same is removed above.
Anyways this was helping the old phy-samsung-usb2 driver, and not needed now.

>
>         if (s5p_ehci->phy)
> -               usb_phy_init(s5p_ehci->phy);
> +               phy_power_on(s5p_ehci->phy);
>         else if (s5p_ehci->pdata->phy_init)
>                 s5p_ehci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST);
>
> @@ -188,7 +189,7 @@ skip_phy:
>
>  fail_add_hcd:
>         if (s5p_ehci->phy)
> -               usb_phy_shutdown(s5p_ehci->phy);
> +               phy_power_off(s5p_ehci->phy);
>         else if (s5p_ehci->pdata->phy_exit)
>                 s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
>  fail_io:
> @@ -209,7 +210,7 @@ static int s5p_ehci_remove(struct platform_device *pdev)
>                 s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);

ditto

>
>         if (s5p_ehci->phy)
> -               usb_phy_shutdown(s5p_ehci->phy);
> +               phy_power_off(s5p_ehci->phy);
>         else if (s5p_ehci->pdata->phy_exit)
>                 s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
>
> @@ -244,7 +245,7 @@ static int s5p_ehci_suspend(struct device *dev)
>                 s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
ditto

>
>         if (s5p_ehci->phy)
> -               usb_phy_shutdown(s5p_ehci->phy);
> +               phy_power_off(s5p_ehci->phy);
>         else if (s5p_ehci->pdata->phy_exit)
>                 s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
>
> @@ -265,7 +266,7 @@ static int s5p_ehci_resume(struct device *dev)
>                 s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
ditto

>
>         if (s5p_ehci->phy)
> -               usb_phy_init(s5p_ehci->phy);
> +               phy_power_on(s5p_ehci->phy);
>         else if (s5p_ehci->pdata->phy_init)
>                 s5p_ehci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST);
>
[..] Rest looks good. :-)
Kamil Debski Oct. 28, 2013, 1:52 p.m. UTC | #4
Hi Jingoo,

> From: Jingoo Han [mailto:jg1.han@samsung.com]
> Sent: Saturday, October 26, 2013 3:27 AM
> 
> On Friday, October 25, 2013 11:15 PM, Kamil Debski wrote:
> >
> > Change the phy provider used from the old usb phy specific to a new
> > one using the generic phy framework.
> >
> > Signed-off-by: Kamil Debski <k.debski@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > ---
> >  drivers/usb/host/ehci-s5p.c |   21 +++++++++++----------
> >  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> Hi Kamil Debski,
> It looks good. :-)

Thank you.
 
> However, could you re-basing against Greg's 'usb-next' branch?
> Now, the file name of 'ehci-s5p.c' is renamed to 'ehci-exynos.c'.
> Also, 'Generic PHY Framework' was already merged to Greg's 'usb-next'
> branch.

Thanks for pointing out this.

> 
> Thank you.
> 
> Best regards,
> Jingoo Han

Best wishes,
Kamil Debski Oct. 28, 2013, 1:53 p.m. UTC | #5
Hi Vivek,

> From: Vivek Gautam [mailto:gautamvivek1987@gmail.com]
> Sent: Saturday, October 26, 2013 11:41 AM
> 
> Hi Kamil,
> 
> 
> On Fri, Oct 25, 2013 at 7:45 PM, Kamil Debski <k.debski@samsung.com>
> wrote:
> > Change the phy provider used from the old usb phy specific to a new
> > one using the generic phy framework.
> >
> > Signed-off-by: Kamil Debski <k.debski@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > ---
> >  drivers/usb/host/ehci-s5p.c |   21 +++++++++++----------
> >  1 file changed, 11 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-
> s5p.c
> > index 7cc26e6..76606ff 100644
> > --- a/drivers/usb/host/ehci-s5p.c
> > +++ b/drivers/usb/host/ehci-s5p.c
> > @@ -19,6 +19,7 @@
> >  #include <linux/module.h>
> >  #include <linux/of.h>
> >  #include <linux/of_gpio.h>
> > +#include <linux/phy/phy.h>
> >  #include <linux/platform_device.h>
> >  #include <linux/platform_data/usb-ehci-s5p.h>
> >  #include <linux/usb/phy.h>
> > @@ -45,7 +46,7 @@ static struct hc_driver __read_mostly
> > s5p_ehci_hc_driver;
> >
> >  struct s5p_ehci_hcd {
> >         struct clk *clk;
> > -       struct usb_phy *phy;
> > +       struct phy *phy;
> >         struct usb_otg *otg;
> >         struct s5p_ehci_platdata *pdata;  }; @@ -77,10 +78,11 @@
> > static int s5p_ehci_probe(struct platform_device *pdev)  {
> >         struct s5p_ehci_platdata *pdata = pdev->dev.platform_data;
> >         struct s5p_ehci_hcd *s5p_ehci;
> > +       struct phy *phy;
> 
> just a nit here:
> Lets keep the pointer to 'phy' and 'phy_name' together ?
> and move this above phy_name ?

Thanks for pointing this out.
 
> >         struct usb_hcd *hcd;
> >         struct ehci_hcd *ehci;
> >         struct resource *res;
> > -       struct usb_phy *phy;
> > +       const char *phy_name;
> >         int irq;
> >         int err;
> >
> > @@ -103,14 +105,14 @@ static int s5p_ehci_probe(struct
> platform_device *pdev)
> >                 return -ENOMEM;
> >         }
> >         s5p_ehci = to_s5p_ehci(hcd);
> > -
> > +       phy_name = of_get_property(pdev->dev.of_node, "phy-names",
> NULL);
> > +       phy =  devm_phy_get(&pdev->dev, phy_name);
> 
> Below check for exynos5440 was supposed to skip any request phy.
> So shouldn't we place above two assignments to the original place where
> devm_usb_get_phy() was called ?
> May be i am not getting you intention of changing the place.

Hm... You are right - if we want to leave this check and skip phy request
for
5450 then I should leave the order as it was. And if we want to use the new
phy driver for 5450 then the check to skip phy requesting should be simply
removed.

> 
> >         if (of_device_is_compatible(pdev->dev.of_node,
> >                                         "samsung,exynos5440-ehci")) {
> >                 s5p_ehci->pdata = &empty_platdata;
> >                 goto skip_phy;
> >         }
> >
> > -       phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
> >         if (IS_ERR(phy)) {
> >                 /* Fallback to pdata */
> >                 if (!pdata) {
> > @@ -122,7 +124,6 @@ static int s5p_ehci_probe(struct platform_device
> *pdev)
> >                 }
> >         } else {
> >                 s5p_ehci->phy = phy;
> > -               s5p_ehci->otg = phy->otg;
> >         }
> >
> >  skip_phy:
> > @@ -166,7 +167,7 @@ skip_phy:
> >                 s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
> 
> Lets remove this line and similar calls to 'set_host()' in the driver,
> since we don't have s5p_ehci->otg anymore after the same is removed
> above.
> Anyways this was helping the old phy-samsung-usb2 driver, and not
> needed now.

Ok, I will.

> 
> >
> >         if (s5p_ehci->phy)
> > -               usb_phy_init(s5p_ehci->phy);
> > +               phy_power_on(s5p_ehci->phy);
> >         else if (s5p_ehci->pdata->phy_init)
> >                 s5p_ehci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST);
> >
> > @@ -188,7 +189,7 @@ skip_phy:
> >
> >  fail_add_hcd:
> >         if (s5p_ehci->phy)
> > -               usb_phy_shutdown(s5p_ehci->phy);
> > +               phy_power_off(s5p_ehci->phy);
> >         else if (s5p_ehci->pdata->phy_exit)
> >                 s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
> >  fail_io:
> > @@ -209,7 +210,7 @@ static int s5p_ehci_remove(struct platform_device
> *pdev)
> >                 s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
> 
> ditto
> 
> >
> >         if (s5p_ehci->phy)
> > -               usb_phy_shutdown(s5p_ehci->phy);
> > +               phy_power_off(s5p_ehci->phy);
> >         else if (s5p_ehci->pdata->phy_exit)
> >                 s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
> >
> > @@ -244,7 +245,7 @@ static int s5p_ehci_suspend(struct device *dev)
> >                 s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
> ditto
> 
> >
> >         if (s5p_ehci->phy)
> > -               usb_phy_shutdown(s5p_ehci->phy);
> > +               phy_power_off(s5p_ehci->phy);
> >         else if (s5p_ehci->pdata->phy_exit)
> >                 s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
> >
> > @@ -265,7 +266,7 @@ static int s5p_ehci_resume(struct device *dev)
> >                 s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
> ditto
> 
> >
> >         if (s5p_ehci->phy)
> > -               usb_phy_init(s5p_ehci->phy);
> > +               phy_power_on(s5p_ehci->phy);
> >         else if (s5p_ehci->pdata->phy_init)
> >                 s5p_ehci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST);
> >
> [..] Rest looks good. :-)
> 

Thank you!

Best wishes,
Vivek Gautam Oct. 28, 2013, 2:36 p.m. UTC | #6
Hi Kamil,


On Mon, Oct 28, 2013 at 7:23 PM, Kamil Debski <k.debski@samsung.com> wrote:
> Hi Vivek,
>
>> From: Vivek Gautam [mailto:gautamvivek1987@gmail.com]
>> Sent: Saturday, October 26, 2013 11:41 AM
>>
>> Hi Kamil,
>>
>>
>> On Fri, Oct 25, 2013 at 7:45 PM, Kamil Debski <k.debski@samsung.com>
>> wrote:
>> > Change the phy provider used from the old usb phy specific to a new
>> > one using the generic phy framework.
>> >
>> > Signed-off-by: Kamil Debski <k.debski@samsung.com>
>> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> > ---

Similar change for ohci-exynos too ?

>> >  drivers/usb/host/ehci-s5p.c |   21 +++++++++++----------
>> >  1 file changed, 11 insertions(+), 10 deletions(-)
>> >
>> > diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-
>> s5p.c
>> > index 7cc26e6..76606ff 100644
>> > --- a/drivers/usb/host/ehci-s5p.c
>> > +++ b/drivers/usb/host/ehci-s5p.c
>> > @@ -19,6 +19,7 @@
>> >  #include <linux/module.h>
>> >  #include <linux/of.h>
>> >  #include <linux/of_gpio.h>
>> > +#include <linux/phy/phy.h>
>> >  #include <linux/platform_device.h>
>> >  #include <linux/platform_data/usb-ehci-s5p.h>
>> >  #include <linux/usb/phy.h>
>> > @@ -45,7 +46,7 @@ static struct hc_driver __read_mostly
>> > s5p_ehci_hc_driver;
>> >
>> >  struct s5p_ehci_hcd {
>> >         struct clk *clk;
>> > -       struct usb_phy *phy;
>> > +       struct phy *phy;
>> >         struct usb_otg *otg;

This can also be removed.

>> >         struct s5p_ehci_platdata *pdata;  }; @@ -77,10 +78,11 @@
>> > static int s5p_ehci_probe(struct platform_device *pdev)  {
>> >         struct s5p_ehci_platdata *pdata = pdev->dev.platform_data;
>> >         struct s5p_ehci_hcd *s5p_ehci;
>> > +       struct phy *phy;
>>
>> just a nit here:
>> Lets keep the pointer to 'phy' and 'phy_name' together ?
>> and move this above phy_name ?
>
> Thanks for pointing this out.
>
>> >         struct usb_hcd *hcd;
>> >         struct ehci_hcd *ehci;
>> >         struct resource *res;
>> > -       struct usb_phy *phy;
>> > +       const char *phy_name;
>> >         int irq;
>> >         int err;
>> >
>> > @@ -103,14 +105,14 @@ static int s5p_ehci_probe(struct
>> platform_device *pdev)
>> >                 return -ENOMEM;
>> >         }
>> >         s5p_ehci = to_s5p_ehci(hcd);
>> > -
>> > +       phy_name = of_get_property(pdev->dev.of_node, "phy-names",
>> NULL);

Sorry one more doubt here :-)
Now that we have HOST, DEVICE, HSIC0, HSIC1 as different PHYs,
and i think EHCI will be the candidate to request HSIC phy too (once
we have HSIC phy
initialization code available for each SoC);
shouldn't we be using of_count_phandle_with_args() to get HOST, and HSIC phys
and then request multiple phys here ?

>> > +       phy =  devm_phy_get(&pdev->dev, phy_name);
>>
>> Below check for exynos5440 was supposed to skip any request phy.
>> So shouldn't we place above two assignments to the original place where
>> devm_usb_get_phy() was called ?
>> May be i am not getting you intention of changing the place.
>
> Hm... You are right - if we want to leave this check and skip phy request
> for
> 5450 then I should leave the order as it was. And if we want to use the new
> phy driver for 5450 then the check to skip phy requesting should be simply
> removed.
>
>>
>> >         if (of_device_is_compatible(pdev->dev.of_node,
>> >                                         "samsung,exynos5440-ehci")) {
>> >                 s5p_ehci->pdata = &empty_platdata;
>> >                 goto skip_phy;
>> >         }
>> >
>> > -       phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
>> >         if (IS_ERR(phy)) {
>> >                 /* Fallback to pdata */
>> >                 if (!pdata) {
>> > @@ -122,7 +124,6 @@ static int s5p_ehci_probe(struct platform_device
>> *pdev)
>> >                 }
>> >         } else {
>> >                 s5p_ehci->phy = phy;
>> > -               s5p_ehci->otg = phy->otg;
>> >         }
>> >
>> >  skip_phy:
>> > @@ -166,7 +167,7 @@ skip_phy:
>> >                 s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
>>
>> Lets remove this line and similar calls to 'set_host()' in the driver,
>> since we don't have s5p_ehci->otg anymore after the same is removed
>> above.
>> Anyways this was helping the old phy-samsung-usb2 driver, and not
>> needed now.
>
> Ok, I will.
>
>>
>> >
>> >         if (s5p_ehci->phy)
>> > -               usb_phy_init(s5p_ehci->phy);
>> > +               phy_power_on(s5p_ehci->phy);
>> >         else if (s5p_ehci->pdata->phy_init)
>> >                 s5p_ehci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST);
>> >
>> > @@ -188,7 +189,7 @@ skip_phy:
>> >
>> >  fail_add_hcd:
>> >         if (s5p_ehci->phy)
>> > -               usb_phy_shutdown(s5p_ehci->phy);
>> > +               phy_power_off(s5p_ehci->phy);
>> >         else if (s5p_ehci->pdata->phy_exit)
>> >                 s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
>> >  fail_io:
>> > @@ -209,7 +210,7 @@ static int s5p_ehci_remove(struct platform_device
>> *pdev)
>> >                 s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
>>
>> ditto
>>
>> >
>> >         if (s5p_ehci->phy)
>> > -               usb_phy_shutdown(s5p_ehci->phy);
>> > +               phy_power_off(s5p_ehci->phy);
>> >         else if (s5p_ehci->pdata->phy_exit)
>> >                 s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
>> >
>> > @@ -244,7 +245,7 @@ static int s5p_ehci_suspend(struct device *dev)
>> >                 s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
>> ditto
>>
>> >
>> >         if (s5p_ehci->phy)
>> > -               usb_phy_shutdown(s5p_ehci->phy);
>> > +               phy_power_off(s5p_ehci->phy);
>> >         else if (s5p_ehci->pdata->phy_exit)
>> >                 s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
>> >
>> > @@ -265,7 +266,7 @@ static int s5p_ehci_resume(struct device *dev)
>> >                 s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
>> ditto
>>
>> >
>> >         if (s5p_ehci->phy)
>> > -               usb_phy_init(s5p_ehci->phy);
>> > +               phy_power_on(s5p_ehci->phy);
>> >         else if (s5p_ehci->pdata->phy_init)
>> >                 s5p_ehci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST);
>> >
>> [..] Rest looks good. :-)
>>
>
> Thank you!
>
> Best wishes,
> --
> Kamil Debski
> Samsung R&D Institute Poland
>
>
diff mbox

Patch

diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 7cc26e6..76606ff 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -19,6 +19,7 @@ 
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_gpio.h>
+#include <linux/phy/phy.h>
 #include <linux/platform_device.h>
 #include <linux/platform_data/usb-ehci-s5p.h>
 #include <linux/usb/phy.h>
@@ -45,7 +46,7 @@  static struct hc_driver __read_mostly s5p_ehci_hc_driver;
 
 struct s5p_ehci_hcd {
 	struct clk *clk;
-	struct usb_phy *phy;
+	struct phy *phy;
 	struct usb_otg *otg;
 	struct s5p_ehci_platdata *pdata;
 };
@@ -77,10 +78,11 @@  static int s5p_ehci_probe(struct platform_device *pdev)
 {
 	struct s5p_ehci_platdata *pdata = pdev->dev.platform_data;
 	struct s5p_ehci_hcd *s5p_ehci;
+	struct phy *phy;
 	struct usb_hcd *hcd;
 	struct ehci_hcd *ehci;
 	struct resource *res;
-	struct usb_phy *phy;
+	const char *phy_name;
 	int irq;
 	int err;
 
@@ -103,14 +105,14 @@  static int s5p_ehci_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 	s5p_ehci = to_s5p_ehci(hcd);
-
+	phy_name = of_get_property(pdev->dev.of_node, "phy-names", NULL);
+	phy =  devm_phy_get(&pdev->dev, phy_name);
 	if (of_device_is_compatible(pdev->dev.of_node,
 					"samsung,exynos5440-ehci")) {
 		s5p_ehci->pdata = &empty_platdata;
 		goto skip_phy;
 	}
 
-	phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
 	if (IS_ERR(phy)) {
 		/* Fallback to pdata */
 		if (!pdata) {
@@ -122,7 +124,6 @@  static int s5p_ehci_probe(struct platform_device *pdev)
 		}
 	} else {
 		s5p_ehci->phy = phy;
-		s5p_ehci->otg = phy->otg;
 	}
 
 skip_phy:
@@ -166,7 +167,7 @@  skip_phy:
 		s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
 
 	if (s5p_ehci->phy)
-		usb_phy_init(s5p_ehci->phy);
+		phy_power_on(s5p_ehci->phy);
 	else if (s5p_ehci->pdata->phy_init)
 		s5p_ehci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST);
 
@@ -188,7 +189,7 @@  skip_phy:
 
 fail_add_hcd:
 	if (s5p_ehci->phy)
-		usb_phy_shutdown(s5p_ehci->phy);
+		phy_power_off(s5p_ehci->phy);
 	else if (s5p_ehci->pdata->phy_exit)
 		s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
 fail_io:
@@ -209,7 +210,7 @@  static int s5p_ehci_remove(struct platform_device *pdev)
 		s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
 
 	if (s5p_ehci->phy)
-		usb_phy_shutdown(s5p_ehci->phy);
+		phy_power_off(s5p_ehci->phy);
 	else if (s5p_ehci->pdata->phy_exit)
 		s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
 
@@ -244,7 +245,7 @@  static int s5p_ehci_suspend(struct device *dev)
 		s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
 
 	if (s5p_ehci->phy)
-		usb_phy_shutdown(s5p_ehci->phy);
+		phy_power_off(s5p_ehci->phy);
 	else if (s5p_ehci->pdata->phy_exit)
 		s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
 
@@ -265,7 +266,7 @@  static int s5p_ehci_resume(struct device *dev)
 		s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self);
 
 	if (s5p_ehci->phy)
-		usb_phy_init(s5p_ehci->phy);
+		phy_power_on(s5p_ehci->phy);
 	else if (s5p_ehci->pdata->phy_init)
 		s5p_ehci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST);