linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [patch] powerpc: Remove redundant pci_read_irq_line() function for 85xx platform
@ 2007-06-01  8:05 Zang Roy-r61911
  2007-06-01 20:06 ` Andy Fleming
  2007-06-01 23:23 ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 3+ messages in thread
From: Zang Roy-r61911 @ 2007-06-01  8:05 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev list

From: Roy Zang <tie-fei.zang@freescale.com>

Remove redundant pci_read_irq_line() function for 
85xx CDS board.
This function has been realized in common pci_32.c.

Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
---
 arch/powerpc/platforms/85xx/mpc85xx_cds.c |   76 +++++++++++++----------------
 1 files changed, 34 insertions(+), 42 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 1490eb3..27b81ff 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -78,52 +78,44 @@ static int mpc85xx_exclude_device(u_char bus, u_char devfn)
 		return PCIBIOS_SUCCESSFUL;
 }
 
-static void __init mpc85xx_cds_pcibios_fixup(void)
+static void __init mpc85xx_cds_pci_irq_fixup(struct pci_dev *dev)
 {
-	struct pci_dev *dev;
-	u_char		c;
-
-	if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
-					PCI_DEVICE_ID_VIA_82C586_1, NULL))) {
+	u_char c;
+	if (dev->vendor == PCI_VENDOR_ID_VIA) {
+		switch (dev->device) {
+		case PCI_DEVICE_ID_VIA_82C586_1:
+			/*
+			 * U-Boot does not set the enable bits
+			 * for the IDE device. Force them on here.
+			 */
+			pci_read_config_byte(dev, 0x40, &c);
+			c |= 0x03; /* IDE: Chip Enable Bits */
+			pci_write_config_byte(dev, 0x40, c);
+
+			/*
+			 * Since only primary interface works, force the
+			 * IDE function to standard primary IDE interrupt
+			 * w/ 8259 offset
+			 */
+			dev->irq = 14;
+			pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
+			break;
 		/*
-		 * U-Boot does not set the enable bits
-		 * for the IDE device. Force them on here.
+		 * Force legacy USB interrupt routing
 		 */
-		pci_read_config_byte(dev, 0x40, &c);
-		c |= 0x03; /* IDE: Chip Enable Bits */
-		pci_write_config_byte(dev, 0x40, c);
-
-		/*
-		 * Since only primary interface works, force the
-		 * IDE function to standard primary IDE interrupt
-		 * w/ 8259 offset
+		case PCI_DEVICE_ID_VIA_82C586_2:
+		/* There are two USB controllers.
+		 * Identify them by functon number
 		 */
-		dev->irq = 14;
-		pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
-		pci_dev_put(dev);
-	}
-
-	/*
-	 * Force legacy USB interrupt routing
-	 */
-	if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
-					PCI_DEVICE_ID_VIA_82C586_2, NULL))) {
-		dev->irq = 10;
-		pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 10);
-		pci_dev_put(dev);
-	}
-
-	if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
-					PCI_DEVICE_ID_VIA_82C586_2, dev))) {
-		dev->irq = 11;
-		pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 11);
-		pci_dev_put(dev);
+			if (PCI_FUNC(dev->devfn))
+				dev->irq = 11;
+			else
+				dev->irq = 10;
+			pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
+		default:
+			break;
+		}
 	}
-
-	/* Now map all the PCI irqs */
-	dev = NULL;
-	for_each_pci_dev(dev)
-		pci_read_irq_line(dev);
 }
 
 #ifdef CONFIG_PPC_I8259
@@ -259,7 +251,7 @@ static void __init mpc85xx_cds_setup_arch(void)
 	for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
 		add_bridge(np);
 
-	ppc_md.pcibios_fixup = mpc85xx_cds_pcibios_fixup;
+	ppc_md.pci_irq_fixup = mpc85xx_cds_pci_irq_fixup;
 	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
 #endif
 }
-- 
1.5.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] powerpc: Remove redundant pci_read_irq_line() function for 85xx platform
  2007-06-01  8:05 [patch] powerpc: Remove redundant pci_read_irq_line() function for 85xx platform Zang Roy-r61911
@ 2007-06-01 20:06 ` Andy Fleming
  2007-06-01 23:23 ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Fleming @ 2007-06-01 20:06 UTC (permalink / raw)
  To: Zang Roy-r61911; +Cc: linuxppc-dev list, Paul Mackerras


On Jun 1, 2007, at 03:05, Zang Roy-r61911 wrote:

> From: Roy Zang <tie-fei.zang@freescale.com>
>
> Remove redundant pci_read_irq_line() function for
> 85xx CDS board.
> This function has been realized in common pci_32.c.
>
> Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>

