All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Xing Zheng <zhengxing@rock-chips.com>
Cc: heiko@sntech.de, pawel.moll@arm.com, mark.rutland@arm.com,
	ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
	linux@arm.linux.org.uk, kever.yang@rock-chips.com,
	maxime.ripard@free-electrons.com, olof@lixom.net,
	gregory.clement@free-electrons.com, wens@csie.org,
	thomas.petazzoni@free-electrons.com, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org
Subject: Re: [PATCH v6 6/8] ARM: rockchip: add support smp for rk3036
Date: Wed, 4 Nov 2015 21:21:06 -0600	[thread overview]
Message-ID: <20151105032106.GA1932@rob-hp-laptop> (raw)
In-Reply-To: <1446639916-11957-1-git-send-email-zhengxing@rock-chips.com>

On Wed, Nov 04, 2015 at 08:25:16PM +0800, Xing Zheng wrote:
> From: Heiko Stuebner <heiko@sntech.de>
> 
> The dual-core Cortex A7 rk3036 is a bit special in that it does not allow
> to control the actual powerdomain of the cpu cores, while the rest of the
> smp-bringup like reset control and entry address handling stays the same.
> Its bigger sibling, the quad-core rk3128 again allows powerdomain control.
> 
> So allow that case by introducing a separate smp-enable-method, that simply
> disables powerdomain handling in the common code.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> Tested-by: Xing Zheng <zhengxing@rock-chips.com>
> Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
> ---
> 
> Changes in v6: None
> 
>  Documentation/devicetree/bindings/arm/cpus.txt |    1 +

Acked-by: Rob Herring <robh@kernel.org>

