From patchwork Sat Mar 9 15:53:33 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: 13587713 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (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 CD88045946 for ; Sat, 9 Mar 2024 15:55:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709999703; cv=none; b=SU44Uov8LwWX1wUUX7FjB+HEYY8ySga9j07SGfEhOyURxReTH4bIgLg60DlQMV6vW1yHP/qKMD2HeDY2VnS1O2zONIkBxtDWbc4ZpqsGgoovN17ckVgq1gZ8i1UbC8SsPJIMmyxvnshIj/7Y41NaHfXG0LP14sny+jtR7zMCidI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709999703; c=relaxed/simple; bh=Yb7xqfxkqIWBKsuccsmy/XJ/urgpuY06bYi+GcfXOxw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Iuk8uv/uHjLyAuEwQsP0/DsKos70jjjmIGDB9yvk8GMivQU9dWP9mQVv6bYxkYJcbBSDIuB2WV0L+US+K8oX3Q1rH6vyfdgvGjyqeHfe8XFLRrLVfAQusJ5J3/eivUINRcMxw1l2IEdMgtMZy3JogN4VqfXy2tFeiqWh+jbcpE0= 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=q2g6ZfcN; arc=none smtp.client-ip=209.85.167.49 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="q2g6ZfcN" Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-5135e8262e4so3591472e87.0 for ; Sat, 09 Mar 2024 07:55:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; s=google; t=1709999700; x=1710604500; 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=cHQfOk2RYffRyoIaOuuITCWN0JusXcRRtkVr9gcihOQ=; b=q2g6ZfcNk/A9EET57koxLJahfGpGPqnCbSFeQoZHq8Cr8VOIwAwSQB8EA6KCt0iGAS fPNk+q1bt7TdDiT3CFQhOjaXA4DR9pOL9uCjSKyzSzbPQDlW7olJfxXqxQbsO7v2UR7L U0zVBUrq72Axxpz4POwfifbIBQLSQEGh6uJoWJqo9MrgfYtOnrvlgYbMHvfACkGSAo6W QMY6/YiJ4d23lDFYTVLnnr3X1D5g/r0NWGuqpxu63QlX5PXhzMQLpvhnzcPOGQ1PoQ4x TRvEmB/WnUOvbxpY2iUJJ1EL/BZBJXipwcuOxQM4K+bZgamwbd9RFYM+MC5x+SaBn1Ks HZBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709999700; x=1710604500; 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=cHQfOk2RYffRyoIaOuuITCWN0JusXcRRtkVr9gcihOQ=; b=CpZR1Z/qAKfDMdZsmNjIV44CQvEM/YdrtxN5JNCHtRg8KBhePZNiyMG+lZpUFBEul6 Re97HM5pPAwScg1l0N2pjJzquh7+uuM9sY/eDMzNvyxWPFD7F0FNlFyPu8LwhOc2BUb+ rT/AlOY7fsZ4yslLK4bSgoRRYuP4SAHpyBERoKrNOkLW878DOyxffZAR4/POH2gTWp5v zY4tVHwEOonpmYuSRMFW8KXLvAO+S9wBuDxLnGPsXTZY8zIpVOB/12bHiS9y6EQyIiVe G40E/OSXcNPlUbD+Luf2dKyFqVF/B/khzxjAxTPtFRviQfypbbGh02b40ULsrr80FiZy 8dGQ== X-Forwarded-Encrypted: i=1; AJvYcCXAKPAnFQdQSg9zx0CmiGWCJ4PdT38Gpl008K3I3Fa+QAizFMq808Gisk+ArGgb8PDo/72wxCPwXMVSjNxIu36ViuIVaOb/ X-Gm-Message-State: AOJu0YywLU96xTdv7JcxXGZXGg0B+FfIG83kJBvJivu2X3E3tDfVAsdC RwyLytPVg62h03HY6p4JOVWsS2dXh30/Bq7Ab0DotmgdtTc1KkNPpdthg5kTdsM= X-Google-Smtp-Source: AGHT+IEGpwRFUsYP1yOBMH/siZGRb/1f1wruXZpRcTIQkJN98y3teQ0M8v2/iPX79mn198Vd/9PanQ== X-Received: by 2002:a05:6512:3b8e:b0:513:9ae1:46f4 with SMTP id g14-20020a0565123b8e00b005139ae146f4mr1877134lfv.49.1709999699910; Sat, 09 Mar 2024 07:54:59 -0800 (PST) Received: from sleipner.berto.se (p4fcc8c6a.dip0.t-ipconnect.de. [79.204.140.106]) by smtp.googlemail.com with ESMTPSA id kq17-20020a170906abd100b00a40f7ed6cb9sm1005216ejb.4.2024.03.09.07.54.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 07:54:59 -0800 (PST) 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 1/2] dt-bindings: net: renesas,etheravb: Add optional MDIO bus node Date: Sat, 9 Mar 2024 16:53:33 +0100 Message-ID: <20240309155334.1310262-2-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240309155334.1310262-1-niklas.soderlund+renesas@ragnatech.se> References: <20240309155334.1310262-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 --- Documentation/devicetree/bindings/net/renesas,etheravb.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/net/renesas,etheravb.yaml b/Documentation/devicetree/bindings/net/renesas,etheravb.yaml index de7ba7f345a9..5345ad8e1be4 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: From patchwork Sat Mar 9 15:53:34 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: 13587714 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (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 867AA4594C for ; Sat, 9 Mar 2024 15:55:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709999704; cv=none; b=vBj1gzh7MdNO/E6RNgAcJJOUOwCMutKMbSJyZkV3szL2OCLuSZiT2uwCkI7p1sZVpTjpV+Ohd9t1QNeDB0sVSWRKNaaEioMyW+UbCImupWilFnwY+0xj3bfBqYgGoJLzyy3Qes2gyDDw3Eqcaqja02QQeHs1aslHYkM/1VRGcmo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709999704; c=relaxed/simple; bh=oxb58H+3dJL1CUmBT7+dL71n3m5oVb4JbCJojOpkuYI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JVfRBZHw3bxG3yth90wPPgqcwREoZxRj1TG5NXGppSlNnPusaymwiTnMqWWkPCnnUd524Vd2cV9WEJW+Lw4l5TbVb1gG4aW1FCuz8fmEIhgL0KYV3ElrjA+yCODZIE6YdhveqoBuINPDpj0YGCbSQKkHiqSmcLDpCqVXLqGq//Q= 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=heZy+aDX; arc=none smtp.client-ip=209.85.208.48 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="heZy+aDX" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-5683576ea18so1488604a12.3 for ; Sat, 09 Mar 2024 07:55:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; s=google; t=1709999701; x=1710604501; 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=ZLBg9xRWeOEFGDBrQs7OucUs0Od0oeREZgUIErgurhk=; b=heZy+aDXlJeGbKVWKYgYdQT8r/MrQSG2MRcfUTnMwMntU1BZCwnBrnVizOKvHmdeev J3e4qE4X73ZFlD8fyXEX9AeR5tDwkfNWKyAS0MadIyhU9zoj4+gXrLFs86I0RqV00cFQ LyaEbe3CC1Ek0z3DoIZ3f62CX4icO1UTpk4J3KX+bctWyaURlUeg7O0igVy2pvQh0AWd LvKc00yZwcoIMu+tY4fFnnJipNOKZirT6m2RRawmb/dYkSNSUqCP+VOYYxhSLzEJH8dj cJcGDu/hGS+i9tNP5d3/OZbxzmkvoht/quqatTXLJ6RZ1oEDs+qmDmIsXYnpOAiDG7WQ GnNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709999701; x=1710604501; 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=ZLBg9xRWeOEFGDBrQs7OucUs0Od0oeREZgUIErgurhk=; b=CmexaOWbNG+Z68ECgTsMDL+tnfdRlnZR/d0yTiu3dNrFxV2YoS9cbzO2aLLWC2aXuX 5jPogn2vCFK/cSDnb6rM5Wpt1Lrqwx8tN5qnJEh4UUlNVfxHp8pRlQ3qaL/ozdqXpaEr uozVOz2/r8SOkdNeRVnU7J0lnQiKjjcW9Brb2ycsKVDIFlsn85F1w/X49yGXp/XeHy4H tdRzvEbc4QoJsUoElEa8MbWVApnanl9VyNUH27fGJ1zznxcZAG8MlFgqke0XtJer9BQK 33BXp4bYOzRvUdJuGiqjD6BFC9gC9mVaCP+9Zb7Sr7s3cwNLIGDoVzJIrDmiDNX3M4TB qdgw== X-Forwarded-Encrypted: i=1; AJvYcCW5c0xBSgkeX+8fzs4CrO/PtKIN8xSbMNB3EPSwhuBOzyL6p4mM/iFEOgoo6qwps2IsqGYR8H99Jg6mjs5FNNe0QI8Xr4qR X-Gm-Message-State: AOJu0YygQtIQm0ceXP5GyMHo3mYcJi0VUt5HXCZ8gvPi/f830zO+Ox45 B8VvflN2pENsjv5fXWBeJ/fXSEOQWFofW1ez9e5WGAz27v6mGlyGN4ooyOGZq/c= X-Google-Smtp-Source: AGHT+IHFKrKh+q85JxwpYDVCMdheOuNJVT349n5QNXE4KZnL8RYGyBx+xA62cTryxrHnY6Xf4F1XTw== X-Received: by 2002:a17:906:c183:b0:a44:2ba0:8200 with SMTP id g3-20020a170906c18300b00a442ba08200mr1106169ejz.26.1709999700834; Sat, 09 Mar 2024 07:55:00 -0800 (PST) Received: from sleipner.berto.se (p4fcc8c6a.dip0.t-ipconnect.de. [79.204.140.106]) by smtp.googlemail.com with ESMTPSA id kq17-20020a170906abd100b00a40f7ed6cb9sm1005216ejb.4.2024.03.09.07.55.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 07:55:00 -0800 (PST) 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 2/2] ravb: Add support for an optional MDIO mode Date: Sat, 9 Mar 2024 16:53:34 +0100 Message-ID: <20240309155334.1310262-3-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240309155334.1310262-1-niklas.soderlund+renesas@ragnatech.se> References: <20240309155334.1310262-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 OF 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 OF 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 OF 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 OF node. This change is backward compatible with old bindings in use. Signed-off-by: Niklas Söderlund Reviewed-by: Sergey Shtylyov --- drivers/net/ethernet/renesas/ravb_main.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index fa48ff4aba2d..b62f765ce066 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; @@ -2582,8 +2583,20 @@ static int ravb_mdio_init(struct ravb_private *priv) snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", pdev->name, pdev->id); - /* Register MDIO bus */ - error = of_mdiobus_register(priv->mii_bus, dev->of_node); + /* Register MDIO bus + * + * Look for a mdio child node, if it exist use it when registering the + * MDIO bus. If no node is found fallback to old behavior and use the + * device OF node. This is used to be able to describe MDIO bus + * properties that are consumed when registering the MDIO bus. + */ + mdio_node = of_get_child_by_name(dev->of_node, "mdio"); + if (mdio_node) { + error = of_mdiobus_register(priv->mii_bus, mdio_node); + of_node_put(mdio_node); + } else { + error = of_mdiobus_register(priv->mii_bus, dev->of_node); + } if (error) goto out_free_bus;