Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4364095pxb; Tue, 5 Oct 2021 01:13:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrj1RbNjlusNHd6+9IqujlGZJttSRGYbTx07JouudF5VMMlGvCeWe80ZEbqUT0/SS4Ya+f X-Received: by 2002:aa7:d1c2:: with SMTP id g2mr23903661edp.248.1633421582842; Tue, 05 Oct 2021 01:13:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633421582; cv=none; d=google.com; s=arc-20160816; b=ZWx0eLRKNDS4b3DxfZ2gRWOHPCk94T2RYD3Z6OTrnMHIS8jxFT0hNbjGTsIXLeS4tT 98omu3DBH1IJa/mIVIh5JM6oRtp9D71HhGsvX2xOqdZAyaNb6l1hU55X8zox1PHBBbu9 FXX7/1TH+vhVfldbLKsF8p9XXOhcqOiJ1he0nM4IyDLnPmmi2cqdgXCbjEtpYzT8NUyi 9m+s1/2ZTdMSu2uHNE30FrBshmA4c2ZwwD6jwuWEpOcg7AqNzd3/Y9kDwzHJL8mfIJu5 tTi9eN//a5delh28g4kt3CLF9v9ppv7BISiq6TLCMi8CBp36poUdk09bxrrll9mp+WrD AqJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5aa4vZiuIFSCPHF4dxekm5eLMC5HcT+Pb9Hlo0UAubI=; b=tfozNGVYEvgfPyPu49d6fRiWewxqM2FF3pmI9VuJIES7pfRTcrSArsg+PYzh6EYrZ7 z73tC74NpRv1v/rQonnDyV7DEEAyUmf7W8SXTf8K/mwVMj4N5rxx4TUrRAXznxrzVgsP /ieENTiT/bs4moLvgijlTGDJATGGrAdOB5wbgbK4TLje3Ynak02rpW7ow0fbKTTWlh7s AxCJzRzPnp41ePWxypzJb9y40ToScCUV5XxLH11xISldAkDL1j0cgNZGNQZPpYTzk+sz J5UqHDpak3KFd1t4mkFEgdq3wwYekRmsUHfdUPpOVLJ8m9huUO5XUKGN9ZEh6gWaeTKY PjbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JYzfxac7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si7122608edk.276.2021.10.05.01.12.37; Tue, 05 Oct 2021 01:13:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JYzfxac7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232942AbhJEIM7 (ORCPT + 99 others); Tue, 5 Oct 2021 04:12:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232929AbhJEIM6 (ORCPT ); Tue, 5 Oct 2021 04:12:58 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00B18C061745 for ; Tue, 5 Oct 2021 01:11:08 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id v18so73970686edc.11 for ; Tue, 05 Oct 2021 01:11:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5aa4vZiuIFSCPHF4dxekm5eLMC5HcT+Pb9Hlo0UAubI=; b=JYzfxac7W+813vz3g6oISyCSz1sLUD4TZXUQfbe+Ap5PzbUCz8pDjLyYvazAS9erlY z3K037RE8QB+HZ06Sx1KP5VYA3uMLdY0lVEwCZ6ldhl56L4hZ83AuoJe1MF/JL6P0fWD Z0jgWVbjUB/K9WrR7rDiJ7+W+p12mI6/Z4WfeQLMeQUw7JoaR1C5WmOitJJLH39zviF4 rb6k5R+5hRqp7cDpsRqIgyRwmb1eSxOjrD1F2ofrkbv4IPj9lI90PPbTORFgOzRvZNeG ADejhdeUFvn6QQWdkOy52Yva9v9+FJgvUiXUmHRD9UCKGxJTlL2ClW4TWOar75Mia6Jj XHWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5aa4vZiuIFSCPHF4dxekm5eLMC5HcT+Pb9Hlo0UAubI=; b=HSVKrulpZ/E6rjFyyUdr7HisWcT24tUNNrxnAmqXch7R18gMLQfkKYESmajVqmwJFc 2sNqGD6710yn3obDemDj+UQLFsFCRT5vs0b/hjslsGjSv/+kxjohOODDk/4RhXX9qMqF foHfPN5RLg6QS0XTEeoieLCeAZxHNGQTi7SiLXid3UxKXlsGkG8zRdeNJgEwMCJYnNme jyocDV+NRNu7VbDfX1Cbyz8sO2DePHBrYZC+9wYejdDgAqGA+RPe8nBVj+I+kI7Hx5Fv 6p9U3ajb7r2DQCuQFQ4JONKLz2tA0PeAFQ8SRxt0uIWu4X6HRBaWH4HwpQGVjGQQVfiD T4rw== X-Gm-Message-State: AOAM530u11/m5GYYdHk7VaxCaIV0Fx2YFrMNamAHWOX4dPgVblHXNloE 0uaxoWWqUdhPaHUVCxKV2r+DtQ== X-Received: by 2002:a17:906:aed1:: with SMTP id me17mr23060476ejb.474.1633421466458; Tue, 05 Oct 2021 01:11:06 -0700 (PDT) Received: from localhost.localdomain ([84.238.208.199]) by smtp.gmail.com with ESMTPSA id f1sm3096258edz.47.2021.10.05.01.11.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 01:11:06 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org, Dikshita Agarwal , Stanimir Varbanov Subject: [PATCH v5 1/7] venus: firmware: enable no tz fw loading for sc7280 Date: Tue, 5 Oct 2021 11:10:42 +0300 Message-Id: <20211005081048.3095252-2-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211005081048.3095252-1-stanimir.varbanov@linaro.org> References: <20211005081048.3095252-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dikshita Agarwal Enable no tz FW loading and add routine to reset XTSS. Signed-off-by: Dikshita Agarwal Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/firmware.c | 42 ++++++++++++++----- .../media/platform/qcom/venus/hfi_venus_io.h | 2 + 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c index 227bd3b3f84c..14b6f1d05991 100644 --- a/drivers/media/platform/qcom/venus/firmware.c +++ b/drivers/media/platform/qcom/venus/firmware.c @@ -27,7 +27,12 @@ static void venus_reset_cpu(struct venus_core *core) { u32 fw_size = core->fw.mapped_mem_size; - void __iomem *wrapper_base = core->wrapper_base; + void __iomem *wrapper_base; + + if (IS_V6(core)) + wrapper_base = core->wrapper_tz_base; + else + wrapper_base = core->wrapper_base; writel(0, wrapper_base + WRAPPER_FW_START_ADDR); writel(fw_size, wrapper_base + WRAPPER_FW_END_ADDR); @@ -35,11 +40,17 @@ static void venus_reset_cpu(struct venus_core *core) writel(fw_size, wrapper_base + WRAPPER_CPA_END_ADDR); writel(fw_size, wrapper_base + WRAPPER_NONPIX_START_ADDR); writel(fw_size, wrapper_base + WRAPPER_NONPIX_END_ADDR); - writel(0x0, wrapper_base + WRAPPER_CPU_CGC_DIS); - writel(0x0, wrapper_base + WRAPPER_CPU_CLOCK_CONFIG); - /* Bring ARM9 out of reset */ - writel(0, wrapper_base + WRAPPER_A9SS_SW_RESET); + if (IS_V6(core)) { + /* Bring XTSS out of reset */ + writel(0, wrapper_base + WRAPPER_TZ_XTSS_SW_RESET); + } else { + writel(0x0, wrapper_base + WRAPPER_CPU_CGC_DIS); + writel(0x0, wrapper_base + WRAPPER_CPU_CLOCK_CONFIG); + + /* Bring ARM9 out of reset */ + writel(0, wrapper_base + WRAPPER_A9SS_SW_RESET); + } } int venus_set_hw_state(struct venus_core *core, bool resume) @@ -56,7 +67,9 @@ int venus_set_hw_state(struct venus_core *core, bool resume) if (resume) { venus_reset_cpu(core); } else { - if (!IS_V6(core)) + if (IS_V6(core)) + writel(1, core->wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET); + else writel(1, core->wrapper_base + WRAPPER_A9SS_SW_RESET); } @@ -162,12 +175,19 @@ static int venus_shutdown_no_tz(struct venus_core *core) u32 reg; struct device *dev = core->fw.dev; void __iomem *wrapper_base = core->wrapper_base; + void __iomem *wrapper_tz_base = core->wrapper_tz_base; - /* Assert the reset to ARM9 */ - reg = readl_relaxed(wrapper_base + WRAPPER_A9SS_SW_RESET); - reg |= WRAPPER_A9SS_SW_RESET_BIT; - writel_relaxed(reg, wrapper_base + WRAPPER_A9SS_SW_RESET); - + if (IS_V6(core)) { + /* Assert the reset to XTSS */ + reg = readl_relaxed(wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET); + reg |= WRAPPER_XTSS_SW_RESET_BIT; + writel_relaxed(reg, wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET); + } else { + /* Assert the reset to ARM9 */ + reg = readl_relaxed(wrapper_base + WRAPPER_A9SS_SW_RESET); + reg |= WRAPPER_A9SS_SW_RESET_BIT; + writel_relaxed(reg, wrapper_base + WRAPPER_A9SS_SW_RESET); + } /* Make sure reset is asserted before the mapping is removed */ mb(); diff --git a/drivers/media/platform/qcom/venus/hfi_venus_io.h b/drivers/media/platform/qcom/venus/hfi_venus_io.h index 300c6e47e72f..9735a246ce36 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus_io.h +++ b/drivers/media/platform/qcom/venus/hfi_venus_io.h @@ -149,6 +149,8 @@ /* Wrapper TZ 6xx */ #define WRAPPER_TZ_BASE_V6 0x000c0000 #define WRAPPER_TZ_CPU_STATUS_V6 0x10 +#define WRAPPER_TZ_XTSS_SW_RESET 0x1000 +#define WRAPPER_XTSS_SW_RESET_BIT BIT(0) /* Venus AON */ #define AON_BASE_V6 0x000e0000 -- 2.25.1