From patchwork Wed Jan 4 11:48:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoyou Xie X-Patchwork-Id: 89821 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp8450212qgi; Wed, 4 Jan 2017 03:50:10 -0800 (PST) X-Received: by 10.84.232.140 with SMTP id i12mr110358039plk.15.1483530610081; Wed, 04 Jan 2017 03:50:10 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x14si41801010pff.62.2017.01.04.03.50.09; Wed, 04 Jan 2017 03:50:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; 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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967242AbdADLt7 (ORCPT + 7 others); Wed, 4 Jan 2017 06:49:59 -0500 Received: from mail-pf0-f170.google.com ([209.85.192.170]:33823 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967056AbdADLt4 (ORCPT ); Wed, 4 Jan 2017 06:49:56 -0500 Received: by mail-pf0-f170.google.com with SMTP id 127so2483058pfg.1 for ; Wed, 04 Jan 2017 03:49:56 -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=ouH+VOu2EVcZbw2Q+6+UsZfcvyqZU3ED2GY/EEZbfyQ=; b=ehko1OKU7ZWE2fB1IjnQi0X2tmf53NP8n9xy77VXHEkztDwDHv3LaGfIR7xEu8q9OP tXyj2prKd8FcrKaeRGyR17GC8QzbI5xF0MRxwtoz/KFp/bixKYxItO0+u/oUMXyog9Av pUO3IfsrRQ9xPSlwe0QmJBmpq0ZUfA/VgoFTE= 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=ouH+VOu2EVcZbw2Q+6+UsZfcvyqZU3ED2GY/EEZbfyQ=; b=mVXaL8OZvuDO6+2L8CGciLlso9xAo4A29WhIXF4KeMNVpO9Q/hYP+BrtpKt5Y2Bupk QuK9E0LfEoAaPwUwZ8o6ZDn/mQFtkLprKrkWEDcKCClKZ0kI93GQviN7YjA5qHvxI8Pz cQpKQaQQLh6JlIf50/IvXV4wVWlXFMs1AYU566K3vJhk3ih3oATA1wkm2r7ktqTjo7tN zWxe+23ALauyUueIk4JgQmtn1pJoNzt1oiRSkFC0Iqst1xQzK8LOAaOr1a1bU7q+ElCn wNUj0FIGxfgcScpriEi6MEmWS/nTXgMIp/mUGFgZXZT7RYBVMuT4HFxpqirVn0qWxtda U/QA== X-Gm-Message-State: AIkVDXLKXhc9hzgistJPdcN/nOazP1haaidnRyu5oKtj8+6z4st81UcADYhPbl5VTt55f/Q+ X-Received: by 10.99.38.198 with SMTP id m189mr119214026pgm.140.1483530590857; Wed, 04 Jan 2017 03:49:50 -0800 (PST) Received: from localhost.localdomain ([104.237.91.189]) by smtp.gmail.com with ESMTPSA id c15sm146600084pfd.36.2017.01.04.03.49.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Jan 2017 03:49:50 -0800 (PST) From: Baoyou Xie To: jun.nie@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, krzk@kernel.org, arnd@arndb.de, ulf.hansson@linaro.org, amitdanielk@gmail.com, claudiu.manoil@nxp.com, yangbo.lu@nxp.com, pankaj.dubey@samsung.com, geert+renesas@glider.be, laurent.pinchart@ideasonboard.com Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, shawnguo@kernel.org, baoyou.xie@linaro.org, xie.baoyou@zte.com.cn, chen.chaokai@zte.com.cn, wang.qiang01@zte.com.cn Subject: [PATCH v6 5/5] soc: zte: pm_domains: Add support for zx296718 Date: Wed, 4 Jan 2017 19:48:14 +0800 Message-Id: <1483530494-14177-5-git-send-email-baoyou.xie@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483530494-14177-1-git-send-email-baoyou.xie@linaro.org> References: <1483530494-14177-1-git-send-email-baoyou.xie@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch introduces the power domain driver of zx296718 which belongs to zte's zx2967 family. Signed-off-by: Baoyou Xie Reviewed-by: Jun Nie --- drivers/soc/zte/Makefile | 1 + drivers/soc/zte/zx296718_pm_domains.c | 181 ++++++++++++++++++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 drivers/soc/zte/zx296718_pm_domains.c -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/soc/zte/Makefile b/drivers/soc/zte/Makefile index 8a37f2f..96b7cd4 100644 --- a/drivers/soc/zte/Makefile +++ b/drivers/soc/zte/Makefile @@ -2,3 +2,4 @@ # ZTE SOC drivers # obj-$(CONFIG_ZX2967_PM_DOMAINS) += zx2967_pm_domains.o +obj-$(CONFIG_ZX2967_PM_DOMAINS) += 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..52003ee --- /dev/null +++ b/drivers/soc/zte/zx296718_pm_domains.c @@ -0,0 +1,181 @@ +/* + * 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", + }, + .bit = PCU_DM_VOU, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; + +static struct zx2967_pm_domain sappu_domain = { + .dm = { + .name = "sappu_domain", + }, + .bit = PCU_DM_SAPPU, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; + +static struct zx2967_pm_domain vde_domain = { + .dm = { + .name = "vde_domain", + }, + .bit = PCU_DM_VDE, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; + +static struct zx2967_pm_domain vce_domain = { + .dm = { + .name = "vce_domain", + }, + .bit = PCU_DM_VCE, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; + +static struct zx2967_pm_domain hde_domain = { + .dm = { + .name = "hde_domain", + }, + .bit = PCU_DM_HDE, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; + +static struct zx2967_pm_domain viu_domain = { + .dm = { + .name = "viu_domain", + }, + .bit = PCU_DM_VIU, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; + +static struct zx2967_pm_domain usb20_domain = { + .dm = { + .name = "usb20_domain", + }, + .bit = PCU_DM_USB20, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; + +static struct zx2967_pm_domain usb21_domain = { + .dm = { + .name = "usb21_domain", + }, + .bit = PCU_DM_USB21, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; + +static struct zx2967_pm_domain usb30_domain = { + .dm = { + .name = "usb30_domain", + }, + .bit = PCU_DM_USB30, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; + +static struct zx2967_pm_domain hsic_domain = { + .dm = { + .name = "hsic_domain", + }, + .bit = PCU_DM_HSIC, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; + +static struct zx2967_pm_domain gmac_domain = { + .dm = { + .name = "gmac_domain", + }, + .bit = PCU_DM_GMAC, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; + +static struct zx2967_pm_domain ts_domain = { + .dm = { + .name = "ts_domain", + }, + .bit = PCU_DM_TS, + .polarity = PWREN, + .reg_offset = zx296718_offsets, +}; + +static 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);