diff mbox

[7/7] ARM: EXYNOS: Remove code for restart and poweroff for exynos SoCs

Message ID 1445234635-3950-8-git-send-email-alim.akhtar@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alim Akhtar Oct. 19, 2015, 6:03 a.m. UTC
Now we can use the generic syscon-{reboot/poweroff} drivers,
so we don't need special handling for reboot/poweroff in
exynos pmu driver. This patch remove the same.

Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
---
 arch/arm/mach-exynos/pmu.c |   43 -------------------------------------------
 1 file changed, 43 deletions(-)

Comments

Krzysztof Kozlowski Oct. 19, 2015, 7 a.m. UTC | #1
On 19.10.2015 15:03, Alim Akhtar wrote:
> Now we can use the generic syscon-{reboot/poweroff} drivers,
> so we don't need special handling for reboot/poweroff in
> exynos pmu driver. This patch remove the same.
> 
> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
> ---
>  arch/arm/mach-exynos/pmu.c |   43 -------------------------------------------
>  1 file changed, 43 deletions(-)

I think that removal of this stuff will effectively remove the
restart/poweroff handlers from:
1. Other defconfigs, like multi_v7
2. Custom configs.

Previously this code was always compiled in for ARCH_EXYNOS. Now it is
not so I am thinking about selecting necessary drivers from main exynos
Kconfig symbol. That could be tricky though, because "select" should be
used only for non-visible symbols.

Any ideas how to solve that?

Best regards,
Krzysztof

> 
> diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
> index de68938ee6aa..393c04aa727e 100644
> --- a/arch/arm/mach-exynos/pmu.c
> +++ b/arch/arm/mach-exynos/pmu.c
> @@ -14,9 +14,6 @@
>  #include <linux/of_address.h>
>  #include <linux/platform_device.h>
>  #include <linux/delay.h>
> -#include <linux/notifier.h>
> -#include <linux/reboot.h>
> -
>  
>  #include "exynos-pmu.h"
>  #include "regs-pmu.h"
> @@ -681,23 +678,6 @@ static unsigned int const exynos5420_list_disable_pmu_reg[] = {
>  	EXYNOS5420_CMU_RESET_FSYS_SYS_PWR_REG,
>  };
>  
> -static void exynos_power_off(void)
> -{
> -	unsigned int tmp;
> -
> -	pr_info("Power down.\n");
> -	tmp = pmu_raw_readl(EXYNOS_PS_HOLD_CONTROL);
> -	tmp ^= (1 << 8);
> -	pmu_raw_writel(tmp, EXYNOS_PS_HOLD_CONTROL);
> -
> -	/* Wait a little so we don't give a false warning below */
> -	mdelay(100);
> -
> -	pr_err("Power down failed, please power off system manually.\n");
> -	while (1)
> -		;
> -}
> -
>  static void exynos5420_powerdown_conf(enum sys_powerdown mode)
>  {
>  	u32 this_cluster;
> @@ -875,14 +855,6 @@ static void exynos5420_pmu_init(void)
>  	pr_info("EXYNOS5420 PMU initialized\n");
>  }
>  
> -static int pmu_restart_notify(struct notifier_block *this,
> -		unsigned long code, void *unused)
> -{
> -	pmu_raw_writel(0x1, EXYNOS_SWRESET);
> -
> -	return NOTIFY_DONE;
> -}
> -
>  static const struct exynos_pmu_data exynos3250_pmu_data = {
>  	.pmu_config	= exynos3250_pmu_config,
>  	.pmu_init	= exynos3250_pmu_init,
> @@ -940,20 +912,11 @@ static const struct of_device_id exynos_pmu_of_device_ids[] = {
>  	{ /*sentinel*/ },
>  };
>  
> -/*
> - * Exynos PMU restart notifier, handles restart functionality
> - */
> -static struct notifier_block pmu_restart_handler = {
> -	.notifier_call = pmu_restart_notify,
> -	.priority = 128,
> -};
> -
>  static int exynos_pmu_probe(struct platform_device *pdev)
>  {
>  	const struct of_device_id *match;
>  	struct device *dev = &pdev->dev;
>  	struct resource *res;
> -	int ret;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	pmu_base_addr = devm_ioremap_resource(dev, res);
> @@ -978,12 +941,6 @@ static int exynos_pmu_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, pmu_context);
>  
> -	ret = register_restart_handler(&pmu_restart_handler);
> -	if (ret)
> -		dev_warn(dev, "can't register restart handler err=%d\n", ret);
> -
> -	pm_power_off = exynos_power_off;
> -
>  	dev_dbg(dev, "Exynos PMU Driver probe done\n");
>  	return 0;
>  }
>
Alim Akhtar Oct. 19, 2015, 8:27 a.m. UTC | #2
Hello Krzysztof,

