diff mbox

[04/16] ARM: realview: use generic API for enabling SCU

Message ID 1479099731-28108-5-git-send-email-pankaj.dubey@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Pankaj Dubey Nov. 14, 2016, 5:01 a.m. UTC
Now as we have of_scu_enable which takes care of mapping
scu base from DT, lets use it.

Also this patch removes computation of number of cores
from SCU, as for DT platform it will be taken care from
DT CPU device nodes.

CC: Russell King <linux@armlinux.org.uk>
Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com>
---
 arch/arm/mach-realview/platsmp-dt.c | 29 +++++++++--------------------
 1 file changed, 9 insertions(+), 20 deletions(-)

Comments

Arnd Bergmann Nov. 14, 2016, 11:56 a.m. UTC | #1
On Monday, November 14, 2016 10:31:59 AM CET Pankaj Dubey wrote:
>  static const struct of_device_id realview_scu_match[] = {
>         { .compatible = "arm,arm11mp-scu", },
> -       { .compatible = "arm,cortex-a9-scu", },
> -       { .compatible = "arm,cortex-a5-scu", },
>         { }
>  };
>  
> @@ -41,27 +39,18 @@ static void __init realview_smp_prepare_cpus(unsigned int max_cpus)
>         struct device_node *np;
>         void __iomem *scu_base;
>         struct regmap *map;
> -       unsigned int ncores;
>         int i;
>  
> -       np = of_find_matching_node(NULL, realview_scu_match);
> -       if (!np) {
> -               pr_err("PLATSMP: No SCU base address\n");
> -               return;
> +       if (of_scu_enable()) {
> +               np = of_find_matching_node(NULL, realview_scu_match);
> +               scu_base = of_iomap(np, 0);
> +               of_node_put(np);
> +               if (!scu_base) {
> +                       pr_err("PLATSMP: No SCU remap\n");
> +                       return;
> +               }
> +               scu_enable(scu_base);
>         }
> 

The only difference here seems to be that realview also needs to handle
"arm,arm11mp-scu". Why not move that into the generic implementation?

	Arnd
Pankaj Dubey Nov. 14, 2016, 12:06 p.m. UTC | #2
On Monday 14 November 2016 05:26 PM, Arnd Bergmann wrote:
> On Monday, November 14, 2016 10:31:59 AM CET Pankaj Dubey wrote:
>>  static const struct of_device_id realview_scu_match[] = {
>>         { .compatible = "arm,arm11mp-scu", },
>> -       { .compatible = "arm,cortex-a9-scu", },
>> -       { .compatible = "arm,cortex-a5-scu", },
>>         { }
>>  };
>>  
>> @@ -41,27 +39,18 @@ static void __init realview_smp_prepare_cpus(unsigned int max_cpus)
>>         struct device_node *np;
>>         void __iomem *scu_base;
>>         struct regmap *map;
>> -       unsigned int ncores;
>>         int i;
>>  
>> -       np = of_find_matching_node(NULL, realview_scu_match);
>> -       if (!np) {
>> -               pr_err("PLATSMP: No SCU base address\n");
>> -               return;
>> +       if (of_scu_enable()) {
>> +               np = of_find_matching_node(NULL, realview_scu_match);
>> +               scu_base = of_iomap(np, 0);
>> +               of_node_put(np);
>> +               if (!scu_base) {
>> +                       pr_err("PLATSMP: No SCU remap\n");
>> +                       return;
>> +               }
>> +               scu_enable(scu_base);
>>         }
>>
> 
> The only difference here seems to be that realview also needs to handle
> "arm,arm11mp-scu". Why not move that into the generic implementation?
> 

Do you mean "arm,arm11mp-scu" this is generic SCU specific to ARM?

If it's generic then it can be moved on the same line I moved a5-scu and
a9-scu.

I left it here in same file, as I understood it might be related with
very specific to realview platform.

Thanks,
Pankaj Dubey

> 	Arnd
> 
> 
>
Pankaj Dubey Nov. 14, 2016, 1:19 p.m. UTC | #3
Hi Arnd,

On 14 November 2016 at 17:26, Arnd Bergmann <arnd@arndb.de> wrote:
> On Monday, November 14, 2016 10:31:59 AM CET Pankaj Dubey wrote:
>>  static const struct of_device_id realview_scu_match[] = {
>>         { .compatible = "arm,arm11mp-scu", },
>> -       { .compatible = "arm,cortex-a9-scu", },
>> -       { .compatible = "arm,cortex-a5-scu", },
>>         { }
>>  };
>>
>> @@ -41,27 +39,18 @@ static void __init realview_smp_prepare_cpus(unsigned int max_cpus)
>>         struct device_node *np;
>>         void __iomem *scu_base;
>>         struct regmap *map;
>> -       unsigned int ncores;
>>         int i;
>>
>> -       np = of_find_matching_node(NULL, realview_scu_match);
>> -       if (!np) {
>> -               pr_err("PLATSMP: No SCU base address\n");
>> -               return;
>> +       if (of_scu_enable()) {
>> +               np = of_find_matching_node(NULL, realview_scu_match);
>> +               scu_base = of_iomap(np, 0);
>> +               of_node_put(np);
>> +               if (!scu_base) {
>> +                       pr_err("PLATSMP: No SCU remap\n");
>> +                       return;
>> +               }
>> +               scu_enable(scu_base);
>>         }
>>
>
> The only difference here seems to be that realview also needs to handle
> "arm,arm11mp-scu". Why not move that into the generic implementation?
>

Just checked scu binding documentation for "arm,arm11mp-scu" and came
to know its for ARM11 MPCore based SoC's SCU. So as you said, it can
surely be moved to genenric imeplemenation. Will do this change and
resubmit again.

Thanks,
Pankaj Dubey

>         Arnd
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Arnd Bergmann Nov. 14, 2016, 2:28 p.m. UTC | #4
On Monday, November 14, 2016 5:36:43 PM CET pankaj.dubey wrote:
> On Monday 14 November 2016 05:26 PM, Arnd Bergmann wrote:
> > On Monday, November 14, 2016 10:31:59 AM CET Pankaj Dubey wrote:
> > 
> > The only difference here seems to be that realview also needs to handle
> > "arm,arm11mp-scu". Why not move that into the generic implementation?
> > 
> 
> Do you mean "arm,arm11mp-scu" this is generic SCU specific to ARM?

Yes.

> If it's generic then it can be moved on the same line I moved a5-scu and
> a9-scu.
> 
> I left it here in same file, as I understood it might be related with
> very specific to realview platform.

The reason why only realview has it is that this is currently the
only platform we support that uses SMP on an ARM11MPcore.

cns3xxx in is also SMP hardware, but we only support the first core.

	ARnd
diff mbox

Patch

diff --git a/arch/arm/mach-realview/platsmp-dt.c b/arch/arm/mach-realview/platsmp-dt.c
index 70ca99e..b2dbf77 100644
--- a/arch/arm/mach-realview/platsmp-dt.c
+++ b/arch/arm/mach-realview/platsmp-dt.c
@@ -23,8 +23,6 @@ 
 
 static const struct of_device_id realview_scu_match[] = {
 	{ .compatible = "arm,arm11mp-scu", },
-	{ .compatible = "arm,cortex-a9-scu", },
-	{ .compatible = "arm,cortex-a5-scu", },
 	{ }
 };
 
@@ -41,27 +39,18 @@  static void __init realview_smp_prepare_cpus(unsigned int max_cpus)
 	struct device_node *np;
 	void __iomem *scu_base;
 	struct regmap *map;
-	unsigned int ncores;
 	int i;
 
-	np = of_find_matching_node(NULL, realview_scu_match);
-	if (!np) {
-		pr_err("PLATSMP: No SCU base address\n");
-		return;
+	if (of_scu_enable()) {
+		np = of_find_matching_node(NULL, realview_scu_match);
+		scu_base = of_iomap(np, 0);
+		of_node_put(np);
+		if (!scu_base) {
+			pr_err("PLATSMP: No SCU remap\n");
+			return;
+		}
+		scu_enable(scu_base);
 	}
-	scu_base = of_iomap(np, 0);
-	of_node_put(np);
-	if (!scu_base) {
-		pr_err("PLATSMP: No SCU remap\n");
-		return;
-	}
-
-	scu_enable(scu_base);
-	ncores = scu_get_core_count(scu_base);
-	pr_info("SCU: %d cores detected\n", ncores);
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-	iounmap(scu_base);
 
 	/* The syscon contains the magic SMP start address registers */
 	np = of_find_matching_node(NULL, realview_syscon_match);