Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 215193
b: refs/heads/master
c: ddfc87b
h: refs/heads/master
i:
  215191: d5f388c
v: v3
  • Loading branch information
Matt Carlson authored and David S. Miller committed Oct 17, 2010
1 parent 727a16e commit 14a4f87
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3d37728bc55994fdf2888f6c872bdeea03a84cc2
refs/heads/master: ddfc87bfd16f370904c6ff7d23738335dd68d0ce
46 changes: 46 additions & 0 deletions trunk/drivers/net/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,52 @@ static void tg3_mdio_fini(struct tg3 *tp)
}
}

static int tg3_phy_cl45_write(struct tg3 *tp, u32 devad, u32 addr, u32 val)
{
int err;

err = tg3_writephy(tp, MII_TG3_MMD_CTRL, devad);
if (err)
goto done;

err = tg3_writephy(tp, MII_TG3_MMD_ADDRESS, addr);
if (err)
goto done;

err = tg3_writephy(tp, MII_TG3_MMD_CTRL,
MII_TG3_MMD_CTRL_DATA_NOINC | devad);
if (err)
goto done;

err = tg3_writephy(tp, MII_TG3_MMD_ADDRESS, val);

done:
return err;
}

static int tg3_phy_cl45_read(struct tg3 *tp, u32 devad, u32 addr, u32 *val)
{
int err;

err = tg3_writephy(tp, MII_TG3_MMD_CTRL, devad);
if (err)
goto done;

err = tg3_writephy(tp, MII_TG3_MMD_ADDRESS, addr);
if (err)
goto done;

err = tg3_writephy(tp, MII_TG3_MMD_CTRL,
MII_TG3_MMD_CTRL_DATA_NOINC | devad);
if (err)
goto done;

err = tg3_readphy(tp, MII_TG3_MMD_ADDRESS, val);

done:
return err;
}

/* tp->lock is held. */
static inline void tg3_generate_fw_event(struct tg3 *tp)
{
Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/net/tg3.h
Original file line number Diff line number Diff line change
Expand Up @@ -2061,6 +2061,10 @@
#define MII_TG3_CTRL_AS_MASTER 0x0800
#define MII_TG3_CTRL_ENABLE_AS_MASTER 0x1000

#define MII_TG3_MMD_CTRL 0x0d /* MMD Access Control register */
#define MII_TG3_MMD_CTRL_DATA_NOINC 0x4000
#define MII_TG3_MMD_ADDRESS 0x0e /* MMD Address Data register */

#define MII_TG3_EXT_CTRL 0x10 /* Extended control register */
#define MII_TG3_EXT_CTRL_FIFO_ELASTIC 0x0001
#define MII_TG3_EXT_CTRL_LNK3_LED_MODE 0x0002
Expand Down

0 comments on commit 14a4f87

Please sign in to comment.