Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4871269rwb; Tue, 8 Aug 2023 15:37:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF/QP1i9BpvWDpeMBK6xW6DHwlWMrEXPykHRbPDem54R6+OVXiHBdhMAFu6mZxceellVW+D X-Received: by 2002:a17:903:2305:b0:1b8:9f6a:39de with SMTP id d5-20020a170903230500b001b89f6a39demr970143plh.65.1691534272430; Tue, 08 Aug 2023 15:37:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691534272; cv=none; d=google.com; s=arc-20160816; b=xG3u8DBEKOWVx2u2jA5npR1LJ0U0ZScYJ5lG6vTOq7ZuHSX2IAEnLwUFWqsJUXxfd8 mKwX0L9KD7aZZFTEDj2zRxCo9mj3SL9Le+qgtxQ0tOu27xQMh0DAAIQFKg5u4vJUb6ww gdwOSLB2GBICv2X52OLGK7Ewoc6G7v1yPt5hmm0fouhDTqQKxysMPQnA17zjNNX13Cox CW6xChCgqnPnA3CWph0URdqgajtud4wx4EwUcgcZeJG3hNhc7U7UfpHrWVTNEsLVhvhZ 4bJ3hcUqMTZNuujf1T+Qd4ZfcAEtQ60zNB0084sKFAiOv65PLkjMg3l/eayi4wiLXEsA ctvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=NbSuxAH1dmgDI1cFhSw3+FjHgNgeooTpwVKeZW63XUA=; fh=vkYpYVwT1imyKPlPsQ8S9OdMM6Y4hOwNyDqUSzsw7ho=; b=V4E1j1d7zygwrdr42lLEq6G1XZPCkht2+Ep23CYppmZnPzFAgJ3e0rm4ZLLrfLhDtD CWFXGqE5GTXqY23HUQX4kttomrCdgRZujdQgnRoXCGcUlILx73zvtNNgIc9x46zz1xqP 61Zmlq5ynNmy4vRVVeKfgeWwj/9NIy0jWdvO3ugz3SIpv2//p2et+Z0zfYId91RD2nZe 02onlUHcGqdtNbUHYlezZLQUIUDIJovoCLsRp8BIn2joeBCbu9FfJaXjKHM5/WVmavXB nTXdWQuKycNPcmOYmCPiZfaZ5X7q7Jxq8H/gN/l/XZpdZlJ/6RmU7JQ07w3jTLT9Vdkc Vw/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20221208.gappssmtp.com header.s=20221208 header.b=omX3M6W7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d7-20020a170902cec700b001bbc80a2a3asi6220458plg.299.2023.08.08.15.37.40; Tue, 08 Aug 2023 15:37:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20221208.gappssmtp.com header.s=20221208 header.b=omX3M6W7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230302AbjHHUG3 (ORCPT + 99 others); Tue, 8 Aug 2023 16:06:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232148AbjHHUGR (ORCPT ); Tue, 8 Aug 2023 16:06:17 -0400 Received: from mail-vk1-xa30.google.com (mail-vk1-xa30.google.com [IPv6:2607:f8b0:4864:20::a30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E3CFFE5D for ; Tue, 8 Aug 2023 11:26:34 -0700 (PDT) Received: by mail-vk1-xa30.google.com with SMTP id 71dfb90a1353d-48735dd1b98so1255698e0c.2 for ; Tue, 08 Aug 2023 11:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1691519193; x=1692123993; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=NbSuxAH1dmgDI1cFhSw3+FjHgNgeooTpwVKeZW63XUA=; b=omX3M6W7HI4CkdKEejiKetClW4YUWnvCPUq8gKc/AoVUAnqTLGguQDDx/Sp7R778JN J9TSo32CN6hMaWQKcsB0qNqnAfUmpGbESPtgNucK5ozybmP7dGop+fVUtC7USzhv0x20 JypPvqhLY7OCKJtBcfnX+96fYG5NsovjpKeVeQyTpMIw8hCNkqz97Nj5+31R97GKArfx FvTCBQ21Dt/3FRicqjABaU4W4VS+jqKz5MgCjjWoW7/8fz5NgBnX8wQtxRvChUJ90vs8 M6mrEFvM5V+hgB099+64rLexf3D68SYLB6togDUSjQ9USqOosVkxu49B4wTl+yHLi33a 3Kiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691519193; x=1692123993; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NbSuxAH1dmgDI1cFhSw3+FjHgNgeooTpwVKeZW63XUA=; b=MrqLDkPEtk0SoL9fk3MEo6KWngo99Ac5bGP2q40vfjqo8IWv5baEQHqAiNkF1a6A5f 2Whn/TsDceMNUbr9qAh2cdkjrwsdLdyCmyiXpmfL7ra4H88eL1uZnjy4GVzFHnChNpBd tjzz1bpZwOwsEOrtwHEW6cSmEszvSHP/GWhTALto6aKNTuEelNsPVXvUJU0qiAoC6JhR m7y+9kJYvUJbaDHAplCwC5Xm2Jv3jjL8Oq8PKnvcB19qt9xMfliLpHKohIZ3kSxornoP DO8OYjqGtR3OOL+eCmU/yBSUvp4R7yeKa5C5N8ACN7s9iEh7DeiwMOZtdPiGwCPJSlLv QvvQ== X-Gm-Message-State: AOJu0YwKsE1VRzDBkfvKs8N4ks2q1S4wCB+VAQJl0SLHmRJTrybo4aKD 1haBtclhxdXZnf+Nb9wkmXXt8FOx6Meu+A866UYFNQ== X-Received: by 2002:a67:f905:0:b0:443:677e:246e with SMTP id t5-20020a67f905000000b00443677e246emr716156vsq.5.1691519193393; Tue, 08 Aug 2023 11:26:33 -0700 (PDT) MIME-Version: 1.0 References: <20230807193102.6374-1-brgl@bgdev.pl> <54421791-75fa-4ed3-8432-e21184556cde@lunn.ch> <65b53003-23cf-40fa-b9d7-f0dbb45a4cb2@lunn.ch> In-Reply-To: From: Bartosz Golaszewski Date: Tue, 8 Aug 2023 20:26:22 +0200 Message-ID: Subject: Re: [PATCH 0/2] net: stmmac: allow sharing MDIO lines To: Andrew Lunn Cc: Andrew Halaney , "Russell King (Oracle)" , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Alex Elder , Srini Kandagatla , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 8, 2023 at 5:15=E2=80=AFPM Andrew Lunn wrote: > > > I'll make the water muddier (hopefully clearer?). I have access to the > > board schematic (not SIP/SOM stuff though), but that should help here. > > > > MAC0 owns its own MDIO bus (we'll call it MDIO0). It is pinmuxed to > > gpio8/gpio9 for mdc/mdio. MAC1 owns its own bus (MDIO1) which is > > pinmuxed to gpio21/22. > > > > On MDIO0 there are two SGMII ethernet phys. One is connected to MAC0, > > one is connected to MAC1. > > > > MDIO1 is not connected to anything on the board. So there is only one > > MDIO master, MAC0 on MDIO0, and it manages the ethernet phy for both > > MAC0/MAC1. > > > > Does that make sense? I don't think from a hardware design standpoint > > this is violating anything, it isn't a multimaster setup on MDIO. > > Thanks for taking a detailed look at the schematics. This is how i > would expect it to be. > > > > > > Good point, but it's worse than that: when MAC0 is unbound, it wi= ll > > > > > unregister the MDIO bus and destroy all PHY devices. These are no= t > > > > > refcounted so they will literally go from under MAC1. Not sure ho= w > > > > > this can be dealt with? > > > > > > > > unbinding is not a normal operation. So i would just live with it, = and > > > > if root decides to shoot herself in the foot, that is her choice. > > > > > > > > > > I disagree. Unbinding is very much a normal operation. > > What do you use it for? > > I don't think i've ever manually done it. Maybe as part of a script to > unbind the FTDI driver from an FTDI device in order to use user space > tools to program the EEPROM? But that is about it. > > I actually expect many unbind operations are broken because it is very > rarely used. > When I say "device unbind", I don't just mean manual unbinding using sysfs. I mean any code path (rmmod, unplugging the USB, etc.) that leads to the device being detached from its driver. This is a perfectly normal situation and should work correctly. I won't be fixing it for this series but may end up looking into establishing some kind of device links between MACs and their "remote" PHYs that would allow to safely unbind them. Bart