diff mbox series

sh: hd64461: fix virq offsets

Message ID 20230709121311.211720-1-contact@artur-rojek.eu (mailing list archive)
State New, archived
Headers show
Series sh: hd64461: fix virq offsets | expand

Commit Message

Artur Rojek July 9, 2023, 12:13 p.m. UTC
A recent change to start counting SuperH IRQ #s from 16 breaks support
for the Hitachi HD64461 companion chip.

Move the offchip IRQ base and HD64461 IRQ # by 16 in order to
accommodate for the new virq numbering rules.

Fixes: a8ac2961148e ("sh: Avoid using IRQ0 on SH3 and SH4")
Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
---
 arch/sh/cchips/Kconfig        | 4 ++--
 arch/sh/include/asm/hd64461.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

John Paul Adrian Glaubitz July 9, 2023, 12:48 p.m. UTC | #1
Hi Artur!

On Sun, 2023-07-09 at 14:13 +0200, Artur Rojek wrote:
> A recent change to start counting SuperH IRQ #s from 16 breaks support
> for the Hitachi HD64461 companion chip.
> 
> Move the offchip IRQ base and HD64461 IRQ # by 16 in order to
> accommodate for the new virq numbering rules.
> 
> Fixes: a8ac2961148e ("sh: Avoid using IRQ0 on SH3 and SH4")
> Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
> ---
>  arch/sh/cchips/Kconfig        | 4 ++--
>  arch/sh/include/asm/hd64461.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/sh/cchips/Kconfig b/arch/sh/cchips/Kconfig
> index efde2edb5627..9659a0bc58de 100644
> --- a/arch/sh/cchips/Kconfig
> +++ b/arch/sh/cchips/Kconfig
> @@ -29,9 +29,9 @@ endchoice
>  config HD64461_IRQ
>  	int "HD64461 IRQ"
>  	depends on HD64461
> -	default "36"
> +	default "52"
>  	help
> -	  The default setting of the HD64461 IRQ is 36.
> +	  The default setting of the HD64461 IRQ is 52.
>  
>  	  Do not change this unless you know what you are doing.
>  
> diff --git a/arch/sh/include/asm/hd64461.h b/arch/sh/include/asm/hd64461.h
> index afb24cb034b1..6d85db6cf54b 100644
> --- a/arch/sh/include/asm/hd64461.h
> +++ b/arch/sh/include/asm/hd64461.h
> @@ -229,7 +229,7 @@
>  #define	HD64461_NIMR		HD64461_IO_OFFSET(0x5002)
>  
>  #define	HD64461_IRQBASE		OFFCHIP_IRQ_BASE
> -#define	OFFCHIP_IRQ_BASE	64
> +#define	OFFCHIP_IRQ_BASE	80
>  #define	HD64461_IRQ_NUM		16
>  
>  #define	HD64461_IRQ_UART	(HD64461_IRQBASE+5)

I think it would be better to write this as (64 + 16) for consistency
with the other changes made by Sergey.

