All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V2 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined
@ 2018-07-27  2:20 Peng Fan
  2018-07-27  2:20 ` [U-Boot] [PATCH V2 2/4] power: Add CONFIG_SPL_POWER_DOMAIN config Peng Fan
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Peng Fan @ 2018-07-27  2:20 UTC (permalink / raw)
  To: u-boot

Add dummy functions when CONFIG_POWER_DOMAIN not defined.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---

V2: Use CONFIG_IS_ENABLED

 include/power-domain.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/include/power-domain.h b/include/power-domain.h
index aba8c0f65c..2029b17c6f 100644
--- a/include/power-domain.h
+++ b/include/power-domain.h
@@ -87,7 +87,14 @@ struct power_domain {
  * @power_domain	A pointer to a power domain struct to initialize.
  * @return 0 if OK, or a negative error code.
  */
+#if CONFIG_IS_ENABLED(POWER_DOMAIN)
 int power_domain_get(struct udevice *dev, struct power_domain *power_domain);
+#else
+int power_domain_get(struct udevice *dev, struct power_domain *power_domain)
+{
+	return -EINVAL;
+}
+#endif
 
 /**
  * power_domain_free - Free a previously requested power domain.
@@ -96,7 +103,14 @@ int power_domain_get(struct udevice *dev, struct power_domain *power_domain);
  *		requested by power_domain_get().
  * @return 0 if OK, or a negative error code.
  */
+#if CONFIG_IS_ENABLED(POWER_DOMAIN)
 int power_domain_free(struct power_domain *power_domain);
+#else
+int power_domain_free(struct power_domain *power_domain)
+{
+	return -EINVAL;
+}
+#endif
 
 /**
  * power_domain_on - Enable power to a power domain.
@@ -105,7 +119,14 @@ int power_domain_free(struct power_domain *power_domain);
  *		requested by power_domain_get().
  * @return 0 if OK, or a negative error code.
  */
+#if CONFIG_IS_ENABLED(POWER_DOMAIN)
 int power_domain_on(struct power_domain *power_domain);
+#else
+int power_domain_on(struct power_domain *power_domain)
+{
+	return -EINVAL;
+}
+#endif
 
 /**
  * power_domain_off - Disable power ot a power domain.
@@ -114,6 +135,13 @@ int power_domain_on(struct power_domain *power_domain);
  *		requested by power_domain_get().
  * @return 0 if OK, or a negative error code.
  */
+#if CONFIG_IS_ENABLED(POWER_DOMAIN)
 int power_domain_off(struct power_domain *power_domain);
+#else
+int power_domain_off(struct power_domain *power_domain)
+{
+	return -EINVAL;
+}
+#endif
 
 #endif
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 2/4] power: Add CONFIG_SPL_POWER_DOMAIN config
  2018-07-27  2:20 [U-Boot] [PATCH V2 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined Peng Fan
@ 2018-07-27  2:20 ` Peng Fan
  2018-07-30 13:26   ` Simon Glass
  2018-08-06  9:10   ` Anatolij Gustschin
  2018-07-27  2:20 ` [U-Boot] [PATCH V2 3/4] dm: core: device: enable power domain in probe Peng Fan
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 12+ messages in thread
From: Peng Fan @ 2018-07-27  2:20 UTC (permalink / raw)
  To: u-boot

Add CONFIG_SPL_POWER_DOMAIN config entry.
Build drivers/power/domain if this config is selected.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Simon Glass <sjg@chromium.org>
---

V2: New

 common/spl/Kconfig            | 9 +++++++++
 drivers/Makefile              | 1 +
 drivers/power/domain/Makefile | 2 +-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 99c9053ab8..2bb1aeb630 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -599,6 +599,15 @@ config SPL_POWER_SUPPORT
 	  in drivers/power, drivers/power/pmic and drivers/power/regulator
 	  as part of an SPL build.
 
+config SPL_POWER_DOMAIN
+	bool "Support power domain drivers"
+	help
+	  Enable support for power domain control in SPL. Many SoCs allow
+	  power to be applied to or removed from portions of the SoC (power
+	  domains). This may be used to save power. This API provides the
+	  means to control such power management hardware. This enables
+	  the drivers in drivers/power/domain as part of a SPL build.
+
 config SPL_RAM_SUPPORT
 	bool "Support booting from RAM"
 	default y if MICROBLAZE || ARCH_SOCFPGA || TEGRA || ARCH_ZYNQ
diff --git a/drivers/Makefile b/drivers/Makefile
index 276e5ee4d7..d53208540e 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_ARMADA_XP) += ddr/marvell/axp/
 obj-$(CONFIG_ALTERA_SDRAM) += ddr/altera/
 obj-$(CONFIG_SPL_POWER_SUPPORT) += power/ power/pmic/
 obj-$(CONFIG_SPL_POWER_SUPPORT) += power/regulator/
+obj-$(CONFIG_SPL_POWER_DOMAIN) += power/domain/
 obj-$(CONFIG_SPL_DM_RESET) += reset/
 obj-$(CONFIG_SPL_MTD_SUPPORT) += mtd/
 obj-$(CONFIG_SPL_ONENAND_SUPPORT) += mtd/onenand/
diff --git a/drivers/power/domain/Makefile b/drivers/power/domain/Makefile
index c7d7644402..020eee2378 100644
--- a/drivers/power/domain/Makefile
+++ b/drivers/power/domain/Makefile
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: GPL-2.0
 
-obj-$(CONFIG_POWER_DOMAIN) += power-domain-uclass.o
+obj-$(CONFIG_$(SPL_)POWER_DOMAIN) += power-domain-uclass.o
 obj-$(CONFIG_BCM6328_POWER_DOMAIN) += bcm6328-power-domain.o
 obj-$(CONFIG_SANDBOX_POWER_DOMAIN) += sandbox-power-domain.o
 obj-$(CONFIG_SANDBOX_POWER_DOMAIN) += sandbox-power-domain-test.o
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 3/4] dm: core: device: enable power domain in probe
  2018-07-27  2:20 [U-Boot] [PATCH V2 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined Peng Fan
  2018-07-27  2:20 ` [U-Boot] [PATCH V2 2/4] power: Add CONFIG_SPL_POWER_DOMAIN config Peng Fan
