From patchwork Mon Dec 31 16:59:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 120 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f199.google.com (cartago.priv [10.11.12.1]) by cassiopea.amarulasolutions.com (Postfix) with ESMTPS id AC0242E002E for ; Mon, 31 Dec 2018 18:00:46 +0100 (CET) Received: by mail-pf1-f199.google.com with SMTP id 74sf29314016pfk.12 for ; Mon, 31 Dec 2018 09:00:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1546275645; cv=pass; d=google.com; s=arc-20160816; b=e4/8nW4guf9QlbsVwKb0OEzDTl3tz5WyWWk1t8iD8WQGEtO+XUTufPIl8pwwT4d1sv ziF539Bk73NfNBeDISks4wBisCPP6N+1UntiTjUHT1akK6HgVf/jYRpHNlMKh2KwqUMQ Gqum3Ri7ACoR6T6fWS/cG/ASnCcYTpaCEVJrBhCINlu8lwPz9cN63oioT6CoeYKh9FJ0 SAPus7lmqc0nfhKxkQCVJzqKN7LkyCmT3YK9GainZGjWGHrZkfSiGK/xUTC8ePwLVogE zVdA2m71bNXEqOOG9OnbAQIPiE2MbjgLsN73s5WTWB9TbxsOpmB7bltqhzTStAU5DG8c jDbA== 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=jDJW03J73u0DhIM3iyuY6JLw4LehdOSXPTPp9UY6D+k=; b=FLeSFrPOAAFkdZD7KivnvHfnohUJ2cbJ+KndtVRP2vG21ubE+FJ0vikSIMpSPKXod+ Du58sTW9vCuSQiruN/JkXyc8eb2QCpXi/oPY+0y2wZO3CLJ3D0BjknSx5lRnZdsgOfaA igR544+a+GHcmd85BUb17s7i1Li0K0+yNsWKIq1We3zBSi9vwLf6p96lFVc5rxyS5LdH O7qNn+QEWL2mr/82rVTnO5Vgup/blMfCPJum8XWvrn90wEudr3c+01yv/8ChrMGYJn2W /MNiedC9+ytggR6qgCZYlbXjEIQnEqsLZVDbSHJ+6ndrkEkEsZb3ANyqwmoo5kuiXor7 jUYQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=dACt+SJD; 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=jDJW03J73u0DhIM3iyuY6JLw4LehdOSXPTPp9UY6D+k=; b=CK0gT0Y16H55G0pykgf0dL41o8LVri89M7ZtKeJ/TdT0Ow319xeICgEIq4RQjOS9JO KARWg0OHMLRjOH92mLhmnkul08U+xIt3/xfKVwId/b96MTnJ05ZPVDzZxpwXbqO9lLJh X/h80EvKAFubo+xVsEwk2Gm6ZaTsdX22/2Jr8= 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=jDJW03J73u0DhIM3iyuY6JLw4LehdOSXPTPp9UY6D+k=; b=p3TLXuMOsl8fBjWrmebx81tJVmmaPp3ZQvUzjpcTYVbNVVzPMRmBfDQcskx5S49DAz Uo0kLxDp6uQv3JSWvBwnHm8CkAJMDGo9GGzrnf5r7rNlM0EUr5R7Vz2YJnZsDF5UHkui thsEV7v2UhFdyoorFYWuzBEOT+SOk7Pd3oPOOdRepgj/GSpCSOjHixEAeq00q02znJSE +gTxv8AXm9iknJcrz4vpZG+QgA89aiqVnt5iO5tN+Lj07GeRvhs+VBwDobxO6vPBunpc NBkF9fXjILRfIHRqaJg8+GhqBDAQ09tQ/QXcdjt12zeolshGB6TRlJe+TX4D8XmUmBvQ z4Og== X-Gm-Message-State: AJcUukd90p14JFSSAGqn2srhRuG9Hey/4x+7kUSKtlDoVh9+kr3uKy20 XTlTjB34rxemqWePpH82d/BUDhqJ X-Google-Smtp-Source: ALg8bN6s6hzgJj6UP0riphSsWE1c4r8dvujp0sJOFe36lw2LCKLRdcQeODAH/MSELDen9EU82VAHxg== X-Received: by 2002:a17:902:7046:: with SMTP id h6mr14790568plt.128.1546275645344; Mon, 31 Dec 2018 09:00:45 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a62:20d5:: with SMTP id m82ls12624047pfj.5.gmail; Mon, 31 Dec 2018 09:00:45 -0800 (PST) X-Received: by 2002:a62:d885:: with SMTP id e127mr38333130pfg.197.1546275645004; Mon, 31 Dec 2018 09:00:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546275644; cv=none; d=google.com; s=arc-20160816; b=A57V/6Cs9skWNqFdc4cWfQ3KIs3g/aCy/xJWX8mBMrRLbEcyldtWG+vDvlw6s05sVD yweIXi/l6+stPXK16XLwuckIxKcjyVhchhYzAvVfMKdg0DuSNWCzeAWcL2aR/khbrNlQ 4cZzS4VS0Hmq6D6AqrFVdftha26+9mF7r7D98HK8Id4qaiz58eMP+iHiwy7t+hvLZjiE +puJyCjd6TGWfTIlV/XiGWsRyEqX9knc66mVSw9lRyPCCzpe5xhA5UrhjlILDk6nL99x IYe3sIbJN3+RvdmdZG+nac8D3cXP3Tr9chhGHZmsf9+KqtB1L05R/AFhOE/gKP5hZwD6 kXZA== 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=jDJW03J73u0DhIM3iyuY6JLw4LehdOSXPTPp9UY6D+k=; b=GQSN1cWORUIgCLZtdGIxd53v4imKcGfYItzG4vViXIiseDAYwTFgESA3R8Xuc+e7lP 2qds6WzjBhun420BYy+c40BeH4DRdOQRC0WnjQw94GSVofnB/IN7IQv7KiZ/e6lOKHl6 3WMntVNcEHV+69sAwFI0eBp1ITlhrFruki7UwZEZBLKgaJ3snEHTAB52eGuB81sGogHi iX5XaAQzJ9DTjSopkadltl/WVDrwbcT0B16Mi3hHzCoiSZ/1yC8xM3QNz9kbC6sfGMuG s8GFLNack/zox4yXXF5VxoGQ9vcRJq3OfcdsOVgBJWW6JoqgOAMZOocmngrpKkZYJCFu NMXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=dACt+SJD; 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 o81sor14577440pfk.52.2018.12.31.09.00.44 for (Google Transport Security); Mon, 31 Dec 2018 09:00:44 -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:509b:: with SMTP id g27mr38926917pfj.48.1546275644674; Mon, 31 Dec 2018 09:00:44 -0800 (PST) Received: from localhost.localdomain ([115.97.184.237]) by smtp.gmail.com with ESMTPSA id p7sm90692925pfj.72.2018.12.31.09.00.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Dec 2018 09:00:43 -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 05/26] clk: sunxi: Add Allwinner A10s/A13 CLK driver Date: Mon, 31 Dec 2018 22:29:06 +0530 Message-Id: <20181231165927.13803-6-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=dACt+SJD; 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 A10s/A13. - Implement USB ahb and USB clocks via ccu_clk_gate table for A10s/A13, so it can accessed in common clk enable and disable functions from clk_sunxi.c - Implement USB resets via ccu_reset table for A10s/A13, 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_a10s.c | 56 ++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 drivers/clk/sunxi/clk_a10s.c diff --git a/drivers/clk/sunxi/Kconfig b/drivers/clk/sunxi/Kconfig index fbbf94ef55..b228c2fa3a 100644 --- a/drivers/clk/sunxi/Kconfig +++ b/drivers/clk/sunxi/Kconfig @@ -16,6 +16,13 @@ config CLK_SUN4I_A10 This enables common clock driver support for platforms based on Allwinner A10/A20 SoC. +config CLK_SUN5I_A10S + bool "Clock driver for Allwinner A10s/A13" + default MACH_SUN5I + help + This enables common clock driver support for platforms based + on Allwinner A10s/A13 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 bba830922f..466d4b79d6 100644 --- a/drivers/clk/sunxi/Makefile +++ b/drivers/clk/sunxi/Makefile @@ -7,5 +7,6 @@ obj-$(CONFIG_CLK_SUNXI) += clk_sunxi.o obj-$(CONFIG_CLK_SUN4I_A10) += clk_a10.o +obj-$(CONFIG_CLK_SUN5I_A10S) += clk_a10s.o obj-$(CONFIG_CLK_SUN8I_H3) += clk_h3.o obj-$(CONFIG_CLK_SUN50I_A64) += clk_a64.o diff --git a/drivers/clk/sunxi/clk_a10s.c b/drivers/clk/sunxi/clk_a10s.c new file mode 100644 index 0000000000..474f37d607 --- /dev/null +++ b/drivers/clk/sunxi/clk_a10s.c @@ -0,0 +1,56 @@ +// 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 a10s_gates[] = { + [CLK_AHB_OTG] = GATE(0x060, BIT(0)), + [CLK_AHB_EHCI] = GATE(0x060, BIT(1)), + [CLK_AHB_OHCI] = GATE(0x060, BIT(2)), + + [CLK_USB_OHCI] = GATE(0x0cc, BIT(6)), + [CLK_USB_PHY0] = GATE(0x0cc, BIT(8)), + [CLK_USB_PHY1] = GATE(0x0cc, BIT(9)), +}; + +static struct ccu_reset a10s_resets[] = { + [RST_USB_PHY0] = RESET(0x0cc, BIT(0)), + [RST_USB_PHY1] = RESET(0x0cc, BIT(1)), +}; + +static const struct ccu_desc a10s_ccu_desc = { + .gates = a10s_gates, + .resets = a10s_resets, +}; + +static int a10s_clk_bind(struct udevice *dev) +{ + return sunxi_reset_bind(dev, 10); +} + +static const struct udevice_id a10s_ccu_ids[] = { + { .compatible = "allwinner,sun5i-a10s-ccu", + .data = (ulong)&a10s_ccu_desc }, + { .compatible = "allwinner,sun5i-a13-ccu", + .data = (ulong)&a10s_ccu_desc }, + { } +}; + +U_BOOT_DRIVER(clk_sun5i_a10s) = { + .name = "sun5i_a10s_ccu", + .id = UCLASS_CLK, + .of_match = a10s_ccu_ids, + .priv_auto_alloc_size = sizeof(struct ccu_priv), + .ops = &sunxi_clk_ops, + .probe = sunxi_clk_probe, + .bind = a10s_clk_bind, +};