Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1096088pxb; Thu, 4 Mar 2021 03:13:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHSHrSH7QdbSQvVEaa/yvT7AK/65RuvqoaeVVE8sqZVdwNFozreNIAHNCqunH6K5otA6zD X-Received: by 2002:a17:906:a3d1:: with SMTP id ca17mr3687632ejb.92.1614856383197; Thu, 04 Mar 2021 03:13:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614856383; cv=none; d=google.com; s=arc-20160816; b=Zadj3aTZeZr2gJcIspJktUFXer/gSN9BJBm9z4deRJjP8wpwXQx1QRDVTEdZiJXDxF uwds3vaK229/4ls5DeRNCGCA8HvfJzwEFj5TRjZSekgG/qusryCclTO9e9tSsaF5xZlZ BtrF7To3S/mVN7rheqQ7/ImfShQmZarGy7flT9itl5wzzjT5Z55+sjdumSmScWn4KJmY /dD/2iXZ9eHIczRAwZeGVh1p0xi1p0poUuG7vl3TbAKpp9/e06zDRuTR4n0zDMRNfZVC KQWLssU1uNASwBGKnfpdXeZ8UpCsjOzNTb3SMhFIGh+9GqJAIgeO34agexb5zRjmvjb0 mPJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=GlfzaZuWsVuycDiyTZSUermkf3Sq3e5G4bMzkcCzrF8=; b=j5xlwoh+8o7/gzr9a1n+c/kc0ex42wAVri/zftII9YROwALdVll3n0P9GkMosAxSZA gJlXz12TCJIVyrobzBUMr+Z+T8ewJc4uCrY2XQWBhR2rIpNdGglw6FaifIJLL7dPsIhK OurL4kq/DRqtmUrtSCLOj/uhjeZNsW5h7UAghkLr1c2WAz8UPefC5R93RKKcL8DiMAS3 o4sBEyaxY+9QZTrypA0TVAYj1Upqtj557XtxY44qdQFHQCGb6leEaQeuOaEIFP1Tku9M Eov2HKq6XOzSfW6TpJOOfqPZ5dGXdkK0AK00dOFllpYlB73utxGueNxtHQoxDczV+Y0d Nmog== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m26si7522748edr.603.2021.03.04.03.12.39; Thu, 04 Mar 2021 03:13:03 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1577118AbhCCRsJ (ORCPT + 99 others); Wed, 3 Mar 2021 12:48:09 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:35762 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359556AbhCCOta (ORCPT ); Wed, 3 Mar 2021 09:49:30 -0500 Received: from [IPv6:2a01:e0a:4cb:a870:30e8:5098:73c5:2bfe] (unknown [IPv6:2a01:e0a:4cb:a870:30e8:5098:73c5:2bfe]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 5F13F1F459FA; Wed, 3 Mar 2021 14:48:46 +0000 (GMT) Subject: Re: [PATCH v3 4/5] media: hantro: Use reset driver To: Philipp Zabel , robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, ezequiel@collabora.com, mchehab@kernel.org, gregkh@linuxfoundation.org Cc: kernel@pengutronix.de, linux-imx@nxp.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, devel@driverdev.osuosl.org, kernel@collabora.com References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> <20210301151754.104749-5-benjamin.gaignard@collabora.com> <29bf66f4b531ec701e85c23a411e40e3621b0ff8.camel@pengutronix.de> From: Benjamin Gaignard Message-ID: Date: Wed, 3 Mar 2021 15:48:43 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <29bf66f4b531ec701e85c23a411e40e3621b0ff8.camel@pengutronix.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 03/03/2021 à 15:39, Philipp Zabel a écrit : > On Mon, 2021-03-01 at 16:17 +0100, Benjamin Gaignard wrote: >> Rather use a reset like feature inside the driver use the reset >> controller API to get the same result. >> >> Signed-off-by: Benjamin Gaignard >> --- >> drivers/staging/media/hantro/Kconfig | 1 + >> drivers/staging/media/hantro/imx8m_vpu_hw.c | 61 ++++----------------- >> 2 files changed, 12 insertions(+), 50 deletions(-) >> >> diff --git a/drivers/staging/media/hantro/Kconfig b/drivers/staging/media/hantro/Kconfig >> index 5b6cf9f62b1a..dd1d4dde2658 100644 >> --- a/drivers/staging/media/hantro/Kconfig >> +++ b/drivers/staging/media/hantro/Kconfig >> @@ -20,6 +20,7 @@ config VIDEO_HANTRO_IMX8M >> bool "Hantro VPU i.MX8M support" >> depends on VIDEO_HANTRO >> depends on ARCH_MXC || COMPILE_TEST >> + select RESET_VPU_IMX8MQ >> default y >> help >> Enable support for i.MX8M SoCs. >> diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c >> index c222de075ef4..d5b4312b9391 100644 >> --- a/drivers/staging/media/hantro/imx8m_vpu_hw.c >> +++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c >> @@ -7,49 +7,12 @@ >> >> #include >> #include >> +#include >> >> #include "hantro.h" >> #include "hantro_jpeg.h" >> #include "hantro_g1_regs.h" >> >> -#define CTRL_SOFT_RESET 0x00 >> -#define RESET_G1 BIT(1) >> -#define RESET_G2 BIT(0) >> - >> -#define CTRL_CLOCK_ENABLE 0x04 >> -#define CLOCK_G1 BIT(1) >> -#define CLOCK_G2 BIT(0) >> - >> -#define CTRL_G1_DEC_FUSE 0x08 >> -#define CTRL_G1_PP_FUSE 0x0c >> -#define CTRL_G2_DEC_FUSE 0x10 >> - >> -static void imx8m_soft_reset(struct hantro_dev *vpu, u32 reset_bits) >> -{ >> - u32 val; >> - >> - /* Assert */ >> - val = readl(vpu->ctrl_base + CTRL_SOFT_RESET); >> - val &= ~reset_bits; >> - writel(val, vpu->ctrl_base + CTRL_SOFT_RESET); >> - >> - udelay(2); >> - >> - /* Release */ >> - val = readl(vpu->ctrl_base + CTRL_SOFT_RESET); >> - val |= reset_bits; >> - writel(val, vpu->ctrl_base + CTRL_SOFT_RESET); >> -} >> - >> -static void imx8m_clk_enable(struct hantro_dev *vpu, u32 clock_bits) >> -{ >> - u32 val; >> - >> - val = readl(vpu->ctrl_base + CTRL_CLOCK_ENABLE); >> - val |= clock_bits; >> - writel(val, vpu->ctrl_base + CTRL_CLOCK_ENABLE); > The way it is implemented in the reset driver, the clocks are now > ungated between assert and deassert instead of afterwards. Is this on > purpose? No and that could be changed on next version. Benjamin > > regards > Philipp >