Skip to content

Commit 99aa8fd

Browse files
eth: xtile: support for qsfp up and down event registration for defense
1 parent 99bf893 commit 99aa8fd

File tree

3 files changed

+156
-126
lines changed

3 files changed

+156
-126
lines changed

drivers/net/ethernet/altera/intel_fpga_eth_etile.h

Lines changed: 45 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424
#include <linux/phy.h>
2525
#include <linux/ptp_clock_kernel.h>
2626
#include <linux/timer.h>
27+
#include <linux/phylink.h>
2728
#include "intel_fpga_tod.h"
2829
#include "altera_eth_dma.h"
2930
#include "altera_msgdma.h"
3031
#include "altera_msgdma_prefetcher.h"
3132
#include "altera_sgdma.h"
33+
#include "intel_fpga_eth_qsfp.h"
3234

3335
#define INTEL_FPGA_RET_SUCCESS 0
3436

@@ -2563,103 +2565,73 @@ struct intel_fpga_rx_fifo {
25632565
#define rx_fifo_csroffs(a) (offsetof(struct intel_fpga_rx_fifo, a))
25642566

25652567
struct intel_fpga_etile_eth_private {
2568+
2569+
const char *fec_type;
25662570
struct net_device *dev;
2567-
struct device *device;
2568-
struct napi_struct napi;
2569-
struct timer_list fec_timer;
2570-
2571-
/* Phylink */
2572-
struct phylink *phylink;
2573-
struct phylink_config phylink_config;
2574-
/* MAC address space */
2571+
struct device *device;
2572+
struct phylink *phylink;
2573+
struct qsfp_ops *qsfp_ops;
2574+
struct altera_dmaops *dmaops;
25752575
struct platform_device *pdev_hssi;
2576-
/* Shared DMA structure */
2577-
struct altera_dma_private dma_priv;
2578-
2579-
/* Shared PTP structure */
2580-
struct intel_fpga_tod_private ptp_priv;
2581-
2582-
u32 ptp_enable;
2583-
u32 chan;
2576+
struct qsfp_reg_space __iomem *qsfp_reg;
25842577
struct intel_fpga_rx_fifo __iomem *rx_fifo;
2585-
/* RS-FEC address space */
2586-
struct intel_fpga_etile_rsfec __iomem *rsfec;
2587-
2588-
/* Interrupts */
2578+
2579+
u32 chan;
25892580
u32 tx_irq;
25902581
u32 rx_irq;
2591-
2592-
u32 tx_irqcount;
2593-
u32 rx_irqcount;
2594-
2595-
u32 xtile_pollcount;
2596-
u32 txcomp;
2597-
u32 rxcomp;
2598-
2599-
u32 intr_missed;
2600-
2601-
/* RX/TX MAC FIFO configs */
2582+
u32 max_mtu;
26022583
u32 tx_fifo_depth;
26032584
u32 rx_fifo_depth;
26042585
u32 rx_fifo_almost_full;
26052586
u32 rx_fifo_almost_empty;
2606-
u32 max_mtu;
2607-
2608-
/* MAC command_config register protection */
2609-
spinlock_t mac_cfg_lock;
2610-
/* Tx path protection */
2611-
spinlock_t tx_lock;
2612-
2613-
/* Rx DMA & interrupt control protection */
2614-
spinlock_t rxdma_irq_lock;
2615-
2616-
/* Rx DMA Buffer Size */
26172587
u32 rxdma_buffer_size;
2618-
/* MAC flow control */
2619-
unsigned int flow_ctrl;
2620-
unsigned int pause;
2621-
2622-
/* PMA digital delay */
2588+
u32 flow_ctrl;
2589+
u32 pause;
2590+
u32 msg_enable;
2591+
u32 link_speed;
2592+
26232593
u32 tx_pma_delay_ns;
26242594
u32 rx_pma_delay_ns;
26252595
u32 tx_pma_delay_fns;
26262596
u32 rx_pma_delay_fns;
2627-
2628-
/* External PHY delay */
2597+
u32 rsfec_cw_pos_rx;
26292598
u32 tx_external_phy_delay_ns;
26302599
u32 rx_external_phy_delay_ns;
2631-
2632-
/* PHY */
2633-
void __iomem *mac_extra_control;
2634-
int phy_addr; /* PHY's MDIO address, -1 for autodetection */
2635-
phy_interface_t phy_iface;
2636-
struct mii_bus *mdio;
2637-
u32 link_speed;
2600+
26382601
u8 duplex;
2639-
int oldlink;
2640-
2641-
/* FEC */
2642-
const char *fec_type;
2643-
u32 rsfec_cw_pos_rx;
2644-
2645-
/* ethtool msglvl option */
2646-
u32 msg_enable;
2647-
struct altera_dmaops *dmaops;
2602+
u8 qsfp_lane;
2603+
bool autoneg;
2604+
bool ptp_enable;
2605+
bool cable_unplugged;
2606+
2607+
spinlock_t tx_lock;
2608+
spinlock_t mac_cfg_lock;
2609+
spinlock_t rxdma_irq_lock;
2610+
2611+
struct napi_struct napi;
2612+
struct delayed_work dwork;
2613+
struct timer_list fec_timer;
2614+
struct altera_dma_private dma_priv;
2615+
struct phylink_config phylink_config;
2616+
struct intel_fpga_tod_private ptp_priv;
26482617

2618+
phy_interface_t phy_iface;
26492619
};
26502620

2651-
/* Function prototypes
2652-
*/
2621+
/* Function prototypes */
26532622
void ui_adjustments(struct timer_list *t);
2654-
26552623
int init_mac(struct intel_fpga_etile_eth_private *priv);
2656-
void enable_port_loopback(struct intel_fpga_etile_eth_private *priv, int port);
26572624
void xtile_get_stats64(struct net_device *dev,
26582625
struct rtnl_link_stats64 *storage);
2659-
void pma_digital_reset(struct intel_fpga_etile_eth_private *priv, bool tx_reset, bool rx_reset);
2660-
2661-
int xtile_check_counter_complete(struct intel_fpga_etile_eth_private *priv, u32 regbank,
2662-
size_t offs, u8 bit_mask, bool set_bit,
2626+
void pma_digital_reset(struct intel_fpga_etile_eth_private *priv,
2627+
bool tx_reset,
2628+
bool rx_reset);
2629+
void pma_analog_reset(struct intel_fpga_etile_eth_private *priv);
2630+
int xtile_check_counter_complete(struct intel_fpga_etile_eth_private *priv,
2631+
u32 regbank,
2632+
size_t offs,
2633+
u8 bit_mask,
2634+
bool set_bit,
26632635
int align);
26642636

26652637
#ifdef CONFIG_INTEL_FPGA_ETILE_DEBUG_FS

0 commit comments

Comments
 (0)