Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 122776
b: refs/heads/master
c: 5664dd5
h: refs/heads/master
v: v3
  • Loading branch information
Baruch Siach authored and David S. Miller committed Dec 19, 2008
1 parent 627b0a0 commit ee09d59
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b88a2a22c6670c31586d1a716255eae4c320b363
refs/heads/master: 5664dd5561850df580414783cf3c8e0aa834c62e
30 changes: 23 additions & 7 deletions trunk/drivers/net/enc28j60.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,32 @@ static void enc28j60_soft_reset(struct enc28j60_net *priv)
*/
static void enc28j60_set_bank(struct enc28j60_net *priv, u8 addr)
{
if ((addr & BANK_MASK) != priv->bank) {
u8 b = (addr & BANK_MASK) >> 5;
u8 b = (addr & BANK_MASK) >> 5;

if (b != (ECON1_BSEL1 | ECON1_BSEL0))
/* These registers (EIE, EIR, ESTAT, ECON2, ECON1)
* are present in all banks, no need to switch bank
*/
if (addr >= EIE && addr <= ECON1)
return;

/* Clear or set each bank selection bit as needed */
if ((b & ECON1_BSEL0) != (priv->bank & ECON1_BSEL0)) {
if (b & ECON1_BSEL0)
spi_write_op(priv, ENC28J60_BIT_FIELD_SET, ECON1,
ECON1_BSEL0);
else
spi_write_op(priv, ENC28J60_BIT_FIELD_CLR, ECON1,
ECON1_BSEL0);
}
if ((b & ECON1_BSEL1) != (priv->bank & ECON1_BSEL1)) {
if (b & ECON1_BSEL1)
spi_write_op(priv, ENC28J60_BIT_FIELD_SET, ECON1,
ECON1_BSEL1);
else
spi_write_op(priv, ENC28J60_BIT_FIELD_CLR, ECON1,
ECON1_BSEL1 | ECON1_BSEL0);
if (b != 0)
spi_write_op(priv, ENC28J60_BIT_FIELD_SET, ECON1, b);
priv->bank = (addr & BANK_MASK);
ECON1_BSEL1);
}
priv->bank = b;
}

/*
Expand Down

0 comments on commit ee09d59

Please sign in to comment.