diff options
author | Edward Cree <ecree@solarflare.com> | 2016-11-28 21:55:34 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-30 18:16:58 +0300 |
commit | 5a6681e22c1409089132085811857d6da828761b (patch) | |
tree | 3ba1f36288a43a6136ea62d366bbaead4ac150b6 /drivers/net/ethernet/sfc/nic.h | |
parent | 6bb10c2bc6576d80d2e933a58b4210101e56c30c (diff) | |
download | linux-5a6681e22c1409089132085811857d6da828761b.tar.xz |
sfc: separate out SFC4000 ("Falcon") support into new sfc-falcon driver
Rationale: The differences between Falcon and Siena are in many ways larger
than those between Siena and EF10 (despite Siena being nominally "Falcon-
architecture"); for instance, Falcon has no MCPU, so there is no MCDI.
Removing Falcon support from the sfc driver should simplify the latter,
and avoid the possibility of Falcon support being broken by changes to sfc
(which are rarely if ever tested on Falcon, it being end-of-lifed hardware).
The sfc-falcon driver created in this changeset is essentially a copy of the
sfc driver, but with Siena- and EF10-specific code, including MCDI, removed
and with the "efx_" identifier prefix changed to "ef4_" (for "EFX 4000-
series") to avoid collisions when both drivers are built-in.
This changeset removes Falcon from the sfc driver's PCI ID table; then in
sfc I've removed obvious Falcon-related code: I removed the Falcon NIC
functions, Falcon PHY code, and EFX_REV_FALCON_*, then fixed up everything
that referenced them.
Also, increment minor version of both drivers (to 4.1).
For now, CONFIG_SFC selects CONFIG_SFC_FALCON, so that updating old configs
doesn't cause Falcon support to disappear; but that should be undone at
some point in the future.
Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sfc/nic.h')
-rw-r--r-- | drivers/net/ethernet/sfc/nic.h | 172 |
1 files changed, 2 insertions, 170 deletions
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h index 06dd96e25bb6..223774635cba 100644 --- a/drivers/net/ethernet/sfc/nic.h +++ b/drivers/net/ethernet/sfc/nic.h @@ -18,11 +18,8 @@ #include "mcdi.h" enum { - EFX_REV_FALCON_A0 = 0, - EFX_REV_FALCON_A1 = 1, - EFX_REV_FALCON_B0 = 2, - EFX_REV_SIENA_A0 = 3, - EFX_REV_HUNT_A0 = 4, + EFX_REV_SIENA_A0 = 0, + EFX_REV_HUNT_A0 = 1, }; static inline int efx_nic_rev(struct efx_nic *efx) @@ -32,12 +29,6 @@ static inline int efx_nic_rev(struct efx_nic *efx) u32 efx_farch_fpga_ver(struct efx_nic *efx); -/* NIC has two interlinked PCI functions for the same port. */ -static inline bool efx_nic_is_dual_func(struct efx_nic *efx) -{ - return efx_nic_rev(efx) < EFX_REV_FALCON_B0; -} - /* Read the current event from the event queue */ static inline efx_qword_t *efx_event(struct efx_channel *channel, unsigned int index) @@ -144,11 +135,6 @@ enum { PHY_TYPE_SFT9001B = 10, }; -#define FALCON_XMAC_LOOPBACKS \ - ((1 << LOOPBACK_XGMII) | \ - (1 << LOOPBACK_XGXS) | \ - (1 << LOOPBACK_XAUI)) - /* Alignment of PCIe DMA boundaries (4KB) */ #define EFX_PAGE_SIZE 4096 /* Size and alignment of buffer table entries (same) */ @@ -161,160 +147,6 @@ enum { GENERIC_STAT_COUNT }; -/** - * struct falcon_board_type - board operations and type information - * @id: Board type id, as found in NVRAM - * @init: Allocate resources and initialise peripheral hardware - * @init_phy: Do board-specific PHY initialisation - * @fini: Shut down hardware and free resources - * @set_id_led: Set state of identifying LED or revert to automatic function - * @monitor: Board-specific health check function - */ -struct falcon_board_type { - u8 id; - int (*init) (struct efx_nic *nic); - void (*init_phy) (struct efx_nic *efx); - void (*fini) (struct efx_nic *nic); - void (*set_id_led) (struct efx_nic *efx, enum efx_led_mode mode); - int (*monitor) (struct efx_nic *nic); -}; - -/** - * struct falcon_board - board information - * @type: Type of board - * @major: Major rev. ('A', 'B' ...) - * @minor: Minor rev. (0, 1, ...) - * @i2c_adap: I2C adapter for on-board peripherals - * @i2c_data: Data for bit-banging algorithm - * @hwmon_client: I2C client for hardware monitor - * @ioexp_client: I2C client for power/port control - */ -struct falcon_board { - const struct falcon_board_type *type; - int major; - int minor; - struct i2c_adapter i2c_adap; - struct i2c_algo_bit_data i2c_data; - struct i2c_client *hwmon_client, *ioexp_client; -}; - -/** - * struct falcon_spi_device - a Falcon SPI (Serial Peripheral Interface) device - * @device_id: Controller's id for the device - * @size: Size (in bytes) - * @addr_len: Number of address bytes in read/write commands - * @munge_address: Flag whether addresses should be munged. - * Some devices with 9-bit addresses (e.g. AT25040A EEPROM) - * use bit 3 of the command byte as address bit A8, rather - * than having a two-byte address. If this flag is set, then - * commands should be munged in this way. - * @erase_command: Erase command (or 0 if sector erase not needed). - * @erase_size: Erase sector size (in bytes) - * Erase commands affect sectors with this size and alignment. - * This must be a power of two. - * @block_size: Write block size (in bytes). - * Write commands are limited to blocks with this size and alignment. - */ -struct falcon_spi_device { - int device_id; - unsigned int size; - unsigned int addr_len; - unsigned int munge_address:1; - u8 erase_command; - unsigned int erase_size; - unsigned int block_size; -}; - -static inline bool falcon_spi_present(const struct falcon_spi_device *spi) -{ - return spi->size != 0; -} - -enum { - FALCON_STAT_tx_bytes = GENERIC_STAT_COUNT, - FALCON_STAT_tx_packets, - FALCON_STAT_tx_pause, - FALCON_STAT_tx_control, - FALCON_STAT_tx_unicast, - FALCON_STAT_tx_multicast, - FALCON_STAT_tx_broadcast, - FALCON_STAT_tx_lt64, - FALCON_STAT_tx_64, - FALCON_STAT_tx_65_to_127, - FALCON_STAT_tx_128_to_255, - FALCON_STAT_tx_256_to_511, - FALCON_STAT_tx_512_to_1023, - FALCON_STAT_tx_1024_to_15xx, - FALCON_STAT_tx_15xx_to_jumbo, - FALCON_STAT_tx_gtjumbo, - FALCON_STAT_tx_non_tcpudp, - FALCON_STAT_tx_mac_src_error, - FALCON_STAT_tx_ip_src_error, - FALCON_STAT_rx_bytes, - FALCON_STAT_rx_good_bytes, - FALCON_STAT_rx_bad_bytes, - FALCON_STAT_rx_packets, - FALCON_STAT_rx_good, - FALCON_STAT_rx_bad, - FALCON_STAT_rx_pause, - FALCON_STAT_rx_control, - FALCON_STAT_rx_unicast, - FALCON_STAT_rx_multicast, - FALCON_STAT_rx_broadcast, - FALCON_STAT_rx_lt64, - FALCON_STAT_rx_64, - FALCON_STAT_rx_65_to_127, - FALCON_STAT_rx_128_to_255, - FALCON_STAT_rx_256_to_511, - FALCON_STAT_rx_512_to_1023, - FALCON_STAT_rx_1024_to_15xx, - FALCON_STAT_rx_15xx_to_jumbo, - FALCON_STAT_rx_gtjumbo, - FALCON_STAT_rx_bad_lt64, - FALCON_STAT_rx_bad_gtjumbo, - FALCON_STAT_rx_overflow, - FALCON_STAT_rx_symbol_error, - FALCON_STAT_rx_align_error, - FALCON_STAT_rx_length_error, - FALCON_STAT_rx_internal_error, - FALCON_STAT_rx_nodesc_drop_cnt, - FALCON_STAT_COUNT -}; - -/** - * struct falcon_nic_data - Falcon NIC state - * @pci_dev2: Secondary function of Falcon A - * @board: Board state and functions - * @stats: Hardware statistics - * @stats_disable_count: Nest count for disabling statistics fetches - * @stats_pending: Is there a pending DMA of MAC statistics. - * @stats_timer: A timer for regularly fetching MAC statistics. - * @spi_flash: SPI flash device - * @spi_eeprom: SPI EEPROM device - * @spi_lock: SPI bus lock - * @mdio_lock: MDIO bus lock - * @xmac_poll_required: XMAC link state needs polling - */ -struct falcon_nic_data { - struct pci_dev *pci_dev2; - struct falcon_board board; - u64 stats[FALCON_STAT_COUNT]; - unsigned int stats_disable_count; - bool stats_pending; - struct timer_list stats_timer; - struct falcon_spi_device spi_flash; - struct falcon_spi_device spi_eeprom; - struct mutex spi_lock; - struct mutex mdio_lock; - bool xmac_poll_required; -}; - -static inline struct falcon_board *falcon_board(struct efx_nic *efx) -{ - struct falcon_nic_data *data = efx->nic_data; - return &data->board; -} - enum { SIENA_STAT_tx_bytes = GENERIC_STAT_COUNT, SIENA_STAT_tx_good_bytes, |