From patchwork Wed Dec 7 06:13:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoyou Xie X-Patchwork-Id: 86969 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp162168qgi; Tue, 6 Dec 2016 22:14:48 -0800 (PST) X-Received: by 10.84.173.195 with SMTP id p61mr144300158plb.158.1481091288574; Tue, 06 Dec 2016 22:14:48 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a36si22855353pli.228.2016.12.06.22.14.48; Tue, 06 Dec 2016 22:14:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752569AbcLGGO3 (ORCPT + 25 others); Wed, 7 Dec 2016 01:14:29 -0500 Received: from mail-pf0-f180.google.com ([209.85.192.180]:33194 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751152AbcLGGO0 (ORCPT ); Wed, 7 Dec 2016 01:14:26 -0500 Received: by mail-pf0-f180.google.com with SMTP id d2so75256619pfd.0 for ; Tue, 06 Dec 2016 22:14:26 -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=wNFt/iAqOL/hHozLJimBWOU8CmTgXWVBOoolnUMuNaU=; b=A04VWcd6DerwMnhis5neTJXx0/A9ee5UzhEYFwpvtOIpu6co6WJsl5QXgOVofdS4mx RRpV9vRdbczonRg3HkzG0Guo8bZm0rftUfBKS38f6R2hpMCz2NviuO0jlTioc4th3QqK O3kC42pRQD/1lVvz86yJbrr1rkCB9ZzfL14Yk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wNFt/iAqOL/hHozLJimBWOU8CmTgXWVBOoolnUMuNaU=; b=Xwde6zO4Q7znH3VVwAmT4yXMSqtLDGEF5V0o2R7bDR7Tma+4I/zrUOKgQAe1WteHad W51FCkqyGQCKvF7v6oHMAiU9A/shVa4+casNYKH4QOH6KWaTUxGZf0Mpwj9xDYgzPrg7 fYLvz9eoPcRRB3ZAE7gFwx532eiPPrke9xCZTn4Y4UJ3cd2xYXVJlO52/AT2kuFIsWD3 duLdt7tc1rkySZ5E7wbOPNdSz6IrsEZO3hvEfvaWWbXTzsRkOTcv5nZruQOpizGmSTMG r3XTkYsLiU5noZ01hhlJ/0NO4fiTntjOHyP41RKU0OX36KC5vAPK9FfrhLsiKU0McNjH dNDg== X-Gm-Message-State: AKaTC01RWmV2pdR+ksgaPewxgWD/Xa0p+/HAztcTnuiUojEhVsZqbepA7C2pMs2va43uVcgY X-Received: by 10.99.178.6 with SMTP id x6mr118350020pge.63.1481091265334; Tue, 06 Dec 2016 22:14:25 -0800 (PST) Received: from localhost.localdomain ([171.214.159.137]) by smtp.gmail.com with ESMTPSA id p14sm6471624pfl.74.2016.12.06.22.14.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Dec 2016 22:14:24 -0800 (PST) From: Baoyou Xie To: jun.nie@linaro.org, baoyou.xie@linaro.org, gregkh@linuxfoundation.org, davem@davemloft.net, geert+renesas@glider.be, akpm@linux-foundation.org, mchehab@kernel.org, linux@roeck-us.net, ulf.hansson@linaro.org, krzk@kernel.org, oss@buserror.net, arnd@arndb.de, amitdanielk@gmail.com, aar@pengutronix.de, f.fainelli@gmail.com, qiang.zhao@nxp.com, claudiu.manoil@nxp.com, pankaj.dubey@samsung.com, yangbo.lu@nxp.com, scott.branden@broadcom.com, rmk+kernel@armlinux.org.uk Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, shawnguo@kernel.org, xie.baoyou@zte.com.cn, chen.chaokai@zte.com.cn, wang.qiang01@zte.com.cn Subject: [PATCH v3 2/3] soc: zte: pm_domains: Add support for zx296718 board Date: Wed, 7 Dec 2016 14:13:23 +0800 Message-Id: <1481091204-6559-2-git-send-email-baoyou.xie@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481091204-6559-1-git-send-email-baoyou.xie@linaro.org> References: <1481091204-6559-1-git-send-email-baoyou.xie@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch introduces the power domain driver of zx296718 which belongs to zte's 2967 family. Signed-off-by: Baoyou Xie --- 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 diff --git a/drivers/soc/zte/Makefile b/drivers/soc/zte/Makefile index 97ac8ea..2d2a2cc 100644 --- a/drivers/soc/zte/Makefile +++ b/drivers/soc/zte/Makefile @@ -1,4 +1,4 @@ # # zx SOC drivers # -obj-$(CONFIG_ZX_PM_DOMAINS) += pm_domains.o +obj-$(CONFIG_ZX_PM_DOMAINS) += 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..5355b94 --- /dev/null +++ b/drivers/soc/zte/zx296718_pm_domains.c @@ -0,0 +1,194 @@ +/* + * Copyright (C) 2015 ZTE Ltd. + * + * Author: Baoyou Xie + * License terms: GNU General Public License (GPL) version 2 + */ +#include +#include "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 zx_pm_domain vou_domain = { + .dm = { + .name = "vou_domain", + .power_off = zx_normal_power_off, + .power_on = zx_normal_power_on, + }, + .bit = PCU_DM_VOU, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx_pm_domain sappu_domain = { + .dm = { + .name = "sappu_domain", + .power_off = zx_normal_power_off, + .power_on = zx_normal_power_on, + }, + .bit = PCU_DM_SAPPU, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx_pm_domain vde_domain = { + .dm = { + .name = "vde_domain", + .power_off = zx_normal_power_off, + .power_on = zx_normal_power_on, + }, + .bit = PCU_DM_VDE, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx_pm_domain vce_domain = { + .dm = { + .name = "vce_domain", + .power_off = zx_normal_power_off, + .power_on = zx_normal_power_on, + }, + .bit = PCU_DM_VCE, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx_pm_domain hde_domain = { + .dm = { + .name = "hde_domain", + .power_off = zx_normal_power_off, + .power_on = zx_normal_power_on, + }, + .bit = PCU_DM_HDE, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; + +static struct zx_pm_domain viu_domain = { + .dm = { + .name = "viu_domain", + .power_off = zx_normal_power_off, + .power_on = zx_normal_power_on, + }, + .bit = PCU_DM_VIU, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx_pm_domain usb20_domain = { + .dm = { + .name = "usb20_domain", + .power_off = zx_normal_power_off, + .power_on = zx_normal_power_on, + }, + .bit = PCU_DM_USB20, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx_pm_domain usb21_domain = { + .dm = { + .name = "usb21_domain", + .power_off = zx_normal_power_off, + .power_on = zx_normal_power_on, + }, + .bit = PCU_DM_USB21, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx_pm_domain usb30_domain = { + .dm = { + .name = "usb30_domain", + .power_off = zx_normal_power_off, + .power_on = zx_normal_power_on, + }, + .bit = PCU_DM_USB30, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx_pm_domain hsic_domain = { + .dm = { + .name = "hsic_domain", + .power_off = zx_normal_power_off, + .power_on = zx_normal_power_on, + }, + .bit = PCU_DM_HSIC, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx_pm_domain gmac_domain = { + .dm = { + .name = "gmac_domain", + .power_off = zx_normal_power_off, + .power_on = zx_normal_power_on, + }, + .bit = PCU_DM_GMAC, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; +static struct zx_pm_domain ts_domain = { + .dm = { + .name = "ts_domain", + .power_off = zx_normal_power_off, + .power_on = zx_normal_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 zx_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);