mirror of
https://github.com/Heleguo/lede.git
synced 2025-12-24 23:01:23 +00:00
r8125: update to 9.006.04 (#8055)
Signed-off-by: boos4721 <3.1415926535boos@gmail.com>
This commit is contained in:
parent
fb8a887bdf
commit
658c2f10bc
@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=r8125
|
||||
PKG_VERSION:=9.005.06
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=9.006.04
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
|
||||
8
package/lean/r8125/src/Makefile
Normal file → Executable file
8
package/lean/r8125/src/Makefile
Normal file → Executable file
@ -47,6 +47,8 @@ ENABLE_PTP_MASTER_MODE = n
|
||||
ENABLE_RSS_SUPPORT = y
|
||||
ENABLE_LIB_SUPPORT = n
|
||||
ENABLE_USE_FIRMWARE_FILE = n
|
||||
DISABLE_PM_SUPPORT = n
|
||||
DISABLE_MULTI_MSIX_VECTOR = n
|
||||
|
||||
ifneq ($(KERNELRELEASE),)
|
||||
obj-m := r8125.o
|
||||
@ -111,6 +113,12 @@ ifneq ($(KERNELRELEASE),)
|
||||
r8125-objs += r8125_firmware.o
|
||||
EXTRA_CFLAGS += -DENABLE_USE_FIRMWARE_FILE
|
||||
endif
|
||||
ifeq ($(DISABLE_PM_SUPPORT), y)
|
||||
EXTRA_CFLAGS += -DDISABLE_PM_SUPPORT
|
||||
endif
|
||||
ifeq ($(DISABLE_MULTI_MSIX_VECTOR), y)
|
||||
EXTRA_CFLAGS += -DDISABLE_MULTI_MSIX_VECTOR
|
||||
endif
|
||||
else
|
||||
BASEDIR := /lib/modules/$(shell uname -r)
|
||||
KERNELDIR ?= $(BASEDIR)/build
|
||||
|
||||
0
package/lean/r8125/src/Makefile_linux24x
Normal file → Executable file
0
package/lean/r8125/src/Makefile_linux24x
Normal file → Executable file
250
package/lean/r8125/src/r8125.h
Normal file → Executable file
250
package/lean/r8125/src/r8125.h
Normal file → Executable file
@ -363,7 +363,7 @@ do { \
|
||||
#define RSS_SUFFIX ""
|
||||
#endif
|
||||
|
||||
#define RTL8125_VERSION "9.005.06" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX
|
||||
#define RTL8125_VERSION "9.006.04" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX
|
||||
#define MODULENAME "r8125"
|
||||
#define PFX MODULENAME ": "
|
||||
|
||||
@ -469,7 +469,7 @@ This is free software, and you are welcome to redistribute it under certain cond
|
||||
#define OCP_STD_PHY_BASE 0xa400
|
||||
|
||||
#ifdef ENABLE_LIB_SUPPORT
|
||||
#define R8125_MULTI_RX_Q(tp) 1
|
||||
#define R8125_MULTI_RX_Q(tp) 0
|
||||
#else
|
||||
#define R8125_MULTI_RX_Q(tp) (tp->num_rx_rings > 1)
|
||||
#endif
|
||||
@ -542,6 +542,8 @@ This is free software, and you are welcome to redistribute it under certain cond
|
||||
|
||||
#define RTK_ADVERTISE_2500FULL 0x80
|
||||
#define RTK_LPA_ADVERTISE_2500FULL 0x20
|
||||
#define RTK_LPA_ADVERTISE_5000FULL 0x40
|
||||
#define RTK_LPA_ADVERTISE_10000FULL 0x800
|
||||
|
||||
/* Tx NO CLOSE */
|
||||
#define MAX_TX_NO_CLOSE_DESC_PTR_V2 0x10000
|
||||
@ -1201,16 +1203,24 @@ enum RTL8125_registers {
|
||||
TIMER_INT3_8125 = 0x00F4,
|
||||
INT_MITI_V2_0_RX = 0x0A00,
|
||||
INT_MITI_V2_0_TX = 0x0A02,
|
||||
INT_MITI_V2_1_RX = 0x0A08,
|
||||
INT_MITI_V2_1_TX = 0x0A0A,
|
||||
IMR_V2_CLEAR_REG_8125 = 0x0D00,
|
||||
ISR_V2_8125 = 0x0D04,
|
||||
IMR_V2_SET_REG_8125 = 0x0D0C,
|
||||
TDU_STA_8125 = 0x0D08,
|
||||
RDU_STA_8125 = 0x0D0A,
|
||||
TX_NEW_CTRL = 0x203E,
|
||||
TNPDS_Q1_LOW_8125 = 0x2100,
|
||||
PLA_TXQ0_IDLE_CREDIT = 0x2500,
|
||||
PLA_TXQ1_IDLE_CREDIT = 0x2504,
|
||||
SW_TAIL_PTR0_8125 = 0x2800,
|
||||
HW_CLO_PTR0_8125 = 0x2802,
|
||||
RDSAR_Q1_LOW_8125 = 0x4000,
|
||||
RSS_CTRL_8125 = 0x4500,
|
||||
Q_NUM_CTRL_8125 = 0x4800,
|
||||
RSS_KEY_8125 = 0x4600,
|
||||
RSS_INDIRECTION_TBL_8125_V2 = 0x4700,
|
||||
EEE_TXIDLE_TIMER_8125 = 0x6048,
|
||||
PTP_CTRL_8125 = 0x6800,
|
||||
PTP_STATUS_8125 = 0x6802,
|
||||
@ -1720,6 +1730,14 @@ struct pci_resource {
|
||||
u32 pci_sn_h;
|
||||
};
|
||||
|
||||
enum r8125_flag {
|
||||
R8125_FLAG_DOWN = 0,
|
||||
R8125_FLAG_TASK_RESET_PENDING,
|
||||
R8125_FLAG_TASK_ESD_CHECK_PENDING,
|
||||
R8125_FLAG_TASK_LINKCHG_CHECK_PENDING,
|
||||
R8125_FLAG_MAX
|
||||
};
|
||||
|
||||
struct rtl8125_tx_ring {
|
||||
void* priv;
|
||||
u32 index;
|
||||
@ -1768,6 +1786,210 @@ struct r8125_irq {
|
||||
char name[IFNAMSIZ + 10];
|
||||
};
|
||||
|
||||
#pragma pack(1)
|
||||
struct rtl8125_regs {
|
||||
//00
|
||||
u8 mac_id[6];
|
||||
u16 reg_06;
|
||||
u8 mar[8];
|
||||
//10
|
||||
u64 dtccr;
|
||||
u16 ledsel0;
|
||||
u16 legreg;
|
||||
u32 tctr3;
|
||||
//20
|
||||
u32 txq0_dsc_st_addr_0;
|
||||
u32 txq0_dsc_st_addr_2;
|
||||
u64 reg_28;
|
||||
//30
|
||||
u16 rit;
|
||||
u16 ritc;
|
||||
u16 reg_34;
|
||||
u8 reg_36;
|
||||
u8 command;
|
||||
u32 imr0;
|
||||
u32 isr0;
|
||||
//40
|
||||
u32 tcr;
|
||||
u32 rcr;
|
||||
u32 tctr0;
|
||||
u32 tctr1;
|
||||
//50
|
||||
u8 cr93c46;
|
||||
u8 config0;
|
||||
u8 config1;
|
||||
u8 config2;
|
||||
u8 config3;
|
||||
u8 config4;
|
||||
u8 config5;
|
||||
u8 tdfnr;
|
||||
u32 timer_int0;
|
||||
u32 timer_int1;
|
||||
//60
|
||||
u32 gphy_mdcmdio;
|
||||
u32 csidr;
|
||||
u32 csiar;
|
||||
u16 phy_status;
|
||||
u8 config6;
|
||||
u8 pmch;
|
||||
//70
|
||||
u32 eridr;
|
||||
u32 eriar;
|
||||
u16 config7;
|
||||
u16 reg_7a;
|
||||
u32 ephy_rxerr_cnt;
|
||||
//80
|
||||
u32 ephy_mdcmdio;
|
||||
u16 ledsel2;
|
||||
u16 ledsel1;
|
||||
u32 tctr2;
|
||||
u32 timer_int2;
|
||||
//90
|
||||
u8 tppoll0;
|
||||
u8 reg_91;
|
||||
u16 reg_92;
|
||||
u16 led_feature;
|
||||
u16 ledsel3;
|
||||
u16 eee_led_config;
|
||||
u16 reg_9a;
|
||||
u32 reg_9c;
|
||||
//a0
|
||||
u32 reg_a0;
|
||||
u32 reg_a4;
|
||||
u32 reg_a8;
|
||||
u32 reg_ac;
|
||||
//b0
|
||||
u32 patch_dbg;
|
||||
u32 reg_b4;
|
||||
u32 gphy_ocp;
|
||||
u32 reg_bc;
|
||||
//c0
|
||||
u32 reg_c0;
|
||||
u32 reg_c4;
|
||||
u32 reg_c8;
|
||||
u16 otp_cmd;
|
||||
u16 otp_pg_config;
|
||||
//d0
|
||||
u16 phy_pwr;
|
||||
u8 twsi_ctrl;
|
||||
u8 oob_ctrl;
|
||||
u16 mac_dbgo;
|
||||
u16 mac_dbg;
|
||||
u16 reg_d8;
|
||||
u16 rms;
|
||||
u32 efuse_data;
|
||||
//e0
|
||||
u16 cplus_cmd;
|
||||
u16 reg_e2;
|
||||
u32 rxq0_dsc_st_addr_0;
|
||||
u32 rxq0_dsc_st_addr_2;
|
||||
u16 reg_ec;
|
||||
u16 tx10midle_cnt;
|
||||
//f0
|
||||
u16 misc0;
|
||||
u16 misc1;
|
||||
u32 timer_int3;
|
||||
u32 cmac_ib;
|
||||
u16 reg_fc;
|
||||
u16 sw_rst;
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
struct rtl8125_regs_save {
|
||||
union {
|
||||
u8 mac_io[R8125_MAC_REGS_SIZE];
|
||||
|
||||
struct rtl8125_regs mac_reg;
|
||||
};
|
||||
u16 pcie_phy[R8125_EPHY_REGS_SIZE/2];
|
||||
u16 eth_phy[R8125_PHY_REGS_SIZE/2];
|
||||
u32 eri_reg[R8125_ERI_REGS_SIZE/4];
|
||||
u32 pci_reg[R8125_PCI_REGS_SIZE/4];
|
||||
u16 sw_tail_ptr_reg[R8125_MAX_TX_QUEUES];
|
||||
u16 hw_clo_ptr_reg[R8125_MAX_TX_QUEUES];
|
||||
|
||||
//ktime_t begin_ktime;
|
||||
//ktime_t end_ktime;
|
||||
//u64 duration_ns;
|
||||
|
||||
u16 sw0_tail_ptr;
|
||||
u16 next_hwq0_clo_ptr;
|
||||
u16 sw1_tail_ptr;
|
||||
u16 next_hwq1_clo_ptr;
|
||||
|
||||
u16 int_miti_rxq0;
|
||||
u16 int_miti_txq0;
|
||||
u16 int_miti_rxq1;
|
||||
u16 int_miti_txq1;
|
||||
u8 int_config;
|
||||
u32 imr_new;
|
||||
u32 isr_new;
|
||||
|
||||
u8 tdu_status;
|
||||
u16 rdu_status;
|
||||
|
||||
u16 tc_mode;
|
||||
|
||||
u32 txq1_dsc_st_addr_0;
|
||||
u32 txq1_dsc_st_addr_2;
|
||||
|
||||
u32 pla_tx_q0_idle_credit;
|
||||
u32 pla_tx_q1_idle_credit;
|
||||
|
||||
u32 rxq1_dsc_st_addr_0;
|
||||
u32 rxq1_dsc_st_addr_2;
|
||||
|
||||
u32 rss_ctrl;
|
||||
u8 rss_key[RTL8125_RSS_KEY_SIZE];
|
||||
u8 rss_i_table[RTL8125_MAX_INDIRECTION_TABLE_ENTRIES];
|
||||
u16 rss_queue_num_sel_r;
|
||||
};
|
||||
|
||||
struct rtl8125_counters {
|
||||
/* legacy */
|
||||
u64 tx_packets;
|
||||
u64 rx_packets;
|
||||
u64 tx_errors;
|
||||
u32 rx_errors;
|
||||
u16 rx_missed;
|
||||
u16 align_errors;
|
||||
u32 tx_one_collision;
|
||||
u32 tx_multi_collision;
|
||||
u64 rx_unicast;
|
||||
u64 rx_broadcast;
|
||||
u32 rx_multicast;
|
||||
u16 tx_aborted;
|
||||
u16 tx_underrun;
|
||||
|
||||
/* extended */
|
||||
u64 tx_octets;
|
||||
u64 rx_octets;
|
||||
u64 rx_multicast64;
|
||||
u64 tx_unicast64;
|
||||
u64 tx_broadcast64;
|
||||
u64 tx_multicast64;
|
||||
u32 tx_pause_on;
|
||||
u32 tx_pause_off;
|
||||
u32 tx_pause_all;
|
||||
u32 tx_deferred;
|
||||
u32 tx_late_collision;
|
||||
u32 tx_all_collision;
|
||||
u32 tx_aborted32;
|
||||
u32 align_errors32;
|
||||
u32 rx_frame_too_long;
|
||||
u32 rx_runt;
|
||||
u32 rx_pause_on;
|
||||
u32 rx_pause_off;
|
||||
u32 rx_pause_all;
|
||||
u32 rx_unknown_opcode;
|
||||
u32 rx_mac_error;
|
||||
u32 tx_underrun32;
|
||||
u32 rx_mac_missed;
|
||||
u32 rx_tcam_dropped;
|
||||
u32 tdu;
|
||||
u32 rdu;
|
||||
};
|
||||
|
||||
/* Flow Control Settings */
|
||||
enum rtl8125_fc_mode {
|
||||
rtl8125_fc_none = 0,
|
||||
@ -1819,8 +2041,8 @@ struct rtl8125_private {
|
||||
struct rtl8125_ring lib_tx_ring[R8125_MAX_TX_QUEUES];
|
||||
struct rtl8125_ring lib_rx_ring[R8125_MAX_RX_QUEUES];
|
||||
#endif
|
||||
struct timer_list esd_timer;
|
||||
struct timer_list link_timer;
|
||||
//struct timer_list esd_timer;
|
||||
//struct timer_list link_timer;
|
||||
struct pci_resource pci_cfg_space;
|
||||
unsigned int esd_flag;
|
||||
unsigned int pci_cfg_is_read;
|
||||
@ -1863,10 +2085,15 @@ struct rtl8125_private {
|
||||
unsigned int (*phy_reset_pending)(struct net_device *);
|
||||
unsigned int (*link_ok)(struct net_device *);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
|
||||
struct work_struct task;
|
||||
struct work_struct reset_task;
|
||||
struct work_struct esd_task;
|
||||
struct work_struct linkchg_task;
|
||||
#else
|
||||
struct delayed_work task;
|
||||
struct delayed_work reset_task;
|
||||
struct delayed_work esd_task;
|
||||
struct delayed_work linkchg_task;
|
||||
#endif
|
||||
DECLARE_BITMAP(task_flags, R8125_FLAG_MAX);
|
||||
unsigned features;
|
||||
|
||||
u8 org_pci_offset_99;
|
||||
@ -1921,6 +2148,11 @@ struct rtl8125_private {
|
||||
|
||||
u8 random_mac;
|
||||
|
||||
u16 phy_reg_aner;
|
||||
u16 phy_reg_anlpar;
|
||||
u16 phy_reg_gbsr;
|
||||
u16 phy_reg_status_2500;
|
||||
|
||||
u32 HwPcieSNOffset;
|
||||
|
||||
u8 HwSuppTxNoCloseVer;
|
||||
@ -1931,6 +2163,8 @@ struct rtl8125_private {
|
||||
|
||||
u8 HwSuppIntMitiVer;
|
||||
|
||||
u8 HwSuppExtendTallyCounterVer;
|
||||
|
||||
u8 check_keep_link_speed;
|
||||
u8 resume_not_chg_speed;
|
||||
|
||||
@ -2063,9 +2297,7 @@ struct rtl8125_private {
|
||||
#ifdef ENABLE_RSS_SUPPORT
|
||||
u32 rss_flags;
|
||||
/* Receive Side Scaling settings */
|
||||
#define RTL8125_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */
|
||||
u8 rss_key[RTL8125_RSS_KEY_SIZE];
|
||||
#define RTL8125_MAX_INDIRECTION_TABLE_ENTRIES 128
|
||||
u8 rss_indir_tbl[RTL8125_MAX_INDIRECTION_TABLE_ENTRIES];
|
||||
u32 rss_options;
|
||||
#endif
|
||||
@ -2248,7 +2480,6 @@ void rtl8125_hw_config(struct net_device *dev);
|
||||
void rtl8125_hw_set_timer_int_8125(struct rtl8125_private *tp, u32 message_id, u8 timer_intmiti_val);
|
||||
void rtl8125_set_rx_q_num(struct rtl8125_private *tp, unsigned int num_rx_queues);
|
||||
void rtl8125_set_tx_q_num(struct rtl8125_private *tp, unsigned int num_tx_queues);
|
||||
int rtl8125_set_real_num_queue(struct rtl8125_private *tp);
|
||||
void rtl8125_hw_start(struct net_device *dev);
|
||||
void rtl8125_hw_reset(struct net_device *dev);
|
||||
void rtl8125_tx_clear(struct rtl8125_private *tp);
|
||||
@ -2256,6 +2487,7 @@ void rtl8125_rx_clear(struct rtl8125_private *tp);
|
||||
int rtl8125_init_ring(struct net_device *dev);
|
||||
void rtl8125_hw_set_rx_packet_filter(struct net_device *dev);
|
||||
void rtl8125_enable_hw_linkchg_interrupt(struct rtl8125_private *tp);
|
||||
int rtl8125_dump_tally_counter(struct rtl8125_private *tp, dma_addr_t paddr);
|
||||
|
||||
#ifndef ENABLE_LIB_SUPPORT
|
||||
static inline void rtl8125_lib_reset_prepare(struct rtl8125_private *tp) { }
|
||||
|
||||
0
package/lean/r8125/src/r8125_dash.h
Normal file → Executable file
0
package/lean/r8125/src/r8125_dash.h
Normal file → Executable file
0
package/lean/r8125/src/r8125_firmware.c
Normal file → Executable file
0
package/lean/r8125/src/r8125_firmware.c
Normal file → Executable file
0
package/lean/r8125/src/r8125_firmware.h
Normal file → Executable file
0
package/lean/r8125/src/r8125_firmware.h
Normal file → Executable file
1408
package/lean/r8125/src/r8125_n.c
Normal file → Executable file
1408
package/lean/r8125/src/r8125_n.c
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
0
package/lean/r8125/src/r8125_ptp.c
Normal file → Executable file
0
package/lean/r8125/src/r8125_ptp.c
Normal file → Executable file
0
package/lean/r8125/src/r8125_ptp.h
Normal file → Executable file
0
package/lean/r8125/src/r8125_ptp.h
Normal file → Executable file
0
package/lean/r8125/src/r8125_realwow.h
Normal file → Executable file
0
package/lean/r8125/src/r8125_realwow.h
Normal file → Executable file
3
package/lean/r8125/src/r8125_rss.c
Normal file → Executable file
3
package/lean/r8125/src/r8125_rss.c
Normal file → Executable file
@ -336,9 +336,6 @@ int rtl8125_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define RSS_KEY_8125 0x4600
|
||||
#define RSS_INDIRECTION_TBL_8125_V2 0x4700
|
||||
|
||||
static u32 rtl8125_rss_key_reg(struct rtl8125_private *tp)
|
||||
{
|
||||
return RSS_KEY_8125;
|
||||
|
||||
3
package/lean/r8125/src/r8125_rss.h
Normal file → Executable file
3
package/lean/r8125/src/r8125_rss.h
Normal file → Executable file
@ -38,6 +38,9 @@
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#define RTL8125_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */
|
||||
#define RTL8125_MAX_INDIRECTION_TABLE_ENTRIES 128
|
||||
|
||||
enum rtl8125_rss_flag {
|
||||
RTL_8125_RSS_FLAG_HASH_UDP_IPV4 = (1 << 0),
|
||||
RTL_8125_RSS_FLAG_HASH_UDP_IPV6 = (1 << 1),
|
||||
|
||||
0
package/lean/r8125/src/rtl_eeprom.c
Normal file → Executable file
0
package/lean/r8125/src/rtl_eeprom.c
Normal file → Executable file
0
package/lean/r8125/src/rtl_eeprom.h
Normal file → Executable file
0
package/lean/r8125/src/rtl_eeprom.h
Normal file → Executable file
39
package/lean/r8125/src/rtltool.c
Normal file → Executable file
39
package/lean/r8125/src/rtltool.c
Normal file → Executable file
@ -47,7 +47,6 @@
|
||||
int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr)
|
||||
{
|
||||
struct rtltool_cmd my_cmd;
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
if (copy_from_user(&my_cmd, ifr->ifr_data, sizeof(my_cmd)))
|
||||
@ -97,10 +96,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr)
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
my_cmd.data = rtl8125_mdio_prot_read(tp, my_cmd.offset);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
|
||||
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
@ -112,19 +108,14 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr)
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
rtl8125_mdio_prot_write(tp, my_cmd.offset, my_cmd.data);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
break;
|
||||
|
||||
case RTLTOOL_READ_EPHY:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
my_cmd.data = rtl8125_ephy_read(tp, my_cmd.offset);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
|
||||
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
@ -136,17 +127,13 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr)
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
rtl8125_ephy_write(tp, my_cmd.offset, my_cmd.data);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
break;
|
||||
|
||||
case RTLTOOL_READ_ERI:
|
||||
my_cmd.data = 0;
|
||||
if (my_cmd.len==1 || my_cmd.len==2 || my_cmd.len==4) {
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
my_cmd.data = rtl8125_eri_read(tp, my_cmd.offset, my_cmd.len, ERIAR_ExGMAC);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
} else {
|
||||
ret = -EOPNOTSUPP;
|
||||
break;
|
||||
@ -167,9 +154,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr)
|
||||
return -EPERM;
|
||||
|
||||
if (my_cmd.len==1 || my_cmd.len==2 || my_cmd.len==4) {
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
rtl8125_eri_write(tp, my_cmd.offset, my_cmd.len, my_cmd.data, ERIAR_ExGMAC);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
} else {
|
||||
ret = -EOPNOTSUPP;
|
||||
break;
|
||||
@ -225,10 +210,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr)
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
my_cmd.data = rtl8125_eeprom_read_sc(tp, my_cmd.offset);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
|
||||
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
@ -240,21 +222,16 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr)
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
rtl8125_eeprom_write_sc(tp, my_cmd.offset, my_cmd.data);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
break;
|
||||
|
||||
case RTL_READ_OOB_MAC:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
rtl8125_oob_mutex_lock(tp);
|
||||
my_cmd.data = rtl8125_ocp_read(tp, my_cmd.offset, 4);
|
||||
rtl8125_oob_mutex_unlock(tp);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
|
||||
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
@ -268,20 +245,16 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr)
|
||||
if (my_cmd.len == 0 || my_cmd.len > 4)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
rtl8125_oob_mutex_lock(tp);
|
||||
rtl8125_ocp_write(tp, my_cmd.offset, my_cmd.len, my_cmd.data);
|
||||
rtl8125_oob_mutex_unlock(tp);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
break;
|
||||
|
||||
case RTL_ENABLE_PCI_DIAG:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
tp->rtk_enable_diag = 1;
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
|
||||
dprintk("enable rtk diag\n");
|
||||
break;
|
||||
@ -290,9 +263,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr)
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
tp->rtk_enable_diag = 0;
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
|
||||
dprintk("disable rtk diag\n");
|
||||
break;
|
||||
@ -304,10 +275,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr)
|
||||
if (my_cmd.offset % 2)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
my_cmd.data = rtl8125_mac_ocp_read(tp, my_cmd.offset);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
|
||||
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
@ -321,19 +289,14 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr)
|
||||
if ((my_cmd.offset % 2) || (my_cmd.len != 2))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
rtl8125_mac_ocp_write(tp, my_cmd.offset, (u16)my_cmd.data);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
break;
|
||||
|
||||
case RTL_DIRECT_READ_PHY_OCP:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
my_cmd.data = rtl8125_mdio_prot_direct_read_phy_ocp(tp, my_cmd.offset);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
|
||||
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
@ -345,9 +308,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr)
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
spin_lock_irqsave(&tp->lock, flags);
|
||||
rtl8125_mdio_prot_direct_write_phy_ocp(tp, my_cmd.offset, my_cmd.data);
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
0
package/lean/r8125/src/rtltool.h
Normal file → Executable file
0
package/lean/r8125/src/rtltool.h
Normal file → Executable file
Loading…
Reference in New Issue
Block a user