diff mbox

[v3,1/7] phy: omap-usb2: Use generic clock names "wkupclk" and "refclk"

Message ID 1399283686-6127-2-git-send-email-rogerq@ti.com
State Accepted
Commit 9f1d8ed227670c592dac606bc5f3bf8dfcfade16
Headers show

Commit Message

Roger Quadros May 5, 2014, 9:54 a.m. UTC
As clocks might be named differently on multiple platforms, use a generic
name in the driver and allow device tree node to specify the platform
specific clock name.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/phy/phy-omap-usb2.c | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

Comments

Felipe Balbi May 5, 2014, 6:14 p.m. UTC | #1
On Mon, May 05, 2014 at 12:54:40PM +0300, Roger Quadros wrote:
> As clocks might be named differently on multiple platforms, use a generic
> name in the driver and allow device tree node to specify the platform
> specific clock name.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>

Reviewed-by: Felipe Balbi <balbi@ti.com>

> ---
>  drivers/phy/phy-omap-usb2.c | 30 +++++++++++++++++++++++-------
>  1 file changed, 23 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
> index a2205a8..7007c11 100644
> --- a/drivers/phy/phy-omap-usb2.c
> +++ b/drivers/phy/phy-omap-usb2.c
> @@ -275,18 +275,34 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  	if (IS_ERR(phy_provider))
>  		return PTR_ERR(phy_provider);
>  
> -	phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k");
> +	phy->wkupclk = devm_clk_get(phy->dev, "wkupclk");
>  	if (IS_ERR(phy->wkupclk)) {
> -		dev_err(&pdev->dev, "unable to get usb_phy_cm_clk32k\n");
> -		return PTR_ERR(phy->wkupclk);
> +		dev_warn(&pdev->dev, "unable to get wkupclk, trying old name\n");
> +		phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k");
> +		if (IS_ERR(phy->wkupclk)) {
> +			dev_err(&pdev->dev, "unable to get usb_phy_cm_clk32k\n");
> +			return PTR_ERR(phy->wkupclk);
> +		} else {
> +			dev_warn(&pdev->dev,
> +				 "found usb_phy_cm_clk32k, please fix DTS\n");
> +		}
>  	}
>  	clk_prepare(phy->wkupclk);
>  
> -	phy->optclk = devm_clk_get(phy->dev, "usb_otg_ss_refclk960m");
> -	if (IS_ERR(phy->optclk))
> -		dev_vdbg(&pdev->dev, "unable to get refclk960m\n");
> -	else
> +	phy->optclk = devm_clk_get(phy->dev, "refclk");
> +	if (IS_ERR(phy->optclk)) {
> +		dev_dbg(&pdev->dev, "unable to get refclk, trying old name\n");
> +		phy->optclk = devm_clk_get(phy->dev, "usb_otg_ss_refclk960m");
> +		if (IS_ERR(phy->optclk)) {
> +			dev_dbg(&pdev->dev,
> +				"unable to get usb_otg_ss_refclk960m\n");
> +		} else {
> +			dev_warn(&pdev->dev,
> +				 "found usb_otg_ss_refclk960m, please fix DTS\n");
> +		}
> +	} else {
>  		clk_prepare(phy->optclk);
> +	}
>  
>  	usb_add_phy_dev(&phy->phy);
>  
> -- 
> 1.8.3.2
>
diff mbox

Patch

diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index a2205a8..7007c11 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -275,18 +275,34 @@  static int omap_usb2_probe(struct platform_device *pdev)
 	if (IS_ERR(phy_provider))
 		return PTR_ERR(phy_provider);
 
-	phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k");
+	phy->wkupclk = devm_clk_get(phy->dev, "wkupclk");
 	if (IS_ERR(phy->wkupclk)) {
-		dev_err(&pdev->dev, "unable to get usb_phy_cm_clk32k\n");
-		return PTR_ERR(phy->wkupclk);
+		dev_warn(&pdev->dev, "unable to get wkupclk, trying old name\n");
+		phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k");
+		if (IS_ERR(phy->wkupclk)) {
+			dev_err(&pdev->dev, "unable to get usb_phy_cm_clk32k\n");
+			return PTR_ERR(phy->wkupclk);
+		} else {
+			dev_warn(&pdev->dev,
+				 "found usb_phy_cm_clk32k, please fix DTS\n");
+		}
 	}
 	clk_prepare(phy->wkupclk);
 
-	phy->optclk = devm_clk_get(phy->dev, "usb_otg_ss_refclk960m");
-	if (IS_ERR(phy->optclk))
-		dev_vdbg(&pdev->dev, "unable to get refclk960m\n");
-	else
+	phy->optclk = devm_clk_get(phy->dev, "refclk");
+	if (IS_ERR(phy->optclk)) {
+		dev_dbg(&pdev->dev, "unable to get refclk, trying old name\n");
+		phy->optclk = devm_clk_get(phy->dev, "usb_otg_ss_refclk960m");
+		if (IS_ERR(phy->optclk)) {
+			dev_dbg(&pdev->dev,
+				"unable to get usb_otg_ss_refclk960m\n");
+		} else {
+			dev_warn(&pdev->dev,
+				 "found usb_otg_ss_refclk960m, please fix DTS\n");
+		}
+	} else {
 		clk_prepare(phy->optclk);
+	}
 
 	usb_add_phy_dev(&phy->phy);