diff options
author | Michael Buesch <mb@bu3sch.de> | 2008-03-28 10:34:55 +0100 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-04-08 15:05:56 -0400 |
commit | 9788ba7500c3a6268ceb63296a0f37f34d450beb (patch) | |
tree | 1b4a4a960acafa93e081502afb5207cf66506bae | |
parent | 247367016305637fb981db020679520e354c80c4 (diff) |
ssb-pcmcia: IRQ and DMA related fixes
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>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/ssb/main.c | 2 | ||||
-rw-r--r-- | drivers/ssb/pcmcia.c | 36 |
2 files changed, 23 insertions, 15 deletions
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index e12371916444..2fcfd73b3b6e 100644 --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c @@ -1064,9 +1064,9 @@ 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; diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c index cd49f7c65531..d674cef7210d 100644 --- a/drivers/ssb/pcmcia.c +++ b/drivers/ssb/pcmcia.c @@ -28,11 +28,6 @@ /* 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 @@ -671,6 +666,24 @@ 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) @@ -681,7 +694,6 @@ void ssb_pcmcia_exit(struct ssb_bus *bus) int ssb_pcmcia_init(struct ssb_bus *bus) { - u8 val, offset; int err; if (bus->bustype != SSB_BUSTYPE_PCMCIA) @@ -691,16 +703,12 @@ int ssb_pcmcia_init(struct ssb_bus *bus) * 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; |