From patchwork Tue Dec 15 14:42:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 344015 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp3975216jai; Tue, 15 Dec 2020 06:44:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0w6DM7niIgC68rja/hGCxQxiEJuySoLS9FC/uzAc20UjBUCANmegEwcF9TFXVQakGtOPI X-Received: by 2002:a05:6402:2041:: with SMTP id bc1mr14279255edb.369.1608043457796; Tue, 15 Dec 2020 06:44:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608043457; cv=none; d=google.com; s=arc-20160816; b=s9la4Jp2olyDStWFdo5aYcIPT35A4lqxLfP/4mZPd0BrMZC5ZPyDbXHCrRDYUurUsL 98cVG0wjDtXz51PUSpjLoZvq9er6BEzrsSr7mXLN6xfDAEmWatrKWzD14RVOG/0KI56h S507M+coe4sL4yH6pRe5lsCaa0deJd6t/ffCb0FxkxU+hYlVBVqFuV5WWsT4Pvpc70zq M1sLyylqtblYDpNcjj3bNegm+1XR/L9Oj0wBbHLfkt9R77WsNVVFOOD1YbUSrayWCoUR xGzB6jyPDv7eGS1WEVTadNE5nwAgerLshNcmhzxTNioWtc3QmblN1tN05ApZGabdkUpL bjRg== 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=I8MwYOF5CouccbtRUOVgye4AaKEexgn5jV+fLcQsHwDWoOVW437j/TEKcwwrls9lC0 Z3qnD5cGGJxhvIiJnHcYfWamjZTjp/R7qJp73lENzXQRrx+Y2Tketo6ff2QXjJTVSHxv iudyPlflcipJH1HrgTxUnPzVMyCkheAs0VAwooL8AZEJnoTFrqRpfSpnzaPdCWbbcP8t ylEPi9mDvGFCLA4c0ZwXytplHz/R4lB2raE7kupWXg0E2Ywtv1KD3eDZAiMFisuE6i0r dtb6Bt9UKiFmiCpufTDtabNrhdfGkmtFl5OS83xa8Oz292MtEqL+Wc5trG41MO6akkrs 1+VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=NsGxCRlw; 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 k4si953459eds.355.2020.12.15.06.44.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Dec 2020 06:44:17 -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=NsGxCRlw; 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 381E0829CA; Tue, 15 Dec 2020 15:43: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="NsGxCRlw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 45465829A8; Tue, 15 Dec 2020 15:43:05 +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 ACF3D829A8 for ; Tue, 15 Dec 2020 15:42:58 +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 20201215144248euoutp01733a11f3aaec6a4dc53610336da7b4d7~Q6ux5ktE91458714587euoutp01x for ; Tue, 15 Dec 2020 14:42:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201215144248euoutp01733a11f3aaec6a4dc53610336da7b4d7~Q6ux5ktE91458714587euoutp01x DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1608043368; bh=tqiyrcofRXDD8+Jvxf8Hvi5HLF9twruT3mGu/SaynC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NsGxCRlwm+C3CRRhixC6vNf3R1S6BXE8l9dvaoWvuEs8QsYoC9dB6T3GUNMrzzqFe yp7gt3Fx2mfaWYM5vEbiMYNuQNLY63wPbPmsoVl9CryWfDm34BYHxkMFqFreVTgB+O X25ooMaQgLdaPiVLs6t6BCMyF7E0QEG2EaF+WQQQ= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201215144243eucas1p1e3cf557fb014fae32f148d860136eba3~Q6utCdaBU0119001190eucas1p1F; Tue, 15 Dec 2020 14:42:43 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 71.36.27958.36BC8DF5; Tue, 15 Dec 2020 14:42:43 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201215144242eucas1p1ff9e7e4acd3ef9b86fa15a2cd4ac05a5~Q6usdNJBJ0489004890eucas1p1Z; Tue, 15 Dec 2020 14:42:42 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201215144242eusmtrp2821871867cc46ecef18bd41d0aef2f77~Q6uschExs2505225052eusmtrp2t; Tue, 15 Dec 2020 14:42:42 +0000 (GMT) X-AuditID: cbfec7f2-f15ff70000006d36-88-5fd8cb6301db Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 86.DD.16282.26BC8DF5; Tue, 15 Dec 2020 14:42:42 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20201215144241eusmtip2e7d49219de61508381b709e31a9bc867~Q6ur8CgD83260432604eusmtip2h; Tue, 15 Dec 2020 14:42:41 +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 v2 1/7] clk: meson: add minimal driver for g12a-ao clocks Date: Tue, 15 Dec 2020 15:42:24 +0100 Message-Id: <20201215144230.9235-2-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201215144230.9235-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphleLIzCtJLcpLzFFi42LZduznOd3k0zfiDa7/Y7bYOGM9q8WNX22s Fs/fXWayWHvkLrvFob5oi47DyhbftmxjtJg04Rebxdu9newWh6d+YHTg8nh/o5XdY3bDRRaP ebNOsHh8+BjnMb/zO5PH2Ts7GD36tqxi9Ni47ABzAEcUl01Kak5mWWqRvl0CV8bRpk8sBbfE KjZeesnawNgs3MXIySEhYCLx9N0qpi5GLg4hgRWMEp/2/IByvjBKTHvylQXC+cwocX7JDTaY ln3HelghEssZJQ68n88O1/Jk109WkCo2AUOJrrddYB0iAkYSl5p2gI1iFrjDJNE1uYEFJCEs 4CnRuKSZHcRmEVCVODjlKpjNK2AjcbnhDzvEOnmJ1RsOMIPYnAK2En8mrgLbJiGwh0Ni5a+X LBBFLhJ/9myBahCWeHUcxpaR+L9zPhNEQzOjxMNza6G6exglLjfNYISospa4c+4X0K0cQPdp SqzfpQ8RdpTY9m0dM0hYQoBP4sZbQZAwM5A5adt0qDCvREebEES1msSs4+vg1h68cIkZwvaQ 6OlpA1skJDCBUWLjkcAJjPKzEHYtYGRcxSieWlqcm55abJiXWq5XnJhbXJqXrpecn7uJEZhg Tv87/mkH49xXH/UOMTJxMB5ilOBgVhLh7S29Hi/Em5JYWZValB9fVJqTWnyIUZqDRUmcd9Xs NfFCAumJJanZqakFqUUwWSYOTqkGJnurtpD4ybdv2Mmd8e8wyuY/p/MwOKPJ6peqx+Tyt1OT GWXcProuPHdwxtvzKYfe/K01MmzlOyAeYygj7FomuOz71ldK/icfHG96Nkt7Q/8S08DT+kYK J2x2PNDc8qr9Y1W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5mScT+DtpaXXL4pMS2Z+M5eb1fxfU7f0rtsr8QJJ4DYfaJvci381ve4q6zW8y dIpf2jPvb0DMrwlObpxfux7e0ZNY5v7M4cDabad2v3nesXVyIX9yRq398usly9I23nnyy+7e DsGgirbbhrW/pVqq8nLYss9c1Obe9mr5xrjvMv/VpkyLz+plXX83rKldiaU4I9FQi7moOBEA OpW2NwADAAA= X-CMS-MailID: 20201215144242eucas1p1ff9e7e4acd3ef9b86fa15a2cd4ac05a5 X-Msg-Generator: CA X-RootMTR: 20201215144242eucas1p1ff9e7e4acd3ef9b86fa15a2cd4ac05a5 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201215144242eucas1p1ff9e7e4acd3ef9b86fa15a2cd4ac05a5 References: <20201215144230.9235-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, +};