Skip to contentSkip to conversation

pcmcia:yenta_socket.c fix broken wireless cards.

PATCH In review Justin P. Mattock 2 participants 8 messages May 19, 2010 – May 21, 2010 Pcmcia

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pcmcia:yenta_socket.c fix broken wireless cards.

I've an old dell inspiron 1200(amazingly still works), that use's a D-Link DWL-G650, and/or a Dell Wireless 1350 for it's wireless connection.

With using opensuse11.2(kernel:2.6.32*), the card(s) work fine, but as soon as I pulled the latest HEAD, all hell broke loose. So after doing a days worth of bisecting with this machine(painfully slow), it finally came down to this commit:

commit 28ca8dd71fc170090edca62cb8129625d01b7760

Author: Jens K<C3><BC>nzer <[email protected]>
Date:   Sat Mar 6 07:46:16 2010 +0100

pcmcia: honor saved flags in yenta_socket's I365_CSCINT register

Instead of overwriting the I365_CSCINT register, save the old value and merely change the bits we care about.

Part 1 of a series to allow the ISA irq to be used for Cardbus devices if the socket's PCI irq is unusable.

[[email protected]: split up the original patch, commit message]

so after fussing around with this commit, and yenta_socket.c I come up with something, that does get my cards powered up, and all good(hopefully).

Anyways please have a look, if you need me to test something different let me know.

---
 drivers/pcmcia/yenta_socket.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/pcmcia/yenta_socket.c +1 -1
index 83ace27..7d6f43b 100644
@@ -989,7 +989,7 @@ static int yenta_probe_cb_irq(struct yenta_socket *socket)
 	}
 
 	/* generate interrupt, wait */
-	reg = exca_readb(socket, I365_CSCINT);
+	reg = exca_readb(socket, I365_CSCINT | I365_CSC_ANY);
 	exca_writeb(socket, I365_CSCINT, reg | I365_CSC_STSCHG);
 	cb_writel(socket, CB_SOCKET_EVENT, -1);
 	cb_writel(socket, CB_SOCKET_MASK, CB_CSTSMASK);
Signature · 1 line
1.6.5.2.180.gc5b3e
#1 lore raw

Justin,

Quoted 26 lines · Justin P. Mattock

I've an old dell inspiron 1200(amazingly still works), that use's a D-Link DWL-G650, and/or a Dell Wireless 1350 for it's wireless connection.

With using opensuse11.2(kernel:2.6.32*), the card(s) work fine, but as soon as I pulled the latest HEAD, all hell broke loose. So after doing a days worth of bisecting with this machine(painfully slow), it finally came down to this commit:

commit 28ca8dd71fc170090edca62cb8129625d01b7760

Author: Jens K<C3><BC>nzer <[email protected]>
Date:   Sat Mar 6 07:46:16 2010 +0100

pcmcia: honor saved flags in yenta_socket's I365_CSCINT register

Instead of overwriting the I365_CSCINT register, save the old value and merely change the bits we care about.

Part 1 of a series to allow the ISA irq to be used for Cardbus devices if the socket's PCI irq is unusable.

[[email protected]: split up the original patch, commit message]

Quoted 8 lines

so after fussing around with this commit, and yenta_socket.c I come up with something, that does get my cards powered up, and all good(hopefully).

Anyways please have a look, if you need me to test something different let me know.

Thanks for tracking this issue down! Could you check what "reg" returned before you applied your patch, and what it is after you applied your patch?

drivers/pcmcia/yenta_socket.c static int yenta_probe_cb_irq(struct yenta_socket *socket) · line 992

Quoted 10 lines
drivers/pcmcia/yenta_socket.c +1 -1
index 83ace27..7d6f43b 100644
@@ -989,7 +989,7 @@ static int yenta_probe_cb_irq(struct yenta_socket *socket)
 	}
 
 	/* generate interrupt, wait */
-	reg = exca_readb(socket, I365_CSCINT);
+	reg = exca_readb(socket, I365_CSCINT | I365_CSC_ANY);

the second parameter to exca_readb() is the address which we read from. I365_CSCINT is the register at offset 0x05; CSC_ANY isn't a register offset, but 0x0f ... so you're reading now from a register at offset 0x0f.

Still, something needs to be fixed -- and to do that, it'd be great if you could tell us the value of "reg" which works, and the value which doesn't. Then I'll prepare a patch for testing, so that it hopefully not only works on your system, but also on Jens'.

Best,
Dominik

#2 lore raw
Quoted 33 lines · Dominik Brodowski

