From patchwork Wed Jul 6 11:11:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1652939 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=TRK/VZhg; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LdH1b3HJCz9s1l for ; Wed, 6 Jul 2022 21:12:03 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1o92wh-0004g5-Sq; Wed, 06 Jul 2022 11:11:51 +0000 Received: from mail-pf1-f178.google.com ([209.85.210.178]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1o92wf-0004Zt-JX for kernel-team@lists.ubuntu.com; Wed, 06 Jul 2022 11:11:49 +0000 Received: by mail-pf1-f178.google.com with SMTP id l124so3689625pfl.8 for ; Wed, 06 Jul 2022 04:11:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=h0cFcvgayvgrr0w2DejHCDdF8xdscM8crDEg5vNcxqc=; b=TRK/VZhgh9KaF7T6nlqJ8WNKMPZ7ItDHNTFHtGS0m3CDJ2IkOL9DAEoZ/BWViJIsb+ hOHT2uJosG40XnOuAYbLcV4r3vzziakWNmKT0Fa/MEY3hc4SQIztFGWxig6IKrh6cx/R A861Surwo0JhD99nzLy7i9umSc/IMKJHsQeV3jNjNCfB//JXPky8EjY6w7mPVhdjveJE tSuzuCTSVIXOCgEfTyqwyl6o6OgRx+qPV6kbZ9MO5dNC9Vg5dTAM3CdQf8Axamn50lFr 2GKHmKFE3YnRyqKt9wrwUl51Y5HI1dra3nuaSE2AhLW48rt2J4QXSAVPdkXoQqqdNLBQ zpSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=h0cFcvgayvgrr0w2DejHCDdF8xdscM8crDEg5vNcxqc=; b=CycHYedH9e3/3EJV9Nbp3ssWno+jnVpku9hWYlIpoGGurlZFrSVLL24QZJHqOpE9K6 gIv1cFd66t4N6dUKJu2cQW0Ccc0VmK+HHXQRegtpj/vCRVQLRNmZZJwJoRpAgVD4q+mh AfPT2E/G8lFXXlapTrHKcYqNGL2Bfogl7fbHlvHFDWHbYdV6XVdcEpG8BKZhK35QC5L1 E9QduZPePc9CaWBx0goLKNmHTXTLpZ0XfsXgSyMPXzx3vak3qIVlaTkn67SbFZiNV6KR H7M3Bc+g/FRCi3YaxiTKTHl3ppRJ9Sgu7NiJHakSfPYsmPyKChDublQJeld4gUhWkpiM omFA== X-Gm-Message-State: AJIora/jB12hQxsHqShYiVV2143BRoYGONwGjDrQMuwFhvcq5fQ5Tl4O kE7SOeyFqgkg4INxFqbW3oJcS0DP+PA= X-Google-Smtp-Source: AGRyM1s6C6xUHa67BGAQycSWCbUEm7Y/QiWNU/OW8uh7LIdOqcrZQleEl78JaLQORcV32QK/884UHw== X-Received: by 2002:a63:8542:0:b0:412:9086:c546 with SMTP id u63-20020a638542000000b004129086c546mr4240920pgd.491.1657105906814; Wed, 06 Jul 2022 04:11:46 -0700 (PDT) Received: from localhost (220-135-95-34.hinet-ip.hinet.net. [220.135.95.34]) by smtp.gmail.com with ESMTPSA id t18-20020a17090aba9200b001efb45d6209sm1274586pjr.20.2022.07.06.04.11.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 04:11:46 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 06/20][SRU][Jammy] net: atlantic: add hw_soft_reset, hw_prepare to hw_ops Date: Wed, 6 Jul 2022 19:11:14 +0800 Message-Id: <20220706111128.820340-7-acelan.kao@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220706111128.820340-1-acelan.kao@canonical.com> References: <20220706111128.820340-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.210.178; envelope-from=acelan@gmail.com; helo=mail-pf1-f178.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Mark Starovoytov BugLink: https://bugs.launchpad.net/bugs/1980371 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 Co-developed-by: Dmitry Bezrukov Signed-off-by: Dmitry Bezrukov Signed-off-by: David S. Miller (cherry picked from commit 099d074e3f0cd3f48e57e3349b9f8a25b0e3feb8) Signed-off-by: Chia-Lin Kao (AceLan) --- 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 b639fb953f119..5e7300c0b4838 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h +++ b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h @@ -159,6 +159,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 1cc1bfcac5172..59485b8196486 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c @@ -232,6 +232,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; @@ -241,7 +255,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 9a0db70c11438..0922988f2a8bb 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 @@ -877,6 +877,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 f36ad4431c61a..3e3266b9d3e0c 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 @@ -1142,6 +1142,8 @@ static int hw_atl_b0_hw_vlan_ctrl(struct aq_hw_s *self, 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 58d53272e770b..45445950fd1d7 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 @@ -62,10 +62,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);