Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1639820rdb; Thu, 25 Jan 2024 01:30:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IGqsNTXcd9Dg56qqSH3bEl60Ndh44KVgfjaB5F5fSpP4RQAChsz8zQrG0HpRij7jLUIEspX X-Received: by 2002:a17:902:a3c6:b0:1d7:5e30:983a with SMTP id q6-20020a170902a3c600b001d75e30983amr664866plb.111.1706175058322; Thu, 25 Jan 2024 01:30:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706175058; cv=pass; d=google.com; s=arc-20160816; b=efTASzaBGPBD7S3tfo5dqDBxS5pZFmy/tQ1pxsvsXWvXE9BBBhzoTj/buqTiJVEf2n 129UUjPpdYNGuZEK3M9dJgODU7YnC+opT9kl0ApAZhWL1k5PnG1n2WOe+qiK7UyNFNn7 9MG4jww83HqAUYTz6Z1jiR3MuhhlqZvKGpohMjX9qYt/bGlFTfDlLgKToC/aHHeCtpRT MBr76TIVJ+Z/EcU+MDNpHZfehgo4vtloL1GRAt0oSYi5KWobhVucAV5y7AlPkrZKXQH8 UnobzsQuVRl6PeWkEJHCDLwBX5SIY15bydA5HkHo/TUaz2YLlukVHs+WVGxNlCdOwGWZ C17g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=68+k4SXoZiAs2Pfmb+T8MrZfPAp6t3J0ktPdjp0hv2Q=; fh=2IRIYbuVn4SetIXPreRxDa0jODgLPWHHVFPF8UGNIUE=; b=Z9KU74xwIQDXhVyFc+HxP0GhzLdqoKpAaZDf9gC9fxsJCUUKMTI1uutMimK6nMnmvG I8joqW/SbhnbQrv/yw10RSZW7XAxHKkCFeMrwpDSTgffArvxKV2fY92e0C7GWm+Vp8Xu rrSkacYW4dQHhHI/SjogCmk1PcwauMK2iWksrJrKwF2B1U0mpu4UfEvc6Z1Jkpp3FAuR Cyf+vVEdJAVBmQgKr0xsVFyztKpgcj3sJPFEtL6sw7VpAlKo33mdxbaumhKwxf+HX7tH 1Qt/+UqcFo5MaKxIDqVILiVgwFXHI9WyzAvzeuA0adERuznNnBqz0yXijXbyuf7PwU8l 8sRQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YqL2T9fK; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-38252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38252-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k10-20020a170902c40a00b001d6f28b7031si13394883plk.193.2024.01.25.01.30.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 01:30:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YqL2T9fK; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-38252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38252-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C4A39284ADE for ; Thu, 25 Jan 2024 09:22:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 86A7B1BC5B; Thu, 25 Jan 2024 09:22:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YqL2T9fK" Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 106B61BDC3; Thu, 25 Jan 2024 09:22:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706174561; cv=none; b=IcfWX9vOgWEsVv/Do5nj18hwn37xuxqPLI365OA4YWqSmksgSPAnNXEBTPEq1nV0RS7WekmZXbTGy34dbkWiglSqO3bCPD0r3JODFPVp73169Mu4Jf6s6XMR3K0MTusepcFEi3B4x89xpLIOcfZxSJXIbaOa/152bKnbmw8mpu8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706174561; c=relaxed/simple; bh=bxot2MLwbGx+WPC8RaoJz1YWvtizCki2E8FaJi5WOzE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VjSL3xQcsdKUSUuammJy1Uthp3h5PZXfPrhIeJGtqXi/m5CNqpotTrHtKmneoRZy3LFfmHkT9wLxf36YFlxUGt3e4M7bJS12h1rug9eUjjb0CzCgqM0P9zuEpNt/6MX3oJGZTKtp55VsWIlJYYMJwA/02+GM+PSrajffL0NSaws= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YqL2T9fK; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a2a17f3217aso628540966b.2; Thu, 25 Jan 2024 01:22:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706174558; x=1706779358; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=68+k4SXoZiAs2Pfmb+T8MrZfPAp6t3J0ktPdjp0hv2Q=; b=YqL2T9fKFZ430JaMoas57izwGE0KFt7P2u7RWMYeL7Ke3ilU9KQTdQrvDG2viRwESX BuQKb+8xAJpQbQLkTqkCV7qginMkMdd4nxHtWmI3LDoReV+iGHIYGrHTwZYABVYfntP8 NyitbCXI5eGwAyIEyHrRvsjT+bKgtVM4PE8Lks/0/ckL/0XYkGHmEze3oXLWEtOZ+NA2 fvQL68vvh9aCxUiI4iIvboTTrr0zrQ+WsPzp2OdltEnWr51uUbfDsmrkjgzcwOqV55bH yKSMby6kAW4uk9v30NaZyh2Wn0Dw3wU7oK1itVz46d3M6KmQt0S1L99Fg/bJdOpV69vW JjTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706174558; x=1706779358; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=68+k4SXoZiAs2Pfmb+T8MrZfPAp6t3J0ktPdjp0hv2Q=; b=kjXSoF6DsaOdrrA+AdsjfLTeHTRrWX3DkfJVS1+3RUu3xS6I8Jb14ER3nyjG5gvzA+ j2BN5IHT4LdhQ87tcKXtmOlgXcJouMS1tGBdB2qJrULIs7G3pAX1aFA3Ih6xREzAWp+G 7SZjbJxscS3vp4jESpAMLvr0oLUUxRIQKbAHBwo48IsIpid3SUQDs6/QaBwbUXKRK8Qz 3Isa6lcPjqR6Q/4cdbj4Q+bgy7JmtHkByy1K2wtAnyk5iAZE+E5A2rTQn0cnZN8ZAoda wRlMy6deWsiKbuFj+e4/mYXxJ/iAUpmnnUN8W7ICJNGD4ccPyKjc/WkI1TlZHJh3/0m9 WfcQ== X-Gm-Message-State: AOJu0YzxYplXlGizPGUtMphamKkTxsLkqEikEeZgykup8Y1FHO4DyxuY PUzynIyxX5NiDW9ErcCo5lIKxZUFgKYpUw2VFmynsP7g5IQwJ/u9 X-Received: by 2002:a17:906:1ccf:b0:a30:fb95:9387 with SMTP id i15-20020a1709061ccf00b00a30fb959387mr407499ejh.75.1706174557914; Thu, 25 Jan 2024 01:22:37 -0800 (PST) Received: from skbuf ([188.25.255.36]) by smtp.gmail.com with ESMTPSA id gw9-20020a170906f14900b00a311ab95fbdsm815922ejb.63.2024.01.25.01.22.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 01:22:37 -0800 (PST) Date: Thu, 25 Jan 2024 11:22:34 +0200 From: Vladimir Oltean To: =?utf-8?B?QXLEsW7DpyDDnE5BTA==?= Cc: Daniel Golle , Landen Chao , DENG Qingfang , Sean Wang , Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , David Bauer , mithat.guner@xeront.com, erkin.bozoglu@xeront.com, Luiz Angelo Daros de Luca , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH net-next] net: dsa: mt7530: support OF-based registration of switch MDIO bus Message-ID: <20240125092234.czwjwc3izmsl3ekr@skbuf> References: <20240122053431.7751-1-arinc.unal@arinc9.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240122053431.7751-1-arinc.unal@arinc9.com> On Mon, Jan 22, 2024 at 08:34:31AM +0300, Arınç ÜNAL wrote: > Currently the MDIO bus of the switches the MT7530 DSA subdriver controls > can only be registered as non-OF-based. Bring support for registering the > bus OF-based. > > The subdrivers that control switches [with MDIO bus] probed on OF must > follow this logic to support all cases properly: > > No switch MDIO bus defined: Populate ds->user_mii_bus, register the MDIO > bus, set the interrupts for PHYs if "interrupt-controller" is defined at > the switch node. This case should only be covered for the switches which > their dt-bindings documentation didn't document the MDIO bus from the > start. This is to keep supporting the device trees that do not describe the > MDIO bus on the device tree but the MDIO bus is being used nonetheless. > > Switch MDIO bus defined: Don't populate ds->user_mii_bus, register the MDIO > bus, set the interrupts for PHYs if ["interrupt-controller" is defined at > the switch node and "interrupts" is defined at the PHY nodes under the > switch MDIO bus node]. > > Switch MDIO bus defined but explicitly disabled: If the device tree says > status = "disabled" for the MDIO bus, we shouldn't need an MDIO bus at all. > Instead, just exit as early as possible and do not call any MDIO API. > > The use of ds->user_mii_bus is inappropriate when the MDIO bus of the > switch is described on the device tree [1], which is why we don't populate > ds->user_mii_bus in that case. > > Link: https://lore.kernel.org/netdev/20231213120656.x46fyad6ls7sqyzv@skbuf/ [1] > Suggested-by: David Bauer > Signed-off-by: Arınç ÜNAL > --- Reviewed-by: Vladimir Oltean