diff mbox

[v2,2/3] usb: chipidea: msm: Add device tree support

Message ID 1392729681-21022-3-git-send-email-iivanov@mm-sol.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Ivan T. Ivanov Feb. 18, 2014, 1:21 p.m. UTC
From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

Allows controller to be specified via device tree.
Pass PHY phandle specified in DT to core driver.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 drivers/usb/chipidea/ci_hdrc_msm.c |   23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

Comments

Josh Cartwright Feb. 18, 2014, 2:08 p.m. UTC | #1
Hey Ivan-

Nit below.

On Tue, Feb 18, 2014 at 03:21:20PM +0200, Ivan T. Ivanov wrote:
> From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> 
> Allows controller to be specified via device tree.
> Pass PHY phandle specified in DT to core driver.
> 
> Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
> ---
>  drivers/usb/chipidea/ci_hdrc_msm.c |   23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c
> index 2d51d85..3f67f1f 100644
> --- a/drivers/usb/chipidea/ci_hdrc_msm.c
> +++ b/drivers/usb/chipidea/ci_hdrc_msm.c
> @@ -57,9 +57,21 @@ static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = {
>  static int ci_hdrc_msm_probe(struct platform_device *pdev)
>  {
>  	struct platform_device *plat_ci;
> +	struct usb_phy *phy;
>  
>  	dev_dbg(&pdev->dev, "ci_hdrc_msm_probe\n");
>  
> +	/*
> +	 * OTG(PHY) driver takes care of PHY initialization, clock management,
> +	 * powering up VBUS, mapping of registers address space and power
> +	 * management.
> +	 */
> +	phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);
> +	if (IS_ERR(phy))
> +		return PTR_ERR(phy);
> +
> +	ci_hdrc_msm_platdata.phy = phy;
> +
>  	plat_ci = ci_hdrc_add_device(&pdev->dev,
>  				pdev->resource, pdev->num_resources,
>  				&ci_hdrc_msm_platdata);
> @@ -86,10 +98,19 @@ static int ci_hdrc_msm_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +static struct of_device_id msm_ci_dt_match[] = {

const?

> +	{ .compatible = "qcom,ci-hdrc", },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, msm_ci_dt_match);
Ivan T. Ivanov Feb. 18, 2014, 5:14 p.m. UTC | #2
Hi, 

On Tue, 2014-02-18 at 20:53 +0300, Sergei Shtylyov wrote: 
> Hello.
> 
> On 02/18/2014 04:21 PM, Ivan T. Ivanov wrote:
> 
> > From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> 
> > Allows controller to be specified via device tree.
> > Pass PHY phandle specified in DT to core driver.
> 
> > Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
> > ---
> >   drivers/usb/chipidea/ci_hdrc_msm.c |   23 ++++++++++++++++++++++-
> >   1 file changed, 22 insertions(+), 1 deletion(-)
> 
>     You also need to describe the binding you're creating in 
> Documentation/devicetree/bindings/usb/<file>.txt.

Did you check "[PATCH v2 1/3]"?

Regards,
Ivan

> 
> WBR, Sergei
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ivan T. Ivanov Feb. 18, 2014, 5:14 p.m. UTC | #3
On Tue, 2014-02-18 at 08:08 -0600, Josh Cartwright wrote: 
> Hey Ivan-
> 
> Nit below.
> 
> On Tue, Feb 18, 2014 at 03:21:20PM +0200, Ivan T. Ivanov wrote:

> >  
> > +static struct of_device_id msm_ci_dt_match[] = {
> 
> const?
> 

Thanks, will do.

Regards,
Ivan

> > +	{ .compatible = "qcom,ci-hdrc", },
> > +	{ }
> > +};
> > +MODULE_DEVICE_TABLE(of, msm_ci_dt_match);
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Feb. 18, 2014, 5:53 p.m. UTC | #4
Hello.

On 02/18/2014 04:21 PM, Ivan T. Ivanov wrote:

> From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

> Allows controller to be specified via device tree.
> Pass PHY phandle specified in DT to core driver.

> Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
> ---
>   drivers/usb/chipidea/ci_hdrc_msm.c |   23 ++++++++++++++++++++++-
>   1 file changed, 22 insertions(+), 1 deletion(-)

    You also need to describe the binding you're creating in 
Documentation/devicetree/bindings/usb/<file>.txt.

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Feb. 18, 2014, 6:31 p.m. UTC | #5
On 02/18/2014 08:14 PM, Ivan T. Ivanov wrote:

>>> From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

>>> Allows controller to be specified via device tree.
>>> Pass PHY phandle specified in DT to core driver.

>>> Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
>>> ---
>>>    drivers/usb/chipidea/ci_hdrc_msm.c |   23 ++++++++++++++++++++++-
>>>    1 file changed, 22 insertions(+), 1 deletion(-)

>>      You also need to describe the binding you're creating in
>> Documentation/devicetree/bindings/usb/<file>.txt.

> Did you check "[PATCH v2 1/3]"?

    Did you send it to 'linux-usb'? I just didn't get the patch.
(Typically, the bindings are described in the same patch the DT support is 
added to the driver bu YMMV, of course.)

> Regards,
> Ivan

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Courtney Cavin Feb. 18, 2014, 9:34 p.m. UTC | #6
On Tue, Feb 18, 2014 at 07:31:55PM +0100, Sergei Shtylyov wrote:
> On 02/18/2014 08:14 PM, Ivan T. Ivanov wrote:
> 
> >>> From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> 
> >>> Allows controller to be specified via device tree.
> >>> Pass PHY phandle specified in DT to core driver.
> 
> >>> Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
> >>> ---
> >>>    drivers/usb/chipidea/ci_hdrc_msm.c |   23 ++++++++++++++++++++++-
> >>>    1 file changed, 22 insertions(+), 1 deletion(-)
> 
> >>      You also need to describe the binding you're creating in
> >> Documentation/devicetree/bindings/usb/<file>.txt.
> 
> > Did you check "[PATCH v2 1/3]"?
> 
>     Did you send it to 'linux-usb'? I just didn't get the patch.
> (Typically, the bindings are described in the same patch the DT support is 
> added to the driver bu YMMV, of course.)

Although I would personally agree that this is the most logical method,
it would appear that the DT guys disagree with us [1].  Lately, they
seem to have either given up or are otherwise preoccupied, so perhaps
you can still slip a few patches by them. ;)

