usb: otg: OMAP4430: Fixing the omap4430_phy_init function
authorHema HK <hemahk@ti.com>
Thu, 24 Mar 2011 11:38:42 +0000 (17:08 +0530)
committerFelipe Balbi <balbi@ti.com>
Wed, 18 May 2011 10:39:51 +0000 (13:39 +0300)
omap4430_phy_init() function can be called with no device pointer,
to powerdown the PHY during board init when USB is disabled.
Fix the function accordingly.

Signed-off-by: Hema HK <hemahk@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
arch/arm/mach-omap2/omap_phy_internal.c

index eff6e248b562c2c370700ae7f6403c164b32728f..f47813edd95143d938c554fd3dc19b71f492237a 100644 (file)
@@ -50,13 +50,16 @@ int omap4430_phy_init(struct device *dev)
 {
        ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K);
        if (!ctrl_base) {
-               dev_err(dev, "control module ioremap failed\n");
+               pr_err("control module ioremap failed\n");
                return -ENOMEM;
        }
        /* Power down the phy */
        __raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
-       phyclk = clk_get(dev, "ocp2scp_usb_phy_ick");
 
+       if (!dev)
+               return 0;
+
+       phyclk = clk_get(dev, "ocp2scp_usb_phy_ick");
        if (IS_ERR(phyclk)) {
                dev_err(dev, "cannot clk_get ocp2scp_usb_phy_ick\n");
                iounmap(ctrl_base);