Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4443339pxv; Tue, 20 Jul 2021 04:02:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLEzd1+3uLhWbXys5qJrR5Ro135CFV8gdfSnr+1ZhTMsuWYHX/pJ0FCezo8u0WLJ+lUu7r X-Received: by 2002:aa7:d857:: with SMTP id f23mr26699358eds.249.1626778960367; Tue, 20 Jul 2021 04:02:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626778960; cv=none; d=google.com; s=arc-20160816; b=dEY4Yrjusce013WzOvmBE331q0GzBzT7fvXvRwZXsFtTAIhLljukwogot8t7oeykaM Pz89Hzw2q59iO1EFPsEJGp5gzznstTtBiUgntvc9G7k/qttFJJZnLES8hd9+ZH8/wXVW 1ce+5XkqY1WhW+vmcra/lVxgTp/NIOU3yyZdcNglYFCRlTDfh0gLXCVL6Vefa+1fy2kQ u3HEmlBYEWOhPr1FqnTISK81jrQjTjHry0FeubOAj7lDG7vD67bE1IT8xpzMDqw2dumk o+L4KmfuSXFo2LKiq4lmAwsnz4Nh1/e0WxIDb8TEx9FZZHz3rn4gbHlfwl42/BnL5xOb j8fg== 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=X9DgfmwG5zYwkF7sOR7g/TQrAhvAzuEX0G6tyMyTNnk=; b=vuBnGLDzXyjMXa0J6dCo7bVe/Qpe9SeFkmDka0h3OKtnBuwqrs+8kAFKVKSoiXBn0H 8v8quLbcQxuTy5gJ7pTKneY8rY0JL/6dgko4V2S0r+L1L93WakmxVGYn9T8k5TXAbgce rOmkG7WI2jkdgQs4OrMXJY0fP0uIL3vKGBL5lXSRQVRZxzsqQTCHAo9Kf6EsGMWoMCWq FpNDsK//G/0eA53FRilpbR6z6f6nrjxlj4t9QzOduQJjianB+1CfphT49hfiaDsTPkgf T0OGByPiaAWwgk7jSfEvqvLbHR6WqtuicSmfsu1+9hJhAp1W1ahuy5D3AKvGNJa63Rl8 CN4g== 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 r6si23631331edo.365.2021.07.20.04.02.17; Tue, 20 Jul 2021 04:02:40 -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; 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 S237938AbhGTKTO convert rfc822-to-8bit (ORCPT + 99 others); Tue, 20 Jul 2021 06:19:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238267AbhGTKLu (ORCPT ); Tue, 20 Jul 2021 06:11:50 -0400 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 9CF5AC061574 for ; Tue, 20 Jul 2021 03:52:21 -0700 (PDT) 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 1m5nMK-0005E8-1J; Tue, 20 Jul 2021 12:52:20 +0200 Received: from pza by lupine with local (Exim 4.92) (envelope-from ) id 1m5nMH-0003Ys-FO; Tue, 20 Jul 2021 12:52:17 +0200 Message-ID: <039151e1f17676a101fb9c0682f5ee9fb8ad502d.camel@pengutronix.de> Subject: Re: [PATCH v2 6/7] soc: mediatek: mmsys: Add reset controller support From: Philipp Zabel To: Enric Balletbo i Serra , linux-kernel@vger.kernel.org Cc: chunkuang.hu@kernel.org, hsinyi@chromium.org, kernel@collabora.com, drinkcat@chromium.org, eizan@chromium.org, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, jitao.shi@mediatek.com, linux-arm-kernel@lists.infradead.org Date: Tue, 20 Jul 2021 12:52:17 +0200 In-Reply-To: <20210714121116.v2.6.I15e2419141a69b2e5c7e700c34d92a69df47e04d@changeid> References: <20210714101141.2089082-1-enric.balletbo@collabora.com> <20210714121116.v2.6.I15e2419141a69b2e5c7e700c34d92a69df47e04d@changeid> 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 Hi Enric, On Wed, 2021-07-14 at 12:11 +0200, Enric Balletbo i Serra wrote: > Among other features the mmsys driver should implement a reset > controller to be able to reset different bits from their space. > > Cc: Jitao Shi > Suggested-by: Chun-Kuang Hu > Signed-off-by: Enric Balletbo i Serra The reset controller driver looks fine, just two questions below. > --- > > (no changes since v1) > > drivers/soc/mediatek/mtk-mmsys.c | 69 ++++++++++++++++++++++++++++++++ > drivers/soc/mediatek/mtk-mmsys.h | 2 + > 2 files changed, 71 insertions(+) > > diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c > index e681029fe804..6ac4deff0164 100644 > --- a/drivers/soc/mediatek/mtk-mmsys.c > +++ b/drivers/soc/mediatek/mtk-mmsys.c [...] > @@ -91,6 +95,59 @@ void mtk_mmsys_ddp_disconnect(struct device *dev, [...] > +static int mtk_mmsys_reset(struct reset_controller_dev *rcdev, unsigned long id) > +{ > + int ret; > + > + ret = mtk_mmsys_reset_assert(rcdev, id); > + if (ret) > + return ret; > + > + usleep_range(1000, 1100); Is this known to be enough for all IP cores that can be reset by this controller? > + return mtk_mmsys_reset_deassert(rcdev, id); > +} > + > +static const struct reset_control_ops mtk_mmsys_reset_ops = { > + .assert = mtk_mmsys_reset_assert, > + .deassert = mtk_mmsys_reset_deassert, > + .reset = mtk_mmsys_reset, > +}; > + > static int mtk_mmsys_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > @@ -111,6 +168,18 @@ static int mtk_mmsys_probe(struct platform_device *pdev) > return ret; > } > > + spin_lock_init(&mmsys->lock); > + > + mmsys->rcdev.owner = THIS_MODULE; > + mmsys->rcdev.nr_resets = 32; Are all bits in the MMSYS_SW0_RST_B register individual reset controls? regards Philipp