From patchwork Mon Dec 31 16:59:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 123 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f198.google.com (cartago.priv [10.11.12.1]) by cassiopea.amarulasolutions.com (Postfix) with ESMTPS id 9B7BD2E002E for ; Mon, 31 Dec 2018 18:01:08 +0100 (CET) Received: by mail-pg1-f198.google.com with SMTP id d3sf24455618pgv.23 for ; Mon, 31 Dec 2018 09:01:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1546275667; cv=pass; d=google.com; s=arc-20160816; b=d44AiIthg2otKdTODkKWDVUs6VfFGjrtr/k+KJNqKE9/wO9/5a7Bu9Z8ND2EhnG6vD HewYM+fKfJjfm1blQ+LDxWHjNylIGD8pWxZlNThrMtN5B+SluiWxSDKxFIeogWnRfm1s FDBWPv1hi3aQWLN6uEUhVASA643kU3L5cUFa722I//kvEnPRU0uxVRrRIQpdI37RVGAz s++njcqpnxvmADaqZhaHVY1av6DQwwh+s+chJGrpTHpHdybg5/iSUBZDknTWYs+hmM9o G7dtaJXkZrYcWVjyy4fI8CvyEDUrH0uJNOsM7OJf1bSV/BDlsHeKQtxsKawv5A5MusEo zO2g== 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=6Ml5VeUxATIu3tfMeXukoyo9JNCYxiqiBQFC99chBcQ=; b=ld0Zv7udbC+qttkBIjsEk0vgX6UbgMVV2kgVrLWsp3+ItI0IJhinciDvsKNLMT377p V1aL8vovwRg3RfU2sN4wQblpmvWG65qbKAr1r/p2YvNslHNktYEeF6LRtuERimDj9eY/ MhAjnqk/4JsFHIhS9ySu7wLbb5MIwDDfdazu0Uyt0uFNxXpeD1Apfje17IpeW+k9Ey+T LAItXx7riBUQ6BYtcjsLX7Vmse+NqZnD4Stt/5j93s8qThAEAcM4hA3WK62SyXVJ7DoV WOjzVeTvCVwnC2V4uBajXbJCrfAyWdCD3ZJfWS3RLb7QOkBpKn0hRh7td+Nab3DiIcP4 8TvA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=dBfip6yn; 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=6Ml5VeUxATIu3tfMeXukoyo9JNCYxiqiBQFC99chBcQ=; b=doQuZiyc0wVUxqwdgKjVzS86KtN+xVtMAANYWEHJGQ8mzBZDoEsDQYqZOff0N8YqVI T2pP+VnjDcUd3RxWEcoTw6gNE3IMUeSj3YQkTGgl0gfRlgGKH377CF8yvFAoqBrOXPve Wq+o6Ey4m2dWNa6TB03z/WoaQF8u9Ln1cfySI= 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=6Ml5VeUxATIu3tfMeXukoyo9JNCYxiqiBQFC99chBcQ=; b=kcWue9p1y8pHyrdGDK13dJWjXnWfiqz50d30vqtYsXisN4zSk2HBnrpS4XDzqouUIj dnUb8vF+dR6zXmzplfFDPCQe+pC9x3WMpteOF9BDFz2q+B5zi89PwABk91LQ3vi4fNcH Lvmp+UDUghf1k72nQYbDWIeG5Mf0H3TWO6s6+QvuS3uBS8O5k8rYW4IhSMYzfePaCNJY SiTTdRTbw/0NXcRa4do0YdlRTuInuZ66C7bAkmc/VHdzAsQ36pj42BxJPO16IPpOa2WA 2wqPq8Bf7yNJQvK4Tz91hNw5lXIiAsgzZcpoa278Sv16wTHyPM1skjIuk7n+GqrNYBd1 uPuQ== X-Gm-Message-State: AJcUukcHDNiLMt+MpyMIs3aj+Hj1J/kJLtPJ2VRC3TrH/S07qQ2HfF47 FiP5SGTXN+FjL9ETOLSQgFqx0BpV X-Google-Smtp-Source: ALg8bN5BhBdNUnTkb+WPMwqMXI5XWXy/O6TDxlElrUXfBRwct7UJ4B6iAyZU6R/qhSn53AqNM9LXDw== X-Received: by 2002:a17:902:2bcb:: with SMTP id l69mr14269982plb.98.1546275667257; Mon, 31 Dec 2018 09:01:07 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a62:124f:: with SMTP id a76ls12648521pfj.1.gmail; Mon, 31 Dec 2018 09:01:07 -0800 (PST) X-Received: by 2002:a65:500c:: with SMTP id f12mr7991886pgo.226.1546275666912; Mon, 31 Dec 2018 09:01:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546275666; cv=none; d=google.com; s=arc-20160816; b=OKl4yUQ/0r7og81fgdV+KswyiODM9lS/6Jsxdtr4rjWAhjJN7fknlO7s04bwgaJvtu F+MWvivz4UYlqvVPwfl7qDb8jr01ET3Zplc8gW4ak8ZXhPV7n5n0zow4aaKPA8IEYdOc LNKjSUxM4kdnQVcjBB8Q52iWJ8a1vvq1GIY+uuKjV4ebRYPe90mEi8NPFfbIwpXhjr3s 0lEByb7UuZ2Hhg/K2IxIUh1Vb5eo1S88KpjoHArrurPK/dmHEy+xDl0S7USb5XGrujHy xysbOT2U3/FCAxhegOj9xpeMlkL0suVEY9H1Kz8KzmaZoznVWN3f9MeZvXMTbeZ2BmHa +QnA== 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=6Ml5VeUxATIu3tfMeXukoyo9JNCYxiqiBQFC99chBcQ=; b=Yhv805T9fr4dRR5DFXqr2Cbi9SqRiRAnQNyZ3JPJWj0JTYiUmnpauSncfqqHszX7Cw 8sbntldHt5quFwZ5lOgWYCyTCtbGXvC857oeVY+1o4nVPFmHGQk69jurhmutmZA+UFkF VOjeN1yoeIGQIwUJJS25HFp7vGD577RSeJ3OdM5bWVW9dGSsHLG6ScqinMAjfp8JlLEA xNnYnYa2qT/BhAGFLynbYr6OrWMf43yFWFSIBSxvgMnvQrFtlD0cB7q26115oZGZNEre eYJZk0YXxYJHxPiAt8NqoL8ULzrhZ4MQEUcoFnfidktwrCig0++YTwmFTjbEYXowY2dx dhrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=dBfip6yn; 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 y78sor14261911pfk.45.2018.12.31.09.01.06 for (Google Transport Security); Mon, 31 Dec 2018 09:01:06 -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:5793:: with SMTP id i19mr38906912pfj.49.1546275666577; Mon, 31 Dec 2018 09:01:06 -0800 (PST) Received: from localhost.localdomain ([115.97.184.237]) by smtp.gmail.com with ESMTPSA id p7sm90692925pfj.72.2018.12.31.09.01.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Dec 2018 09:01:06 -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 08/26] clk: sunxi: Add Allwinner A83T CLK driver Date: Mon, 31 Dec 2018 22:29:09 +0530 Message-Id: <20181231165927.13803-9-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=dBfip6yn; 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 A83T. - Implement USB bus and USB clocks via ccu_clk_gate table for A83T, 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 A83T, 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_a83t.c | 63 ++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 drivers/clk/sunxi/clk_a83t.c diff --git a/drivers/clk/sunxi/Kconfig b/drivers/clk/sunxi/Kconfig index 38ff99d345..90af70d171 100644 --- a/drivers/clk/sunxi/Kconfig +++ b/drivers/clk/sunxi/Kconfig @@ -37,6 +37,13 @@ config CLK_SUN8I_A23 This enables common clock driver support for platforms based on Allwinner A23/A33 SoC. +config CLK_SUN8I_A83T + bool "Clock driver for Allwinner A83T" + default MACH_SUN8I_A83T + help + This enables common clock driver support for platforms based + on Allwinner A83T 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 6924897036..4a254c8671 100644 --- a/drivers/clk/sunxi/Makefile +++ b/drivers/clk/sunxi/Makefile @@ -10,5 +10,6 @@ obj-$(CONFIG_CLK_SUN4I_A10) += clk_a10.o obj-$(CONFIG_CLK_SUN5I_A10S) += clk_a10s.o 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_H3) += clk_h3.o obj-$(CONFIG_CLK_SUN50I_A64) += clk_a64.o diff --git a/drivers/clk/sunxi/clk_a83t.c b/drivers/clk/sunxi/clk_a83t.c new file mode 100644 index 0000000000..45faef2f11 --- /dev/null +++ b/drivers/clk/sunxi/clk_a83t.c @@ -0,0 +1,63 @@ +// 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 a83t_gates[] = { + [CLK_BUS_OTG] = GATE(0x060, BIT(24)), + [CLK_BUS_EHCI0] = GATE(0x060, BIT(26)), + [CLK_BUS_EHCI1] = GATE(0x060, BIT(27)), + [CLK_BUS_OHCI0] = GATE(0x060, BIT(29)), + + [CLK_USB_PHY0] = GATE(0x0cc, BIT(8)), + [CLK_USB_PHY1] = GATE(0x0cc, BIT(9)), + [CLK_USB_HSIC] = GATE(0x0cc, BIT(10)), + [CLK_USB_HSIC_12M] = GATE(0x0cc, BIT(11)), + [CLK_USB_OHCI0] = GATE(0x0cc, BIT(16)), +}; + +static struct ccu_reset a83t_resets[] = { + [RST_USB_PHY0] = RESET(0x0cc, BIT(0)), + [RST_USB_PHY1] = RESET(0x0cc, BIT(1)), + [RST_USB_HSIC] = RESET(0x0cc, BIT(2)), + + [RST_BUS_OTG] = RESET(0x2c0, BIT(24)), + [RST_BUS_EHCI0] = RESET(0x2c0, BIT(26)), + [RST_BUS_EHCI1] = RESET(0x2c0, BIT(27)), + [RST_BUS_OHCI0] = RESET(0x2c0, BIT(29)), +}; + +static const struct ccu_desc a83t_ccu_desc = { + .gates = a83t_gates, + .resets = a83t_resets, +}; + +static int a83t_clk_bind(struct udevice *dev) +{ + return sunxi_reset_bind(dev, 44); +} + +static const struct udevice_id a83t_clk_ids[] = { + { .compatible = "allwinner,sun8i-a83t-ccu", + .data = (ulong)&a83t_ccu_desc }, + { } +}; + +U_BOOT_DRIVER(clk_sun8i_a83t) = { + .name = "sun8i_a83t_ccu", + .id = UCLASS_CLK, + .of_match = a83t_clk_ids, + .priv_auto_alloc_size = sizeof(struct ccu_priv), + .ops = &sunxi_clk_ops, + .probe = sunxi_clk_probe, + .bind = a83t_clk_bind, +};