net: atlantic: add hw_soft_reset, hw_prepare to hw_ops
authorMark Starovoytov <mstarovoitov@marvell.com>
Thu, 30 Apr 2020 08:04:32 +0000 (11:04 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 May 2020 22:37:57 +0000 (15:37 -0700)
A2 will have a different implementation of these 2 APIs, so
this patch moves them to hw_ops in preparation for A2.

Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Co-developed-by: Dmitry Bezrukov <dbezrukov@marvell.com>
Signed-off-by: Dmitry Bezrukov <dbezrukov@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/aquantia/atlantic/aq_hw.h
drivers/net/ethernet/aquantia/atlantic/aq_nic.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c

index 7d71bc7dc500c9190e15902520dbcccf37ae3f79..84abce29d5903c5190c1efe2845141f34ba2757c 100644 (file)
@@ -182,6 +182,11 @@ struct aq_hw_ops {
 
        int (*hw_set_mac_address)(struct aq_hw_s *self, u8 *mac_addr);
 
+       int (*hw_soft_reset)(struct aq_hw_s *self);
+
+       int (*hw_prepare)(struct aq_hw_s *self,
+                         const struct aq_fw_ops **fw_ops);
+
        int (*hw_reset)(struct aq_hw_s *self);
 
        int (*hw_init)(struct aq_hw_s *self, u8 *mac_addr);
index 80dd744dcbd1b0825d0d690cca38dc7bb0155f32..7f4d8abab951298483f5e2de9688fd1fcd54c1d5 100644 (file)
@@ -257,6 +257,20 @@ static void aq_nic_polling_timer_cb(struct timer_list *t)
                  AQ_CFG_POLLING_TIMER_INTERVAL);
 }
 
+static int aq_nic_hw_prepare(struct aq_nic_s *self)
+{
+       int err = 0;
+
+       err = self->aq_hw_ops->hw_soft_reset(self->aq_hw);
+       if (err)
+               goto exit;
+
+       err = self->aq_hw_ops->hw_prepare(self->aq_hw, &self->aq_fw_ops);
+
+exit:
+       return err;
+}
+
 int aq_nic_ndev_register(struct aq_nic_s *self)
 {
        int err = 0;
@@ -266,7 +280,7 @@ int aq_nic_ndev_register(struct aq_nic_s *self)
                goto err_exit;
        }
 
-       err = hw_atl_utils_initfw(self->aq_hw, &self->aq_fw_ops);
+       err = aq_nic_hw_prepare(self);
        if (err)
                goto err_exit;
 
index 9b1062b8af640534a4b23e026e8366e89533321a..2dba8c277ecb5a060f08408a8df0801549d51f2e 100644 (file)
@@ -886,6 +886,8 @@ static int hw_atl_a0_hw_ring_rx_stop(struct aq_hw_s *self,
 }
 
 const struct aq_hw_ops hw_atl_ops_a0 = {
+       .hw_soft_reset        = hw_atl_utils_soft_reset,
+       .hw_prepare           = hw_atl_utils_initfw,
        .hw_set_mac_address   = hw_atl_a0_hw_mac_addr_set,
        .hw_init              = hw_atl_a0_hw_init,
        .hw_reset             = hw_atl_a0_hw_reset,
index d20d91cdece861adeb0b45c44a69a8140cb048e4..4e2e4eef028d0c5993e109f9fbe58f1dd8a1e933 100644 (file)
@@ -1478,6 +1478,8 @@ static int hw_atl_b0_set_loopback(struct aq_hw_s *self, u32 mode, bool enable)
 }
 
 const struct aq_hw_ops hw_atl_ops_b0 = {
+       .hw_soft_reset        = hw_atl_utils_soft_reset,
+       .hw_prepare           = hw_atl_utils_initfw,
        .hw_set_mac_address   = hw_atl_b0_hw_mac_addr_set,
        .hw_init              = hw_atl_b0_hw_init,
        .hw_reset             = hw_atl_b0_hw_reset,
index 354705f9bc493afcbe9c63f28cc36f779eea4be5..7259bcb81e9bda947dfc55c9d9c2c44305dc9575 100644 (file)
@@ -67,10 +67,6 @@ int hw_atl_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops)
 {
        int err = 0;
 
-       err = hw_atl_utils_soft_reset(self);
-       if (err)
-               return err;
-
        hw_atl_utils_hw_chip_features_init(self,
                                           &self->chip_features);