devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@linaro.org>
To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Grant Likely <grant.likely@linaro.org>, Michal Simek <monstr@monstr.eu>
Subject: [RFC 8/9] microblaze/pci: Drop PowerPC-ism from irq parsing
Date: Tue, 15 Oct 2013 21:39:22 +0100	[thread overview]
Message-ID: <1381869563-16083-9-git-send-email-grant.likely@linaro.org> (raw)
In-Reply-To: <1381869563-16083-1-git-send-email-grant.likely@linaro.org>

The Microblaze PCI code copied the PowerPC irq handling, but powerpc
needs to handle broken device trees that are not present on Microblaze.
This patch removes the powerpc special case and replaces it with a
direct of_irq_parse_and_map_pci() call.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/include/asm/pci.h |  2 --
 arch/microblaze/pci/pci-common.c  | 71 +--------------------------------------
 2 files changed, 1 insertion(+), 72 deletions(-)

diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h
index d52abb6..935f9be 100644
--- a/arch/microblaze/include/asm/pci.h
+++ b/arch/microblaze/include/asm/pci.h
@@ -127,8 +127,6 @@ extern void of_scan_pci_bridge(struct device_node *node,
 extern void of_scan_bus(struct device_node *node, struct pci_bus *bus);
 extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus);
 
-extern int pci_read_irq_line(struct pci_dev *dev);
-
 extern int pci_bus_find_capability(struct pci_bus *bus,
 						unsigned int devfn, int cap);
 
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 60b386c..5060fc5 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -193,75 +193,6 @@ void pcibios_set_master(struct pci_dev *dev)
 }
 
 /*
- * Reads the interrupt pin to determine if interrupt is use by card.
- * If the interrupt is used, then gets the interrupt line from the
- * openfirmware and sets it in the pci_dev and pci_config line.
- */
-int pci_read_irq_line(struct pci_dev *pci_dev)
-{
-	struct of_phandle_args oirq;
-	unsigned int virq;
-
-	/* The current device-tree that iSeries generates from the HV
-	 * PCI informations doesn't contain proper interrupt routing,
-	 * and all the fallback would do is print out crap, so we
-	 * don't attempt to resolve the interrupts here at all, some
-	 * iSeries specific fixup does it.
-	 *
-	 * In the long run, we will hopefully fix the generated device-tree
-	 * instead.
-	 */
-	pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev));
-
-#ifdef DEBUG
-	memset(&oirq, 0xff, sizeof(oirq));
-#endif
-	/* Try to get a mapping from the device-tree */
-	if (of_irq_parse_pci(pci_dev, &oirq)) {
-		u8 line, pin;
-
-		/* If that fails, lets fallback to what is in the config
-		 * space and map that through the default controller. We
-		 * also set the type to level low since that's what PCI
-		 * interrupts are. If your platform does differently, then
-		 * either provide a proper interrupt tree or don't use this
-		 * function.
-		 */
-		if (pci_read_config_byte(pci_dev, PCI_INTERRUPT_PIN, &pin))
-			return -1;
-		if (pin == 0)
-			return -1;
-		if (pci_read_config_byte(pci_dev, PCI_INTERRUPT_LINE, &line) ||
-		    line == 0xff || line == 0) {
-			return -1;
-		}
-		pr_debug(" No map ! Using line %d (pin %d) from PCI config\n",
-			 line, pin);
-
-		virq = irq_create_mapping(NULL, line);
-		if (virq)
-			irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW);
-	} else {
-		pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
-			 oirq.args_count, oirq.args[0], oirq.args[1],
-			 of_node_full_name(oirq.np));
-
-		virq = irq_create_of_mapping(&oirq);
-	}
-	if (!virq) {
-		pr_debug(" Failed to map !\n");
-		return -1;
-	}
-
-	pr_debug(" Mapped to linux irq %d\n", virq);
-
-	pci_dev->irq = virq;
-
-	return 0;
-}
-EXPORT_SYMBOL(pci_read_irq_line);
-
-/*
  * Platform support for /proc/bus/pci/X/Y mmap()s,
  * modelled on the sparc64 implementation by Dave Miller.
  *  -- paulus.
@@ -959,7 +890,7 @@ void pcibios_setup_bus_devices(struct pci_bus *bus)
 		dev->dev.archdata.dma_data = (void *)PCI_DRAM_OFFSET;
 
 		/* Read default IRQs and fixup if necessary */
-		pci_read_irq_line(dev);
+		dev->irq = of_irq_parse_and_map_pci(dev, 0, 0);
 	}
 }
 
