igc: Add support for PF
Subsystems (2)
PATCH v6 2/11 igc: Add support for PF
This patch adds the basic defines and structures needed by the PF for operation. With this it is possible to bring up the interface, but without being able to configure any of the filters on the interface itself.
Add skeleton for a function pointers.
Sasha Neftin (v2):
add description
fix code indentation
Sasha Neftin (v3):
squash patches, clean code and remove unused values remove duplication
Sasha Neftin (v4):
address comments
remove unused PCIE definition
remove unused MAX_MTA_REG definition
remove unused NVM registers
remove unused PCIE registers
remove unused DMA registers
remove unused Receive registers
remove unused Transmit registers
fix typos
replace e1000_ prefix with igc_ prefix
remove unused PCIE defines
remove unused EEE register, will be add per needs
remove unused SERDES definitions
Sasha Neftin (v5):
resolve automatic test system error
add __iomem to *hw_addr definition
remove obsolete flash_address definition
Sasha Neftin (v6):
fix code indentation
remove unused defines from igc_defines.h
minor cosmetic changes
--- drivers/net/ethernet/intel/igc/Makefile | 2 +- drivers/net/ethernet/intel/igc/igc.h | 13 ++ drivers/net/ethernet/intel/igc/igc_defines.h | 33 ++++ drivers/net/ethernet/intel/igc/igc_hw.h | 112 +++++++++++ drivers/net/ethernet/intel/igc/igc_i225.h | 10 + drivers/net/ethernet/intel/igc/igc_mac.c | 51 +++++ drivers/net/ethernet/intel/igc/igc_mac.h | 13 ++ drivers/net/ethernet/intel/igc/igc_main.c | 101 ++++++++++ drivers/net/ethernet/intel/igc/igc_regs.h | 192 +++++++++++++++++++ 9 files changed, 526 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/intel/igc/igc_defines.h create mode 100644 drivers/net/ethernet/intel/igc/igc_i225.h create mode 100644 drivers/net/ethernet/intel/igc/igc_mac.c create mode 100644 drivers/net/ethernet/intel/igc/igc_mac.h create mode 100644 drivers/net/ethernet/intel/igc/igc_regs.h
drivers/net/ethernet/intel/igc/Makefile +1 -1
@@ -7,4 +7,4 @@ obj-$(CONFIG_IGC) += igc.o -igc-objs := igc_main.o +igc-objs := igc_main.o igc_mac.o
drivers/net/ethernet/intel/igc/igc.h +13 -0
@@ -22,8 +22,21 @@#include <linux/net_tstamp.h> #include <linux/ptp_clock_kernel.h> +#include "igc_hw.h" +/* main */ extern char igc_driver_name[];extern char igc_driver_version[]; +/* Board specific private data structure */ +struct igc_adapter { +u8 __iomem *io_addr; + +/* OS defined structs */ +struct pci_dev *pdev; + +/* structs defined in igc_hw.h */ +struct igc_hw hw; +}; +#endif /* _IGC_H_ */
drivers/net/ethernet/intel/igc/igc_defines.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2018 Intel Corporation */ + +#ifndef _IGC_DEFINES_H_ +#define _IGC_DEFINES_H_ + +/* PCI Function Mask */ +#define IGC_STATUS_FUNC_MASK 0x0000000C + +/* PCI Bus Info */ +#define PCIE_DEVICE_CONTROL2 0x28 +#define PCIE_DEVICE_CONTROL2_16ms 0x0005 + +/* Error Codes */ +#define IGC_SUCCESS 0 +#define IGC_ERR_NVM 1 +#define IGC_ERR_PHY 2 +#define IGC_ERR_CONFIG 3 +#define IGC_ERR_PARAM 4 +#define IGC_ERR_MAC_INIT 5 +#define IGC_ERR_RESET 9 + +/* Device Status */ +#define IGC_STATUS_FD 0x00000001/* Full duplex.0=half,1=full */ +#define IGC_STATUS_LU 0x00000002/* Link up.0=no,1=link */ +#define IGC_STATUS_FUNC_MASK 0x0000000C/* PCI Function Mask */ +#define IGC_STATUS_FUNC_SHIFT 2 +#define IGC_STATUS_FUNC_1 0x00000004/* Function 1 */ +#define IGC_STATUS_TXOFF 0x00000010/* transmission paused */ +#define IGC_STATUS_SPEED_100 0x00000040/* Speed 100Mb/s */ +#define IGC_STATUS_SPEED_1000 0x00000080/* Speed 1000Mb/s */ + +#endif /* _IGC_DEFINES_H_ */
drivers/net/ethernet/intel/igc/igc_hw.h +112 -0
119 lines not on this page · raw message
drivers/net/ethernet/intel/igc/igc_i225.h new file +10 -0
@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2018 Intel Corporation */ + +#ifndef _IGC_I225_H_ +#define _IGC_I225_H_ + +s32 igc_acquire_swfw_sync_i225 (struct igc_hw *hw,u16 mask); +void igc_release_swfw_sync_i225 (struct igc_hw *hw,u16 mask); + +#endif
drivers/net/ethernet/intel/igc/igc_mac.c new file +51 -0
51 lines not on this page · raw message
drivers/net/ethernet/intel/igc/igc_mac.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2018 Intel Corporation */ + +#ifndef _IGC_MAC_H_ +#define _IGC_MAC_H_ + +#ifndef IGC_REMOVED +#define IGC_REMOVED (a) (0) +#endif /* IGC_REMOVED */ + +s32 igc_get_bus_info_pcie (struct igc_hw *hw); + +#endif
drivers/net/ethernet/intel/igc/igc_main.c +101 -0
127 lines not on this page · raw message
drivers/net/ethernet/intel/igc/igc_regs.h new file +192 -0
192 lines not on this page · raw message
Signature · 1 line
2.18.0
PATCH v6 2/11 igc: Add support for PF
On 8/23/2018 12:05 AM, Sasha Neftin wrote:
[...]
drivers/net/ethernet/intel/igc/igc_regs.h line 191
Quoted 5 lines
drivers/net/ethernet/intel/igc/igc_regs.h new file +5
-0+#define array_wr32 (reg, offset, value) \ + wr32((reg) + ((offset) << 2), (value)) + +#define array_rd32 (reg, offset) (igc_rd32(hw, (reg) + ((offset) << 2))) +
Hmm... you may want to be careful with these array defines. I don't know what the register set looks like, but on some devices I've seen array element offset is in things like 128 byte chunks rather than 4-byte words.
sln
Neftin
PATCH v6 2/11 igc: Add support for PF
Quoted 15 lines · Shannon Nelson
On 8/23/2018 12:05 AM, Sasha Neftin wrote:
[...]
drivers/net/ethernet/intel/igc/igc_regs.h line 191
Quoted 5 lines
drivers/net/ethernet/intel/igc/igc_regs.h new file +5
-0+#define array_wr32 (reg, offset, value) \ +??? wr32((reg) + ((offset) << 2), (value)) + +#define array_rd32 (reg, offset) (igc_rd32(hw, (reg) + ((offset) << 2))) +Hmm... you may want to be careful with these array defines.? I don't know what the register set looks like, but on some devices I've seen array element offset is in things like 128 byte chunks rather than 4-byte words.
Quoted 2 lines
sln
Good point. We use this define for read array of 32 bit registers. Also, I will add validation request to double check how it work. Thanks,
Sasha