@ 2018-07-27  2:20 ` Peng Fan
  2018-08-06  9:10   ` Anatolij Gustschin
  2018-07-27  2:20 ` [U-Boot] [PATCH V2 4/4] dm: power-domain: query power domain after get device Peng Fan
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Peng Fan @ 2018-07-27  2:20 UTC (permalink / raw)
  To: u-boot

Enable power domain associated with the device when probe.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

V2:
 Add review tag

 drivers/core/device.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index d5f5fc31b0..207d566b71 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -26,6 +26,7 @@
 #include <dm/util.h>
 #include <linux/err.h>
 #include <linux/list.h>
+#include <power-domain.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -304,6 +305,7 @@ static void *alloc_priv(int size, uint flags)
 
 int device_probe(struct udevice *dev)
 {
+	struct power_domain pd;
 	const struct driver *drv;
 	int size = 0;
 	int ret;
@@ -383,6 +385,11 @@ int device_probe(struct udevice *dev)
 	if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL)
 		pinctrl_select_state(dev, "default");
 
+	if (dev->parent && device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) {
+		if (!power_domain_get(dev, &pd))
+			power_domain_on(&pd);
+	}
+
 	ret = uclass_pre_probe_device(dev);
 	if (ret)
 		goto fail;
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 4/4] dm: power-domain: query power domain after get device
  2018-07-27  2:20 [U-Boot] [PATCH V2 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined Peng Fan
  2018-07-27  2:20 ` [U-Boot] [PATCH V2 2/4] power: Add CONFIG_SPL_POWER_DOMAIN config Peng Fan
  2018-07-27  2:20 ` [U-Boot] [PATCH V2 3/4] dm: core: device: enable power domain in probe Peng Fan
@ 2018-07-27  2:20 ` Peng Fan
  2018-08-06  9:11   ` Anatolij Gustschin
  2018-07-30 13:26 ` [U-Boot] [PATCH V2 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined Simon Glass
  2018-08-06  9:09 ` Anatolij Gustschin
  4 siblings, 1 reply; 12+ messages in thread
From: Peng Fan @ 2018-07-27  2:20 UTC (permalink / raw)
  To: u-boot

This is to test power_domain_on in device_probe.
If the device has a power-domain property, enable it
when probe the device. So add the test to check
whether it is powered on or not.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

V2: Add review tag

 test/dm/power-domain.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/test/dm/power-domain.c b/test/dm/power-domain.c
index a1e1df2bb2..48318218a9 100644
--- a/test/dm/power-domain.c
+++ b/test/dm/power-domain.c
@@ -26,6 +26,8 @@ static int dm_test_power_domain(struct unit_test_state *uts)
 
 	ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "power-domain-test",
 					      &dev_test));
+	ut_asserteq(1, sandbox_power_domain_query(dev_power_domain,
+						  TEST_POWER_DOMAIN));
 	ut_assertok(sandbox_power_domain_test_get(dev_test));
 
 	ut_assertok(sandbox_power_domain_test_on(dev_test));
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 2/4] power: Add CONFIG_SPL_POWER_DOMAIN config
  2018-07-27  2:20 ` [U-Boot] [PATCH V2 2/4] power: Add CONFIG_SPL_POWER_DOMAIN config Peng Fan
@ 2018-07-30 13:26   ` Simon Glass
  2018-08-06  9:10   ` Anatolij Gustschin
  1 sibling, 0 replies; 12+ messages in thread
From: Simon Glass @ 2018-07-30 13:26 UTC (permalink / raw)
  To: u-boot

On 26 July 2018 at 20:20, Peng Fan <peng.fan@nxp.com> wrote:
> Add CONFIG_SPL_POWER_DOMAIN config entry.
> Build drivers/power/domain if this config is selected.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>
> V2: New
>
>  common/spl/Kconfig            | 9 +++++++++
>  drivers/Makefile              | 1 +
>  drivers/power/domain/Makefile | 2 +-
>  3 files changed, 11 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined
  2018-07-27  2:20 [U-Boot] [PATCH V2 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined Peng Fan
                   ` (2 preceding siblings ...)
  2018-07-27  2:20 ` [U-Boot] [PATCH V2 4/4] dm: power-domain: query power domain after get device Peng Fan
@ 2018-07-30 13:26 ` Simon Glass
  2018-08-06  3:02   ` Peng Fan
  2018-08-06  9:09 ` Anatolij Gustschin
  4 siblings, 1 reply; 12+ messages in thread
From: Simon Glass @ 2018-07-30 13:26 UTC (permalink / raw)
  To: u-boot

On 26 July 2018 at 20:20, Peng Fan <peng.fan@nxp.com> wrote:
> Add dummy functions when CONFIG_POWER_DOMAIN not defined.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>
> V2: Use CONFIG_IS_ENABLED
>
>  include/power-domain.h | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined
  2018-07-30 13:26 ` [U-Boot] [PATCH V2 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined Simon Glass
@ 2018-08-06  3:02   ` Peng Fan
  0 siblings, 0 replies; 12+ messages in thread
From: Peng Fan @ 2018-08-06  3:02 UTC (permalink / raw)
  To: u-boot

Hi Simon, Jaehoon

Would you pick up this patchset?

https://patchwork.ozlabs.org/patch/949962/
https://patchwork.ozlabs.org/patch/949963/
https://patchwork.ozlabs.org/patch/949964/
https://patchwork.ozlabs.org/patch/949965/

Thanks,
Peng.

> -----Original Message-----
> From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
> Sent: 2018年7月30日 21:27
> To: Peng Fan <peng.fan@nxp.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>; U-Boot Mailing List
> <u-boot@lists.denx.de>; dl-linux-imx <linux-imx@nxp.com>
> Subject: Re: [PATCH V2 1/4] power-domain: add dummy functions when
> CONFIG_POWER_DOMAIN not defined
> 
> On 26 July 2018 at 20:20, Peng Fan <peng.fan@nxp.com> wrote:
> > Add dummy functions when CONFIG_POWER_DOMAIN not defined.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >
> > V2: Use CONFIG_IS_ENABLED
> >
> >  include/power-domain.h | 28 ++++++++++++++++++++++++++++
> >  1 file changed, 28 insertions(+)
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined
  2018-07-27  2:20 [U-Boot] [PATCH V2 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined Peng Fan
                   ` (3 preceding siblings ...)
  2018-07-30 13:26 ` [U-Boot] [PATCH V2 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined Simon Glass
@ 2018-08-06  9:09 ` Anatolij Gustschin
  2018-08-06 10:04   ` Anatolij Gustschin
  4 siblings, 1 reply; 12+ messages in thread
From: Anatolij Gustschin @ 2018-08-06  9:09 UTC (permalink / raw)
  To: u-boot

Hi Peng,

On Fri, 27 Jul 2018 10:20:36 +0800
Peng Fan peng.fan at nxp.com wrote:

> Add dummy functions when CONFIG_POWER_DOMAIN not defined.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> 
> V2: Use CONFIG_IS_ENABLED
> 
>  include/power-domain.h | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)

Applied to u-boot-staging/agust at denx.de, thanks!

--
Anatolij

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 2/4] power: Add CONFIG_SPL_POWER_DOMAIN config
  2018-07-27  2:20 ` [U-Boot] [PATCH V2 2/4] power: Add CONFIG_SPL_POWER_DOMAIN config Peng Fan
  2018-07-30 13:26   ` Simon Glass
@ 2018-08-06  9:10   ` Anatolij Gustschin
  1 sibling, 0 replies; 12+ messages in thread
From: Anatolij Gustschin @ 2018-08-06  9:10 UTC (permalink / raw)
  To: u-boot

On Fri, 27 Jul 2018 10:20:37 +0800
Peng Fan peng.fan at nxp.com wrote:

> Add CONFIG_SPL_POWER_DOMAIN config entry.
> Build drivers/power/domain if this config is selected.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
> 
> V2: New
> 
>  common/spl/Kconfig            | 9 +++++++++
>  drivers/Makefile              | 1 +
>  drivers/power/domain/Makefile | 2 +-
>  3 files changed, 11 insertions(+), 1 deletion(-)

Applied to u-boot-staging/agust at denx.de, thanks!

--
Anatolij

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 3/4] dm: core: device: enable power domain in probe
  2018-07-27  2:20 ` [U-Boot] [PATCH V2 3/4] dm: core: device: enable power domain in probe Peng Fan
@ 2018-08-06  9:10   ` Anatolij Gustschin
  0 siblings, 0 replies; 12+ messages in thread
From: Anatolij Gustschin @ 2018-08-06  9:10 UTC (permalink / raw)
  To: u-boot

On Fri, 27 Jul 2018 10:20:38 +0800
Peng Fan peng.fan at nxp.com wrote:

> Enable power domain associated with the device when probe.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> 
> V2:
>  Add review tag
> 
>  drivers/core/device.c | 7 +++++++
>  1 file changed, 7 insertions(+)

Applied to u-boot-staging/agust at denx.de, thanks!

--
Anatolij

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 4/4] dm: power-domain: query power domain after get device
  2018-07-27  2:20 ` [U-Boot] [PATCH V2 4/4] dm: power-domain: query power domain after get device Peng Fan
@ 2018-08-06  9:11   ` Anatolij Gustschin
  0 siblings, 0 replies; 12+ messages in thread
From: Anatolij Gustschin @ 2018-08-06  9:11 UTC (permalink / raw)
  To: u-boot

On Fri, 27 Jul 2018 10:20:39 +0800
Peng Fan peng.fan at nxp.com wrote:

> This is to test power_domain_on in device_probe.
> If the device has a power-domain property, enable it
> when probe the device. So add the test to check
> whether it is powered on or not.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> 
> V2: Add review tag
> 
>  test/dm/power-domain.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied to u-boot-staging/agust at denx.de, thanks!

--
Anatolij

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined
  2018-08-06  9:09 ` Anatolij Gustschin
@ 2018-08-06 10:04   ` Anatolij Gustschin
  0 siblings, 0 replies; 12+ messages in thread
From: Anatolij Gustschin @ 2018-08-06 10:04 UTC (permalink / raw)
  To: u-boot

On Mon, 6 Aug 2018 11:09:27 +0200
Anatolij Gustschin agust at denx.de wrote:
...
> Applied to u-boot-staging/agust at denx.de, thanks!

Dropped, it breaks building.

--
Anatolij

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-08-06 10:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-27  2:20 [U-Boot] [PATCH V2 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined Peng Fan
2018-07-27  2:20 ` [U-Boot] [PATCH V2 2/4] power: Add CONFIG_SPL_POWER_DOMAIN config Peng Fan
2018-07-30 13:26   ` Simon Glass
2018-08-06  9:10   ` Anatolij Gustschin
2018-07-27  2:20 ` [U-Boot] [PATCH V2 3/4] dm: core: device: enable power domain in probe Peng Fan
2018-08-06  9:10   ` Anatolij Gustschin
2018-07-27  2:20 ` [U-Boot] [PATCH V2 4/4] dm: power-domain: query power domain after get device Peng Fan
2018-08-06  9:11   ` Anatolij Gustschin
2018-07-30 13:26 ` [U-Boot] [PATCH V2 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined Simon Glass
2018-08-06  3:02   ` Peng Fan
2018-08-06  9:09 ` Anatolij Gustschin
2018-08-06 10:04   ` Anatolij Gustschin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.