Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3450381imm; Thu, 17 May 2018 08:58:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZogpYdil4gfQ/m0WU7/0W06qw3kqpcTX4GBS3BtLVItzplNWXonKhTFRDlBwKjmn9RV3305 X-Received: by 2002:a62:b909:: with SMTP id z9-v6mr5710088pfe.254.1526572713606; Thu, 17 May 2018 08:58:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526572713; cv=none; d=google.com; s=arc-20160816; b=Qt6Kb+bNkfkhPhM6U+X21yzu80T7vFNjm3EzgaMYs3CX9zqX6BbJvFSMXZtS3xQObM WCz9vD7v7tuzRA99YbEc5Lr527lN7HROlzmLubEzjGgvYA8f+9/EM1y1low8UldABSTx xYKg+p7gMghLJd4hZBGcyVb4NBUzagJ7O4d+GgbUbcqcVq9zYZ1F0t3zFsbSNAWrxSW1 XMoliUGgFLscvLuJOIVLFahfL0MQ97WXq0sHjcIUlRFbBVn71mjVKBrXna+W1dCF9ymq 19b0eKGeeqpob5X/7mkSPx6bw5WjNgFCYNsZt2qlRcaBpKguJ+1f13jRxbxh6aMAELSr +KxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dmarc-filter:dkim-signature :dkim-signature:arc-authentication-results; bh=biKv66BnVRmuYEXlMRL62E4uXomM1nDap/tuojBFjSY=; b=InLgHVV9dGfGahFcwcldfefxYVCfDOHNgv69OdHmvlePcWeQmQ0AD8BuC27y0iQjKQ PmSC1119wy8fmuMJk9jIeWzHjbTnBDgxIdVqGBuaKGvVPDN1m8sDFbScCA1S/szuEd25 zq+78LVloTZaZ2ii1FZFMLClqHDRvVwand8ICeWQSHQ8mUeCh413RTIYWHzbOqhO3u7t bsHHV7YPXgNfB9g+8pq+jFofHjLmgtykdLYCLqo9tQG2l9pHoHLjxKlm3eg/LSBIRmRZ 88qzacL/MWjcptu5VgibLI8u3gjqTRC4SBS6vphcTB5mQEfFLAqfcqNUFkBnFNvQWHIp 9nlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=aPe5wvXU; dkim=pass header.i=@codeaurora.org header.s=default header.b=BLMgeEMT; 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 x133-v6si5436608pfd.124.2018.05.17.08.58.19; Thu, 17 May 2018 08:58:33 -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=aPe5wvXU; dkim=pass header.i=@codeaurora.org header.s=default header.b=BLMgeEMT; 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 S1752464AbeEQP5r (ORCPT + 99 others); Thu, 17 May 2018 11:57:47 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:52056 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752448AbeEQP5m (ORCPT ); Thu, 17 May 2018 11:57:42 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C692D60C65; Thu, 17 May 2018 15:57:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526572661; bh=G8J9+HKdJDVgSCuqGt1ZwpLW+9NhuF/IJ2rKeB6IaTo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aPe5wvXUQwubYcLV/KbME0qHwPWMLBHdbSycuP3DZvTS5+qWDBa0AI3sVVykRzcQT 3lkRGXULBY15wu6otP/kUhUOTOWa0+PSae6hF15rznkVCLKR3hTkRzSRS4IdurzbsU K8CvUC5FFhzYmuelmYbxSsH7RAcnmK5sskw6WlTI= 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 jcrouse-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jcrouse@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1207A601D7; Thu, 17 May 2018 15:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526572660; bh=G8J9+HKdJDVgSCuqGt1ZwpLW+9NhuF/IJ2rKeB6IaTo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BLMgeEMT+AUZSIT8y88PkeyKqIE14k/ZU84MLMkL/pk9rcsSTiBUBwobGIuO2WvE7 YyfespRCBuRYYqqoUr46UVzCecKJ7bpQ4raeNmwvXmbEwI1rFbaMrGy0cvsycuMzgl 2HDm9y6L6o3P9VP2KhkM8cDnkgzmr1U5ejkKGK1Y= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1207A601D7 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=jcrouse@codeaurora.org Date: Thu, 17 May 2018 09:57:38 -0600 From: Jordan Crouse To: Vikash Garodia Cc: hverkuil@xs4all.nl, mchehab@kernel.org, andy.gross@linaro.org, bjorn.andersson@linaro.org, stanimir.varbanov@linaro.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, acourbot@google.com Subject: Re: [PATCH 2/4] media: venus: add a routine to reset ARM9 Message-ID: <20180517155737.GI4995@jcrouse-lnx.qualcomm.com> Mail-Followup-To: Vikash Garodia , hverkuil@xs4all.nl, mchehab@kernel.org, andy.gross@linaro.org, bjorn.andersson@linaro.org, stanimir.varbanov@linaro.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, acourbot@google.com References: <1526556740-25494-1-git-send-email-vgarodia@codeaurora.org> <1526556740-25494-3-git-send-email-vgarodia@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1526556740-25494-3-git-send-email-vgarodia@codeaurora.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 17, 2018 at 05:02:18PM +0530, Vikash Garodia wrote: > 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); If you are going to have a bunch of writel() functions followed by a barrier it wouldn't hurt to use writel_relaxed() instead. Jordan > + /* 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 Code Aurora Forum, a Linux Foundation Collaborative Project