Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp1052393rdb; Wed, 1 Nov 2023 09:58:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFniRNFKkv+EkeeROXrfxxrJzl3/omW2AF++1KDMShO11z3r+lG/of+MFNdSKq4MRsZ+LCE X-Received: by 2002:a17:90a:17c8:b0:279:2dac:80b3 with SMTP id q66-20020a17090a17c800b002792dac80b3mr14637066pja.44.1698857892748; Wed, 01 Nov 2023 09:58:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698857892; cv=none; d=google.com; s=arc-20160816; b=SanA9tUGSLo68S/oF2Sxc5WHAnAxdhro+T8wy/OZh/m6W+XFyBKmO+uds9P1mny1tG pq6yYV/H+5X6rOnNTx8/8NMLqeXzVASXIPHm1+XBSUHHnPiPVYbeQMpqfKp4vC95ic+g laC/s8IxSsIUNgmFzbkIA+jqljQe0UceFbr9dtSL948wJXu51CkRjIjGzlRDtwAGELWA rtNehjFSTcCAuUGHBL0+1JwdbzttEw9+Yy0kDhTlFPHGXvYCTNJaZ71UEmLk9HSKmDyZ dY57lK8WW+pPSaUjYG8d+ALcuL7At6QicQIOSCtwZBbJ0IJI7XWOiA8E5dJVVX4ih+cf fD9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:content-language:references:cc:to:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=Sn6xBYx2DalfFZhDl/aI5XV9Hmv1XDDj4chPbF8qFs0=; fh=6nsbQULrSzb986yKOQWpRbLIKdTkNBMVp6e9BD2XaFs=; b=VPr5ttwzISvuT8gSE+thTeE+Q+5mA9awzSIfAOU205Dv0UE9X431XAfFE3ex4DNfZs xzmA7ApTgDTPnsHsH8sDRmfsib/8To02CNJOhc0h4AyYS744EjH2hEbHhMSR7RDZSFnD T5gJIQkTX6f6Qd5eHq/rvzuKfgonmiHGo6cXwuma47aPWxgJEONhHSYAL8UEMYSlbkW3 R53didwd2sxviUzLJzkzRUGmbZq/NiLQjd/53KFH1dqyh53EYcreRiVSevzXz3yUpX14 UvOsZAj2zpkFDU97CY0pN5FqaBs9ESVT1y89UTPMgTMfcZ4Q363x5mJsrom59XFk4HVL SnEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WKD+d4Vw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id n21-20020a17090a929500b002802c4518d1si1186535pjo.148.2023.11.01.09.58.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 09:58:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WKD+d4Vw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 43FF1808A8DB; Wed, 1 Nov 2023 09:58:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344229AbjKAQ6A (ORCPT + 99 others); Wed, 1 Nov 2023 12:58:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231233AbjKAQ56 (ORCPT ); Wed, 1 Nov 2023 12:57:58 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 535B910F; Wed, 1 Nov 2023 09:57:52 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-9d267605ceeso393366b.2; Wed, 01 Nov 2023 09:57:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698857871; x=1699462671; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=Sn6xBYx2DalfFZhDl/aI5XV9Hmv1XDDj4chPbF8qFs0=; b=WKD+d4VwDGvXkwbZtczTmG9T01GVwkx3KPgMBLuRWFKyA17xs9Ycmo1gglcbnXHidy qHC7molFd/k/hlmv1MI7H1fTuBXhRfzI7Z8r0l85OWmpfw9XZh2nl0Ve7s43VREhbBaB Ky79XAdzuihexy0NHCmwUGTIERYvtKgqGOCfM797OEyWPKEw1WSz9bGkRUqPbe38mO3M L5r56S7M0/oIl0DDcKK6M0GGu2izVTfOJ08Cm/4LH2KXenA/5gmrxJMp48MiSVKvdJ7t /qfIPkE+a4dEtgedXAtmfCxxpEiUZU6RW7+fwtR9FkRc+IOEiMNadKBcgwvME/92Z4uG 7vOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698857871; x=1699462671; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Sn6xBYx2DalfFZhDl/aI5XV9Hmv1XDDj4chPbF8qFs0=; b=aUdsv/OovyC5WyAzwp91G7Gj1RoHh2KoqrqY93zG8FiUpofxBhUWfFjo8t41Ojvvx1 ebTmBQ9lbtUi0HfauyclNWitGUpKPJpvAZSkuMfiZOuomcg3jALY8S/iytHI5VxUMAN6 4Dt6UmXO9fFsgCoLRwh5tyFb8j1/6FJy0QXnErVZ7Rpt0AWgep6mZssEBy2NI2UHWz6i NCso3YrvzR0CJq97hQaFLmHrE9b6HFTnBaWy9P/fyGdzXDz2S5ub1D1gFvvBmkBqXkZP nRKFeFT5J3NUJoC3dW8nzc8yKFwIwbRYjKbFXs6jpj+GnLXf2HzjqY0EGKXajEh7pEnf hsJg== X-Gm-Message-State: AOJu0YzlXxCCGw7pib7hffj8MuOLtAzhS5Eio1O1Sz1lBGOkQghgSjfk TnF95xTLCOkLxOQuxpE21ZIRYFd0n9o= X-Received: by 2002:a17:907:eab:b0:9bf:5df1:38c9 with SMTP id ho43-20020a1709070eab00b009bf5df138c9mr2530757ejc.9.1698857870436; Wed, 01 Nov 2023 09:57:50 -0700 (PDT) Received: from ?IPV6:2a01:c22:6f25:5100:302f:4dfd:b45b:b65a? (dynamic-2a01-0c22-6f25-5100-302f-4dfd-b45b-b65a.c22.pool.telefonica.de. [2a01:c22:6f25:5100:302f:4dfd:b45b:b65a]) by smtp.googlemail.com with ESMTPSA id x27-20020a170906135b00b009a5f1d15644sm135256ejb.119.2023.11.01.09.57.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Nov 2023 09:57:50 -0700 (PDT) Message-ID: Date: Wed, 1 Nov 2023 17:57:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [net-next PATCH v2 1/2] net: phy: aquantia: add firmware load support To: Christian Marangi Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andrew Lunn , Russell King , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Robert Marko References: <20231101123608.11157-1-ansuelsmth@gmail.com> <5af21f93-bb2d-42b1-b4d4-ee4443ffaff9@gmail.com> <65424cd9.5d0a0220.20d9a.fe0f@mx.google.com> Content-Language: en-US From: Heiner Kallweit Autocrypt: addr=hkallweit1@gmail.com; keydata= xsFNBF/0ZFUBEAC0eZyktSE7ZNO1SFXL6cQ4i4g6Ah3mOUIXSB4pCY5kQ6OLKHh0FlOD5/5/ sY7IoIouzOjyFdFPnz4Bl3927ClT567hUJJ+SNaFEiJ9vadI6vZm2gcY4ExdIevYHWe1msJF MVE4yNwdS+UsPeCF/6CQQTzHc+n7DomE7fjJD5J1hOJjqz2XWe71fTvYXzxCFLwXXbBiqDC9 dNqOe5odPsa4TsWZ09T33g5n2nzTJs4Zw8fCy8rLqix/raVsqr8fw5qM66MVtdmEljFaJ9N8 /W56qGCp+H8Igk/F7CjlbWXiOlKHA25mPTmbVp7VlFsvsmMokr/imQr+0nXtmvYVaKEUwY2g 86IU6RAOuA8E0J5bD/BeyZdMyVEtX1kT404UJZekFytJZrDZetwxM/cAH+1fMx4z751WJmxQ J7mIXSPuDfeJhRDt9sGM6aRVfXbZt+wBogxyXepmnlv9K4A13z9DVLdKLrYUiu9/5QEl6fgI kPaXlAZmJsQfoKbmPqCHVRYj1lpQtDM/2/BO6gHASflWUHzwmBVZbS/XRs64uJO8CB3+V3fa cIivllReueGCMsHh6/8wgPAyopXOWOxbLsZ291fmZqIR0L5Y6b2HvdFN1Xhc+YrQ8TKK+Z4R mJRDh0wNQ8Gm89g92/YkHji4jIWlp2fwzCcx5+lZCQ1XdqAiHQARAQABzSZIZWluZXIgS2Fs bHdlaXQgPGhrYWxsd2VpdDFAZ21haWwuY29tPsLBjgQTAQgAOBYhBGxfqY/yOyXjyjJehXLe ig9U8DoMBQJf9GRVAhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEHLeig9U8DoMSycQ AJbfg8HZEK0ljV4M8nvdaiNixWAufrcZ+SD8zhbxl8GispK4F3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UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 01 Nov 2023 09:58:10 -0700 (PDT) On 01.11.2023 13:57, Christian Marangi wrote: > On Wed, Nov 01, 2023 at 02:01:33PM +0100, Heiner Kallweit wrote: >> On 01.11.2023 13:36, Christian Marangi wrote: >>> From: Robert Marko >>> >>> Aquantia PHY-s require firmware to be loaded before they start operating. >>> It can be automatically loaded in case when there is a SPI-NOR connected >>> to Aquantia PHY-s or can be loaded from the host via MDIO. >>> >>> This patch adds support for loading the firmware via MDIO as in most cases >>> there is no SPI-NOR being used to save on cost. >>> Firmware loading code itself is ported from mainline U-boot with cleanups. >>> >>> The firmware has mixed values both in big and little endian. >>> PHY core itself is big-endian but it expects values to be in little-endian. >>> The firmware is little-endian but CRC-16 value for it is stored at the end >>> of firmware in big-endian. >>> >>> It seems the PHY does the conversion internally from firmware that is >>> little-endian to the PHY that is big-endian on using the mailbox >>> but mailbox returns a big-endian CRC-16 to verify the written data >>> integrity. >>> >>> Co-developed-by: Christian Marangi >>> Signed-off-by: Robert Marko >>> Signed-off-by: Christian Marangi >>> --- >>> Changes v2: >>> - Move out of RFC >>> - Address sanity check for offsets >>> - Add additional comments on firmware load check >>> - Fix some typo >>> - Capitalize CRC in comments >>> - Rename load_sysfs to load_fs >>> >> >> To make the driver better maintainable: can the firmware handling code >> be placed in a separate source code file, similar to what has been done >> for the hwmon part? >> If yes, then this could also be the right time to move the aquantia >> driver to an own subdirectory. >> > > Sure! Np for me just is it really worth it? hwmod is a bigger one but > this is really a few functions. > r8169_firmware.c is even smaller and I've never regretted having it factored out. Whether it makes sense depends on how much you share with the main module and how the API is structured that you provide to the main module. So I don't say you have to do it, I'm just saying it's worth considering it. > Anyway if requested, I will move in v3 the driver to a dedicated > directory and move the function to a separate file! >