netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Igor Russkikh <irusskikh@marvell.com>
To: <netdev@vger.kernel.org>
Cc: "David S . Miller" <davem@davemloft.net>,
	Mark Starovoytov <mstarovoitov@marvell.com>,
	Dmitry Bezrukov <dbezrukov@marvell.com>,
	"Igor Russkikh" <irusskikh@marvell.com>
Subject: [PATCH net-next 04/17] net: atlantic: add hw_soft_reset, hw_prepare to hw_ops
Date: Fri, 24 Apr 2020 10:27:16 +0300	[thread overview]
Message-ID: <20200424072729.953-5-irusskikh@marvell.com> (raw)
In-Reply-To: <20200424072729.953-1-irusskikh@marvell.com>

From: Mark Starovoytov <mstarovoitov@marvell.com>

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: Igor Russkikh <irusskikh@marvell.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_hw.h   |  5 +++++
 drivers/net/ethernet/aquantia/atlantic/aq_nic.c  | 16 +++++++++++++++-
 .../aquantia/atlantic/hw_atl/hw_atl_a0.c         |  2 ++
 .../aquantia/atlantic/hw_atl/hw_atl_b0.c         |  2 ++
 .../aquantia/atlantic/hw_atl/hw_atl_utils.c      |  4 ----
 5 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
index 7d71bc7dc500..84abce29d590 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
@@ -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);
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index 80dd744dcbd1..7f4d8abab951 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -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;
 
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
index 9b1062b8af64..2dba8c277ecb 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
@@ -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,
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
index d20d91cdece8..4e2e4eef028d 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
@@ -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,
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
index 354705f9bc49..7259bcb81e9b 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
@@ -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);
 
-- 
2.17.1


  parent reply	other threads:[~2020-04-24  7:27 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24  7:27 [PATCH net-next 00/17] net: atlantic: A2 support Igor Russkikh
2020-04-24  7:27 ` [PATCH net-next 01/17] net: atlantic: update company name in the driver description Igor Russkikh
2020-04-24  7:27 ` [PATCH net-next 02/17] net: atlantic: add A2 device IDs Igor Russkikh
2020-04-24  7:27 ` [PATCH net-next 03/17] net: atlantic: add defines for 10M and EEE 100M link mode Igor Russkikh
2020-04-24  7:27 ` Igor Russkikh [this message]
2020-04-24  7:27 ` [PATCH net-next 05/17] net: atlantic: simplify hw_get_fw_version() usage Igor Russkikh
2020-04-24  7:27 ` [PATCH net-next 06/17] net: atlantic: make hw_get_regs optional Igor Russkikh
2020-04-24  7:27 ` [PATCH net-next 07/17] net: atlantic: move IS_CHIP_FEATURE to aq_hw.h Igor Russkikh
2020-04-24  7:27 ` [PATCH net-next 08/17] net: atlantic: A2 driver-firmware interface Igor Russkikh
2020-04-25  0:44   ` Jakub Kicinski
2020-04-25  1:25     ` David Miller
2020-04-26  8:50       ` [EXT] " Igor Russkikh
2020-04-27  1:05         ` David Miller
2020-04-27 15:38           ` Igor Russkikh
2020-04-27 19:03             ` Jakub Kicinski
2020-04-27 20:04               ` Igor Russkikh
2020-04-27 20:20                 ` David Miller
2020-04-28  8:58                   ` Igor Russkikh
2020-04-24  7:27 ` [PATCH net-next 09/17] net: atlantic: minimal A2 HW bindings required for fw_ops Igor Russkikh
2020-04-24  7:27 ` [PATCH net-next 10/17] net: atlantic: minimal A2 fw_ops Igor Russkikh
2020-04-24  7:27 ` [PATCH net-next 11/17] net: atlantic: A2 hw_ops skeleton Igor Russkikh
2020-04-24  7:27 ` [PATCH net-next 12/17] net: atlantic: HW bindings for A2 RFP Igor Russkikh
2020-04-24  7:27 ` [PATCH net-next 13/17] net: atlantic: add A2 RPF hw_ops Igor Russkikh
2020-04-24  7:27 ` [PATCH net-next 14/17] net: atlantic: HW bindings for basic A2 init/deinit hw_ops Igor Russkikh
2020-04-24  7:27 ` [PATCH net-next 15/17] net: atlantic: common functions needed " Igor Russkikh
2020-04-24  7:27 ` [PATCH net-next 16/17] net: atlantic: " Igor Russkikh
2020-04-25  0:48   ` Jakub Kicinski
2020-04-24  7:27 ` [PATCH net-next 17/17] net: atlantic: A2 ingress / egress hw configuration Igor Russkikh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200424072729.953-5-irusskikh@marvell.com \
    --to=irusskikh@marvell.com \
    --cc=davem@davemloft.net \
    --cc=dbezrukov@marvell.com \
    --cc=mstarovoitov@marvell.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).