RE: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-25 Thread Venu Byravarasu
> -Original Message-
> From: ABRAHAM, KISHON VIJAY [mailto:kis...@ti.com]
> Sent: Monday, September 24, 2012 11:48 AM
> To: Venu Byravarasu
> Cc: Stephen Warren; ba...@ti.com; gre...@linuxfoundation.org; linux-
> ker...@vger.kernel.org; linux-...@vger.kernel.org
> Subject: Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver
> 
> Hi,
> 
> On Sat, Sep 22, 2012 at 2:08 PM, Venu Byravarasu
>  wrote:
> >> -Original Message-
> >> From: Stephen Warren [mailto:swar...@wwwdotorg.org]
> >> Sent: Friday, September 21, 2012 9:45 PM
> >> To: ABRAHAM, KISHON VIJAY
> >> Cc: Venu Byravarasu; ba...@ti.com; gre...@linuxfoundation.org; linux-
> >> ker...@vger.kernel.org; linux-...@vger.kernel.org
> >> Subject: Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver
> >>
> >> On 09/21/2012 07:09 AM, ABRAHAM, KISHON VIJAY wrote:
> >> > Hi,
> >> >
...
> >>
> >> ... where perhaps the use of defaults could be folded into
> >> parse_pdata_from_dt().
> >
> >
> > Thanks Stephen for the detailed explanation.
> >
> > Kishon / Felipe,
> > Do you have any more questions in this related, before patch can be
> applied?
> 
> I don't have any further comments.
> 
> Thanks
> Kishon

Felipe,

Can you plz merge this patch, if you don't have any objections?

Thanks,
Venu
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-25 Thread Venu Byravarasu
 -Original Message-
 From: ABRAHAM, KISHON VIJAY [mailto:kis...@ti.com]
 Sent: Monday, September 24, 2012 11:48 AM
 To: Venu Byravarasu
 Cc: Stephen Warren; ba...@ti.com; gre...@linuxfoundation.org; linux-
 ker...@vger.kernel.org; linux-...@vger.kernel.org
 Subject: Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver
 
 Hi,
 
 On Sat, Sep 22, 2012 at 2:08 PM, Venu Byravarasu
 vbyravar...@nvidia.com wrote:
  -Original Message-
  From: Stephen Warren [mailto:swar...@wwwdotorg.org]
  Sent: Friday, September 21, 2012 9:45 PM
  To: ABRAHAM, KISHON VIJAY
  Cc: Venu Byravarasu; ba...@ti.com; gre...@linuxfoundation.org; linux-
  ker...@vger.kernel.org; linux-...@vger.kernel.org
  Subject: Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver
 
  On 09/21/2012 07:09 AM, ABRAHAM, KISHON VIJAY wrote:
   Hi,
  
...
 
  ... where perhaps the use of defaults could be folded into
  parse_pdata_from_dt().
 
 
  Thanks Stephen for the detailed explanation.
 
  Kishon / Felipe,
  Do you have any more questions in this related, before patch can be
 applied?
 
 I don't have any further comments.
 
 Thanks
 Kishon

Felipe,

Can you plz merge this patch, if you don't have any objections?

Thanks,
Venu
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-24 Thread Venu Byravarasu
> -Original Message-
> From: ABRAHAM, KISHON VIJAY [mailto:kis...@ti.com]
> Sent: Monday, September 24, 2012 11:48 AM
> To: Venu Byravarasu
> Cc: Stephen Warren; ba...@ti.com; gre...@linuxfoundation.org; linux-
> ker...@vger.kernel.org; linux-...@vger.kernel.org
> Subject: Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver
> 
> Hi,
> 
> On Sat, Sep 22, 2012 at 2:08 PM, Venu Byravarasu
>  wrote:
> >> -Original Message-
> >> From: Stephen Warren [mailto:swar...@wwwdotorg.org]
> >> Sent: Friday, September 21, 2012 9:45 PM
> >> To: ABRAHAM, KISHON VIJAY
> >> Cc: Venu Byravarasu; ba...@ti.com; gre...@linuxfoundation.org; linux-
> >> ker...@vger.kernel.org; linux-...@vger.kernel.org
> >> Subject: Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver
> >>
> >> On 09/21/2012 07:09 AM, ABRAHAM, KISHON VIJAY wrote:
> >> > Hi,
> >> >
> >> > On Fri, Sep 21, 2012 at 5:50 PM, Venu Byravarasu
> >>  wrote:
> >> >> NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
> >> >> In order to support USB PHY drivers on these SoCs, existing
> >> >> PHY driver is split into SoC agnostic common USB PHY driver
> >> >> and Tegra20-specific USB phy driver. This will facilitate
> >> >> easy addition and deletion of phy drivers for Tegra SoCs.
> >>
> >> >> @@ -618,6 +618,9 @@ static int tegra_ehci_probe(struct
> platform_device
> >> *pdev)
> >> ...
> >> >> pdata = pdev->dev.platform_data;
> >> >> if (!pdata) {
> >>
> >> Some missing lines of context are:
> >>
> >> dev_err(>dev, "Platform data missing\n");
> >> return -EINVAL;
> >> }
> >>
> >> ...
> >> >> +   params.mode = TEGRA_USB_PHY_MODE_HOST;
> >> >> +   params.config = pdata->phy_config;
> >> >
> >> > I fail to understand how pdata is not NULL in dt boot. I know i've
> >> > already given this comment and you replied that you dint see any
> >> > crash. But I'd like to know where and how pdata gets populated.
> >>
> >> In practice, the platform uses AUXDATA to provide platform data to the
> >> driver even when it's instantiated using device tree; see
> >> arch/arm/mach-tegra/board-dt-tegra20.c variables tegra_ehci*_pdata
> and
> >> tegra20_auxdata_lookup[].
> >>
> >> In the slightly (very very slightly, hopefully) longer term, I would
> >> like to completely remove the AUXDATA setup from board-dt-tegra20.c;
> >> tegra_ehci_probe() should do something like:
> >>
> >> pdata = pdev->dev.platform_data
> >> if (!pdata)
> >> pdata = parse_pdata_from_dt();
> >> /* user didn't specify any in DT either */
> >> if (!pdata)
> >> pdata = default_pdata_for_port();
> >>
> >> ... where perhaps the use of defaults could be folded into
> >> parse_pdata_from_dt().
> >
> >
> > Thanks Stephen for the detailed explanation.
> >
> > Kishon / Felipe,
> > Do you have any more questions in this related, before patch can be
> applied?
> 
> I don't have any further comments.
> 

