|
24 | 24 | #include <linux/phy.h> |
25 | 25 | #include <linux/ptp_clock_kernel.h> |
26 | 26 | #include <linux/timer.h> |
| 27 | +#include <linux/phylink.h> |
27 | 28 | #include "intel_fpga_tod.h" |
28 | 29 | #include "altera_eth_dma.h" |
29 | 30 | #include "altera_msgdma.h" |
30 | 31 | #include "altera_msgdma_prefetcher.h" |
31 | 32 | #include "altera_sgdma.h" |
| 33 | +#include "intel_fpga_eth_qsfp.h" |
32 | 34 |
|
33 | 35 | #define INTEL_FPGA_RET_SUCCESS 0 |
34 | 36 |
|
@@ -2563,103 +2565,73 @@ struct intel_fpga_rx_fifo { |
2563 | 2565 | #define rx_fifo_csroffs(a) (offsetof(struct intel_fpga_rx_fifo, a)) |
2564 | 2566 |
|
2565 | 2567 | struct intel_fpga_etile_eth_private { |
| 2568 | + |
| 2569 | + const char *fec_type; |
2566 | 2570 | 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; |
2575 | 2575 | 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; |
2584 | 2577 | 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; |
2589 | 2580 | u32 tx_irq; |
2590 | 2581 | 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; |
2602 | 2583 | u32 tx_fifo_depth; |
2603 | 2584 | u32 rx_fifo_depth; |
2604 | 2585 | u32 rx_fifo_almost_full; |
2605 | 2586 | 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 */ |
2617 | 2587 | 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 | + |
2623 | 2593 | u32 tx_pma_delay_ns; |
2624 | 2594 | u32 rx_pma_delay_ns; |
2625 | 2595 | u32 tx_pma_delay_fns; |
2626 | 2596 | u32 rx_pma_delay_fns; |
2627 | | - |
2628 | | - /* External PHY delay */ |
| 2597 | + u32 rsfec_cw_pos_rx; |
2629 | 2598 | u32 tx_external_phy_delay_ns; |
2630 | 2599 | 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 | + |
2638 | 2601 | 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; |
2648 | 2617 |
|
| 2618 | + phy_interface_t phy_iface; |
2649 | 2619 | }; |
2650 | 2620 |
|
2651 | | -/* Function prototypes |
2652 | | - */ |
| 2621 | +/* Function prototypes */ |
2653 | 2622 | void ui_adjustments(struct timer_list *t); |
2654 | | - |
2655 | 2623 | int init_mac(struct intel_fpga_etile_eth_private *priv); |
2656 | | -void enable_port_loopback(struct intel_fpga_etile_eth_private *priv, int port); |
2657 | 2624 | void xtile_get_stats64(struct net_device *dev, |
2658 | 2625 | 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, |
2663 | 2635 | int align); |
2664 | 2636 |
|
2665 | 2637 | #ifdef CONFIG_INTEL_FPGA_ETILE_DEBUG_FS |
|
0 commit comments