On 10/19/2015 12:30 PM, Krzysztof Kozlowski wrote:
> On 19.10.2015 15:03, Alim Akhtar wrote:
>> Now we can use the generic syscon-{reboot/poweroff} drivers,
>> so we don't need special handling for reboot/poweroff in
>> exynos pmu driver. This patch remove the same.
>>
>> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
>> ---
>>   arch/arm/mach-exynos/pmu.c |   43 -------------------------------------------
>>   1 file changed, 43 deletions(-)
>
> I think that removal of this stuff will effectively remove the
> restart/poweroff handlers from:
> 1. Other defconfigs, like multi_v7
> 2. Custom configs.
>
Well, I did have a plan to enable it on multi_v7
Not sure about other custom configs, if there are some, they should also 
enable it I feel.

> Previously this code was always compiled in for ARCH_EXYNOS. Now it is
> not so I am thinking about selecting necessary drivers from main exynos
> Kconfig symbol. That could be tricky though, because "select" should be
> used only for non-visible symbols.
>
Probably adding these to mach-exynos/Kconfig as a "select" will do.

> Any ideas how to solve that?
>
> Best regards,
> Krzysztof
>
>>
>> diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
>> index de68938ee6aa..393c04aa727e 100644
>> --- a/arch/arm/mach-exynos/pmu.c
>> +++ b/arch/arm/mach-exynos/pmu.c
>> @@ -14,9 +14,6 @@
>>   #include <linux/of_address.h>
>>   #include <linux/platform_device.h>
>>   #include <linux/delay.h>
>> -#include <linux/notifier.h>
>> -#include <linux/reboot.h>
>> -
>>
>>   #include "exynos-pmu.h"
>>   #include "regs-pmu.h"
>> @@ -681,23 +678,6 @@ static unsigned int const exynos5420_list_disable_pmu_reg[] = {
>>   	EXYNOS5420_CMU_RESET_FSYS_SYS_PWR_REG,
>>   };
>>
>> -static void exynos_power_off(void)
>> -{
>> -	unsigned int tmp;
>> -
>> -	pr_info("Power down.\n");
>> -	tmp = pmu_raw_readl(EXYNOS_PS_HOLD_CONTROL);
>> -	tmp ^= (1 << 8);
>> -	pmu_raw_writel(tmp, EXYNOS_PS_HOLD_CONTROL);
>> -
>> -	/* Wait a little so we don't give a false warning below */
>> -	mdelay(100);
>> -
>> -	pr_err("Power down failed, please power off system manually.\n");
>> -	while (1)
>> -		;
>> -}
>> -
>>   static void exynos5420_powerdown_conf(enum sys_powerdown mode)
>>   {
>>   	u32 this_cluster;
>> @@ -875,14 +855,6 @@ static void exynos5420_pmu_init(void)
>>   	pr_info("EXYNOS5420 PMU initialized\n");
>>   }
>>
>> -static int pmu_restart_notify(struct notifier_block *this,
>> -		unsigned long code, void *unused)
>> -{
>> -	pmu_raw_writel(0x1, EXYNOS_SWRESET);
>> -
>> -	return NOTIFY_DONE;
>> -}
>> -
>>   static const struct exynos_pmu_data exynos3250_pmu_data = {
>>   	.pmu_config	= exynos3250_pmu_config,
>>   	.pmu_init	= exynos3250_pmu_init,
>> @@ -940,20 +912,11 @@ static const struct of_device_id exynos_pmu_of_device_ids[] = {
>>   	{ /*sentinel*/ },
>>   };
>>
>> -/*
>> - * Exynos PMU restart notifier, handles restart functionality
>> - */
>> -static struct notifier_block pmu_restart_handler = {
>> -	.notifier_call = pmu_restart_notify,
>> -	.priority = 128,
>> -};
>> -
>>   static int exynos_pmu_probe(struct platform_device *pdev)
>>   {
>>   	const struct of_device_id *match;
>>   	struct device *dev = &pdev->dev;
>>   	struct resource *res;
>> -	int ret;
>>
>>   	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>   	pmu_base_addr = devm_ioremap_resource(dev, res);
>> @@ -978,12 +941,6 @@ static int exynos_pmu_probe(struct platform_device *pdev)
>>
>>   	platform_set_drvdata(pdev, pmu_context);
>>
>> -	ret = register_restart_handler(&pmu_restart_handler);
>> -	if (ret)
>> -		dev_warn(dev, "can't register restart handler err=%d\n", ret);
>> -
>> -	pm_power_off = exynos_power_off;
>> -
>>   	dev_dbg(dev, "Exynos PMU Driver probe done\n");
>>   	return 0;
>>   }
>>
>
>
Javier Martinez Canillas Oct. 19, 2015, 9:56 a.m. UTC | #3
Hello,

On 10/19/2015 09:00 AM, Krzysztof Kozlowski wrote:
> On 19.10.2015 15:03, Alim Akhtar wrote:
>> Now we can use the generic syscon-{reboot/poweroff} drivers,
>> so we don't need special handling for reboot/poweroff in
>> exynos pmu driver. This patch remove the same.
>>
>> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
>> ---
>>  arch/arm/mach-exynos/pmu.c |   43 -------------------------------------------
>>  1 file changed, 43 deletions(-)
> 
> I think that removal of this stuff will effectively remove the
> restart/poweroff handlers from:
> 1. Other defconfigs, like multi_v7
> 2. Custom configs.
>

This will also break old DTBs that don't have a "syscon-poweroff" device
node that contains the necessary PMU regmap, offset and mask information.
 
> Previously this code was always compiled in for ARCH_EXYNOS. Now it is
> not so I am thinking about selecting necessary drivers from main exynos
> Kconfig symbol. That could be tricky though, because "select" should be
> used only for non-visible symbols.
> 
> Any ideas how to solve that?
>

Is true that select should only be used for non-visible symbols but there
are others user visible symbols that are selected by ARCH_EXYNOS such as
EXYNOS_THERMAL. So I think selecting the regmap syscon reset stuff there
is a sensible option.
 
> Best regards,
> Krzysztof
>

Best regards,
Alim Akhtar Oct. 19, 2015, 10:23 a.m. UTC | #4
On 10/19/2015 03:26 PM, Javier Martinez Canillas wrote:
> Hello,
>
> On 10/19/2015 09:00 AM, Krzysztof Kozlowski wrote:
>> On 19.10.2015 15:03, Alim Akhtar wrote:
>>> Now we can use the generic syscon-{reboot/poweroff} drivers,
>>> so we don't need special handling for reboot/poweroff in
>>> exynos pmu driver. This patch remove the same.
>>>
>>> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
>>> ---
>>>   arch/arm/mach-exynos/pmu.c |   43 -------------------------------------------
>>>   1 file changed, 43 deletions(-)
>>
>> I think that removal of this stuff will effectively remove the
>> restart/poweroff handlers from:
>> 1. Other defconfigs, like multi_v7
>> 2. Custom configs.
>>
>
> This will also break old DTBs that don't have a "syscon-poweroff" device
> node that contains the necessary PMU regmap, offset and mask information.
>
>> Previously this code was always compiled in for ARCH_EXYNOS. Now it is
>> not so I am thinking about selecting necessary drivers from main exynos
>> Kconfig symbol. That could be tricky though, because "select" should be
>> used only for non-visible symbols.
>>
>> Any ideas how to solve that?
>>
>
> Is true that select should only be used for non-visible symbols but there
> are others user visible symbols that are selected by ARCH_EXYNOS such as
> EXYNOS_THERMAL. So I think selecting the regmap syscon reset stuff there
> is a sensible option.
>
Yes, another example is MFD_SYSYCON which is selected from Kconfig.
Also CONFIG_POWER_RESET_SYSCON is enable in arch/arm64/config/defconfig.
So both approaches are taken here.
will go with maintainer suggestion here.
>> Best regards,
>> Krzysztof
>>
>
> Best regards,
>
Krzysztof Kozlowski Oct. 19, 2015, 1:28 p.m. UTC | #5
2015-10-19 18:56 GMT+09:00 Javier Martinez Canillas <javier@osg.samsung.com>:
> Hello,
>
> On 10/19/2015 09:00 AM, Krzysztof Kozlowski wrote:
>> On 19.10.2015 15:03, Alim Akhtar wrote:
>>> Now we can use the generic syscon-{reboot/poweroff} drivers,
>>> so we don't need special handling for reboot/poweroff in
>>> exynos pmu driver. This patch remove the same.
>>>
>>> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
>>> ---
>>>  arch/arm/mach-exynos/pmu.c |   43 -------------------------------------------
>>>  1 file changed, 43 deletions(-)
>>
>> I think that removal of this stuff will effectively remove the
>> restart/poweroff handlers from:
>> 1. Other defconfigs, like multi_v7
>> 2. Custom configs.
>>
>
> This will also break old DTBs that don't have a "syscon-poweroff" device
> node that contains the necessary PMU regmap, offset and mask information.

I am not sure whether this is ABI break issue. There was no compatible
mentioning that "reset works" which now would be replaced. The
existing PMU compatible (like samsung,exynos4412-pmu) does not mention
"reset" as a feature coming with this compatible.

So no ABI break.


>
>> Previously this code was always compiled in for ARCH_EXYNOS. Now it is
>> not so I am thinking about selecting necessary drivers from main exynos
>> Kconfig symbol. That could be tricky though, because "select" should be
>> used only for non-visible symbols.
>>
>> Any ideas how to solve that?
>>
>
> Is true that select should only be used for non-visible symbols but there
> are others user visible symbols that are selected by ARCH_EXYNOS such as
> EXYNOS_THERMAL. So I think selecting the regmap syscon reset stuff there
> is a sensible option.

Selecting from defconfig is not sufficient... since I do not have
other idea than selecting then ovak, but Alim please check it whether
it does not create circular dependencies on various configs.

Best regards,
Krzysztof
Javier Martinez Canillas Oct. 19, 2015, 2:07 p.m. UTC | #6
Hello Krzysztof,

On 10/19/2015 03:28 PM, Krzysztof Kozlowski wrote:
> 2015-10-19 18:56 GMT+09:00 Javier Martinez Canillas <javier@osg.samsung.com>:
>> Hello,
>>
>> On 10/19/2015 09:00 AM, Krzysztof Kozlowski wrote:
>>> On 19.10.2015 15:03, Alim Akhtar wrote:
>>>> Now we can use the generic syscon-{reboot/poweroff} drivers,
>>>> so we don't need special handling for reboot/poweroff in
>>>> exynos pmu driver. This patch remove the same.
>>>>
>>>> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
>>>> ---
>>>>  arch/arm/mach-exynos/pmu.c |   43 -------------------------------------------
>>>>  1 file changed, 43 deletions(-)
>>>
>>> I think that removal of this stuff will effectively remove the
>>> restart/poweroff handlers from:
>>> 1. Other defconfigs, like multi_v7
>>> 2. Custom configs.
>>>
>>
>> This will also break old DTBs that don't have a "syscon-poweroff" device
>> node that contains the necessary PMU regmap, offset and mask information.
> 
> I am not sure whether this is ABI break issue. There was no compatible
> mentioning that "reset works" which now would be replaced. The
> existing PMU compatible (like samsung,exynos4412-pmu) does not mention
> "reset" as a feature coming with this compatible.
> 
> So no ABI break.
> 
> 

I deliberately didn't use the "DT ABI break" expression since as you said is
not part of the documented DT bindings. But what I said is that this change
will break old DTBs with newer kernels since reboot and power off will stop
working after $SUBJECT.

I'm not a particular fan of the stable DT idea since in practice it seems to
do more harm than good but since that was decided, the expectation for users
is that booting a new kernel with an old DT should not cause any regression.

So I think that at least a comment in the commit message is needed so if
there are people really using old DTs with newer kernels on Exynos boards,
they can know that the commit causes such an issue instead of having to
figure it out themselves.

>>
>>> Previously this code was always compiled in for ARCH_EXYNOS. Now it is
>>> not so I am thinking about selecting necessary drivers from main exynos
>>> Kconfig symbol. That could be tricky though, because "select" should be
>>> used only for non-visible symbols.
>>>
>>> Any ideas how to solve that?
>>>
>>
>> Is true that select should only be used for non-visible symbols but there
>> are others user visible symbols that are selected by ARCH_EXYNOS such as
>> EXYNOS_THERMAL. So I think selecting the regmap syscon reset stuff there
>> is a sensible option.
> 
> Selecting from defconfig is not sufficient... since I do not have
> other idea than selecting then ovak, but Alim please check it whether
> it does not create circular dependencies on various configs.
>

Agreed, Kconfig circular dependencies is the reason why select is avoided.
Fortunately now the 0-day bot analyzes even posted patches so it's possible
that such an issue could be found even before these patches are merged.

> Best regards,
> Krzysztof
>

Best regards,
Alim Akhtar Oct. 19, 2015, 4:06 p.m. UTC | #7
Hi krzysztof,

On Mon, Oct 19, 2015 at 6:58 PM, Krzysztof Kozlowski
<k.kozlowski@samsung.com> wrote:
> 2015-10-19 18:56 GMT+09:00 Javier Martinez Canillas <javier@osg.samsung.com>:
>> Hello,
>>
>> On 10/19/2015 09:00 AM, Krzysztof Kozlowski wrote:
>>> On 19.10.2015 15:03, Alim Akhtar wrote:
>>>> Now we can use the generic syscon-{reboot/poweroff} drivers,
>>>> so we don't need special handling for reboot/poweroff in
>>>> exynos pmu driver. This patch remove the same.
>>>>
>>>> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
>>>> ---
>>>>  arch/arm/mach-exynos/pmu.c |   43 -------------------------------------------
>>>>  1 file changed, 43 deletions(-)
>>>
>>> I think that removal of this stuff will effectively remove the
>>> restart/poweroff handlers from:
>>> 1. Other defconfigs, like multi_v7
>>> 2. Custom configs.
>>>
>>
>> This will also break old DTBs that don't have a "syscon-poweroff" device
>> node that contains the necessary PMU regmap, offset and mask information.
>
> I am not sure whether this is ABI break issue. There was no compatible
> mentioning that "reset works" which now would be replaced. The
> existing PMU compatible (like samsung,exynos4412-pmu) does not mention
> "reset" as a feature coming with this compatible.
>
> So no ABI break.
>
You are right, there is no DT ABI break here.

>
>>
>>> Previously this code was always compiled in for ARCH_EXYNOS. Now it is
>>> not so I am thinking about selecting necessary drivers from main exynos
>>> Kconfig symbol. That could be tricky though, because "select" should be
>>> used only for non-visible symbols.
>>>
>>> Any ideas how to solve that?
>>>
>>
>> Is true that select should only be used for non-visible symbols but there
>> are others user visible symbols that are selected by ARCH_EXYNOS such as
>> EXYNOS_THERMAL. So I think selecting the regmap syscon reset stuff there
>> is a sensible option.
>
> Selecting from defconfig is not sufficient... since I do not have
> other idea than selecting then ovak, but Alim please check it whether
> it does not create circular dependencies on various configs.
>
I checked in multi_v7_defconfig SYSCON_RESET is already enabled by
default. so I doubt we are going to run into any circular
dependencies, will check again..thanks.

> Best regards,
> Krzysztof
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alim Akhtar Oct. 19, 2015, 4:13 p.m. UTC | #8
Hi Javier,

On Mon, Oct 19, 2015 at 7:37 PM, Javier Martinez Canillas
<javier@osg.samsung.com> wrote:
> Hello Krzysztof,
>
> On 10/19/2015 03:28 PM, Krzysztof Kozlowski wrote:
>> 2015-10-19 18:56 GMT+09:00 Javier Martinez Canillas <javier@osg.samsung.com>:
>>> Hello,
>>>
>>> On 10/19/2015 09:00 AM, Krzysztof Kozlowski wrote:
>>>> On 19.10.2015 15:03, Alim Akhtar wrote:
>>>>> Now we can use the generic syscon-{reboot/poweroff} drivers,
>>>>> so we don't need special handling for reboot/poweroff in
>>>>> exynos pmu driver. This patch remove the same.
>>>>>
>>>>> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
>>>>> ---
>>>>>  arch/arm/mach-exynos/pmu.c |   43 -------------------------------------------
>>>>>  1 file changed, 43 deletions(-)
>>>>
>>>> I think that removal of this stuff will effectively remove the
>>>> restart/poweroff handlers from:
>>>> 1. Other defconfigs, like multi_v7
>>>> 2. Custom configs.
>>>>
>>>
>>> This will also break old DTBs that don't have a "syscon-poweroff" device
>>> node that contains the necessary PMU regmap, offset and mask information.
>>
>> I am not sure whether this is ABI break issue. There was no compatible
>> mentioning that "reset works" which now would be replaced. The
>> existing PMU compatible (like samsung,exynos4412-pmu) does not mention
>> "reset" as a feature coming with this compatible.
>>
>> So no ABI break.
>>
>>
>
> I deliberately didn't use the "DT ABI break" expression since as you said is
> not part of the documented DT bindings. But what I said is that this change
> will break old DTBs with newer kernels since reboot and power off will stop
> working after $SUBJECT.
>
> I'm not a particular fan of the stable DT idea since in practice it seems to
> do more harm than good but since that was decided, the expectation for users
> is that booting a new kernel with an old DT should not cause any regression.
>
> So I think that at least a comment in the commit message is needed so if
> there are people really using old DTs with newer kernels on Exynos boards,
> they can know that the commit causes such an issue instead of having to
> figure it out themselves.
>
Agree, will add a comment about this in commit message.

>>>
>>>> Previously this code was always compiled in for ARCH_EXYNOS. Now it is
>>>> not so I am thinking about selecting necessary drivers from main exynos
>>>> Kconfig symbol. That could be tricky though, because "select" should be
>>>> used only for non-visible symbols.
>>>>
>>>> Any ideas how to solve that?
>>>>
>>>
>>> Is true that select should only be used for non-visible symbols but there
>>> are others user visible symbols that are selected by ARCH_EXYNOS such as
>>> EXYNOS_THERMAL. So I think selecting the regmap syscon reset stuff there
>>> is a sensible option.
>>
>> Selecting from defconfig is not sufficient... since I do not have
>> other idea than selecting then ovak, but Alim please check it whether
>> it does not create circular dependencies on various configs.
>>
>
> Agreed, Kconfig circular dependencies is the reason why select is avoided.
> Fortunately now the 0-day bot analyzes even posted patches so it's possible
> that such an issue could be found even before these patches are merged.
>
ok..will select it from mach-exynos/Kconfig.
Thanks.

>> Best regards,
>> Krzysztof
>>
>
> Best regards,
> --
> Javier Martinez Canillas
> Open Source Group
> Samsung Research America
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Javier Martinez Canillas Oct. 19, 2015, 4:42 p.m. UTC | #9
Hello Alim,

On 10/19/2015 06:13 PM, Alim Akhtar wrote:
> Hi Javier,
> 
> On Mon, Oct 19, 2015 at 7:37 PM, Javier Martinez Canillas
> <javier@osg.samsung.com> wrote:
>> Hello Krzysztof,
>>
>> On 10/19/2015 03:28 PM, Krzysztof Kozlowski wrote:
>>> 2015-10-19 18:56 GMT+09:00 Javier Martinez Canillas <javier@osg.samsung.com>:
>>>> Hello,
>>>>
>>>> On 10/19/2015 09:00 AM, Krzysztof Kozlowski wrote:
>>>>> On 19.10.2015 15:03, Alim Akhtar wrote:
>>>>>> Now we can use the generic syscon-{reboot/poweroff} drivers,
>>>>>> so we don't need special handling for reboot/poweroff in
>>>>>> exynos pmu driver. This patch remove the same.
>>>>>>
>>>>>> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
>>>>>> ---
>>>>>>  arch/arm/mach-exynos/pmu.c |   43 -------------------------------------------
>>>>>>  1 file changed, 43 deletions(-)
>>>>>
>>>>> I think that removal of this stuff will effectively remove the
>>>>> restart/poweroff handlers from:
>>>>> 1. Other defconfigs, like multi_v7
>>>>> 2. Custom configs.
>>>>>
>>>>
>>>> This will also break old DTBs that don't have a "syscon-poweroff" device
>>>> node that contains the necessary PMU regmap, offset and mask information.
>>>
>>> I am not sure whether this is ABI break issue. There was no compatible
>>> mentioning that "reset works" which now would be replaced. The
>>> existing PMU compatible (like samsung,exynos4412-pmu) does not mention
>>> "reset" as a feature coming with this compatible.
>>>
>>> So no ABI break.
>>>
>>>
>>
>> I deliberately didn't use the "DT ABI break" expression since as you said is
>> not part of the documented DT bindings. But what I said is that this change
>> will break old DTBs with newer kernels since reboot and power off will stop
>> working after $SUBJECT.
>>
>> I'm not a particular fan of the stable DT idea since in practice it seems to
>> do more harm than good but since that was decided, the expectation for users
>> is that booting a new kernel with an old DT should not cause any regression.
>>
>> So I think that at least a comment in the commit message is needed so if
>> there are people really using old DTs with newer kernels on Exynos boards,
>> they can know that the commit causes such an issue instead of having to
>> figure it out themselves.
>>
> Agree, will add a comment about this in commit message.
>

Thanks, with that comment in the commit message, feel free
to add my Reviewed-by tag to this patch as well.
 
>>>>
>>>>> Previously this code was always compiled in for ARCH_EXYNOS. Now it is
>>>>> not so I am thinking about selecting necessary drivers from main exynos
>>>>> Kconfig symbol. That could be tricky though, because "select" should be
>>>>> used only for non-visible symbols.
>>>>>
>>>>> Any ideas how to solve that?
>>>>>
>>>>
>>>> Is true that select should only be used for non-visible symbols but there
>>>> are others user visible symbols that are selected by ARCH_EXYNOS such as
>>>> EXYNOS_THERMAL. So I think selecting the regmap syscon reset stuff there
>>>> is a sensible option.
>>>
>>> Selecting from defconfig is not sufficient... since I do not have
>>> other idea than selecting then ovak, but Alim please check it whether
>>> it does not create circular dependencies on various configs.
>>>
>>
>> Agreed, Kconfig circular dependencies is the reason why select is avoided.
>> Fortunately now the 0-day bot analyzes even posted patches so it's possible
>> that such an issue could be found even before these patches are merged.
>>
> ok..will select it from mach-exynos/Kconfig.
> Thanks.
>

Ok, great.

Best regards,
Krzysztof Kozlowski Oct. 20, 2015, 12:20 a.m. UTC | #10
On 20.10.2015 01:06, Alim Akhtar wrote:
>>>
>>>> Previously this code was always compiled in for ARCH_EXYNOS. Now it is
>>>> not so I am thinking about selecting necessary drivers from main exynos
>>>> Kconfig symbol. That could be tricky though, because "select" should be
>>>> used only for non-visible symbols.
>>>>
>>>> Any ideas how to solve that?
>>>>
>>>
>>> Is true that select should only be used for non-visible symbols but there
>>> are others user visible symbols that are selected by ARCH_EXYNOS such as
>>> EXYNOS_THERMAL. So I think selecting the regmap syscon reset stuff there
>>> is a sensible option.
>>
>> Selecting from defconfig is not sufficient... since I do not have
>> other idea than selecting then ovak, but Alim please check it whether
>> it does not create circular dependencies on various configs.
>>
> I checked in multi_v7_defconfig SYSCON_RESET is already enabled by
> default. so I doubt we are going to run into any circular
> dependencies, will check again..thanks.

The circular dependency does not happen when some defconfig selects it.
Instead it could happen when some other Kconfig symbol selects such (and
there are more dependencies).

So what I am saying here, after adding "select SYSCON_RESET" in
mach-exynos/Kconfig, please build configs:
1. allyes
2. allmod,
3. multi_v7,
4. (and of course) exynos.

Best regards,
Krzysztof
diff mbox

Patch

diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index de68938ee6aa..393c04aa727e 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -14,9 +14,6 @@ 
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
-#include <linux/notifier.h>
-#include <linux/reboot.h>
-
 
 #include "exynos-pmu.h"
 #include "regs-pmu.h"
@@ -681,23 +678,6 @@  static unsigned int const exynos5420_list_disable_pmu_reg[] = {
 	EXYNOS5420_CMU_RESET_FSYS_SYS_PWR_REG,
 };
 
-static void exynos_power_off(void)
-{
-	unsigned int tmp;
-
-	pr_info("Power down.\n");
-	tmp = pmu_raw_readl(EXYNOS_PS_HOLD_CONTROL);
-	tmp ^= (1 << 8);
-	pmu_raw_writel(tmp, EXYNOS_PS_HOLD_CONTROL);
-
-	/* Wait a little so we don't give a false warning below */
-	mdelay(100);
-
-	pr_err("Power down failed, please power off system manually.\n");
-	while (1)
-		;
-}
-
 static void exynos5420_powerdown_conf(enum sys_powerdown mode)
 {
 	u32 this_cluster;
@@ -875,14 +855,6 @@  static void exynos5420_pmu_init(void)
 	pr_info("EXYNOS5420 PMU initialized\n");
 }
 
-static int pmu_restart_notify(struct notifier_block *this,
-		unsigned long code, void *unused)
-{
-	pmu_raw_writel(0x1, EXYNOS_SWRESET);
-
-	return NOTIFY_DONE;
-}
-
 static const struct exynos_pmu_data exynos3250_pmu_data = {
 	.pmu_config	= exynos3250_pmu_config,
 	.pmu_init	= exynos3250_pmu_init,
@@ -940,20 +912,11 @@  static const struct of_device_id exynos_pmu_of_device_ids[] = {
 	{ /*sentinel*/ },
 };
 
-/*
- * Exynos PMU restart notifier, handles restart functionality
- */
-static struct notifier_block pmu_restart_handler = {
-	.notifier_call = pmu_restart_notify,
-	.priority = 128,
-};
-
 static int exynos_pmu_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *match;
 	struct device *dev = &pdev->dev;
 	struct resource *res;
-	int ret;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	pmu_base_addr = devm_ioremap_resource(dev, res);
@@ -978,12 +941,6 @@  static int exynos_pmu_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, pmu_context);
 
-	ret = register_restart_handler(&pmu_restart_handler);
-	if (ret)
-		dev_warn(dev, "can't register restart handler err=%d\n", ret);
-
-	pm_power_off = exynos_power_off;
-
 	dev_dbg(dev, "Exynos PMU Driver probe done\n");
 	return 0;
 }