Thanks Kishon for your quick response.
 

> Thanks
> Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-24 Thread ABRAHAM, KISHON VIJAY
Hi,

On Sat, Sep 22, 2012 at 2:08 PM, Venu Byravarasu  wrote:
>> -Original Message-
>> From: Stephen Warren [mailto:swar...@wwwdotorg.org]
>> Sent: Friday, September 21, 2012 9:45 PM
>> To: ABRAHAM, KISHON VIJAY
>> Cc: Venu Byravarasu; ba...@ti.com; gre...@linuxfoundation.org; linux-
>> ker...@vger.kernel.org; linux-...@vger.kernel.org
>> Subject: Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver
>>
>> On 09/21/2012 07:09 AM, ABRAHAM, KISHON VIJAY wrote:
>> > Hi,
>> >
>> > On Fri, Sep 21, 2012 at 5:50 PM, Venu Byravarasu
>>  wrote:
>> >> NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
>> >> In order to support USB PHY drivers on these SoCs, existing
>> >> PHY driver is split into SoC agnostic common USB PHY driver
>> >> and Tegra20-specific USB phy driver. This will facilitate
>> >> easy addition and deletion of phy drivers for Tegra SoCs.
>>
>> >> @@ -618,6 +618,9 @@ static int tegra_ehci_probe(struct platform_device
>> *pdev)
>> ...
>> >> pdata = pdev->dev.platform_data;
>> >> if (!pdata) {
>>
>> Some missing lines of context are:
>>
>> dev_err(>dev, "Platform data missing\n");
>> return -EINVAL;
>> }
>>
>> ...
>> >> +   params.mode = TEGRA_USB_PHY_MODE_HOST;
>> >> +   params.config = pdata->phy_config;
>> >
>> > I fail to understand how pdata is not NULL in dt boot. I know i've
>> > already given this comment and you replied that you dint see any
>> > crash. But I'd like to know where and how pdata gets populated.
>>
>> In practice, the platform uses AUXDATA to provide platform data to the
>> driver even when it's instantiated using device tree; see
>> arch/arm/mach-tegra/board-dt-tegra20.c variables tegra_ehci*_pdata and
>> tegra20_auxdata_lookup[].
>>
>> In the slightly (very very slightly, hopefully) longer term, I would
>> like to completely remove the AUXDATA setup from board-dt-tegra20.c;
>> tegra_ehci_probe() should do something like:
>>
>> pdata = pdev->dev.platform_data
>> if (!pdata)
>> pdata = parse_pdata_from_dt();
>> /* user didn't specify any in DT either */
>> if (!pdata)
>> pdata = default_pdata_for_port();
>>
>> ... where perhaps the use of defaults could be folded into
>> parse_pdata_from_dt().
>
>
> Thanks Stephen for the detailed explanation.
>
> Kishon / Felipe,
> Do you have any more questions in this related, before patch can be applied?

I don't have any further comments.

Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-24 Thread ABRAHAM, KISHON VIJAY
Hi,

