From patchwork Wed May 15 12:03:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Baltieri X-Patchwork-Id: 16959 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F16422396C for ; Wed, 15 May 2013 12:05:00 +0000 (UTC) Received: by mail-we0-f200.google.com with SMTP id u55sf1476099wes.11 for ; Wed, 15 May 2013 05:04:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=nL/pDZmbr9xoIbKODq4Ug2Pc3SN+se5RvsgWEejUIKY=; b=gIyoIcqFYdglT9mHDaW+dLO0kdWPPtMKwwZWUFHJQC3gdv0lo37usZiFJUAvDLUrXi f3LAgNvBe1iZmULmchaGTKVnOHRyYstkMNThh8Om0vJj5C0DpCLMQVMtCPO+h6qC9BdC MZqqDDvAd+eBXE1Mo5Y0NQHnMTw3DjvYL+oCZrRjZZ9ALu2PyWsOOoVdjssx0nKfqri1 a3CkxQsgMCV7yKdGdoTO+LP+T2Dx6MGxdKHMKatcrKsogwovWQjlTTEEdiYHBdLo1QY4 Anflu1QcN4HBz2uzhbfBnL1V0LuiSSkuUN1gXUHqpuu045QkCkdgOs/jA2zBCuRi+dlc 2nEw== X-Received: by 10.180.206.107 with SMTP id ln11mr2326785wic.7.1368619463543; Wed, 15 May 2013 05:04:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.97.167 with SMTP id eb7ls536997wib.7.gmail; Wed, 15 May 2013 05:04:23 -0700 (PDT) X-Received: by 10.194.60.212 with SMTP id j20mr3673229wjr.56.1368619463480; Wed, 15 May 2013 05:04:23 -0700 (PDT) Received: from mail-ve0-x22f.google.com (mail-ve0-x22f.google.com [2607:f8b0:400c:c01::22f]) by mx.google.com with ESMTPS id hr11si687279wib.123.2013.05.15.05.04.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 May 2013 05:04:23 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22f is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22f; Received: by mail-ve0-f175.google.com with SMTP id cz11so1855830veb.20 for ; Wed, 15 May 2013 05:04:22 -0700 (PDT) X-Received: by 10.221.2.130 with SMTP id nu2mr5319473vcb.41.1368619462368; Wed, 15 May 2013 05:04:22 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.217.15 with SMTP id hk15csp16067vcb; Wed, 15 May 2013 05:04:21 -0700 (PDT) X-Received: by 10.180.185.179 with SMTP id fd19mr14091339wic.1.1368619461329; Wed, 15 May 2013 05:04:21 -0700 (PDT) Received: from mail-wg0-x234.google.com (mail-wg0-x234.google.com [2a00:1450:400c:c00::234]) by mx.google.com with ESMTPS id fv3si7002559wic.76.2013.05.15.05.04.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 May 2013 05:04:21 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c00::234 is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) client-ip=2a00:1450:400c:c00::234; Received: by mail-wg0-f52.google.com with SMTP id k13so1452877wgh.31 for ; Wed, 15 May 2013 05:04:20 -0700 (PDT) X-Received: by 10.194.241.234 with SMTP id wl10mr3668750wjc.13.1368619460883; Wed, 15 May 2013 05:04:20 -0700 (PDT) Received: from localhost ([2a01:2003:1:1025:8e70:5aff:feac:ad8]) by mx.google.com with ESMTPSA id f2sm27663497wiv.11.2013.05.15.05.04.14 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 15 May 2013 05:04:20 -0700 (PDT) From: Fabio Baltieri To: Felipe Balbi Cc: Linus Walleij , Lee Jones , Praveena Nadahally , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Mian Yousaf Kaukab , Fabio Baltieri Subject: [PATCH 03/10] usb: phy: ab8500-usb: add transceiver clock control Date: Wed, 15 May 2013 14:03:26 +0200 Message-Id: <1368619413-24647-4-git-send-email-fabio.baltieri@linaro.org> X-Mailer: git-send-email 1.8.2 In-Reply-To: <1368619413-24647-1-git-send-email-fabio.baltieri@linaro.org> References: <1368619413-24647-1-git-send-email-fabio.baltieri@linaro.org> X-Gm-Message-State: ALoCoQnb0jJ7KieJcheZTYdPQ64L7HjEHz3o/xReWyAIsPnlPEKQYIgzNbk4yDwjuarMy7SAtId6 X-Original-Sender: fabio.baltieri@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22f is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Mian Yousaf Kaukab Add common clock support code for the ab8500-usb phy driver. Acked-by: Linus Walleij Acked-by: Maxime Coquelin Signed-off-by: Mian Yousaf Kaukab Signed-off-by: Fabio Baltieri --- drivers/usb/phy/phy-ab8500-usb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index b043faa..cc0d7e5 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #include #include @@ -126,6 +128,7 @@ struct ab8500_usb { unsigned vbus_draw; struct work_struct phy_dis_work; enum ab8500_usb_mode mode; + struct clk *sysclk; struct regulator *v_ape; struct regulator *v_musb; struct regulator *v_ulpi; @@ -252,6 +255,9 @@ static void ab8500_usb_phy_enable(struct ab8500_usb *ab, bool sel_host) if (IS_ERR(ab->pinctrl)) dev_err(ab->dev, "could not get/set default pinstate\n"); + if (clk_prepare_enable(ab->sysclk)) + dev_err(ab->dev, "can't prepare/enable clock\n"); + ab8500_usb_regulator_enable(ab); abx500_mask_and_set_register_interruptible(ab->dev, @@ -274,6 +280,8 @@ static void ab8500_usb_phy_disable(struct ab8500_usb *ab, bool sel_host) /* Needed to disable the phy.*/ ab8500_usb_wd_workaround(ab); + clk_disable_unprepare(ab->sysclk); + ab8500_usb_regulator_disable(ab); if (!IS_ERR(ab->pinctrl)) { @@ -784,6 +792,12 @@ static int ab8500_usb_probe(struct platform_device *pdev) if (err) return err; + ab->sysclk = devm_clk_get(ab->dev, "sysclk"); + if (IS_ERR(ab->sysclk)) { + dev_err(ab->dev, "Could not get sysclk.\n"); + return PTR_ERR(ab->sysclk); + } + err = ab8500_usb_irq_setup(pdev, ab); if (err < 0) return err;