162306a36Sopenharmony_ci/* Broadcom NetXtreme-C/E network driver.
262306a36Sopenharmony_ci *
362306a36Sopenharmony_ci * Copyright (c) 2014-2016 Broadcom Corporation
462306a36Sopenharmony_ci * Copyright (c) 2016-2017 Broadcom Limited
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * This program is free software; you can redistribute it and/or modify
762306a36Sopenharmony_ci * it under the terms of the GNU General Public License as published by
862306a36Sopenharmony_ci * the Free Software Foundation.
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#ifndef BNXT_ETHTOOL_H
1262306a36Sopenharmony_ci#define BNXT_ETHTOOL_H
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_cistruct bnxt_led_cfg {
1562306a36Sopenharmony_ci	u8 led_id;
1662306a36Sopenharmony_ci	u8 led_state;
1762306a36Sopenharmony_ci	u8 led_color;
1862306a36Sopenharmony_ci	u8 unused;
1962306a36Sopenharmony_ci	__le16 led_blink_on;
2062306a36Sopenharmony_ci	__le16 led_blink_off;
2162306a36Sopenharmony_ci	u8 led_group_id;
2262306a36Sopenharmony_ci	u8 rsvd;
2362306a36Sopenharmony_ci};
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#define BNXT_LED_DFLT_ENA				\
2662306a36Sopenharmony_ci	(PORT_LED_CFG_REQ_ENABLES_LED0_ID |		\
2762306a36Sopenharmony_ci	 PORT_LED_CFG_REQ_ENABLES_LED0_STATE |		\
2862306a36Sopenharmony_ci	 PORT_LED_CFG_REQ_ENABLES_LED0_BLINK_ON |	\
2962306a36Sopenharmony_ci	 PORT_LED_CFG_REQ_ENABLES_LED0_BLINK_OFF |	\
3062306a36Sopenharmony_ci	 PORT_LED_CFG_REQ_ENABLES_LED0_GROUP_ID)
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#define BNXT_LED_DFLT_ENA_SHIFT	6
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define BNXT_LED_DFLT_ENABLES(x)			\
3562306a36Sopenharmony_ci	cpu_to_le32(BNXT_LED_DFLT_ENA << (BNXT_LED_DFLT_ENA_SHIFT * (x)))
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci#define BNXT_FW_RESET_AP	(ETH_RESET_AP << ETH_RESET_SHARED_SHIFT)
3862306a36Sopenharmony_ci#define BNXT_FW_RESET_CHIP	((ETH_RESET_MGMT | ETH_RESET_IRQ |	\
3962306a36Sopenharmony_ci				  ETH_RESET_DMA | ETH_RESET_FILTER |	\
4062306a36Sopenharmony_ci				  ETH_RESET_OFFLOAD | ETH_RESET_MAC |	\
4162306a36Sopenharmony_ci				  ETH_RESET_PHY | ETH_RESET_RAM)	\
4262306a36Sopenharmony_ci				 << ETH_RESET_SHARED_SHIFT)
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#define BNXT_PXP_REG_LEN	0x3110
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ciextern const struct ethtool_ops bnxt_ethtool_ops;
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ciu32 bnxt_get_rxfh_indir_size(struct net_device *dev);
4962306a36Sopenharmony_ciu32 _bnxt_fw_to_ethtool_adv_spds(u16, u8);
5062306a36Sopenharmony_ciu32 bnxt_fw_to_ethtool_speed(u16);
5162306a36Sopenharmony_ciu16 bnxt_get_fw_auto_link_speeds(u32);
5262306a36Sopenharmony_ciint bnxt_hwrm_nvm_get_dev_info(struct bnxt *bp,
5362306a36Sopenharmony_ci			       struct hwrm_nvm_get_dev_info_output *nvm_dev_info);
5462306a36Sopenharmony_ciint bnxt_hwrm_firmware_reset(struct net_device *dev, u8 proc_type,
5562306a36Sopenharmony_ci			     u8 self_reset, u8 flags);
5662306a36Sopenharmony_ciint bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware *fw,
5762306a36Sopenharmony_ci				   u32 install_type, struct netlink_ext_ack *extack);
5862306a36Sopenharmony_ciint bnxt_get_pkginfo(struct net_device *dev, char *ver, int size);
5962306a36Sopenharmony_civoid bnxt_ethtool_init(struct bnxt *bp);
6062306a36Sopenharmony_civoid bnxt_ethtool_free(struct bnxt *bp);
6162306a36Sopenharmony_ciint bnxt_find_nvram_item(struct net_device *dev, u16 type, u16 ordinal,
6262306a36Sopenharmony_ci			 u16 ext, u16 *index, u32 *item_length,
6362306a36Sopenharmony_ci			 u32 *data_length);
6462306a36Sopenharmony_ciint bnxt_find_nvram_item(struct net_device *dev, u16 type, u16 ordinal,
6562306a36Sopenharmony_ci			 u16 ext, u16 *index, u32 *item_length,
6662306a36Sopenharmony_ci			 u32 *data_length);
6762306a36Sopenharmony_ciint bnxt_flash_nvram(struct net_device *dev, u16 dir_type,
6862306a36Sopenharmony_ci		     u16 dir_ordinal, u16 dir_ext, u16 dir_attr,
6962306a36Sopenharmony_ci		     u32 dir_item_len, const u8 *data,
7062306a36Sopenharmony_ci		     size_t data_len);
7162306a36Sopenharmony_ciint bnxt_get_nvram_item(struct net_device *dev, u32 index, u32 offset,
7262306a36Sopenharmony_ci			u32 length, u8 *data);
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci#endif
75