smc911x: afc_cfg calculation is wrong at case 5
Subsystems (2)
PATCH 12/12 smc911x: afc_cfg calculation is wrong at case 5
BACKDUR calculation is wrong at case 5. Also some cosmetic around smc911x_probe...
AFC_HI is about ((Rx Data Fifo Size)*2/3)/64AFC_LO is AFC_HI/2BACK_DUR is about 5uS*(AFC_LO) rounded down
Rx Data Fifo Size = 10560AFC_HI = 110AFC_LO = 55BACK_DUR = 55 * 5 = 275
drivers/net/smc911x.c +4 -5
@@ -1884,7 +1882,7 @@ }/* -* Function: smc911x_probe(unsigned long ioaddr) +* Function: smc911x_probe(struct net_device *dev, unsigned long ioaddr) * * Purpose: * Tests to see if a given ioaddr points to an SMC911x chip.
@@ -1917,7 +1915,7 @@/* First, see if the endian word is recognized */ val =SMC_GET_BYTE_TEST (); -DBG (SMC_DEBUG_MISC ,"%s: endian probe returned 0x%04x\n" ,CARDNAME , val); +DBG (SMC_DEBUG_MISC ,"%s: endian probe returned 0x%08x\n" ,CARDNAME , val);if (val !=0x87654321 ) {printk (KERN_ERR "Invalid chip endian 0x08%x\n" ,val); retval = -ENODEV ;
@@ -1977,7 +1975,7 @@case 4 :/* 11520 Rx Data Fifo Size */ lp->afc_cfg=0x00783C9F ;break ;case 5 :/* 10560 Rx Data Fifo Size */ - lp->afc_cfg=0x006E374F ;break ; + lp->afc_cfg=0x006E378F ;break ;case 6 :/* 9600 Rx Data Fifo Size */ lp->afc_cfg=0x0064328F ;break ;case 7 :/* 8640 Rx Data Fifo Size */
@@ -2039,8 +2037,7 @@ } }if (dev->irq ==0 ) { -printk ("%s: Couldn't autodetect your IRQ. Use irq=xx.\n" , - dev->name); +printk ("%s: Couldn't autodetect your IRQ\n" , dev->name); retval = -ENODEV ; goto err_out; }
[email protected] <[email protected]> :
[...]
Quoted 2 lines
BACKDUR calculation is wrong at case 5. Also some cosmetic around
smc911x_probe...
If you are in a mood for cosmetic, feel free to turn some unsigned long ioaddr into something more void __iomem *ioaddr and store it in the private part of the device struct instead of dev->base_addr.
[...]
drivers/net/smc911x.c line 1978
Quoted 6 lines
drivers/net/smc911x.c +1
-1@@ -1977,7 +1975,7 @@case 4 :/* 11520 Rx Data Fifo Size */ lp->afc_cfg=0x00783C9F ;break ;case 5 :/* 10560 Rx Data Fifo Size */ - lp->afc_cfg=0x006E374F ;break ; + lp->afc_cfg=0x006E378F ;break ;
Not your fault but the break statement is misplaced.
Signature · 1 line
Ueimor
Quoted 8 lines · Francois Romieu
[email protected] <[email protected]> :
[...]Quoted 2 lines
BACKDUR calculation is wrong at case 5. Also some cosmetic around
smc911x_probe...If you are in a mood for cosmetic, feel free to turn some unsigned long ioaddr into something more void
__iomem*ioaddr and store it in the private part of the device struct instead ofdev->base_addr.
like
struct smc911x_local *lp = netdev_priv(dev); void __iomem *ioaddr = lp->base_addr;
?
Quoted 9 lines
[...]
drivers/net/smc911x.c line 1978
Quoted 6 lines
drivers/net/smc911x.c +1
-1@@ -1977,7 +1975,7 @@case 4 :/* 11520 Rx Data Fifo Size */ lp->afc_cfg=0x00783C9F ;break ;case 5 :/* 10560 Rx Data Fifo Size */ - lp->afc_cfg=0x006E374F ;break ; + lp->afc_cfg=0x006E378F ;break ;Not your fault but the break statement is misplaced.
One line below?
Thanks for all of your comments. I will create a new set of patches...
--
Bora SAHIN
Quoted 9 lines
drivers/net/smc911x.c line 1978
Quoted 7 lines
drivers/net/smc911x.c +1
-1@@ -1977,7 +1975,7 @@case 4 :/* 11520 Rx Data Fifo Size */ lp->afc_cfg=0x00783C9F ;break ;case 5 :/* 10560 Rx Data Fifo Size */ - lp->afc_cfg=0x006E374F ;break ; + lp->afc_cfg=0x006E378F ;break ;Not your fault but the break statement is misplaced.
Or one space ahead? like
lp->afc_cfg=0x006E378F; break;
--
Bora SAHIN