Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1579642pxb; Thu, 4 Mar 2021 15:22:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJw57CalGrgvxNLAWHymWUagxrpQi3tbQwx5V3K01qWcrVjp7jkwz+HjenDrbijPoE6OjkK5 X-Received: by 2002:a05:6402:32a:: with SMTP id q10mr6691239edw.15.1614900135607; Thu, 04 Mar 2021 15:22:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614900135; cv=none; d=google.com; s=arc-20160816; b=H+wujguRscbF709cxbli3efX7K8dnw934Hn+yi8TFw45Auy9zS7xZpkfJ533XIYRnZ WEqa7p6Xx2rTxhI8F3Qw+X9VtxlGm7uJAeU7XQQp1VqI1fk3jtdOYm+87M/a6Tt6MZpR J2ztSzheoL/ElOiIaRqKKp5TwyFPxt8OskeEUEqPiZngv4/2fea4CMK50fwWNYeZ3DG9 DJmvIwCSHcZpNjR1O8PPB7E9Qi46Y8Zrj0UbGDYGYkb+8ooH1UqLp1wWPinDAjznIKko KXHOVTqoyECTFT1CLWHULdQkngw8jq44acKalNW6d6D9zxAGGUzTqaZLrSs5sdQFmJ2U wqNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=OY31/Rb2aV2tcViGOMDV7/W3X5AT81wAgsIsI/R/fv4=; b=honDDfPkqjPmj+0kegFieqnoYMLfsUVb8aUAYxXTpMM/GvA4gCJv3T6HuHCWM2zSu7 mxMqZCQWQw1TPR6q599JLbth8qsxvgfKitJCNEI4ey60uibbpCxTaaAdu+B/MGJbS2QP GP87WgbKKJp0FWMxx4l7+AQawbfTEfd3gfubQaCCagB4O40zTViQCJgUrC7HXHx4yl9P ok0jYEM8StUAJMljWXAQf7Fopn0NP4nvpiu8tbXRbk8MdgA6Zx7V+zoIlDxqxpoHnYZ8 yPWZm/nFM1LElBZADynef4D6ZdroKWMh1Z7xEYGFkDIf7J22FOn0TD01vZA+VudNiIEH ElTQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p32si649469edd.89.2021.03.04.15.21.53; Thu, 04 Mar 2021 15:22:15 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575978AbhCCRrR convert rfc822-to-8bit (ORCPT + 99 others); Wed, 3 Mar 2021 12:47:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234148AbhCCOkf (ORCPT ); Wed, 3 Mar 2021 09:40:35 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4178C0611C2 for ; Wed, 3 Mar 2021 06:39:39 -0800 (PST) Received: from lupine.hi.pengutronix.de ([2001:67c:670:100:3ad5:47ff:feaf:1a17] helo=lupine) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lHSez-0003rD-RS; Wed, 03 Mar 2021 15:39:33 +0100 Received: from pza by lupine with local (Exim 4.92) (envelope-from ) id 1lHSey-0000i4-TA; Wed, 03 Mar 2021 15:39:32 +0100 Message-ID: <29bf66f4b531ec701e85c23a411e40e3621b0ff8.camel@pengutronix.de> Subject: Re: [PATCH v3 4/5] media: hantro: Use reset driver From: Philipp Zabel To: Benjamin Gaignard , 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 Date: Wed, 03 Mar 2021 15:39:32 +0100 In-Reply-To: <20210301151754.104749-5-benjamin.gaignard@collabora.com> References: <20210301151754.104749-1-benjamin.gaignard@collabora.com> <20210301151754.104749-5-benjamin.gaignard@collabora.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? regards Philipp