>  arch/arm/mach-rockchip/platsmp.c               |   45 +++++++++++++++++-------
>  2 files changed, 34 insertions(+), 12 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
> index 3a07a87..8fb0749 100644
> --- a/Documentation/devicetree/bindings/arm/cpus.txt
> +++ b/Documentation/devicetree/bindings/arm/cpus.txt
> @@ -200,6 +200,7 @@ nodes to be present and contain the properties described below.
>  			    "qcom,gcc-msm8660"
>  			    "qcom,kpss-acc-v1"
>  			    "qcom,kpss-acc-v2"
> +			    "rockchip,rk3036-smp"
>  			    "rockchip,rk3066-smp"
>  			    "ste,dbx500-smp"
>  
> diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c
> index 3e7a4b7..5c138f9 100644
> --- a/arch/arm/mach-rockchip/platsmp.c
> +++ b/arch/arm/mach-rockchip/platsmp.c
> @@ -42,6 +42,7 @@ static int ncores;
>  #define PMU_PWRDN_SCU		4
>  
>  static struct regmap *pmu;
> +static int has_pmu = true;
>  
>  static int pmu_power_domain_is_on(int pd)
>  {
> @@ -89,20 +90,23 @@ static int pmu_set_power_domain(int pd, bool on)
>  	if (!IS_ERR(rstc) && !on)
>  		reset_control_assert(rstc);
>  
> -	ret = regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), val);
> -	if (ret < 0) {
> -		pr_err("%s: could not update power domain\n", __func__);
> -		return ret;
> -	}
> -
> -	ret = -1;
> -	while (ret != on) {
> -		ret = pmu_power_domain_is_on(pd);
> +	if (has_pmu) {
> +		ret = regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), val);
>  		if (ret < 0) {
> -			pr_err("%s: could not read power domain state\n",
> +			pr_err("%s: could not update power domain\n",
>  			       __func__);
>  			return ret;
>  		}
> +
> +		ret = -1;
> +		while (ret != on) {
> +			ret = pmu_power_domain_is_on(pd);
> +			if (ret < 0) {
> +				pr_err("%s: could not read power domain state\n",
> +				       __func__);
> +				return ret;
> +			}
> +		}
>  	}
>  
>  	if (!IS_ERR(rstc)) {
> @@ -122,7 +126,7 @@ static int rockchip_boot_secondary(unsigned int cpu, struct task_struct *idle)
>  {
>  	int ret;
>  
> -	if (!sram_base_addr || !pmu) {
> +	if (!sram_base_addr || (has_pmu && !pmu)) {
>  		pr_err("%s: sram or pmu missing for cpu boot\n", __func__);
>  		return -ENXIO;
>  	}
> @@ -275,7 +279,7 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus)
>  		return;
>  	}
>  
> -	if (rockchip_smp_prepare_pmu())
> +	if (has_pmu && rockchip_smp_prepare_pmu())
>  		return;
>  
>  	if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) {
> @@ -318,6 +322,13 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus)
>  		pmu_set_power_domain(0 + i, false);
>  }
>  
> +static void __init rk3036_smp_prepare_cpus(unsigned int max_cpus)
> +{
> +	has_pmu = false;
> +
> +	rockchip_smp_prepare_cpus(max_cpus);
> +}
> +
>  #ifdef CONFIG_HOTPLUG_CPU
>  static int rockchip_cpu_kill(unsigned int cpu)
>  {
> @@ -340,6 +351,15 @@ static void rockchip_cpu_die(unsigned int cpu)
>  }
>  #endif
>  
> +static struct smp_operations rk3036_smp_ops __initdata = {
> +	.smp_prepare_cpus	= rk3036_smp_prepare_cpus,
> +	.smp_boot_secondary	= rockchip_boot_secondary,
> +#ifdef CONFIG_HOTPLUG_CPU
> +	.cpu_kill		= rockchip_cpu_kill,
> +	.cpu_die		= rockchip_cpu_die,
> +#endif
> +};
> +
>  static struct smp_operations rockchip_smp_ops __initdata = {
>  	.smp_prepare_cpus	= rockchip_smp_prepare_cpus,
>  	.smp_boot_secondary	= rockchip_boot_secondary,
> @@ -349,4 +369,5 @@ static struct smp_operations rockchip_smp_ops __initdata = {
>  #endif
>  };
>  
> +CPU_METHOD_OF_DECLARE(rk3036_smp, "rockchip,rk3036-smp", &rk3036_smp_ops);
>  CPU_METHOD_OF_DECLARE(rk3066_smp, "rockchip,rk3066-smp", &rockchip_smp_ops);
> -- 
> 1.7.9.5
> 
> 

WARNING: multiple messages have this Message-ID (diff)
From: robh@kernel.org (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 6/8] ARM: rockchip: add support smp for rk3036
Date: Wed, 4 Nov 2015 21:21:06 -0600	[thread overview]
Message-ID: <20151105032106.GA1932@rob-hp-laptop> (raw)
In-Reply-To: <1446639916-11957-1-git-send-email-zhengxing@rock-chips.com>

On Wed, Nov 04, 2015 at 08:25:16PM +0800, Xing Zheng wrote:
> From: Heiko Stuebner <heiko@sntech.de>
> 
> The dual-core Cortex A7 rk3036 is a bit special in that it does not allow
> to control the actual powerdomain of the cpu cores, while the rest of the
> smp-bringup like reset control and entry address handling stays the same.
> Its bigger sibling, the quad-core rk3128 again allows powerdomain control.
> 
> So allow that case by introducing a separate smp-enable-method, that simply
> disables powerdomain handling in the common code.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> Tested-by: Xing Zheng <zhengxing@rock-chips.com>
> Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
> ---
> 
> Changes in v6: None
> 
>  Documentation/devicetree/bindings/arm/cpus.txt |    1 +

Acked-by: Rob Herring <robh@kernel.org>

>  arch/arm/mach-rockchip/platsmp.c               |   45 +++++++++++++++++-------
>  2 files changed, 34 insertions(+), 12 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
> index 3a07a87..8fb0749 100644
> --- a/Documentation/devicetree/bindings/arm/cpus.txt
> +++ b/Documentation/devicetree/bindings/arm/cpus.txt
> @@ -200,6 +200,7 @@ nodes to be present and contain the properties described below.
>  			    "qcom,gcc-msm8660"
>  			    "qcom,kpss-acc-v1"
>  			    "qcom,kpss-acc-v2"
> +			    "rockchip,rk3036-smp"
>  			    "rockchip,rk3066-smp"
>  			    "ste,dbx500-smp"
>  
> diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c
> index 3e7a4b7..5c138f9 100644
> --- a/arch/arm/mach-rockchip/platsmp.c
> +++ b/arch/arm/mach-rockchip/platsmp.c
> @@ -42,6 +42,7 @@ static int ncores;
>  #define PMU_PWRDN_SCU		4
>  
>  static struct regmap *pmu;
> +static int has_pmu = true;
>  
>  static int pmu_power_domain_is_on(int pd)
>  {
> @@ -89,20 +90,23 @@ static int pmu_set_power_domain(int pd, bool on)
>  	if (!IS_ERR(rstc) && !on)
>  		reset_control_assert(rstc);
>  
> -	ret = regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), val);
> -	if (ret < 0) {
> -		pr_err("%s: could not update power domain\n", __func__);
> -		return ret;
> -	}
> -
> -	ret = -1;
> -	while (ret != on) {
> -		ret = pmu_power_domain_is_on(pd);
> +	if (has_pmu) {
> +		ret = regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), val);
>  		if (ret < 0) {
> -			pr_err("%s: could not read power domain state\n",
> +			pr_err("%s: could not update power domain\n",
>  			       __func__);
>  			return ret;
>  		}
> +
> +		ret = -1;
> +		while (ret != on) {
> +			ret = pmu_power_domain_is_on(pd);
> +			if (ret < 0) {
> +				pr_err("%s: could not read power domain state\n",
> +				       __func__);
> +				return ret;
> +			}
> +		}
>  	}
>  
>  	if (!IS_ERR(rstc)) {
> @@ -122,7 +126,7 @@ static int rockchip_boot_secondary(unsigned int cpu, struct task_struct *idle)
>  {
>  	int ret;
>  
> -	if (!sram_base_addr || !pmu) {
> +	if (!sram_base_addr || (has_pmu && !pmu)) {
>  		pr_err("%s: sram or pmu missing for cpu boot\n", __func__);
>  		return -ENXIO;
>  	}
> @@ -275,7 +279,7 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus)
>  		return;
>  	}
>  
> -	if (rockchip_smp_prepare_pmu())
> +	if (has_pmu && rockchip_smp_prepare_pmu())
>  		return;
>  
>  	if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) {
> @@ -318,6 +322,13 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus)
>  		pmu_set_power_domain(0 + i, false);
>  }
>  
> +static void __init rk3036_smp_prepare_cpus(unsigned int max_cpus)
> +{
> +	has_pmu = false;
> +
> +	rockchip_smp_prepare_cpus(max_cpus);
> +}
> +
>  #ifdef CONFIG_HOTPLUG_CPU
>  static int rockchip_cpu_kill(unsigned int cpu)
>  {
> @@ -340,6 +351,15 @@ static void rockchip_cpu_die(unsigned int cpu)
>  }
>  #endif
>  
> +static struct smp_operations rk3036_smp_ops __initdata = {
> +	.smp_prepare_cpus	= rk3036_smp_prepare_cpus,
> +	.smp_boot_secondary	= rockchip_boot_secondary,
> +#ifdef CONFIG_HOTPLUG_CPU
> +	.cpu_kill		= rockchip_cpu_kill,
> +	.cpu_die		= rockchip_cpu_die,
> +#endif
> +};
> +
>  static struct smp_operations rockchip_smp_ops __initdata = {
>  	.smp_prepare_cpus	= rockchip_smp_prepare_cpus,
>  	.smp_boot_secondary	= rockchip_boot_secondary,
> @@ -349,4 +369,5 @@ static struct smp_operations rockchip_smp_ops __initdata = {
>  #endif
>  };
>  
> +CPU_METHOD_OF_DECLARE(rk3036_smp, "rockchip,rk3036-smp", &rk3036_smp_ops);
>  CPU_METHOD_OF_DECLARE(rk3066_smp, "rockchip,rk3066-smp", &rockchip_smp_ops);
> -- 
> 1.7.9.5
> 
> 

  parent reply	other threads:[~2015-11-05  3:21 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04 12:18 [PATCH v6 0/8] Build and support rk3036 SoC platform Xing Zheng
2015-11-04 12:18 ` Xing Zheng
2015-11-04 12:18 ` [PATCH v6 2/8] clk: rockchip: add dt-binding header for rk3036 Xing Zheng
2015-11-04 12:18 ` [PATCH v6 3/8] clk: rockchip: add new pll-type for rk3036 and similar socs Xing Zheng
2015-11-04 12:18   ` Xing Zheng
2015-11-04 23:50   ` [PATCH v6.1 " Heiko Stuebner
2015-11-04 23:50     ` Heiko Stuebner
2015-11-04 12:18 ` [PATCH v6 4/8] clk: rockchip: add clock controller for rk3036 Xing Zheng
2015-11-04 12:18   ` Xing Zheng
2015-11-04 12:18   ` Xing Zheng
2015-11-04 23:51   ` [PATCH v6.1 " Heiko Stuebner
2015-11-04 23:51     ` Heiko Stuebner
     [not found] ` <1446639503-11763-1-git-send-email-zhengxing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2015-11-04 12:18   ` [PATCH v6 1/8] dt-bindings: add documentation of rk3036 clock controller Xing Zheng
2015-11-04 12:18     ` Xing Zheng
2015-11-04 12:18     ` Xing Zheng
     [not found]     ` <1446639503-11763-2-git-send-email-zhengxing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2015-11-04 23:39       ` Heiko Stuebner
2015-11-04 23:39         ` Heiko Stuebner
2015-11-04 23:39         ` Heiko Stuebner
2015-11-05  3:05         ` Xing Zheng
2015-11-05  3:05           ` Xing Zheng
2015-11-05  3:05           ` Xing Zheng
2015-11-05  3:22       ` Rob Herring
2015-11-05  3:22         ` Rob Herring
2015-11-05  3:22         ` Rob Herring
2015-11-04 12:24   ` [PATCH v6 5/8] ARM: dts: rockchip: add core rk3036 dts Xing Zheng
2015-11-04 12:24     ` Xing Zheng
2015-11-04 12:24     ` Xing Zheng
2015-11-04 12:25 ` [PATCH v6 6/8] ARM: rockchip: add support smp for rk3036 Xing Zheng
2015-11-04 12:25   ` Xing Zheng
     [not found]   ` <1446639916-11957-1-git-send-email-zhengxing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2015-11-04 23:33     ` Heiko Stuebner
2015-11-04 23:33       ` Heiko Stuebner
2015-11-04 23:33       ` Heiko Stuebner
2015-11-05  3:00       ` Xing Zheng
2015-11-05  3:00         ` Xing Zheng
2015-11-05  3:00         ` Xing Zheng
2015-11-05  3:21   ` Rob Herring [this message]
2015-11-05  3:21     ` Rob Herring
2015-11-04 12:25 ` [PATCH v6 7/8] ARM: dts: enable " Xing Zheng
2015-11-04 12:25   ` Xing Zheng
2015-11-04 12:25 ` [PATCH v6 8/8] rockchip: make sure timer5 is enabled on rk3036 platforms Xing Zheng
2015-11-04 12:25   ` Xing Zheng
2015-11-04 23:35   ` Heiko Stuebner
2015-11-04 23:35     ` Heiko Stuebner

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=20151105032106.GA1932@rob-hp-laptop \
    --to=robh@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=gregory.clement@free-electrons.com \
    --cc=heiko@sntech.de \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=kever.yang@rock-chips.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=olof@lixom.net \
    --cc=pawel.moll@arm.com \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=wens@csie.org \
    --cc=zhengxing@rock-chips.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 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.