configs: opos6uldev: undef CONFIG_POWER_DOMAIN when SPL_BUILD
PATCH 1/4 configs: opos6uldev: undef CONFIG_POWER_DOMAIN when SPL_BUILD
Because CONFIG_POWER_DOMAIN is enabled in defconfig, however driver/power/domain is not built for SPL, there is build failure when power_domain_on added to device_probe. Because power domain is not needed in SPL, let's undef it.
---
Need to find a way to avoid SPL build failure in future patch, but in this patchset let's undef CONFIG_POWER_DOMAIN first, because it is not needed.
include/configs/opos6uldev.h | 1 + 1 file changed, 1 insertion(+)
include/configs/opos6uldev.h +1 -0
@@ -15,6 +15,7 @@#ifdef CONFIG_SPL_BUILD #undef CONFIG_DM_REGULATOR +#undef CONFIG_POWER_DOMAIN#endif #endif
Signature · 1 line
2.14.1
PATCH 2/4 power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined
Add dummy functions when CONFIG_POWER_DOMAIN not defined.
--- include/power-domain.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
include/power-domain.h +28 -0
@@ -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. */ +#ifdef CONFIG_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. */ +#ifdef CONFIG_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. */ +#ifdef CONFIG_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. */ +#ifdef CONFIG_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
Signature · 1 line
2.14.1
PATCH 3/4 dm: core: device: enable power domain in probe
In reply to Peng FanEnable power domain associated with the device when probe.
--- drivers/core/device.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/core/device.c +7 -0
@@ -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;
Signature · 1 line
2.14.1
PATCH 4/4 dm: power-domain: query power domain after get device
In reply to Peng FanThis 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.
--- test/dm/power-domain.c | 2 ++ 1 file changed, 2 insertions(+)
test/dm/power-domain.c +2 -0
@@ -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));
Signature · 1 line
2.14.1
PATCH 1/4 configs: opos6uldev: undef CONFIG_POWER_DOMAIN when SPL_BUILD
In reply to Peng FanHi Peng,
Quoted 8 lines · Peng Fan
Because
CONFIG_POWER_DOMAINis enabled in defconfig, however driver/power/domain is not built for SPL, there is build failure whenpower_domain_onadded todevice_probe. Because power domain is not needed in SPL, let's undef it.Signed-off-by Peng Fan <[email protected]>Cc "Sébastien Szymanski" <[email protected]>Cc Stefano Babic <[email protected]>
Quoted 8 lines
---
Need to find a way to avoid SPL build failure in future patch, but in this patchset let's undef
CONFIG_POWER_DOMAINfirst, because it is not needed.include/configs/opos6uldev.h | 1 + 1 file changed, 1 insertion(+)
This should be handled by adding an SPL_POWER_DOMAIN option and converting existing uses to CONFIG_IS_ENABLED(POWER_DOMAIN)
Regards,
Simon
PATCH 2/4 power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined
In reply to Peng FanHi Peng,
Quoted 13 lines · Peng Fan
Add dummy functions when
CONFIG_POWER_DOMAINnot defined.Signed-off-by Peng Fan <[email protected]>Reviewed-by Simon Glass <[email protected]>--- include/power-domain.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)include/power-domain.h +0
-0
include/power-domain.h struct power_domain { · line 95
Quoted 9 lines
include/power-domain.h +5
-0@@ -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. */ +#ifdef CONFIG_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 ;
Actually shouldn't this be -ENOSYS?
Quoted 50 lines
include/power-domain.h +23
-1+} +#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. */ +#ifdef CONFIG_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. */ +#ifdef CONFIG_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. */ +#ifdef CONFIG_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 --
Quoted 2 lines
2.14.1
Regards,
Simon
PATCH 3/4 dm: core: device: enable power domain in probe
In reply to Peng FanQuoted 7 lines · Peng Fan
Enable power domain associated with the device when probe.
Signed-off-by Peng Fan <[email protected]>Cc Simon Glass <[email protected]>--- drivers/core/device.c | 7 +++++++ 1 file changed, 7 insertions(+)
PATCH 4/4 dm: power-domain: query power domain after get device
In reply to Peng FanQuoted 10 lines · Peng Fan
This is to test
power_domain_onindevice_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 <[email protected]>Cc Simon Glass <[email protected]>--- test/dm/power-domain.c | 2 ++ 1 file changed, 2 insertions(+)
PATCH 1/4 configs: opos6uldev: undef CONFIG_POWER_DOMAIN when SPL_BUILD
In reply to Simon GlassHi Simon,
Quoted 27 lines
-----Original Message-----
From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
Sent: 2018年7月25日 10:46
To: Peng Fan <[email protected]>
Cc: U-Boot Mailing List <[email protected]>; dl-linux-imx <[email protected]>; Sébastien Szymanski <[email protected]>; Stefano Babic <[email protected]>
Subject: Re: [PATCH 1/4] configs: opos6uldev: undefCONFIG_POWER_DOMAINwhenSPL_BUILDHi Peng,
Quoted 14 lines · Peng Fan
Because
CONFIG_POWER_DOMAINis enabled in defconfig, however driver/power/domain is not built for SPL, there is build failure whenpower_domain_onadded todevice_probe.
Because power domain is not needed in SPL, let's undef it.Signed-off-by Peng Fan <[email protected]>Cc "Sébastien Szymanski" <[email protected]>Cc Stefano Babic <[email protected]>---
Need to find a way to avoid SPL build failure in future patch, but in this patchset let's undef
CONFIG_POWER_DOMAINfirst, because it is not needed.
Quoted 5 lines
Quoted 2 lines
include/configs/opos6uldev.h | 1 + 1 file changed, 1 insertion(+)This should be handled by adding an
SPL_POWER_DOMAINoption and converting existing uses toCONFIG_IS_ENABLED(POWER_DOMAIN)
The opos6uldev_defconfig has "CONFIG_POWER_DOMAIN=y", so when building
SPL, this macro is still effective.
Opos6uldev compiles driver/core/device.c which includes power-domain.h in my later patch. Because driver/power/domain is not built for SPL, so build failure for SPL.
The simple method for now is to undef CONFIG_POWER_DOMAIN for SPL build. If use CONFIG_IS_ENABLED, the undef CONFIG_POWER_DOMAIN will not be detected in Kconfig.
Simply introduce SPL_POWER_DOMAIN could not fix this issue. Need to let SPL choose CONFIG_SPL_POWER_DOMAIN, but not CONFIG_POWER_DOMAIN, I do not have a clear idea on how.
Thanks,
Peng.
Quoted 3 lines
Regards,
Simon
PATCH 1/4 configs: opos6uldev: undef CONFIG_POWER_DOMAIN when SPL_BUILD
Hi Peng,
Quoted 40 lines · Peng Fan
Hi Simon,
Quoted 27 lines
-----Original Message-----
From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
Sent: 2018年7月25日 10:46
To: Peng Fan <[email protected]>
Cc: U-Boot Mailing List <[email protected]>; dl-linux-imx <[email protected]>; Sébastien Szymanski <[email protected]>; Stefano Babic <[email protected]>
Subject: Re: [PATCH 1/4] configs: opos6uldev: undefCONFIG_POWER_DOMAINwhenSPL_BUILDHi Peng,
Quoted 14 lines · Peng Fan
Because
CONFIG_POWER_DOMAINis enabled in defconfig, however driver/power/domain is not built for SPL, there is build failure whenpower_domain_onadded todevice_probe.
Because power domain is not needed in SPL, let's undef it.Signed-off-by Peng Fan <[email protected]>Cc "Sébastien Szymanski" <[email protected]>Cc Stefano Babic <[email protected]>---
Need to find a way to avoid SPL build failure in future patch, but in this patchset let's undef
CONFIG_POWER_DOMAINfirst, because it is not needed.Quoted 5 lines
Quoted 2 lines
include/configs/opos6uldev.h | 1 + 1 file changed, 1 insertion(+)This should be handled by adding an
SPL_POWER_DOMAINoption and converting existing uses toCONFIG_IS_ENABLED(POWER_DOMAIN)The
opos6uldev_defconfighas "CONFIG_POWER_DOMAIN=y", so when building
SPL, this macro is still effective.
Opos6uldev compilesdriver/core/device.cwhich includespower-domain.hin my later patch. Because driver/power/domain is not built for SPL, so build failure for SPL.
Quoted 5 lines
The simple method for now is to undef
CONFIG_POWER_DOMAINfor SPL build. If useCONFIG_IS_ENABLED, the undefCONFIG_POWER_DOMAINwill not be detected inKconfig.Simply introduce
SPL_POWER_DOMAINcould not fix this issue. Need to let SPL chooseCONFIG_SPL_POWER_DOMAIN, but notCONFIG_POWER_DOMAIN, I do not have a clear idea on how.
Here's how it works:
1. Have two separate Kconfig options: CONFIG_POWER_DOMAIN and CONFIG_SPL_POWER_DOMAIN
2. Enable CONFIG_POWER_DOMAIN in the board config, but not CONFIG_SPL_POWER_DOMAIN
3. Use CONFIG_IS_ENABLED(POWER_DOMAIN) everywhere (with if() or #if)
4. Now, U-Boot proper will support POWER_DOMAIN, but SPL will not
The #undef mechanism is the old way of doing it, before we had CONFIG_IS_ENABLED
Regards,
Simon
PATCH 1/4 configs: opos6uldev: undef CONFIG_POWER_DOMAIN when SPL_BUILD
Hi Simon,
Quoted 28 lines
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
Need to find a way to avoid SPL build failure in future patch, but in this patchset let's undef
CONFIG_POWER_DOMAINfirst, because it is not needed.include/configs/opos6uldev.h | 1 + 1 file changed, 1 insertion(+)This should be handled by adding an
SPL_POWER_DOMAINoption and converting existing uses toCONFIG_IS_ENABLED(POWER_DOMAIN)The
opos6uldev_defconfighas "CONFIG_POWER_DOMAIN=y", so whenbuilding
Quoted 2 lines
SPL, this macro is still effective.
Opos6uldev compilesdriver/core/device.cwhich includespower-domain.hinmy later patch.
Quoted 3 lines
Because driver/power/domain is not built for SPL, so build failure for SPL.
The simple method for now is to undef
CONFIG_POWER_DOMAINfor SPLbuild.
Quoted 1 line
If use
CONFIG_IS_ENABLED, the undefCONFIG_POWER_DOMAINwill not bedetected in
Kconfig.Quoted 3 lines
Simply introduce
SPL_POWER_DOMAINcould not fix this issue. Need to let SPL chooseCONFIG_SPL_POWER_DOMAIN, but not
CONFIG_POWER_DOMAIN, I do not have a clear idea on how.Here's how it works:
Quoted 9 lines
1. Have two separate
Kconfigoptions:CONFIG_POWER_DOMAINandCONFIG_SPL_POWER_DOMAIN2. EnableCONFIG_POWER_DOMAINin the board config, but notCONFIG_SPL_POWER_DOMAIN3. UseCONFIG_IS_ENABLED(POWER_DOMAIN)everywhere (withif()or #if) 4. Now, U-Boot proper will supportPOWER_DOMAIN, but SPL will notThe #undef mechanism is the old way of doing it, before we had
CONFIG_IS_ENABLED
Just posted out V2 following your suggestion.
Thanks,
Peng.
Quoted 2 lines
Regards,
Simon