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=-2.1 required=3.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, USER_AGENT_SANE_1 autolearn=no 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 D95C4C282DD for ; Tue, 7 Jan 2020 19:22:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A822D20656 for ; Tue, 7 Jan 2020 19:22:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QJsTl/ln" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728662AbgAGTWd (ORCPT ); Tue, 7 Jan 2020 14:22:33 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:34177 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728307AbgAGTWd (ORCPT ); Tue, 7 Jan 2020 14:22:33 -0500 Received: by mail-ed1-f66.google.com with SMTP id l8so570762edw.1 for ; Tue, 07 Jan 2020 11:22:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=i1b85XP7jYPsUG6P1B/l7q7mdL1Mfe3kQkwElRIQA7g=; b=QJsTl/lneKXgGQToCNZLwxPj8ZxSzhZF4swUPAUIrh1f9frs2WIEdP+3nvGtvTeS9c t+xpmTLLHO9cc/z1RfkuWWUrxfW9BBp/TZv+yPz2vs7WZCMiYsBo4/jZHu0LZLMdCKKF 31HxNtJ6enoFTC+B7nvJToYQLxWJuvOgMK8crRvzViylNf5AGkZzOOXR5lDOe++EkN+5 Ke/SgRL3mvrEU7uOpe+ebMlL8NEsdVX97FouQh6KqOh3j1AMSoSceFzLXo64l8oXYtBd j1W9eze4dwWDB+Im1XkCE9T+DM8XP5SLKf2UsSvrF3pVuUhbKDnTAOCSeGYp0l7/1QwV pQLA== 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:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=i1b85XP7jYPsUG6P1B/l7q7mdL1Mfe3kQkwElRIQA7g=; b=BzvRS0epKi7/Q2hCMX8geiX5rjWhUHSUv8UwsIdhOY/8BFqQ16sJ9kb1p0jE+K5ybU VD+WChGcuCgsK4EUjgsMLHec11yHEMpBXqBiMf9ID/jwZjmoElDF5sB0JDAnzQ9srPH2 zf/YcEXJxjZ600IKPTwI1FJJPTtNsbNYlNm0ajTp03k0jYNPtJnxSwJOM4xlcW2rRhUK 4yFJ9wkvlw0pFME2+DKN+/r0c+upPC7z+fhl1wBPDsGCafR0jkkRzgVrbWpzqU6sACGp qbzeX5weFEfdna2zVxutD5hp/NZlFgWw1TGkU7Meb4hL5zYKajxszlznDceeI0y53QCs w20g== X-Gm-Message-State: APjAAAX1UWDFHTa1vlZJnWHaq3PN56a3HIBV/9z/Xud6GZUYdpVdwJlk /p9vuT7eXxGFKyJ9TqINQS4= X-Google-Smtp-Source: APXvYqyr8nnQdV6ih8WUBeOsmJJwkoY0iYFgelpDxEoHlbxIeUNt8AZjJABxjcifk6j86Q/hJvR/Lg== X-Received: by 2002:a17:906:f0d6:: with SMTP id dk22mr930362ejb.307.1578424950993; Tue, 07 Jan 2020 11:22:30 -0800 (PST) Received: from [10.67.50.41] ([192.19.223.252]) by smtp.googlemail.com with ESMTPSA id m2sm19184edp.85.2020.01.07.11.22.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Jan 2020 11:22:30 -0800 (PST) Subject: Re: [PATCH v5 net-next 5/9] enetc: Make MDIO accessors more generic and export to include/linux/fsl To: Vladimir Oltean Cc: "David S. Miller" , Jakub Kicinski , Russell King - ARM Linux admin , Andrew Lunn , Vivien Didelot , Alexandru Marginean , Claudiu Manoil , Xiaoliang Yang , "Y.b. Lu" , netdev , Alexandre Belloni , Horatiu Vultur , Microchip Linux Driver Support , Vladimir Oltean References: <20200106013417.12154-1-olteanv@gmail.com> <20200106013417.12154-6-olteanv@gmail.com> <8718ea22-d1aa-fe58-bd69-521eeee5190a@gmail.com> <86c9b320-bed5-a00b-24aa-494a1d7f91d0@gmail.com> From: Florian Fainelli Autocrypt: addr=f.fainelli@gmail.com; prefer-encrypt=mutual; keydata= xsDiBEjPuBIRBACW9MxSJU9fvEOCTnRNqG/13rAGsj+vJqontvoDSNxRgmafP8d3nesnqPyR xGlkaOSDuu09rxuW+69Y2f1TzjFuGpBk4ysWOR85O2Nx8AJ6fYGCoeTbovrNlGT1M9obSFGQ X3IzRnWoqlfudjTO5TKoqkbOgpYqIo5n1QbEjCCwCwCg3DOH/4ug2AUUlcIT9/l3pGvoRJ0E AICDzi3l7pmC5IWn2n1mvP5247urtHFs/uusE827DDj3K8Upn2vYiOFMBhGsxAk6YKV6IP0d ZdWX6fqkJJlu9cSDvWtO1hXeHIfQIE/xcqvlRH783KrihLcsmnBqOiS6rJDO2x1eAgC8meAX SAgsrBhcgGl2Rl5gh/jkeA5ykwbxA/9u1eEuL70Qzt5APJmqVXR+kWvrqdBVPoUNy/tQ8mYc nzJJ63ng3tHhnwHXZOu8hL4nqwlYHRa9eeglXYhBqja4ZvIvCEqSmEukfivk+DlIgVoOAJbh qIWgvr3SIEuR6ayY3f5j0f2ejUMYlYYnKdiHXFlF9uXm1ELrb0YX4GMHz80n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message-ID: <0e884172-4f20-5638-4c58-48d013d82baf@gmail.com> Date: Tue, 7 Jan 2020 11:22:26 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 1/7/20 1:46 AM, Vladimir Oltean wrote: > > So we don't typically have the external MDIO controller be part of the > memory map of an Ethernet port, it has its own region in the SoC. But > this is not an external MDIO controller, and it's a completely > separate hardware instance with its own memory region not shared with > anybody else. OK, I do not think I managed to express myself correctly, by external MDIO controller I meant a controller that is used to interface with off-chip (and sometimes on-chip, too) MDIO devices. That is an on-chip MDIO controller technically, pardon me for not expressing myself more clearly here. > > And I think your need for registering the slave MDIO bus in the > Starfighter 2 switch driver, on top of the same memory region as the > GENET's MDIO bus, is just to work around the fact that the switch > pseudo-PHY MDIO address is fixed at 30 on some chips, and you need to > intercept those transactions by wrapping the mii_bus->read and > mii_bus->write methods of the master, otherwise none of this would > have been needed. You are conflating two things that are not related to the point being discussed. The SF2 switch used on 7445 and 7278 has some wrapping around the Roboswitch original IP. The roboswitch has an internal MDIO controller which is managed through the register space within the switch. We added a MDIO controller to interface with both our internal Gigabit PHYs as well as external MDIO devices would such thing exist. The binding show the MDIO node as part of "switch_top" but not being part of "core": Documentation/devicetree/bindings/net/brcm,bcm7445-switch-v4.0.txt. The same IP used as the MDIO controller (those two 32-bit words with CFG and CMD) are the same as those that are used on GENET, hence the desire to re-use the same piece of driver. > If I understand correctly, couldn't you have just overridden the > mii_bus->read and mii_bus->write ops of the master MDIO bus, without > registering another one? Yes maybe, I do not think this is particularly relevant to this discussion though. > >>> >>>> Your commit message does not provide a justification for why this >>>> abstraction (mii_bus) was not suitable or considered here. Do you think >>>> that could be changed? >>>> >>> >>> I'm sorry, was the mii_bus abstraction really not considered here? >>> Based on the stuff exported in this patch, an mii_bus is exactly what >>> I'm registering in 9/9, no? >> >> I meat in the commit message, there is no justification why this was not >> considered or used, by asking you ended up providing one, that is >> typically what one would expect to find to explain why something was/was >> not considered. It's fine, the code is merge, I won't object or require >> you to use a mii_bus abstraction. > > So I answered your question? If so, it was by mistake, because I still > don't exactly understand your point (although I would like to). > The difference is that we don't register a new platform device for the > mii_bus (we use mii_bus->dev = ocelot->dev), and that it's not in > drivers/net/phy/mdio-fsl-enetc.c, although it could be, but I don't > see a clear benefit. To go back to the original point, I suppose the answer is no: we did not consider using a mii_bus abstraction and in hindsight, we do not see the point but it was interesting you brought that up. Case closed from my side, thank you. -- Florian