Commit ef5a1ba1 authored by David S. Miller's avatar David S. Miller

Merge branch 'r8152'

Hayes Wang says:

====================
r8152: couldn't read OCP_SRAM_DATA

Read OCP_SRAM_DATA would read additional bytes and may let
the hw abnormal.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents e60bf806 b4d99def
...@@ -833,9 +833,6 @@ static void ocp_write_word(struct r8152 *tp, u16 type, u16 index, u32 data) ...@@ -833,9 +833,6 @@ static void ocp_write_word(struct r8152 *tp, u16 type, u16 index, u32 data)
index &= ~3; index &= ~3;
} }
generic_ocp_read(tp, index, sizeof(tmp), &tmp, type);
data |= __le32_to_cpu(tmp) & ~mask;
tmp = __cpu_to_le32(data); tmp = __cpu_to_le32(data);
generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type); generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type);
...@@ -874,9 +871,6 @@ static void ocp_write_byte(struct r8152 *tp, u16 type, u16 index, u32 data) ...@@ -874,9 +871,6 @@ static void ocp_write_byte(struct r8152 *tp, u16 type, u16 index, u32 data)
index &= ~3; index &= ~3;
} }
generic_ocp_read(tp, index, sizeof(tmp), &tmp, type);
data |= __le32_to_cpu(tmp) & ~mask;
tmp = __cpu_to_le32(data); tmp = __cpu_to_le32(data);
generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type); generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type);
...@@ -926,12 +920,6 @@ static void sram_write(struct r8152 *tp, u16 addr, u16 data) ...@@ -926,12 +920,6 @@ static void sram_write(struct r8152 *tp, u16 addr, u16 data)
ocp_reg_write(tp, OCP_SRAM_DATA, data); ocp_reg_write(tp, OCP_SRAM_DATA, data);
} }
static u16 sram_read(struct r8152 *tp, u16 addr)
{
ocp_reg_write(tp, OCP_SRAM_ADDR, addr);
return ocp_reg_read(tp, OCP_SRAM_DATA);
}
static int read_mii_word(struct net_device *netdev, int phy_id, int reg) static int read_mii_word(struct net_device *netdev, int phy_id, int reg)
{ {
struct r8152 *tp = netdev_priv(netdev); struct r8152 *tp = netdev_priv(netdev);
...@@ -2518,24 +2506,18 @@ static void r8153_hw_phy_cfg(struct r8152 *tp) ...@@ -2518,24 +2506,18 @@ static void r8153_hw_phy_cfg(struct r8152 *tp)
data = ocp_reg_read(tp, OCP_POWER_CFG); data = ocp_reg_read(tp, OCP_POWER_CFG);
data |= EN_10M_PLLOFF; data |= EN_10M_PLLOFF;
ocp_reg_write(tp, OCP_POWER_CFG, data); ocp_reg_write(tp, OCP_POWER_CFG, data);
data = sram_read(tp, SRAM_IMPEDANCE); sram_write(tp, SRAM_IMPEDANCE, 0x0b13);
data &= ~RX_DRIVING_MASK;
sram_write(tp, SRAM_IMPEDANCE, data);
ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_PHY_PWR); ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_PHY_PWR);
ocp_data |= PFM_PWM_SWITCH; ocp_data |= PFM_PWM_SWITCH;
ocp_write_word(tp, MCU_TYPE_PLA, PLA_PHY_PWR, ocp_data); ocp_write_word(tp, MCU_TYPE_PLA, PLA_PHY_PWR, ocp_data);
data = sram_read(tp, SRAM_LPF_CFG); /* Enable LPF corner auto tune */
data |= LPF_AUTO_TUNE; sram_write(tp, SRAM_LPF_CFG, 0xf70f);
sram_write(tp, SRAM_LPF_CFG, data);
data = sram_read(tp, SRAM_10M_AMP1); /* Adjust 10M Amplitude */
data |= GDAC_IB_UPALL; sram_write(tp, SRAM_10M_AMP1, 0x00af);
sram_write(tp, SRAM_10M_AMP1, data); sram_write(tp, SRAM_10M_AMP2, 0x0208);
data = sram_read(tp, SRAM_10M_AMP2);
data |= AMP_DN;
sram_write(tp, SRAM_10M_AMP2, data);
set_bit(PHY_RESET, &tp->flags); set_bit(PHY_RESET, &tp->flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment