From patchwork Thu Oct 20 18:55:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarangdhar Joshi X-Patchwork-Id: 9387439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 399FE60762 for ; Thu, 20 Oct 2016 18:56:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D4C829C32 for ; Thu, 20 Oct 2016 18:56:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2103929C3C; Thu, 20 Oct 2016 18:56:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B66529C32 for ; Thu, 20 Oct 2016 18:56:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935281AbcJTSzq (ORCPT ); Thu, 20 Oct 2016 14:55:46 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:34281 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934197AbcJTSzo (ORCPT ); Thu, 20 Oct 2016 14:55:44 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 20D1161ACE; Thu, 20 Oct 2016 18:55:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1476989744; bh=mgyM2Nju1kKa7f6ZdadFsaSYSs4pGgLIUUBQxjznTIU=; h=From:To:Cc:Subject:Date:From; b=n2fx3cr2UyQidqYX8HU6T8SVjm3JBHpUbTRwXMN+GYCl4GcYQz37oMdYd1zLsjGnV 80s7w9DrzNY3IyNqGNlPznId76abkZde7O9QB68HS/G3t1WktF70Vka5a4bHm82kvk N382UdPxjPIkgPjzL4vKjLvPEJhSWoqk1GuCacj8= Received: from spjoshi-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: spjoshi@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5C7F06168F; Thu, 20 Oct 2016 18:55:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1476989743; bh=mgyM2Nju1kKa7f6ZdadFsaSYSs4pGgLIUUBQxjznTIU=; h=From:To:Cc:Subject:Date:From; b=Tgq11kFd2CHM3t8kHh9ieVktnuyduaZQax1SfA0m67PJbHZwvxDbXPXZ3ZuqU6spG WjcSGbDtlkw/igK0wp19bHdwAvp4FxYdxTBMwqnYQhauUPT0K70zP3DNkLlUt5YNpw ddWLu1f1FxHa4dhDakzeDs9x+EFYEsC73N1E6Nwg= DMARC-Filter: OpenDMARC Filter v1.3.1 smtp.codeaurora.org 5C7F06168F Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=pass smtp.mailfrom=spjoshi@codeaurora.org From: Sarangdhar Joshi To: Ohad Ben-Cohen , Bjorn Andersson Cc: Sarangdhar Joshi , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stephen Boyd , Trilok Soni Subject: [PATCH] remoteproc: Add support for xo clock Date: Thu, 20 Oct 2016 11:55:24 -0700 Message-Id: <1476989724-7464-1-git-send-email-spjoshi@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add xo clock support required for Qualcomm ADSP Peripheral Image Loader. Signed-off-by: Sarangdhar Joshi --- This patch depends on https://lkml.org/lkml/2016/8/23/50 drivers/remoteproc/qcom_adsp_pil.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/qcom_adsp_pil.c b/drivers/remoteproc/qcom_adsp_pil.c index 9141633..a1f2f32 100644 --- a/drivers/remoteproc/qcom_adsp_pil.c +++ b/drivers/remoteproc/qcom_adsp_pil.c @@ -15,6 +15,7 @@ * GNU General Public License for more details. */ +#include #include #include #include @@ -48,6 +49,8 @@ struct qcom_adsp { struct qcom_smem_state *state; unsigned stop_bit; + struct clk *xo; + struct regulator *cx_supply; struct completion start_done; @@ -102,10 +105,14 @@ static int adsp_start(struct rproc *rproc) struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv; int ret; - ret = regulator_enable(adsp->cx_supply); + ret = clk_prepare_enable(adsp->xo); if (ret) return ret; + ret = regulator_enable(adsp->cx_supply); + if (ret) + goto disable_clocks; + ret = qcom_scm_pas_auth_and_reset(ADSP_PAS_ID); if (ret) { dev_err(adsp->dev, @@ -126,6 +133,8 @@ static int adsp_start(struct rproc *rproc) disable_regulators: regulator_disable(adsp->cx_supply); +disable_clocks: + clk_disable_unprepare(adsp->xo); return ret; } @@ -223,6 +232,17 @@ static irqreturn_t adsp_stop_ack_interrupt(int irq, void *dev) return IRQ_HANDLED; } +static int adsp_init_clock(struct qcom_adsp *adsp) +{ + adsp->xo = devm_clk_get(adsp->dev, "xo"); + if (IS_ERR(adsp->xo)) { + dev_err(adsp->dev, "failed to get xo clock"); + return PTR_ERR(adsp->xo); + } + + return 0; +} + static int adsp_init_regulator(struct qcom_adsp *adsp) { adsp->cx_supply = devm_regulator_get(adsp->dev, "cx"); @@ -320,6 +340,10 @@ static int adsp_probe(struct platform_device *pdev) if (ret) goto free_rproc; + ret = adsp_init_clock(adsp); + if (ret) + goto free_rproc; + ret = adsp_init_regulator(adsp); if (ret) goto free_rproc;