From patchwork Wed Jan 4 00:19:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoyou Xie X-Patchwork-Id: 89754 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp8257630qgi; Tue, 3 Jan 2017 16:23:56 -0800 (PST) X-Received: by 10.98.70.74 with SMTP id t71mr60723986pfa.47.1483489436667; Tue, 03 Jan 2017 16:23:56 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id i13si70465398pgp.325.2017.01.03.16.23.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jan 2017 16:23:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cOZM5-0001ul-AY; Wed, 04 Jan 2017 00:23:01 +0000 Received: from mail-pg0-x22d.google.com ([2607:f8b0:400e:c05::22d]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cOZLu-0001oA-EL for linux-arm-kernel@lists.infradead.org; Wed, 04 Jan 2017 00:22:52 +0000 Received: by mail-pg0-x22d.google.com with SMTP id f188so220054566pgc.3 for ; Tue, 03 Jan 2017 16:22:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sT7tURiZI+UwkgKj4MMB5OF+4BoBR/PUK0A7d2k+t8s=; b=aHq253EfCWHNn4b0xkF+fuofALuLVbSKgLnej4yj/xRqEAURbS/vP/lrwgvJxu/U7j 4tqvFm7gouaPRIglaDzedgo957O7EEvobATKbN9/PAB1HLzfAE2r0V333/fqGdeMGPG8 h7ze72ID3gBD59Dhi1Sm3+KzX2mmGRkbYTjHQ= 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; bh=sT7tURiZI+UwkgKj4MMB5OF+4BoBR/PUK0A7d2k+t8s=; b=r9EEXD1hoRPo86PZlinKvvblGVSUrZaHEZ26KTtFWCP/ZSeUEu/E9GdjcfHmHrj2w4 th/d7HJloFfkN7DAOoIuaOzjMUqPXD8G4GDvxS8CYlhKYD/TIynQ6++ZEt/SwC3khGCg KyxKEBcqwU9gGA6QHrC6KbV2i69RmcCpGxeMyQqe8HGp8H09rSDBENvAm6KRwz0J/Rie 1IgKYGs86Ik4FcO9IyD650YPOiZNfhX7nUQFcvavd4t5ss0GD7QiRqD72BW5OUvU+R0H W33JoK7b/eotV8hjwDhbOroDuxBBFCQEpb2ExT3TE7qrNabwo8EKHfuVZDOm50ppOAIl Lf5g== X-Gm-Message-State: AIkVDXI3fud4P2fXJk3PiXkFX2TjkXsYZ3APvtpv+FLE/p5byDNpOWf1Kol5LwN45lwdQfbS X-Received: by 10.99.181.76 with SMTP id u12mr119763606pgo.64.1483489349358; Tue, 03 Jan 2017 16:22:29 -0800 (PST) Received: from localhost.localdomain ([104.237.91.58]) by smtp.gmail.com with ESMTPSA id 186sm142418741pfv.61.2017.01.03.16.22.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Jan 2017 16:22:28 -0800 (PST) From: Baoyou Xie To: jun.nie@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, gregkh@linuxfoundation.org, davem@davemloft.net, geert+renesas@glider.be, akpm@linux-foundation.org, mchehab@kernel.org, linux@roeck-us.net, krzk@kernel.org, arnd@arndb.de, linus.walleij@linaro.org, pankaj.dubey@samsung.com, yangbo.lu@nxp.com, f.fainelli@gmail.com, claudiu.manoil@nxp.com, laurent.pinchart+renesas@ideasonboard.com Subject: [PATCH v5 3/4] soc: zte: pm_domains: Add support for zx296718 board Date: Wed, 4 Jan 2017 08:19:16 +0800 Message-Id: <1483489157-10782-3-git-send-email-baoyou.xie@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483489157-10782-1-git-send-email-baoyou.xie@linaro.org> References: <1483489157-10782-1-git-send-email-baoyou.xie@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170103_162250_627802_659E104A X-CRM114-Status: GOOD ( 14.64 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400e:c05:0:0:0:22d listed in] [list.dnswl.org] 0.0 HK_RANDOM_ENVFROM Envelope sender username looks random 0.0 HK_RANDOM_FROM From username looks random -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, xie.baoyou@zte.com.cn, linux-kernel@vger.kernel.org, chen.chaokai@zte.com.cn, wang.qiang01@zte.com.cn, baoyou.xie@linaro.org, shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org This patch introduces the power domain driver of zx296718 which belongs to zte's zx2967 family. Signed-off-by: Baoyou Xie Reviewed-by: Shawn Guo Reviewed-by: Jun Nie --- drivers/soc/zte/Makefile | 2 +- drivers/soc/zte/zx296718_pm_domains.c | 194 ++++++++++++++++++++++++++++++++++ 2 files changed, 195 insertions(+), 1 deletion(-) create mode 100644 drivers/soc/zte/zx296718_pm_domains.c -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/soc/zte/Makefile b/drivers/soc/zte/Makefile index 8a37f2f..f399553 100644 --- a/drivers/soc/zte/Makefile +++ b/drivers/soc/zte/Makefile @@ -1,4 +1,4 @@ # # ZTE SOC drivers # -obj-$(CONFIG_ZX2967_PM_DOMAINS) += zx2967_pm_domains.o +obj-$(CONFIG_ZX2967_PM_DOMAINS) += zx2967_pm_domains.o zx296718_pm_domains.o diff --git a/drivers/soc/zte/zx296718_pm_domains.c b/drivers/soc/zte/zx296718_pm_domains.c new file mode 100644 index 0000000..626e6ce --- /dev/null +++ b/drivers/soc/zte/zx296718_pm_domains.c @@ -0,0 +1,194 @@ +/* + * Copyright (C) 2017 ZTE Ltd. + * + * Author: Baoyou Xie + * License terms: GNU General Public License (GPL) version 2 + */ +#include +#include "zx2967_pm_domains.h" + +static u16 zx296718_offsets[REG_ARRAY_SIZE] = { + [REG_CLKEN] = 0x18, + [REG_ISOEN] = 0x1c, + [REG_RSTEN] = 0x20, + [REG_PWREN] = 0x24, + [REG_ACK_SYNC] = 0x28, +}; + +enum { + PCU_DM_VOU = 0, + PCU_DM_SAPPU, + PCU_DM_VDE, + PCU_DM_VCE, + PCU_DM_HDE, + PCU_DM_VIU, + PCU_DM_USB20, + PCU_DM_USB21, + PCU_DM_USB30, + PCU_DM_HSIC, + PCU_DM_GMAC, + PCU_DM_TS, +}; + +static struct zx2967_pm_domain vou_domain = { + .dm = { + .name = "vou_domain", + .power_off = zx2967_power_off, + .power_on = zx2967_power_on, + }, + .bit = PCU_DM_VOU, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx2967_pm_domain sappu_domain = { + .dm = { + .name = "sappu_domain", + .power_off = zx2967_power_off, + .power_on = zx2967_power_on, + }, + .bit = PCU_DM_SAPPU, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx2967_pm_domain vde_domain = { + .dm = { + .name = "vde_domain", + .power_off = zx2967_power_off, + .power_on = zx2967_power_on, + }, + .bit = PCU_DM_VDE, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx2967_pm_domain vce_domain = { + .dm = { + .name = "vce_domain", + .power_off = zx2967_power_off, + .power_on = zx2967_power_on, + }, + .bit = PCU_DM_VCE, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx2967_pm_domain hde_domain = { + .dm = { + .name = "hde_domain", + .power_off = zx2967_power_off, + .power_on = zx2967_power_on, + }, + .bit = PCU_DM_HDE, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; + +static struct zx2967_pm_domain viu_domain = { + .dm = { + .name = "viu_domain", + .power_off = zx2967_power_off, + .power_on = zx2967_power_on, + }, + .bit = PCU_DM_VIU, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx2967_pm_domain usb20_domain = { + .dm = { + .name = "usb20_domain", + .power_off = zx2967_power_off, + .power_on = zx2967_power_on, + }, + .bit = PCU_DM_USB20, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx2967_pm_domain usb21_domain = { + .dm = { + .name = "usb21_domain", + .power_off = zx2967_power_off, + .power_on = zx2967_power_on, + }, + .bit = PCU_DM_USB21, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx2967_pm_domain usb30_domain = { + .dm = { + .name = "usb30_domain", + .power_off = zx2967_power_off, + .power_on = zx2967_power_on, + }, + .bit = PCU_DM_USB30, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx2967_pm_domain hsic_domain = { + .dm = { + .name = "hsic_domain", + .power_off = zx2967_power_off, + .power_on = zx2967_power_on, + }, + .bit = PCU_DM_HSIC, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx2967_pm_domain gmac_domain = { + .dm = { + .name = "gmac_domain", + .power_off = zx2967_power_off, + .power_on = zx2967_power_on, + }, + .bit = PCU_DM_GMAC, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx2967_pm_domain ts_domain = { + .dm = { + .name = "ts_domain", + .power_off = zx2967_power_off, + .power_on = zx2967_power_on, + }, + .bit = PCU_DM_TS, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +struct generic_pm_domain *zx296718_pm_domains[] = { + [DM_ZX296718_SAPPU] = &sappu_domain.dm, + [DM_ZX296718_VDE] = &vde_domain.dm, + [DM_ZX296718_VCE] = &vce_domain.dm, + [DM_ZX296718_HDE] = &hde_domain.dm, + [DM_ZX296718_VIU] = &viu_domain.dm, + [DM_ZX296718_USB20] = &usb20_domain.dm, + [DM_ZX296718_USB21] = &usb21_domain.dm, + [DM_ZX296718_USB30] = &usb30_domain.dm, + [DM_ZX296718_HSIC] = &hsic_domain.dm, + [DM_ZX296718_GMAC] = &gmac_domain.dm, + [DM_ZX296718_TS] = &ts_domain.dm, + [DM_ZX296718_VOU] = &vou_domain.dm, +}; + +static int zx296718_pd_probe(struct platform_device *pdev) +{ + return zx2967_pd_probe(pdev, + zx296718_pm_domains, + ARRAY_SIZE(zx296718_pm_domains)); +} + +static const struct of_device_id zx296718_pm_domain_matches[] = { + { .compatible = "zte,zx296718-pcu", }, + { }, +}; + +static struct platform_driver zx296718_pd_driver = { + .driver = { + .name = "zx-powerdomain", + .owner = THIS_MODULE, + .of_match_table = zx296718_pm_domain_matches, + }, + .probe = zx296718_pd_probe, +}; + +static int __init zx296718_pd_init(void) +{ + return platform_driver_register(&zx296718_pd_driver); +} +subsys_initcall(zx296718_pd_init);