* [PATCH] ARM: ux500: check platform in ux500_l2x0_init
@ 2013-06-26 1:30 Olof Johansson
2013-06-26 19:46 ` Linus Walleij
0 siblings, 1 reply; 3+ messages in thread
From: Olof Johansson @ 2013-06-26 1:30 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-arm-kernel, linux-kernel, Olof Johansson
Add compatible checks for ux500. This should probably be moved to generic
DT-based probing whenever DT is populated instead, but until then at
least don't panic all non-ux500 multiplatform machines.
Signed-off-by: Olof Johansson <olof@lixom.net>
---
Linus, I'll apply this directly if you ack it, let me know.
-Olof
arch/arm/mach-ux500/cache-l2x0.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/arm/mach-ux500/cache-l2x0.c b/arch/arm/mach-ux500/cache-l2x0.c
index f58615b..3facc1e 100644
--- a/arch/arm/mach-ux500/cache-l2x0.c
+++ b/arch/arm/mach-ux500/cache-l2x0.c
@@ -39,6 +39,15 @@ static int __init ux500_l2x0_init(void)
{
u32 aux_val = 0x3e000000;
+ /* Ick. I wish there was a single compatible value to compare for,
+ * but there isn't.
+ */
+ if (!of_machine_is_compatible("st-ericsson,u8500") &&
+ !of_machine_is_compatible("st-ericsson,u8540") &&
+ !of_machine_is_compatible("st-ericsson,u9500") &&
+ !of_machine_is_compatible("st-ericsson,u8540"))
+ return -ENODEV;
+
if (cpu_is_u8500_family() || cpu_is_ux540_family())
l2x0_base = __io_address(U8500_L2CC_BASE);
else
--
1.8.1.192.gc4361b8
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ARM: ux500: check platform in ux500_l2x0_init
2013-06-26 1:30 [PATCH] ARM: ux500: check platform in ux500_l2x0_init Olof Johansson
@ 2013-06-26 19:46 ` Linus Walleij
2013-06-26 22:49 ` Olof Johansson
0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2013-06-26 19:46 UTC (permalink / raw)
To: Olof Johansson
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
On Wed, Jun 26, 2013 at 3:30 AM, Olof Johansson <olof@lixom.net> wrote:
> Add compatible checks for ux500. This should probably be moved to generic
> DT-based probing whenever DT is populated instead, but until then at
> least don't panic all non-ux500 multiplatform machines.
>
> Signed-off-by: Olof Johansson <olof@lixom.net>
> + /* Ick. I wish there was a single compatible value to compare for,
> + * but there isn't.
> + */
> + if (!of_machine_is_compatible("st-ericsson,u8500") &&
> + !of_machine_is_compatible("st-ericsson,u8540") &&
> + !of_machine_is_compatible("st-ericsson,u9500") &&
> + !of_machine_is_compatible("st-ericsson,u8540"))
> + return -ENODEV;
This is checking u8540 twice and does not account for snowball.
With new platforms coming we cannot just line up all possible
compat strings like this, we need to rely on the cpu_is* macro
to be reporting something sane, and I think it does.
What about just doing this:
>From da838c71fb32d63d7e28c14697702ff48088a09b Mon Sep 17 00:00:00 2001
From: Linus Walleij <linus.walleij@linaro.org>
Date: Wed, 26 Jun 2013 21:44:57 +0200
Subject: [PATCH] ARM: ux500: bail out on alien cpus
This makes the l2x0 initialization fail gracefully on non-ux500
systems.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
arch/arm/mach-ux500/cache-l2x0.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-ux500/cache-l2x0.c b/arch/arm/mach-ux500/cache-l2x0.c
index f58615b..82ccf1d 100644
--- a/arch/arm/mach-ux500/cache-l2x0.c
+++ b/arch/arm/mach-ux500/cache-l2x0.c
@@ -42,7 +42,8 @@ static int __init ux500_l2x0_init(void)
if (cpu_is_u8500_family() || cpu_is_ux540_family())
l2x0_base = __io_address(U8500_L2CC_BASE);
else
- ux500_unknown_soc();
+ /* Non-Ux500 platform */
+ return -ENODEV;
/* Unlock before init */
ux500_l2x0_unlock();
--
1.8.1.4
Yours,
Linus Walleij
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ARM: ux500: check platform in ux500_l2x0_init
2013-06-26 19:46 ` Linus Walleij
@ 2013-06-26 22:49 ` Olof Johansson
0 siblings, 0 replies; 3+ messages in thread
From: Olof Johansson @ 2013-06-26 22:49 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Hi,
On Wed, Jun 26, 2013 at 09:46:08PM +0200, Linus Walleij wrote:
> On Wed, Jun 26, 2013 at 3:30 AM, Olof Johansson <olof@lixom.net> wrote:
>
> > Add compatible checks for ux500. This should probably be moved to generic
> > DT-based probing whenever DT is populated instead, but until then at
> > least don't panic all non-ux500 multiplatform machines.
> >
> > Signed-off-by: Olof Johansson <olof@lixom.net>
>
> > + /* Ick. I wish there was a single compatible value to compare for,
> > + * but there isn't.
> > + */
> > + if (!of_machine_is_compatible("st-ericsson,u8500") &&
> > + !of_machine_is_compatible("st-ericsson,u8540") &&
> > + !of_machine_is_compatible("st-ericsson,u9500") &&
> > + !of_machine_is_compatible("st-ericsson,u8540"))
> > + return -ENODEV;
>
> This is checking u8540 twice and does not account for snowball.
Snowball has a compatible of:
"calaosystems,snowball-a9500", "st-ericsson,u9500"
but yeah, I typoed on the 9540.
> With new platforms coming we cannot just line up all possible
> compat strings like this, we need to rely on the cpu_is* macro
> to be reporting something sane, and I think it does.
Agreed.
> What about just doing this:
>
> From da838c71fb32d63d7e28c14697702ff48088a09b Mon Sep 17 00:00:00 2001
> From: Linus Walleij <linus.walleij@linaro.org>
> Date: Wed, 26 Jun 2013 21:44:57 +0200
> Subject: [PATCH] ARM: ux500: bail out on alien cpus
>
> This makes the l2x0 initialization fail gracefully on non-ux500
> systems.
>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> arch/arm/mach-ux500/cache-l2x0.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-ux500/cache-l2x0.c b/arch/arm/mach-ux500/cache-l2x0.c
> index f58615b..82ccf1d 100644
> --- a/arch/arm/mach-ux500/cache-l2x0.c
> +++ b/arch/arm/mach-ux500/cache-l2x0.c
> @@ -42,7 +42,8 @@ static int __init ux500_l2x0_init(void)
> if (cpu_is_u8500_family() || cpu_is_ux540_family())
> l2x0_base = __io_address(U8500_L2CC_BASE);
> else
> - ux500_unknown_soc();
> + /* Non-Ux500 platform */
> + return -ENODEV;
>
> /* Unlock before init */
> ux500_l2x0_unlock();
SGTM. Applied to next/late.
-Olof
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-26 22:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-26 1:30 [PATCH] ARM: ux500: check platform in ux500_l2x0_init Olof Johansson
2013-06-26 19:46 ` Linus Walleij
2013-06-26 22:49 ` Olof Johansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox