Received: by 10.223.185.116 with SMTP id b49csp2393374wrg; Mon, 5 Mar 2018 02:00:12 -0800 (PST) X-Google-Smtp-Source: AG47ELtOPApCR5vhCADr76Jy702DEO/5lhIQEujWhWJK/qNQJTPyG79dZsQda2+1Ig7zJlObfGwO X-Received: by 2002:a17:902:2ec1:: with SMTP id r59-v6mr12262527plb.416.1520244012540; Mon, 05 Mar 2018 02:00:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520244012; cv=none; d=google.com; s=arc-20160816; b=KLVelM+rhoDFE/eqghZmuVFZ7brEGXn8NRiW5jM3oA901C5rDNNkIZXbHERpIM4h/D XsNqAS0sJmYIv5K0uI5OtHq3q1c7dxp6YzDb3u8p8y655OqMs1rsd1NMUi0MVt0O/yqO q4ZeH50IzwAIeEhl5r4ouIgRukR3BhMbJz2pHi8lvJtCK5NerJV9AZ4eF4AWF9yLw8F4 lT6Gn4X3RwSn/rUQOIhGjov4R3oazbdX5X6g2214XtuuXOz/A4rcWLoneQGr0UKKEijl 1iFlGz84ai+l5Cdhz9G7pN4UwKXfAuZ4panNmmFb9uTeormrtb1F91lHLQxPgQjfjNvU 7YCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=2wwzp/SdfjjDLXODo6keSCBbm8N7OLFkMtoVNkvGcts=; b=s8d5IhpBLzybU9yt6zacK7G3jiCrh6acNbsY9jyaBA+HEa1HPnQTSnESTB3EQe6UkJ dFUSSnLII3GYbhjiHtgwomNyWbGPxdIrcbNyHAon3vLZwF5TBn6LjCz6RNd9W1Gd+9VC yRCn+xBlbAMnXzkGSjw9v5/f22V2kG8hSgWIJ4LMPlGxka8k0l7k3DcXt2erJtZgzk1/ /bUHmpdHK0hlaohPa5/DjXxPHs9JnLpwzctPDN/ZUJOxGafVoMwxWBMXWq+bbn4pUoFG cXgM1p04WlVNvFfR/rId8QErFoJUDJICAOaojOnIYBuXwS69KhLs7zyepF45lGd28x0I rBzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=arsupsHc; dkim=pass header.i=@codeaurora.org header.s=default header.b=j4mC24yP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u66si8135052pgc.651.2018.03.05.01.59.57; Mon, 05 Mar 2018 02:00:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=arsupsHc; dkim=pass header.i=@codeaurora.org header.s=default header.b=j4mC24yP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933958AbeCEJy7 (ORCPT + 99 others); Mon, 5 Mar 2018 04:54:59 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:48086 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933361AbeCEJyY (ORCPT ); Mon, 5 Mar 2018 04:54:24 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0A575607EF; Mon, 5 Mar 2018 09:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520243664; bh=UaOwzq3tLqtIZ+5t1ZXQ1SLLHgsc/GJuYPdAHHNP6Q4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=arsupsHcPJHOYaUssPPz09nr3LeuEPfd2BvCEwPQGUSnLUBIdDOq1yJub9Hnv3EV/ YZwmQbpCnA2YN8tzGsdHH71tcnyRszvDqv/uZ7xieXzkD5cGSUzAnwofax3dMvdz8k mJnSe9ISGRdS31sRqUcjiWS51Y3JNJXj+EC8tGU0= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from blr-ubuntu-87.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: sibis@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 07BFA6081C; Mon, 5 Mar 2018 09:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520243662; bh=UaOwzq3tLqtIZ+5t1ZXQ1SLLHgsc/GJuYPdAHHNP6Q4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j4mC24yP62ZBw6if0j2895HrG5RRrqQ9Bub7i4GcjDuYf40OdQL2cNiQcSExHQPEE IzRLyaisScbQ0fkqSy/YzMxts6MjMgmgAECi6wM+KWXOM5TmHe1k9gUDwUgR2nxLLb Y/gZfWWKO3DKNhubTcSOWKuPP+j7kB0G25ZiGWlE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 07BFA6081C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=sibis@codeaurora.org From: sibis To: bjorn.andersson@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, sibis@codeaurora.org, georgi.djakov@linaro.org, jassisinghbrar@gmail.com, p.zabel@pengutronix.de, ohad@wizery.com, mark.rutland@arm.com, robh+dt@kernel.org, kyan@codeaurora.org, sricharan@codeaurora.org, akdwived@codeaurora.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 5/6] remoteproc: qcom: Add support for mss remoteproc on SDM845 Date: Mon, 5 Mar 2018 15:23:32 +0530 Message-Id: <1520243613-30393-6-git-send-email-sibis@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520243613-30393-1-git-send-email-sibis@codeaurora.org> References: <1520243613-30393-1-git-send-email-sibis@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From SDM845, the Q6SS reset sequence on software side has been simplified with the introduction of boot FSM which assists in bringing the Q6 out of reset Add GLINK subdevice to allow definition of GLINK edge as a child of modem-pil Signed-off-by: sibis --- drivers/remoteproc/qcom_q6v5_pil.c | 65 +++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c index b4e5e72..92bf125 100644 --- a/drivers/remoteproc/qcom_q6v5_pil.c +++ b/drivers/remoteproc/qcom_q6v5_pil.c @@ -57,6 +57,8 @@ #define RMB_PMI_META_DATA_REG 0x10 #define RMB_PMI_CODE_START_REG 0x14 #define RMB_PMI_CODE_LENGTH_REG 0x18 +#define RMB_MBA_MSS_STATUS 0x40 +#define RMB_MBA_ALT_RESET 0x44 #define RMB_CMD_META_DATA_READY 0x1 #define RMB_CMD_LOAD_READY 0x2 @@ -104,6 +106,13 @@ #define QDSP6SS_XO_CBCR 0x0038 #define QDSP6SS_ACC_OVERRIDE_VAL 0x20 +/* QDSP6v65 parameters */ +#define QDSP6SS_SLEEP 0x3C +#define QDSP6SS_BOOT_CORE_START 0x400 +#define QDSP6SS_BOOT_CMD 0x404 +#define SLEEP_CHECK_MAX_LOOPS 200 +#define BOOT_FSM_TIMEOUT 10000 + struct reg_info { struct regulator *reg; int uV; @@ -166,6 +175,7 @@ struct q6v5 { void *mpss_region; size_t mpss_size; + struct qcom_rproc_glink glink_subdev; struct qcom_rproc_subdev smd_subdev; struct qcom_rproc_ssr ssr_subdev; bool need_mem_protection; @@ -178,6 +188,7 @@ enum { MSS_MSM8916, MSS_MSM8974, MSS_MSM8996, + MSS_SDM845, }; static int q6v5_regulator_init(struct device *dev, struct reg_info *regs, @@ -384,8 +395,35 @@ static int q6v5proc_reset(struct q6v5 *qproc) int ret; int i; + if (qproc->version == MSS_SDM845) { - if (qproc->version == MSS_MSM8996) { + val = readl(qproc->reg_base + QDSP6SS_SLEEP); + val |= 0x1; + writel(val, qproc->reg_base + QDSP6SS_SLEEP); + + ret = readl_poll_timeout(qproc->reg_base + QDSP6SS_SLEEP, + val, !(val & BIT(31)), 1, + SLEEP_CHECK_MAX_LOOPS); + if (ret) { + dev_err(qproc->dev, "QDSP6SS Sleep clock timed out\n"); + return -ETIMEDOUT; + } + + /* De-assert QDSP6 stop core */ + writel(1, qproc->reg_base + QDSP6SS_BOOT_CORE_START); + /* Trigger boot FSM */ + writel(1, qproc->reg_base + QDSP6SS_BOOT_CMD); + + ret = readl_poll_timeout(qproc->rmb_base + RMB_MBA_MSS_STATUS, + val, (val & BIT(0)) != 0, 10, BOOT_FSM_TIMEOUT); + if (ret) { + dev_err(qproc->dev, "Boot FSM failed to complete.\n"); + return ret; + } + + goto pbl_wait; + + } else if (qproc->version == MSS_MSM8996) { /* Override the ACC value if required */ writel(QDSP6SS_ACC_OVERRIDE_VAL, qproc->reg_base + QDSP6SS_STRAP_ACC); @@ -493,6 +531,7 @@ static int q6v5proc_reset(struct q6v5 *qproc) val &= ~Q6SS_STOP_CORE; writel(val, qproc->reg_base + QDSP6SS_RESET_REG); +pbl_wait: /* Wait for PBL status */ ret = q6v5_rmb_pbl_wait(qproc, 1000); if (ret == -ETIMEDOUT) { @@ -1213,6 +1252,7 @@ static int q6v5_probe(struct platform_device *pdev) } qproc->mpss_perm = BIT(QCOM_SCM_VMID_HLOS); qproc->mba_perm = BIT(QCOM_SCM_VMID_HLOS); + qcom_add_glink_subdev(rproc, &qproc->glink_subdev); qcom_add_smd_subdev(rproc, &qproc->smd_subdev); qcom_add_ssr_subdev(rproc, &qproc->ssr_subdev, "mpss"); @@ -1234,6 +1274,7 @@ static int q6v5_remove(struct platform_device *pdev) rproc_del(qproc->rproc); + qcom_remove_glink_subdev(qproc->rproc, &qproc->glink_subdev); qcom_remove_smd_subdev(qproc->rproc, &qproc->smd_subdev); qcom_remove_ssr_subdev(qproc->rproc, &qproc->ssr_subdev); rproc_free(qproc->rproc); @@ -1241,6 +1282,27 @@ static int q6v5_remove(struct platform_device *pdev) return 0; } +static const struct rproc_hexagon_res sdm845_mss = { + .hexagon_mba_image = "mba.mbn", + .proxy_clk_names = (char*[]){ + "xo", + "axis2", + "prng", + NULL + }, + .active_clk_names = (char*[]){ + "iface", + "bus", + "mem", + "gpll0_mss", + "snoc_axi", + "mnoc_axi", + NULL + }, + .need_mem_protection = true, + .version = MSS_SDM845, +}; + static const struct rproc_hexagon_res msm8996_mss = { .hexagon_mba_image = "mba.mbn", .proxy_clk_names = (char*[]){ @@ -1334,6 +1396,7 @@ static int q6v5_remove(struct platform_device *pdev) { .compatible = "qcom,msm8916-mss-pil", .data = &msm8916_mss}, { .compatible = "qcom,msm8974-mss-pil", .data = &msm8974_mss}, { .compatible = "qcom,msm8996-mss-pil", .data = &msm8996_mss}, + { .compatible = "qcom,sdm845-mss-pil", .data = &sdm845_mss}, { }, }; MODULE_DEVICE_TABLE(of, q6v5_of_match); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project