From patchwork Wed Dec 16 07:51:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 344497 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp163725ejs; Tue, 15 Dec 2020 23:52:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJychHgCzOG6jywW4VQtTYd8Nj97pGDHLGFCuXDsHgI4FdqFyBELAJJEk9PNC2cwzvBoL3Ws X-Received: by 2002:a05:6402:22ea:: with SMTP id dn10mr32312460edb.67.1608105142345; Tue, 15 Dec 2020 23:52:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608105142; cv=none; d=google.com; s=arc-20160816; b=cJwjWFaU5PigA8R+HljejIwqrzbqt0fkTIH15qV8gN5Lyq1qYV6rmbhBify6FL7ztJ e+ZJasD7FEw2wf6BaksuHxhWlGl9VmJ6zDEXXAnJPR0A7IidDLHl/5nkVBIr2wlh2OGE 9fXA8/E1e66yP8XGChaDh0hD4B0TIpvQZvbCY+GjlVtKu1zq/Ij0Z7sJuu4IHoAJCaJ6 QSiDpuf+3FfL3OVikqBB4OEUtQQDbRWff2gmTjfA6rEJsymrVwKNotImdnnyhBSKxblE IbCkr+atmT6ARwxxbyVfAZjNNn/76wNAsNpdBzAvmw9cSV59lhyBLvuOguZCQZmcwNdP e7Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=tqiyrcofRXDD8+Jvxf8Hvi5HLF9twruT3mGu/SaynC8=; b=cKr3sgxVxdcxOroXSQ33c08w+iw7TE0YJ/NemtGJLaG5wPM3Iop3dfqVqPkPbAdLyC IPij8hWFmn1bG2yH6YiC1PbIMlfwV291GSdQthwxAMBGLQcn2UPfc/STjFkydQ33WH+/ JakSSzG7u9DADJnjlLqNiza1dA4NiCuuGtdE6xSTrZ0PqYhuExXuzgqWLyjkoUgoNakM Fh2lTNv+eS+24fbAbEVFYnxWexxM830XJAbFJxX/31EsA6PUkUPgLoUNoDLZq6KkLQS0 3V89N7qANt+9FUJT4WmkBRNEy2i3Iwy+TM2BfHmCnSRR7IgfILBJHCQEt55esbdCKsMF I6Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Se4pgzbs; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id y15si476104ejp.228.2020.12.15.23.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Dec 2020 23:52:22 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Se4pgzbs; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AD4E682A48; Wed, 16 Dec 2020 08:52:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="Se4pgzbs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EC20382A4B; Wed, 16 Dec 2020 08:52:18 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BEE26828C0 for ; Wed, 16 Dec 2020 08:52:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m.szyprowski@samsung.com Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201216075205euoutp02240e7e209fd8fce8b8768f82244d10b4~RIxdWY2q82686326863euoutp021 for ; Wed, 16 Dec 2020 07:52:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201216075205euoutp02240e7e209fd8fce8b8768f82244d10b4~RIxdWY2q82686326863euoutp021 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1608105125; bh=tqiyrcofRXDD8+Jvxf8Hvi5HLF9twruT3mGu/SaynC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Se4pgzbsmuGBPpmcb1FX/mRnv14VezkWxdPAD4TKm1hfrxr58X894KLNMFynn0PS/ ZAb8cXrVXrm2hIixsnrOw8nOVWmWPlk65tmt987AUC+sU1Y0bbs2vF221GJcnC2ksT Wbyv7Z2BqNPF9qfFOGEerCmjQ4Vnir3B+xyrX3iU= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201216075204eucas1p2d21d5fc6b533e10eb3e5136b922d4ab2~RIxc72zYW0743307433eucas1p2S; Wed, 16 Dec 2020 07:52:04 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 8F.01.27958.4ACB9DF5; Wed, 16 Dec 2020 07:52:04 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201216075204eucas1p253957263c68d1091d6cd4f83872f35ba~RIxcn5VHs1128511285eucas1p2H; Wed, 16 Dec 2020 07:52:04 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201216075204eusmtrp2981b336317172195c2a2249bb09ded45~RIxcnOkUp0040100401eusmtrp2y; Wed, 16 Dec 2020 07:52:04 +0000 (GMT) X-AuditID: cbfec7f2-efdff70000006d36-52-5fd9bca4fc76 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id A0.5A.16282.4ACB9DF5; Wed, 16 Dec 2020 07:52:04 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20201216075203eusmtip204e833ad2557c506d812ee2b0a739c4d~RIxcGGEqt1788017880eusmtip26; Wed, 16 Dec 2020 07:52:03 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de, u-boot-amlogic@groups.io Cc: Marek Szyprowski , Neil Armstrong , Lukasz Majewski , Philippe Reynes , Simon Glass , Heinrich Schuchardt , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH v3 1/6] clk: meson: add minimal driver for g12a-ao clocks Date: Wed, 16 Dec 2020 08:51:53 +0100 Message-Id: <20201216075158.16458-2-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201216075158.16458-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSaUwTURSF82am7bRaHQqRBxoxNWjQCKIkjIgNuMQxwaj8IdFoqTCySIG0 oOCWCmqgQawo0lCVJVDZF6kV3C1LcaECTbUScI3iAkjBSEEUKYP677vn3nPPzcvDUUEWyx2P iU+iZfGSOCGbh+nbxk2rSu68FK9ufbSErFfXskjrxBkW2T9kRsjqlj4OacjeQ2Y0LyV/6PSA zFFNsMnBu5kcsjl3GATxqG/W0xxKo+jCqKv57Rg1bNtHFWSOIVRHbyOgsnUVgKrXPkB34rt5 gZF0XMwhWuYjCudFt6aNYIk9C1Lquz+zFCDdWQm4OCT8YNXtHLYS8HABUQagNq+cwxTfAbQP 1GBMMQrg2KQN+WvpaWjiOFhAXAOw5GXQP8eApmumwSZ8oXJQyXawC7EGdqc1zmxCiV4EKi8o MEfDmdgGzfc+sRyMEZ5QbaubMfCJDfCjoQQwaR6wsu4B6mAuIYLNegXiWASJFhyWFf/CmKHN MDfPOsvO8ItRx2F4EZxqKpg1pAP41lTNYYosAM1p6tmI9bDXNDEdjU/f5wVrb/kwcjA8ZSmc kSExD1oHnRwyOo05+jyUkfkw44yAmV4G8401/2IfdnajDFMwM9c0+4znAXxzfwxTAY/8/2GF AFQAVzpZLo2i5b7x9GFvuUQqT46P8o5IkF4H0x/myW/jSCO48sXmbQAIDgwA4qjQhT85aBUL +JGS1CO0LEEsS46j5QawEMeErvwKTZVYQERJkuiDNJ1Iy/52EZzrrkCQzpO7WFPauWGqZ3NP c/wtN4JpN43Ev20XCx15fydm2MWytqsk4F5BONkfG2dPeTJF0iuPrkVDGg4Ya3u3l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KblNQFnBaHuNzK4tDQpLW3RfbZv6JFRz6nKBq3U7joeW7/CX55AwN/orbHrQ8ULyIcaf zsx79mhW7Dj+7db6yfPO5R3zkOiu4XtVMKtD/MNyjreqqemfnf4qJ2VsMMyPcBUt0+b6f0HQ t7PX4eWUxFK3Qoae/Scap1k1/5PyWsUbvfXNtw860defZjX4PDiq/OWwTqbbOm0lluKMREMt 5qLiRACmIKHGAAMAAA== X-CMS-MailID: 20201216075204eucas1p253957263c68d1091d6cd4f83872f35ba X-Msg-Generator: CA X-RootMTR: 20201216075204eucas1p253957263c68d1091d6cd4f83872f35ba X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201216075204eucas1p253957263c68d1091d6cd4f83872f35ba References: <20201216075158.16458-1-m.szyprowski@samsung.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add minimal driver AO clocks on meson G12A family. Only ADC related clocks are supported. Signed-off-by: Marek Szyprowski Reviewed-by: Neil Armstrong Tested-by: Jaehoon Chung Reviewed-by: Jaehoon Chung --- drivers/clk/meson/Makefile | 1 + drivers/clk/meson/g12a-ao.c | 83 +++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 drivers/clk/meson/g12a-ao.c -- 2.17.1 diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile index c873d6976f..7204383e17 100644 --- a/drivers/clk/meson/Makefile +++ b/drivers/clk/meson/Makefile @@ -6,4 +6,5 @@ obj-$(CONFIG_CLK_MESON_GX) += gxbb.o obj-$(CONFIG_CLK_MESON_AXG) += axg.o obj-$(CONFIG_CLK_MESON_G12A) += g12a.o +obj-$(CONFIG_CLK_MESON_G12A) += g12a-ao.o diff --git a/drivers/clk/meson/g12a-ao.c b/drivers/clk/meson/g12a-ao.c new file mode 100644 index 0000000000..7a0abea77c --- /dev/null +++ b/drivers/clk/meson/g12a-ao.c @@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "clk_meson.h" + +struct meson_clk { + struct regmap *map; +}; + +#define AO_CLK_GATE0 0x4c +#define AO_SAR_CLK 0x90 + +static struct meson_gate gates[] = { + MESON_GATE(CLKID_AO_SAR_ADC, AO_CLK_GATE0, 8), + MESON_GATE(CLKID_AO_SAR_ADC_CLK, AO_SAR_CLK, 8), +}; + +static int meson_set_gate(struct clk *clk, bool on) +{ + struct meson_clk *priv = dev_get_priv(clk->dev); + struct meson_gate *gate; + + if (clk->id >= ARRAY_SIZE(gates)) + return -ENOENT; + + gate = &gates[clk->id]; + + if (gate->reg == 0) + return 0; + + regmap_update_bits(priv->map, gate->reg, + BIT(gate->bit), on ? BIT(gate->bit) : 0); + + return 0; +} + +static int meson_clk_enable(struct clk *clk) +{ + return meson_set_gate(clk, true); +} + +static int meson_clk_disable(struct clk *clk) +{ + return meson_set_gate(clk, false); +} + +static int meson_clk_probe(struct udevice *dev) +{ + struct meson_clk *priv = dev_get_priv(dev); + + priv->map = syscon_node_to_regmap(dev_get_parent(dev)->node); + if (IS_ERR(priv->map)) + return PTR_ERR(priv->map); + + return 0; +} + +static struct clk_ops meson_clk_ops = { + .disable = meson_clk_disable, + .enable = meson_clk_enable, +}; + +static const struct udevice_id meson_clk_ids[] = { + { .compatible = "amlogic,meson-g12a-aoclkc" }, + { } +}; + +U_BOOT_DRIVER(meson_clk_axg) = { + .name = "meson_clk_g12a_ao", + .id = UCLASS_CLK, + .of_match = meson_clk_ids, + .priv_auto_alloc_size = sizeof(struct meson_clk), + .ops = &meson_clk_ops, + .probe = meson_clk_probe, +};