* [PATCH] SSB: fix 32 bit PCMCIA access.
@ 2009-11-06 15:56 Martin Fuzzey
2009-11-06 17:10 ` Michael Buesch
0 siblings, 1 reply; 2+ messages in thread
From: Martin Fuzzey @ 2009-11-06 15:56 UTC (permalink / raw)
To: linux-wireless
The scan function was using 32 bit access which does not
work on 16bit CF cards.
This patch corrects this by doing two 16 bit reads like
ssb_pcmcia_read32 already does (unfortunately we don't
have a struct ssb_device to use that directly).
Signed-off-by: Martin Fuzzey <mfuzzey@gmail.com>
---
drivers/ssb/scan.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/ssb/scan.c b/drivers/ssb/scan.c
index b74212d..6721fa8 100644
--- a/drivers/ssb/scan.c
+++ b/drivers/ssb/scan.c
@@ -162,6 +162,9 @@ static u8 chipid_to_nrcores(u16 chipid)
static u32 scan_read32(struct ssb_bus *bus, u8 current_coreidx,
u16 offset)
{
+ unsigned long flags;
+ u32 lo, hi;
+
switch (bus->bustype) {
case SSB_BUSTYPE_SSB:
offset += current_coreidx * SSB_CORE_SIZE;
@@ -174,7 +177,11 @@ static u32 scan_read32(struct ssb_bus *bus, u8 current_coreidx,
offset -= 0x800;
} else
ssb_pcmcia_switch_segment(bus, 0);
- break;
+ spin_lock_irqsave(&bus->bar_lock, flags);
+ lo = readw(bus->mmio + offset);
+ hi = readw(bus->mmio + offset + 2);
+ spin_unlock_irqrestore(&bus->bar_lock, flags);
+ return lo | (hi << 16);
case SSB_BUSTYPE_SDIO:
offset += current_coreidx * SSB_CORE_SIZE;
return ssb_sdio_scan_read32(bus, offset);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] SSB: fix 32 bit PCMCIA access.
2009-11-06 15:56 [PATCH] SSB: fix 32 bit PCMCIA access Martin Fuzzey
@ 2009-11-06 17:10 ` Michael Buesch
0 siblings, 0 replies; 2+ messages in thread
From: Michael Buesch @ 2009-11-06 17:10 UTC (permalink / raw)
To: Martin Fuzzey; +Cc: linux-wireless
On Friday 06 November 2009 16:56:05 Martin Fuzzey wrote:
> The scan function was using 32 bit access which does not
> work on 16bit CF cards.
>
> This patch corrects this by doing two 16 bit reads like
> ssb_pcmcia_read32 already does (unfortunately we don't
> have a struct ssb_device to use that directly).
>
> Signed-off-by: Martin Fuzzey <mfuzzey@gmail.com>
>
> ---
>
> drivers/ssb/scan.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/ssb/scan.c b/drivers/ssb/scan.c
> index b74212d..6721fa8 100644
> --- a/drivers/ssb/scan.c
> +++ b/drivers/ssb/scan.c
> @@ -162,6 +162,9 @@ static u8 chipid_to_nrcores(u16 chipid)
> static u32 scan_read32(struct ssb_bus *bus, u8 current_coreidx,
> u16 offset)
> {
> + unsigned long flags;
> + u32 lo, hi;
> +
> switch (bus->bustype) {
> case SSB_BUSTYPE_SSB:
> offset += current_coreidx * SSB_CORE_SIZE;
> @@ -174,7 +177,11 @@ static u32 scan_read32(struct ssb_bus *bus, u8 current_coreidx,
> offset -= 0x800;
> } else
> ssb_pcmcia_switch_segment(bus, 0);
> - break;
> + spin_lock_irqsave(&bus->bar_lock, flags);
> + lo = readw(bus->mmio + offset);
> + hi = readw(bus->mmio + offset + 2);
> + spin_unlock_irqrestore(&bus->bar_lock, flags);
> + return lo | (hi << 16);
> case SSB_BUSTYPE_SDIO:
> offset += current_coreidx * SSB_CORE_SIZE;
> return ssb_sdio_scan_read32(bus, offset);
Thanks for spotting this. This really looks like a bug.
I'll test this patch on my device and remove the unnecessary locks and then resubmit upstream.
Next time, please make sure to Cc maintainers. See the MAINTAINERS file.
--
Greetings, Michael.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-06 17:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-06 15:56 [PATCH] SSB: fix 32 bit PCMCIA access Martin Fuzzey
2009-11-06 17:10 ` 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).