Skip to content

Commit

Permalink
r8169: add ERI functions.
Browse files Browse the repository at this point in the history
Add the ERI functions which would be used by the new chips.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
  • Loading branch information
Hayes Wang authored and Francois Romieu committed Jul 14, 2011
1 parent 92fc43b commit 133ac40
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions drivers/net/r8169.c
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,49 @@ static u32 rtl_csi_read(void __iomem *ioaddr, int addr)
return value;
}

static
void rtl_eri_write(void __iomem *ioaddr, int addr, u32 mask, u32 val, int type)
{
unsigned int i;

BUG_ON((addr & 3) || (mask == 0));
RTL_W32(ERIDR, val);
RTL_W32(ERIAR, ERIAR_WRITE_CMD | type | mask | addr);

for (i = 0; i < 100; i++) {
if (!(RTL_R32(ERIAR) & ERIAR_FLAG))
break;
udelay(100);
}
}

static u32 rtl_eri_read(void __iomem *ioaddr, int addr, int type)
{
u32 value = ~0x00;
unsigned int i;

RTL_W32(ERIAR, ERIAR_READ_CMD | type | ERIAR_MASK_1111 | addr);

for (i = 0; i < 100; i++) {
if (RTL_R32(ERIAR) & ERIAR_FLAG) {
value = RTL_R32(ERIDR);
break;
}
udelay(100);
}

return value;
}

static void
rtl_w1w0_eri(void __iomem *ioaddr, int addr, u32 mask, u32 p, u32 m, int type)
{
u32 val;

val = rtl_eri_read(ioaddr, addr, type);
rtl_eri_write(ioaddr, addr, mask, (val & ~m) | p, type);
}

static u8 rtl8168d_efuse_read(void __iomem *ioaddr, int reg_addr)
{
u8 value = 0xff;
Expand Down

0 comments on commit 133ac40

Please sign in to comment.