From patchwork Thu Jan 10 18:40:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1023156 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="nbuw9aYK"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43bFRd3NQ3z9sCh for ; Fri, 11 Jan 2019 05:50:05 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id E34FDC22118; Thu, 10 Jan 2019 18:48:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C648EC22133; Thu, 10 Jan 2019 18:44:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 556A6C220F5; Thu, 10 Jan 2019 18:44:12 +0000 (UTC) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by lists.denx.de (Postfix) with ESMTPS id 6F6BAC2210C for ; Thu, 10 Jan 2019 18:44:02 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id e11so5556237plt.11 for ; Thu, 10 Jan 2019 10:44:02 -0800 (PST) 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; bh=pYPymASeViyBtpOsDEVjgfVoVNowhfc3LGpzBHpJM58=; b=nbuw9aYK/j2xhE+orMrRudBDPx5bSb/A/oRP69EYXOhQkYJYWVuYN9vJIZkRY/WvBZ dT3jTGZQPoO3T8n+ENHfJcsK+51JtmXR6mwknegk1fXx7DUR18a9o2Az5ayF+q3P6zM0 RZGhJZ8LMMeRttslGJ/rMUy0Cs1/JKjDKEueA= 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; bh=pYPymASeViyBtpOsDEVjgfVoVNowhfc3LGpzBHpJM58=; b=hEbjokVksiUmiNyI+K2tI0CGMQODqwrLmuUMKchozKQhmVEQCYk0GovL61/SFJkSA7 k86kjXFYpMGWb3lqrpm3mSIljUrgUdC57MJPOI0FlpuX3ildHhkWFFbxzlThqfJaxwU8 WbUm/NtAQ+YHVBxhZBJK0LhxP2+aFTzmooAwna5ATE6YPazxOSaGjgePIYEL8ACcufmo Vyfr3ZIlw+LICrBe1zmTMim4ngaCCkKHMWpUTAmYKMJxn3X8xK64ylRKjkVr8aYpUhie +mijKl05qQAzjcPYIPLFOauRQ3O1emGfsTSloHHmhTKDRieRQeyXrnBNlHqQz6iWyc7+ NDTg== X-Gm-Message-State: AJcUukcfjJvxq0iXXushgNOz9o5p8n+4qlJ1b017Q50LsoX++BNIciOV TgiHRkSp2AVUb0xcpLjAq4PgVA== X-Google-Smtp-Source: ALg8bN6A7BV6XOV29eROHA8C9O9iwR13DS6rJgSJhzQu2AN1c7fjahfX9kYkyC+ZKlQkp/xbndN3tQ== X-Received: by 2002:a17:902:780a:: with SMTP id p10mr11730936pll.54.1547145840954; Thu, 10 Jan 2019 10:44:00 -0800 (PST) Received: from localhost.localdomain ([49.206.202.55]) by smtp.gmail.com with ESMTPSA id t90sm156370546pfj.23.2019.01.10.10.43.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 10:44:00 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Andre Przywara , Chen-Yu Tsai , Simon Glass , Tom Rini , u-boot@lists.denx.de, linux-sunxi@googlegroups.com, Michael Trimarchi , linux-amarula@amarulasolutions.com Date: Fri, 11 Jan 2019 00:10:01 +0530 Message-Id: <20190110184016.17027-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190110184016.17027-1-jagan@amarulasolutions.com> References: <20190110184016.17027-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Subject: [U-Boot] [PATCH v6 05/20] clk: sunxi: Add Allwinner A10s/A13 CLK driver X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" 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..bf91018fc2 --- /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, ARRAY_SIZE(a10s_resets)); +} + +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, +};