* [PATCH] libertas: fixes for slow hardware
@ 2007-10-08 9:18 Holger Schurig
2007-10-08 13:15 ` Dan Williams
0 siblings, 1 reply; 6+ messages in thread
From: Holger Schurig @ 2007-10-08 9:18 UTC (permalink / raw)
To: linux-wireless, libertas-dev, Dan Williams
This fixes issues where either the CF module is slow (and needs
more time while downloading the firmware) or where the host
computer is slow, so that some card interrupts arrive while
the system was still downloading the firmware.
Signed-off-by: Vitaly V. Bursov <vitalyvb@ukr.net>
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
--
Index: libertas-2.6/drivers/net/wireless/libertas/if_cs.c
===================================================================
--- libertas-2.6.orig/drivers/net/wireless/libertas/if_cs.c
2007-10-01 14:05:53.000000000 +0200
+++ libertas-2.6/drivers/net/wireless/libertas/if_cs.c 2007-10-01
14:06:43.000000000 +0200
@@ -148,11 +148,11 @@ static int if_cs_poll_while_fw_download(
{
int i;
- for (i = 0; i < 500; i++) {
+ for (i = 0; i < 1000; i++) {
u8 val = if_cs_read8(card, addr);
if (val == reg)
return i;
- udelay(100);
+ udelay(500);
}
return -ETIME;
}
@@ -405,6 +405,7 @@ static struct sk_buff *if_cs_receive_dat
skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + 2);
if (!skb)
goto out;
+ skb->dev = priv->dev;
skb_put(skb, len);
skb_reserve(skb, 2);/* 16 byte align */
data = skb->data;
@@ -878,6 +879,9 @@ static int if_cs_probe(struct pcmcia_dev
goto out3;
}
+ /* Clear any interrupt cause that happend while sending
+ * firmware/initializing card */
+ if_cs_write16(card, IF_CS_C_INT_CAUSE, IF_CS_C_IC_MASK);
if_cs_enable_ints(card);
/* And finally bring the card up */
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] libertas: fixes for slow hardware
2007-10-08 9:18 [PATCH] libertas: fixes for slow hardware Holger Schurig
@ 2007-10-08 13:15 ` Dan Williams
2007-10-09 8:41 ` [PATCH, take 2] " Holger Schurig
0 siblings, 1 reply; 6+ messages in thread
From: Dan Williams @ 2007-10-08 13:15 UTC (permalink / raw)
To: Holger Schurig; +Cc: linux-wireless, libertas-dev
On Mon, 2007-10-08 at 11:18 +0200, Holger Schurig wrote:
> This fixes issues where either the CF module is slow (and needs
> more time while downloading the firmware) or where the host
> computer is slow, so that some card interrupts arrive while
> the system was still downloading the firmware.
>
> Signed-off-by: Vitaly V. Bursov <vitalyvb@ukr.net>
> Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
@@ -405,6 +405,7 @@ static struct sk_buff *if_cs_receive_dat
skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + 2);
if (!skb)
goto out;
+ skb->dev = priv->dev;
skb_put(skb, len);
skb_reserve(skb, 2);/* 16 byte align */
data = skb->data;
This hunk is not necessary, the skb->dev gets set in
libertas_upload_rx_packet() when calling eth_type_trans(). If using a
kernel <= 2.6.21, setting skb->dev should be handled by
libertas_upload_rx_packet() for you later on.
Dan
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH, take 2] libertas: fixes for slow hardware
2007-10-08 13:15 ` Dan Williams
@ 2007-10-09 8:41 ` Holger Schurig
2007-10-09 11:18 ` Dan Williams
2007-10-09 21:18 ` John W. Linville
0 siblings, 2 replies; 6+ messages in thread
From: Holger Schurig @ 2007-10-09 8:41 UTC (permalink / raw)
To: linux-wireless; +Cc: Dan Williams, libertas-dev
Fixes for slow hardware.
Signed-off-by: Vitaly V. Bursov <vitalyvb@ukr.net>
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
Index: libertas-2.6/drivers/net/wireless/libertas/if_cs.c
===================================================================
--- libertas-2.6.orig/drivers/net/wireless/libertas/if_cs.c 2007-10-09 11:40:37.000000000 +0200
+++ libertas-2.6/drivers/net/wireless/libertas/if_cs.c 2007-10-09 11:40:50.000000000 +0200
@@ -148,11 +148,11 @@ static int if_cs_poll_while_fw_download(
{
int i;
- for (i = 0; i < 500; i++) {
+ for (i = 0; i < 1000; i++) {
u8 val = if_cs_read8(card, addr);
if (val == reg)
return i;
- udelay(100);
+ udelay(500);
}
return -ETIME;
}
@@ -878,6 +878,9 @@ static int if_cs_probe(struct pcmcia_dev
goto out3;
}
+ /* Clear any interrupt cause that happend while sending
+ * firmware/initializing card */
+ if_cs_write16(card, IF_CS_C_INT_CAUSE, IF_CS_C_IC_MASK);
if_cs_enable_ints(card);
/* And finally bring the card up */
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH, take 2] libertas: fixes for slow hardware
2007-10-09 8:41 ` [PATCH, take 2] " Holger Schurig
@ 2007-10-09 11:18 ` Dan Williams
2007-10-09 21:18 ` John W. Linville
1 sibling, 0 replies; 6+ messages in thread
From: Dan Williams @ 2007-10-09 11:18 UTC (permalink / raw)
To: Holger Schurig; +Cc: linux-wireless, libertas-dev
On Tue, 2007-10-09 at 10:41 +0200, Holger Schurig wrote:
> Fixes for slow hardware.
>
> Signed-off-by: Vitaly V. Bursov <vitalyvb@ukr.net>
> Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
Acked-by: Dan Williams <dcbw@redhat.com>
> Index: libertas-2.6/drivers/net/wireless/libertas/if_cs.c
> ===================================================================
> --- libertas-2.6.orig/drivers/net/wireless/libertas/if_cs.c 2007-10-09 11:40:37.000000000 +0200
> +++ libertas-2.6/drivers/net/wireless/libertas/if_cs.c 2007-10-09 11:40:50.000000000 +0200
> @@ -148,11 +148,11 @@ static int if_cs_poll_while_fw_download(
> {
> int i;
>
> - for (i = 0; i < 500; i++) {
> + for (i = 0; i < 1000; i++) {
> u8 val = if_cs_read8(card, addr);
> if (val == reg)
> return i;
> - udelay(100);
> + udelay(500);
> }
> return -ETIME;
> }
> @@ -878,6 +878,9 @@ static int if_cs_probe(struct pcmcia_dev
> goto out3;
> }
>
> + /* Clear any interrupt cause that happend while sending
> + * firmware/initializing card */
> + if_cs_write16(card, IF_CS_C_INT_CAUSE, IF_CS_C_IC_MASK);
> if_cs_enable_ints(card);
>
> /* And finally bring the card up */
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH, take 2] libertas: fixes for slow hardware
2007-10-09 8:41 ` [PATCH, take 2] " Holger Schurig
2007-10-09 11:18 ` Dan Williams
@ 2007-10-09 21:18 ` John W. Linville
2007-10-10 7:24 ` Holger Schurig
1 sibling, 1 reply; 6+ messages in thread
From: John W. Linville @ 2007-10-09 21:18 UTC (permalink / raw)
To: Holger Schurig; +Cc: linux-wireless, Dan Williams, libertas-dev
On Tue, Oct 09, 2007 at 10:41:57AM +0200, Holger Schurig wrote:
> @@ -148,11 +148,11 @@ static int if_cs_poll_while_fw_download(
> {
> int i;
>
> - for (i = 0; i < 500; i++) {
> + for (i = 0; i < 1000; i++) {
> u8 val = if_cs_read8(card, addr);
> if (val == reg)
> return i;
> - udelay(100);
> + udelay(500);
> }
> return -ETIME;
> }
10x the maximum delay? Is this really necessary? How did you
determine this was needed?
If it really is necessary, you need to change the "The host polls
the Card Status register for 50 ms..." comment in if_cs_prog_helper
as well.
John
--
John W. Linville
linville@tuxdriver.com
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH, take 2] libertas: fixes for slow hardware
2007-10-09 21:18 ` John W. Linville
@ 2007-10-10 7:24 ` Holger Schurig
0 siblings, 0 replies; 6+ messages in thread
From: Holger Schurig @ 2007-10-10 7:24 UTC (permalink / raw)
To: libertas-dev; +Cc: John W. Linville, Dan Williams, linux-wireless
> > @@ -148,11 +148,11 @@ static int
> > if_cs_poll_while_fw_download( {
> > int i;
> >
> > - for (i = 0; i < 500; i++) {
> > + for (i = 0; i < 1000; i++) {
> > u8 val = if_cs_read8(card, addr);
> > if (val == reg)
> > return i;
> > - udelay(100);
> > + udelay(500);
> > }
> > return -ETIME;
> > }
>
> 10x the maximum delay? Is this really necessary?
>
> How did you determine this was needed?
For my hardware, it was not necessary. My CF card worked with the
old settings.
The documentation, in 2.2.1.2 "CF Interface" says at point 3. a)
"The host polls this for 50 ms before declaring a failure on
the particular block of firmware being downloaded".
Some lines below, in the section about the real firmware (the
former citation was from the section about the helper firmware),
it just says in "8.", after polling card status register:
"The is no definite time period that the host polls this bit
before declaring a failure on this particular block of
firmware".
and in "9.", after card configuration and scratch port register:
"The host polls this 50ms before declaring a failure ..."
So, two times it's 50ms, once it's unspecified.
For me 50ms worked in all cases (my hardware actually reacts in
way less than 50 millisends).
However, Vitaly sent this patch, he had hardware where the
firmware download was failing with the original approach and
where it was necessary to make those values larger. I'm actually
don't know in which of the three cases it failed for him. But
this code piece isn't so time critical:
* the routine will only called during firmware download, not for
normal operation. Especially not when sending commands,
receiving responses or sending/receiving packets
* for my hardware, I never reach the upper ceilings, the routine
routines always way faster.
This are my findings how often it spun loops in
if_cs_poll_while_fw_download():
* While programming the helper firmware: 10 * 1 loop
* While programming the real firmware, 1 * 0 loop, 363 * 1 loop
* While waiting for the expected value in the scratch pad
register: 88 loops
With the original code:
* While programming the helper firmware: 8 * 3 loops, 2 * 1 loop
* While programming the real firmware: 1 * 0 loop, 363 * 1 loop
* While waiting for the expected value in the scratch pad
register: 434 loops
> If it really is necessary, you need to change the "The host
> polls the Card Status register for 50 ms..." comment in
> if_cs_prog_helper as well.
As this is an excerpt from the docs, I don't want to change this
arbitrary.
My problem is that I don't have the hardware that failed with the
original code. If I would have this hardware, I would have
changed if_cs_poll_while_fw_download() so that I could specify
the amount of time it should wait. Or so that I can change the
number of loops it should wait.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-10-10 7:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-08 9:18 [PATCH] libertas: fixes for slow hardware Holger Schurig
2007-10-08 13:15 ` Dan Williams
2007-10-09 8:41 ` [PATCH, take 2] " Holger Schurig
2007-10-09 11:18 ` Dan Williams
2007-10-09 21:18 ` John W. Linville
2007-10-10 7:24 ` Holger Schurig
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).