1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-24 05:11:46 +02:00

backfire: generic: rtl8366: use struct rtl8366_smi for phy_reg_{read,write} calls (backport of r21912)

git-svn-id: svn://svn.openwrt.org/openwrt/branches/backfire@21931 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
juhosg 2010-06-26 19:53:14 +00:00
parent a219ae9c95
commit 814c82f218
2 changed files with 14 additions and 18 deletions

View File

@ -257,10 +257,9 @@ static int rtl8366rb_reset_chip(struct rtl8366rb *rtl)
return 0;
}
static int rtl8366rb_read_phy_reg(struct rtl8366rb *rtl,
static int rtl8366rb_read_phy_reg(struct rtl8366_smi *smi,
u32 phy_no, u32 page, u32 addr, u32 *data)
{
struct rtl8366_smi *smi = &rtl->smi;
u32 reg;
int ret;
@ -293,10 +292,9 @@ static int rtl8366rb_read_phy_reg(struct rtl8366rb *rtl,
return 0;
}
static int rtl8366rb_write_phy_reg(struct rtl8366rb *rtl,
static int rtl8366rb_write_phy_reg(struct rtl8366_smi *smi,
u32 phy_no, u32 page, u32 addr, u32 data)
{
struct rtl8366_smi *smi = &rtl->smi;
u32 reg;
int ret;
@ -1502,11 +1500,11 @@ static void rtl8366rb_switch_cleanup(struct rtl8366rb *rtl)
static int rtl8366rb_mii_read(struct mii_bus *bus, int addr, int reg)
{
struct rtl8366rb *rtl = smi_to_rtl8366rb(bus->priv);
struct rtl8366_smi *smi = bus->priv;
u32 val = 0;
int err;
err = rtl8366rb_read_phy_reg(rtl, addr, 0, reg, &val);
err = rtl8366rb_read_phy_reg(smi, addr, 0, reg, &val);
if (err)
return 0xffff;
@ -1515,13 +1513,13 @@ static int rtl8366rb_mii_read(struct mii_bus *bus, int addr, int reg)
static int rtl8366rb_mii_write(struct mii_bus *bus, int addr, int reg, u16 val)
{
struct rtl8366rb *rtl = smi_to_rtl8366rb(bus->priv);
struct rtl8366_smi *smi = bus->priv;
u32 t;
int err;
err = rtl8366rb_write_phy_reg(rtl, addr, 0, reg, val);
err = rtl8366rb_write_phy_reg(smi, addr, 0, reg, val);
/* flush write */
(void) rtl8366rb_read_phy_reg(rtl, addr, 0, reg, &t);
(void) rtl8366rb_read_phy_reg(smi, addr, 0, reg, &t);
return err;
}

View File

@ -257,10 +257,9 @@ static int rtl8366s_reset_chip(struct rtl8366s *rtl)
return 0;
}
static int rtl8366s_read_phy_reg(struct rtl8366s *rtl,
static int rtl8366s_read_phy_reg(struct rtl8366_smi *smi,
u32 phy_no, u32 page, u32 addr, u32 *data)
{
struct rtl8366_smi *smi = &rtl->smi;
u32 reg;
int ret;
@ -293,10 +292,9 @@ static int rtl8366s_read_phy_reg(struct rtl8366s *rtl,
return 0;
}
static int rtl8366s_write_phy_reg(struct rtl8366s *rtl,
static int rtl8366s_write_phy_reg(struct rtl8366_smi *smi,
u32 phy_no, u32 page, u32 addr, u32 data)
{
struct rtl8366_smi *smi = &rtl->smi;
u32 reg;
int ret;
@ -1471,11 +1469,11 @@ static void rtl8366s_switch_cleanup(struct rtl8366s *rtl)
static int rtl8366s_mii_read(struct mii_bus *bus, int addr, int reg)
{
struct rtl8366s *rtl = smi_to_rtl8366s(bus->priv);
struct rtl8366_smi *smi = bus->priv;
u32 val = 0;
int err;
err = rtl8366s_read_phy_reg(rtl, addr, 0, reg, &val);
err = rtl8366s_read_phy_reg(smi, addr, 0, reg, &val);
if (err)
return 0xffff;
@ -1484,13 +1482,13 @@ static int rtl8366s_mii_read(struct mii_bus *bus, int addr, int reg)
static int rtl8366s_mii_write(struct mii_bus *bus, int addr, int reg, u16 val)
{
struct rtl8366s *rtl = smi_to_rtl8366s(bus->priv);
struct rtl8366_smi *smi = bus->priv;
u32 t;
int err;
err = rtl8366s_write_phy_reg(rtl, addr, 0, reg, val);
err = rtl8366s_write_phy_reg(smi, addr, 0, reg, val);
/* flush write */
(void) rtl8366s_read_phy_reg(rtl, addr, 0, reg, &t);
(void) rtl8366s_read_phy_reg(smi, addr, 0, reg, &t);
return err;
}