-- 
1.8.1.2

  parent reply	other threads:[~2013-10-15 20:39 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-15 20:39 [RFC 0/9] of: refactor IRQ parsing and add interrupts-extended implementation Grant Likely
2013-10-15 20:39 ` [RFC 1/9] of/irq: Rename of_irq_map_* functions to of_irq_parse_* Grant Likely
2013-10-16 10:47   ` Michal Simek
2013-10-15 20:39 ` [RFC 2/9] of/irq: Replace of_irq with of_phandle_args Grant Likely
2013-10-15 20:39 ` [RFC 4/9] of/irq: Refactor interrupt-map parsing Grant Likely
2013-10-29 16:23   ` Olof Johansson
2013-10-31  1:19     ` Ming Lei
     [not found]     ` <CACxGe6uE+KvycQq3XBavRcvprff6PhBaxX54W_Cb1cfuVpMXvQ@mail.gmail.com>
2013-10-31 18:57       ` Olof Johansson
2013-11-01 14:48         ` Grant Likely
2013-11-01 17:53         ` Grant Likely
     [not found]           ` <20131101175317.A812AC40868-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-01 18:54             ` Grant Likely
2013-11-02  4:16               ` Ming Lei
     [not found]               ` <20131101185401.B298FC40868-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-04  5:04                 ` Olof Johansson
2013-11-05 15:18                   ` Tomasz Figa
2013-11-05 15:21                     ` [PATCH 1/2] of: irq: Fix interrupt-map entry matching Tomasz Figa
2013-11-07 11:32                       ` Tomasz Figa
2013-11-07 16:40                         ` Rob Herring
     [not found]                           ` <CAL_JsqKUaioiz2dw3Sr8f7UfqzjagWH_je2-u_QGYXRK5g1=yg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-07 22:11                             ` Tomasz Figa
2013-11-08  9:37                               ` Grant Likely
2013-11-07 11:50                       ` Sachin Kamat
2013-11-05 15:21                     ` [PATCH 2/2] of: irq: Check for reg property presence only when parsing interrupt-map Tomasz Figa
2013-11-07 11:33                       ` Tomasz Figa
2013-11-01 19:07             ` [RFC 4/9] of/irq: Refactor interrupt-map parsing Stephen Warren
2013-10-31 20:45   ` [RFC 4/9] of/irq: Refactor interrupt-map parsing [CPU hotplug clockevents issue] Stephen Warren
2013-10-15 20:39 ` [RFC 5/9] of: Add helper for printing an of_phandle_args structure Grant Likely
     [not found] ` <1381869563-16083-1-git-send-email-grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-10-15 20:39   ` [RFC 3/9] of/irq: simplify args to irq_create_of_mapping Grant Likely
2013-10-15 20:39   ` [RFC 6/9] of: Add testcases for interrupt parsing Grant Likely
2013-10-15 20:39   ` [RFC 9/9] of/irq: create interrupts-extended property Grant Likely
2013-10-17 17:33     ` Tony Lindgren
2013-10-27 13:46     ` Grant Likely
2013-10-27 20:24       ` Rob Herring
2013-10-28  3:16         ` Mark Rutland
2013-10-28  6:54           ` Kumar Gala
     [not found]       ` <20131027134607.E1782C4039D-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-10-28 21:47         ` Stephen Warren
2013-10-28 22:49           ` Mark Rutland
2013-10-28 23:16           ` Benjamin Herrenschmidt
     [not found]     ` <1381869563-16083-10-git-send-email-grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-10-28  6:54       ` Kumar Gala
     [not found]         ` <31D756E7-A7CD-42ED-8D1D-D1B38B85E3A0-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2013-10-28 23:41           ` Grant Likely
2013-11-11 22:58       ` Peter Crosthwaite
     [not found]         ` <CAEgOgz6=HhBkb2KtxcmHpNdE_0sNngw0NaL2SnLWj1opZkO3SA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-12  6:54           ` Grant Likely
     [not found]             ` <20131112065405.C75E8C42024-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-12  7:49               ` Peter Crosthwaite
     [not found]                 ` <CAEgOgz6j8YsvFgq8ZbE20ocHPA0C-eUGBb7F1gNiVBvJXLa8_g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-12  8:50                   ` Grant Likely
     [not found]                     ` <20131112085038.B6A75C421BB-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-12 23:17                       ` Peter Crosthwaite
2013-11-13  6:14                         ` Grant Likely
2013-11-24  7:04                           ` Peter Crosthwaite
2013-10-17 17:30   ` [RFC 0/9] of: refactor IRQ parsing and add interrupts-extended implementation Tony Lindgren
2013-10-15 20:39 ` [RFC 7/9] of/irq: Create of_irq_parse_and_map_pci() to consolidate arch code Grant Likely
2013-10-15 20:39 ` Grant Likely [this message]
     [not found] ` < 1381869563-16083-10-git-send-email-grant.likely@linaro.org>
     [not found]   ` < CAEgOgz6=HhBkb2KtxcmHpNdE_0sNngw0NaL2SnLWj1opZkO3SA@mail.gmail.com>
     [not found]     ` < 20131112065405.C75E8C42024@trevor.secretlab.ca>
     [not found]       ` < CAEgOgz6j8YsvFgq8ZbE20ocHPA0C-eUGBb7F1gNiVBvJXLa8_g@mail.gmail.com>
     [not found]         ` < 20131112085038.B6A75C421BB@trevor.secretlab.ca>
     [not found]           ` < CAEgOgz4dM1zQdFpOkUwZqAUMUBe2eh3j1Ah0KgomVAOGgrPsVw@mail.gmail.com>
     [not found]             ` < 20131113061425.667F9C41807@trevor.secretlab.ca>
     [not found]               ` < CAEgOgz5BWzo-LGddjG6ZUtKt6GHxLmDUEndFOdVrn+1HTPvpGQ@mail.gmail.com>
     [not found]                 ` <CAEgOgz5BWzo-LGddjG6ZUtKt6GHxLmDUEndFOdVrn+1HTPvpGQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-24 21:32                   ` [RFC 9/9] of/irq: create interrupts-extended property Grant Likely
     [not found]                     ` <20131124213212.226B8C402C3-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-27  9:06                       ` Peter Crosthwaite
     [not found]                 ` < 20131124213212.226B8C402C3@trevor.secretlab.ca>
     [not found]                   ` < CAEgOgz4yhDzy_BFiotK5Qi48sczR3PL1oPjPhNYC9O94P6AnzQ@mail.gmail.com>
     [not found]                     ` <CAEgOgz4yhDzy_BFiotK5Qi48sczR3PL1oPjPhNYC9O94P6AnzQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-27 14:17                       ` Grant Likely
2013-11-28  7:28                         ` Peter Crosthwaite

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=1381869563-16083-9-git-send-email-grant.likely@linaro.org \
    --to=grant.likely@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=monstr@monstr.eu \
    /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).