Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp7003325ybf; Fri, 6 Mar 2020 08:30:55 -0800 (PST) X-Google-Smtp-Source: ADFU+vu3EVh18l1g6fqABakrIwHMLGaqseHt1+IlefccAPb6AfTQm1Okc0qwHHpxlmX6AmGKRt9B X-Received: by 2002:a05:6830:103:: with SMTP id i3mr3147878otp.270.1583512254927; Fri, 06 Mar 2020 08:30:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583512254; cv=none; d=google.com; s=arc-20160816; b=BR8mJXgPBzFoDYiE4IfCyZIi23M9DU/ac1dmYKWfLLyEClhGBrC6NTQdRTSDJguWfh 3/hhMHuXLQt9Bq4875bq1ho1b9CKo0JZj1LrC2Do1NMyZfQ5kc1bhFxJe7vpFZQy6cI6 zt42IhFp1YXpKXoP0SL2tdRrigp8yQ6e9auOZcp1Rdfivf0U214QXIV82PK3nCQBVVkB NoMegkLd83g0WWcTTEaEzmdvQoknWnMfPcNESeqOueXtaqHphYfFl7WICWKBeNTqSBIa EWprNdF+RKCSTZe3JkZjeUZ7dSkQCEUiAOAOsUbg1TaGOxeBoGUpXMX6vK+jsqkrHaLE FAIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=XySMeGLS3ciGA4Tpuu0W6ay6NEAe5sOfA0+8JJ1Bw74=; b=rwtDCHH+aHTvNFNHDaH1D27veMnvuNU9jUuQsie70clPc83Rg7X6Z+uh2BblBc7akl 5FV462tQDUxwPMOmRR19394q+KcULq1dB0g72cCiScO0FIYOXbCRS/DqheOTPwTrQajO sIpKI/RaO+frwjiA9FsonXCGmykS9bGxaFV1KVc+dpXYPUKDiByljdGfvBRvdoxBLFKP PB7UgrjZg3RUG2/jN/LCGcPjoKCV15NpDgGqJhfRJ+Dixs47hujQsWz3gFKCHn2FR4eZ J7r96HsBwPvg20phZL1x1AEp45gpV1nEn2y066MdDFFXr3DnF1nbUWAMtafBajovIhWU Gs1g== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1si1658041oti.277.2020.03.06.08.30.42; Fri, 06 Mar 2020 08:30:54 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726892AbgCFQaY (ORCPT + 99 others); Fri, 6 Mar 2020 11:30:24 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:40092 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726314AbgCFQaX (ORCPT ); Fri, 6 Mar 2020 11:30:23 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 098DD29681D Subject: Re: [PATCH v11 3/5] soc: mediatek: Move mt8173 MMSYS to platform driver To: Stephen Boyd , airlied@linux.ie, ck.hu@mediatek.com, laurent.pinchart@ideasonboard.com, mark.rutland@arm.com, mturquette@baylibre.com, p.zabel@pengutronix.de, robh+dt@kernel.org, ulrich.hecht+renesas@gmail.com Cc: Mauro Carvalho Chehab , rdunlap@infradead.org, dri-devel@lists.freedesktop.org, Weiyi Lu , Seiya Wang , linux-clk@vger.kernel.org, Collabora Kernel ML , mtk01761 , Allison Randal , Thomas Gleixner , wens@csie.org, Kate Stewart , Greg Kroah-Hartman , Houlong Wei , Matthias Brugger , linux-media@vger.kernel.org, devicetree@vger.kernel.org, sean.wang@mediatek.com, frank-w@public-files.de, Minghsiu Tsai , Andrew-CT Chen , linux-mediatek@lists.infradead.org, hsinyi@chromium.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org, Richard Fontana , linux-kernel@vger.kernel.org, matthias.bgg@kernel.org, Daniel Vetter References: <20200302110128.2664251-1-enric.balletbo@collabora.com> <20200302110128.2664251-4-enric.balletbo@collabora.com> <158344207340.7173.8369925839829696256@swboyd.mtv.corp.google.com> From: Enric Balletbo i Serra Message-ID: <8bfc4350-6e92-e657-18f2-3624a2558521@collabora.com> Date: Fri, 6 Mar 2020 17:30:16 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <158344207340.7173.8369925839829696256@swboyd.mtv.corp.google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stephen, On 5/3/20 22:01, Stephen Boyd wrote: > Quoting Enric Balletbo i Serra (2020-03-02 03:01:26) >> From: Matthias Brugger >> >> There is no strong reason for this to use CLK_OF_DECLARE instead of >> being a platform driver. > > Cool. > >> Plus, this driver provides clocks but also >> a shared register space for the mediatek-drm and the mediatek-mdp >> driver. So move to drivers/soc/mediatek as a platform driver. >> >> Signed-off-by: Matthias Brugger >> Signed-off-by: Enric Balletbo i Serra >> Reviewed-by: CK Hu >> --- >> >> Changes in v11: None >> Changes in v10: >> - Renamed to be generic mtk-mmsys >> - Add driver data support to be able to support diferent SoCs >> >> Changes in v9: >> - Move mmsys to drivers/soc/mediatek (CK) >> >> Changes in v8: >> - Be a builtin_platform_driver like other mediatek mmsys drivers. >> >> Changes in v7: >> - Free clk_data->clks as well >> - Get rid of private data structure >> >> drivers/clk/mediatek/clk-mt8173.c | 104 -------------------- >> drivers/soc/mediatek/Kconfig | 7 ++ >> drivers/soc/mediatek/Makefile | 1 + >> drivers/soc/mediatek/mtk-mmsys.c | 154 ++++++++++++++++++++++++++++++ > > Can you generate with -M so that we can see what has actually changed? > Sure, sorry about that. >> 4 files changed, 162 insertions(+), 104 deletions(-) >> create mode 100644 drivers/soc/mediatek/mtk-mmsys.c >> >> diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig >> index 2114b563478c..7a156944d50e 100644 >> --- a/drivers/soc/mediatek/Kconfig >> +++ b/drivers/soc/mediatek/Kconfig >> @@ -44,4 +44,11 @@ config MTK_SCPSYS >> Say yes here to add support for the MediaTek SCPSYS power domain >> driver. >> >> +config MTK_MMSYS >> + bool "MediaTek MMSYS Support" >> + depends on COMMON_CLK_MT8173 > > Does it need some default so that defconfig updates don't break things? > Right. >> + help >> + Say yes here to add support for the MediaTek Multimedia >> + Subsystem (MMSYS). >> + >> endmenu >> diff --git a/drivers/soc/mediatek/Makefile b/drivers/soc/mediatek/Makefile >> index b01733074ad6..01f9f873634a 100644 >> --- a/drivers/soc/mediatek/Makefile >> +++ b/drivers/soc/mediatek/Makefile >> @@ -3,3 +3,4 @@ obj-$(CONFIG_MTK_CMDQ) += mtk-cmdq-helper.o >> obj-$(CONFIG_MTK_INFRACFG) += mtk-infracfg.o >> obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o >> obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o >> +obj-$(CONFIG_MTK_MMSYS) += mtk-mmsys.o >> diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c >> new file mode 100644 >> index 000000000000..473cdf732fb5 >> --- /dev/null >> +++ b/drivers/soc/mediatek/mtk-mmsys.c >> @@ -0,0 +1,154 @@ >> +// SPDX-License-Identifier: GPL-2.0-only >> +/* >> + * Copyright (c) 2014 MediaTek Inc. >> + * Author: James Liao >> + */ >> + >> +#include >> +#include >> +#include >> + >> +#include "../../clk/mediatek/clk-gate.h" >> +#include "../../clk/mediatek/clk-mtk.h" > > Why not use include/linux/clk/? > I can move these files to include, this will impact a lot more of drivers but, yes, I think is the right way. > But I also don't understand why the clk driver is moved outside of > drivers/clk/ into drivers/soc/. Commit text saying that it has shared > registers doesn't mean it can't still keep the clk driver part in the > drivers/clk/ area. > Actually moving this to the soc directory has been requested by CK (mediatek) as a change in v8. You can see the discussion in [1] Thanks, Enric [1] https://patchwork.kernel.org/cover/11394709/ >> + >> +#include >> + >> +static const struct mtk_gate_regs mm0_cg_regs = { >> + .set_ofs = 0x0104, >> + .clr_ofs = 0x0108, >> + .sta_ofs = 0x0100, >> +}; >> + >> +static const struct mtk_gate_regs mm1_cg_regs = { >> + .set_ofs = 0x0114, >> + .clr_ofs = 0x0118, >> + .sta_ofs = 0x0110, >> +};