From patchwork Thu Jul 17 20:16:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 4578731 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 56676C0514 for ; Thu, 17 Jul 2014 20:17:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 80A7520160 for ; Thu, 17 Jul 2014 20:17:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A406B200E7 for ; Thu, 17 Jul 2014 20:17:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754637AbaGQURB (ORCPT ); Thu, 17 Jul 2014 16:17:01 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:40264 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754362AbaGQURA (ORCPT ); Thu, 17 Jul 2014 16:17:00 -0400 Received: by mail-wi0-f179.google.com with SMTP id f8so3425960wiw.6 for ; Thu, 17 Jul 2014 13:16:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=EsajPy0H5qPsGa6Wm11qST1ikBIxiDfx4CAh0wq2x0I=; b=VW+oNgshWp3kr1G8HuSf3w6VMZpQVNj0q/6XyZGC2in8I82OWBMHVg3kSS4v286TWN Ql2bEnk1rsXYxvuyk3ZS3HywjhS/GH2IRD7vYwH42uevylFe77jIeHisHYh5gjyU0ghM I1VyO6vTqZ3PXQOcuJUnv1+r5IXXxRCl7PZO225MLWk1L0vXTIhaxtsece74Bhq+7u9d LukzLWMOvSunyOzXaGdiuCOUTstWrnB4yXu4fdP11LmE9tJvi0e2wk6E0oZf3fkH5Ans kPOG7LnJr6D7JnxckLudvlX4Z3/97uQWZUxHdDt7t1mOqYkla3pdgEPosp4yB9k5bvGC BqNw== X-Gm-Message-State: ALoCoQlo1jjGMrA1OaRoJW8Kxo2ik+tfzhl2RDy2BqykbVaisXTgVjHg9uRChOFAKwN0dbGI40EK X-Received: by 10.194.63.196 with SMTP id i4mr49456780wjs.50.1405628218593; Thu, 17 Jul 2014 13:16:58 -0700 (PDT) Received: from srini-ThinkPad-X1-Carbon-2nd.dlink.com (host-2-99-226-247.as13285.net. [2.99.226.247]) by mx.google.com with ESMTPSA id fc7sm8535178wjc.37.2014.07.17.13.16.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Jul 2014 13:16:57 -0700 (PDT) From: Srinivas Kandagatla To: Felipe Balbi Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v2] usb: phy: msm: Make phy_reset clk and reset line optional. Date: Thu, 17 Jul 2014 21:16:40 +0100 Message-Id: <1405628200-21776-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch makes the phy reset clk and reset line optional as this clk is not available on boards like IFC6410 with APQ8064. phy-reset clk is only used as argument to the mach level callbacks, so this patch adds condition before clk_get calls so that the driver wouldn't fail on SOCs which do not have this support. Signed-off-by: Srinivas Kandagatla tested-by: Prakash Burla --- Hi Felipe, With this new patch now the error message is only printed if the SOC actually supports the phy reset clk, for SOCs like APQ8064 where there is no phy reset clock or the callback which takes it there is no point in doing a clk_get call in the first place. Thanks, srini drivers/usb/phy/phy-msm-usb.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index c929370..aa8e2b9 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -279,11 +279,11 @@ static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert) static int msm_otg_phy_clk_reset(struct msm_otg *motg) { - int ret; + int ret = 0; if (motg->pdata->phy_clk_reset) ret = motg->pdata->phy_clk_reset(motg->phy_reset_clk); - else + else if (motg->phy_rst) ret = reset_control_reset(motg->phy_rst); if (ret) @@ -1466,7 +1466,7 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg) motg->phy_rst = devm_reset_control_get(&pdev->dev, "phy"); if (IS_ERR(motg->phy_rst)) - return PTR_ERR(motg->phy_rst); + motg->phy_rst = NULL; pdata->mode = of_usb_get_dr_mode(node); if (pdata->mode == USB_DR_MODE_UNKNOWN) @@ -1554,11 +1554,14 @@ static int msm_otg_probe(struct platform_device *pdev) phy = &motg->phy; phy->dev = &pdev->dev; - motg->phy_reset_clk = devm_clk_get(&pdev->dev, + if (motg->pdata->phy_clk_reset) { + motg->phy_reset_clk = devm_clk_get(&pdev->dev, np ? "phy" : "usb_phy_clk"); - if (IS_ERR(motg->phy_reset_clk)) { - dev_err(&pdev->dev, "failed to get usb_phy_clk\n"); - return PTR_ERR(motg->phy_reset_clk); + + if (IS_ERR(motg->phy_reset_clk)) { + dev_err(&pdev->dev, "failed to get usb_phy_clk\n"); + return PTR_ERR(motg->phy_reset_clk); + } } motg->clk = devm_clk_get(&pdev->dev, np ? "core" : "usb_hs_clk");