Justin,

Quoted 30 lines · Justin P. Mattock

I've an old dell inspiron 1200(amazingly still works), that use's a D-Link DWL-G650, and/or a Dell Wireless 1350 for it's wireless connection.

With using opensuse11.2(kernel:2.6.32*), the card(s) work fine, but as soon as I pulled the latest HEAD, all hell broke loose. So after doing a days worth of bisecting with this machine(painfully slow), it finally came down to this commit:

commit 28ca8dd71fc170090edca62cb8129625d01b7760

Author: Jens K<C3><BC>nzer<[email protected]>
Date:   Sat Mar 6 07:46:16 2010 +0100

pcmcia: honor saved flags in yenta_socket's I365_CSCINT register

Instead of overwriting the I365_CSCINT register, save the old value and merely change the bits we care about.

Part 1 of a series to allow the ISA irq to be used for Cardbus devices if the socket's PCI irq is unusable.

[[email protected]: split up the original patch, commit message]

so after fussing around with this commit, and yenta_socket.c I come up with something, that does get my cards powered up, and all good(hopefully).

Quoted 8 lines
Quoted 4 lines

Anyways please have a look, if you need me to test something different let me know.

Thanks for tracking this issue down! Could you check what "reg" returned before you applied your patch, and what it is after you applied your patch?

your welcome!! I went and filed a bug report for this
(cause I didn't know if Id receive a response or not:
https://bugzilla.kernel.org/show_bug.cgi?id=16015(and yes I had a hissy fit).

Quoted 7 lines
Quoted 7 lines
drivers/pcmcia/yenta_socket.c +0 -0
index 83ace27..7d6f43b 100644
@@ -989,7 +989,7 @@ static int yenta_probe_cb_irq(struct yenta_socket *socket)
  	}
 
Quoted 8 lines

drivers/pcmcia/yenta_socket.c static int yenta_probe_cb_irq(struct yenta_socket *socket) · line 992

Quoted 3 lines
drivers/pcmcia/yenta_socket.c +1 -1
  	/* generate interrupt, wait */
-	reg = exca_readb(socket, I365_CSCINT);
+	reg = exca_readb(socket, I365_CSCINT | I365_CSC_ANY);

the second parameter to exca_readb() is the address which we read from. I365_CSCINT is the register at offset 0x05; CSC_ANY isn't a register offset, but 0x0f ... so you're reading now from a register at offset 0x0f.

yeah I wasn't sure what to really do, I ended up replacing(as a test)
I365_CSCINT with I365_GENCTL, I365_INTCTL and I365_STATUS(only I365_STATUS worked out of these as well as I365_CSC_ANY, so I figured as a temporary fix just to use I365_CSC_ANY).

Quoted 8 lines

Still, something needs to be fixed -- and to do that, it'd be great if you could tell us the value of "reg" which works, and the value which doesn't. Then I'll prepare a patch for testing, so that it hopefully not only works on your system, but also on Jens'.

Best,
Dominik

you probably know more in this area than I(so please give me the right commands(if need be), so we can get this thing fixed)

here is what pci looks like without anything on the current head:

yenta_cardbus 0000:02:01.0: TI: probing PCI interrupt failed, trying
to fix

 [   10.708049] yenta_cardbus 0000:02:01.0: Yenta TI: no PCI 
interrupts. Fish. Please report.
 [   10.708061] yenta_cardbus 0000:02:01.0: no PCI IRQ, CardBus support 
disabled for this socket.
 [   10.708066] yenta_cardbus 0000:02:01.0: check your BIOS CardBus, 
BIOS IRQ or ACPI settings.
 [   10.830872] yenta_cardbus 0000:02:01.0: ISA IRQ mask 0x0cf8, PCI irq 0
 [   10.830879] yenta_cardbus 0000:02:01.0: Socket status: 30000020
 [   10.830885] pci_bus 0000:02: Raising subordinate bus# of parent bus 
