aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorhayeswang <hayeswang@realtek.com>2014-09-25 08:54:00 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-28 17:24:27 -0400
commit4c4a6b1b85095e0fcee36f2fd2acc7d7cd9e0699 (patch)
tree3c2ce1425586610fadcf15bafa4c9f9d192bf3e1 /drivers/net/usb
parent18c565eb410307f9eefbef7c9021c7a75d8a2408 (diff)
r8152: change the EEE definition
Replace the EEE definitions with the ones which is declared in "mdio.h". Chage some definitions to make them readable. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/r8152.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 3d5c39a1e46f..d225aa10a032 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -22,6 +22,8 @@
22#include <linux/ip.h> 22#include <linux/ip.h>
23#include <linux/ipv6.h> 23#include <linux/ipv6.h>
24#include <net/ip6_checksum.h> 24#include <net/ip6_checksum.h>
25#include <uapi/linux/mdio.h>
26#include <linux/mdio.h>
25 27
26/* Version Information */ 28/* Version Information */
27#define DRIVER_VERSION "v1.06.0 (2014/03/03)" 29#define DRIVER_VERSION "v1.06.0 (2014/03/03)"
@@ -129,7 +131,7 @@
129#define OCP_SRAM_ADDR 0xa436 131#define OCP_SRAM_ADDR 0xa436
130#define OCP_SRAM_DATA 0xa438 132#define OCP_SRAM_DATA 0xa438
131#define OCP_DOWN_SPEED 0xa442 133#define OCP_DOWN_SPEED 0xa442
132#define OCP_EEE_CFG2 0xa5d0 134#define OCP_EEE_ADV 0xa5d0
133#define OCP_ADC_CFG 0xbc06 135#define OCP_ADC_CFG 0xbc06
134 136
135/* SRAM Register */ 137/* SRAM Register */
@@ -361,7 +363,7 @@
361#define EEE_NWAY_EN 0x1000 363#define EEE_NWAY_EN 0x1000
362#define TX_QUIET_EN 0x0200 364#define TX_QUIET_EN 0x0200
363#define RX_QUIET_EN 0x0100 365#define RX_QUIET_EN 0x0100
364#define SDRISETIME 0x0010 /* bit 4 ~ 6 */ 366#define sd_rise_time(x) (min(x, 7) << 4) /* bit 4 ~ 6 */
365#define RG_RXLPI_MSK_HFDUP 0x0008 367#define RG_RXLPI_MSK_HFDUP 0x0008
366#define SDFALLTIME 0x0007 /* bit 0 ~ 2 */ 368#define SDFALLTIME 0x0007 /* bit 0 ~ 2 */
367 369
@@ -373,7 +375,7 @@
373#define RG_EEEPRG_EN 0x0010 375#define RG_EEEPRG_EN 0x0010
374 376
375/* OCP_EEE_CONFIG3 */ 377/* OCP_EEE_CONFIG3 */
376#define FST_SNR_EYE_R 0x1500 /* bit 7 ~ 15 */ 378#define fast_snr(x) (min(x, 0x1ff) << 7) /* bit 7 ~ 15 */
377#define RG_LFS_SEL 0x0060 /* bit 6 ~ 5 */ 379#define RG_LFS_SEL 0x0060 /* bit 6 ~ 5 */
378#define MSK_PH 0x0006 /* bit 0 ~ 3 */ 380#define MSK_PH 0x0006 /* bit 0 ~ 3 */
379 381
@@ -382,11 +384,6 @@
382#define FUN_ADDR 0x0000 384#define FUN_ADDR 0x0000
383#define FUN_DATA 0x4000 385#define FUN_DATA 0x4000
384/* bit[4:0] device addr */ 386/* bit[4:0] device addr */
385#define DEVICE_ADDR 0x0007
386
387/* OCP_EEE_DATA */
388#define EEE_ADDR 0x003C
389#define EEE_DATA 0x0002
390 387
391/* OCP_EEE_CFG */ 388/* OCP_EEE_CFG */
392#define CTAP_SHORT_EN 0x0040 389#define CTAP_SHORT_EN 0x0040
@@ -395,10 +392,6 @@
395/* OCP_DOWN_SPEED */ 392/* OCP_DOWN_SPEED */
396#define EN_10M_BGOFF 0x0080 393#define EN_10M_BGOFF 0x0080
397 394
398/* OCP_EEE_CFG2 */
399#define MY1000_EEE 0x0004
400#define MY100_EEE 0x0002
401
402/* OCP_ADC_CFG */ 395/* OCP_ADC_CFG */
403#define CKADSEL_L 0x0100 396#define CKADSEL_L 0x0100
404#define ADC_EN 0x0080 397#define ADC_EN 0x0080
@@ -2967,16 +2960,16 @@ static void r8152b_enable_eee(struct r8152 *tp)
2967 ocp_reg_write(tp, OCP_EEE_CONFIG1, RG_TXLPI_MSK_HFDUP | RG_MATCLR_EN | 2960 ocp_reg_write(tp, OCP_EEE_CONFIG1, RG_TXLPI_MSK_HFDUP | RG_MATCLR_EN |
2968 EEE_10_CAP | EEE_NWAY_EN | 2961 EEE_10_CAP | EEE_NWAY_EN |
2969 TX_QUIET_EN | RX_QUIET_EN | 2962 TX_QUIET_EN | RX_QUIET_EN |
2970 SDRISETIME | RG_RXLPI_MSK_HFDUP | 2963 sd_rise_time(1) | RG_RXLPI_MSK_HFDUP |
2971 SDFALLTIME); 2964 SDFALLTIME);
2972 ocp_reg_write(tp, OCP_EEE_CONFIG2, RG_LPIHYS_NUM | RG_DACQUIET_EN | 2965 ocp_reg_write(tp, OCP_EEE_CONFIG2, RG_LPIHYS_NUM | RG_DACQUIET_EN |
2973 RG_LDVQUIET_EN | RG_CKRSEL | 2966 RG_LDVQUIET_EN | RG_CKRSEL |
2974 RG_EEEPRG_EN); 2967 RG_EEEPRG_EN);
2975 ocp_reg_write(tp, OCP_EEE_CONFIG3, FST_SNR_EYE_R | RG_LFS_SEL | MSK_PH); 2968 ocp_reg_write(tp, OCP_EEE_CONFIG3, fast_snr(42) | RG_LFS_SEL | MSK_PH);
2976 ocp_reg_write(tp, OCP_EEE_AR, FUN_ADDR | DEVICE_ADDR); 2969 ocp_reg_write(tp, OCP_EEE_AR, FUN_ADDR | MDIO_MMD_AN);
2977 ocp_reg_write(tp, OCP_EEE_DATA, EEE_ADDR); 2970 ocp_reg_write(tp, OCP_EEE_DATA, MDIO_AN_EEE_ADV);
2978 ocp_reg_write(tp, OCP_EEE_AR, FUN_DATA | DEVICE_ADDR); 2971 ocp_reg_write(tp, OCP_EEE_AR, FUN_DATA | MDIO_MMD_AN);
2979 ocp_reg_write(tp, OCP_EEE_DATA, EEE_DATA); 2972 ocp_reg_write(tp, OCP_EEE_DATA, MDIO_EEE_100TX);
2980 ocp_reg_write(tp, OCP_EEE_AR, 0x0000); 2973 ocp_reg_write(tp, OCP_EEE_AR, 0x0000);
2981} 2974}
2982 2975
@@ -2991,9 +2984,9 @@ static void r8153_enable_eee(struct r8152 *tp)
2991 data = ocp_reg_read(tp, OCP_EEE_CFG); 2984 data = ocp_reg_read(tp, OCP_EEE_CFG);
2992 data |= EEE10_EN; 2985 data |= EEE10_EN;
2993 ocp_reg_write(tp, OCP_EEE_CFG, data); 2986 ocp_reg_write(tp, OCP_EEE_CFG, data);
2994 data = ocp_reg_read(tp, OCP_EEE_CFG2); 2987 data = ocp_reg_read(tp, OCP_EEE_ADV);
2995 data |= MY1000_EEE | MY100_EEE; 2988 data |= MDIO_EEE_1000T | MDIO_EEE_100TX;
2996 ocp_reg_write(tp, OCP_EEE_CFG2, data); 2989 ocp_reg_write(tp, OCP_EEE_ADV, data);
2997} 2990}
2998 2991
2999static void r8152b_enable_fc(struct r8152 *tp) 2992static void r8152b_enable_fc(struct r8152 *tp)