Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3163780imm; Thu, 17 May 2018 04:34:04 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrx9P8LVovxF33SjCI6WtDd8ghZby8Z923/QdM4r22bkdxBuL9ZpCiXlvJRJWfjXgyltxXJ X-Received: by 2002:a62:8605:: with SMTP id x5-v6mr4832270pfd.103.1526556844295; Thu, 17 May 2018 04:34:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526556844; cv=none; d=google.com; s=arc-20160816; b=0mnjpBnmb72NHrUpOig0hWI1WsAG/A8wTSbBymcduRvgM3BdhfhWsfYiM2Wf85W1UZ wUxVb37COodXf+iPuoIQjtanMkVCW1VE3Lei//XyO0c940mybdiiFxHGgGIA1zMyWw/R k8O4C1karEvDfQdnsF7akp/MsF+dSLn/zmPm/qkb2xQVy90WcGNAjsv+55lRXOe4IuRv xx4auPy6OzW3MJFaVjSL201oQaE5jUksJ1h7fBrt0pKOs00t8B1mkP3KXJ0d0ABtkvxU U6MlqWRCnlhF0k48MHjX00KAVDalglG0snuQ3RxR9MDuZNB3kQ7tZHr219JbJx9GLUus cRwg== 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=vXBu1gEhxDu2ATCkl6EZV16PT3Y3euitengGHmwFPD4=; b=I1mXNV1xFf2sdT3xdSbqQVcX+jullXdS/oSGB/pw78370NGF/KGK4YMJPjmEVcrlZ5 Rr61uuB6OJRWTHfeqxl4nwoU2lNnS2obPcQuZxpxdntYRuPLgN6T7BKPwLGRnNub4kg7 pWcKVpx0KY5tdehZH5f4eWTFAcJhufbW5SZ5t0lk+LiJ+x0ZD1zBOwPmFvhDtQbcKZOL OEpvp8r1mL/SHcbTYrGl82q0jTs8gM9WTLlyVOga6j19nX+0E1ysQvb55GIMFJ8FtvH1 8mkr1oFCdC4EkFrKr3fxaArNuW9nHC/nzhChM4SeBse7cfFwI7owf+RXGryLl33OotPb LXyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Rsfh02+4; dkim=pass header.i=@codeaurora.org header.s=default header.b=bW4F+5eB; 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 l187-v6si3607836pgl.485.2018.05.17.04.33.50; Thu, 17 May 2018 04:34:04 -0700 (PDT) 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=Rsfh02+4; dkim=pass header.i=@codeaurora.org header.s=default header.b=bW4F+5eB; 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 S1752081AbeEQLdK (ORCPT + 99 others); Thu, 17 May 2018 07:33:10 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:60494 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751097AbeEQLdI (ORCPT ); Thu, 17 May 2018 07:33:08 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7E6E260AF9; Thu, 17 May 2018 11:33:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526556787; bh=9ZrkgSROv1ZKhqgiqXmqE5ZQNEeN+UgqMUH3kBZB22E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rsfh02+4RVPfb8mtAS1GdfGW+hMSNHooB6KX/tl4IPjeLjWCg8XBxNTJmq57jltZ8 EC8Zwu+xDMa2dm8HUQWP3xAAaI/GQkL7ZFnzmGdqC67FEq/i3AXkwSnKtjghFrDwuX 14IbX53sb3LKVmz78l37JKJt7HIa2SbpfHzpR8Ac= 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 vgarodia-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vgarodia@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id E61486055C; Thu, 17 May 2018 11:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526556786; bh=9ZrkgSROv1ZKhqgiqXmqE5ZQNEeN+UgqMUH3kBZB22E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bW4F+5eBVf7Bgr8CUV8VV4HxIugkQ6ZZ8mUTeUEnVUSWccpNKX+lQrR2BdX3TGNmn eQdMxni8nVpV65zrp/hQ8YSXXadLLMAM+B2dHcl0GPKrLYUJ5pFYTG0a/kvA9F6uyU Wbm0KyOvyyn/dK3u91dEphmPY+WfevUmMnds4SFg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E61486055C 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=vgarodia@codeaurora.org From: Vikash Garodia To: hverkuil@xs4all.nl, mchehab@kernel.org, andy.gross@linaro.org, bjorn.andersson@linaro.org, stanimir.varbanov@linaro.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, acourbot@google.com, Vikash Garodia Subject: [PATCH 2/4] media: venus: add a routine to reset ARM9 Date: Thu, 17 May 2018 17:02:18 +0530 Message-Id: <1526556740-25494-3-git-send-email-vgarodia@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1526556740-25494-1-git-send-email-vgarodia@codeaurora.org> References: <1526556740-25494-1-git-send-email-vgarodia@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new routine to reset the ARM9 and brings it out of reset. This is in preparation to add PIL functionality in venus driver. Signed-off-by: Vikash Garodia --- drivers/media/platform/qcom/venus/firmware.c | 26 ++++++++++++++++++++++++ drivers/media/platform/qcom/venus/firmware.h | 1 + drivers/media/platform/qcom/venus/hfi_venus_io.h | 5 +++++ 3 files changed, 32 insertions(+) diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c index c4a5778..8f25375 100644 --- a/drivers/media/platform/qcom/venus/firmware.c +++ b/drivers/media/platform/qcom/venus/firmware.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -22,11 +23,36 @@ #include #include +#include "core.h" #include "firmware.h" +#include "hfi_venus_io.h" #define VENUS_PAS_ID 9 #define VENUS_FW_MEM_SIZE (6 * SZ_1M) +void venus_reset_hw(struct venus_core *core) +{ + void __iomem *reg_base = core->base; + + writel(0, reg_base + WRAPPER_FW_START_ADDR); + writel(VENUS_FW_MEM_SIZE, reg_base + WRAPPER_FW_END_ADDR); + writel(0, reg_base + WRAPPER_CPA_START_ADDR); + writel(VENUS_FW_MEM_SIZE, reg_base + WRAPPER_CPA_END_ADDR); + writel(0x0, reg_base + WRAPPER_CPU_CGC_DIS); + writel(0x0, reg_base + WRAPPER_CPU_CLOCK_CONFIG); + + /* Make sure all register writes are committed. */ + mb(); + + /* + * Need to wait 10 cycles of internal clocks before bringing ARM9 + * out of reset. + */ + udelay(1); + + /* Bring Arm9 out of reset */ + writel_relaxed(0, reg_base + WRAPPER_A9SS_SW_RESET); +} int venus_boot(struct device *dev, const char *fwname) { const struct firmware *mdt; diff --git a/drivers/media/platform/qcom/venus/firmware.h b/drivers/media/platform/qcom/venus/firmware.h index 428efb5..d56f5b2 100644 --- a/drivers/media/platform/qcom/venus/firmware.h +++ b/drivers/media/platform/qcom/venus/firmware.h @@ -18,5 +18,6 @@ int venus_boot(struct device *dev, const char *fwname); int venus_shutdown(struct device *dev); +void venus_reset_hw(struct venus_core *core); #endif diff --git a/drivers/media/platform/qcom/venus/hfi_venus_io.h b/drivers/media/platform/qcom/venus/hfi_venus_io.h index 76f4793..39afa5d 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus_io.h +++ b/drivers/media/platform/qcom/venus/hfi_venus_io.h @@ -109,6 +109,11 @@ #define WRAPPER_CPU_CGC_DIS (WRAPPER_BASE + 0x2010) #define WRAPPER_CPU_STATUS (WRAPPER_BASE + 0x2014) #define WRAPPER_SW_RESET (WRAPPER_BASE + 0x3000) +#define WRAPPER_CPA_START_ADDR (WRAPPER_BASE + 0x1020) +#define WRAPPER_CPA_END_ADDR (WRAPPER_BASE + 0x1024) +#define WRAPPER_FW_START_ADDR (WRAPPER_BASE + 0x1028) +#define WRAPPER_FW_END_ADDR (WRAPPER_BASE + 0x102C) +#define WRAPPER_A9SS_SW_RESET (WRAPPER_BASE + 0x3000) /* Venus 4xx */ #define WRAPPER_VCODEC0_MMCC_POWER_STATUS (WRAPPER_BASE + 0x90) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project