Acked-by: Andy Fleming <afleming@freescale.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] powerpc: Remove redundant pci_read_irq_line() function for 85xx platform
  2007-06-01  8:05 [patch] powerpc: Remove redundant pci_read_irq_line() function for 85xx platform Zang Roy-r61911
  2007-06-01 20:06 ` Andy Fleming
@ 2007-06-01 23:23 ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2007-06-01 23:23 UTC (permalink / raw)
  To: Zang Roy-r61911; +Cc: linuxppc-dev list, Paul Mackerras

On Fri, 2007-06-01 at 16:05 +0800, Zang Roy-r61911 wrote:
> From: Roy Zang <tie-fei.zang@freescale.com>
> 
> Remove redundant pci_read_irq_line() function for 
> 85xx CDS board.
> This function has been realized in common pci_32.c.
> 
> Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> ---
>  arch/powerpc/platforms/85xx/mpc85xx_cds.c |   76 +++++++++++++----------------
>  1 files changed, 34 insertions(+), 42 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
> index 1490eb3..27b81ff 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
> @@ -78,52 +78,44 @@ static int mpc85xx_exclude_device(u_char bus, u_char devfn)
>  		return PCIBIOS_SUCCESSFUL;
>  }
>  
> -static void __init mpc85xx_cds_pcibios_fixup(void)
> +static void __init mpc85xx_cds_pci_irq_fixup(struct pci_dev *dev)
>  {
> -	struct pci_dev *dev;
> -	u_char		c;
> -
> -	if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
> -					PCI_DEVICE_ID_VIA_82C586_1, NULL))) {
> +	u_char c;
> +	if (dev->vendor == PCI_VENDOR_ID_VIA) {
> +		switch (dev->device) {
> +		case PCI_DEVICE_ID_VIA_82C586_1:
> +			/*
> +			 * U-Boot does not set the enable bits
> +			 * for the IDE device. Force them on here.
> +			 */
> +			pci_read_config_byte(dev, 0x40, &c);
> +			c |= 0x03; /* IDE: Chip Enable Bits */
> +			pci_write_config_byte(dev, 0x40, c);
> +
> +			/*
> +			 * Since only primary interface works, force the
> +			 * IDE function to standard primary IDE interrupt
> +			 * w/ 8259 offset
> +			 */
> +			dev->irq = 14;
> +			pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
> +			break;
>  		/*
> -		 * U-Boot does not set the enable bits
> -		 * for the IDE device. Force them on here.
> +		 * Force legacy USB interrupt routing
>  		 */
> -		pci_read_config_byte(dev, 0x40, &c);
> -		c |= 0x03; /* IDE: Chip Enable Bits */
> -		pci_write_config_byte(dev, 0x40, c);
> -
> -		/*
> -		 * Since only primary interface works, force the
> -		 * IDE function to standard primary IDE interrupt
> -		 * w/ 8259 offset
> +		case PCI_DEVICE_ID_VIA_82C586_2:
> +		/* There are two USB controllers.
> +		 * Identify them by functon number
>  		 */
> -		dev->irq = 14;
> -		pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
> -		pci_dev_put(dev);
> -	}
> -
> -	/*
> -	 * Force legacy USB interrupt routing
> -	 */
> -	if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
> -					PCI_DEVICE_ID_VIA_82C586_2, NULL))) {
> -		dev->irq = 10;
> -		pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 10);
> -		pci_dev_put(dev);
> -	}
> -
> -	if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
> -					PCI_DEVICE_ID_VIA_82C586_2, dev))) {
> -		dev->irq = 11;
> -		pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 11);
> -		pci_dev_put(dev);
> +			if (PCI_FUNC(dev->devfn))
> +				dev->irq = 11;
> +			else
> +				dev->irq = 10;
> +			pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
> +		default:
> +			break;
> +		}
>  	}
> -
> -	/* Now map all the PCI irqs */
> -	dev = NULL;
> -	for_each_pci_dev(dev)
> -		pci_read_irq_line(dev);
>  }
>  
>  #ifdef CONFIG_PPC_I8259
> @@ -259,7 +251,7 @@ static void __init mpc85xx_cds_setup_arch(void)
>  	for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
>  		add_bridge(np);
>  
> -	ppc_md.pcibios_fixup = mpc85xx_cds_pcibios_fixup;
> +	ppc_md.pci_irq_fixup = mpc85xx_cds_pci_irq_fixup;
>  	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
>  #endif
>  }

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-06-01 23:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-01  8:05 [patch] powerpc: Remove redundant pci_read_irq_line() function for 85xx platform Zang Roy-r61911
2007-06-01 20:06 ` Andy Fleming
2007-06-01 23:23 ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).