On Sat, Sep 22, 2012 at 2:08 PM, Venu Byravarasu vbyravar...@nvidia.com wrote:
 -Original Message-
 From: Stephen Warren [mailto:swar...@wwwdotorg.org]
 Sent: Friday, September 21, 2012 9:45 PM
 To: ABRAHAM, KISHON VIJAY
 Cc: Venu Byravarasu; ba...@ti.com; gre...@linuxfoundation.org; linux-
 ker...@vger.kernel.org; linux-...@vger.kernel.org
 Subject: Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

 On 09/21/2012 07:09 AM, ABRAHAM, KISHON VIJAY wrote:
  Hi,
 
  On Fri, Sep 21, 2012 at 5:50 PM, Venu Byravarasu
 vbyravar...@nvidia.com wrote:
  NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
  In order to support USB PHY drivers on these SoCs, existing
  PHY driver is split into SoC agnostic common USB PHY driver
  and Tegra20-specific USB phy driver. This will facilitate
  easy addition and deletion of phy drivers for Tegra SoCs.

  @@ -618,6 +618,9 @@ static int tegra_ehci_probe(struct platform_device
 *pdev)
 ...
  pdata = pdev-dev.platform_data;
  if (!pdata) {

 Some missing lines of context are:

 dev_err(pdev-dev, Platform data missing\n);
 return -EINVAL;
 }

 ...
  +   params.mode = TEGRA_USB_PHY_MODE_HOST;
  +   params.config = pdata-phy_config;
 
  I fail to understand how pdata is not NULL in dt boot. I know i've
  already given this comment and you replied that you dint see any
  crash. But I'd like to know where and how pdata gets populated.

 In practice, the platform uses AUXDATA to provide platform data to the
 driver even when it's instantiated using device tree; see
 arch/arm/mach-tegra/board-dt-tegra20.c variables tegra_ehci*_pdata and
 tegra20_auxdata_lookup[].

 In the slightly (very very slightly, hopefully) longer term, I would
 like to completely remove the AUXDATA setup from board-dt-tegra20.c;
 tegra_ehci_probe() should do something like:

 pdata = pdev-dev.platform_data
 if (!pdata)
 pdata = parse_pdata_from_dt();
 /* user didn't specify any in DT either */
 if (!pdata)
 pdata = default_pdata_for_port();

 ... where perhaps the use of defaults could be folded into
 parse_pdata_from_dt().


 Thanks Stephen for the detailed explanation.

 Kishon / Felipe,
 Do you have any more questions in this related, before patch can be applied?

I don't have any further comments.

Thanks
Kishon
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-24 Thread Venu Byravarasu
 -Original Message-
 From: ABRAHAM, KISHON VIJAY [mailto:kis...@ti.com]
 Sent: Monday, September 24, 2012 11:48 AM
 To: Venu Byravarasu
 Cc: Stephen Warren; ba...@ti.com; gre...@linuxfoundation.org; linux-
 ker...@vger.kernel.org; linux-...@vger.kernel.org
 Subject: Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver
 
 Hi,
 
 On Sat, Sep 22, 2012 at 2:08 PM, Venu Byravarasu
 vbyravar...@nvidia.com wrote:
  -Original Message-
  From: Stephen Warren [mailto:swar...@wwwdotorg.org]
  Sent: Friday, September 21, 2012 9:45 PM
  To: ABRAHAM, KISHON VIJAY
  Cc: Venu Byravarasu; ba...@ti.com; gre...@linuxfoundation.org; linux-
  ker...@vger.kernel.org; linux-...@vger.kernel.org
  Subject: Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver
 
  On 09/21/2012 07:09 AM, ABRAHAM, KISHON VIJAY wrote:
   Hi,
  
   On Fri, Sep 21, 2012 at 5:50 PM, Venu Byravarasu
  vbyravar...@nvidia.com wrote:
   NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
   In order to support USB PHY drivers on these SoCs, existing
   PHY driver is split into SoC agnostic common USB PHY driver
   and Tegra20-specific USB phy driver. This will facilitate
   easy addition and deletion of phy drivers for Tegra SoCs.
 
   @@ -618,6 +618,9 @@ static int tegra_ehci_probe(struct
 platform_device
  *pdev)
  ...
   pdata = pdev-dev.platform_data;
   if (!pdata) {
 
  Some missing lines of context are:
 
  dev_err(pdev-dev, Platform data missing\n);
  return -EINVAL;
  }
 
  ...
   +   params.mode = TEGRA_USB_PHY_MODE_HOST;
   +   params.config = pdata-phy_config;
  
   I fail to understand how pdata is not NULL in dt boot. I know i've
   already given this comment and you replied that you dint see any
   crash. But I'd like to know where and how pdata gets populated.
 
  In practice, the platform uses AUXDATA to provide platform data to the
  driver even when it's instantiated using device tree; see
  arch/arm/mach-tegra/board-dt-tegra20.c variables tegra_ehci*_pdata
 and
  tegra20_auxdata_lookup[].
 
  In the slightly (very very slightly, hopefully) longer term, I would
  like to completely remove the AUXDATA setup from board-dt-tegra20.c;
  tegra_ehci_probe() should do something like:
 
  pdata = pdev-dev.platform_data
  if (!pdata)
  pdata = parse_pdata_from_dt();
  /* user didn't specify any in DT either */
  if (!pdata)
  pdata = default_pdata_for_port();
 
  ... where perhaps the use of defaults could be folded into
  parse_pdata_from_dt().
 
 
  Thanks Stephen for the detailed explanation.
 
  Kishon / Felipe,
  Do you have any more questions in this related, before patch can be
 applied?
 
 I don't have any further comments.
 

