From patchwork Mon Dec 14 11:24:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 343489 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp2911691jai; Mon, 14 Dec 2020 03:25:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJz101KEXLJ1+HIJN3t+Z1C2RSvtMJp0izxoLu+Z3U2CdtuvJOAv6zzDLQiTbI67ytF+FjZ2 X-Received: by 2002:a17:906:ca47:: with SMTP id jx7mr22968438ejb.237.1607945146224; Mon, 14 Dec 2020 03:25:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607945146; cv=none; d=google.com; s=arc-20160816; b=PwYlCIkxA/KLAX8t7nDnNrbAqnumJK1pBSE+tU0lnro0pMx+vfZ2aywic+/2Wtu8Mt jj+GD1QtFhs7Jh256985PQ/IjDXSAyK+JTQWJnYtOx0FHmpW5Gb0KG7peAbN/qHx1g3t F2sSISk1N3hxOUlmn8Kt6oOxz6gH0pryI3iJ1I0hHybycvH4MMPZxRhv02PANoqsUTdq szWe7z9es2LTnWaFk4Ep6knKkypteto9DrtbARGh37DI6Qolw59An0TajVvaOgL/zYG/ fgI4WR7vqArNcW90vgzmnncnjLwlxPA3WHx9L84hoogc+19TJhkrTVEDHNTLxCkUo5q8 vocQ== 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=+0e8dKAiob1OcjRvD9TwFvbIOMafBCQMSn4wKEe4suE=; b=vun9mvFNXOfU42FcDfuTWKxzLEw4KfA3ExNsq1eJ7gx1TuGoh4lpmqLHPva3wEBnOy KUchQMpBkn8SKnv+SdUnFGZ6zgzrlZfrN7iz+QeL3BRqYolmbx6bkT0PanFI/CP7d00z yWs9RqRHJUl75HMVqAQL9sbibd6KVeLT2WbPQUcpmlfq+OLTj0MDNOfkpFBazysR1d61 mWeHHECD5fzPXHrinqeYu7KrHTLdqCm7rlaf0mQUlzyLpjXU6ISs3ecX1EeLj82y/+Y1 Q8/cjQ/qbhM8dOFoUby72QwBtZLM0BMYcqc8by/kZQWtQ94iHZfHgyEg5kv/mPp26ikm v3vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=rb7dwA+7; 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 k4si9945648eds.355.2020.12.14.03.25.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 03:25:46 -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=rb7dwA+7; 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 CD6068282A; Mon, 14 Dec 2020 12:25:16 +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="rb7dwA+7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EAD0F82824; Mon, 14 Dec 2020 12:25:11 +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 mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DD7EC82817 for ; Mon, 14 Dec 2020 12:25:05 +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 mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201214112455euoutp017dcb82e5ee80409a9b74548f753ac441~QkYt7PBuH0070700707euoutp011 for ; Mon, 14 Dec 2020 11:24:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201214112455euoutp017dcb82e5ee80409a9b74548f753ac441~QkYt7PBuH0070700707euoutp011 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1607945095; bh=+0e8dKAiob1OcjRvD9TwFvbIOMafBCQMSn4wKEe4suE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rb7dwA+7u37qygmrBg2xePmK/E4pvgumvD5h2EU0eA3gS1gdL+ShPbkXe5mYa+uHF sg/PXzIgoXXK8zeHS0o8ns4IbXHIdbYDuwqV9yplfPFS1ljcJR6yNh4Y8igh+hPm3z cNGOeiTOb64T8c3HofDicemscX0KykJN6lEcQfhE= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201214112449eucas1p18733e741986e7895c7df2f3be40abfdf~QkYo9ao513049230492eucas1p1b; Mon, 14 Dec 2020 11:24:49 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id F9.C0.45488.18B47DF5; Mon, 14 Dec 2020 11:24:49 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201214112449eucas1p2ce0ef939e0d7f468e64be3555f29ea04~QkYom2uOJ0277402774eucas1p2y; Mon, 14 Dec 2020 11:24:49 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201214112449eusmtrp1b84153b97bd4b2d80989ab1ae0945405~QkYomP8_r1608516085eusmtrp1f; Mon, 14 Dec 2020 11:24:49 +0000 (GMT) X-AuditID: cbfec7f5-c5fff7000000b1b0-2b-5fd74b814fef Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 08.9B.21957.18B47DF5; Mon, 14 Dec 2020 11:24:49 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201214112448eusmtip1b672ed5236197e535684c1d28db028a8~QkYoERjR72707027070eusmtip1O; Mon, 14 Dec 2020 11:24:48 +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 1/6] clk: meson: add minimal driver for g12a-ao clocks Date: Mon, 14 Dec 2020 12:24:32 +0100 Message-Id: <20201214112437.18757-2-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201214112437.18757-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupkleLIzCtJLcpLzFFi42LZduznOd1G7+vxBn2PjCw2zljPanHjVxur xfN3l5ks1h65y25xqC/aouOwssW3LdsYLSZN+MVm8XZvJ7vF4akfGB24PN7faGX3mN1wkcVj 3qwTLB4fPsZ5zO/8zuRx9s4ORo++LasYPTYuO8AcwBHFZZOSmpNZllqkb5fAlXFp0xKmgq+i FQsPn2BvYFwl1MXIySEhYCIx69wJVhBbSGAFo8TTo4FdjFxA9hdGiVOPrrJDOJ8ZJTafv8nY xcgB1tHepQsRX84o0bRuJTtcx9zbi9hARrEJGEp0ve0Cs0UEjCQuNe1gASliFrjDJNE1uYEF ZJKwgJtE+7UakBoWAVWJfQs/g4V5BWwl7s8xhrhOXmL1hgPMIDangJ3Exrlr2UDGSAgc4ZD4 9GMNC0SRi8SKa5PZIGxhiVfHt7BD2DISpyf3sEA0NDNKPDy3lh3C6WGUuNw0gxGiylrizrlf bCCbmQU0Jdbv0ocIO0qsOd/DCvExn8SNt4IgYWYgc9K26cwQYV6JjjZoKKpJzDq+Dm7twQuX mCFsD4lHn7qYIOEzEeiEVZuYJzDKz0JYtoCRcRWjeGppcW56arFxXmq5XnFibnFpXrpecn7u JkZgajn97/jXHYwrXn3UO8TIxMF4iFGCg1lJhPd3/eV4Id6UxMqq1KL8+KLSnNTiQ4zSHCxK 4ry7tq6JFxJITyxJzU5NLUgtgskycXBKNTAt4vuSHX2uTTF51wyL38/YS7/F7p+VsOOiBeOK EG9z9r9vBFbWOx348ed1+8xw5bW97A0XSkV5/+7ddfyDvdKqDxLHz8Tcf3S/ZXvStIKsUEeV /8cuvLR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mB 5ZeLMcEvjPcprJihYHdZ9P/51gSV7Kdrluia9n+IzhDNZ5WMdtHXsPp6ynPDQ+kTEg+WGGhX CTz6Mrst7MczOWVf/iphxq0tdaf/6DYHadn7NF2ctKeWx2entixfVdg987rLd+scdmTqLTlc xbzWKritIdn5V9x5ocPyqz8UrMtXEbrr+33qmbgbxStuzWu5sehjIwvTXb7mUCslluKMREMt 5qLiRAC2S1xK/QIAAA== X-CMS-MailID: 20201214112449eucas1p2ce0ef939e0d7f468e64be3555f29ea04 X-Msg-Generator: CA X-RootMTR: 20201214112449eucas1p2ce0ef939e0d7f468e64be3555f29ea04 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201214112449eucas1p2ce0ef939e0d7f468e64be3555f29ea04 References: <20201214112437.18757-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 Change-Id: I0c91848bc55493e19570db333e7da6020d687907 --- 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 Reviewed-by: Neil Armstrong Tested-by: Jaehoon Chung Reviewed-by: Jaehoon Chung diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile index c873d6976fa..7204383e173 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 00000000000..7a0abea77c4 --- /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, +};