Adrian
Artur Rojek July 9, 2023, 12:56 p.m. UTC | #2
On 2023-07-09 14:48, John Paul Adrian Glaubitz wrote:
> Hi Artur!
> 
> On Sun, 2023-07-09 at 14:13 +0200, Artur Rojek wrote:
>> A recent change to start counting SuperH IRQ #s from 16 breaks support
>> for the Hitachi HD64461 companion chip.
>> 
>> Move the offchip IRQ base and HD64461 IRQ # by 16 in order to
>> accommodate for the new virq numbering rules.
>> 
>> Fixes: a8ac2961148e ("sh: Avoid using IRQ0 on SH3 and SH4")
>> Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
>> ---
>>  arch/sh/cchips/Kconfig        | 4 ++--
>>  arch/sh/include/asm/hd64461.h | 2 +-
>>  2 files changed, 3 insertions(+), 3 deletions(-)
>> 
>> diff --git a/arch/sh/cchips/Kconfig b/arch/sh/cchips/Kconfig
>> index efde2edb5627..9659a0bc58de 100644
>> --- a/arch/sh/cchips/Kconfig
>> +++ b/arch/sh/cchips/Kconfig
>> @@ -29,9 +29,9 @@ endchoice
>>  config HD64461_IRQ
>>  	int "HD64461 IRQ"
>>  	depends on HD64461
>> -	default "36"
>> +	default "52"
>>  	help
>> -	  The default setting of the HD64461 IRQ is 36.
>> +	  The default setting of the HD64461 IRQ is 52.
>> 
>>  	  Do not change this unless you know what you are doing.
>> 
>> diff --git a/arch/sh/include/asm/hd64461.h 
>> b/arch/sh/include/asm/hd64461.h
>> index afb24cb034b1..6d85db6cf54b 100644
>> --- a/arch/sh/include/asm/hd64461.h
>> +++ b/arch/sh/include/asm/hd64461.h
>> @@ -229,7 +229,7 @@
>>  #define	HD64461_NIMR		HD64461_IO_OFFSET(0x5002)
>> 
>>  #define	HD64461_IRQBASE		OFFCHIP_IRQ_BASE
>> -#define	OFFCHIP_IRQ_BASE	64
>> +#define	OFFCHIP_IRQ_BASE	80
>>  #define	HD64461_IRQ_NUM		16
>> 
>>  #define	HD64461_IRQ_UART	(HD64461_IRQBASE+5)
> 
> I think it would be better to write this as (64 + 16) for consistency
> with the other changes made by Sergey.
Sure, I will send v2 with this change, although the same can't be
applied to HD64461_IRQ value above, so some inconsistency will exist
either way.
> 
> Adrian
John Paul Adrian Glaubitz July 9, 2023, 12:59 p.m. UTC | #3
Hi!

On Sun, 2023-07-09 at 14:56 +0200, Artur Rojek wrote:
> On 2023-07-09 14:48, John Paul Adrian Glaubitz wrote:
> > Hi Artur!
> > 
> > On Sun, 2023-07-09 at 14:13 +0200, Artur Rojek wrote:
> > > A recent change to start counting SuperH IRQ #s from 16 breaks support
> > > for the Hitachi HD64461 companion chip.
> > > 
> > > Move the offchip IRQ base and HD64461 IRQ # by 16 in order to
> > > accommodate for the new virq numbering rules.
> > > 
> > > Fixes: a8ac2961148e ("sh: Avoid using IRQ0 on SH3 and SH4")
> > > Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
> > > ---
> > >  arch/sh/cchips/Kconfig        | 4 ++--
> > >  arch/sh/include/asm/hd64461.h | 2 +-
> > >  2 files changed, 3 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/arch/sh/cchips/Kconfig b/arch/sh/cchips/Kconfig
> > > index efde2edb5627..9659a0bc58de 100644
> > > --- a/arch/sh/cchips/Kconfig
> > > +++ b/arch/sh/cchips/Kconfig
> > > @@ -29,9 +29,9 @@ endchoice
> > >  config HD64461_IRQ
> > >  	int "HD64461 IRQ"
> > >  	depends on HD64461
> > > -	default "36"
> > > +	default "52"
> > >  	help
> > > -	  The default setting of the HD64461 IRQ is 36.
> > > +	  The default setting of the HD64461 IRQ is 52.
> > > 
> > >  	  Do not change this unless you know what you are doing.
> > > 
> > > diff --git a/arch/sh/include/asm/hd64461.h 
> > > b/arch/sh/include/asm/hd64461.h
> > > index afb24cb034b1..6d85db6cf54b 100644
> > > --- a/arch/sh/include/asm/hd64461.h
> > > +++ b/arch/sh/include/asm/hd64461.h
> > > @@ -229,7 +229,7 @@
> > >  #define	HD64461_NIMR		HD64461_IO_OFFSET(0x5002)
> > > 
> > >  #define	HD64461_IRQBASE		OFFCHIP_IRQ_BASE
> > > -#define	OFFCHIP_IRQ_BASE	64
> > > +#define	OFFCHIP_IRQ_BASE	80
> > >  #define	HD64461_IRQ_NUM		16
> > > 
> > >  #define	HD64461_IRQ_UART	(HD64461_IRQBASE+5)
> > 
> > I think it would be better to write this as (64 + 16) for consistency
> > with the other changes made by Sergey.
>
> Sure, I will send v2 with this change, although the same can't be
> applied to HD64461_IRQ value above, so some inconsistency will exist
> either way.
> 