(#02) from #03 to #06
 [   10.830905] yenta_cardbus 0000:02:01.0: pcmcia: parent PCI bridge 
window: [io  0xd000-0xdfff]
 [   10.830911] yenta_cardbus 0000:02:01.0: pcmcia: parent PCI bridge 
window: [mem 0xdfd00000-0xdfdfffff]
 [   10.830918] pcmcia_socket pcmcia_socket0: cs: memory probe 
0xdfd00000-0xdfdfffff: excluding 0xdfd00000-0xdfd0ffff 0xdfdf0000-0xdfdfffff
 [   10.830990] yenta_cardbus 0000:02:01.0: pcmcia: parent PCI bridge 
window: [mem 0x20000000-0x23ffffff pref]
 [   10.830996] pcmcia_socket pcmcia_socket0: cs: memory probe 
0x20000000-0x23ffffff: excluding 0x20000000-0x23ffffff
 [   10.848538] pcmcia_socket pcmcia_socket0: cs: memory probe 
0x0c0000-0x0fffff: excluding 0xc0000-0xc7fff 0xcc000-0xcffff 0xf0000-0xfffff
 [   10.850120] pcmcia_socket pcmcia_socket0: cs: memory probe 
0xa0000000-0xa0ffffff: clean.
 [   10.850389] pcmcia_socket pcmcia_socket0: cs: memory probe 
0x60000000-0x60ffffff: clean.
 [   10.999905] Adding 2096124k swap on /dev/sda2.  Priority:-1 
extents:1 across:2096124k
 [   11.204044] pcmcia_socket pcmcia_socket0: cardbus cards are not 
supported.
 [   26.031710] pci 0000:00:02.0: PCI INT A -> GSI 16 (level, low) -> 
IRQ 16
 [   26.031719] pci 0000:00:02.0: setting latency timer to 64

and with I365_CSC_ANY being used

pcmcia_socket pcmcia_socket0: pccard: CardBus card inserted into slot 0

 [13915.161101] pci 0000:03:00.0: reg 10: [mem 0x00000000-0x0000ffff]
 [13915.161215] pci 0000:03:00.0: BAR 0: assigned [mem 
0x24000000-0x2400ffff]
 [13915.161225] pci 0000:03:00.0: BAR 0: set to [mem 
0x24000000-0x2400ffff] (PCI address [0x24000000-0x2400ffff]
 [13915.161437] ath5k 0000:03:00.0: enabling device (0000 -> 0002)
 [13915.161452] ath5k 0000:03:00.0: PCI INT A -> GSI 16 (level, low) -> 
IRQ 16
 [13915.161526] ath5k 0000:03:00.0: registered as 'phy1'
 [13916.030695] ath: EEPROM regdomain: 0x10
 [13916.030700] ath: EEPROM indicates we should expect a direct regpair map
 [13916.030705] ath: Country alpha2 being used: CO
 [13916.030708] ath: Regpair used: 0x10
 [13916.033628] phy1: Selected rate control algorithm 'minstrel'
 [13916.036604] ath5k phy1: Atheros AR2414 chip found (MAC: 0x79, PHY: 
0x45)
 [13916.036616] cfg80211: Calling CRDA for country: CO

seems the yenta_probe_irq reg is working fine
its the yenta_probe_cb_irq reg that is the only
trouble area(from what I see).

Justin P. Mattock

#3 lore raw

Jens, Justin,

could both of you test this patch on top of 2.6.34, please?

pcmcia: only keep saved I365_CSCING flag if there is no PCI irq

drivers/pcmcia/yenta_socket.c +5 -2
index 424e576..151ca43 100644
@@ -371,8 +371,11 @@ static int yenta_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
 			exca_writeb(socket, I365_POWER, reg);
 
 		/* CSC interrupt: no ISA irq for CSC */
-		reg = exca_readb(socket, I365_CSCINT);
-		reg &= I365_CSC_IRQ_MASK;
+		reg = 0;
+		if (!socket->dev->irq) {
+			reg = exca_readb(socket, I365_CSCINT);
+			reg &= I365_CSC_IRQ_MASK;
+		}
 		reg |= I365_CSC_DETECT;
 		if (state->flags & SS_IOCARD) {
 			if (state->csc_mask & SS_STSCHG)
#4 lore raw
Quoted 17 lines · Dominik Brodowski

Jens, Justin,

could both of you test this patch on top of 2.6.34, please?

pcmcia: only keep saved I365_CSCING flag if there is no PCI irq

drivers/pcmcia/yenta_socket.c +0 -0
index 424e576..151ca43 100644
@@ -371,8 +371,11 @@ static int yenta_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
  			exca_writeb(socket, I365_POWER, reg);
 
  		/* CSC interrupt: no ISA irq for CSC */

drivers/pcmcia/yenta_socket.c static int yenta_set_socket(struct pcmcia_socket *sock, socket_state_t *state) · line 381

Quoted 10 lines
drivers/pcmcia/yenta_socket.c +5 -2
-		reg = exca_readb(socket, I365_CSCINT);
-		reg&= I365_CSC_IRQ_MASK;
+		reg = 0;
+		if (!socket->dev->irq) {
+			reg = exca_readb(socket, I365_CSCINT);
+			reg&= I365_CSC_IRQ_MASK;
+		}
  		reg |= I365_CSC_DETECT;
  		if (state->flags&  SS_IOCARD) {
  			if (state->csc_mask&  SS_STSCHG)

o.k., I just did a git pull
to the current, now waiting
(compiling)very slow machine) then I'll
verify or not, if a fix has already been
pushed forward, if not then I'll apply
your patch.

Thanks for taking the time with this.

Justin P. Mattock

#5 lore raw
In reply to Dominik Brodowski
Quoted 17 lines · Dominik Brodowski

Jens, Justin,

could both of you test this patch on top of 2.6.34, please?

pcmcia: only keep saved I365_CSCING flag if there is no PCI irq

drivers/pcmcia/yenta_socket.c +0 -0
index 424e576..151ca43 100644
@@ -371,8 +371,11 @@ static int yenta_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
  			exca_writeb(socket, I365_POWER, reg);
 
  		/* CSC interrupt: no ISA irq for CSC */

drivers/pcmcia/yenta_socket.c static int yenta_set_socket(struct pcmcia_socket *sock, socket_state_t *state) · line 381

Quoted 10 lines
drivers/pcmcia/yenta_socket.c +5 -2
-		reg = exca_readb(socket, I365_CSCINT);
-		reg&= I365_CSC_IRQ_MASK;
+		reg = 0;
+		if (!socket->dev->irq) {
+			reg = exca_readb(socket, I365_CSCINT);
+			reg&= I365_CSC_IRQ_MASK;
+		}
  		reg |= I365_CSC_DETECT;
  		if (state->flags&  SS_IOCARD) {
  			if (state->csc_mask&  SS_STSCHG)

o.k. finally built the kernel
with this machine..
with the current head, there is
no fix, after applying your patch
to the current, seems this thing is still
broken. here is some info from dmesg
with the current head with your patch on top:

agpgart-intel 0000:00:00.0: Intel 915GM Chipset

[    9.700307] agpgart-intel 0000:00:00.0: detected 7932K stolen memory
[    9.773503] agpgart-intel 0000:00:00.0: AGP aperture is 256M @ 0xc0000000
[    9.824628] yenta_cardbus 0000:02:01.0: CardBus bridge found [1028:01a6]
[    9.824657] yenta_cardbus 0000:02:01.0: Using CSCINT to route CSC interrupts to PCI
[    9.824661] yenta_cardbus 0000:02:01.0: Routing CardBus interrupts to PCI
[    9.824669] yenta_cardbus 0000:02:01.0: TI: mfunc 0x00001002, devctl 0x64
[    9.914482] input: Video Bus as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/LNXVIDEO:00/input/input2
[    9.914614] ACPI: Video Device [VID] (multi-head: yes  rom: no  post: no)
[    9.914658] [Firmware Bug]: Duplicate ACPI video bus devices for the same VGA controller, please try module parameter "video.allow_duplicates=1"if the current driver doesn't work.
[   10.286343] yenta_cardbus 0000:02:01.0: TI: probing PCI interrupt failed, trying to fix
[   10.387050] yenta_cardbus 0000:02:01.0: Yenta TI: no PCI interrupts. Fish. Please report.
[   10.387062] yenta_cardbus 0000:02:01.0: no PCI IRQ, CardBus support disabled for this socket.
[   10.387066] yenta_cardbus 0000:02:01.0: check your BIOS CardBus, BIOS IRQ or ACPI settings.
[   10.490080] Synaptics Touchpad, model: 1, fw: 6.2, id: 0x8fa0b1, caps: 0xa04713/0x200000/0x0
[   10.531380] input: SynPS/2 Synaptics TouchPad as /devices/platform/i8042/serio1/input/input3
power_supply BAT0: prop SERIAL_NUMBER=4211
[   10.696902] yenta_cardbus 0000:02:01.0: ISA IRQ mask 0x0cf8, PCI irq 0
[   10.696910] yenta_cardbus 0000:02:01.0: Socket status: 30000020
[   10.696916] pci_bus 0000:02: Raising subordinate bus# of parent bus (#02) from #03 to #06
[   10.696935] yenta_cardbus 0000:02:01.0: pcmcia: parent PCI bridge window: [io  0xd000-0xdfff]
[   10.696941] yenta_cardbus 0000:02:01.0: pcmcia: parent PCI bridge window: [mem 0xdfd00000-0xdfdfffff]
[   10.696948] pcmcia_socket pcmcia_socket0: cs: memory probe 0xdfd00000-0xdfdfffff: excluding 0xdfd00000-0xdfd0ffff 0xdfdf0000-0xdfdfffff
[   10.697033] yenta_cardbus 0000:02:01.0: pcmcia: parent PCI bridge window: [mem 0x20000000-0x23ffffff pref]
[   10.697039] pcmcia_socket pcmcia_socket0: cs: memory probe 0x20000000-0x23ffffff: excluding 0x20000000-0x23ffffff
[   10.727273] pcmcia_socket pcmcia_socket0: cs: memory probe 0x0c0000-0x0fffff: excluding 0xc0000-0xc7fff 0xcc000-0xcffff 0xf0000-0xfffff
[   10.727541] pcmcia_socket pcmcia_socket0: cs: memory probe 0xa0000000-0xa0ffffff: clean.
[   10.727801] pcmcia_socket pcmcia_socket0: cs: memory probe 0x60000000-0x60ffffff: clean.
[   10.823429] Intel ICH 0000:00:1e.2: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[   10.823487] Intel ICH 0000:00:1e.2: setting latency timer to 64
[   11.070034] pcmcia_socket pcmcia_socket0: cardbus cards are not supported.
[   11.134038] intel8x0_measure_ac97_clock: measured 50713 usecs (2444 samples)
[   11.134044] intel8x0: clocking to 48000

this is all the info I see in dmesg on this machine (if you need full log let me know).

Justin P. Mattock

#6 lore raw
In reply to Dominik Brodowski
Quoted 17 lines · Dominik Brodowski

Jens, Justin,

could both of you test this patch on top of 2.6.34, please?

pcmcia: only keep saved I365_CSCING flag if there is no PCI irq

drivers/pcmcia/yenta_socket.c +0 -0
index 424e576..151ca43 100644
@@ -371,8 +371,11 @@ static int yenta_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
  			exca_writeb(socket, I365_POWER, reg);
 
  		/* CSC interrupt: no ISA irq for CSC */

drivers/pcmcia/yenta_socket.c static int yenta_set_socket(struct pcmcia_socket *sock, socket_state_t *state) · line 381

Quoted 10 lines
drivers/pcmcia/yenta_socket.c +5 -2
-		reg = exca_readb(socket, I365_CSCINT);
-		reg&= I365_CSC_IRQ_MASK;
+		reg = 0;
+		if (!socket->dev->irq) {
+			reg = exca_readb(socket, I365_CSCINT);
+			reg&= I365_CSC_IRQ_MASK;
+		}
  		reg |= I365_CSC_DETECT;
  		if (state->flags&  SS_IOCARD) {
  			if (state->csc_mask&  SS_STSCHG)

hmm.. not sure if this is even being read or not
as a simple test:

/* CSC interrupt: no ISA irq for CSC */
- reg = exca_readb(socket, I365_CSCINT);
- reg&= I365_CSC_IRQ_MASK;
+ reg = 0;
+ if (!socket->dev->irq) {
+ reg = exca_readb(socket, I365_STATUS);
+ /*reg&= I365_CSC_IRQ_MASK;*/
+ }

just a simple STATUS on this still errors out with the unsupported card thing..

Justin P. Mattock

#7 lore raw

Justin,

would you be willing to test another patch? This one replaces the previous version, and makes the readb() conditional at the right place (hopefully, that is).

Thanks & best,

Dominik

drivers/pcmcia/yenta_socket.c +3 -2
index 424e576..6bf8b2c 100644
@@ -975,7 +975,7 @@ static irqreturn_t yenta_probe_handler(int irq, void *dev_id)
 /* probes the PCI interrupt, use only on override functions */
 static int yenta_probe_cb_irq(struct yenta_socket *socket)
 {
-	u8 reg;
+	u8 reg = 0;
 
 	if (!socket->cb_irq)
 		return -1;
@@ -989,7 +989,8 @@ static int yenta_probe_cb_irq(struct yenta_socket *socket)
 	}
 
 	/* generate interrupt, wait */
-	reg = exca_readb(socket, I365_CSCINT);
+	if (!socket->dev->irq)
+		reg = exca_readb(socket, I365_CSCINT);
 	exca_writeb(socket, I365_CSCINT, reg | I365_CSC_STSCHG);
 	cb_writel(socket, CB_SOCKET_EVENT, -1);
 	cb_writel(socket, CB_SOCKET_MASK, CB_CSTSMASK);