linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ssb-pcmcia: IRQ and DMA related fixes
@ 2008-03-28  9:34 Michael Buesch
  2008-04-01 19:27 ` John W. Linville
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Buesch @ 2008-03-28  9:34 UTC (permalink / raw)
  To: John Linville; +Cc: bcm43xx-dev, linux-wireless

Here come some IRQ and DMA related fixes for the ssb PCMCIA-host code.
Not much to say, actually. I think the patch explains itself.

Signed-off-by: Michael Buesch <mb@bu3sch.de>

---

For 2.6.25

Index: wireless-testing/drivers/ssb/pcmcia.c
===================================================================
--- wireless-testing.orig/drivers/ssb/pcmcia.c	2008-03-28 10:23:09.000000000 +0100
+++ wireless-testing/drivers/ssb/pcmcia.c	2008-03-28 10:25:00.000000000 +0100
@@ -25,17 +25,12 @@
 
 /* Define the following to 1 to enable a printk on each coreswitch. */
 #define SSB_VERBOSE_PCMCIACORESWITCH_DEBUG		0
 
 
 /* PCMCIA configuration registers */
-#define SSB_PCMCIA_CORECTL		0x00
-#define  SSB_PCMCIA_CORECTL_RESET	0x80 /* Core reset */
-#define  SSB_PCMCIA_CORECTL_IRQEN	0x04 /* IRQ enable */
-#define  SSB_PCMCIA_CORECTL_FUNCEN	0x01 /* Function enable */
-#define SSB_PCMCIA_CORECTL2		0x80
 #define SSB_PCMCIA_ADDRESS0		0x2E
 #define SSB_PCMCIA_ADDRESS1		0x30
 #define SSB_PCMCIA_ADDRESS2		0x32
 #define SSB_PCMCIA_MEMSEG		0x34
 #define SSB_PCMCIA_SPROMCTL		0x36
 #define  SSB_PCMCIA_SPROMCTL_IDLE	0
@@ -668,42 +663,55 @@ static ssize_t ssb_pcmcia_attr_sprom_sto
 }
 
 static DEVICE_ATTR(ssb_sprom, 0600,
 		   ssb_pcmcia_attr_sprom_show,
 		   ssb_pcmcia_attr_sprom_store);
 
+static int ssb_pcmcia_cor_setup(struct ssb_bus *bus, u8 cor)
+{
+	u8 val;
+	int err;
+
+	err = ssb_pcmcia_cfg_read(bus, cor, &val);
+	if (err)
+		return err;
+	val &= ~COR_SOFT_RESET;
+	val |= COR_FUNC_ENA | COR_IREQ_ENA | COR_LEVEL_REQ;
+	err = ssb_pcmcia_cfg_write(bus, cor, val);
+	if (err)
+		return err;
+	msleep(40);
+
+	return 0;
+}
+
 void ssb_pcmcia_exit(struct ssb_bus *bus)
 {
 	if (bus->bustype != SSB_BUSTYPE_PCMCIA)
 		return;
 
 	device_remove_file(&bus->host_pcmcia->dev, &dev_attr_ssb_sprom);
 }
 
 int ssb_pcmcia_init(struct ssb_bus *bus)
 {
-	u8 val, offset;
 	int err;
 
 	if (bus->bustype != SSB_BUSTYPE_PCMCIA)
 		return 0;
 
 	/* Switch segment to a known state and sync
 	 * bus->mapped_pcmcia_seg with hardware state. */
 	ssb_pcmcia_switch_segment(bus, 0);
 
-	/* Init IRQ routing */
-	if (bus->chip_id == 0x4306)
-		offset = SSB_PCMCIA_CORECTL;
-	else
-		offset = SSB_PCMCIA_CORECTL2;
-	err = ssb_pcmcia_cfg_read(bus, offset, &val);
+	/* Init the COR register. */
+	err = ssb_pcmcia_cor_setup(bus, CISREG_COR);
 	if (err)
 		goto error;
-	val |= SSB_PCMCIA_CORECTL_IRQEN | SSB_PCMCIA_CORECTL_FUNCEN;
-	err = ssb_pcmcia_cfg_write(bus, offset, val);
+	/* Some cards also need this register to get poked. */
+	err = ssb_pcmcia_cor_setup(bus, CISREG_COR + 0x80);
 	if (err)
 		goto error;
 
 	bus->sprom_size = SSB_PCMCIA_SPROM_SIZE;
 	mutex_init(&bus->sprom_mutex);
 	err = device_create_file(&bus->host_pcmcia->dev, &dev_attr_ssb_sprom);
Index: wireless-testing/drivers/ssb/main.c
===================================================================
--- wireless-testing.orig/drivers/ssb/main.c	2008-03-28 10:23:21.000000000 +0100
+++ wireless-testing/drivers/ssb/main.c	2008-03-28 10:25:00.000000000 +0100
@@ -1061,15 +1061,15 @@ void ssb_device_disable(struct ssb_devic
 EXPORT_SYMBOL(ssb_device_disable);
 
 u32 ssb_dma_translation(struct ssb_device *dev)
 {
 	switch (dev->bus->bustype) {
 	case SSB_BUSTYPE_SSB:
+	case SSB_BUSTYPE_PCMCIA:
 		return 0;
 	case SSB_BUSTYPE_PCI:
-	case SSB_BUSTYPE_PCMCIA:
 		return SSB_PCI_DMA;
 	}
 	return 0;
 }
 EXPORT_SYMBOL(ssb_dma_translation);
 

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

* Re: [PATCH] ssb-pcmcia: IRQ and DMA related fixes
  2008-03-28  9:34 [PATCH] ssb-pcmcia: IRQ and DMA related fixes Michael Buesch
@ 2008-04-01 19:27 ` John W. Linville
  2008-04-02 13:47   ` Michael Buesch
  0 siblings, 1 reply; 3+ messages in thread
From: John W. Linville @ 2008-04-01 19:27 UTC (permalink / raw)
  To: Michael Buesch; +Cc: bcm43xx-dev, linux-wireless

On Fri, Mar 28, 2008 at 10:34:55AM +0100, Michael Buesch wrote:
> Here come some IRQ and DMA related fixes for the ssb PCMCIA-host code.
> Not much to say, actually. I think the patch explains itself.
> 
> Signed-off-by: Michael Buesch <mb@bu3sch.de>
> 
> ---
> 
> For 2.6.25

This seems to build upon these two patches:

commit e7ec2e3230633a858af1b0b359f6c4670dbeb997
Author: Michael Buesch <mb@bu3sch.de>
Date:   Mon Mar 10 17:26:32 2008 +0100

    ssb: Add SPROM/invariants support for PCMCIA devices

    This adds support for reading/writing the SPROM invariants
    for PCMCIA based devices.

    Signed-off-by: Michael Buesch <mb@bu3sch.de>
    Signed-off-by: John W. Linville <linville@tuxdriver.com>

commit ffc7689ddae5cbe12bde437ae0f2b386d568b5cd
Author: Michael Buesch <mb@bu3sch.de>
Date:   Wed Feb 20 19:08:10 2008 +0100

    ssb: Add support for 8bit register access

    This adds support for 8bit wide register reads/writes.
    This is needed in order to support the gigabit ethernet core.

    Signed-off-by: Michael Buesch <mb@bu3sch.de>
    Signed-off-by: John W. Linville <linville@tuxdriver.com>

Those are not in 2.6.25.  Is 2.6.26 OK for this one?

John
-- 
John W. Linville
linville@tuxdriver.com

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

* Re: [PATCH] ssb-pcmcia: IRQ and DMA related fixes
  2008-04-01 19:27 ` John W. Linville
