Patchwork [3/3] fsl_rio: fix non-standard HID1 register access

login
register
mail settings
Submitter Yang Li
Date June 18, 2010, 5:29 a.m.
Message ID <1276838958-28947-3-git-send-email-leoli@freescale.com>
Download mbox | patch
Permalink /patch/56119/
State Superseded
Delegated to: Kumar Gala
Headers show

Comments

Yang Li - June 18, 2010, 5:29 a.m.
The access to HID1 register is only legitimate for e500 v1/v2 cores.

Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/sysdev/fsl_rio.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
Geert Uytterhoeven - June 18, 2010, 5:46 a.m.
On Fri, Jun 18, 2010 at 07:29, Li Yang <leoli@freescale.com> wrote:
> The access to HID1 register is only legitimate for e500 v1/v2 cores.
>
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
>  arch/powerpc/sysdev/fsl_rio.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
> index 954a754..785a882 100644
> --- a/arch/powerpc/sysdev/fsl_rio.c
> +++ b/arch/powerpc/sysdev/fsl_rio.c
> @@ -1523,9 +1523,12 @@ int fsl_rio_setup(struct of_device *dev)
>  #ifdef CONFIG_E500
>        saved_mcheck_exception = ppc_md.machine_check_exception;
>        ppc_md.machine_check_exception = fsl_rio_mcheck_exception;
> -#endif
> -       /* Ensure that RFXE is set */
> +
> +#ifndef CONFIG_E500MC
> +       /* Ensure that RFXE is set on e500 v1/v2 */
>        mtspr(SPRN_HID1, (mfspr(SPRN_HID1) | 0x20000));
> +#endif /* !E500MC */
> +#endif /* E500 */
>
>        return 0;
>  err:

This prevents you from building a kernel for both normal E500 and E500MC.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
Kumar Gala - June 18, 2010, 5:51 a.m.
On Jun 18, 2010, at 12:46 AM, Geert Uytterhoeven wrote:

> On Fri, Jun 18, 2010 at 07:29, Li Yang <leoli@freescale.com> wrote:
>> The access to HID1 register is only legitimate for e500 v1/v2 cores.
>> 
>> Signed-off-by: Li Yang <leoli@freescale.com>
>> ---
>>  arch/powerpc/sysdev/fsl_rio.c |    7 +++++--
>>  1 files changed, 5 insertions(+), 2 deletions(-)
>> 
>> diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
>> index 954a754..785a882 100644
>> --- a/arch/powerpc/sysdev/fsl_rio.c
>> +++ b/arch/powerpc/sysdev/fsl_rio.c
>> @@ -1523,9 +1523,12 @@ int fsl_rio_setup(struct of_device *dev)
>>  #ifdef CONFIG_E500
>>        saved_mcheck_exception = ppc_md.machine_check_exception;
>>        ppc_md.machine_check_exception = fsl_rio_mcheck_exception;
>> -#endif
>> -       /* Ensure that RFXE is set */
>> +
>> +#ifndef CONFIG_E500MC
>> +       /* Ensure that RFXE is set on e500 v1/v2 */
>>        mtspr(SPRN_HID1, (mfspr(SPRN_HID1) | 0x20000));
>> +#endif /* !E500MC */
>> +#endif /* E500 */
>> 
>>        return 0;
>>  err:
> 
> This prevents you from building a kernel for both normal E500 and E500MC.
> 
> Gr{oetje,eeting}s,

Also, not a fan of the magic number 0x20000.

- k

Patch

diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 954a754..785a882 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -1523,9 +1523,12 @@  int fsl_rio_setup(struct of_device *dev)
 #ifdef CONFIG_E500
 	saved_mcheck_exception = ppc_md.machine_check_exception;
 	ppc_md.machine_check_exception = fsl_rio_mcheck_exception;
-#endif
-	/* Ensure that RFXE is set */
+	
+#ifndef CONFIG_E500MC
+	/* Ensure that RFXE is set on e500 v1/v2 */
 	mtspr(SPRN_HID1, (mfspr(SPRN_HID1) | 0x20000));
+#endif /* !E500MC */
+#endif /* E500 */
 
 	return 0;
 err: