Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751451AbcLED1O (ORCPT ); Sun, 4 Dec 2016 22:27:14 -0500 Received: from mail-qk0-f179.google.com ([209.85.220.179]:34869 "EHLO mail-qk0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751120AbcLED1L (ORCPT ); Sun, 4 Dec 2016 22:27:11 -0500 MIME-Version: 1.0 In-Reply-To: <1480774291-6211-2-git-send-email-baoyou.xie@linaro.org> References: <1480774291-6211-1-git-send-email-baoyou.xie@linaro.org> <1480774291-6211-2-git-send-email-baoyou.xie@linaro.org> From: Jun Nie Date: Mon, 5 Dec 2016 11:27:09 +0800 Message-ID: Subject: Re: [PATCH 2/2] soc: zte: pm_domains: Add support for zx296718 driver To: Baoyou Xie Cc: Greg KH , davem@davemloft.net, geert+renesas@glider.be, akpm@linux-foundation.org, mchehab@kernel.org, linux@roeck-us.net, Ulf Hansson , Arnd Bergmann , oss@buserror.net, krzk@kernel.org, qiang.zhao@nxp.com, aar@pengutronix.de, claudiu.manoil@nxp.com, pankaj.dubey@samsung.com, Florian Fainelli , yangbo.lu@nxp.com, scott.branden@broadcom.com, rmk+kernel@armlinux.org.uk, Linux Kernel Mailing List , linux-arm-kernel@lists.infradead.org, "xie.baoyou" , chen.chaokai@zte.com.cn, wang.qiang01@zte.com.cn Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6632 Lines: 211 2016-12-03 22:11 GMT+08:00 Baoyou Xie : > 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 | 3 + > drivers/soc/zte/zx296718_pm_domains.c | 162 ++++++++++++++++++++++++++++++++++ > 2 files changed, 165 insertions(+) > create mode 100644 drivers/soc/zte/zx296718_pm_domains.c > > diff --git a/drivers/soc/zte/Makefile b/drivers/soc/zte/Makefile > index 97ac8ea..a6e7bfe 100644 > --- a/drivers/soc/zte/Makefile > +++ b/drivers/soc/zte/Makefile > @@ -2,3 +2,6 @@ > # zx SOC drivers > # > obj-$(CONFIG_ZX_PM_DOMAINS) += pm_domains.o > +ifeq ($(CONFIG_ZX_PM_DOMAINS), y) > + obj-y += zx296718_pm_domains.o > +endif Follow unified style for Makefile: obj-$(CONFIG_ZX_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..fc16dfd > --- /dev/null > +++ b/drivers/soc/zte/zx296718_pm_domains.c > @@ -0,0 +1,162 @@ > +/* > + * Copyright (C) 2015 ZTE Ltd. > + * > + * Author: Baoyou Xie > + * License terms: GNU General Public License (GPL) version 2 > + */ > +#include "pm_domains.h" > + > +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, > +}; > +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, > +}; > +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, > +}; > +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, > +}; > +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, > +}; > + > +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, > +}; > +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, > +}; > +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, > +}; > +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, > +}; > +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, > +}; > +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, > +}; > +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, > +}; > +struct generic_pm_domain *zx296718_pm_domains[] = { > + //&vou_domain.dm, Remove this line. > + &sappu_domain.dm, If you can add an index and add the index definition in devicetree header file, it will be more convenient when binding power domain to device in DT file. such as [ZX296718_PM_VDE] = &vde_domain.dm, > + &vde_domain.dm, > + &vce_domain.dm, > + &hde_domain.dm, > + &viu_domain.dm, > + &usb20_domain.dm, > + &usb21_domain.dm, > + &usb30_domain.dm, > + &hsic_domain.dm, > + &gmac_domain.dm, > + &ts_domain.dm, > + &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", }, Suggest to rename probe function and of_device_id to a generic zx name, then add compatible data so that probe function can be shared. Probe function can find SoC specific data via comparing compatible string and initialize device accordingly. > + { }, > +}; > + > +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); > -- > 2.7.4 >