summaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/r8152_shield.c
diff options
context:
space:
mode:
authorhayeswang <hayeswang@realtek.com>2014-02-18 08:48:58 -0500
committerVladislav Zhurba <vzhurba@nvidia.com>2018-02-01 16:57:59 -0500
commit500867181c5da4e6e8b65839951b7f112dcc4229 (patch)
tree2b0920d588188207272c5d808902d71dc47657d3 /drivers/net/usb/r8152_shield.c
parent06f49a04d4124b972478203e35b2d4b813494f20 (diff)
r8152: move some functions
Move the following functions which is for the further coding. - rtl_clear_bp - r8153_clear_bp - r8153_teredo_off - r8152b_disable_aldps - r8152b_enable_aldps - r8152b_hw_phy_cfg Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Preetham Chandru R <pchandru@nvidia.com> (cherry picked from commit 4349968ad29a9023005e31eca5d971143d127ba8) Change-Id: I58ec6af782459a2cab438e8b967ccdaac6583e30 Reviewed-on: http://git-master/r/370014 Tested-by: Aly Hirani <ahirani@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Diffstat (limited to 'drivers/net/usb/r8152_shield.c')
-rw-r--r--drivers/net/usb/r8152_shield.c106
1 files changed, 53 insertions, 53 deletions
diff --git a/drivers/net/usb/r8152_shield.c b/drivers/net/usb/r8152_shield.c
index a28120031..edc31be54 100644
--- a/drivers/net/usb/r8152_shield.c
+++ b/drivers/net/usb/r8152_shield.c
@@ -1719,6 +1719,59 @@ static void rtl8152_disable(struct r8152 *tp)
1719 rtl8152_nic_reset(tp); 1719 rtl8152_nic_reset(tp);
1720} 1720}
1721 1721
1722static void rtl_clear_bp(struct r8152 *tp)
1723{
1724 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_0, 0);
1725 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_2, 0);
1726 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_4, 0);
1727 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_6, 0);
1728 ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_0, 0);
1729 ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_2, 0);
1730 ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_4, 0);
1731 ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_6, 0);
1732 mdelay(3);
1733 ocp_write_word(tp, MCU_TYPE_PLA, PLA_BP_BA, 0);
1734 ocp_write_word(tp, MCU_TYPE_USB, USB_BP_BA, 0);
1735}
1736
1737static void r8153_clear_bp(struct r8152 *tp)
1738{
1739 ocp_write_byte(tp, MCU_TYPE_PLA, PLA_BP_EN, 0);
1740 ocp_write_byte(tp, MCU_TYPE_USB, USB_BP_EN, 0);
1741 rtl_clear_bp(tp);
1742}
1743
1744static void r8153_teredo_off(struct r8152 *tp)
1745{
1746 u32 ocp_data;
1747
1748 ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_TEREDO_CFG);
1749 ocp_data &= ~(TEREDO_SEL | TEREDO_RS_EVENT_MASK | OOB_TEREDO_EN);
1750 ocp_write_word(tp, MCU_TYPE_PLA, PLA_TEREDO_CFG, ocp_data);
1751
1752 ocp_write_word(tp, MCU_TYPE_PLA, PLA_WDT6_CTRL, WDT6_SET_MODE);
1753 ocp_write_word(tp, MCU_TYPE_PLA, PLA_REALWOW_TIMER, 0);
1754 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_TEREDO_TIMER, 0);
1755}
1756
1757static void r8152b_disable_aldps(struct r8152 *tp)
1758{
1759 ocp_reg_write(tp, OCP_ALDPS_CONFIG, ENPDNPS | LINKENA | DIS_SDSAVE);
1760 msleep(20);
1761}
1762
1763static inline void r8152b_enable_aldps(struct r8152 *tp)
1764{
1765 ocp_reg_write(tp, OCP_ALDPS_CONFIG, ENPWRSAVE | ENPDNPS |
1766 LINKENA | DIS_SDSAVE);
1767}
1768
1769static void r8152b_hw_phy_cfg(struct r8152 *tp)
1770{
1771 r8152_mdio_write(tp, MII_BMCR, BMCR_ANENABLE);
1772 r8152b_disable_aldps(tp);
1773}
1774
1722static void r8152b_exit_oob(struct r8152 *tp) 1775static void r8152b_exit_oob(struct r8152 *tp)
1723{ 1776{
1724 u32 ocp_data; 1777 u32 ocp_data;
@@ -1863,18 +1916,6 @@ static void r8152b_enter_oob(struct r8152 *tp)
1863 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); 1916 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data);
1864} 1917}
1865 1918
1866static void r8152b_disable_aldps(struct r8152 *tp)
1867{
1868 ocp_reg_write(tp, OCP_ALDPS_CONFIG, ENPDNPS | LINKENA | DIS_SDSAVE);
1869 msleep(20);
1870}
1871
1872static inline void r8152b_enable_aldps(struct r8152 *tp)
1873{
1874 ocp_reg_write(tp, OCP_ALDPS_CONFIG, ENPWRSAVE | ENPDNPS |
1875 LINKENA | DIS_SDSAVE);
1876}
1877
1878static void r8153_hw_phy_cfg(struct r8152 *tp) 1919static void r8153_hw_phy_cfg(struct r8152 *tp)
1879{ 1920{
1880 u32 ocp_data; 1921 u32 ocp_data;
@@ -1959,19 +2000,6 @@ static void r8153_power_cut_en(struct r8152 *tp, int enable)
1959 ocp_write_word(tp, MCU_TYPE_USB, USB_MISC_0, ocp_data); 2000 ocp_write_word(tp, MCU_TYPE_USB, USB_MISC_0, ocp_data);
1960} 2001}
1961 2002
1962static void r8153_teredo_off(struct r8152 *tp)
1963{
1964 u32 ocp_data;
1965
1966 ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_TEREDO_CFG);
1967 ocp_data &= ~(TEREDO_SEL | TEREDO_RS_EVENT_MASK | OOB_TEREDO_EN);
1968 ocp_write_word(tp, MCU_TYPE_PLA, PLA_TEREDO_CFG, ocp_data);
1969
1970 ocp_write_word(tp, MCU_TYPE_PLA, PLA_WDT6_CTRL, WDT6_SET_MODE);
1971 ocp_write_word(tp, MCU_TYPE_PLA, PLA_REALWOW_TIMER, 0);
1972 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_TEREDO_TIMER, 0);
1973}
1974
1975static void r8153_first_init(struct r8152 *tp) 2003static void r8153_first_init(struct r8152 *tp)
1976{ 2004{
1977 u32 ocp_data; 2005 u32 ocp_data;
@@ -2306,28 +2334,6 @@ static int rtl8152_close(struct net_device *netdev)
2306 return res; 2334 return res;
2307} 2335}
2308 2336
2309static void rtl_clear_bp(struct r8152 *tp)
2310{
2311 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_0, 0);
2312 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_2, 0);
2313 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_4, 0);
2314 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_6, 0);
2315 ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_0, 0);
2316 ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_2, 0);
2317 ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_4, 0);
2318 ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_6, 0);
2319 mdelay(3);
2320 ocp_write_word(tp, MCU_TYPE_PLA, PLA_BP_BA, 0);
2321 ocp_write_word(tp, MCU_TYPE_USB, USB_BP_BA, 0);
2322}
2323
2324static void r8153_clear_bp(struct r8152 *tp)
2325{
2326 ocp_write_byte(tp, MCU_TYPE_PLA, PLA_BP_EN, 0);
2327 ocp_write_byte(tp, MCU_TYPE_USB, USB_BP_EN, 0);
2328 rtl_clear_bp(tp);
2329}
2330
2331static void r8152b_enable_eee(struct r8152 *tp) 2337static void r8152b_enable_eee(struct r8152 *tp)
2332{ 2338{
2333 u32 ocp_data; 2339 u32 ocp_data;
@@ -2376,12 +2382,6 @@ static void r8152b_enable_fc(struct r8152 *tp)
2376 r8152_mdio_write(tp, MII_ADVERTISE, anar); 2382 r8152_mdio_write(tp, MII_ADVERTISE, anar);
2377} 2383}
2378 2384
2379static void r8152b_hw_phy_cfg(struct r8152 *tp)
2380{
2381 r8152_mdio_write(tp, MII_BMCR, BMCR_ANENABLE);
2382 r8152b_disable_aldps(tp);
2383}
2384
2385static void r8152b_init(struct r8152 *tp) 2385static void r8152b_init(struct r8152 *tp)
2386{ 2386{
2387 u32 ocp_data; 2387 u32 ocp_data;