Thanks Kishon for your quick response.
 

 Thanks
 Kishon
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-22 Thread Venu Byravarasu
> -Original Message-
> From: Stephen Warren [mailto:swar...@wwwdotorg.org]
> Sent: Friday, September 21, 2012 9:45 PM
> To: ABRAHAM, KISHON VIJAY
> Cc: Venu Byravarasu; ba...@ti.com; gre...@linuxfoundation.org; linux-
> ker...@vger.kernel.org; linux-...@vger.kernel.org
> Subject: Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver
> 
> On 09/21/2012 07:09 AM, ABRAHAM, KISHON VIJAY wrote:
> > Hi,
> >
> > On Fri, Sep 21, 2012 at 5:50 PM, Venu Byravarasu
>  wrote:
> >> NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
> >> In order to support USB PHY drivers on these SoCs, existing
> >> PHY driver is split into SoC agnostic common USB PHY driver
> >> and Tegra20-specific USB phy driver. This will facilitate
> >> easy addition and deletion of phy drivers for Tegra SoCs.
> 
> >> @@ -618,6 +618,9 @@ static int tegra_ehci_probe(struct platform_device
> *pdev)
> ...
> >> pdata = pdev->dev.platform_data;
> >> if (!pdata) {
> 
> Some missing lines of context are:
> 
> dev_err(>dev, "Platform data missing\n");
> return -EINVAL;
> }
> 
> ...
> >> +   params.mode = TEGRA_USB_PHY_MODE_HOST;
> >> +   params.config = pdata->phy_config;
> >
> > I fail to understand how pdata is not NULL in dt boot. I know i've
> > already given this comment and you replied that you dint see any
> > crash. But I'd like to know where and how pdata gets populated.
> 
> In practice, the platform uses AUXDATA to provide platform data to the
> driver even when it's instantiated using device tree; see
> arch/arm/mach-tegra/board-dt-tegra20.c variables tegra_ehci*_pdata and
> tegra20_auxdata_lookup[].
> 
> In the slightly (very very slightly, hopefully) longer term, I would
> like to completely remove the AUXDATA setup from board-dt-tegra20.c;
> tegra_ehci_probe() should do something like:
> 
> pdata = pdev->dev.platform_data
> if (!pdata)
> pdata = parse_pdata_from_dt();
> /* user didn't specify any in DT either */
> if (!pdata)
> pdata = default_pdata_for_port();
> 
> ... where perhaps the use of defaults could be folded into
> parse_pdata_from_dt().
 

Thanks Stephen for the detailed explanation.

Kishon / Felipe,
Do you have any more questions in this related, before patch can be applied?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-22 Thread Venu Byravarasu
 -Original Message-
 From: Stephen Warren [mailto:swar...@wwwdotorg.org]
 Sent: Friday, September 21, 2012 9:45 PM
 To: ABRAHAM, KISHON VIJAY
 Cc: Venu Byravarasu; ba...@ti.com; gre...@linuxfoundation.org; linux-
 ker...@vger.kernel.org; linux-...@vger.kernel.org
 Subject: Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver
 
 On 09/21/2012 07:09 AM, ABRAHAM, KISHON VIJAY wrote:
  Hi,
 
  On Fri, Sep 21, 2012 at 5:50 PM, Venu Byravarasu
 vbyravar...@nvidia.com wrote:
  NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
  In order to support USB PHY drivers on these SoCs, existing
  PHY driver is split into SoC agnostic common USB PHY driver
  and Tegra20-specific USB phy driver. This will facilitate
  easy addition and deletion of phy drivers for Tegra SoCs.
 
  @@ -618,6 +618,9 @@ static int tegra_ehci_probe(struct platform_device
 *pdev)
 ...
  pdata = pdev-dev.platform_data;
  if (!pdata) {
 
 Some missing lines of context are:
 
 dev_err(pdev-dev, Platform data missing\n);
 return -EINVAL;
 }
 
 ...
  +   params.mode = TEGRA_USB_PHY_MODE_HOST;
  +   params.config = pdata-phy_config;
 
  I fail to understand how pdata is not NULL in dt boot. I know i've
  already given this comment and you replied that you dint see any
  crash. But I'd like to know where and how pdata gets populated.
 
 In practice, the platform uses AUXDATA to provide platform data to the
 driver even when it's instantiated using device tree; see
 arch/arm/mach-tegra/board-dt-tegra20.c variables tegra_ehci*_pdata and
 tegra20_auxdata_lookup[].
 
 In the slightly (very very slightly, hopefully) longer term, I would
 like to completely remove the AUXDATA setup from board-dt-tegra20.c;
 tegra_ehci_probe() should do something like:
 
 pdata = pdev-dev.platform_data
 if (!pdata)
 pdata = parse_pdata_from_dt();
 /* user didn't specify any in DT either */
 if (!pdata)
 pdata = default_pdata_for_port();
 
 ... where perhaps the use of defaults could be folded into
 parse_pdata_from_dt().
 

Thanks Stephen for the detailed explanation.

Kishon / Felipe,
Do you have any more questions in this related, before patch can be applied?
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-21 Thread Stephen Warren
On 09/21/2012 06:20 AM, Venu Byravarasu wrote:
> NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
> In order to support USB PHY drivers on these SoCs, existing
> PHY driver is split into SoC agnostic common USB PHY driver
> and Tegra20-specific USB phy driver. This will facilitate
> easy addition and deletion of phy drivers for Tegra SoCs.
> 
> Signed-off-by: Venu Byravarasu 

Tested-by: Stephen Warren 

> ---
> delta from v2:
> 
> Added an if condition to check for device_node to be not NULL,
> before dereferencing it.

I suppose that doesn't hurt, but it's not strictly needed; this code
will only ever run on systems that boot using device tree now.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-21 Thread Stephen Warren
On 09/21/2012 07:09 AM, ABRAHAM, KISHON VIJAY wrote:
> Hi,
> 
> On Fri, Sep 21, 2012 at 5:50 PM, Venu Byravarasu  
> wrote:
>> NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
>> In order to support USB PHY drivers on these SoCs, existing
>> PHY driver is split into SoC agnostic common USB PHY driver
>> and Tegra20-specific USB phy driver. This will facilitate
>> easy addition and deletion of phy drivers for Tegra SoCs.

>> @@ -618,6 +618,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
...
>> pdata = pdev->dev.platform_data;
>> if (!pdata) {

Some missing lines of context are:

dev_err(>dev, "Platform data missing\n");
return -EINVAL;
}

...
>> +   params.mode = TEGRA_USB_PHY_MODE_HOST;
>> +   params.config = pdata->phy_config;
> 
> I fail to understand how pdata is not NULL in dt boot. I know i've
> already given this comment and you replied that you dint see any
> crash. But I'd like to know where and how pdata gets populated.

In practice, the platform uses AUXDATA to provide platform data to the
driver even when it's instantiated using device tree; see
arch/arm/mach-tegra/board-dt-tegra20.c variables tegra_ehci*_pdata and
tegra20_auxdata_lookup[].

In the slightly (very very slightly, hopefully) longer term, I would
like to completely remove the AUXDATA setup from board-dt-tegra20.c;
tegra_ehci_probe() should do something like:

pdata = pdev->dev.platform_data
if (!pdata)
pdata = parse_pdata_from_dt();
/* user didn't specify any in DT either */
if (!pdata)
pdata = default_pdata_for_port();

... where perhaps the use of defaults could be folded into
parse_pdata_from_dt().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-21 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Sep 21, 2012 at 5:50 PM, Venu Byravarasu  wrote:
> NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
> In order to support USB PHY drivers on these SoCs, existing
> PHY driver is split into SoC agnostic common USB PHY driver
> and Tegra20-specific USB phy driver. This will facilitate
> easy addition and deletion of phy drivers for Tegra SoCs.
>
> Signed-off-by: Venu Byravarasu 
> ---
> delta from v2:
>
> Added an if condition to check for device_node to be not NULL,
> before dereferencing it.
>
>  drivers/usb/host/ehci-tegra.c  |   26 +-
>  drivers/usb/phy/Makefile   |1 +
>  .../usb/phy/{tegra_usb_phy.c => tegra2_usb_phy.c}  |  421 +++--
>  drivers/usb/phy/tegra2_usb_phy.h   |  140 
>  drivers/usb/phy/tegra_usb_phy.c|  688 
> +---
>  include/linux/usb/tegra_usb_phy.h  |   34 +-
>  6 files changed, 298 insertions(+), 1012 deletions(-)
>  copy drivers/usb/phy/{tegra_usb_phy.c => tegra2_usb_phy.c} (53%)
>  create mode 100644 drivers/usb/phy/tegra2_usb_phy.h
>
> diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
> index 6223d17..8199a6e 100644
> --- a/drivers/usb/host/ehci-tegra.c
> +++ b/drivers/usb/host/ehci-tegra.c
> @@ -618,6 +618,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
> int err = 0;
> int irq;
> int instance = pdev->id;
> +   struct device_node *np = pdev->dev.of_node;
> +   struct phy_params params;
> +   int phy_type;
>
> pdata = pdev->dev.platform_data;
> if (!pdata) {
> @@ -701,14 +704,29 @@ static int tegra_ehci_probe(struct platform_device 
> *pdev)
> break;
> default:
> err = -ENODEV;
> -   dev_err(>dev, "unknown usb instance\n");
> +   dev_err(>dev, "unknown usb inst:%d\n", 
> instance);
> goto fail_io;
> }
> }
>
> +   if (np) {
> +   phy_type = of_property_match_string(np, "phy_type", "utmi");
> +   if (phy_type >= 0)
> +   params.type = TEGRA_USB_PHY_TYPE_UTMI;
> +   else {
> +   phy_type = of_property_match_string(np, "phy_type", 
> "ulpi");
> +   if (phy_type >= 0)
> +   params.type = TEGRA_USB_PHY_TYPE_ULPI;
> +   else
> +   params.type = TEGRA_USB_PHY_TYPE_INVALID;
> +   }
> +   }
> +
> +   params.mode = TEGRA_USB_PHY_MODE_HOST;
> +   params.config = pdata->phy_config;

I fail to understand how pdata is not NULL in dt boot. I know i've
already given this comment and you replied that you dint see any
crash. But I'd like to know where and how pdata gets populated.

Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-21 Thread Venu Byravarasu
NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
In order to support USB PHY drivers on these SoCs, existing
PHY driver is split into SoC agnostic common USB PHY driver
and Tegra20-specific USB phy driver. This will facilitate
easy addition and deletion of phy drivers for Tegra SoCs.

