From patchwork Wed Nov 16 17:01:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dwivedi, Avaneesh Kumar (avani)" X-Patchwork-Id: 9432207 X-Patchwork-Delegate: agross@codeaurora.org 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 6450A60476 for ; Wed, 16 Nov 2016 17:02:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5151028F71 for ; Wed, 16 Nov 2016 17:02:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45D7728FB3; Wed, 16 Nov 2016 17:02:06 +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=ham 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 429B828FD0 for ; Wed, 16 Nov 2016 17:02:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932754AbcKPRCA (ORCPT ); Wed, 16 Nov 2016 12:02:00 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:57130 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932592AbcKPRBy (ORCPT ); Wed, 16 Nov 2016 12:01:54 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id CDD8D614DB; Wed, 16 Nov 2016 17:01:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1479315713; bh=sDC6NdamPdE3wLaJzqivmWhGcMdP+yWn0JvC0/p0vMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f1xHx30oFpTLyYeAJuDE1cw3lVnMy3lpniVBMNlB2bm5ipluz2nHdOBXKKUQikScF e0FG4T/iBgZ7ggXyJvIK2OA4NQBTTRtS9YgZH7+YSlHRT4HlL2ba/I3M1c9P13Y1P0 L+FqfeSSDLsEEkwFzjKJet6MZnYsr32i+OGsYckk= Received: from akdwived-linux.qualcomm.com (unknown [202.46.23.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: akdwived@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 8FF6D61503; Wed, 16 Nov 2016 17:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1479315713; bh=sDC6NdamPdE3wLaJzqivmWhGcMdP+yWn0JvC0/p0vMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f1xHx30oFpTLyYeAJuDE1cw3lVnMy3lpniVBMNlB2bm5ipluz2nHdOBXKKUQikScF e0FG4T/iBgZ7ggXyJvIK2OA4NQBTTRtS9YgZH7+YSlHRT4HlL2ba/I3M1c9P13Y1P0 L+FqfeSSDLsEEkwFzjKJet6MZnYsr32i+OGsYckk= DMARC-Filter: OpenDMARC Filter v1.3.1 smtp.codeaurora.org 8FF6D61503 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=akdwived@codeaurora.org From: Avaneesh Kumar Dwivedi To: bjorn.andersson@linaro.org Cc: sboyd@codeaurora.org, agross@codeaurora.org, linux-arm-msm@vger.kernel.org, Avaneesh Kumar Dwivedi Subject: [PATCH v4 02/10] remoteproc: qcom: Initialize MSS reset control handle Date: Wed, 16 Nov 2016 22:31:28 +0530 Message-Id: <1479315696-15490-3-git-send-email-akdwived@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1479315696-15490-1-git-send-email-akdwived@codeaurora.org> References: <1479315696-15490-1-git-send-email-akdwived@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reset assert of mss need to be done before mss clocks are enabled and hexagon starts ticking. On some platform handle to program restart register is via reset control framework while on some it is by direct ioremap. Signed-off-by: Avaneesh Kumar Dwivedi --- drivers/remoteproc/qcom_q6v5_pil.c | 40 ++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c index 7660012..f43c96b 100644 --- a/drivers/remoteproc/qcom_q6v5_pil.c +++ b/drivers/remoteproc/qcom_q6v5_pil.c @@ -37,7 +37,6 @@ #include -#define MBA_FIRMWARE_NAME "mba.b00" #define MPSS_FIRMWARE_NAME "modem.mdt" #define MPSS_CRASH_REASON_SMEM 421 @@ -117,7 +116,7 @@ struct q6v5 { void __iomem *reg_base; void __iomem *rmb_base; - + void __iomem *restart_reg; struct regmap *halt_map; u32 halt_q6; u32 halt_modem; @@ -743,9 +742,12 @@ static int q6v5_init_clocks(struct q6v5 *qproc) return 0; } -static int q6v5_init_reset(struct q6v5 *qproc) +static int q6v5_init_reset(void *q, void *p) { - qproc->mss_restart = devm_reset_control_get(qproc->dev, NULL); + struct q6v5 *qproc = q; + struct platform_device *pdev = p; + + qproc->mss_restart = devm_reset_control_get(&pdev->dev, NULL); if (IS_ERR(qproc->mss_restart)) { dev_err(qproc->dev, "failed to acquire mss restart\n"); return PTR_ERR(qproc->mss_restart); @@ -754,6 +756,23 @@ static int q6v5_init_reset(struct q6v5 *qproc) return 0; } +static int q6v56_init_reset(void *q, void *p) +{ + struct resource *res; + struct q6v5 *qproc = q; + struct platform_device *pdev = p; + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "restart_reg"); + qproc->restart_reg = devm_ioremap(qproc->dev, res->start, + resource_size(res)); + if (IS_ERR(qproc->restart_reg)) { + dev_err(qproc->dev, "failed to get restart_reg\n"); + return PTR_ERR(qproc->restart_reg); + } + + return 0; +} + static int q6v5_request_irq(struct q6v5 *qproc, struct platform_device *pdev, const char *name, @@ -825,10 +844,15 @@ static int q6v5_probe(struct platform_device *pdev) { struct q6v5 *qproc; struct rproc *rproc; + const struct q6_rproc_res *desc; int ret; + desc = of_device_get_match_data(&pdev->dev); + if (!desc) + return -EINVAL; + rproc = rproc_alloc(&pdev->dev, pdev->name, &q6v5_ops, - MBA_FIRMWARE_NAME, sizeof(*qproc)); + desc->q6_mba_image, sizeof(*qproc)); if (!rproc) { dev_err(&pdev->dev, "failed to allocate rproc\n"); return -ENOMEM; @@ -860,7 +884,7 @@ static int q6v5_probe(struct platform_device *pdev) if (ret) goto free_rproc; - ret = q6v5_init_reset(qproc); + ret = desc->q6_reset_init(qproc, pdev); if (ret) goto free_rproc; @@ -916,7 +940,7 @@ static int q6v5_remove(struct platform_device *pdev) "gpll0_mss_clk", "snoc_axi_clk", "mnoc_axi_clk", NULL}; static const struct q6_rproc_res q6v56_res = { - .q6_reset_init = NULL, + .q6_reset_init = q6v56_init_reset, .q6_mba_image = "mba.mbn", .proxy_reg_string = proxy_q6v56_regulator_namestr, .active_reg_string = NULL, @@ -927,7 +951,7 @@ static int q6v5_remove(struct platform_device *pdev) }; static const struct q6_rproc_res q6v5_res = { - .q6_reset_init = NULL, + .q6_reset_init = q6v5_init_reset, .q6_mba_image = "mba.mbn", .proxy_reg_string = proxy_q6v56_regulator_namestr, .proxy_voltage_load = (int **)proxy_q6v56_voltage_load,