From patchwork Mon Dec 31 16:59:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 125 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f199.google.com (cartago.priv [10.11.12.1]) by cassiopea.amarulasolutions.com (Postfix) with ESMTPS id 9F8242E002E for ; Mon, 31 Dec 2018 18:01:21 +0100 (CET) Received: by mail-pl1-f199.google.com with SMTP id c14sf21945549pls.21 for ; Mon, 31 Dec 2018 09:01:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1546275680; cv=pass; d=google.com; s=arc-20160816; b=XoYgIbgamZKh+PXtZeJVQg1uUAMUncG/4ugPYwD8Efd6ijKUV2cOPZHaafRdUM/Hlx wjlxiq6lgXqn2KfKyH79VYf9e+EGUnTlJiem+0dJySNLVm7DQXbDb1rgwG0sHrgpmLU7 n+OHAOzIJD1Vy6ofVlOCJJK/e9yfIfow+BCjIuZoJkpfXi6hAl5a9f4MTkL/erGWA290 LA2Ktf2Ws8Pea190/xWnUSlc9nhZKPUh8UGj3psc3V23dBdnM0pfSgn8Oljp/xAbk4Ow Gc5q7u0rPDdW6OrtWPAdqRGnjnm9jeB3CXUmLbT8irjABlChIbEgUaHGeNYe+exEpuhU 8ipQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hcqYu9QvvCY7gWf8KF9hLQkfuuS9K3ENA/CTVM3DQ8I=; b=VbTRbd2tNmLbg3MFL1T5tSX7W5IdRBpMe+6LnBulY1WmekUkQx86jLtTb2sEyckA3D 73LJ4DE7rcWQt/bDpKQLMuVMI4Sv9mWvlLtlbTMnDbt1PH1FA52n0oLzOxSFsi0QU602 eIi/MR285YYXqn8QLedDfbytEWKpihyZ2/VGQNsCzNHoPSi7sHsl7rw3AFlviv7H5TAx RNRNGyoltdmWes+0L8JqoBTiWNljcGJmjZAkdD3szWipAFz88xIT8dfjaiZ8oUf68Gjy mX/extIr1NErWEBEan0Wb1wWEYr5vtx0x9UdxIhsb0dz10y3eutNCjnGLBzyTJL++br2 jgDw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=QrlcEgVo; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=hcqYu9QvvCY7gWf8KF9hLQkfuuS9K3ENA/CTVM3DQ8I=; b=qd2vdZMSkBOUp0Vx5/qbNf85MRCQ9U1mgw6IUpNiNZRlANE+jgd1JYMYP76pji9uQI 7w67RJSh+bkshNBLifbZ97E/m+bANZ/xXMKF+j/u3Kor/NXDnqGNvfkVvJUgb6kt1rls ld/dfw5di14hQgdiNyWdwmMt2uTR4A4HpZagw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=hcqYu9QvvCY7gWf8KF9hLQkfuuS9K3ENA/CTVM3DQ8I=; b=dPa2q4fHkaxlBebw//ahQXV2K7ueNqOfeeb3BAe6ezHO1InMhssLWeVUV6ZRVMob0l EU75NCOY5Bzytwund1rWeWCoAejppDGYy6eGkoWNwLUbsjHgsVasWWXj0U16i8Wbk+mr 6fz5ocS2EY1MSb8gci+PtvsigIrMS5uS0vfEAAqMHTD2oylrERLNLlyjB+y53B8K821m PPSPjFmK/rX+VmSSfpHdkziuqr46CQtihdS0Vwjbu5cL00Pc/AK6kb+3z32JBrCBCEJE zGiZEQ90vZKsGwmIshTY7k1RXGPl6BKBg2v/aCm7HpTFGpEjSQo0vxD8rGd/tm49VlRS Y6pA== X-Gm-Message-State: AJcUukfPN6GTA6CeSjSXOnkoYs/oKlzqjYlMwlkV3owHew7RwY5hgh/J kFdxFkLoPhwE+HzCFt2cWYXp/Atr X-Google-Smtp-Source: ALg8bN5xK01s7mT8qUT4yk3q/Nrjdei/c8rJQh/BcCvcz3a9VC0UlFFVy1l+aPHDH/ubCh4vQNhyRQ== X-Received: by 2002:a63:1c23:: with SMTP id c35mr17451684pgc.13.1546275680181; Mon, 31 Dec 2018 09:01:20 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a62:8909:: with SMTP id v9ls12628592pfd.3.gmail; Mon, 31 Dec 2018 09:01:20 -0800 (PST) X-Received: by 2002:a63:eb0e:: with SMTP id t14mr36640751pgh.445.1546275679933; Mon, 31 Dec 2018 09:01:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546275679; cv=none; d=google.com; s=arc-20160816; b=S06EgWbuGZlfD7Awo0QkE67rTLW8eVqyjB+bkBSdeb6mffCBlpkCQlNvhTcLtz1KaD NPyljbNeXFIPnIUGHsrC2cNiuVQNwxm6jxRiU6uM9rrAEhkIzSr5/8s1N0JuK0HGx2hg /BEJJflllAfKhOp3GkZOdmyPp0pgqYg5YEs1D9g19XbYH79+StYTh9EUV6slkQiIRZ+c 6XDKeoS79bwugCClVRUbWPfUQUGwIpqa6xdzblmPwD/pWtoYh/3JxjrIOj9XPNdoB4y8 bVnKI0f9C+iaVOf+UJ58vscu+9KPF3oqC+dU4LGR+yX6hXXP3ARhgcpuirfc6nc0jcRx Dt1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=hcqYu9QvvCY7gWf8KF9hLQkfuuS9K3ENA/CTVM3DQ8I=; b=scpU2Y0neETe6g/9EzCv4/yYDSIETfTJGosN2EDRtT4QuaxER6wYe+EYHW0gedZP3k IaykARZtJzuiFmKDmhCTZkwu7stC9meOUy/j9A9N1QK8RV9gAlRgFbmY7LjqmB+QdjtL avTmnHApOdIyE3UNUEchBD+Sr8wP/jc4Y2LlQsofn5+KFQA9r7H5E7EC5yakTevQ2659 Cjgj048E5d+qvES++NT/IRO+LZ9HODbdP9dlMkcYjkucagg4gmdyhb9Qcd7xzsSLcVRU PaCzTX9rK0MAdm+t5P+Nuz6Xoz5hZ/fN3ykeWY+iHul2fMTtYFRBqTtzpApsTfxif6E1 n/3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=QrlcEgVo; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id y78sor14263116pfk.45.2018.12.31.09.01.19 for (Google Transport Security); Mon, 31 Dec 2018 09:01:19 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a62:1b83:: with SMTP id b125mr40024443pfb.42.1546275679599; Mon, 31 Dec 2018 09:01:19 -0800 (PST) Received: from localhost.localdomain ([115.97.184.237]) by smtp.gmail.com with ESMTPSA id p7sm90692925pfj.72.2018.12.31.09.01.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Dec 2018 09:01:19 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Andre Przywara Cc: Chen-Yu Tsai , Simon Glass , Tom Rini , u-boot@lists.denx.de, linux-sunxi@googlegroups.com, Michael Trimarchi , linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v5 10/26] clk: sunxi: Add Allwinner V3S CLK driver Date: Mon, 31 Dec 2018 22:29:11 +0530 Message-Id: <20181231165927.13803-11-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181231165927.13803-1-jagan@amarulasolutions.com> References: <20181231165927.13803-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=QrlcEgVo; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add initial clock driver for Allwinner V3S. - Implement USB bus and USB clocks via ccu_clk_gate table for V3S, so it can accessed in common clk enable and disable functions from clk_sunxi.c - Implement USB bus and USB resets via ccu_reset table for V3S, so it can accessed in common reset deassert and assert functions from reset-sunxi.c Signed-off-by: Jagan Teki Acked-by: Maxime Ripard --- drivers/clk/sunxi/Kconfig | 7 +++++ drivers/clk/sunxi/Makefile | 1 + drivers/clk/sunxi/clk_v3s.c | 51 +++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 drivers/clk/sunxi/clk_v3s.c diff --git a/drivers/clk/sunxi/Kconfig b/drivers/clk/sunxi/Kconfig index c45a4ba378..a6f84e9e56 100644 --- a/drivers/clk/sunxi/Kconfig +++ b/drivers/clk/sunxi/Kconfig @@ -51,6 +51,13 @@ config CLK_SUN8I_R40 This enables common clock driver support for platforms based on Allwinner R40 SoC. +config CLK_SUN8I_V3S + bool "Clock driver for Allwinner V3S" + default MACH_SUN8I_V3S + help + This enables common clock driver support for platforms based + on Allwinner V3S SoC. + config CLK_SUN8I_H3 bool "Clock driver for Allwinner H3/H5" default MACH_SUNXI_H3_H5 diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile index 61f8b87396..fbd43527a6 100644 --- a/drivers/clk/sunxi/Makefile +++ b/drivers/clk/sunxi/Makefile @@ -12,5 +12,6 @@ obj-$(CONFIG_CLK_SUN6I_A31) += clk_a31.o obj-$(CONFIG_CLK_SUN8I_A23) += clk_a23.o obj-$(CONFIG_CLK_SUN8I_A83T) += clk_a83t.o obj-$(CONFIG_CLK_SUN8I_R40) += clk_r40.o +obj-$(CONFIG_CLK_SUN8I_V3S) += clk_v3s.o obj-$(CONFIG_CLK_SUN8I_H3) += clk_h3.o obj-$(CONFIG_CLK_SUN50I_A64) += clk_a64.o diff --git a/drivers/clk/sunxi/clk_v3s.c b/drivers/clk/sunxi/clk_v3s.c new file mode 100644 index 0000000000..0eeea84c1a --- /dev/null +++ b/drivers/clk/sunxi/clk_v3s.c @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (C) 2018 Amarula Solutions. + * Author: Jagan Teki + */ + +#include +#include +#include +#include +#include +#include +#include + +static struct ccu_clk_gate v3s_gates[] = { + [CLK_BUS_OTG] = GATE(0x060, BIT(24)), + + [CLK_USB_PHY0] = GATE(0x0cc, BIT(8)), +}; + +static struct ccu_reset v3s_resets[] = { + [RST_USB_PHY0] = RESET(0x0cc, BIT(0)), + + [RST_BUS_OTG] = RESET(0x2c0, BIT(24)), +}; + +static const struct ccu_desc v3s_ccu_desc = { + .gates = v3s_gates, + .resets = v3s_resets, +}; + +static int v3s_clk_bind(struct udevice *dev) +{ + return sunxi_reset_bind(dev, 53); +} + +static const struct udevice_id v3s_clk_ids[] = { + { .compatible = "allwinner,sun8i-v3s-ccu", + .data = (ulong)&v3s_ccu_desc }, + { } +}; + +U_BOOT_DRIVER(clk_sun8i_v3s) = { + .name = "sun8i_v3s_ccu", + .id = UCLASS_CLK, + .of_match = v3s_clk_ids, + .priv_auto_alloc_size = sizeof(struct ccu_priv), + .ops = &sunxi_clk_ops, + .probe = sunxi_clk_probe, + .bind = v3s_clk_bind, +};