Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp548465imm; Wed, 4 Jul 2018 01:36:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfTwUBFrzskQdV/t46nxA4AMxBJZ6+wN/UUBOwgXAJdSyLtr2DxXofGcm3F2yJLv18ijAM0 X-Received: by 2002:a62:5d18:: with SMTP id r24-v6mr1212969pfb.87.1530693395759; Wed, 04 Jul 2018 01:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530693395; cv=none; d=google.com; s=arc-20160816; b=JSpN/c/Sg57uR4UfB9WIhGnCmblpCRK8Ps5lOcvT3UlwT0vdZYtoRRbvGlhvrbVPKq UF0VcAKdX1vEF+ZBXe4gkInVjr3mLgYJZxlU7I8OtlOnDjZH4BHqmoEFlpUREu3UGea6 TDEqKwoR+aYq91HsbNRSQObfP/ORQSdPWGqYZxhLqwt2U8GakcHbTkB+e+1ScZbsPC2u G2/PPtelYlotIkhJ8wQH1HP2sBzLaSreBjpU4k8TgU8yLHpaoa68xZVZq74aOfvgRFyV LqKHj+Rdi96MwyEueT2zgSfNdlp0FM28yKFjgkuS9j3l3f6xrzQ4IdkZFscJVLtJOXZb UNQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=PtQoWJN6UAlJVV1HK+CzGEgQyLYT5urGC97J6tUMMVs=; b=e7tx3+UVJ7Hz6wtC1zh7pmiQHsmsokQB1dsLDS0VnRDsvb1YGrAg0r7OCO/gyIM8Lr HopHoXzjN9zD7FIvgW5LAgjvl6Gf8QvnPVri0iKUkIM/JBAz53NX2EsWMipjSVwbN/IF NRsIXxN22y3nFH1V3FkRhOB1VzAPIon92bBOL3AIWliEBisspeg+EWS4pZExcY3zZn0g FR50vVJzUTQHP4P0Vg3VX8ERhF2N1jXMzpKnTy3zLapbfKJg9BegklSAIRvPnjZvfmzO 8ytVqzkBCFt74sL7q0zu1S4CFPj702qSuRSoYGvLp1w8E1kMCYVvtdG0rNI9jsHuo2rg 5/xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=kpSN1f5u; dkim=pass header.i=@codeaurora.org header.s=default header.b=hzC57Qqv; 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 b18-v6si2923770pls.292.2018.07.04.01.36.21; Wed, 04 Jul 2018 01:36:35 -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=kpSN1f5u; dkim=pass header.i=@codeaurora.org header.s=default header.b=hzC57Qqv; 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 S933844AbeGDIff (ORCPT + 99 others); Wed, 4 Jul 2018 04:35:35 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:36732 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932479AbeGDIfc (ORCPT ); Wed, 4 Jul 2018 04:35:32 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 682F360B23; Wed, 4 Jul 2018 08:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1530693331; bh=03MxvPnnhxLTEG3tamWL8QA0TGUcYc72rQKPYFRhY4o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kpSN1f5urL9KzSG0k9OlBFvoZGP7g4x75vvWA+4rHFpyXNE2HmAdA/St3svbybOc1 S3fDN6VrzuYbqmSKXlvBu4oJiqWDf3srRlxsEWwIA52o17drO/uJTKDxZwv3GyVzZw N+FDJI5M6cNw1kYK2iEk2DoobbT6VfuWoX2Q4yH8= 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 mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 42E1A60251; Wed, 4 Jul 2018 08:35:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1530693330; bh=03MxvPnnhxLTEG3tamWL8QA0TGUcYc72rQKPYFRhY4o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hzC57QqvpCV1u19lW52Uw/p8WXYBOQxFIPZmq9xw9kmfz436RXLRx/VNvPpF9iAcp 9HMf+WNAMZmg5XNRoDvGd9SJHO/CmEcaHhmdUOyMz15bln8ZqBh/rAd0LfF1UZUXzJ sT58PbgPdYuNRgbpdEdzJtGM6e6EmNv8BShuFRnU= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 04 Jul 2018 14:05:30 +0530 From: Vikash Garodia To: Stanimir Varbanov Cc: hverkuil@xs4all.nl, mchehab@kernel.org, robh@kernel.org, mark.rutland@arm.com, andy.gross@linaro.org, bjorn.andersson@linaro.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, devicetree@vger.kernel.org, acourbot@chromium.org, linux-media-owner@vger.kernel.org Subject: Re: [PATCH v2 1/5] media: venus: add a routine to reset ARM9 In-Reply-To: <894ab678-bc1d-da04-b552-d53301bd3980@linaro.org> References: <1527884768-22392-1-git-send-email-vgarodia@codeaurora.org> <1527884768-22392-2-git-send-email-vgarodia@codeaurora.org> <894ab678-bc1d-da04-b552-d53301bd3980@linaro.org> Message-ID: X-Sender: vgarodia@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stanimir, Thanks for the review. On 2018-06-02 03:45, Stanimir Varbanov wrote: > Hi Vikash, > > On 1.06.2018 23:26, 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. > > please squash this patch with 4/5. I don't see a reason to add a > function which is not used. Shouldn't this produce gcc warnings? Will squash the api definition with the patch using it. >> >> Signed-off-by: Vikash Garodia >> --- >> drivers/media/platform/qcom/venus/firmware.c | 26 >> ++++++++++++++++++++++++ >> drivers/media/platform/qcom/venus/hfi_venus_io.h | 5 +++++ >> 2 files changed, 31 insertions(+) >> >> diff --git a/drivers/media/platform/qcom/venus/firmware.c >> b/drivers/media/platform/qcom/venus/firmware.c >> index 521d4b3..7d89b5a 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) >> +static void venus_reset_hw(struct venus_core *core) > > can we rename this to venus_reset_cpu? reset_hw sounds like we reset > vcodec IPs, so I think we can be more exact here. > >> +{ >> + void __iomem *reg_base = core->base; > > just 'base', please. Ok. >> + >> + 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(); > > the comment says "register writes" hence shouldn't this be wmb? Also > if we are going to have explicit memory barrier why not use > writel_relaxed? >> + >> + /* >> + * Need to wait 10 cycles of internal clocks before bringing ARM9 > > Do we know what is the minimum frequency of the internal ARM9 clocks? > I.e does 1us is enough for all venus versions. ARM9 is yet not brought out of reset at this point. Sleep might be added to ensure that the register writes are completed. But as Bjorn commented, only way to ensure registers are written is to read them back. I do not have proper justification of sleep as this code was used for many chipset bringup. I can try by removing the sleep and if goes well, we can live without it. >> + * out of reset. >> + */ >> + udelay(1); >> + >> + /* Bring Arm9 out of reset */ > > ARM9 > >> + writel_relaxed(0, reg_base + WRAPPER_A9SS_SW_RESET); > > in my opinion we should have a wmb here too I guess if sleep is removed, we will be left with only the above instruction. so no need to ensure the access order. > regards, > Stan