Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp151229lqr; Wed, 5 Jun 2024 01:39:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV24GemqSJeknsETEclFh8WbIKybwB6kti4iwkEHgfazXbKcJWwi54gP989cUbeIfaSm+rXH1bI7jyIKLq3Ji4HkhQo+IrmXIqKMZ84rQ== X-Google-Smtp-Source: AGHT+IEteq6m47tzl20sB/YAOgQwwBRgTUYqkNsdjl7zu/KjHEY45Wgi48I4UQd8qJw0kZ2UnEee X-Received: by 2002:a17:906:3f8d:b0:a68:a498:2e9 with SMTP id a640c23a62f3a-a699f888675mr115519566b.40.1717576791382; Wed, 05 Jun 2024 01:39:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717576791; cv=pass; d=google.com; s=arc-20160816; b=XwU+/zo0j7kSmBETaQWPLIStxJSLVeg/9+wIC36d7kjdP6mHP8Weq0zh4UsTIr7h79 yHx2SdCSMFn8Ozy1SXyOZaHjQKDtCsV5aKVQUTmYEOr9oGP6qoRIh6Es20Xr/yt5XQKt Z/9wfXDFAQq7ZlIIRkKz5HTu9UQq9/GdzdVxfu4e1p6vECSld+dfXdSEyib6rkl0+p/F RVqzRMX0SSOk1P1hNer+WJXFl0BLX+AMXBAbzqqt8XXk0fl00A7gap13ghURQl9LXQ0a N7IwqMnvJ8jkG8oXIGFoobA8LSwrx6e0ce8A6Vh0cyNlGemCFLxQRRWbfrOXrahXoxoX icAg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=YTQe3wg02xrKHSMQnPEBjVMZ37QaY2jveS1Tz9H3zuE=; fh=tt2mH2deTuiCDEFkysbeNGk/vKkQKUc60pNLa5dN7w4=; b=p1/kM7j3EhJrYLCTrypfXSr9379iE4PTTgIBR9wrptYJeL4dlD1N8BPeqDfe8pyrFu YyNDmlT0NRmm8dKFqH1HEAVWN3N46M21oCboFg0WT2rlTzxnQBEsluHJ8xKEWu5PFU+2 jDuSRj2BNpaVKqPNTJ8Uw2Wz0mOHNjOhaqGqiHYYGKt/Z8AEsENntsWbSPEOkseth59b btBzkFg+STkBwAQO1vY6qfkPsxYrjAfyZMa8m90lmP1UHbxd+dka+siBtxM3EPlm/zsX jzQVuxarIxEvPJfZbqn6cEgYNsp3QB1k+cNRGt/+JNerYgYIV0zfAbCRjdVhCqX30frz dp6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Kq6u3j4g; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-202024-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202024-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6aa2efbbe3si36673666b.834.2024.06.05.01.39.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 01:39:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202024-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Kq6u3j4g; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-202024-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202024-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id EA3E11F213D8 for ; Wed, 5 Jun 2024 08:39:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C4CB846D; Wed, 5 Jun 2024 08:39:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Kq6u3j4g" Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3541849637 for ; Wed, 5 Jun 2024 08:39:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717576762; cv=none; b=dHVShRGUErDW78bIBVFv45g+5CRMWBDy/ZvnBEmssNDBd2/vaVK3n5NmvNwsAxdy61IkzDSbrfhehFsfI5XpehRDkSQd/Ew3OmLT5BEX28qbIOEIIBjrxlSSzxuT0vG+3PRNY44VAR5+bqtj8D/EpvmXFERj73IOudcl8ufyAqo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717576762; c=relaxed/simple; bh=Uyde1GwcRmYQzkcMME858pT8IXlt7YjOaqdfevgl2hw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=U0c/aOwmUUaR8q9AomV45EGuGggTeQOf7nORAFGBMAKNI3KDK6aj9Hx9gwOELEy7c/Hg+zND9U9Re18a2kWxz0HlSgaW5DIPxK+oLwoPejCGZfGaDdnSifMplAxcwpBAmc3/TB2oetNTFw9Eg6dvxcY1/KarN4/6Yhf65aVmF8Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Kq6u3j4g; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-52b992fd796so2326794e87.0 for ; Wed, 05 Jun 2024 01:39:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1717576758; x=1718181558; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=YTQe3wg02xrKHSMQnPEBjVMZ37QaY2jveS1Tz9H3zuE=; b=Kq6u3j4gG7hkWexFavJgfz64yhv41MZdEsyYMHYCcUJRFQPHBBCJLyrTbVCkHFhG4+ rjqHsLg0/MIG48/WmHZ0STSHwJ2EIrfMh0EGpIKaLo0E9KHJP6x9WGR/fTnA9FN7CA9j pMxazRLab4JplePA0SUDqCaXvePQgjyz3WiaY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717576758; x=1718181558; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YTQe3wg02xrKHSMQnPEBjVMZ37QaY2jveS1Tz9H3zuE=; b=L7WTizB+6HNqznJ91LK7ZC5FP/SjuRfdXqN7r0YbvYuWAkxDnDrDugP8J7K4AvOBsA PuMatgK4/PYvDVpAhnjKOVFr0XJffCahZhs6xIVU0W4z8vTDyDQkxbS9H48dikyV0MBR EmGgidPAtknha+DyEqFB+Tfntmg4NbTQ0iql0RMSAZzK9z+A0NRcdp8bKI3ihP4gSeDx XaAJsZMvzGE9KkbnQ/FjGH02GZ6fXQ6ZmEJp6X4U8195bYSwwDKSOvtp/8H7XFNHkjGW 7ZDunsVJqx0CpCrj+TRDGq1gp0VPQGJeGUPpfEktcyOfRcH0ukS1g8pmx9xGSLKgIzzy he1w== X-Forwarded-Encrypted: i=1; AJvYcCVj9KFbqCQhCV6ecb7lxtQ/N7TjWCaUgLr6Ch7yGkuBSikwZXBwwz/H4yUqI/hr9xBk0i0QaGpcWcIYhLIstk/meWq+2FH1R0qUSuuP X-Gm-Message-State: AOJu0Yz+0/8RvQ4r8t94HgBbtc4jp/uKRyjSI03F0fNQ/p/krcmsGnit FCqJgEFbPHElAaH5FfkGfhpIZ4HGA+AIjnkLQ+EyWRhbNu2CCyZDmVx6IkDSz+18G0CNOLBG9WZ +4XgktSw1XRRaVaZhIYz7WQ7Anq5n9oL0mYaS X-Received: by 2002:ac2:4c1a:0:b0:52b:88ec:b425 with SMTP id 2adb3069b0e04-52bab4dd705mr1044549e87.27.1717576758308; Wed, 05 Jun 2024 01:39:18 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240530083513.4135052-1-wenst@chromium.org> <20240530083513.4135052-3-wenst@chromium.org> <5a5842d7-adad-410b-bac2-9e5cb03ae18c@collabora.com> In-Reply-To: From: Chen-Yu Tsai Date: Wed, 5 Jun 2024 16:39:07 +0800 Message-ID: Subject: Re: [PATCH 2/6] clk: mediatek: Add mt8173-mfgtop driver To: AngeloGioacchino Del Regno Cc: Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 30, 2024 at 6:16=E2=80=AFPM Chen-Yu Tsai w= rote: > > On Thu, May 30, 2024 at 5:59=E2=80=AFPM AngeloGioacchino Del Regno > wrote: > > > > Il 30/05/24 10:35, Chen-Yu Tsai ha scritto: > > > The MFG (GPU) block on the MT8173 has a small glue layer, named MFG_T= OP > > > in the datasheet, that contains clock gates, some power sequence sign= al > > > delays, and other unknown registers that get toggled when the GPU is > > > powered on. > > > > > > The clock gates are exposed as clocks provided by a clock controller, > > > while the power sequencing bits are exposed as one singular power dom= ain. > > > > > > Signed-off-by: Chen-Yu Tsai > > > --- > > > drivers/clk/mediatek/Kconfig | 9 + > > > drivers/clk/mediatek/Makefile | 1 + > > > drivers/clk/mediatek/clk-mt8173-mfgtop.c | 240 ++++++++++++++++++++= +++ > > > 3 files changed, 250 insertions(+) > > > create mode 100644 drivers/clk/mediatek/clk-mt8173-mfgtop.c > > > > > > diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kcon= fig > > > index 70a005e7e1b1..9e279c739f1c 100644 > > > --- a/drivers/clk/mediatek/Kconfig > > > +++ b/drivers/clk/mediatek/Kconfig > > > @@ -500,6 +500,15 @@ config COMMON_CLK_MT8173_IMGSYS > > > help > > > This driver supports MediaTek MT8173 imgsys clocks. > > > > > > +config COMMON_CLK_MT8173_MFGTOP > > > + tristate "Clock and power driver for MediaTek MT8173 mfgtop" > > > + depends on COMMON_CLK_MT8173 > > > + default COMMON_CLK_MT8173 > > > + select PM_GENERIC_DOMAINS > > > + select PM_GENERIC_DOMAINS_OF > > > + help > > > + This driver supports MediaTek MT8173 mfgtop clocks and power = domain. > > > + > > > config COMMON_CLK_MT8173_MMSYS > > > tristate "Clock driver for MediaTek MT8173 mmsys" > > > depends on COMMON_CLK_MT8173 > > > diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Mak= efile > > > index eeccfa039896..fdd3a76e12a1 100644 > > > --- a/drivers/clk/mediatek/Makefile > > > +++ b/drivers/clk/mediatek/Makefile > > > @@ -77,6 +77,7 @@ obj-$(CONFIG_COMMON_CLK_MT8167_VDECSYS) +=3D clk-mt= 8167-vdec.o > > > obj-$(CONFIG_COMMON_CLK_MT8173) +=3D clk-mt8173-apmixedsys.o clk-mt= 8173-infracfg.o \ > > > clk-mt8173-pericfg.o clk-mt8173-topc= kgen.o > > > obj-$(CONFIG_COMMON_CLK_MT8173_IMGSYS) +=3D clk-mt8173-img.o > > > +obj-$(CONFIG_COMMON_CLK_MT8173_MFGTOP) +=3D clk-mt8173-mfgtop.o > > > obj-$(CONFIG_COMMON_CLK_MT8173_MMSYS) +=3D clk-mt8173-mm.o > > > obj-$(CONFIG_COMMON_CLK_MT8173_VDECSYS) +=3D clk-mt8173-vdecsys.o > > > obj-$(CONFIG_COMMON_CLK_MT8173_VENCSYS) +=3D clk-mt8173-vencsys.o > > > diff --git a/drivers/clk/mediatek/clk-mt8173-mfgtop.c b/drivers/clk/m= ediatek/clk-mt8173-mfgtop.c > > > new file mode 100644 > > > index 000000000000..85fa7a7453ed > > > --- /dev/null > > > +++ b/drivers/clk/mediatek/clk-mt8173-mfgtop.c > > > @@ -0,0 +1,240 @@ > > > +// SPDX-License-Identifier: GPL-2.0-only > > > +/* > > > + * Copyright (c) 2024 Google LLC > > > + * Author: Chen-Yu Tsai > > > + * > > > + * Based on driver in downstream ChromeOS v5.15 kernel. > > > + * > > > + * Copyright (c) 2014 MediaTek Inc. > > > + * Author: Chiawen Lee > > > + */ > > > + > > > +#include > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +#include "clk-gate.h" > > > +#include "clk-mtk.h" > > > + > > > +static const struct mtk_gate_regs mfg_cg_regs =3D { > > > + .sta_ofs =3D 0x0000, > > > + .clr_ofs =3D 0x0008, > > > + .set_ofs =3D 0x0004, > > > +}; > > > + > > > +#define GATE_MFG(_id, _name, _parent, _shift, _flags) \ > > > + GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, _shif= t, &mtk_clk_gate_ops_setclr, _flags) > > > > Extra tabulation: please fix > > One tab instead of two? OK. > > > > + > > > +/* TODO: The block actually has dividers for the core and mem clocks= . */ > > > +static const struct mtk_gate mfg_clks[] =3D { > > > + GATE_MFG(CLK_MFG_AXI, "mfg_axi", "axi_mfg_in_sel", 0, CLK_SET_R= ATE_PARENT), > > > + GATE_MFG(CLK_MFG_MEM, "mfg_mem", "mem_mfg_in_sel", 1, CLK_SET_R= ATE_PARENT), > > > + GATE_MFG(CLK_MFG_G3D, "mfg_g3d", "mfg_sel", 2, CLK_SET_RATE_PAR= ENT), > > > + GATE_MFG(CLK_MFG_26M, "mfg_26m", "clk26m", 3, 0), > > > +}; > > > + > > > +static const struct mtk_clk_desc mfg_desc =3D { > > > + .clks =3D mfg_clks, > > > + .num_clks =3D ARRAY_SIZE(mfg_clks), > > > +}; > > > + > > > +struct mt8173_mfgtop_data { > > > + struct clk_hw_onecell_data *clk_data; > > > + struct regmap *regmap; > > > + struct generic_pm_domain genpd; > > > + struct of_phandle_args parent_pd, child_pd; > > > + struct clk *clk_26m; > > > +}; > > > + > > > +static const struct of_device_id of_match_clk_mt8173_mfgtop[] =3D { > > > + { .compatible =3D "mediatek,mt8173-mfgtop", .data =3D &mfg_desc= }, > > > + { /* sentinel */ } > > > +}; > > > +MODULE_DEVICE_TABLE(of, of_match_clk_mt8173_mfgtop); > > > > Please move of_match_clk_mt8173_mfgtop before clk_mt8173_mfgtop_drv for= consistency > > with all the other clock drivers. > > Ack. > > > > + > > > +/* Delay count in clock cycles */ > > > +#define MFG_ACTIVE_POWER_CON0 0x24 > > > + #define RST_B_DELAY_CNT GENMASK(7, 0) /* pwr_rst_b de-assert = delay during power-up */ > > > + #define CLK_EN_DELAY_CNT GENMASK(15, 8) /* CLK_DIS deassert del= ay during power-up */ > > > + #define CLK_DIS_DELAY_CNT GENMASK(23, 16) /* CLK_DIS assert delay= during power-down */ > > > > The reason why I had EVT_FORCE_ABORT and ACTIVE_PWRCTL_EN in my driver = is to > > document that we're keeping the event force abort disabled and, more im= portantly, > > we are keeping the "active power control" feature disabled. > > > > Please, add those two - or at least the ACTIVE_PWRCTL_EN - to keep that= documented, > > or this information will be lost for sure. > > If in the future the ACTIVE_PWRCTL feature will become usable, it's goi= ng to be > > just a 30 seconds change, as the info is already there. > > OK. > > > > + > > > +#define MFG_ACTIVE_POWER_CON1 0x28 > > > + #define PWR_ON_S_DELAY_CNT GENMASK(7, 0) /* pwr_on_s assert dela= y during power-up */ > > > + #define ISO_DELAY_CNT GENMASK(15, 8) /* ISO assert d= elay during power-down */ > > > + #define ISOOFF_DELAY_CNT GENMASK(23, 16) /* ISO de-assert delay = during power-up */ > > > + #define RST__DELAY_CNT GENMASK(31, 24) /* pwr_rsb_b as= sert delay during power-down */ > > > + > > > +static int clk_mt8173_mfgtop_power_on(struct generic_pm_domain *doma= in) > > > +{ > > > + struct mt8173_mfgtop_data *data =3D container_of(domain, struct= mt8173_mfgtop_data, genpd); > > > + > > > + /* drives internal power management */ > > > + clk_prepare_enable(data->clk_26m); > > > + > > > + /* Power on/off delays for various signals */ > > > + regmap_write(data->regmap, MFG_ACTIVE_POWER_CON0, > > > + FIELD_PREP(RST_B_DELAY_CNT, 77) | > > > + FIELD_PREP(CLK_EN_DELAY_CNT, 61) | > > > + FIELD_PREP(CLK_DIS_DELAY_CNT, 60)); > > > > I get that this is kinda odd to read, but still... > > > > FIELD_PREP(CLK_DIS_DELAY_CNT, 60) | > > FIELD_PREP(ACTIVE_PWRCTL_EN, 0)); > > > > ...please :-) > > Sure. > > > > + regmap_write(data->regmap, MFG_ACTIVE_POWER_CON1, > > > + FIELD_PREP(PWR_ON_S_DELAY_CNT, 11) | > > > + FIELD_PREP(ISO_DELAY_CNT, 68) | > > > + FIELD_PREP(ISOOFF_DELAY_CNT, 69) | > > > + FIELD_PREP(RST__DELAY_CNT, 77)); > > > + > > > + /* Magic numbers related to core switch sequence and delays */ > > > + regmap_write(data->regmap, 0xe0, 0x7a710184); > > > + regmap_write(data->regmap, 0xe4, 0x835f6856); > > > + regmap_write(data->regmap, 0xe8, 0x002b0234); > > > + regmap_write(data->regmap, 0xec, 0x80000000); > > > + regmap_write(data->regmap, 0xa0, 0x08000000); > > > > Is there any way to retrieve information about what those registers are= ? > > I asked. They said the project was too long ago, and they could only > figure out that it had something to do with core switch sequencing and > delays between each core, which is what I put in the comment there. > > > > + > > > + return 0; > > > +} > > > + > > > +static int clk_mt8173_mfgtop_power_off(struct generic_pm_domain *dom= ain) > > > +{ > > > + struct mt8173_mfgtop_data *data =3D container_of(domain, struct= mt8173_mfgtop_data, genpd); > > > + > > > + /* Magic numbers related to core switch sequence and delays */ > > > + regmap_write(data->regmap, 0xec, 0); > > > + > > > + /* drives internal power management */ > > > + clk_disable_unprepare(data->clk_26m); > > > + > > > + return 0; > > > +} > > > + > > > +static int clk_mt8173_mfgtop_probe(struct platform_device *pdev) > > > +{ > > > + struct device *dev =3D &pdev->dev; > > > + struct device_node *node =3D dev->of_node; > > > + struct mt8173_mfgtop_data *data; > > > + int ret; > > > + > > > + data =3D devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); > > > + if (!data) > > > + return -ENOMEM; > > > + > > > + platform_set_drvdata(pdev, data); > > > + > > > + data->clk_data =3D mtk_devm_alloc_clk_data(dev, ARRAY_SIZE(mfg_= clks)); > > > + if (!data->clk_data) > > > + return -ENOMEM; > > > + > > > + /* MTK clock gates also uses regmap */ > > > + data->regmap =3D device_node_to_regmap(node); > > > + if (IS_ERR(data->regmap)) > > > + return dev_err_probe(dev, PTR_ERR(data->regmap), "Faile= d to get regmap\n"); > > > + > > > + data->child_pd.np =3D node; > > > + data->child_pd.args_count =3D 0; > > > + ret =3D of_parse_phandle_with_args(node, "power-domains", "#pow= er-domain-cells", 0, > > > + &data->parent_pd); > > > + if (ret) > > > + return dev_err_probe(dev, ret, "Failed to parse power d= omain\n"); > > > + > > > + devm_pm_runtime_enable(dev); > > > + /* > > > + * Do a pm_runtime_resume_and_get() to workaround a possible > > > + * deadlock between clk_register() and the genpd framework. > > > + */ > > > + ret =3D pm_runtime_resume_and_get(dev); > > > + if (ret) { > > > + dev_err_probe(dev, ret, "Failed to runtime resume devic= e\n"); > > > + goto put_of_node; > > > + } > > > + > > > + ret =3D mtk_clk_register_gates(dev, node, mfg_clks, ARRAY_SIZE(= mfg_clks), > > > + data->clk_data); > > > + if (ret) { > > > + dev_err_probe(dev, ret, "Failed to register clock gates= \n"); > > > + goto put_pm_runtime; > > > + } > > > + > > > + data->clk_26m =3D clk_hw_get_clk(data->clk_data->hws[CLK_MFG_26= M], "26m"); > > > + if (IS_ERR(data->clk_26m)) { > > > + dev_err_probe(dev, PTR_ERR(data->clk_26m), "Failed to g= et 26 MHz clock\n"); > > > + goto unregister_clks; > > > + } > > > + > > > + ret =3D of_clk_add_hw_provider(node, of_clk_hw_onecell_get, dat= a->clk_data); > > > + if (ret) { > > > + dev_err_probe(dev, ret, "Failed to add clk OF provider\= n"); > > > + goto put_26m_clk; > > > + } > > > + > > > + data->genpd.name =3D "mfg_apm"; > > > > "mfg-apm" or "mfg-pwr" please! > > Ack. On second thought, mfg-top seems like a better name, since it matches the datasheet. ChenYu > > Everything else looks good. > > > > Thanks for taking care of that, I started this work way too much time a= go and > > realistically I wouldn't have been able to finish it due to time constr= aints. > > > > It's great to see that *finally* we can get some GPU upstream on this o= ld SoC. > > As its CPUs are really slow, LLVMPipe is quite unusable from a UX persp= ective > > hence its only big issue was the lack of 3D HW acceleration. > > I think there's still more work on the GPU driver side. I was digging > through the mailing list to find ways to get it running, and evidently > it doesn't fully support zink yet. > > > This makes machines embedding this SoC usable, and that's simply awesom= e. > > I'll give the patches a week to simmer while I go work on some > other stuff. > > ChenYu