linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jun Nie <jun.nie@linaro.org>
To: Baoyou Xie <baoyou.xie@linaro.org>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	davem@davemloft.net, geert+renesas@glider.be,
	akpm@linux-foundation.org, mchehab@kernel.org,
	linux@roeck-us.net, Ulf Hansson <ulf.hansson@linaro.org>,
	Arnd Bergmann <arnd@arndb.de>,
	oss@buserror.net, krzk@kernel.org, qiang.zhao@nxp.com,
	aar@pengutronix.de, claudiu.manoil@nxp.com,
	pankaj.dubey@samsung.com, Florian Fainelli <f.fainelli@gmail.com>,
	yangbo.lu@nxp.com, scott.branden@broadcom.com,
	rmk+kernel@armlinux.org.uk,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	"xie.baoyou" <xie.baoyou@zte.com.cn>,
	chen.chaokai@zte.com.cn, wang.qiang01@zte.com.cn
Subject: Re: [PATCH 2/2] soc: zte: pm_domains: Add support for zx296718 driver
Date: Mon, 5 Dec 2016 11:27:09 +0800	[thread overview]
Message-ID: <CABymUCPuA-wwEcF8XZVpPpFOkgqOJ7Zs_DyXsBSXY6hRPDX5WA@mail.gmail.com> (raw)
In-Reply-To: <1480774291-6211-2-git-send-email-baoyou.xie@linaro.org>

2016-12-03 22:11 GMT+08:00 Baoyou Xie <baoyou.xie@linaro.org>:
> This patch introduces the power domain driver of zx296718
> which belongs to zte's 2967 family.
>
> Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
> ---
>  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 <baoyou.xie@linaro.org>
> + * 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
>

  reply	other threads:[~2016-12-05  3:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-03 14:11 [PATCH 1/2] soc: zte: pm_domains: Prepare for supporting ARMv8 2967 family Baoyou Xie
2016-12-03 14:11 ` [PATCH 2/2] soc: zte: pm_domains: Add support for zx296718 driver Baoyou Xie
2016-12-05  3:27   ` Jun Nie [this message]
2016-12-05  3:15 ` [PATCH 1/2] soc: zte: pm_domains: Prepare for supporting ARMv8 2967 family Jun Nie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABymUCPuA-wwEcF8XZVpPpFOkgqOJ7Zs_DyXsBSXY6hRPDX5WA@mail.gmail.com \
    --to=jun.nie@linaro.org \
    --cc=aar@pengutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=baoyou.xie@linaro.org \
    --cc=chen.chaokai@zte.com.cn \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mchehab@kernel.org \
    --cc=oss@buserror.net \
    --cc=pankaj.dubey@samsung.com \
    --cc=qiang.zhao@nxp.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=scott.branden@broadcom.com \
    --cc=ulf.hansson@linaro.org \
    --cc=wang.qiang01@zte.com.cn \
    --cc=xie.baoyou@zte.com.cn \
    --cc=yangbo.lu@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).