-Courtney

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/submitting-patches.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Feb. 18, 2014, 11:32 p.m. UTC | #7
Hello.

On 02/19/2014 12:34 AM, Courtney Cavin wrote:

>>>>> From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

>>>>> Allows controller to be specified via device tree.
>>>>> Pass PHY phandle specified in DT to core driver.

>>>>> Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
>>>>> ---
>>>>>     drivers/usb/chipidea/ci_hdrc_msm.c |   23 ++++++++++++++++++++++-
>>>>>     1 file changed, 22 insertions(+), 1 deletion(-)

>>>>       You also need to describe the binding you're creating in
>>>> Documentation/devicetree/bindings/usb/<file>.txt.

>>> Did you check "[PATCH v2 1/3]"?

>>      Did you send it to 'linux-usb'? I just didn't get the patch.
>> (Typically, the bindings are described in the same patch the DT support is
>> added to the driver bu YMMV, of course.)

> Although I would personally agree that this is the most logical method,
> it would appear that the DT guys disagree with us [1].  Lately, they

    Thank you for the reference.

> seem to have either given up or are otherwise preoccupied, so perhaps
> you can still slip a few patches by them. ;)

    Yeah, I was at last able to get my Ethernet driver bindings applied. :-)

> -Courtney

> [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/submitting-patches.txt

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ivan T. Ivanov Feb. 19, 2014, 3:48 p.m. UTC | #8
Hi,

On Tue, 2014-02-18 at 21:31 +0300, Sergei Shtylyov wrote: 
> On 02/18/2014 08:14 PM, Ivan T. Ivanov wrote:
> 
> >>> From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> 
> >>> Allows controller to be specified via device tree.
> >>> Pass PHY phandle specified in DT to core driver.
> 
> >>> Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
> >>> ---
> >>>    drivers/usb/chipidea/ci_hdrc_msm.c |   23 ++++++++++++++++++++++-
> >>>    1 file changed, 22 insertions(+), 1 deletion(-)
> 
> >>      You also need to describe the binding you're creating in
> >> Documentation/devicetree/bindings/usb/<file>.txt.
> 
> > Did you check "[PATCH v2 1/3]"?
> 
>     Did you send it to 'linux-usb'?

Opps, sorry. get_maintainer.pl did not list linux-usb and I forgot 
to add it. Would like to resend it?

Regards,
Ivan

> 
> WBR, Sergei


--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Feb. 19, 2014, 8:24 p.m. UTC | #9
Hello.

On 02/19/2014 06:48 PM, Ivan T. Ivanov wrote:

>>>>> From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

>>>>> Allows controller to be specified via device tree.
>>>>> Pass PHY phandle specified in DT to core driver.

>>>>> Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
>>>>> ---
>>>>>     drivers/usb/chipidea/ci_hdrc_msm.c |   23 ++++++++++++++++++++++-
>>>>>     1 file changed, 22 insertions(+), 1 deletion(-)

>>>>       You also need to describe the binding you're creating in
>>>> Documentation/devicetree/bindings/usb/<file>.txt.

>>> Did you check "[PATCH v2 1/3]"?

>>      Did you send it to 'linux-usb'?

> Opps, sorry. get_maintainer.pl did not list linux-usb and I forgot
> to add it. Would like to resend it?

    I guess so, since the binding document would go in thru the USB tree 
anyway, IIUC.

> Regards,
> Ivan

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c
index 2d51d85..3f67f1f 100644
--- a/drivers/usb/chipidea/ci_hdrc_msm.c
+++ b/drivers/usb/chipidea/ci_hdrc_msm.c
@@ -57,9 +57,21 @@  static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = {
 static int ci_hdrc_msm_probe(struct platform_device *pdev)
 {
 	struct platform_device *plat_ci;
+	struct usb_phy *phy;
 
 	dev_dbg(&pdev->dev, "ci_hdrc_msm_probe\n");
 
+	/*
+	 * OTG(PHY) driver takes care of PHY initialization, clock management,
+	 * powering up VBUS, mapping of registers address space and power
+	 * management.
+	 */
+	phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);
+	if (IS_ERR(phy))
+		return PTR_ERR(phy);
+
+	ci_hdrc_msm_platdata.phy = phy;
+
 	plat_ci = ci_hdrc_add_device(&pdev->dev,
 				pdev->resource, pdev->num_resources,
 				&ci_hdrc_msm_platdata);
@@ -86,10 +98,19 @@  static int ci_hdrc_msm_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static struct of_device_id msm_ci_dt_match[] = {
+	{ .compatible = "qcom,ci-hdrc", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, msm_ci_dt_match);
+
 static struct platform_driver ci_hdrc_msm_driver = {
 	.probe = ci_hdrc_msm_probe,
 	.remove = ci_hdrc_msm_remove,
-	.driver = { .name = "msm_hsusb", },
+	.driver = {
+		.name = "msm_hsusb",
+		.of_match_table = msm_ci_dt_match,
+	},
 };
 
 module_platform_driver(ci_hdrc_msm_driver);