Skip to content

Commit 65b342f

Browse files
committed
Merge branch 'Aquantia-atlantic-driver-new-devices-support'
Igor Russkikh says: ==================== Aquantia atlantic driver new devices support This patchset introduces a support for new Aquantia hardware: AQC11x family with updated hardware (B1) and firmware (2.x and 3.x branches). For that, a number of improvements in overall driver model were done: - Firmware specific ops tables. Firmware 2.x and 3.x series support functions are now in separate fw2x module. - PCI module cleanup and simplification done. - Verified and tested hardware reset process. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents f9b6ae2 + 6de97c0 commit 65b342f

21 files changed

+1019
-773
lines changed

drivers/net/ethernet/aquantia/atlantic/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ atlantic-objs := aq_main.o \
3939
hw_atl/hw_atl_a0.o \
4040
hw_atl/hw_atl_b0.o \
4141
hw_atl/hw_atl_utils.o \
42+
hw_atl/hw_atl_utils_fw2x.o \
4243
hw_atl/hw_atl_llh.o

drivers/net/ethernet/aquantia/atlantic/aq_cfg.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,13 @@
6565

6666
/*#define AQ_CFG_MAC_ADDR_PERMANENT {0x30, 0x0E, 0xE3, 0x12, 0x34, 0x56}*/
6767

68-
#define AQ_CFG_FC_MODE 3U
68+
#define AQ_NIC_FC_OFF 0U
69+
#define AQ_NIC_FC_TX 1U
70+
#define AQ_NIC_FC_RX 2U
71+
#define AQ_NIC_FC_FULL 3U
72+
#define AQ_NIC_FC_AUTO 4U
73+
74+
#define AQ_CFG_FC_MODE AQ_NIC_FC_FULL
6975

7076
#define AQ_CFG_SPEED_MSK 0xFFFFU /* 0xFFFFU==auto_neg */
7177

drivers/net/ethernet/aquantia/atlantic/aq_common.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,42 @@
1919
#include "aq_cfg.h"
2020
#include "aq_utils.h"
2121

22+
#define PCI_VENDOR_ID_AQUANTIA 0x1D6A
23+
24+
#define AQ_DEVICE_ID_0001 0x0001
25+
#define AQ_DEVICE_ID_D100 0xD100
26+
#define AQ_DEVICE_ID_D107 0xD107
27+
#define AQ_DEVICE_ID_D108 0xD108
28+
#define AQ_DEVICE_ID_D109 0xD109
29+
30+
#define AQ_DEVICE_ID_AQC100 0x00B1
31+
#define AQ_DEVICE_ID_AQC107 0x07B1
32+
#define AQ_DEVICE_ID_AQC108 0x08B1
33+
#define AQ_DEVICE_ID_AQC109 0x09B1
34+
#define AQ_DEVICE_ID_AQC111 0x11B1
35+
#define AQ_DEVICE_ID_AQC112 0x12B1
36+
37+
#define AQ_DEVICE_ID_AQC100S 0x80B1
38+
#define AQ_DEVICE_ID_AQC107S 0x87B1
39+
#define AQ_DEVICE_ID_AQC108S 0x88B1
40+
#define AQ_DEVICE_ID_AQC109S 0x89B1
41+
#define AQ_DEVICE_ID_AQC111S 0x91B1
42+
#define AQ_DEVICE_ID_AQC112S 0x92B1
43+
44+
#define AQ_DEVICE_ID_AQC111E 0x51B1
45+
#define AQ_DEVICE_ID_AQC112E 0x52B1
46+
47+
#define HW_ATL_NIC_NAME "aQuantia AQtion 10Gbit Network Adapter"
48+
49+
#define AQ_HWREV_ANY 0
50+
#define AQ_HWREV_1 1
51+
#define AQ_HWREV_2 2
52+
53+
#define AQ_NIC_RATE_10G BIT(0)
54+
#define AQ_NIC_RATE_5G BIT(1)
55+
#define AQ_NIC_RATE_5GSR BIT(2)
56+
#define AQ_NIC_RATE_2GS BIT(3)
57+
#define AQ_NIC_RATE_1G BIT(4)
58+
#define AQ_NIC_RATE_100M BIT(5)
59+
2260
#endif /* AQ_COMMON_H */

