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 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 CFD42C43381 for ; Sun, 24 Mar 2019 09:42:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C270222A9 for ; Sun, 24 Mar 2019 09:42:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LiZG9U1n" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728645AbfCXJmU (ORCPT ); Sun, 24 Mar 2019 05:42:20 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:35578 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726160AbfCXJmU (ORCPT ); Sun, 24 Mar 2019 05:42:20 -0400 Received: by mail-wm1-f65.google.com with SMTP id y197so6056404wmd.0 for ; Sun, 24 Mar 2019 02:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ZLl4iCKFD5+C5H71mCE9qDjzE4f0FudPOqkiYFDFJLY=; b=LiZG9U1n+aomajJhWe0uY2JUKSyD25Z1wY6J8i/qQR7GxXNikRfEXfGfKkyxMohyQo hyQy4p8SBrZPgIWp7wvmoInwB82ocrRY3DgYwKxn3hun4tGMjyqtEjb/biRhR0vsfByU CV32FkiFsguV310yN6NCxg1YbaLYjg4ZyqUUAkLbz+16YZTqART1XYn95RQzhXcDqj1J aZSroZLJhASMcbNjMPUieLrQhAtiBlkESoymCsMxMTTAp9XayUJnNWRiXybBkWabzr6E YqYhe67Fo5HEX2TeoVYJu8HV8TkoBCmQUEWpdWfWVVL/tmcL4ZjG3jGUjNW6T53sgR12 ml6w== 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:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ZLl4iCKFD5+C5H71mCE9qDjzE4f0FudPOqkiYFDFJLY=; b=TdfejYFbR3l9O9tbJUnUm+f1PBhL6Zv/5hRcd6PbxFfqWJ0KwEO9dJ3p43KMdpiaAT kNB/PBA64/0YkmaOB9kvVfbGcRNruJ16etNCs6tt8EVap/xsG4Glj2LE8PNm+WNXGWya +hGGnyYIc18WEVpb81AWgbSmIccs+Xhl9hSDwSYGREqW1sECrWJ6IZvlMkPu6jChyLtX txKOceKV+N461gqJdaH1ChAD3Dssdn2m+HKQ3/IJjXnTYFrNE9uVHwmyeCezJ4eNfxQr hnbQo49UQFa0WzbK8FT05zR7yAXpCipKntglNtB16rgsoIdWw05qG3JuYLqowd4O+CIq LrVg== X-Gm-Message-State: APjAAAUnmf1v4nymcw9p6NuGzQiUndyp7GFkvO0C8+JKlzELBTna9+rI gYswgdQffEhRBGWHdEBlSHAFa8G1 X-Google-Smtp-Source: APXvYqwhs51PC6jqf6OuBwFcHY9g+Hd7XmiURGDVobMD9gzmFxFNyY+E6/9wGD9xba3/76WXKx2qXA== X-Received: by 2002:a1c:9a41:: with SMTP id c62mr2053672wme.108.1553420537993; Sun, 24 Mar 2019 02:42:17 -0700 (PDT) Received: from ?IPv6:2003:ea:8bc4:dc00:5ca8:2950:7dd3:94a3? (p200300EA8BC4DC005CA829507DD394A3.dip0.t-ipconnect.de. [2003:ea:8bc4:dc00:5ca8:2950:7dd3:94a3]) by smtp.googlemail.com with ESMTPSA id t2sm28617424wra.9.2019.03.24.02.42.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Mar 2019 02:42:16 -0700 (PDT) Subject: Re: [PATCH net-next 2/3] net: phy: aquantia: report PHY details like firmware version To: Florian Fainelli , Andrew Lunn , David Miller Cc: "netdev@vger.kernel.org" References: <0e35a866-e3a5-6d49-2353-008f14ed6ff4@gmail.com> <6298a8d9-8571-6c1f-5069-f37efae0cd51@gmail.com> From: Heiner Kallweit Message-ID: <4add315d-2c7a-ac10-ae99-dc2922bee069@gmail.com> Date: Sun, 24 Mar 2019 10:42:09 +0100 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: <6298a8d9-8571-6c1f-5069-f37efae0cd51@gmail.com> 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 24.03.2019 02:04, Florian Fainelli wrote: > > > 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? > It's also possible to load firmware over MDIO, but typically an internal boot loader reads the firmware directly from a SPI NOR flash. Vendor registers allow access to the flash and it should be possible to expose the flash as MTD, but that's a different exercise (I think some experimental work has been done in that direction already). Based on the datasheet I'm not sure whether the PHY can work w/o firmware. The firmware is more than the provisioned register defaults. >> +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? > Yes, most likely it's better to do this. I'll add it in a v2.