From patchwork Mon Mar 11 14:11:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 13588805 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (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 B24E33FE35 for ; Mon, 11 Mar 2024 14:12:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710166353; cv=none; b=Z9vzJzUnmvRBeyxQ26HLaLP9/dU5KJvgDA5NSfXs0HcH44Wr18RvpkLzRQq21iBZBABGn5fWDrQ/eQP8sl6q8q+uYoRoBXIJHRqSgOIR/oJRccUddWcwZ94TExmJ6KZpCCGQsGK3va8109ISBt3bZhfahtwN/s6sThHmMyhrb1Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710166353; c=relaxed/simple; bh=/HGzTB5SZdVO3xOHO21xQHKVoBA4t5yAIwbItVhKxeE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YRnbts/F95beQ6GlJN0B0iE5nOntQeM5R98YCkUT6NzpBWoXGatW2O4Mmbk7qYJUf14MkZPtezqXB7qN++d6WcMSY2kRgZTI5yoeKn6cauaT0ss92Xe6rn+DXrxtzIapi6MaDXXToanq2Bc6voj5FJQRS212S5J6N/4EWy2ICXM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=Yy9Ijr4b; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="Yy9Ijr4b" Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a4627a7233aso162777766b.1 for ; Mon, 11 Mar 2024 07:12:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; s=google; t=1710166350; x=1710771150; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yBanA23QROE3/+jLFGt6yRe0SQoJ2oxKoX4eGPxFzrw=; b=Yy9Ijr4bZImVsPWjUXnztvNB/wqKf7ZtGMd6DlRUuxmxn9FpChWfGR5HWJwSRBoPJX U3N8uNFrXNl8nX/j8YT8vbYe3l4icX7f3pJZgFilMdor9B/gm9QaGnFS68zAV6XQryVf vU9UlMkn6yQN9B+lL83EIOvTgV3XkQ0qHWTeO/Ha4uz0ACIqyIb3BEky3X5J5fCHz9qb EMm8Q68WvJA83kTWrfojb2PDQgajuUWnMKUby+3K5rPZE02lS1gh7HrqLINcGQCf690x fcaiMb4QWGVPRc5iLVj/p8gUg3FEG9hlKpxgrMgEQj1VNJjXZkCBL/4iEAhi7u0qE0DB 13ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710166350; x=1710771150; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yBanA23QROE3/+jLFGt6yRe0SQoJ2oxKoX4eGPxFzrw=; b=NYMB6RGYP9uFjOkpFerF3TOkf/AMJSM/ERgT74U0jwTmV42VhU6QskYxW3EMEzCHGT Gi1acv5lxrdxdT3CVsNGFO62Z/5I1CxJnL3xMQwSdDMAM2y2s1qTSZMPfxudm5NMTvlc iWewiZPEKt+D0ZzQDZSehwP6ctc+KMfCKYNl7wiLqu1ZrFJKGZvgndDZZjuAdJBrMwzE W4y6dooMtPFKPreA3XHYbwctth0LOObCET4rYBedXgPkhPoinkI8W2kGenqqhb+8+rVg LRVtju6Y4OVk/h3uAKTziSMqFMRaazE2hWwPctpvQ9TQ8lmR0iYwPTZ8uLP0hpJnivj0 1chA== X-Forwarded-Encrypted: i=1; AJvYcCXzZxL7jmEPcqcA5TArY+meXbpdZEvYDLed285G4Vktab49m0rtG+cxS83nTfeeV1I9LrhxR72MmjZerBnJJ29vxGx4pCib X-Gm-Message-State: AOJu0YznhLffSY6zoyclU/HAQaRfO3GTs5ZT/zxljc5EGdoqnyPrC/Mp aaH5TNUEqbyx1V9xVcZ1TFir7eldNgm1DarVn2yoSK2zDBrmFBMVA+Bm6L9sIRs= X-Google-Smtp-Source: AGHT+IFpaFYHZPUC59+vr6YEUbUDIfvHm0t6MBKRtc2HkOlRmTHV+gZO+re4EWKsdiZyVhlhk5GFtg== X-Received: by 2002:a17:906:6cc:b0:a46:2a8a:63fb with SMTP id v12-20020a17090606cc00b00a462a8a63fbmr2167752ejb.26.1710166349926; Mon, 11 Mar 2024 07:12:29 -0700 (PDT) Received: from sleipner.berto.se (p4fcc8c6a.dip0.t-ipconnect.de. [79.204.140.106]) by smtp.googlemail.com with ESMTPSA id kn11-20020a170906aa4b00b00a45efdfdd1esm2863154ejb.40.2024.03.11.07.12.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 07:12:29 -0700 (PDT) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Claudiu Beznea , Yoshihiro Shimoda , Biju Das , netdev@vger.kernel.org, devicetree@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [net-next,v3 1/2] dt-bindings: net: renesas,etheravb: Add optional MDIO bus node Date: Mon, 11 Mar 2024 15:11:05 +0100 Message-ID: <20240311141106.3200743-2-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240311141106.3200743-1-niklas.soderlund+renesas@ragnatech.se> References: <20240311141106.3200743-1-niklas.soderlund+renesas@ragnatech.se> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The Renesas Ethernet AVB bindings do not allow the MDIO bus to be described. This has not been needed as only a single PHY is supported and no MDIO bus properties have been needed. Add an optional mdio node to the binding which allows the MDIO bus to be described and allow bus properties to be set. Signed-off-by: Niklas Söderlund Reviewed-by: Sergey Shtylyov Reviewed-by: Rob Herring --- * Changes since v2 - Mark the PHY pattern as deprecated and add a comment that new bindings should describe the PHY inside the MDIO node. --- .../devicetree/bindings/net/renesas,etheravb.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/net/renesas,etheravb.yaml b/Documentation/devicetree/bindings/net/renesas,etheravb.yaml index de7ba7f345a9..8bfd4fb5f834 100644 --- a/Documentation/devicetree/bindings/net/renesas,etheravb.yaml +++ b/Documentation/devicetree/bindings/net/renesas,etheravb.yaml @@ -93,6 +93,10 @@ properties: description: Number of size cells on the MDIO bus. const: 0 + mdio: + $ref: /schemas/net/mdio.yaml# + unevaluatedProperties: false + renesas,no-ether-link: type: boolean description: @@ -110,9 +114,13 @@ properties: tx-internal-delay-ps: enum: [0, 2000] +# In older bindings there where no mdio child-node to describe the MDIO bus +# and the PHY. To not fail older bindings accept any node with an address. New +# users should describe the PHY inside the mdio child-node. patternProperties: "@[0-9a-f]$": type: object + deprecated: true required: - compatible From patchwork Mon Mar 11 14:11:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 13588807 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 B3FC43FE28 for ; Mon, 11 Mar 2024 14:12:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710166354; cv=none; b=Hv1QKT5YI84EyvWKrhmS0CF7ZKSWRhm1Yq/q3+LmsHk7M9f00qKmqUZs7NpBY06du2o42Ar/QQwdrUknxNXMMOhLGO24O61uBoCkeVoe5WHNTeoH1e5DMjaNcqooiZnQo7/Sk3WckVewZ5gSxwtK+DTfNkfX3Alr6LnW/7miGN8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710166354; c=relaxed/simple; bh=rVZOsO2PWk9L7eDbDTFt/a8pYc9EpOZUtY86t0+O3oE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lkgFGBSat6pQL+OFwK/cRzOsK9xcAPFMbY2RP1e/rHI4BVwXBqC2O31C/7WAdvCJ61m5DCiG/FbmDmGmXKelf3EuEtyswnnlHhNfwNiFPOz3W4/f76mJpsEimF6Tu0UJ3bFAVQ3A8InM7OOH74QNPme0Low2zBgO6ijhr3S5e7k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=b4izc26p; arc=none smtp.client-ip=209.85.208.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="b4izc26p" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-568241f40e9so4111482a12.0 for ; Mon, 11 Mar 2024 07:12:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; s=google; t=1710166351; x=1710771151; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tGqfMLj68zV4QYB0uesNdYqp81X62zcg2nmph+fkNLQ=; b=b4izc26puqsPYrGND3iwWeujcwm/X9ZjhJ1OCZWqGDTmCXVwFLhD4J3+gze9LbWhZc iBN+ZtDpTQTPQ1TyoVt3fzxI9wDzAmGB29b5VKRRHwaBep9ohRqBxwODmKN+99VZackE FHRVEedMP1onuQhz9UseIufl4ATsaX+4edrF4Qp4KDfU4NW6j70bRxXQADV7uOoY9n8N nd27ooAC9a+5dkU7Fa42T8t86RCQ4UGFBRCwWF6lFDHyuOOP1YrwQBQ1Og95WHOBMK+C JnNyaVIQU6zCE7Sz2B/QbnELLlkkZsT7MAlW27TUYsqIuw9nSuryD1+kK/ymRIC8nO4I oegQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710166351; x=1710771151; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tGqfMLj68zV4QYB0uesNdYqp81X62zcg2nmph+fkNLQ=; b=oCBxI+ArGSAZNgqcV5judyaAlpTXYPDlHj2XWpup3kQnwdDIXaJfrWAk8cGCWbmLCk bavzPv/eQ35h7BSvqX7hVNGHQiIzOVmB1zjp/dKh4iOpv7FcUQ3OYDRc4BDpFbylsmNU T87Cz58RLbZWDPG9itPOqdTqpG4egGTnWnE7lzhUSMRd6jb7OzSf7g0upnUExZUyU5A0 T0AoZeioNIzTcm6J6dqIXGkwnkNIGWQVYWaNvjt3Ex5/NeA7z2jBg7ymQuifQc1HpiIi N/YYMxiXue4DBPwtFa9TUw1hl7tElG3jPdnNRZaDmPqCUHQ5FFqJHI4fDaDK5f6LZEyR dUGg== X-Forwarded-Encrypted: i=1; AJvYcCUOckR63YZv1IJOwx5osKXVDm6zfTfeVtC+fardbbsDiREuabYMF4+IUfKZU/vSS+MJZHnYgLPlJi8NbPQQvJCVDLrKPBRb X-Gm-Message-State: AOJu0YwAgtegFB2FHmGcHUQuyxeobIZhX2bGvSuavDv3/JW/jUF2NGe3 Y5VqD3u+1hcjKjpWz5/Nqgr5itHFh5W7asndlFuS4FmwTikXMK5UTABBkMjhE03DVqnqeHseln1 l4dA= X-Google-Smtp-Source: AGHT+IGv/UO+y536rcu5Pt1opdzuMvWULQFbRmxnXvsT/KYgcNTaWIUMZPJHXoYy8ixzjKVsCLJOEw== X-Received: by 2002:a17:907:d40d:b0:a46:17dd:33da with SMTP id vi13-20020a170907d40d00b00a4617dd33damr3853059ejc.29.1710166350938; Mon, 11 Mar 2024 07:12:30 -0700 (PDT) Received: from sleipner.berto.se (p4fcc8c6a.dip0.t-ipconnect.de. [79.204.140.106]) by smtp.googlemail.com with ESMTPSA id kn11-20020a170906aa4b00b00a45efdfdd1esm2863154ejb.40.2024.03.11.07.12.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 07:12:30 -0700 (PDT) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Claudiu Beznea , Yoshihiro Shimoda , Biju Das , netdev@vger.kernel.org, devicetree@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [net-next,v3 2/2] ravb: Add support for an optional MDIO mode Date: Mon, 11 Mar 2024 15:11:06 +0100 Message-ID: <20240311141106.3200743-3-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240311141106.3200743-1-niklas.soderlund+renesas@ragnatech.se> References: <20240311141106.3200743-1-niklas.soderlund+renesas@ragnatech.se> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The driver used the DT node of the device itself when registering the MDIO bus. While this works, it creates a problem: it forces any MDIO bus properties to also be set on the devices DT node. This mixes the properties of two distinctly different things and is confusing. This change adds support for an optional mdio node to be defined as a child to the device DT node. The child node can then be used to describe MDIO bus properties that the MDIO core can act on when registering the bus. If no mdio child node is found the driver fallback to the old behavior and register the MDIO bus using the device DT node. This change is backward compatible with old bindings in use. Signed-off-by: Niklas Söderlund Reviewed-by: Sergey Shtylyov Reviewed-by: Andrew Lunn --- * Changes since v2 - Use DT node instead of OF ode in commit message. - Update punctuation in commit message. - Simplify the node selection in the driver. --- drivers/net/ethernet/renesas/ravb_main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index fa48ff4aba2d..b6adf608ebfa 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2564,6 +2564,7 @@ static int ravb_mdio_init(struct ravb_private *priv) { struct platform_device *pdev = priv->pdev; struct device *dev = &pdev->dev; + struct device_node *mdio_node; struct phy_device *phydev; struct device_node *pn; int error; @@ -2583,7 +2584,13 @@ static int ravb_mdio_init(struct ravb_private *priv) pdev->name, pdev->id); /* Register MDIO bus */ - error = of_mdiobus_register(priv->mii_bus, dev->of_node); + mdio_node = of_get_child_by_name(dev->of_node, "mdio"); + if (!mdio_node) { + /* backwards compatibility for DT lacking mdio subnode */ + mdio_node = of_node_get(dev->of_node); + } + error = of_mdiobus_register(priv->mii_bus, mdio_node); + of_node_put(mdio_node); if (error) goto out_free_bus;