From: George Kashperko <george@znau.edu.ua>
To: linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [RFC] AI support (7/14 ssb bus_check_core routine)
Date: Fri, 18 Feb 2011 00:18:42 +0200 [thread overview]
Message-ID: <1297981122.23381.19.camel@dev.znau.edu.ua> (raw)
In-Reply-To: <1297980093.13554.5.camel@maggie>
From: George Kashperko <george@znau.edu.ua>
Move part of the SB-style bus scan code into separate routine
in order to reuse it later with AI-style bus scan.
Signed-off-by: George Kashperko <george@znau.edu.ua>
---
drivers/ssb/scan.c | 173 +++++++++++++++++++-----------------
drivers/ssb/ssb_private.h | 2
2 files changed, 94 insertions(+), 81 deletions(-)
--- linux-wireless-testing.orig/drivers/ssb/scan.c 2011-02-17 14:05:12.000000000 +0200
+++ linux-wireless-testing/drivers/ssb/scan.c 2011-02-17 14:32:49.000000000 +0200
@@ -265,6 +265,96 @@ static int we_support_multiple_80211_cor
return 0;
}
+/* returns 0 if the core is ok and -1 if the core should be ignored */
+int ssb_bus_check_core(struct ssb_device *dev, int *nr_80211_cores, int corenum)
+{
+ struct ssb_bus *bus = dev->bus;
+
+ printk(KERN_DEBUG PFX
+ "Core %d found: %s "
+ "(cc 0x%03X, rev 0x%02X, vendor 0x%04X)\n",
+ corenum, ssb_core_name(dev->id.coreid),
+ dev->id.coreid, dev->id.revision, dev->id.vendor);
+
+ switch (dev->id.coreid) {
+ case SSB_DEV_80211:
+ (*nr_80211_cores)++;
+ if (*nr_80211_cores > 1) {
+ if (!we_support_multiple_80211_cores(bus)) {
+ ssb_dprintk(KERN_INFO PFX "Ignoring additional "
+ "802.11 core\n");
+ return -1;
+ }
+ }
+ break;
+ case SSB_DEV_EXTIF:
+#ifdef CONFIG_SSB_DRIVER_EXTIF
+ if (bus->extif.dev) {
+ ssb_printk(KERN_WARNING PFX
+ "WARNING: Multiple EXTIFs found\n");
+ break;
+ }
+ bus->extif.dev = dev;
+#endif /* CONFIG_SSB_DRIVER_EXTIF */
+ break;
+ case SSB_DEV_CHIPCOMMON:
+ if (bus->chipco.dev) {
+ ssb_printk(KERN_WARNING PFX
+ "WARNING: Multiple ChipCommon found\n");
+ break;
+ }
+ bus->chipco.dev = dev;
+ break;
+ case SSB_DEV_MIPS:
+ case SSB_DEV_MIPS_3302:
+#ifdef CONFIG_SSB_DRIVER_MIPS
+ if (bus->mipscore.dev) {
+ ssb_printk(KERN_WARNING PFX
+ "WARNING: Multiple MIPS cores found\n");
+ break;
+ }
+ bus->mipscore.dev = dev;
+#endif /* CONFIG_SSB_DRIVER_MIPS */
+ break;
+ case SSB_DEV_PCI:
+ case SSB_DEV_PCIE:
+#ifdef CONFIG_SSB_DRIVER_PCICORE
+ if (bus->bustype == SSB_BUSTYPE_PCI) {
+ /* Ignore PCI cores on PCI-E cards.
+ * Ignore PCI-E cores on PCI cards. */
+ if (dev->id.coreid == SSB_DEV_PCI) {
+ if (pci_is_pcie(bus->host_pci))
+ return -1;
+ } else {
+ if (!pci_is_pcie(bus->host_pci))
+ return -1;
+ }
+ }
+ if (bus->pcicore.dev) {
+ ssb_printk(KERN_WARNING PFX
+ "WARNING: Multiple PCI(E) cores found\n");
+ break;
+ }
+ bus->pcicore.dev = dev;
+#endif /* CONFIG_SSB_DRIVER_PCICORE */
+ break;
+ case SSB_DEV_ETHERNET:
+ if (bus->bustype == SSB_BUSTYPE_PCI) {
+ if (bus->host_pci->vendor == PCI_VENDOR_ID_BROADCOM &&
+ (bus->host_pci->device & 0xFF00) == 0x4300) {
+ /* This is a dangling ethernet core on a
+ * wireless device. Ignore it. */
+ return -1;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
int ssb_bus_scan(struct ssb_bus *bus,
unsigned long baseaddr)
{
@@ -353,87 +443,8 @@ int ssb_bus_scan(struct ssb_bus *bus,
dev->ops = bus->ops;
dev->helpers = &ssb_helpers_sb;
- printk(KERN_DEBUG PFX
- "Core %d found: %s "
- "(cc 0x%03X, rev 0x%02X, vendor 0x%04X)\n",
- i, ssb_core_name(dev->id.coreid),
- dev->id.coreid, dev->id.revision, dev->id.vendor);
-
- switch (dev->id.coreid) {
- case SSB_DEV_80211:
- nr_80211_cores++;
- if (nr_80211_cores > 1) {
- if (!we_support_multiple_80211_cores(bus)) {
- ssb_dprintk(KERN_INFO PFX "Ignoring additional "
- "802.11 core\n");
- continue;
- }
- }
- break;
- case SSB_DEV_EXTIF:
-#ifdef CONFIG_SSB_DRIVER_EXTIF
- if (bus->extif.dev) {
- ssb_printk(KERN_WARNING PFX
- "WARNING: Multiple EXTIFs found\n");
- break;
- }
- bus->extif.dev = dev;
-#endif /* CONFIG_SSB_DRIVER_EXTIF */
- break;
- case SSB_DEV_CHIPCOMMON:
- if (bus->chipco.dev) {
- ssb_printk(KERN_WARNING PFX
- "WARNING: Multiple ChipCommon found\n");
- break;
- }
- bus->chipco.dev = dev;
- break;
- case SSB_DEV_MIPS:
- case SSB_DEV_MIPS_3302:
-#ifdef CONFIG_SSB_DRIVER_MIPS
- if (bus->mipscore.dev) {
- ssb_printk(KERN_WARNING PFX
- "WARNING: Multiple MIPS cores found\n");
- break;
- }
- bus->mipscore.dev = dev;
-#endif /* CONFIG_SSB_DRIVER_MIPS */
- break;
- case SSB_DEV_PCI:
- case SSB_DEV_PCIE:
-#ifdef CONFIG_SSB_DRIVER_PCICORE
- if (bus->bustype == SSB_BUSTYPE_PCI) {
- /* Ignore PCI cores on PCI-E cards.
- * Ignore PCI-E cores on PCI cards. */
- if (dev->id.coreid == SSB_DEV_PCI) {
- if (pci_is_pcie(bus->host_pci))
- continue;
- } else {
- if (!pci_is_pcie(bus->host_pci))
- continue;
- }
- }
- if (bus->pcicore.dev) {
- ssb_printk(KERN_WARNING PFX
- "WARNING: Multiple PCI(E) cores found\n");
- break;
- }
- bus->pcicore.dev = dev;
-#endif /* CONFIG_SSB_DRIVER_PCICORE */
- break;
- case SSB_DEV_ETHERNET:
- if (bus->bustype == SSB_BUSTYPE_PCI) {
- if (bus->host_pci->vendor == PCI_VENDOR_ID_BROADCOM &&
- (bus->host_pci->device & 0xFF00) == 0x4300) {
- /* This is a dangling ethernet core on a
- * wireless device. Ignore it. */
- continue;
- }
- }
- break;
- default:
- break;
- }
+ if (ssb_bus_check_core(dev, &nr_80211_cores, i) < 0)
+ continue;
dev_i++;
}
--- linux-wireless-testing.orig/drivers/ssb/ssb_private.h 2011-02-17 14:28:49.000000000 +0200
+++ linux-wireless-testing/drivers/ssb/ssb_private.h 2011-02-17 14:29:06.000000000 +0200
@@ -160,6 +160,8 @@ extern const char *ssb_core_name(u16 cor
extern int ssb_bus_scan(struct ssb_bus *bus,
unsigned long baseaddr);
extern void ssb_iounmap(struct ssb_bus *ssb);
+extern int ssb_bus_check_core(struct ssb_device *dev, int *nr_80211_cores,
+ int corenum);
/* sprom.c */
next prev parent reply other threads:[~2011-02-17 22:27 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-17 15:58 [RFC] AI support George Kashperko
2011-02-17 22:01 ` Michael Büsch
2011-02-17 22:06 ` [RFC] AI support (1/14 ssb admatch redefine) George Kashperko
2011-02-17 22:08 ` [RFC] AI support (2/14 ssb helpers) George Kashperko
2011-02-18 22:29 ` Michael Büsch
2011-02-18 23:15 ` George Kashperko
2011-02-18 23:29 ` Michael Büsch
2011-02-18 23:27 ` George Kashperko
2011-02-17 22:10 ` [RFC] AI support (3/14 ssb irqflag mips core op) George Kashperko
2011-02-17 22:12 ` [RFC] AI support (4/14 ssb mips core irqflag treatment) George Kashperko
2011-02-17 22:14 ` [RFC] AI support (5/14 ssb core control and state helpers) George Kashperko
2011-02-17 22:16 ` [RFC] AI support (6/14 ssb propagate core control and state helpers usage) George Kashperko
2011-02-17 22:18 ` George Kashperko [this message]
2011-02-17 22:20 ` [RFC] AI support (8/14 ssb ssb_bus_detect routine) George Kashperko
2011-02-18 22:35 ` Michael Büsch
2011-02-17 22:23 ` [RFC] AI support (9/14 ssb SB-specific bus scan routine) George Kashperko
2011-02-17 22:25 ` [RFC] AI support (10/14 ssb bus implementation-specific io unmap) George Kashperko
2011-02-17 22:27 ` [RFC] AI support (11/14 ssb separate SB-specific code) George Kashperko
2011-02-17 22:29 ` [RFC] AI support (12/14 ssb mips74k core defs) George Kashperko
2011-02-17 22:31 ` [RFC] AI support (13/14 ssb add AI support) George Kashperko
2011-02-18 22:45 ` Michael Büsch
2011-02-18 23:07 ` George Kashperko
2011-02-18 23:27 ` Michael Büsch
2011-02-18 23:42 ` George Kashperko
2011-02-18 23:54 ` Michael Büsch
2011-02-18 23:51 ` George Kashperko
2011-02-18 23:46 ` Larry Finger
2011-02-18 23:47 ` George Kashperko
2011-02-19 0:06 ` Larry Finger
2011-02-19 0:08 ` George Kashperko
2011-02-19 0:22 ` Larry Finger
2011-02-17 22:35 ` [RFC] AI support (14/14 ssb AI on pci host (untested)) George Kashperko
2011-02-18 2:43 ` [RFC] AI support Henry Ptasinski
2011-02-18 7:39 ` George Kashperko
2011-02-18 11:53 ` Michael Büsch
2011-02-18 12:39 ` George Kashperko
2011-02-18 22:21 ` Michael Büsch
2011-02-18 22:52 ` George Kashperko
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=1297981122.23381.19.camel@dev.znau.edu.ua \
--to=george@znau.edu.ua \
--cc=linux-wireless@vger.kernel.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 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).