Signed-off-by: Venu Byravarasu 
---
delta from v2:

Added an if condition to check for device_node to be not NULL,
before dereferencing it.

 drivers/usb/host/ehci-tegra.c  |   26 +-
 drivers/usb/phy/Makefile   |1 +
 .../usb/phy/{tegra_usb_phy.c => tegra2_usb_phy.c}  |  421 +++--
 drivers/usb/phy/tegra2_usb_phy.h   |  140 
 drivers/usb/phy/tegra_usb_phy.c|  688 +---
 include/linux/usb/tegra_usb_phy.h  |   34 +-
 6 files changed, 298 insertions(+), 1012 deletions(-)
 copy drivers/usb/phy/{tegra_usb_phy.c => tegra2_usb_phy.c} (53%)
 create mode 100644 drivers/usb/phy/tegra2_usb_phy.h

diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 6223d17..8199a6e 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -618,6 +618,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
int err = 0;
int irq;
int instance = pdev->id;
+   struct device_node *np = pdev->dev.of_node;
+   struct phy_params params;
+   int phy_type;
 
pdata = pdev->dev.platform_data;
if (!pdata) {
@@ -701,14 +704,29 @@ static int tegra_ehci_probe(struct platform_device *pdev)
break;
default:
err = -ENODEV;
-   dev_err(>dev, "unknown usb instance\n");
+   dev_err(>dev, "unknown usb inst:%d\n", instance);
goto fail_io;
}
}
 
+   if (np) {
+   phy_type = of_property_match_string(np, "phy_type", "utmi");
+   if (phy_type >= 0)
+   params.type = TEGRA_USB_PHY_TYPE_UTMI;
+   else {
+   phy_type = of_property_match_string(np, "phy_type", 
"ulpi");
+   if (phy_type >= 0)
+   params.type = TEGRA_USB_PHY_TYPE_ULPI;
+   else
+   params.type = TEGRA_USB_PHY_TYPE_INVALID;
+   }
+   }
+
+   params.mode = TEGRA_USB_PHY_MODE_HOST;
+   params.config = pdata->phy_config;
+
tegra->phy = tegra_usb_phy_open(>dev, instance, hcd->regs,
-   pdata->phy_config,
-   TEGRA_USB_PHY_MODE_HOST);
+   );
if (IS_ERR(tegra->phy)) {
dev_err(>dev, "Failed to open USB phy\n");
err = -ENXIO;
@@ -744,7 +762,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)
 
err = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (err) {
-   dev_err(>dev, "Failed to add USB HCD\n");
+   dev_err(>dev, "usb_add_hcd failed with err 0x%x\n", err);
goto fail;
}
 
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index b069f29..21872e1 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_OMAP_USB2) += omap-usb2.o
 obj-$(CONFIG_USB_ISP1301)  += isp1301.o
 obj-$(CONFIG_MV_U3D_PHY)   += mv_u3d_phy.o
 obj-$(CONFIG_USB_EHCI_TEGRA)   += tegra_usb_phy.o
