linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: George Kashperko <george@znau.edu.ua>
To: linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [RFC] AI support (1/14 ssb admatch redefine)
Date: Fri, 18 Feb 2011 00:06:10 +0200	[thread overview]
Message-ID: <1297980370.23381.2.camel@dev.znau.edu.ua> (raw)
In-Reply-To: <1297980093.13554.5.camel@maggie>

From: George Kashperko <george@znau.edu.ua>

Move direct master/slave wrappers registers' queries into SSB management code.
Indirect requests to SB management code for wrappers' base/size rather than
direct access to backplane-specific registers will let adding AI-style SSB
buses support without need to alter drivers' code later on.
Signed-off-by: George Kashperko <george@znau.edu.ua>
---
 drivers/ssb/driver_gige.c   |    2 +-
 drivers/ssb/main.c          |    8 ++++++--
 drivers/usb/host/ohci-ssb.c |    8 ++++----
 include/linux/ssb/ssb.h     |    4 ++--
 4 files changed, 13 insertions(+), 9 deletions(-)
--- linux-wireless-testing.orig/drivers/ssb/driver_gige.c	2011-02-08 00:22:45.000000000 +0200
+++ linux-wireless-testing/drivers/ssb/driver_gige.c	2011-02-17 14:00:33.000000000 +0200
@@ -193,7 +193,7 @@ static int ssb_gige_probe(struct ssb_dev
 		ssb_device_enable(sdev, 0);
 
 	/* Setup BAR0. This is a 64k MMIO region. */
-	base = ssb_admatch_base(ssb_read32(sdev, SSB_ADMATCH1));
+	base = ssb_admatch_base(sdev, SSB_ADMATCH1);
 	gige_pcicfg_write32(dev, PCI_BASE_ADDRESS_0, base);
 	gige_pcicfg_write32(dev, PCI_BASE_ADDRESS_1, 0);
 
--- linux-wireless-testing.orig/drivers/ssb/main.c	2011-02-08 00:22:45.000000000 +0200
+++ linux-wireless-testing/drivers/ssb/main.c	2011-02-17 14:00:33.000000000 +0200
@@ -1312,10 +1312,12 @@ error:
 }
 EXPORT_SYMBOL(ssb_bus_powerup);
 
-u32 ssb_admatch_base(u32 adm)
+u32 ssb_admatch_base(struct ssb_device *dev, u32 adm)
 {
 	u32 base = 0;
 
+	adm = ssb_read32(dev, adm);
+
 	switch (adm & SSB_ADM_TYPE) {
 	case SSB_ADM_TYPE0:
 		base = (adm & SSB_ADM_BASE0);
@@ -1336,10 +1338,12 @@ u32 ssb_admatch_base(u32 adm)
 }
 EXPORT_SYMBOL(ssb_admatch_base);
 
-u32 ssb_admatch_size(u32 adm)
+u32 ssb_admatch_size(struct ssb_device *dev, u32 adm)
 {
 	u32 size = 0;
 
+	adm = ssb_read32(dev, adm);
+
 	switch (adm & SSB_ADM_TYPE) {
 	case SSB_ADM_TYPE0:
 		size = ((adm & SSB_ADM_SZ0) >> SSB_ADM_SZ0_SHIFT);
--- linux-wireless-testing.orig/drivers/usb/host/ohci-ssb.c	2011-02-08 00:22:48.000000000 +0200
+++ linux-wireless-testing/drivers/usb/host/ohci-ssb.c	2011-02-17 14:00:33.000000000 +0200
@@ -107,7 +107,7 @@ static int ssb_ohci_attach(struct ssb_de
 	struct ssb_ohci_device *ohcidev;
 	struct usb_hcd *hcd;
 	int err = -ENOMEM;
-	u32 tmp, flags = 0;
+	u32 flags = 0;
 
 	if (dma_set_mask(dev->dma_dev, DMA_BIT_MASK(32)) ||
 	    dma_set_coherent_mask(dev->dma_dev, DMA_BIT_MASK(32)))
@@ -118,6 +118,7 @@ static int ssb_ohci_attach(struct ssb_de
 		flags |= SSB_OHCI_TMSLOW_HOSTMODE;
 		ssb_device_enable(dev, flags);
 	} else if (dev->id.coreid == SSB_DEV_USB20_HOST) {
+		u32 tmp;
 		/*
 		 * USB 2.0 special considerations:
 		 *
@@ -163,9 +164,8 @@ static int ssb_ohci_attach(struct ssb_de
 	ohcidev = hcd_to_ssb_ohci(hcd);
 	ohcidev->enable_flags = flags;
 
-	tmp = ssb_read32(dev, SSB_ADMATCH0);
-	hcd->rsrc_start = ssb_admatch_base(tmp);
-	hcd->rsrc_len = ssb_admatch_size(tmp);
+	hcd->rsrc_start = ssb_admatch_base(dev, SSB_ADMATCH0);
+	hcd->rsrc_len = ssb_admatch_size(dev, SSB_ADMATCH0);
 	hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
 	if (!hcd->regs)
 		goto err_put_hcd;
--- linux-wireless-testing.orig/include/linux/ssb/ssb.h	2011-02-08 00:22:50.000000000 +0200
+++ linux-wireless-testing/include/linux/ssb/ssb.h	2011-02-17 14:00:33.000000000 +0200
@@ -520,8 +520,8 @@ extern int ssb_bus_powerup(struct ssb_bu
 
 
 /* Various helper functions */
-extern u32 ssb_admatch_base(u32 adm);
-extern u32 ssb_admatch_size(u32 adm);
+extern u32 ssb_admatch_base(struct ssb_device *dev, u32 adm);
+extern u32 ssb_admatch_size(struct ssb_device *dev, u32 adm);
 
 /* PCI device mapping and fixup routines.
  * Called from the architecture pcibios init code.




  reply	other threads:[~2011-02-17 22:15 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   ` George Kashperko [this message]
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   ` [RFC] AI support (7/14 ssb bus_check_core routine) George Kashperko
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=1297980370.23381.2.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).