That's okay, that's the user-facing part ;-).

Btw, did you verify that the default assigned IRQ is actually changed from
36 to 52 when the machine boots?

Adrian
Geert Uytterhoeven July 9, 2023, 1:18 p.m. UTC | #4
On Sun, Jul 9, 2023 at 2:59 PM John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
> On Sun, 2023-07-09 at 14:56 +0200, Artur Rojek wrote:
> > On 2023-07-09 14:48, John Paul Adrian Glaubitz wrote:
> > > On Sun, 2023-07-09 at 14:13 +0200, Artur Rojek wrote:
> > > > A recent change to start counting SuperH IRQ #s from 16 breaks support
> > > > for the Hitachi HD64461 companion chip.
> > > >
> > > > Move the offchip IRQ base and HD64461 IRQ # by 16 in order to
> > > > accommodate for the new virq numbering rules.
> > > >
> > > > Fixes: a8ac2961148e ("sh: Avoid using IRQ0 on SH3 and SH4")
> > > > Signed-off-by: Artur Rojek <contact@artur-rojek.eu>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> > > > --- a/arch/sh/cchips/Kconfig
> > > > +++ b/arch/sh/cchips/Kconfig
> > > > @@ -29,9 +29,9 @@ endchoice
> > > >  config HD64461_IRQ
> > > >   int "HD64461 IRQ"
> > > >   depends on HD64461
> > > > - default "36"
> > > > + default "52"
> > > >   help
> > > > -   The default setting of the HD64461 IRQ is 36.
> > > > +   The default setting of the HD64461 IRQ is 52.
> > > >
> > > >     Do not change this unless you know what you are doing.
> > > >
> > > > diff --git a/arch/sh/include/asm/hd64461.h
> > > > b/arch/sh/include/asm/hd64461.h
> > > > index afb24cb034b1..6d85db6cf54b 100644
> > > > --- a/arch/sh/include/asm/hd64461.h
> > > > +++ b/arch/sh/include/asm/hd64461.h
> > > > @@ -229,7 +229,7 @@
> > > >  #define  HD64461_NIMR            HD64461_IO_OFFSET(0x5002)
> > > >
> > > >  #define  HD64461_IRQBASE         OFFCHIP_IRQ_BASE
> > > > -#define  OFFCHIP_IRQ_BASE        64
> > > > +#define  OFFCHIP_IRQ_BASE        80
> > > >  #define  HD64461_IRQ_NUM         16
> > > >
> > > >  #define  HD64461_IRQ_UART        (HD64461_IRQBASE+5)
> > >
> > > I think it would be better to write this as (64 + 16) for consistency
> > > with the other changes made by Sergey.

Ideally, we want to have a #define for that...

> > Sure, I will send v2 with this change, although the same can't be
> > applied to HD64461_IRQ value above, so some inconsistency will exist
> > either way.
>
> That's okay, that's the user-facing part ;-).

Do we want to keep this Kconfig option? It is rather fragile, and there is
no in-tree config file overriding the default value.
Presumably it was introduced to support an out-of-tree board with
a different wiring.

BTW, there's also this (unused) definition:

arch/sh/include/mach-common/mach/hp6xx.h:#define HP680_HD64461_IRQ
 evt2irq(0x680)  /* IRQ4_IRQ */

Gr{oetje,eeting}s,

                        Geert