@ 2008-04-02 13:47   ` Michael Buesch
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Buesch @ 2008-04-02 13:47 UTC (permalink / raw)
  To: John W. Linville; +Cc: bcm43xx-dev, linux-wireless

On Tuesday 01 April 2008 21:27:33 John W. Linville wrote:
> On Fri, Mar 28, 2008 at 10:34:55AM +0100, Michael Buesch wrote:
> > Here come some IRQ and DMA related fixes for the ssb PCMCIA-host code.
> > Not much to say, actually. I think the patch explains itself.
> > 
> > Signed-off-by: Michael Buesch <mb@bu3sch.de>
> > 
> > ---
> > 
> > For 2.6.25
> 
> This seems to build upon these two patches:
> 
> commit e7ec2e3230633a858af1b0b359f6c4670dbeb997
> Author: Michael Buesch <mb@bu3sch.de>
> Date:   Mon Mar 10 17:26:32 2008 +0100
> 
>     ssb: Add SPROM/invariants support for PCMCIA devices
> 
>     This adds support for reading/writing the SPROM invariants
>     for PCMCIA based devices.
> 
>     Signed-off-by: Michael Buesch <mb@bu3sch.de>
>     Signed-off-by: John W. Linville <linville@tuxdriver.com>
> 
> commit ffc7689ddae5cbe12bde437ae0f2b386d568b5cd
> Author: Michael Buesch <mb@bu3sch.de>
> Date:   Wed Feb 20 19:08:10 2008 +0100
> 
>     ssb: Add support for 8bit register access
> 
>     This adds support for 8bit wide register reads/writes.
>     This is needed in order to support the gigabit ethernet core.
> 
>     Signed-off-by: Michael Buesch <mb@bu3sch.de>
>     Signed-off-by: John W. Linville <linville@tuxdriver.com>
> 
> Those are not in 2.6.25.  Is 2.6.26 OK for this one?

Yeah, right. I was a little bit confused what was in 2.6.25 :)


-- 
Greetings Michael.

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

end of thread, other threads:[~2008-04-02 13:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-28  9:34 [PATCH] ssb-pcmcia: IRQ and DMA related fixes Michael Buesch
2008-04-01 19:27 ` John W. Linville
2008-04-02 13:47   ` Michael Buesch

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).