Skip to contentSkip to conversation

Fix silly thinko in sungem network driver.

DISCUSSION Benjamin Herrenschmidt 2 participants 8 messages Feb 21, 2004 1 message not in the archive Network drivers

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 4 lines · Linux Kernel Mailing List

ChangeSet 1.1584, 2004/02/20 14:29:11-08:00, [email protected]

Fix silly thinko in sungem network driver.

Argh. Actually, the patch is wrong as we are losing the 2 other magic bits (the RonPaul bit, dunno what it is, that's how it's called by Apple, end the other bugfix bit, some more apple magic).

Fixed patch on its way ... (as soon as I finish pulling, don't cancel that cset, I'll apply a patch on top of it)

Ben.

#2 lore raw
Quoted 6 lines · Benjamin Herrenschmidt
Quoted 4 lines · Linux Kernel Mailing List

ChangeSet 1.1584, 2004/02/20 14:29:11-08:00, [email protected]

Fix silly thinko in sungem network driver.

Quoted 6 lines

Argh. Actually, the patch is wrong as we are losing the 2 other magic bits (the RonPaul bit, dunno what it is, that's how it's called by Apple, end the other bugfix bit, some more apple magic).

Fixed patch on its way ... (as soon as I finish pulling, don't cancel that cset, I'll apply a patch on top of it)

Here it is:

drivers/net/sungem.c +2 -1
@@ -1837,7 +1837,8 @@
 	 * thresholds (and Apple bug fixes don't exist)
 	 */
 	if (!(readl(gp->regs + GREG_CFG) & GREG_CFG_IBURST)) {
-		cfg = ((2 << 1) & GREG_CFG_TXDMALIM);
+		cfg &= ~(GREG_CFG_TXDMALIM | GREG_CFG_TXDMALIM);
+		cfg |= ((2 << 1) & GREG_CFG_TXDMALIM);
 		cfg |= ((8 << 6) & GREG_CFG_RXDMALIM);
 		writel(cfg, gp->regs + GREG_CFG);
 	}	
#3 lore raw
Quoted 7 lines · On Sat, 21 Feb 2004 11:12:03 +1100 Benjamin Herrenschmidt…
Quoted 6 lines · Benjamin Herrenschmidt
Quoted 4 lines · Linux Kernel Mailing List

ChangeSet 1.1584, 2004/02/20 14:29:11-08:00, [email protected]

Fix silly thinko in sungem network driver.

Quoted 8 lines
Quoted 6 lines

Argh. Actually, the patch is wrong as we are losing the 2 other magic bits (the RonPaul bit, dunno what it is, that's how it's called by Apple, end the other bugfix bit, some more apple magic).

Fixed patch on its way ... (as soon as I finish pulling, don't cancel that cset, I'll apply a patch on top of it)

Here it is:

I thought the idea was that if IBURST doesn't stick, then the Apple specific bits aren't implemented?

That's what the comment says.

#4 lore raw
Quoted 4 lines · David S. Miller

I thought the idea was that if IBURST doesn't stick, then the Apple specific bits aren't implemented?

That's what the comment says.

I though the IBURST that doesn't stick was specific to latest Apple versions ? Those latest Apple versions are _also_ the ones implementing the magic bug fix bits (those appeared with the G5).

Or did I get it backward ? Hrm, maybe I did... Here's Apple code:

	fConfiguration	= kConfiguration_TX_DMA_Limit		// default Configuration value
					| kConfiguration_RX_DMA_Limit
					| kConfiguration_Infinite_Burst
					| kConfiguration_RonPaulBit
					| kConfiguration_EnableBug2Fix;
	WRITE_REGISTER( Configuration, fConfiguration );	// try the default

	ui32 = READ_REGISTER( Configuration );				// read it back
    if ( (ui32 & kConfiguration_Infinite_Burst) == 0 )	
    {													// not infinite-burst capable:
        ELG( 0, 0, 'Lims', "UniNEnet::initChip: set TX_DMA_Limit and RX_DMA_Limit." );
		fConfiguration	= (0x02 << 1) | (0x08 << 6);	// change TX_DMA_Limit, RX_DMA_Limit
		WRITE_REGISTER( Configuration, fConfiguration );
    }

What does your doco says ?

Ben.

#5 lore raw
Quoted 1 line · On Sat, 21 Feb 2004 11:24:50 +1100 Benjamin Herrenschmidt…

Or did I get it backward ? Hrm, maybe I did... Here's Apple code:

This matches the current code, with Linus's fix applied.

Quoted 1 line

What does your doco says ?

It just says that all Sun versions of GEM support the IBURST bit.

It seems clear to me that the current code in Linus's tree is correct and matches what Apple is doing.

#6 lore raw
Quoted 5 lines

It just says that all Sun versions of GEM support the IBURST bit.

It seems clear to me that the current code in Linus's tree is correct and matches what Apple is doing.

Yes it does. it's a bad week for me apparently. I think most of the patches I sent to linus lately had at least a typo, now that ... pffff....

Ben.

#7 lore raw
In reply to Benjamin Herrenschmidt

And some more data:

Apple .h says:

#define kConfiguration_Infinite_Burst 0x00000001 // for Tx only
#define kConfiguration_RonPaulBit 0x00000800 // for pci reads at end of infinite burst, next command is memory read multiple
#define kConfiguration_EnableBug2Fix 0x00001000 // fix Rx hang after overflow

And the OF firmware (forth) driver does:

config rl@ 801 or config rl!

Which is interesting, that is it sets the RonPaulBit and the Infinite Burst bit, and doesn't test the result...

Linus, does your G5 infinite burst bit sticks at all ? I think the idea is that _older_ apple ones didn't have infinite burst, while newer (G5) ones do, but also need the bug fix bits.

Which means the code Linus has is ok (without my latest patch).

Ben.

#8 lore raw
In reply to Benjamin Herrenschmidt
Quoted 4 lines

Here it is:

.../...

And here's the version without the typo

(I shall not code before having breakfast...)

drivers/net/sungem.c +2 -1
@@ -1837,7 +1837,8 @@
 	 * thresholds (and Apple bug fixes don't exist)
 	 */
 	if (!(readl(gp->regs + GREG_CFG) & GREG_CFG_IBURST)) {
-		cfg = ((2 << 1) & GREG_CFG_TXDMALIM);
+		cfg &= ~(GREG_CFG_TXDMALIM | GREG_CFG_RXDMALIM);
+		cfg |= ((2 << 1) & GREG_CFG_TXDMALIM);
 		cfg |= ((8 << 6) & GREG_CFG_RXDMALIM);
 		writel(cfg, gp->regs + GREG_CFG);
 	}