From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E7133EB64DD for ; Thu, 13 Jul 2023 13:17:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id A21FA61375; Thu, 13 Jul 2023 13:17:45 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org A21FA61375 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1689254265; bh=qiRMcyUybp/kqW6zLYK2PetzAKrhUtz15tE4/PR8zh8=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=n5GSuL/1/EtOFvOFEbkG4N84t6FzmNnerNfsG+ZczzW0P7N/eYOnwNTT1Mm95Sqc7 DSm7tYilMAfok/8r7G40E0LJdu+wKd4+Qq63bcRJc1c6i7exAllF0PPOM1Gw/m+WdE iHS/BYO8M/ewNAwIJlQuB8xERTzxMGxp+nQFnXLCoKTSSoA/vZ4K6x9jKTdkfyYN7C dRNbN9usHwdVUOx5RY1x7TE7fb9u7HKfzUCxH6i+dK7UL1Yha9V5kmZcaiXpon1sHl IDAo/ejbY0QIo6Zki9M5KyVyrC8Uuzz1+uDNm4EtQa23pk+ctHZdP8HiM9Cd6LPzXH UKaINq0ZIG4fg== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FAlRdVbjbK-b; Thu, 13 Jul 2023 13:17:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id B65EE61398; Thu, 13 Jul 2023 13:17:44 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org B65EE61398 Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 03FC01BF3E1 for ; Thu, 13 Jul 2023 13:17:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id CECAD400D7 for ; Thu, 13 Jul 2023 13:17:37 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org CECAD400D7 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9OA-RYexUlnm for ; Thu, 13 Jul 2023 13:17:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 1B15041718 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by smtp2.osuosl.org (Postfix) with ESMTPS id 1B15041718 for ; Thu, 13 Jul 2023 13:17:37 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="344776806" X-IronPort-AV: E=Sophos;i="6.01,202,1684825200"; d="scan'208";a="344776806" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2023 06:17:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="751629439" X-IronPort-AV: E=Sophos;i="6.01,202,1684825200"; d="scan'208";a="751629439" Received: from s240.igk.intel.com (HELO DevelopmentVM.nql.local) ([10.102.18.202]) by orsmga008.jf.intel.com with ESMTP; 13 Jul 2023 06:17:35 -0700 From: Jan Sokolowski To: intel-wired-lan@lists.osuosl.org Date: Thu, 13 Jul 2023 15:21:24 +0200 Message-Id: <20230713132124.1514647-2-jan.sokolowski@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230713132124.1514647-1-jan.sokolowski@intel.com> References: <20230713132124.1514647-1-jan.sokolowski@intel.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689254257; x=1720790257; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eXTUE+Nn2HAN/bxcUZfAEff9x6NwB3djtoAV3Uze7zM=; b=KZLBAzlXFQONOr8I7E5mzoIcExdHa8hdlsomVpH6WzNmbFoa5EVejUOF 67Spw/4fe9ejNPwaM6/iTrWT8Sm2T8d8Px5rHnZIQUIEMTu02B2FQ8N5f HaMFDJBkCJNewj9sGy3S3Qk60viqq33oZWM62ecSQqTorWVOgx7c6J3LF uwtCTMRzuozLXH+gMjEAsqszBtKSPeL2HMe5jwYKCaKnKbYNrWyfNR1us irpDsjcWZu/nz930qRAuJb7ctllKa7ksXfajlYadkX+tyjn+PnIuJ/kps B75SOvWopBNTzl+J2SCyElAJZvdWPmIZPoCo3lbGwuVNyu99FbX9H9AvP A==; X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=KZLBAzlX Subject: [Intel-wired-lan] [PATCH iwl-next v2 2/2] ice: add FW load wait X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Przemek Kitszel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" As some cards load FW from external sources, we have to wait to be sure that FW is ready before setting link up. Add check and wait for FW readiness Signed-off-by: Jan Sokolowski Reviewed-by: Przemek Kitszel --- v2: Applied hints received on v1 review on IWL. --- .../net/ethernet/intel/ice/ice_hw_autogen.h | 2 + drivers/net/ethernet/intel/ice/ice_main.c | 37 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h index 20f40dfeb761..531cc2194741 100644 --- a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h +++ b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h @@ -335,6 +335,8 @@ #define VP_MDET_TX_TCLAN_VALID_M BIT(0) #define VP_MDET_TX_TDPU(_VF) (0x00040000 + ((_VF) * 4)) #define VP_MDET_TX_TDPU_VALID_M BIT(0) +#define GL_MNG_FWSM 0x000B6134 +#define GL_MNG_FWSM_FW_LOADING_M BIT(30) #define GLNVM_FLA 0x000B6108 #define GLNVM_FLA_LOCKED_M BIT(6) #define GLNVM_GENS 0x000B6100 diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index e3245ee635b2..674e78ff708d 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -4561,6 +4561,31 @@ static void ice_deinit_eth(struct ice_pf *pf) ice_decfg_netdev(vsi); } +/** + * ice_wait_for_fw - wait for full FW readiness + * @hw: pointer to the hardware structure + * @timeout: milliseconds that can elapse before timing out + */ +static int ice_wait_for_fw(struct ice_hw *hw, u32 timeout) +{ + int fw_loading; + u32 elapsed = 0; + + while (elapsed <= timeout) { + fw_loading = rd32(hw, GL_MNG_FWSM) & GL_MNG_FWSM_FW_LOADING_M; + + /* firmware was not yet loaded, we have to wait more */ + if (fw_loading) { + elapsed += 100; + msleep(100); + continue; + } + return 0; + } + + return -ETIMEDOUT; +} + static int ice_init_dev(struct ice_pf *pf) { struct device *dev = ice_pf_to_dev(pf); @@ -4573,6 +4598,18 @@ static int ice_init_dev(struct ice_pf *pf) return err; } + /* Some cards require longer initialization times + * due to necessity of loading FW from an external source. + * This can take even half a minute. + */ + if (ice_is_pf_c827(hw)) { + err = ice_wait_for_fw(hw, 30000); + if (err) { + dev_err(dev, "ice_wait_for_fw timed out"); + return err; + } + } + ice_init_feature_support(pf); ice_request_fw(pf); -- 2.31.1 _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan