mirror of https://gitee.com/openkylin/linux.git
r8169: add r8169.h
In preparation of factoring out PHY configuration to a separate source file move commonly used definitions to new header file r8169.h. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1c5be5e91d
commit
2992bdfa4a
|
@ -0,0 +1,78 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* r8169.h: RealTek 8169/8168/8101 ethernet driver.
|
||||
*
|
||||
* Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
|
||||
* Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
|
||||
* Copyright (c) a lot of people too. Please respect their work.
|
||||
*
|
||||
* See MAINTAINERS file for support contact information.
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/phy.h>
|
||||
|
||||
enum mac_version {
|
||||
/* support for ancient RTL_GIGA_MAC_VER_01 has been removed */
|
||||
RTL_GIGA_MAC_VER_02,
|
||||
RTL_GIGA_MAC_VER_03,
|
||||
RTL_GIGA_MAC_VER_04,
|
||||
RTL_GIGA_MAC_VER_05,
|
||||
RTL_GIGA_MAC_VER_06,
|
||||
RTL_GIGA_MAC_VER_07,
|
||||
RTL_GIGA_MAC_VER_08,
|
||||
RTL_GIGA_MAC_VER_09,
|
||||
RTL_GIGA_MAC_VER_10,
|
||||
RTL_GIGA_MAC_VER_11,
|
||||
RTL_GIGA_MAC_VER_12,
|
||||
RTL_GIGA_MAC_VER_13,
|
||||
RTL_GIGA_MAC_VER_14,
|
||||
RTL_GIGA_MAC_VER_15,
|
||||
RTL_GIGA_MAC_VER_16,
|
||||
RTL_GIGA_MAC_VER_17,
|
||||
RTL_GIGA_MAC_VER_18,
|
||||
RTL_GIGA_MAC_VER_19,
|
||||
RTL_GIGA_MAC_VER_20,
|
||||
RTL_GIGA_MAC_VER_21,
|
||||
RTL_GIGA_MAC_VER_22,
|
||||
RTL_GIGA_MAC_VER_23,
|
||||
RTL_GIGA_MAC_VER_24,
|
||||
RTL_GIGA_MAC_VER_25,
|
||||
RTL_GIGA_MAC_VER_26,
|
||||
RTL_GIGA_MAC_VER_27,
|
||||
RTL_GIGA_MAC_VER_28,
|
||||
RTL_GIGA_MAC_VER_29,
|
||||
RTL_GIGA_MAC_VER_30,
|
||||
RTL_GIGA_MAC_VER_31,
|
||||
RTL_GIGA_MAC_VER_32,
|
||||
RTL_GIGA_MAC_VER_33,
|
||||
RTL_GIGA_MAC_VER_34,
|
||||
RTL_GIGA_MAC_VER_35,
|
||||
RTL_GIGA_MAC_VER_36,
|
||||
RTL_GIGA_MAC_VER_37,
|
||||
RTL_GIGA_MAC_VER_38,
|
||||
RTL_GIGA_MAC_VER_39,
|
||||
RTL_GIGA_MAC_VER_40,
|
||||
RTL_GIGA_MAC_VER_41,
|
||||
RTL_GIGA_MAC_VER_42,
|
||||
RTL_GIGA_MAC_VER_43,
|
||||
RTL_GIGA_MAC_VER_44,
|
||||
RTL_GIGA_MAC_VER_45,
|
||||
RTL_GIGA_MAC_VER_46,
|
||||
RTL_GIGA_MAC_VER_47,
|
||||
RTL_GIGA_MAC_VER_48,
|
||||
RTL_GIGA_MAC_VER_49,
|
||||
RTL_GIGA_MAC_VER_50,
|
||||
RTL_GIGA_MAC_VER_51,
|
||||
RTL_GIGA_MAC_VER_52,
|
||||
RTL_GIGA_MAC_VER_60,
|
||||
RTL_GIGA_MAC_VER_61,
|
||||
RTL_GIGA_MAC_NONE
|
||||
};
|
||||
|
||||
struct rtl8169_private;
|
||||
|
||||
void r8169_apply_firmware(struct rtl8169_private *tp);
|
||||
u16 rtl8168h_2_get_adc_bias_ioffset(struct rtl8169_private *tp);
|
||||
u8 rtl8168d_efuse_read(struct rtl8169_private *tp, int reg_addr);
|
||||
void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev,
|
||||
enum mac_version ver);
|
|
@ -31,6 +31,7 @@
|
|||
#include <linux/ipv6.h>
|
||||
#include <net/ip6_checksum.h>
|
||||
|
||||
#include "r8169.h"
|
||||
#include "r8169_firmware.h"
|
||||
|
||||
#define MODULENAME "r8169"
|
||||
|
@ -84,64 +85,6 @@
|
|||
#define RTL_R16(tp, reg) readw(tp->mmio_addr + (reg))
|
||||
#define RTL_R32(tp, reg) readl(tp->mmio_addr + (reg))
|
||||
|
||||
enum mac_version {
|
||||
/* support for ancient RTL_GIGA_MAC_VER_01 has been removed */
|
||||
RTL_GIGA_MAC_VER_02,
|
||||
RTL_GIGA_MAC_VER_03,
|
||||
RTL_GIGA_MAC_VER_04,
|
||||
RTL_GIGA_MAC_VER_05,
|
||||
RTL_GIGA_MAC_VER_06,
|
||||
RTL_GIGA_MAC_VER_07,
|
||||
RTL_GIGA_MAC_VER_08,
|
||||
RTL_GIGA_MAC_VER_09,
|
||||
RTL_GIGA_MAC_VER_10,
|
||||
RTL_GIGA_MAC_VER_11,
|
||||
RTL_GIGA_MAC_VER_12,
|
||||
RTL_GIGA_MAC_VER_13,
|
||||
RTL_GIGA_MAC_VER_14,
|
||||
RTL_GIGA_MAC_VER_15,
|
||||
RTL_GIGA_MAC_VER_16,
|
||||
RTL_GIGA_MAC_VER_17,
|
||||
RTL_GIGA_MAC_VER_18,
|
||||
RTL_GIGA_MAC_VER_19,
|
||||
RTL_GIGA_MAC_VER_20,
|
||||
RTL_GIGA_MAC_VER_21,
|
||||
RTL_GIGA_MAC_VER_22,
|
||||
RTL_GIGA_MAC_VER_23,
|
||||
RTL_GIGA_MAC_VER_24,
|
||||
RTL_GIGA_MAC_VER_25,
|
||||
RTL_GIGA_MAC_VER_26,
|
||||
RTL_GIGA_MAC_VER_27,
|
||||
RTL_GIGA_MAC_VER_28,
|
||||
RTL_GIGA_MAC_VER_29,
|
||||
RTL_GIGA_MAC_VER_30,
|
||||
RTL_GIGA_MAC_VER_31,
|
||||
RTL_GIGA_MAC_VER_32,
|
||||
RTL_GIGA_MAC_VER_33,
|
||||
RTL_GIGA_MAC_VER_34,
|
||||
RTL_GIGA_MAC_VER_35,
|
||||
RTL_GIGA_MAC_VER_36,
|
||||
RTL_GIGA_MAC_VER_37,
|
||||
RTL_GIGA_MAC_VER_38,
|
||||
RTL_GIGA_MAC_VER_39,
|
||||
RTL_GIGA_MAC_VER_40,
|
||||
RTL_GIGA_MAC_VER_41,
|
||||
RTL_GIGA_MAC_VER_42,
|
||||
RTL_GIGA_MAC_VER_43,
|
||||
RTL_GIGA_MAC_VER_44,
|
||||
RTL_GIGA_MAC_VER_45,
|
||||
RTL_GIGA_MAC_VER_46,
|
||||
RTL_GIGA_MAC_VER_47,
|
||||
RTL_GIGA_MAC_VER_48,
|
||||
RTL_GIGA_MAC_VER_49,
|
||||
RTL_GIGA_MAC_VER_50,
|
||||
RTL_GIGA_MAC_VER_51,
|
||||
RTL_GIGA_MAC_VER_52,
|
||||
RTL_GIGA_MAC_VER_60,
|
||||
RTL_GIGA_MAC_VER_61,
|
||||
RTL_GIGA_MAC_NONE
|
||||
};
|
||||
|
||||
#define JUMBO_1K ETH_DATA_LEN
|
||||
#define JUMBO_4K (4*1024 - ETH_HLEN - 2)
|
||||
#define JUMBO_6K (6*1024 - ETH_HLEN - 2)
|
||||
|
@ -1362,7 +1305,7 @@ DECLARE_RTL_COND(rtl_efusear_cond)
|
|||
return RTL_R32(tp, EFUSEAR) & EFUSEAR_FLAG;
|
||||
}
|
||||
|
||||
static u8 rtl8168d_efuse_read(struct rtl8169_private *tp, int reg_addr)
|
||||
u8 rtl8168d_efuse_read(struct rtl8169_private *tp, int reg_addr)
|
||||
{
|
||||
RTL_W32(tp, EFUSEAR, (reg_addr & EFUSEAR_REG_MASK) << EFUSEAR_REG_SHIFT);
|
||||
|
||||
|
@ -2287,7 +2230,7 @@ static void rtl_release_firmware(struct rtl8169_private *tp)
|
|||
}
|
||||
}
|
||||
|
||||
static void r8169_apply_firmware(struct rtl8169_private *tp)
|
||||
void r8169_apply_firmware(struct rtl8169_private *tp)
|
||||
{
|
||||
/* TODO: release firmware if rtl_fw_write_firmware signals failure. */
|
||||
if (tp->rtl_fw)
|
||||
|
@ -3178,7 +3121,7 @@ static void rtl8168h_1_hw_phy_config(struct rtl8169_private *tp,
|
|||
rtl8168h_config_eee_phy(phydev);
|
||||
}
|
||||
|
||||
static u16 rtl8168h_2_get_adc_bias_ioffset(struct rtl8169_private *tp)
|
||||
u16 rtl8168h_2_get_adc_bias_ioffset(struct rtl8169_private *tp)
|
||||
{
|
||||
u16 data1, data2, ioffset;
|
||||
|
||||
|
@ -3510,9 +3453,8 @@ static void rtl8125_2_hw_phy_config(struct rtl8169_private *tp,
|
|||
rtl8125_config_eee_phy(phydev);
|
||||
}
|
||||
|
||||
static void r8169_hw_phy_config(struct rtl8169_private *tp,
|
||||
struct phy_device *phydev,
|
||||
enum mac_version ver)
|
||||
void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev,
|
||||
enum mac_version ver)
|
||||
{
|
||||
static const rtl_phy_cfg_fct phy_configs[] = {
|
||||
/* PCI devices. */
|
||||
|
|
Loading…
Reference in New Issue