All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Olaf Hering <olaf@aepfle.de>
Cc: linuxppc-dev@ozlabs.org, linux-ide@vger.kernel.org,
	Paul Mackeras <paulus@samba.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] add correct interrupt property for pegasos ide
Date: Wed, 4 Apr 2007 20:10:49 +0200	[thread overview]
Message-ID: <200704042010.50088.bzolnier@gmail.com> (raw)
In-Reply-To: <20070404162004.GA3016@aepfle.de>


Hi,

On Wednesday 04 April 2007, Olaf Hering wrote:
> 
> The firmware assigns irq 20/21 to the VIA IDE device on Pegasos.
> But the required interrupt is 14/15.
> Maybe someone confused decimal vs. hexadecimal values.

Good to see Pegasos platform being fixed to do the quirk in the proper way.

However I fail to see how via82cxxx will continue to work without some other
modifications to via82cxxx.c or setup-pci.c, namely how will hwif->irq be
assigned with correct values?

AFAICS:
* via82cxxx.c:init_chipset_via82cxxx() returns '0' instead of 'dev->irq'
  (won't help anyway since chipset is in legacy mode using IRQs 14 and 15)
* on CHRP platform there is no ppc_ide_md.ide_default_irq
* IRQ probing (used by ide-probe.c as a last resort) is unsupported on PPC

therefore hwif->irq won't be set et all after removing quirk from via82cxxx.c

?

Thanks,
Bart

> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> 
> ---
>  arch/powerpc/kernel/prom_init.c |   55 ++++++++++++++++++++++++----------------
>  drivers/ide/pci/via82cxxx.c     |   11 --------
>  2 files changed, 33 insertions(+), 33 deletions(-)
> 
> Index: b/arch/powerpc/kernel/prom_init.c
> ===================================================================
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -2035,39 +2035,50 @@ static void __init fixup_device_tree_map
>  #endif
>  
>  #ifdef CONFIG_PPC_CHRP
> -/* Pegasos and BriQ lacks the "ranges" property in the isa node */
> +/*
> + * Pegasos and BriQ lacks the "ranges" property in the isa node
> + * Pegasos needs decimal IRQ 14/15, not hexadecimal
> + */
>  static void __init fixup_device_tree_chrp(void)
>  {
> -	phandle isa;
> -	u32 isa_ranges[6];
> +	phandle ph;
> +	u32 prop[6];
>  	u32 rloc = 0x01006000; /* IO space; PCI device = 12 */
>  	char *name;
>  	int rc;
>  
>  	name = "/pci@80000000/isa@c";
> -	isa = call_prom("finddevice", 1, 1, ADDR(name));
> -	if (!PHANDLE_VALID(isa)) {
> +	ph = call_prom("finddevice", 1, 1, ADDR(name));
> +	if (!PHANDLE_VALID(ph)) {
>  		name = "/pci@ff500000/isa@6";
> -		isa = call_prom("finddevice", 1, 1, ADDR(name));
> +		ph = call_prom("finddevice", 1, 1, ADDR(name));
>  		rloc = 0x01003000; /* IO space; PCI device = 6 */
>  	}
> -	if (!PHANDLE_VALID(isa))
> -		return;
> -
> -	rc = prom_getproplen(isa, "ranges");
> -	if (rc != 0 && rc != PROM_ERROR)
> -		return;
> -
> -	prom_printf("Fixing up missing ISA range on Pegasos...\n");
> +	if (PHANDLE_VALID(ph)) {
> +		rc = prom_getproplen(ph, "ranges");
> +		if (rc == 0 || rc == PROM_ERROR) {
> +			prom_printf("Fixing up missing ISA range on Pegasos...\n");
> +
> +			prop[0] = 0x1;
> +			prop[1] = 0x0;
> +			prop[2] = rloc;
> +			prop[3] = 0x0;
> +			prop[4] = 0x0;
> +			prop[5] = 0x00010000;
> +			prom_setprop(ph, name, "ranges", prop, sizeof(prop));
> +		}
> +	}
>  
> -	isa_ranges[0] = 0x1;
> -	isa_ranges[1] = 0x0;
> -	isa_ranges[2] = rloc;
> -	isa_ranges[3] = 0x0;
> -	isa_ranges[4] = 0x0;
> -	isa_ranges[5] = 0x00010000;
> -	prom_setprop(isa, name, "ranges",
> -			isa_ranges, sizeof(isa_ranges));
> +	name = "/pci@80000000/ide@C,1";
> +	ph = call_prom("finddevice", 1, 1, ADDR(name));
> +	if (PHANDLE_VALID(ph)) {
> +		prom_printf("Fixing up IDE interrupt on Pegasos...\n");
> +		prop[0] = 14;
> +		prop[1] = 0x0;
> +		prop[2] = 15;
> +		prop[3] = 0x0;
> +		prom_setprop(ph, name, "interrupts", prop, 4*sizeof(u32));
> +	}
>  }
>  #else
>  #define fixup_device_tree_chrp()
> Index: b/drivers/ide/pci/via82cxxx.c
> ===================================================================
> --- a/drivers/ide/pci/via82cxxx.c
> +++ b/drivers/ide/pci/via82cxxx.c
> @@ -35,10 +35,6 @@
>  #include <linux/ide.h>
>  #include <asm/io.h>
>  
> -#ifdef CONFIG_PPC_CHRP
> -#include <asm/processor.h>
> -#endif
> -
>  #include "ide-timing.h"
>  
>  #define DISPLAY_VIA_TIMINGS
> @@ -436,13 +432,6 @@ static void __devinit init_hwif_via82cxx
>  	hwif->tuneproc = &via82cxxx_tune_drive;
>  	hwif->speedproc = &via_set_drive;
>  
> -
> -#ifdef CONFIG_PPC_CHRP
> -	if(machine_is(chrp) && _chrp_type == _CHRP_Pegasos) {
> -		hwif->irq = hwif->channel ? 15 : 14;
> -	}
> -#endif
> -
>  	for (i = 0; i < 2; i++) {
>  		hwif->drives[i].io_32bit = 1;
>  		hwif->drives[i].unmask = (vdev->via_config->flags & VIA_NO_UNMASK) ? 0 : 1;

WARNING: multiple messages have this Message-ID (diff)
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Olaf Hering <olaf@aepfle.de>
Cc: linuxppc-dev@ozlabs.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Paul Mackeras <paulus@samba.org>,
	linux-ide@vger.kernel.org
Subject: Re: [PATCH] add correct interrupt property for pegasos ide
Date: Wed, 4 Apr 2007 20:10:49 +0200	[thread overview]
Message-ID: <200704042010.50088.bzolnier@gmail.com> (raw)
In-Reply-To: <20070404162004.GA3016@aepfle.de>


Hi,

On Wednesday 04 April 2007, Olaf Hering wrote:
> 
> The firmware assigns irq 20/21 to the VIA IDE device on Pegasos.
> But the required interrupt is 14/15.
> Maybe someone confused decimal vs. hexadecimal values.

Good to see Pegasos platform being fixed to do the quirk in the proper way.

However I fail to see how via82cxxx will continue to work without some other
modifications to via82cxxx.c or setup-pci.c, namely how will hwif->irq be
assigned with correct values?

AFAICS:
* via82cxxx.c:init_chipset_via82cxxx() returns '0' instead of 'dev->irq'
  (won't help anyway since chipset is in legacy mode using IRQs 14 and 15)
* on CHRP platform there is no ppc_ide_md.ide_default_irq
* IRQ probing (used by ide-probe.c as a last resort) is unsupported on PPC

therefore hwif->irq won't be set et all after removing quirk from via82cxxx.c

?

Thanks,
Bart

> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> 
> ---
>  arch/powerpc/kernel/prom_init.c |   55 ++++++++++++++++++++++++----------------
>  drivers/ide/pci/via82cxxx.c     |   11 --------
>  2 files changed, 33 insertions(+), 33 deletions(-)
> 
> Index: b/arch/powerpc/kernel/prom_init.c
> ===================================================================
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -2035,39 +2035,50 @@ static void __init fixup_device_tree_map
>  #endif
>  
>  #ifdef CONFIG_PPC_CHRP
> -/* Pegasos and BriQ lacks the "ranges" property in the isa node */
> +/*
> + * Pegasos and BriQ lacks the "ranges" property in the isa node
> + * Pegasos needs decimal IRQ 14/15, not hexadecimal
> + */
>  static void __init fixup_device_tree_chrp(void)
>  {
> -	phandle isa;
> -	u32 isa_ranges[6];
> +	phandle ph;
> +	u32 prop[6];
>  	u32 rloc = 0x01006000; /* IO space; PCI device = 12 */
>  	char *name;
>  	int rc;
>  
>  	name = "/pci@80000000/isa@c";
> -	isa = call_prom("finddevice", 1, 1, ADDR(name));
> -	if (!PHANDLE_VALID(isa)) {
> +	ph = call_prom("finddevice", 1, 1, ADDR(name));
> +	if (!PHANDLE_VALID(ph)) {
>  		name = "/pci@ff500000/isa@6";
> -		isa = call_prom("finddevice", 1, 1, ADDR(name));
> +		ph = call_prom("finddevice", 1, 1, ADDR(name));
>  		rloc = 0x01003000; /* IO space; PCI device = 6 */
>  	}
> -	if (!PHANDLE_VALID(isa))
> -		return;
> -
> -	rc = prom_getproplen(isa, "ranges");
> -	if (rc != 0 && rc != PROM_ERROR)
> -		return;
> -
> -	prom_printf("Fixing up missing ISA range on Pegasos...\n");
> +	if (PHANDLE_VALID(ph)) {
> +		rc = prom_getproplen(ph, "ranges");
> +		if (rc == 0 || rc == PROM_ERROR) {
> +			prom_printf("Fixing up missing ISA range on Pegasos...\n");
> +
> +			prop[0] = 0x1;
> +			prop[1] = 0x0;
> +			prop[2] = rloc;
> +			prop[3] = 0x0;
> +			prop[4] = 0x0;
> +			prop[5] = 0x00010000;
> +			prom_setprop(ph, name, "ranges", prop, sizeof(prop));
> +		}
> +	}
>  
> -	isa_ranges[0] = 0x1;
> -	isa_ranges[1] = 0x0;
> -	isa_ranges[2] = rloc;
> -	isa_ranges[3] = 0x0;
> -	isa_ranges[4] = 0x0;
> -	isa_ranges[5] = 0x00010000;
> -	prom_setprop(isa, name, "ranges",
> -			isa_ranges, sizeof(isa_ranges));
> +	name = "/pci@80000000/ide@C,1";
> +	ph = call_prom("finddevice", 1, 1, ADDR(name));
> +	if (PHANDLE_VALID(ph)) {
> +		prom_printf("Fixing up IDE interrupt on Pegasos...\n");
> +		prop[0] = 14;
> +		prop[1] = 0x0;
> +		prop[2] = 15;
> +		prop[3] = 0x0;
> +		prom_setprop(ph, name, "interrupts", prop, 4*sizeof(u32));
> +	}
>  }
>  #else
>  #define fixup_device_tree_chrp()
> Index: b/drivers/ide/pci/via82cxxx.c
> ===================================================================
> --- a/drivers/ide/pci/via82cxxx.c
> +++ b/drivers/ide/pci/via82cxxx.c
> @@ -35,10 +35,6 @@
>  #include <linux/ide.h>
>  #include <asm/io.h>
>  
> -#ifdef CONFIG_PPC_CHRP
> -#include <asm/processor.h>
> -#endif
> -
>  #include "ide-timing.h"
>  
>  #define DISPLAY_VIA_TIMINGS
> @@ -436,13 +432,6 @@ static void __devinit init_hwif_via82cxx
>  	hwif->tuneproc = &via82cxxx_tune_drive;
>  	hwif->speedproc = &via_set_drive;
>  
> -
> -#ifdef CONFIG_PPC_CHRP
> -	if(machine_is(chrp) && _chrp_type == _CHRP_Pegasos) {
> -		hwif->irq = hwif->channel ? 15 : 14;
> -	}
> -#endif
> -
>  	for (i = 0; i < 2; i++) {
>  		hwif->drives[i].io_32bit = 1;
>  		hwif->drives[i].unmask = (vdev->via_config->flags & VIA_NO_UNMASK) ? 0 : 1;

  reply	other threads:[~2007-04-04 18:01 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-04 11:16 adding Pegasus IDE quirk for pata_via Olaf Hering
2007-04-04 16:20 ` [PATCH] add correct interrupt property for pegasos ide Olaf Hering
2007-04-04 18:10   ` Bartlomiej Zolnierkiewicz [this message]
2007-04-04 18:10     ` Bartlomiej Zolnierkiewicz
2007-04-04 18:11     ` Olaf Hering
2007-04-04 18:42       ` Bartlomiej Zolnierkiewicz
2007-04-05  1:47         ` Benjamin Herrenschmidt
2007-04-05  1:47           ` Benjamin Herrenschmidt
2007-04-05 10:32         ` Olaf Hering
2007-04-05 10:32           ` Olaf Hering
2007-04-05  1:46       ` Benjamin Herrenschmidt
2007-04-05  1:46         ` Benjamin Herrenschmidt
2007-04-05  0:55   ` Stephen Rothwell
2007-04-05  0:55     ` Stephen Rothwell
2007-04-04 23:52 ` adding Pegasus IDE quirk for pata_via Benjamin Herrenschmidt
2007-04-09 13:13 ` Matt Sealey
2007-04-09 14:40   ` Alan Cox
2007-04-09 14:40     ` Alan Cox
2007-04-09 17:39     ` Matt Sealey
2007-04-09 17:39       ` Matt Sealey
2007-04-10 16:22     ` Olaf Hering
2007-04-10 16:22       ` Olaf Hering
2007-08-16 17:01       ` Olaf Hering
2007-08-16 17:01         ` Olaf Hering
2007-08-16 17:00   ` Olaf Hering
2007-08-17 13:10 ` [PATCH] advertise correct IDE mode on Pegasos2 Olaf Hering
2007-08-17 14:33   ` Olaf Hering
2007-08-17 18:19     ` Matt Sealey
2007-08-17 18:30       ` Olaf Hering
2007-08-17 18:27   ` Olaf Hering

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=200704042010.50088.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=olaf@aepfle.de \
    --cc=paulus@samba.org \
    /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.