linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: Olof Johansson <olof@lixom.net>
Cc: netdev@vger.kernel.org, jgarzik@pobox.com, linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] [2/4] pasemi_mac: irq mapping changes
Date: Mon, 16 Apr 2007 16:32:14 +1000	[thread overview]
Message-ID: <1176705134.4728.10.camel@concordia.ozlabs.ibm.com> (raw)
In-Reply-To: <20070416061818.GD19783@lixom.net>

[-- Attachment #1: Type: text/plain, Size: 3286 bytes --]

On Mon, 2007-04-16 at 01:18 -0500, Olof Johansson wrote:
> Fixes for ethernet IRQ mapping, to move it to the driver instead of in
> the platform setup code.
> 
> 
> Signed-off-by: Olof Johansson <olof@lixom.net>
> 
> Index: powerpc/arch/powerpc/platforms/pasemi/pci.c
> ===================================================================
> --- powerpc.orig/arch/powerpc/platforms/pasemi/pci.c
> +++ powerpc/arch/powerpc/platforms/pasemi/pci.c
> @@ -163,19 +163,6 @@ static void __init pas_fixup_phb_resourc
>  }
>  
> 
> -void __devinit pas_pci_irq_fixup(struct pci_dev *dev)
> -{
> -	/* DMA is special, 84 interrupts (128 -> 211), all but 128
> -	 * need to be mapped by hand here.
> -	 */
> -	if (dev->vendor == 0x1959 && dev->device == 0xa007) {
> -		int i;
> -		for (i = 129; i < 212; i++)
> -			irq_create_mapping(NULL, i);
> -	}
> -}
> -
> -
>  void __init pas_pci_init(void)
>  {
>  	struct device_node *np, *root;
> Index: powerpc/arch/powerpc/platforms/pasemi/setup.c
> ===================================================================
> --- powerpc.orig/arch/powerpc/platforms/pasemi/setup.c
> +++ powerpc/arch/powerpc/platforms/pasemi/setup.c
> @@ -240,5 +240,4 @@ define_machine(pas) {
>  	.check_legacy_ioport    = pas_check_legacy_ioport,
>  	.progress		= pas_progress,
>  	.machine_check_exception = pas_machine_check_handler,
> -	.pci_irq_fixup		= pas_pci_irq_fixup,
>  };
> Index: powerpc/drivers/net/pasemi_mac.c
> ===================================================================
> --- powerpc.orig/drivers/net/pasemi_mac.c
> +++ powerpc/drivers/net/pasemi_mac.c
> @@ -537,6 +537,9 @@ static irqreturn_t pasemi_mac_tx_intr(in
>  static int pasemi_mac_open(struct net_device *dev)
>  {
>  	struct pasemi_mac *mac = netdev_priv(dev);
> +	struct device_node *dma_dn = pci_device_to_OF_node(mac->dma_pdev);
> +	const unsigned int *prop;
> +	int base_irq;
>  	unsigned int flags;
>  	int ret;
>  
> @@ -600,8 +603,24 @@ static int pasemi_mac_open(struct net_de
>  	netif_start_queue(dev);
>  	netif_poll_enable(dev);
>  
> -	ret = request_irq(mac->dma_pdev->irq + mac->dma_txch,
> -			  &pasemi_mac_tx_intr, IRQF_DISABLED,
> +	/* Interrupts are a bit different for our DMA controller: While
> +	 * it's got one a regular PCI device header, the interrupt there
> +	 * is really the base of the range it's using. Each tx and rx
> +	 * channel has it's own interrupt source.
> +	 *
> +	 * The only way to get to the actual hardware interrupt is by
> +	 * getting it from the device tree, since the kernel has done
> +	 * virtual remapping of the sources by the time we can get them
> +	 * from the PCI device.
> +	 */
> +
> +	prop = of_get_property(dma_dn, "interrupts", NULL);
> +	base_irq = *prop;

The recently added virq_to_hw() makes it nice 'n easy to reverse map the
hw irq from the pci_dev:

	  base_irq = virq_to_hw(pdev->irq);


You should also probably check that irq_create_mapping() succeeds, just
to be pedantic.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2007-04-16  6:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-16  6:16 [PATCH] [0/4] pasemi_mac: fixes and enhancements Olof Johansson
2007-04-16  6:17 ` [PATCH] [1/4] pasemi_mac: minor bugfixes Olof Johansson
2007-04-16  6:18 ` [PATCH] [2/4] pasemi_mac: irq mapping changes Olof Johansson
2007-04-16  6:32   ` Michael Ellerman [this message]
2007-04-16  6:19 ` [PATCH] [3/4] pasemi_mac: cleanups and rx performance improvements Olof Johansson
2007-04-16  6:20 ` [PATCH] [4/4] pasemi_mac: phy support Olof Johansson
2007-04-16  7:05 ` [PATCH] [0/4] pasemi_mac: fixes and enhancements Olof Johansson
2007-04-18  6:24 ` [PATCH] [0/5] [v2] " Olof Johansson
2007-04-18  6:25   ` [PATCH] [0/5] [v2] pasemi_mac: minor bugfixes Olof Johansson
2007-04-18  6:25   ` [PATCH] [2/5] [v2] pasemi_mac: irq mapping changes Olof Johansson
2007-04-18  6:26   ` [PATCH] [3/5] [v2] pasemi_mac: cleanups and rx performance improvements Olof Johansson
2007-04-18  6:27   ` [PATCH] [4/5] [v2] pasemi_mac: phy support Olof Johansson
2007-04-18  6:27   ` [PATCH] [5/5] [v2] pasemi_mac: use local-mac-address Olof Johansson

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=1176705134.4728.10.camel@concordia.ozlabs.ibm.com \
    --to=michael@ellerman.id.au \
    --cc=jgarzik@pobox.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=netdev@vger.kernel.org \
    --cc=olof@lixom.net \
    /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 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).