Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF9C3C43381 for ; Sun, 24 Mar 2019 01:04:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6CEA6217D8 for ; Sun, 24 Mar 2019 01:04:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bG79l5Wo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727808AbfCXBEz (ORCPT ); Sat, 23 Mar 2019 21:04:55 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:35422 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727625AbfCXBEz (ORCPT ); Sat, 23 Mar 2019 21:04:55 -0400 Received: by mail-pg1-f193.google.com with SMTP id g8so4006240pgf.2 for ; Sat, 23 Mar 2019 18:04:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=QVoPhqkKGpPvFeORseLtTEa1mNyfMFfrviUmV+i707s=; b=bG79l5WoH34bIxjH/YuziHk2tam72TdmakP8dTVQ1gh+bR9KACrbfyGYSFUuVCiX7m DulHK5iimCJn6imf0lnjaAn8nMzv5nMX/FWopKQSQZcYz+1rmhF6bgdh1obUvWh0ylPx beiLt0sQbz0arcwZBgHt4wGJGJmED3cT+x3Jh+759RrUj8o/woo1yiAE1kPgDUInheu2 0NDDw8W1s4XeFPPGN6NPk/Kbt6a3pR4B29cXMj9Rwj02oB6VgNdFQuEDVRdbGL8JGhAH zWmOx77Boe0iSwGJIByHyR4NCU5oPGXMExqBQvmADhxY0sozkNmnGUF1QxFWmRgimDRx MMkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=QVoPhqkKGpPvFeORseLtTEa1mNyfMFfrviUmV+i707s=; b=NkAjCX+3KZo2WAg3Csz5yiqSuj+CGq8DmKK5Pwlk+WOX05YZdBy6ol39dhPdc6SLKF VWBHm+u7BTogbM0GHSUaYzMVlmgfeZ6J+O4AhdIxLPb6MuY8dF6vEM5mchNSfH1K4G2T HCUERsRxNhTv+T9VUk0evePrNy/0pQ6KbyK2+wkad804DlejCTTwfZ/dP/PrZs3aJ0BA sHEZlgnMFVof/H1N4C0uLFhKbMFvAbEYn3pFvC3qIqdgeXK50swc2KKIVINESYVsOf+t JsvUSip+jIEdR/h/xeP7dFIu8ljTa0XmRtK+wKR6M83dS/y3W3sItAdQ7ROBcn+3nxDA ZSIQ== X-Gm-Message-State: APjAAAWjBsQt6F/YQ4xeNAHwoBTvJjiOhkFzlU88mNCv1bri4Sgf0/OJ inIRNm12S/EAHG8tjyr2ptkptMoA X-Google-Smtp-Source: APXvYqyml7bKDON+YdppcbQSMrbq85ML7XOijicudTAJxk3/LghmANxz/rPfM0IBGOEfQbxM5d98ZA== X-Received: by 2002:a65:6210:: with SMTP id d16mr16570335pgv.189.1553389494184; Sat, 23 Mar 2019 18:04:54 -0700 (PDT) Received: from [192.168.1.3] (ip68-101-123-102.oc.oc.cox.net. [68.101.123.102]) by smtp.gmail.com with ESMTPSA id z15sm14827202pgc.25.2019.03.23.18.04.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Mar 2019 18:04:53 -0700 (PDT) Subject: Re: [PATCH net-next 2/3] net: phy: aquantia: report PHY details like firmware version To: Heiner Kallweit , Andrew Lunn , David Miller Cc: "netdev@vger.kernel.org" References: <0e35a866-e3a5-6d49-2353-008f14ed6ff4@gmail.com> From: Florian Fainelli Openpgp: preference=signencrypt Message-ID: <6298a8d9-8571-6c1f-5069-f37efae0cd51@gmail.com> Date: Sat, 23 Mar 2019 18:04:50 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 3/23/2019 6:15 AM, Heiner Kallweit wrote: > Add reporting firmware details. These details are available only once > the firmware has finished initializing the chip. This can take some > time and we need to poll for init completion. > > Signed-off-by: Heiner Kallweit > --- [snip] > > +/* If we configure settings whilst firmware is still initializing the chip, > + * then these settings may be overwritten. Therefore make sure chip > + * initialization has completed. Use presence of the firmware ID as > + * indicator for initialization having completed. > + * The chip also provides a "reset completed" bit, but it's cleared after > + * read. Therefore function would time out if called again. > + */ Is there a way to say, run a checksum calculation on the firmware image to assess its health/validity as well as read the firmware ID? What happens if the PHY is not provisioned with a firmware image? Is it expecting for a specific set of MDIO vendor commands to load it over MDIO? > +static void aqr107_wait_reset_complete(struct phy_device *phydev) > +{ > + int val, retries = 100; > + > + do { > + val = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_FW_ID); > + if (val < 0) > + return; > + msleep(20); > + } while (!val && --retries); Should not this return 0/-ETIMEDOUT and have the caller propagate that error code? -- Florian