netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* r6040: bad udelay call, build failure on ARM with R6040=m
@ 2008-08-25 12:05 Martin Michlmayr
  2008-08-25 21:05 ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Michlmayr @ 2008-08-25 12:05 UTC (permalink / raw)
  To: Florian Fainelli, Sten Wang; +Cc: netdev

r6040 fails to build on ARM with:

ERROR: "__bad_udelay" [drivers/net/r6040.ko] undefined!
make[1]: *** [__modpost] Error 1

__bad_udelay is specifically designed on ARM to fail when udelay is
called in a bad way.  arch/arm/include/asm/delay.h has this to say
about __bad_udelay:

/*
 * This function intentionally does not exist; if you see references to
 * it, it means that you're calling udelay() with an out of range value.
 *
 * With currently imposed limits, this means that we support a max delay
 * of 2000us. Further limits: HZ<=1000 and bogomips<=3355
 */
extern void __bad_udelay(void);

Can you check why your driver is calling udelay() with a value > 2000?

-- 
Martin Michlmayr
http://www.cyrius.com/

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

* Re: r6040: bad udelay call, build failure on ARM with R6040=m
  2008-08-25 12:05 r6040: bad udelay call, build failure on ARM with R6040=m Martin Michlmayr
@ 2008-08-25 21:05 ` Florian Fainelli
  2008-08-26  5:04   ` Martin Michlmayr
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2008-08-25 21:05 UTC (permalink / raw)
  To: Martin Michlmayr; +Cc: Sten Wang, netdev, Martin Michlmayr

Hey Martin,

Le Monday 25 August 2008 14:05:02 Martin Michlmayr, vous avez écrit :
> r6040 fails to build on ARM with:
>
> ERROR: "__bad_udelay" [drivers/net/r6040.ko] undefined!
> make[1]: *** [__modpost] Error 1
>
> __bad_udelay is specifically designed on ARM to fail when udelay is
> called in a bad way.  arch/arm/include/asm/delay.h has this to say
> about __bad_udelay:

Please find/test the patch below :
--
From: Florian Fainelli <florian.fainelli@telecomint.eu>
Subject: [PATCH] r6040: fix bad usage of udelay

This patch fixes the bad usage of udelay(5000), which in turns is a
mdelay(5). It causes compilation for ARM where udelay maximum value
is checked.

Reported-by: Martin Michlmayr <tbm@cyrius.com>
Signed-off-by: Florian Fainelli <florian.fainelli@telecomint.eu>
---
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index d453987..d837bef 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -364,7 +364,7 @@ static void r6040_init_mac_regs(struct net_device *dev)
 	/* Reset internal state machine */
 	iowrite16(2, ioaddr + MAC_SM);
 	iowrite16(0, ioaddr + MAC_SM);
-	udelay(5000);
+	mdelay(5);
 
 	/* MAC Bus Control Register */
 	iowrite16(MBCR_DEFAULT, ioaddr + MBCR);
@@ -800,7 +800,7 @@ static void r6040_mac_address(struct net_device *dev)
 	iowrite16(0x01, ioaddr + MCR1); /* Reset MAC */
 	iowrite16(2, ioaddr + MAC_SM); /* Reset internal state machine */
 	iowrite16(0, ioaddr + MAC_SM);
-	udelay(5000);
+	mdelay(5);
 
 	/* Restore MAC Address */
 	adrp = (u16 *) dev->dev_addr;

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

* Re: r6040: bad udelay call, build failure on ARM with R6040=m
  2008-08-25 21:05 ` Florian Fainelli
@ 2008-08-26  5:04   ` Martin Michlmayr
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Michlmayr @ 2008-08-26  5:04 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: Sten Wang, netdev

* Florian Fainelli <florian.fainelli@telecomint.eu> [2008-08-25 23:05]:
> Please find/test the patch below :

I don't have the hardware to test, but it compiles fine on ARM now.
-- 
Martin Michlmayr
http://www.cyrius.com/

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

end of thread, other threads:[~2008-08-26  5:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-25 12:05 r6040: bad udelay call, build failure on ARM with R6040=m Martin Michlmayr
2008-08-25 21:05 ` Florian Fainelli
2008-08-26  5:04   ` Martin Michlmayr

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