+obj-$(CONFIG_USB_EHCI_TEGRA)   += tegra2_usb_phy.o
diff --git a/drivers/usb/phy/tegra_usb_phy.c b/drivers/usb/phy/tegra2_usb_phy.c
similarity index 53%
copy from drivers/usb/phy/tegra_usb_phy.c
copy to drivers/usb/phy/tegra2_usb_phy.c
index 987116f..4896a4d 100644
--- a/drivers/usb/phy/tegra_usb_phy.c
+++ b/drivers/usb/phy/tegra2_usb_phy.c
@@ -1,9 +1,11 @@
 /*
  * Copyright (C) 2010 Google, Inc.
+ * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
  *
  * Author:
  * Erik Gilling 
  * Benoit Goby 
+ *  Venu Byravarasu 
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -31,187 +33,18 @@
 #include 
 #include 
 
-#define ULPI_VIEWPORT  0x170
-
-#define USB_PORTSC10x184
-#define   USB_PORTSC1_PTS(x)   (((x) & 0x3) << 30)
-#define   USB_PORTSC1_PSPD(x)  (((x) & 0x3) << 26)
-#define   USB_PORTSC1_PHCD (1 << 23)
-#define   USB_PORTSC1_WKOC (1 << 22)
-#define   USB_PORTSC1_WKDS (1 << 21)
-#define   USB_PORTSC1_WKCN (1 << 20)
-#define   USB_PORTSC1_PTC(x)   (((x) & 0xf) << 16)
-#define   USB_PORTSC1_PP   (1 << 12)
-#define   USB_PORTSC1_SUSP (1 << 7)
-#define   USB_PORTSC1_PE   (1 << 2)
-#define   USB_PORTSC1_CCS  (1 << 0)
-
-#define USB_SUSP_CTRL  0x400
-#define   USB_WAKE_ON_CNNT_EN_DEV  (1 << 3)
-#define   

[PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-21 Thread Venu Byravarasu
NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
In order to support USB PHY drivers on these SoCs, existing
PHY driver is split into SoC agnostic common USB PHY driver
and Tegra20-specific USB phy driver. This will facilitate
easy addition and deletion of phy drivers for Tegra SoCs.

Signed-off-by: Venu Byravarasu vbyravar...@nvidia.com
---
delta from v2:

Added an if condition to check for device_node to be not NULL,
before dereferencing it.

 drivers/usb/host/ehci-tegra.c  |   26 +-
 drivers/usb/phy/Makefile   |1 +
 .../usb/phy/{tegra_usb_phy.c = tegra2_usb_phy.c}  |  421 +++--
 drivers/usb/phy/tegra2_usb_phy.h   |  140 
 drivers/usb/phy/tegra_usb_phy.c|  688 +---
 include/linux/usb/tegra_usb_phy.h  |   34 +-
 6 files changed, 298 insertions(+), 1012 deletions(-)
 copy drivers/usb/phy/{tegra_usb_phy.c = tegra2_usb_phy.c} (53%)
 create mode 100644 drivers/usb/phy/tegra2_usb_phy.h

diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 6223d17..8199a6e 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -618,6 +618,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
int err = 0;
int irq;
int instance = pdev-id;
+   struct device_node *np = pdev-dev.of_node;
+   struct phy_params params;
+   int phy_type;
 
pdata = pdev-dev.platform_data;
if (!pdata) {
@@ -701,14 +704,29 @@ static int tegra_ehci_probe(struct platform_device *pdev)
break;
default:
err = -ENODEV;
-   dev_err(pdev-dev, unknown usb instance\n);
+   dev_err(pdev-dev, unknown usb inst:%d\n, instance);
goto fail_io;
}
}
 
+   if (np) {
+   phy_type = of_property_match_string(np, phy_type, utmi);
+   if (phy_type = 0)
+   params.type = TEGRA_USB_PHY_TYPE_UTMI;
+   else {
+   phy_type = of_property_match_string(np, phy_type, 
ulpi);
+   if (phy_type = 0)
+   params.type = TEGRA_USB_PHY_TYPE_ULPI;
+   else
+   params.type = TEGRA_USB_PHY_TYPE_INVALID;
+   }
+   }
+
+   params.mode = TEGRA_USB_PHY_MODE_HOST;
+   params.config = pdata-phy_config;
+
tegra-phy = tegra_usb_phy_open(pdev-dev, instance, hcd-regs,
-   pdata-phy_config,
-   TEGRA_USB_PHY_MODE_HOST);
+   params);
if (IS_ERR(tegra-phy)) {
dev_err(pdev-dev, Failed to open USB phy\n);
err = -ENXIO;
@@ -744,7 +762,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)
 
err = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (err) {
-   dev_err(pdev-dev, Failed to add USB HCD\n);
+   dev_err(pdev-dev, usb_add_hcd failed with err 0x%x\n, err);
goto fail;
}
 
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index b069f29..21872e1 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_OMAP_USB2) += omap-usb2.o
 obj-$(CONFIG_USB_ISP1301)  += isp1301.o
 obj-$(CONFIG_MV_U3D_PHY)   += mv_u3d_phy.o
 obj-$(CONFIG_USB_EHCI_TEGRA)   += tegra_usb_phy.o
+obj-$(CONFIG_USB_EHCI_TEGRA)   += tegra2_usb_phy.o
diff --git a/drivers/usb/phy/tegra_usb_phy.c b/drivers/usb/phy/tegra2_usb_phy.c
similarity index 53%
copy from drivers/usb/phy/tegra_usb_phy.c
copy to drivers/usb/phy/tegra2_usb_phy.c
index 987116f..4896a4d 100644
--- a/drivers/usb/phy/tegra_usb_phy.c
+++ b/drivers/usb/phy/tegra2_usb_phy.c
@@ -1,9 +1,11 @@
 /*
  * Copyright (C) 2010 Google, Inc.
+ * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
  *
  * Author:
  * Erik Gilling konk...@google.com
  * Benoit Goby ben...@android.com
+ *  Venu Byravarasu vbyravar...@nvidia.com
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -31,187 +33,18 @@
 #include linux/usb/tegra_usb_phy.h
 #include mach/iomap.h
 
-#define ULPI_VIEWPORT  0x170
-
-#define USB_PORTSC10x184
-#define   USB_PORTSC1_PTS(x)   (((x)  0x3)  30)
-#define   USB_PORTSC1_PSPD(x)  (((x)  0x3)  26)
-#define   USB_PORTSC1_PHCD (1  23)
-#define   USB_PORTSC1_WKOC (1  22)
-#define   USB_PORTSC1_WKDS (1  21)
-#define   USB_PORTSC1_WKCN (1  20)
-#define   USB_PORTSC1_PTC(x)   (((x)  0xf)  16)
-#define   USB_PORTSC1_PP   (1  12)
-#define   USB_PORTSC1_SUSP (1  7)
-#define   USB_PORTSC1_PE   (1  2)
-#define   USB_PORTSC1_CCS  (1  0)
-
-#define 

Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-21 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Sep 21, 2012 at 5:50 PM, Venu Byravarasu vbyravar...@nvidia.com wrote:
 NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
 In order to support USB PHY drivers on these SoCs, existing
 PHY driver is split into SoC agnostic common USB PHY driver
 and Tegra20-specific USB phy driver. This will facilitate
 easy addition and deletion of phy drivers for Tegra SoCs.

 Signed-off-by: Venu Byravarasu vbyravar...@nvidia.com
 ---
 delta from v2:

 Added an if condition to check for device_node to be not NULL,
 before dereferencing it.

  drivers/usb/host/ehci-tegra.c  |   26 +-
  drivers/usb/phy/Makefile   |1 +
  .../usb/phy/{tegra_usb_phy.c = tegra2_usb_phy.c}  |  421 +++--
  drivers/usb/phy/tegra2_usb_phy.h   |  140 
  drivers/usb/phy/tegra_usb_phy.c|  688 
 +---
  include/linux/usb/tegra_usb_phy.h  |   34 +-
  6 files changed, 298 insertions(+), 1012 deletions(-)
  copy drivers/usb/phy/{tegra_usb_phy.c = tegra2_usb_phy.c} (53%)
  create mode 100644 drivers/usb/phy/tegra2_usb_phy.h

 diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
 index 6223d17..8199a6e 100644
 --- a/drivers/usb/host/ehci-tegra.c
 +++ b/drivers/usb/host/ehci-tegra.c
 @@ -618,6 +618,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
 int err = 0;
 int irq;
 int instance = pdev-id;
 +   struct device_node *np = pdev-dev.of_node;
 +   struct phy_params params;
 +   int phy_type;

 pdata = pdev-dev.platform_data;
 if (!pdata) {
 @@ -701,14 +704,29 @@ static int tegra_ehci_probe(struct platform_device 
 *pdev)
 break;
 default:
 err = -ENODEV;
 -   dev_err(pdev-dev, unknown usb instance\n);
 +   dev_err(pdev-dev, unknown usb inst:%d\n, 
 instance);
 goto fail_io;
 }
 }

 +   if (np) {
 +   phy_type = of_property_match_string(np, phy_type, utmi);
 +   if (phy_type = 0)
 +   params.type = TEGRA_USB_PHY_TYPE_UTMI;
 +   else {
 +   phy_type = of_property_match_string(np, phy_type, 
 ulpi);
 +   if (phy_type = 0)
 +   params.type = TEGRA_USB_PHY_TYPE_ULPI;
 +   else
 +   params.type = TEGRA_USB_PHY_TYPE_INVALID;
 +   }
 +   }
 +
 +   params.mode = TEGRA_USB_PHY_MODE_HOST;
 +   params.config = pdata-phy_config;

I fail to understand how pdata is not NULL in dt boot. I know i've
already given this comment and you replied that you dint see any
crash. But I'd like to know where and how pdata gets populated.

Thanks
Kishon
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-21 Thread Stephen Warren
On 09/21/2012 07:09 AM, ABRAHAM, KISHON VIJAY wrote:
 Hi,
 
 On Fri, Sep 21, 2012 at 5:50 PM, Venu Byravarasu vbyravar...@nvidia.com 
 wrote:
 NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
 In order to support USB PHY drivers on these SoCs, existing
 PHY driver is split into SoC agnostic common USB PHY driver
 and Tegra20-specific USB phy driver. This will facilitate
 easy addition and deletion of phy drivers for Tegra SoCs.

 @@ -618,6 +618,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
...
 pdata = pdev-dev.platform_data;
 if (!pdata) {

Some missing lines of context are:

dev_err(pdev-dev, Platform data missing\n);
return -EINVAL;
}

...
 +   params.mode = TEGRA_USB_PHY_MODE_HOST;
 +   params.config = pdata-phy_config;
 
 I fail to understand how pdata is not NULL in dt boot. I know i've
 already given this comment and you replied that you dint see any
 crash. But I'd like to know where and how pdata gets populated.

In practice, the platform uses AUXDATA to provide platform data to the
driver even when it's instantiated using device tree; see
arch/arm/mach-tegra/board-dt-tegra20.c variables tegra_ehci*_pdata and
tegra20_auxdata_lookup[].

In the slightly (very very slightly, hopefully) longer term, I would
like to completely remove the AUXDATA setup from board-dt-tegra20.c;
tegra_ehci_probe() should do something like:

pdata = pdev-dev.platform_data
if (!pdata)
pdata = parse_pdata_from_dt();
/* user didn't specify any in DT either */
if (!pdata)
pdata = default_pdata_for_port();

... where perhaps the use of defaults could be folded into
parse_pdata_from_dt().
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-21 Thread Stephen Warren
On 09/21/2012 06:20 AM, Venu Byravarasu wrote:
 NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
 In order to support USB PHY drivers on these SoCs, existing
 PHY driver is split into SoC agnostic common USB PHY driver
 and Tegra20-specific USB phy driver. This will facilitate
 easy addition and deletion of phy drivers for Tegra SoCs.
 
 Signed-off-by: Venu Byravarasu vbyravar...@nvidia.com

Tested-by: Stephen Warren swar...@nvidia.com

 ---
 delta from v2:
 
 Added an if condition to check for device_node to be not NULL,
 before dereferencing it.

I suppose that doesn't hurt, but it's not strictly needed; this code
will only ever run on systems that boot using device tree now.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/