drivers/net/ethernet/aquantia/atlantic/aq_hw.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ struct aq_hw_caps_s {
2323
u64 hw_features;
2424
u64 link_speed_msk;
2525
unsigned int hw_priv_flags;
26+
u32 media_type;
2627
u32 rxds;
2728
u32 txds;
2829
u32 txhwb_alignment;
2930
u32 irq_mask;
3031
u32 vecs;
3132
u32 mtu;
3233
u32 mac_regs_count;
33-
u8 ports;
34+
u32 hw_alive_check_addr;
3435
u8 msix_irqs;
3536
u8 tcs;
3637
u8 rxd_alignment;
@@ -41,7 +42,6 @@ struct aq_hw_caps_s {
4142
u8 rx_rings;
4243
bool flow_control;
4344
bool is_64_dma;
44-
u32 fw_ver_expected;
4545
};
4646

4747
struct aq_hw_link_status_s {
@@ -95,12 +95,15 @@ struct aq_stats_s {
9595
#define AQ_NIC_FLAGS_IS_NOT_TX_READY (AQ_NIC_FLAGS_IS_NOT_READY | \
9696
AQ_NIC_LINK_DOWN)
9797

98+
#define AQ_HW_MEDIA_TYPE_TP 1U
99+
#define AQ_HW_MEDIA_TYPE_FIBRE 2U
100+
98101
struct aq_hw_s {
99102
atomic_t flags;
103+
u8 rbl_enabled:1;
100104
struct aq_nic_cfg_s *aq_nic_cfg;
101-
struct aq_pci_func_s *aq_pci_func;
105+
const struct aq_fw_ops *aq_fw_ops;
102106
void __iomem *mmio;
103-
unsigned int not_ff_addr;
104107
struct aq_hw_link_status_s aq_link_status;
105108
struct hw_aq_atl_utils_mbox mbox;
106109
struct hw_atl_stats_s last_stats;
@@ -119,19 +122,9 @@ struct aq_hw_s {
119122

120123
struct aq_ring_s;
121124
struct aq_ring_param_s;
122-
struct aq_nic_cfg_s;
123125
struct sk_buff;
124126

125127
struct aq_hw_ops {
126-
struct aq_hw_s *(*create)(struct aq_pci_func_s *aq_pci_func,
127-
unsigned int port);
128-
129-
void (*destroy)(struct aq_hw_s *self);
130-
131-
int (*get_hw_caps)(struct aq_hw_s *self,
132-
struct aq_hw_caps_s *aq_hw_caps,
133-
unsigned short device,
134-
unsigned short subsystem_device);
135128

136129
int (*hw_ring_tx_xmit)(struct aq_hw_s *self, struct aq_ring_s *aq_ring,
137130
unsigned int frags);
@@ -145,15 +138,8 @@ struct aq_hw_ops {
145138
int (*hw_ring_tx_head_update)(struct aq_hw_s *self,
146139
struct aq_ring_s *aq_ring);
147140

148-
int (*hw_get_mac_permanent)(struct aq_hw_s *self,
149-
u8 *mac);
150-
151141
int (*hw_set_mac_address)(struct aq_hw_s *self, u8 *mac_addr);
152142

153-
int (*hw_get_link_status)(struct aq_hw_s *self);
154-
155-
int (*hw_set_link_speed)(struct aq_hw_s *self, u32 speed);
156-
157143
int (*hw_reset)(struct aq_hw_s *self);
158144

159145
int (*hw_init)(struct aq_hw_s *self, u8 *mac_addr);
@@ -207,8 +193,6 @@ struct aq_hw_ops {
207193
const struct aq_hw_caps_s *aq_hw_caps,
208194
u32 *regs_buff);
209195

210-
int (*hw_update_stats)(struct aq_hw_s *self);
211-
212196
struct aq_stats_s *(*hw_get_hw_stats)(struct aq_hw_s *self);
213197

214198
int (*hw_get_fw_version)(struct aq_hw_s *self, u32 *fw_version);
@@ -218,4 +202,20 @@ struct aq_hw_ops {
218202
int (*hw_set_power)(struct aq_hw_s *self, unsigned int power_state);
219203
};
220204

205+
struct aq_fw_ops {
206+
int (*init)(struct aq_hw_s *self);
207+
208+
int (*reset)(struct aq_hw_s *self);
209+
210+
int (*get_mac_permanent)(struct aq_hw_s *self, u8 *mac);
211+
212+
int (*set_link_speed)(struct aq_hw_s *self, u32 speed);
213+
214+
int (*set_state)(struct aq_hw_s *self, enum hal_atl_utils_fw_state_e state);
215+
216+
int (*update_link_status)(struct aq_hw_s *self);
217+
218+
int (*update_stats)(struct aq_hw_s *self);
219+
};
220+
221221
#endif /* AQ_HW_H */

drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "aq_hw_utils.h"
1515
#include "aq_hw.h"
16+
#include "aq_nic.h"
1617

1718
void aq_hw_write_reg_bit(struct aq_hw_s *aq_hw, u32 addr, u32 msk,
1819
u32 shift, u32 val)
@@ -39,7 +40,9 @@ u32 aq_hw_read_reg(struct aq_hw_s *hw, u32 reg)
3940
{
4041
u32 value = readl(hw->mmio + reg);
4142

42-
if ((~0U) == value && (~0U) == readl(hw->mmio + hw->not_ff_addr))
43+
if ((~0U) == value &&
44+
(~0U) == readl(hw->mmio +
45+
hw->aq_nic_cfg->aq_hw_caps->hw_alive_check_addr))
4346
aq_utils_obj_set(&hw->flags, AQ_HW_FLAG_ERR_UNPLUG);
4447

4548
return value;

drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ do { \
3535
} \
3636
} while (0)
3737

38+
#define aq_pr_err(...) pr_err(AQ_CFG_DRV_NAME ": " __VA_ARGS__)
39+
#define aq_pr_trace(...) pr_info(AQ_CFG_DRV_NAME ": " __VA_ARGS__)
40+
3841
struct aq_hw_s;
3942

4043
void aq_hw_write_reg_bit(struct aq_hw_s *aq_hw, u32 addr, u32 msk,

drivers/net/ethernet/aquantia/atlantic/aq_main.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,9 @@ struct net_device *aq_ndev_alloc(void)
4343

4444
static int aq_ndev_open(struct net_device *ndev)
4545
{
46-
struct aq_nic_s *aq_nic = NULL;
4746
int err = 0;
47+
struct aq_nic_s *aq_nic = netdev_priv(ndev);
4848

49-
aq_nic = aq_nic_alloc_hot(ndev);
50-
if (!aq_nic) {
51-
err = -ENOMEM;
52-
goto err_exit;
53-
}
5449
err = aq_nic_init(aq_nic);
5550
if (err < 0)
5651
goto err_exit;
@@ -73,7 +68,6 @@ static int aq_ndev_close(struct net_device *ndev)
7368
if (err < 0)
7469
goto err_exit;
7570
aq_nic_deinit(aq_nic);
76-
aq_nic_free_hot_resources(aq_nic);
7771

7872
err_exit:
7973
return err;
@@ -145,15 +139,13 @@ static void aq_ndev_set_multicast_settings(struct net_device *ndev)
145139

146140
err = aq_nic_set_packet_filter(aq_nic, ndev->flags);
147141
if (err < 0)
148-
goto err_exit;
142+
return;
149143

150144
if (netdev_mc_count(ndev)) {
151145
err = aq_nic_set_multicast_list(aq_nic, ndev);
152146
if (err < 0)
153-
goto err_exit;
147+
return;
154148
}
155-
156-
err_exit:;
157149
}
158150

159151
static const struct net_device_ops aq_ndev_ops = {

0 commit comments

Comments
 (0)