Artur Rojek July 10, 2023, 11:25 p.m. UTC | #5
On 2023-07-09 14:59, John Paul Adrian Glaubitz wrote:
> Hi!
> 
> On Sun, 2023-07-09 at 14:56 +0200, Artur Rojek wrote:
>> On 2023-07-09 14:48, John Paul Adrian Glaubitz wrote:
>> > Hi Artur!
>> >
>> > On Sun, 2023-07-09 at 14:13 +0200, Artur Rojek wrote:
>> > > A recent change to start counting SuperH IRQ #s from 16 breaks support
>> > > for the Hitachi HD64461 companion chip.
>> > >
>> > > Move the offchip IRQ base and HD64461 IRQ # by 16 in order to
>> > > accommodate for the new virq numbering rules.
>> > >
>> > > Fixes: a8ac2961148e ("sh: Avoid using IRQ0 on SH3 and SH4")
>> > > Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
>> > > ---
>> > >  arch/sh/cchips/Kconfig        | 4 ++--
>> > >  arch/sh/include/asm/hd64461.h | 2 +-
>> > >  2 files changed, 3 insertions(+), 3 deletions(-)
>> > >
>> > > diff --git a/arch/sh/cchips/Kconfig b/arch/sh/cchips/Kconfig
>> > > index efde2edb5627..9659a0bc58de 100644
>> > > --- a/arch/sh/cchips/Kconfig
>> > > +++ b/arch/sh/cchips/Kconfig
>> > > @@ -29,9 +29,9 @@ endchoice
>> > >  config HD64461_IRQ
>> > >  	int "HD64461 IRQ"
>> > >  	depends on HD64461
>> > > -	default "36"
>> > > +	default "52"
>> > >  	help
>> > > -	  The default setting of the HD64461 IRQ is 36.
>> > > +	  The default setting of the HD64461 IRQ is 52.
>> > >
>> > >  	  Do not change this unless you know what you are doing.
>> > >
>> > > diff --git a/arch/sh/include/asm/hd64461.h
>> > > b/arch/sh/include/asm/hd64461.h
>> > > index afb24cb034b1..6d85db6cf54b 100644
>> > > --- a/arch/sh/include/asm/hd64461.h
>> > > +++ b/arch/sh/include/asm/hd64461.h
>> > > @@ -229,7 +229,7 @@
>> > >  #define	HD64461_NIMR		HD64461_IO_OFFSET(0x5002)
>> > >
>> > >  #define	HD64461_IRQBASE		OFFCHIP_IRQ_BASE
>> > > -#define	OFFCHIP_IRQ_BASE	64
>> > > +#define	OFFCHIP_IRQ_BASE	80
>> > >  #define	HD64461_IRQ_NUM		16
>> > >
>> > >  #define	HD64461_IRQ_UART	(HD64461_IRQBASE+5)
>> >
>> > I think it would be better to write this as (64 + 16) for consistency
>> > with the other changes made by Sergey.
>> 
>> Sure, I will send v2 with this change, although the same can't be
>> applied to HD64461_IRQ value above, so some inconsistency will exist
>> either way.
>> 
> 
> That's okay, that's the user-facing part ;-).
> 
> Btw, did you verify that the default assigned IRQ is actually changed 
> from
> 36 to 52 when the machine boots?
If I understood the question correctly, then yes, the new virq number
for HD64461 interrupt is now 52 and the cchip interrupts need this patch
to work.

Cheers,
Artur
> 
> Adrian
diff mbox series

Patch

diff --git a/arch/sh/cchips/Kconfig b/arch/sh/cchips/Kconfig
index efde2edb5627..9659a0bc58de 100644
--- a/arch/sh/cchips/Kconfig
+++ b/arch/sh/cchips/Kconfig
@@ -29,9 +29,9 @@  endchoice
 config HD64461_IRQ
 	int "HD64461 IRQ"
 	depends on HD64461
-	default "36"
+	default "52"
 	help
-	  The default setting of the HD64461 IRQ is 36.
+	  The default setting of the HD64461 IRQ is 52.
 
 	  Do not change this unless you know what you are doing.
 
diff --git a/arch/sh/include/asm/hd64461.h b/arch/sh/include/asm/hd64461.h
index afb24cb034b1..6d85db6cf54b 100644
--- a/arch/sh/include/asm/hd64461.h
+++ b/arch/sh/include/asm/hd64461.h
@@ -229,7 +229,7 @@ 
 #define	HD64461_NIMR		HD64461_IO_OFFSET(0x5002)
 
 #define	HD64461_IRQBASE		OFFCHIP_IRQ_BASE
-#define	OFFCHIP_IRQ_BASE	64
+#define	OFFCHIP_IRQ_BASE	80
 #define	HD64461_IRQ_NUM		16
 
 #define	HD64461_IRQ_UART	(HD64461_IRQBASE+5)