From patchwork Sun Mar 14 12:14:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452662 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=kyeNyE9M; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dyz670d6Mz9sRR for ; Sun, 14 Mar 2021 23:15:43 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F263D828DC; Sun, 14 Mar 2021 13:15:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kyeNyE9M"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0C02082829; Sun, 14 Mar 2021 13:15:24 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8CE8382829 for ; Sun, 14 Mar 2021 13:15:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pj1-x1036.google.com with SMTP id ha17so6604371pjb.2 for ; Sun, 14 Mar 2021 05:15:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RVSoLgX1KjlsudZs2k8Si4ZBOBwzGlsm43NzXSY9PwI=; b=kyeNyE9MNfQ1l4zcJpMyYNaSSv5rk8sOC8CINDuB8Uod0G6vz9yUK/evo2Vak6MGON qtyF38zCyPM+Bw5/3zxeuC8zvAOWYm0bTNhUERPJko3zkQXrxzCORRpIuRHN+b4XSgmJ oE05daOWPA9IWhG47DvcnRsx2llggh5IfK5UpctW6RqEC7hyW/h09Bzng3k2dUzp5ctF RTXStfWmn4JMnmQcnS4BcLU6K+pr4B/NTjfShYJvcHQ23N+rHQqenMQY4VqMD1PcuBVe vhMl470AhR5069OzecxBSeTyShChkukJmL5959cAidwyUHuQ5CmFhGqdzYBNR8HlSzj5 io+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RVSoLgX1KjlsudZs2k8Si4ZBOBwzGlsm43NzXSY9PwI=; b=pPugiw/oedR2qf7LRZygLTybNMitHOiWA+lnL/4+824oJ/fl5jQm3U7v59FLPepHA1 X8+/iQ96kMSENQCwwgv2dcKj037b+YdAt2WKyH4k6Qis0v1LD6ckwhnNVegLDbvsxt8F c4MpjhzLlRa9MUeJkYU46/bH3Vb8zZ6KnrC9sAVzGqNiPwyKqLH9+49tdPGa6VhGTJpu LcqI62Wrt/MebZ+8rlbTTuBVTvGxfxPwCR2tN9h0ibHq13kXg9ZuZ70TIBMbimVg8DLW lL1SRsSOQs8m3Fko9g0tAWBi64tw0Nb2VOePOQ0zDUidLTm/+i9mibhOFlohwdVLpWSJ CDVA== X-Gm-Message-State: AOAM5313sWkCA3lVo/4BuZlIS8ZNDByfwdB8DbgPrgb7Pezg0gHPn/r6 4lL+2ZAupFUWLw8TOjpp4xs= X-Google-Smtp-Source: ABdhPJxr6mFv9933nYzl0idUFFQT6/Jvuoc5bRA2214niHai/mo3QCuYuCguBLdTUpEK90Rh5d6f/Q== X-Received: by 2002:a17:902:da8d:b029:e5:c7d9:81f2 with SMTP id j13-20020a170902da8db02900e5c7d981f2mr6733078plx.21.1615724118964; Sun, 14 Mar 2021 05:15:18 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.15.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:15:18 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 01/22] dt-bindings: net: Add the old DT bindings for "fixed-link" Date: Sun, 14 Mar 2021 20:14:45 +0800 Message-Id: <20210314121506.18303-2-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean Per the upstream Linux kernel doc: Documentation/devicetree/bindings/net/ethernet-controller.yaml There are two ways to describe a fixed PHY attached to an Ethernet device. This updates our dt-bindings doc to add the old DT bindings. Signed-off-by: Bin Meng Reviewed-by: Ramon Fried Reviewed-by: Vladimir Oltean --- (no changes since v3) Changes in v3: - mention that U-Boot deliberately ignores the 'phy_id' and unconditionally uses PHY_FIXED_ID doc/device-tree-bindings/net/fixed-link.txt | 48 +++++++++++++++------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/doc/device-tree-bindings/net/fixed-link.txt b/doc/device-tree-bindings/net/fixed-link.txt index 5829bd81a2..5efeeb6fc5 100644 --- a/doc/device-tree-bindings/net/fixed-link.txt +++ b/doc/device-tree-bindings/net/fixed-link.txt @@ -5,21 +5,37 @@ Some Ethernet MACs have a "fixed link", and are not connected to a normal MDIO-managed PHY device. For those situations, a Device Tree binding allows to describe a "fixed link". -Such a fixed link situation is described by creating a 'fixed-link' -sub-node of the Ethernet MAC device node, with the following -properties: - -* 'speed' (integer, mandatory), to indicate the link speed. Accepted - values are 10, 100 and 1000 -* 'full-duplex' (boolean, optional), to indicate that full duplex is - used. When absent, half duplex is assumed. -* 'pause' (boolean, optional), to indicate that pause should be - enabled. -* 'asym-pause' (boolean, optional), to indicate that asym_pause should - be enabled. +Note there are two ways to describe a fixed PHY attached to an +Ethernet device: + +- The new DT binding, where 'fixed-link' is a sub-node of the Ethernet + MAC device node, with the following properties: + + * 'speed' (integer, mandatory), to indicate the link speed. Accepted + values are 10, 100 and 1000 + * 'full-duplex' (boolean, optional), to indicate that full duplex is + used. When absent, half duplex is assumed. + * 'pause' (boolean, optional), to indicate that pause should be + enabled. + * 'asym-pause' (boolean, optional), to indicate that asym_pause should + be enabled. + +- The old DT binding, where 'fixed-link' is a property with 5 cells + encoding various information about the fixed PHY, in the form of + . + + * 'phy_id', emulated PHY ID, choose any but unique to the all specified + fixed-links. Note U-Boot deliberately ignores the 'phy_id' and + unconditionally uses PHY_FIXED_ID. + * 'full-duplex', 0 for half duplex or 1 for full duplex + * 'speed', link speed in Mbits/sec, accepts only 10, 100 and 1000 + * 'pause', 0 for no pause, 1 for pause + * 'asym-pause', 0 for no asymmetric pause, 1 for asymmetric pause Examples: +The new binding: + ethernet@0 { ... fixed-link { @@ -28,3 +44,11 @@ ethernet@0 { }; ... }; + +The old binding: + +ethernet@0 { + ... + fixed-link = <0 1 1000 0 0>; + ... +}; From patchwork Sun Mar 14 12:14:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452663 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=vTHtK3Og; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dyz6Q0SGBz9sRf for ; Sun, 14 Mar 2021 23:15:57 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 52B26828F4; Sun, 14 Mar 2021 13:15:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vTHtK3Og"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 34CD9828EE; Sun, 14 Mar 2021 13:15:28 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 70F848289F for ; Sun, 14 Mar 2021 13:15:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pg1-x531.google.com with SMTP id g4so18821794pgj.0 for ; Sun, 14 Mar 2021 05:15:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FMBGJUnmse/SpfzI5O5WhChVgJhE3Ev2Wz/8ipaMRyU=; b=vTHtK3Og2nSk4twPX52Z5xFCh0d2cfKz4ual/5JbNnRBy50hz8A8Q9N6cmnnVGQ3zI mdhlanuSOtYKxKukRWNak7NwlHvuxHXM5xBh2/VuEzvxQTu++lX1tgFcMkD9RjWG0Apc B9RBje/mygjhCpoq+NVSpr6OHCU+JTW4BKFUWpoZOUR1rE+9N7nJNQx8bU6l/B5oGEx0 BHwam/h7+VML921XNwargc14/SJp/q+tnrUUvGFcKc75RZ+KMxG8V+g92O56BClyrXlC wB2/86sMl5kKvNWY4TfB81lTpxf0F70Hw+w1FP/TvSKLMoZiRHTVpOyf+nlt8IuXb9gc i1Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FMBGJUnmse/SpfzI5O5WhChVgJhE3Ev2Wz/8ipaMRyU=; b=VNhDFq+Qmn2y1oEJxaeLc617/rChHAd5rL+kWdP1HvAVX2FPR1JrHLr9dMFTdFA+2p Owslj8csIMsS9izyDrTf9F4afcoTZIEL0V7qOgy0NVfzfWwz+lZDrauZo3gTw7qKm9qA 8kVqKojq6EG2KCjTk5oWZge82S0H/Hzswn76LaCg/bo3Q9gGCSeuzmjTKjP4GFS5/jw2 EWp2qzCWlU5SeBp5Suq4Jo/pF+zEhS2O3TkGKIpPBnbfP2O1RIwWU7fUZHyVqG6JZadH SnLn32ipyyJ8NKJjPsnbgqPpPE8DkqUCnPcS9otu7FvODdLdTlcK6lih09diVOg0uPST JrSw== X-Gm-Message-State: AOAM530eKhwMqZj5tdErt50iUKiC3jpoMpZa7CTz4c+8/u/9jxHGusEe vbRuMn3mUn38FcJ9cZGp/N0= X-Google-Smtp-Source: ABdhPJyDmOi821mm8ngp75keZ392gnmiKeXEAdhmtZgKxgxJXkgIZ9/YdKGB7FX+4/NLMURcmpbhxQ== X-Received: by 2002:a63:1021:: with SMTP id f33mr19241136pgl.409.1615724121799; Sun, 14 Mar 2021 05:15:21 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.15.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:15:21 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 02/22] of: extra: Introduce ofnode_phy_is_fixed_link() API Date: Sun, 14 Mar 2021 20:14:46 +0800 Message-Id: <20210314121506.18303-3-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean Introduce a helper API ofnode_phy_is_fixed_link() to detect whether the ethernet controller connects to a fixed-link pseudo-PHY device. Note there are two ways to describe a fixed PHY attached to an Ethernet device: - the new DT binding, where 'fixed-link' is a sub-node of the Ethernet device - the old DT binding, where 'fixed-link' is a property with 5 cells encoding various information about the fixed PHY Signed-off-by: Bin Meng Reviewed-by: Simon Glass Reviewed-by: Vladimir Oltean --- (no changes since v3) Changes in v3: - update the code logic to prefer the new binding if both new and old bindings exist drivers/core/of_extra.c | 23 +++++++++++++++++++++++ include/dm/of_extra.h | 20 ++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/drivers/core/of_extra.c b/drivers/core/of_extra.c index 653344529e..7702beff97 100644 --- a/drivers/core/of_extra.c +++ b/drivers/core/of_extra.c @@ -130,3 +130,26 @@ int ofnode_decode_memory_region(ofnode config_node, const char *mem_type, return 0; } + +bool ofnode_phy_is_fixed_link(ofnode eth_node, ofnode *phy_node) +{ + ofnode node, subnode; + int len; + + subnode = ofnode_find_subnode(eth_node, "fixed-link"); + if (ofnode_valid(subnode)) { + /* new binding */ + node = subnode; + } else if (ofnode_get_property(eth_node, "fixed-link", &len) && + len == (5 * sizeof(__be32))) { + /* old binding */ + node = eth_node; + } else { + return false; + } + + if (phy_node) + *phy_node = node; + + return true; +} diff --git a/include/dm/of_extra.h b/include/dm/of_extra.h index ca15df21b0..f54f0ed3aa 100644 --- a/include/dm/of_extra.h +++ b/include/dm/of_extra.h @@ -86,4 +86,24 @@ int ofnode_decode_memory_region(ofnode config_node, const char *mem_type, const char *suffix, fdt_addr_t *basep, fdt_size_t *sizep); +/** + * ofnode_phy_is_fixed_link() - Detect fixed-link pseudo-PHY device + * + * This function detects whether the ethernet controller connects to a + * fixed-link pseudo-PHY device. + * + * This function supports the following two DT bindings: + * - the new DT binding, where 'fixed-link' is a sub-node of the + * Ethernet device + * - the old DT binding, where 'fixed-link' is a property with 5 + * cells encoding various information about the fixed PHY + * + * If both new and old bindings exist, the new one is preferred. + * + * @param eth_node ofnode containing the fixed-link subnode/property + * @param phy_node if fixed-link PHY detected, containing the PHY ofnode + * @return true if a fixed-link pseudo-PHY device exists, false otherwise + */ +bool ofnode_phy_is_fixed_link(ofnode eth_node, ofnode *phy_node); + #endif From patchwork Sun Mar 14 12:14:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452664 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=fvVycXtz; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dyz6k4lP9z9sRR for ; Sun, 14 Mar 2021 23:16:14 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 01C6C828FB; Sun, 14 Mar 2021 13:15:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fvVycXtz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0AB4C828F4; Sun, 14 Mar 2021 13:15:30 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2AB7682829 for ; Sun, 14 Mar 2021 13:15:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pl1-x629.google.com with SMTP id w7so10474471pll.8 for ; Sun, 14 Mar 2021 05:15:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/PZkViSsdHxlR8FKPcvfWMw0v2XAUKL/uimPYKmIwkE=; b=fvVycXtzOzk1frij1P5XuMSilSDOfmhgr+2oSaZ4sfkwhritQKZ/3hu1xA81pXUv5k KfBmAdHEPRKfxdGnV6XZIkgfPq13sBI/tisUDtLM6k6UrDreOkpyLPgESxxcscdHI3uq BZ0r1IA2msV5rgwlwkqatrEflEt15cX3n2duQ1hzYUCPhSXh+SIx3n2XLu5DW+/ClwCT BUYrKo+YTR8QquPFpR2NLVJvIFKhR2XkcS1+MmauBxlJIhFpuDKcdG+5ClIsagmx95nV GQDmePG9FYmkckaz1Vxvgtqw6TDys7hP4RJyeUTBow1I1jnX5DOORN8PiXHVLjVPyY7N C1/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/PZkViSsdHxlR8FKPcvfWMw0v2XAUKL/uimPYKmIwkE=; b=nYJUkVXWviH3HbEDPKuX+7g7Cm2HhSk0X8VcgkAw1nVTqoSftqgXC0WB7KYpr43x00 s/SK35DkClhQYeQCIumfuOVpCtkvXdnK9RA5pd0UjLD0XXyRJOJf8gQuHc4LYQjHx2DJ jv8ZvkEtLx7m/xOQkiim7Mp5Cac05dUvNMgd+VoguvvIJ6Z1lBwG+J1H6i2rGX4ZbIKF VLyfurjgVeJkiJBt0F1tgNdkEdFvet5BqqI8bLm9JKGfYsKIM+jGW97O25vXuIdgDFn8 BW/eHmGfGOeVTuk10ewSP55WZ0RjL2KN0KT7TiJMmDl7pzu0eL+ra9hNTdrfzU+4iz0t j4yQ== X-Gm-Message-State: AOAM533lRzy/sTOqHDmoE+7i5meLFHtzZyttMHey8cSZagezloQsxXKK svWzkHtoKZSj8w9zOWZjcb4= X-Google-Smtp-Source: ABdhPJwEgkFzEOmZaPgdhBz6GQe973hCX3mGAZ342aSVJeBZSRnhf6HqtW3DwC4iuYG+0a/CsTo5Sg== X-Received: by 2002:a17:90a:ff0f:: with SMTP id ce15mr7924946pjb.15.1615724124616; Sun, 14 Mar 2021 05:15:24 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.15.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:15:24 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 03/22] dm: mdio: Use ofnode_phy_is_fixed_link() API Date: Sun, 14 Mar 2021 20:14:47 +0800 Message-Id: <20210314121506.18303-4-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean Switch to use the ofnode_phy_is_fixed_link() API which can support both the new and old DT bindings. Signed-off-by: Bin Meng Reviewed-by: Ramon Fried Reviewed-by: Vladimir Oltean --- (no changes since v1) net/mdio-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c index 5da984ca3f..2a9533c88b 100644 --- a/net/mdio-uclass.c +++ b/net/mdio-uclass.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -140,7 +141,7 @@ static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev, int i; if (CONFIG_IS_ENABLED(PHY_FIXED) && - ofnode_valid(dev_read_subnode(ethdev, "fixed-link"))) { + ofnode_phy_is_fixed_link(dev_ofnode(ethdev), NULL)) { phy = phy_connect(NULL, -1, ethdev, interface); goto out; } From patchwork Sun Mar 14 12:14:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452665 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=WGPvrJI7; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dyz6z0P1sz9sRR for ; Sun, 14 Mar 2021 23:16:26 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4A65882903; Sun, 14 Mar 2021 13:15:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="WGPvrJI7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7F371828FB; Sun, 14 Mar 2021 13:15:34 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D3AD6828ED for ; Sun, 14 Mar 2021 13:15:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pj1-x1036.google.com with SMTP id q6-20020a17090a4306b02900c42a012202so13298514pjg.5 for ; Sun, 14 Mar 2021 05:15:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DU/6KRfuEnnxacZY5lNSnmFA/tVGcxoPfM9My7VBn2Q=; b=WGPvrJI7IM98lAA3Ndz5Jn3vnH/jflVlNpb6i8BDtrRWO6TYT4gtKDY+W99JwTnel3 6pssW4reKws4DbH+PL7w9uD8+HxAOiywgGbfzl1DuojhJq88iU06uaA84eBEtC4o4Ayf Tld/yp4Nz4PiLrf+mMN1/jY6iN8N/EBFiIkNQELG2Wlsq+uoB6vhvYZTSO7HnSZRBRV8 jwO6efkiKZK7DTLfTOCKYNNwRk1y85LrQxkUtARsg64c9aAJj43gxFS3Ptz1rWKxF0FQ mvG9/J6Vj+IJMorkbRMhL5L1k39KOPrVYqLq8eGvUSRcohYPTlPvhYsT+pooviq9ax6z gOPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DU/6KRfuEnnxacZY5lNSnmFA/tVGcxoPfM9My7VBn2Q=; b=SIuopDF3pun52tEYydQDmT6ZNe7u+6XGCW+WKKidsWur5yLGg0am4c0iDdokC7VCBN MLo0pHcUGQclhjFvR9nCpHxL545sLhFnKmUmE9P00ohhrFeiVhDaoMl9evTG9eHm5sko w86QLfxQmIgUm8BLVquD1Sw16o6lAR4TovXTxHQWl5CYPmdc/iHsBkFban6Vo7tTqtwM oMapueSp0Y4VSHVAPFb3VXjBSUXrxo1dtsQfRjL8yhwdegtJNQ4fG7FyrnU0E1y3jqPW mryq92GZhdfZHzCWVsMnKtorgKeyTvlcpoeDDFNsHfenv7sbdyCZ61nuJlgmnev0ud5T PpOQ== X-Gm-Message-State: AOAM531n2lmoSe7tzaFkSxbzFWhTLv9Wm79xNjUkw0QqH71dQaKy2rfb hwpJ8q/hqNWE3pfDNaJGJCU= X-Google-Smtp-Source: ABdhPJxOFskAJnW1Jc9qh6JupQvl0o5pqRQlKAU2xrSr/0iQeIfCTdKuAKC3Mkd3as/gJOFFzjZcew== X-Received: by 2002:a17:90b:1213:: with SMTP id gl19mr7720300pjb.55.1615724127485; Sun, 14 Mar 2021 05:15:27 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.15.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:15:27 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 04/22] net: phy: fixed: Be compatible with live OF tree Date: Sun, 14 Mar 2021 20:14:48 +0800 Message-Id: <20210314121506.18303-5-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean From: Vladimir Oltean On systems that use CONFIG_OF_LIVE, the "ofnode" type is defined as const struct device_node *np, while on the flat DT systems it is defined as a long of_offset into gd->fdt_blob. It is desirable that the fixed PHY driver uses the higher-level ofnode abstraction instead of parsing gd->fdt_blob directly, because that enables it to work on live OF systems. The fixed PHY driver has used a nasty hack since its introduction in commit db40c1aa1c10 ("drivers/net/phy: add fixed-phy / fixed-link support"), which is to pass the long gd->fdt_blob offset inside int phydev->addr (a value that normally holds the MDIO bus address at which the PHY responds). Even ignoring the fact that the types were already mismatched leading to a potential truncation (flat OF offset was supposed to be a long and not an int), we really cannot extend this hack any longer, because there's no way an int will hold the other representation of ofnode, the struct device_node *np. So we unfortunately need to do the right thing, which is to use the framework introduced by Grygorii Strashko in commit eef0b8a930d1 ("net: phy: add ofnode node to struct phy_device"). This will populate phydev->node for the fixed PHY. Note that phydev->node will not be valid in the probe function, since that is called synchronously from phy_device_create and we really have no way of passing the ofnode directly through the phy_device_create API. So we do what other drivers do too: we move the OF parsing logic from the .probe to the .config method of the PHY driver. The new function will be called at phy_config() time. I do believe I've converted all the possible call paths for creating a PHY with PHY_FIXED_ID, so there is really no reason to maintain compatibility with the old logic of retrieving a flat OF tree offset from phydev->addr. We just pass 0 to phydev->addr now. Signed-off-by: Vladimir Oltean Reviewed-by: Bin Meng Tested-by: Bin Meng Message-Id: <20210216224804.3355044-2-olteanv@gmail.com> [bmeng: keep fixedphy_probe(); update mdio-uclass.c to handle fixed phy] Signed-off-by: Bin Meng Reviewed-by: Vladimir Oltean --- (no changes since v1) drivers/net/phy/fixed.c | 26 +++++++++++++++++--------- drivers/net/phy/phy.c | 30 +++++++++++++++--------------- net/mdio-uclass.c | 6 ++++-- 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index 1a38c29469..11342df1c5 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c @@ -17,13 +17,23 @@ DECLARE_GLOBAL_DATA_PTR; int fixedphy_probe(struct phy_device *phydev) { + /* fixed-link phy must not be reset by core phy code */ + phydev->flags |= PHY_FLAG_BROKEN_RESET; + + return 0; +} + +int fixedphy_config(struct phy_device *phydev) +{ + ofnode node = phy_get_ofnode(phydev); struct fixed_link *priv; - int ofnode = phydev->addr; u32 val; + if (!ofnode_valid(node)) + return -EINVAL; + /* check for mandatory properties within fixed-link node */ - val = fdt_getprop_u32_default_node(gd->fdt_blob, - ofnode, 0, "speed", 0); + val = ofnode_read_u32_default(node, "speed", 0); if (val != SPEED_10 && val != SPEED_100 && val != SPEED_1000 && val != SPEED_2500 && val != SPEED_10000) { printf("ERROR: no/invalid speed given in fixed-link node!"); @@ -38,12 +48,9 @@ int fixedphy_probe(struct phy_device *phydev) phydev->priv = priv; priv->link_speed = val; - priv->duplex = fdtdec_get_bool(gd->fdt_blob, ofnode, "full-duplex"); - priv->pause = fdtdec_get_bool(gd->fdt_blob, ofnode, "pause"); - priv->asym_pause = fdtdec_get_bool(gd->fdt_blob, ofnode, "asym-pause"); - - /* fixed-link phy must not be reset by core phy code */ - phydev->flags |= PHY_FLAG_BROKEN_RESET; + priv->duplex = ofnode_read_bool(node, "full-duplex"); + priv->pause = ofnode_read_bool(node, "pause"); + priv->asym_pause = ofnode_read_bool(node, "asym-pause"); return 0; } @@ -72,6 +79,7 @@ static struct phy_driver fixedphy_driver = { .name = "Fixed PHY", .features = PHY_GBIT_FEATURES | SUPPORTED_MII, .probe = fixedphy_probe, + .config = fixedphy_config, .startup = fixedphy_startup, .shutdown = fixedphy_shutdown, }; diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 89e3076bfd..2feb559bba 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -988,6 +988,7 @@ static struct phy_device *phy_connect_gmii2rgmii(struct mii_dev *bus, struct phy_device *fixed_phy_create(ofnode node) { phy_interface_t interface = PHY_INTERFACE_MODE_NONE; + struct phy_device *phydev; const char *if_str; ofnode subnode; @@ -1004,8 +1005,11 @@ struct phy_device *fixed_phy_create(ofnode node) return NULL; } - return phy_device_create(NULL, ofnode_to_offset(subnode), PHY_FIXED_ID, - false, interface); + phydev = phy_device_create(NULL, 0, PHY_FIXED_ID, false, interface); + if (phydev) + phydev->node = subnode; + + return phydev; } #ifdef CONFIG_DM_ETH @@ -1018,20 +1022,16 @@ static struct phy_device *phy_connect_fixed(struct mii_dev *bus, phy_interface_t interface) #endif { - struct phy_device *phydev = NULL; - int sn; - const char *name; + ofnode node = dev_ofnode(dev), subnode; + struct phy_device *phydev; - sn = fdt_first_subnode(gd->fdt_blob, dev_of_offset(dev)); - while (sn > 0) { - name = fdt_get_name(gd->fdt_blob, sn, NULL); - if (name && strcmp(name, "fixed-link") == 0) { - phydev = phy_device_create(bus, sn, PHY_FIXED_ID, false, - interface); - break; - } - sn = fdt_next_subnode(gd->fdt_blob, sn); - } + subnode = ofnode_find_subnode(node, "fixed-link"); + if (!ofnode_valid(subnode)) + return NULL; + + phydev = phy_device_create(bus, 0, PHY_FIXED_ID, false, interface); + if (phydev) + phydev->node = subnode; return phydev; } diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c index 2a9533c88b..1b687765b8 100644 --- a/net/mdio-uclass.c +++ b/net/mdio-uclass.c @@ -138,11 +138,13 @@ static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev, struct udevice *mdiodev; struct phy_device *phy; struct ofnode_phandle_args phandle = {.node = ofnode_null()}; + ofnode phynode; int i; if (CONFIG_IS_ENABLED(PHY_FIXED) && - ofnode_phy_is_fixed_link(dev_ofnode(ethdev), NULL)) { - phy = phy_connect(NULL, -1, ethdev, interface); + ofnode_phy_is_fixed_link(dev_ofnode(ethdev), &phynode)) { + phy = phy_connect(NULL, 0, ethdev, interface); + phandle.node = phynode; goto out; } From patchwork Sun Mar 14 12:14:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452666 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=p1VtyEgY; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dyz7G45PNz9sRR for ; Sun, 14 Mar 2021 23:16:42 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9F4A18290C; Sun, 14 Mar 2021 13:15:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="p1VtyEgY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2B562828F8; Sun, 14 Mar 2021 13:15:35 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C1A5F82829 for ; Sun, 14 Mar 2021 13:15:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pj1-x1036.google.com with SMTP id t18so7356177pjs.3 for ; Sun, 14 Mar 2021 05:15:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tfBc5S+030mhhJ6nyq+s6ESztXYzmxR5YOGahX9rVug=; b=p1VtyEgYDGJmTkuxUYGI5HZXb4H0ijKZPDlJyuWKqlVYicQX0iIlECxyAKz5H+JPOl Sey8HajgPFZYHSlgYjhT/6SDEYacK9Vokwt5CrECR26fEGKMwV75r67vG+tTeVlHSmvP dU9KkEMuJ7XPw8QQjubV6DihDzg4LLmCCw944qlZ3v8T3I82ZRKrwm312Z+ym2Fs5+2d dqDWqwMZV3JFVf7VhzZ1XbjSzlpxhhIo56HnrtmXqd8uPbxPT7KqKq5BZO0+Yi3jaFtM qWltgraHj9gdpfxlY322YacJfS5IUh4Rda6/dpwR5alOouuCiXM/H11LhgjrrfbZKUzv Y4fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tfBc5S+030mhhJ6nyq+s6ESztXYzmxR5YOGahX9rVug=; b=Xx5DVmVzaHXXjgWI5cBuyT9R9xvigOjktxm1B9gW/kADY0eteQ89dTfW3ZjUmrZcSR kNDxa2vYzszCk80rcCPu037RiQWPYuX7fP5ryMMUlPPvtAhE06f46rzp2v9n2JrBvfqA RIDnNAvhMFXwWA9CaKaQdcnJCqib2FSVIH6kzq+0J24yG1lEp+BAiexpSYkPBemTgUxT qlgEyCn7oVtjqIOoTFnyySZOeDjHjyq3rahCnkHl5xTNoOGyQifMUqho9BHOMZO3SWRk qQj1rW8NK+50l/121aPCk7cdgVn0SvhbIJTsDBPJUsf6cg8J5p3UJ0mP/9KYAYSUDso4 tBHw== X-Gm-Message-State: AOAM531KJKnEZOksR1khN6EhnSdsJHTK+oHqVglfMNAPWo1vaQLHAcxT oq/vHhumD9tGPfFjDdQk/xnwX3TFZYg= X-Google-Smtp-Source: ABdhPJySUKAlzAqKfiZFJ5eOqs5fm00k1/0vxapveT0mZK5CmLjfhMcfdBF35TPm2DULg4y7LlwpvQ== X-Received: by 2002:a17:90a:ea96:: with SMTP id h22mr7644154pjz.24.1615724130451; Sun, 14 Mar 2021 05:15:30 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.15.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:15:30 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 05/22] net: phy: fixed: Drop #ifdef CONFIG_DM_ETH around phy_connect_fixed Date: Sun, 14 Mar 2021 20:14:49 +0800 Message-Id: <20210314121506.18303-6-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean From: Vladimir Oltean In drivers/net/phy/Kconfig, CONFIG_PHY_FIXED already depends on CONFIG_DM_ETH, so the function prototype definition when CONFIG_DM_ETH=n does nothing, so it can be dropped. It is also never reachable, since the whole function is already under #ifdef CONFIG_PHY_FIXED (which again, as I said, depends on CONFIG_DM_ETH=y). Signed-off-by: Vladimir Oltean Reviewed-by: Bin Meng Tested-by: Bin Meng Message-Id: <20210216224804.3355044-3-olteanv@gmail.com> Signed-off-by: Bin Meng Reviewed-by: Vladimir Oltean --- (no changes since v1) drivers/net/phy/phy.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 2feb559bba..eae40cc0d6 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1012,15 +1012,9 @@ struct phy_device *fixed_phy_create(ofnode node) return phydev; } -#ifdef CONFIG_DM_ETH static struct phy_device *phy_connect_fixed(struct mii_dev *bus, struct udevice *dev, phy_interface_t interface) -#else -static struct phy_device *phy_connect_fixed(struct mii_dev *bus, - struct eth_device *dev, - phy_interface_t interface) -#endif { ofnode node = dev_ofnode(dev), subnode; struct phy_device *phydev; From patchwork Sun Mar 14 12:14:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452668 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=G5cMDg8U; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dyz7Z2zthz9sRR for ; Sun, 14 Mar 2021 23:16:57 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E437C82925; Sun, 14 Mar 2021 13:15:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="G5cMDg8U"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1B33F82903; Sun, 14 Mar 2021 13:15:39 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5C79682829 for ; Sun, 14 Mar 2021 13:15:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pg1-x52d.google.com with SMTP id n9so17854270pgi.7 for ; Sun, 14 Mar 2021 05:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TzmSu4QwjqNfgONan/MLRgnFyxZQAEHRggr5DkvIo14=; b=G5cMDg8UEpgWfgL8WiSSX0Uc/rTkF8cpIVUK5+Q3xNHks3L66n7GDikUaoKJiEHUu4 qUfe5sT/CvRGtzFh4cSH1ApN9GHVEIhA+ssQRCgpe6Zjcogc+ifSwtTUgDdCPnHkViL7 TBwFrYdw+Y6R+bA+/3wyYyNNOBZ2U28HhLLmhwsY6QxIYFZYwNOPwWexxAGgJHwGYeKY 7aSAYQmkDHAYj3uI9hb7hk19hU7S7N/rtMU6RDjdAYHW4sfQ4HXHzDwREVkPbJAXNTTk 60wPb4YZRjAcPokoiIqZar8k20TG1/dXgEIvi5vdmcV5AaMBayds2Omci93ilaW3CQYf +5uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TzmSu4QwjqNfgONan/MLRgnFyxZQAEHRggr5DkvIo14=; b=lfcX1mdKGqC3DLGT3myO94mCHU6uwhdpLPITI1DeW/bRVKBFh/mGeWAUp0e1o9k9v2 qzFFIvUGmN0fxCsPRdrUTBTV/fqF7A0vIOF/zBHGnS9h7TMoJBXd+hfDvtm9V2b/npDn UYJvsLsl5wr7TxiYLmGZpK+0ad6iublNbkL/uLVbnvmjhwwmEPRiTVw2P+qZoRU7BS03 2hGGrNuGfCv7Vewqum8TIzn4vTLACz2Znd7EB3Ld34tD7jkvu6B44M+f7MD3dZD7BAAu giuvCEBR0N3djOY9C6B9W7x/hjIkHDQw3fwfU6fSEKwYVlIJxpvtwv9+9N1VJcpG5jGv PUMw== X-Gm-Message-State: AOAM532kSbLkw9eOWlZK12vJzGz/RffJ5BXwyCgLo2/7jlQNzMP14Gd/ 4K9Go4NRB4Sg/CAZzXT+j7s= X-Google-Smtp-Source: ABdhPJzEsk8CoQoIlsPAtKwVknxtKHjPdGjj9riOaInfn2EAjNMivzJTjZYPjmZkiuBthjgR1zJQGg== X-Received: by 2002:a62:8ccc:0:b029:1f6:c5e2:69ff with SMTP id m195-20020a628ccc0000b02901f6c5e269ffmr6463963pfd.46.1615724133934; Sun, 14 Mar 2021 05:15:33 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.15.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:15:33 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng , Michal Simek , T Karthik Reddy , Ashok Reddy Soma Subject: [PATCH v4 06/22] net: phy: xilinx: Be compatible with live OF tree Date: Sun, 14 Mar 2021 20:14:50 +0800 Message-Id: <20210314121506.18303-7-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean Following the same updates that were done to the fixed phy driver, use ofnode_ APIs instead of fdt_ APIs so that the Xilinx PHY driver can support live DT. Signed-off-by: Bin Meng --- (no changes since v2) Changes in v2: - move device tree parsing from xilinxgmiitorgmii_probe() to xilinxgmiitorgmii_config() and use OF APIs drivers/net/phy/phy.c | 23 +++++------ drivers/net/phy/xilinx_gmii2rgmii.c | 61 ++++++++++++++--------------- 2 files changed, 40 insertions(+), 44 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index eae40cc0d6..d464379121 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -953,23 +953,20 @@ static struct phy_device *phy_connect_gmii2rgmii(struct mii_dev *bus, #endif { struct phy_device *phydev = NULL; - int sn = dev_of_offset(dev); - int off; - - while (sn > 0) { - off = fdt_node_offset_by_compatible(gd->fdt_blob, sn, - "xlnx,gmii-to-rgmii-1.0"); - if (off > 0) { - phydev = phy_device_create(bus, off, + ofnode node = dev_ofnode(dev); + + while (ofnode_valid(node)) { + node = ofnode_by_compatible(node, "xlnx,gmii-to-rgmii-1.0"); + if (ofnode_valid(node)) { + phydev = phy_device_create(bus, 0, PHY_GMII2RGMII_ID, false, interface); + if (phydev) + phydev->node = node; break; } - if (off == -FDT_ERR_NOTFOUND) - sn = fdt_first_subnode(gd->fdt_blob, sn); - else - printf("%s: Error finding compat string:%d\n", - __func__, off); + + node = ofnode_first_subnode(node); } return phydev; diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c index 74105c0b7d..635c0570ef 100644 --- a/drivers/net/phy/xilinx_gmii2rgmii.c +++ b/drivers/net/phy/xilinx_gmii2rgmii.c @@ -18,9 +18,38 @@ DECLARE_GLOBAL_DATA_PTR; static int xilinxgmiitorgmii_config(struct phy_device *phydev) { - struct phy_device *ext_phydev = phydev->priv; + ofnode node = phy_get_ofnode(phydev); + struct phy_device *ext_phydev; + struct ofnode_phandle_args phandle; + int ext_phyaddr = -1; + int ret; debug("%s\n", __func__); + + if (!ofnode_valid(node)) + return -EINVAL; + + phydev->addr = ofnode_read_u32_default(node, "reg", -1); + ret = ofnode_parse_phandle_with_args(node, "phy-handle", + NULL, 0, 0, &phandle); + if (ret) + return ret; + + ext_phyaddr = ofnode_read_u32_default(phandle.node, "reg", -1); + ext_phydev = phy_find_by_mask(phydev->bus, + 1 << ext_phyaddr, + PHY_INTERFACE_MODE_RGMII); + if (!ext_phydev) { + printf("%s, No external phy device found\n", __func__); + return -EINVAL; + } + + ext_phydev->node = phandle.node; + phydev->priv = ext_phydev; + + debug("%s, gmii2rgmmi:0x%x, extphy:0x%x\n", __func__, phydev->addr, + ext_phyaddr); + if (ext_phydev->drv->config) ext_phydev->drv->config(ext_phydev); @@ -83,11 +112,6 @@ static int xilinxgmiitorgmii_startup(struct phy_device *phydev) static int xilinxgmiitorgmii_probe(struct phy_device *phydev) { - int ofnode = phydev->addr; - u32 phy_of_handle; - int ext_phyaddr = -1; - struct phy_device *ext_phydev; - debug("%s\n", __func__); if (phydev->interface != PHY_INTERFACE_MODE_GMII) { @@ -95,31 +119,6 @@ static int xilinxgmiitorgmii_probe(struct phy_device *phydev) return -EINVAL; } - /* - * Read the phy address again as the one we read in ethernet driver - * was overwritten for the purpose of storing the ofnode - */ - phydev->addr = fdtdec_get_int(gd->fdt_blob, ofnode, "reg", -1); - phy_of_handle = fdtdec_lookup_phandle(gd->fdt_blob, ofnode, - "phy-handle"); - if (phy_of_handle > 0) - ext_phyaddr = fdtdec_get_int(gd->fdt_blob, - phy_of_handle, - "reg", -1); - ext_phydev = phy_find_by_mask(phydev->bus, - 1 << ext_phyaddr, - PHY_INTERFACE_MODE_RGMII); - if (!ext_phydev) { - printf("%s, No external phy device found\n", __func__); - return -EINVAL; - } - - ext_phydev->node = offset_to_ofnode(phy_of_handle); - phydev->priv = ext_phydev; - - debug("%s, gmii2rgmmi:0x%x, extphy:0x%x\n", __func__, phydev->addr, - ext_phyaddr); - phydev->flags |= PHY_FLAG_BROKEN_RESET; return 0; From patchwork Sun Mar 14 12:14:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452669 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=HsrhVl35; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dyz7p3fjDz9sRR for ; Sun, 14 Mar 2021 23:17:10 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B1EA182934; Sun, 14 Mar 2021 13:15:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HsrhVl35"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2ABEC82917; Sun, 14 Mar 2021 13:15:43 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7F821828FE for ; Sun, 14 Mar 2021 13:15:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pl1-x631.google.com with SMTP id o10so1768503plg.11 for ; Sun, 14 Mar 2021 05:15:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ciedds9M5rgJP/2Llzw4dTkSrklLGvQa87/Nq6TAxUc=; b=HsrhVl35oOAOuZ+Jc7boylbtS66LJvmVuy/jgm/glkY41IrQDvZaFC8pvBYF/B1GqV 7hMeRsYVHWgnffRbIx+zwrN/NAS5mqZBjjRYnDJ3V2SLaEpxJxtozbqjDQPwhHBY/5rp cIyxjphclYvslem/cGvBvpkR0dsgQD4l2QwA486zhcZfSSLwjs92v7L/C7i7FgqlLToa DY5ENWvY482ecClI+OX7ZDefYubz+rWshPJejXaNLArji43Yuac+4DlE+tcjPdFGH3Og 6Cc0OIjaICXXBX+gWesJIeUTf4gmHEFXDTXIyOSIX/pa3xB/CffluFnPrwOKIOysaTwG jCtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ciedds9M5rgJP/2Llzw4dTkSrklLGvQa87/Nq6TAxUc=; b=Tg1hRlxV5z9lHmv1m7hv5FQfa9VLozLJFLka8F5jua3DtoFsgPAvg/xGbKbsIjY7GU BibAGOSnjNzrptrwDdnhvx6DL1vqG/DlKYGQumz+ADz5qkQ65lJSN+1kYAIg0HPdkfBU IEj3o84xC+gKbQKbk/y9qOMR6vYYpfvCNEFMJuaHzDQZuc3YngBc8iPI0VALuK/zG9sS E8/qwtYm0BZiyneEfkjllbqC6/0sIk7uvqwekLmoHslcYdViTWiFdT85QyhIQyLMH9oe 5Eu9bvf1TGFz2BxMbfUYkSXwHunOxiFDgdEsvnVIFwd69BVy3wYW5hvy/AbG1l8xSw/7 uuhQ== X-Gm-Message-State: AOAM530hrsrBaMcIAVvn8zwP2H8zJ3kxVwLiHR6V2TNQtBrYPdyoYUcW BI5pkAj6ypyuW3uQvn/qmVI= X-Google-Smtp-Source: ABdhPJwsXAaeG+CMmjve3uCXlNqtCoiIpjen4R0NSQz4aMf1lK1+t2fucF5RvjByTAODXC+ZYzOhnA== X-Received: by 2002:a17:90a:2c09:: with SMTP id m9mr7928079pjd.3.1615724137068; Sun, 14 Mar 2021 05:15:37 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:15:36 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng , Michal Simek Subject: [PATCH v4 07/22] net: phy: xilinx: Drop #ifdef CONFIG_DM_ETH around phy_connect_gmii2rgmii() Date: Sun, 14 Mar 2021 20:14:51 +0800 Message-Id: <20210314121506.18303-8-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean At present phy_connect_gmii2rgmii() is implemented using a DM API dev_of_offset() hence it cannot support a non-DM configuration. Remove the non-DM version prototype of phy_connect_gmii2rgmii() and make the driver depend on CONFIG_DM_ETH. Signed-off-by: Bin Meng Acked-by: Michal Simek Reviewed-by: Ramon Fried Reviewed-by: Vladimir Oltean --- (no changes since v1) drivers/net/phy/Kconfig | 1 + drivers/net/phy/phy.c | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index d69503067d..070ffa82cb 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -292,6 +292,7 @@ config PHY_XILINX config PHY_XILINX_GMII2RGMII bool "Xilinx GMII to RGMII Ethernet PHYs support" + depends on DM_ETH help This adds support for Xilinx GMII to RGMII IP core. This IP acts as bridge between MAC connected over GMII and external phy that diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index d464379121..c7cdf64a0a 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -942,15 +942,9 @@ void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev) } #ifdef CONFIG_PHY_XILINX_GMII2RGMII -#ifdef CONFIG_DM_ETH static struct phy_device *phy_connect_gmii2rgmii(struct mii_dev *bus, struct udevice *dev, phy_interface_t interface) -#else -static struct phy_device *phy_connect_gmii2rgmii(struct mii_dev *bus, - struct eth_device *dev, - phy_interface_t interface) -#endif { struct phy_device *phydev = NULL; ofnode node = dev_ofnode(dev); From patchwork Sun Mar 14 12:14:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452670 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=jZQsgb/k; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dyz84036Fz9sRR for ; Sun, 14 Mar 2021 23:17:23 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5D04D82939; Sun, 14 Mar 2021 13:15:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jZQsgb/k"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 46D558291E; Sun, 14 Mar 2021 13:15:45 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7FA4782906 for ; Sun, 14 Mar 2021 13:15:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pf1-x432.google.com with SMTP id s21so4914431pfm.1 for ; Sun, 14 Mar 2021 05:15:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0ZXmt8jKZwxm6+L+pJ/nWf2tEGdFFmwV9barsES5KKo=; b=jZQsgb/kfJpOWjnzLydrD9WO2dPR5EXP9IM/qS9uvtppLmwa8vUsY5Zmr30W63SNw/ 2Q35NbCSIaGE4IMmuK680YpuUY5/yAP1QyEKU+XPrOTQVicZcvDwM9rUNvGgQcIM0odP OSY99r3gy5IU6YANPuNGzww6JkVYlUnwubePBkB48i1YBomD8u8RXyUnnnXaqQ1H78So ai2k9SS6yYKGVmyP8y0F+c7SAPgDjHOplcD4Gm875mht/KDQtE6SuBdxr05Kqdpdnh1M B2ttsPQjFa/1g47hrUuGjleTkZBOpGfH9IviC/aavrpQlqLcNZHu810QnE8St8AhGtSF qr2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0ZXmt8jKZwxm6+L+pJ/nWf2tEGdFFmwV9barsES5KKo=; b=nzl8o8myyMeRjIkH9aNIwgluuESr4pPlJoYh4hpBox3IF00hhqqsfbYbimLD7qKmAf A6en6eZ+9VFt3jNpLlTwlDRAxJsUOlv0WkYAfpFuSxVKg/CUy3MjoD+NHJ9so45ceq43 kEnog3YtcCQVTVxpWwV62WfrsPu2rO7GP5h1J5KnEzs4HGCm+9edvvzTiDvuVN+6L8D5 tbdpaHFSiWNzPnufX4KTP4xfgWM+V3VivmMSAB+wwEY1GBFdxMgjo1d4Dqtqn3fkKGvC g38DNuWe2/EkBm4Ut03ataFhyo48I6QyD40UjA6Wf0fGB2Ykjf4dsAzDwhtPu5lgu2/y lFQQ== X-Gm-Message-State: AOAM532Tnb68tJ9jWbeO5ceTEXeZkFyJx6wsxALwPdu6/jDZzWKyQaYm 0HYedDYZZIUqV5mSEo/hVyU= X-Google-Smtp-Source: ABdhPJyFPrVer2NxmSNEfF59N6JCwoga0z4VZ0oQIbZzuCSOIL6FFZUDETKtnm8SDLxJlOK92KjeZw== X-Received: by 2002:a62:1896:0:b029:197:491c:be38 with SMTP id 144-20020a6218960000b0290197491cbe38mr6342994pfy.15.1615724140136; Sun, 14 Mar 2021 05:15:40 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.15.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:15:39 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 08/22] net: phy: Simplify the logic of phy_connect_fixed() Date: Sun, 14 Mar 2021 20:14:52 +0800 Message-Id: <20210314121506.18303-9-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean Simplify the logic of phy_connect_fixed() by using the new API ofnode_phy_is_fixed_link(), which brings additional bonus of supporting the old DT bindings. Signed-off-by: Bin Meng Reviewed-by: Ramon Fried Reviewed-by: Vladimir Oltean --- (no changes since v1) drivers/net/phy/phy.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index c7cdf64a0a..dcdef9e661 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -1008,15 +1009,14 @@ static struct phy_device *phy_connect_fixed(struct mii_dev *bus, phy_interface_t interface) { ofnode node = dev_ofnode(dev), subnode; - struct phy_device *phydev; - - subnode = ofnode_find_subnode(node, "fixed-link"); - if (!ofnode_valid(subnode)) - return NULL; + struct phy_device *phydev = NULL; - phydev = phy_device_create(bus, 0, PHY_FIXED_ID, false, interface); - if (phydev) - phydev->node = subnode; + if (ofnode_phy_is_fixed_link(node, &subnode)) { + phydev = phy_device_create(bus, 0, PHY_FIXED_ID, + false, interface); + if (phydev) + phydev->node = subnode; + } return phydev; } From patchwork Sun Mar 14 12:14:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452671 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=p66MYcji; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dyz8K2w1rz9sRR for ; Sun, 14 Mar 2021 23:17:37 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F14A882954; Sun, 14 Mar 2021 13:16:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="p66MYcji"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 58E6B82930; Sun, 14 Mar 2021 13:15:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D05408291D for ; Sun, 14 Mar 2021 13:15:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pl1-x629.google.com with SMTP id q12so3498279plr.1 for ; Sun, 14 Mar 2021 05:15:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Bx8AT4uTsOntEPlIB0J3DEBNrKjbvhS55lAfFoGRsRI=; b=p66MYcjiMrlaS6kx8M15zPJpsawuPhsWPuptoCzsOdWZJjLIfcZL63tV3VNCWQu2yL QG2suR66u8k4nlCcJNKJ9i4LJQM+AofE/Jf0IMjORghV/D9AYk2Yq07Zmpq4+vF0NxPC okeZTNsqc+Th0jSvBituuH0H2iIgtP5DNThMRF8YuCmVWAk47IUMzAsaqOd1OBAdKpOH h/5oXY2EhGbOXBXDOnp3immF/F6FI3tCNrUVQbvU6/a1OPd+o9z9MqcGMIHXezTtBN8K Oxx2j1x7/ZpQVXZRxfbJljpJ7pnzAoeFmTElBygBU7iC7+0C4OJf8Kwmps52sNhKyFS6 A9ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Bx8AT4uTsOntEPlIB0J3DEBNrKjbvhS55lAfFoGRsRI=; b=gmDKYeFbHRFsLUziIwGMGVFk0L+W0zaLZY3XpTVxhdDjKH+py4ZDt12hsTtCCpj0F/ XdMn3YHR6oUrztbkAjzlurgpsiz3Ckpp4balWF8XAdlpIHMLuXbuDdLlCGos0EBO+x+2 m27fhy0jmGSBwa/+XDPZhaVx6e2nOjP4Zrw5UXF0Zsa6ldgJf9e3a+376getcunT4ykL gYAonfFTFznx9H/x4jojwjgVU6xNS7vNJZOvsLw6PyuTsgxq0aGQ0rqOVCrOsOlc4uBX j0FBKJTCYX/GaqDxuRZVwIyAsMlwodZTRQ/AgHAmg9rLvaRY/nCYDMbFBfOlWtkvnPZp mTaA== X-Gm-Message-State: AOAM533TWXiOjPSy56DD9wznBduMEL04ZHVkAgg+LZITIzXWMOgdLWJS LPNXCFTDT5aBE+/Oo6k2TzI= X-Google-Smtp-Source: ABdhPJziGTCg+qR/lBDlPohOpplP5l3oXNprFAD2zKvftvIw2qz5gYsXph1Vo6zm/LZtNer57wi67g== X-Received: by 2002:a17:902:509:b029:e5:9944:f763 with SMTP id 9-20020a1709020509b02900e59944f763mr6829860plf.35.1615724143495; Sun, 14 Mar 2021 05:15:43 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.15.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:15:43 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 09/22] net: phy: fixed: Make driver ops static Date: Sun, 14 Mar 2021 20:14:53 +0800 Message-Id: <20210314121506.18303-10-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean The PHY driver ops should be made static. Signed-off-by: Bin Meng Reviewed-by: Ramon Fried Reviewed-by: Vladimir Oltean --- (no changes since v1) drivers/net/phy/fixed.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index 11342df1c5..1d2587278f 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c @@ -15,7 +15,7 @@ DECLARE_GLOBAL_DATA_PTR; -int fixedphy_probe(struct phy_device *phydev) +static int fixedphy_probe(struct phy_device *phydev) { /* fixed-link phy must not be reset by core phy code */ phydev->flags |= PHY_FLAG_BROKEN_RESET; @@ -23,7 +23,7 @@ int fixedphy_probe(struct phy_device *phydev) return 0; } -int fixedphy_config(struct phy_device *phydev) +static int fixedphy_config(struct phy_device *phydev) { ofnode node = phy_get_ofnode(phydev); struct fixed_link *priv; @@ -55,7 +55,7 @@ int fixedphy_config(struct phy_device *phydev) return 0; } -int fixedphy_startup(struct phy_device *phydev) +static int fixedphy_startup(struct phy_device *phydev) { struct fixed_link *priv = phydev->priv; @@ -68,7 +68,7 @@ int fixedphy_startup(struct phy_device *phydev) return 0; } -int fixedphy_shutdown(struct phy_device *phydev) +static int fixedphy_shutdown(struct phy_device *phydev) { return 0; } From patchwork Sun Mar 14 12:14:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452672 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=bMVjwfSn; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dyz8X1LH6z9sRf for ; Sun, 14 Mar 2021 23:17:48 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B37C68294D; Sun, 14 Mar 2021 13:16:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="bMVjwfSn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C9E4682930; Sun, 14 Mar 2021 13:15:52 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2061B82927 for ; Sun, 14 Mar 2021 13:15:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pl1-x62f.google.com with SMTP id w7so10474691pll.8 for ; Sun, 14 Mar 2021 05:15:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3j7BZLCrvDDKliXLbbKht9OSxw6RrIxTHlF8DfVc8Zc=; b=bMVjwfSnwtu9pQYdNPy/i8nq7X2yWgZOnQkHeqF4RzL2QQwc8GsJVD5XaJyEqCcI58 Sz5o7ELqg64uZZkAG5/2nhv4yXjiffv4NWh46gKQ13sx+MN6EcDd8Vyykz8kTE0j5zb3 hdYSwsc3rJjXXS+pMsgv0Fvn8vwxwGv6k4/K9h/fIbz2RuLRB2SnSNG5aerUcN9xnfGZ F+tgpy0ElU49e0Vj+9nQjCXXsxa2vRfsvlwPMYDiiEzOU4j8UfWbuewlkRSJ3g1qkOI0 L9TEIhdbFGJEiqpvojKKbF4p6Z8bCPZB8Jb0M+1evLxTfQty5/tfWC+w1eSLOggLAH6V tW+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3j7BZLCrvDDKliXLbbKht9OSxw6RrIxTHlF8DfVc8Zc=; b=GngKUwxY6sCEyjH0s5qiFHCjaMcGpR4K7RnZc70rGFOIpw4LblUEXaUXeCsL5RHsgx jSis6/7JWOlIEGQt5JVq1+bSKYaKepSRmuHEY+lHaobbJeBun6oJNlsl5hMARMjjKS7j 7ajRnIiXO2nuVniMrWeDHEwcHH/NvPbnhGDFO+XffKfvxJOb3rpH3P+FslnTA4b/IMn1 9dxVSifyMi7UUGouoma/u7MRxIAOVr+/eL+F/I4qCiedxFsj3/sWeMhFcHVoMRqWdp/d Tea+hwnJw+t+hvZ3REoganMrqXq6OXXNU3qrrLrIXz8tsalGTdhBCqiu6StNU3YvoMyz Zwow== X-Gm-Message-State: AOAM530STd4py8Z2TAtbFz3uhXHioWjR1TdIcvJokr6LTCfKvZD5lcp5 uj3rzjgnjwvZC9pnA9qKkwc= X-Google-Smtp-Source: ABdhPJzWgMwhNKPedRsHQB2380iRcfcbI3rGqeKdCYbfu3UdIJWJ5J+f9JzRDgyt46rRrHp+VSIpEA== X-Received: by 2002:a17:903:20c1:b029:e6:a67b:3907 with SMTP id i1-20020a17090320c1b02900e6a67b3907mr3651489plb.46.1615724146752; Sun, 14 Mar 2021 05:15:46 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.15.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:15:46 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 10/22] net: phy: fixed: Add the missing ending newline Date: Sun, 14 Mar 2021 20:14:54 +0800 Message-Id: <20210314121506.18303-11-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean The printf statement doesn't end with a newline. Add it. Signed-off-by: Bin Meng Reviewed-by: Ramon Fried Reviewed-by: Vladimir Oltean --- (no changes since v1) drivers/net/phy/fixed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index 1d2587278f..304e506554 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c @@ -36,7 +36,7 @@ static int fixedphy_config(struct phy_device *phydev) val = ofnode_read_u32_default(node, "speed", 0); if (val != SPEED_10 && val != SPEED_100 && val != SPEED_1000 && val != SPEED_2500 && val != SPEED_10000) { - printf("ERROR: no/invalid speed given in fixed-link node!"); + printf("ERROR: no/invalid speed given in fixed-link node!\n"); return -EINVAL; } From patchwork Sun Mar 14 12:14:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452673 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=ZRn73X+M; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dyz8l4cp8z9sRR for ; Sun, 14 Mar 2021 23:17:59 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EF73C828FA; Sun, 14 Mar 2021 13:16:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZRn73X+M"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DD63E82935; Sun, 14 Mar 2021 13:15:54 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E74CA8291D for ; Sun, 14 Mar 2021 13:15:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pg1-x52d.google.com with SMTP id 205so1836771pgh.9 for ; Sun, 14 Mar 2021 05:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=asZQ83B78wks+MgSE0tO6skCuUw5Wdy66KgHHlbcTW0=; b=ZRn73X+MD0kQleRRgFFW+GPH1t+Y4luovyNiGlOlO39BGbHqqVTg67GaBt+sqsFjZy WoT3DdtAd3czGOOwopw+XodL6942HiHfY2JzUl4btESK257D0634uPdeTg0bNWVT9741 JjCLl9lc9rYSFGWBLpLVYSm3C0k7XMJzD7kObYgQEj47p5674ZCY3ienVaS1Aywg1M3R 8KSxk7lhRSbCVeNFrWfNgOBTYj/LI5HHsmiChIN2uc8LI0DkCPlJKZfxgzFKLj14f8b+ x9Zja94WXEhN2flmH4X0HYM212dUzyIFNxl/r7pb6j0qChV8Wicq5xedCnQkRC7/OMSW PnTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=asZQ83B78wks+MgSE0tO6skCuUw5Wdy66KgHHlbcTW0=; b=ln608QlcdkcWNHzKyGdnkFaKuujv+hNF+SYheD+E+H6Y7VgByPM1Yn3aNd6HQ1aYEE SLwI13hya9anWTYzTXsNY3Hd12DPhKc4Fs7A4rjYxzC9sk/UE2/xaRmGd3PKfyPcBEn6 n8k+tmLt22r3ibe16YcKyFvE/VXx7ur081vE8umhCKZxeWQg43Zph+kUUiS4BBXjv4sx K72OHWqjEvg15bNLTIDXVvGpKFzNebiTaNWM8R4V4shcww679TKgZ7bI/cIOLfyjOAAv aA7CdsfIXFp1CPglRaGvrvC5dwVwv+u005EL5xzUclpow7E9b6RHS/W4d1sdU2JX+JqZ wqiw== X-Gm-Message-State: AOAM5303QZbca3UIWuhqK+axtUPzPi9igJxWLicl/pyKtEeRxzdLMJoI laka+v+QbY3G8ekpMW3OGeI= X-Google-Smtp-Source: ABdhPJwGdzQNB4hZWmBXao1Q6GX5aV1E3gV+XzKT52dZ09JnMqqBwtIALPktuHJ9OJwm+K9dy1ZRXg== X-Received: by 2002:aa7:9478:0:b029:1fd:1fc1:bdfe with SMTP id t24-20020aa794780000b02901fd1fc1bdfemr6329895pfq.57.1615724149620; Sun, 14 Mar 2021 05:15:49 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.15.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:15:49 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 11/22] net: phy: fixed: Support the old DT binding Date: Sun, 14 Mar 2021 20:14:55 +0800 Message-Id: <20210314121506.18303-12-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean Update fixedphy_probe() to support the old DT binding. Signed-off-by: Bin Meng Reviewed-by: Ramon Fried Reviewed-by: Vladimir Oltean --- (no changes since v3) Changes in v3: - sort variable definitions by line length drivers/net/phy/fixed.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index 304e506554..1192915ee5 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c @@ -27,6 +27,8 @@ static int fixedphy_config(struct phy_device *phydev) { ofnode node = phy_get_ofnode(phydev); struct fixed_link *priv; + bool old_binding = false; + u32 old_val[5]; u32 val; if (!ofnode_valid(node)) @@ -34,6 +36,18 @@ static int fixedphy_config(struct phy_device *phydev) /* check for mandatory properties within fixed-link node */ val = ofnode_read_u32_default(node, "speed", 0); + + if (!val) { + /* try old binding */ + old_binding = true; + if (ofnode_read_u32_array(node, "fixed-link", old_val, + ARRAY_SIZE(old_val))) { + printf("ERROR: no/invalid property!\n"); + return -ENOENT; + } + val = old_val[2]; + } + if (val != SPEED_10 && val != SPEED_100 && val != SPEED_1000 && val != SPEED_2500 && val != SPEED_10000) { printf("ERROR: no/invalid speed given in fixed-link node!\n"); @@ -48,9 +62,15 @@ static int fixedphy_config(struct phy_device *phydev) phydev->priv = priv; priv->link_speed = val; - priv->duplex = ofnode_read_bool(node, "full-duplex"); - priv->pause = ofnode_read_bool(node, "pause"); - priv->asym_pause = ofnode_read_bool(node, "asym-pause"); + if (!old_binding) { + priv->duplex = ofnode_read_bool(node, "full-duplex"); + priv->pause = ofnode_read_bool(node, "pause"); + priv->asym_pause = ofnode_read_bool(node, "asym-pause"); + } else { + priv->duplex = old_val[1]; + priv->pause = old_val[3]; + priv->asym_pause = old_val[4]; + } return 0; } From patchwork Sun Mar 14 12:14:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452674 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=SNidOePP; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dyz8z144Cz9sRR for ; Sun, 14 Mar 2021 23:18:10 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E01388295B; Sun, 14 Mar 2021 13:16:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SNidOePP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6D73982937; Sun, 14 Mar 2021 13:15:57 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CB25D82927 for ; Sun, 14 Mar 2021 13:15:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pf1-x433.google.com with SMTP id x7so4892442pfi.7 for ; Sun, 14 Mar 2021 05:15:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Voe+U+B2Qp7elbxyCdNYtRwwWmyvpwfQzXGbPWV4oC8=; b=SNidOePPwsUxBBUWIKjYUF8Yx5t+H98D5SL1FUKcoHGaUM3J5gYUWg/YBJXrU7+p8D OAA5pPExQEXDwri39TWpmUbKQtCtfW4NaGn1SVbme5W6PJslkD3PeoZrxko9r+fAOWxm LfR5OZJgoyHqUwjMV4eIe8F4hoheqGj7ZOQtR8YIIgC/uC7eK1A4i/A9z8fQL4LAkGMh RKhPCUjn6fhK4HxJ90MsRUykZFKhVldL6hunWpmc8/RI7N/3oTKt4bAQhJPGHElVmNdd MtUxZdfunPG8wy5IJC97fu37zfSX9osUlQ97faso/+WUCbOKeS7Pz8ZX91pybOgsb02m mIKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Voe+U+B2Qp7elbxyCdNYtRwwWmyvpwfQzXGbPWV4oC8=; b=ELMIiiDaTtyI0IUvdTYiVVIByUMpOOjZTPehkPcXm31CuCuY609jotgBZ4ytzuLQRP UPTgCqJBUsaYztkud+q+Dm4P5F/AacIJiLCZLu4cie2N9G5XweC8ov2jBTfbxndIX3Of PwcJwq6em4BDz2SFRQXzsS3vzyORgialcv/hPHDtJhDaGnyOwKP7nVq5ESCk5qMXfEBX L3urmxIjB+YYhaGW8t9CvMhYKN5AlbaiNShpOzjqjnKGbNNZaT7jV2+iB7pCfePULZlc L2fscVwMPuRnzQ++KUkbdzEPJQPiWdpQoibwKAmucKOc8zCD78/uGoxGrkUAlfF2alGx fF+Q== X-Gm-Message-State: AOAM530hiODNIhOBHuRZcHOMzko+9Eu53whN9BvY5WSMLOeT2a3v9bgb p7NhbXtRxwlGwgmb4ASypeE= X-Google-Smtp-Source: ABdhPJxuqsKUrGJ6qXomNAFaqTKocMnWh6g112nSgpJCIxrMGb1vGPNGn7AKraY+FByLbxdbVcvrhQ== X-Received: by 2002:aa7:969d:0:b029:1f5:b02c:eed3 with SMTP id f29-20020aa7969d0000b02901f5b02ceed3mr6282977pfk.75.1615724152416; Sun, 14 Mar 2021 05:15:52 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.15.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:15:52 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 12/22] net: tsec: Use dm_eth_phy_connect() directly for the DM case Date: Sun, 14 Mar 2021 20:14:56 +0800 Message-Id: <20210314121506.18303-13-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean From: Vladimir Oltean Now that the fixed phy driver has been fully adapted to OF APIs, and dm_eth_phy_connect() already can handle the fixed phy, call dm_eth_phy_connect() directly in the DM tsec driver. Signed-off-by: Vladimir Oltean Reviewed-by: Bin Meng Tested-by: Bin Meng Message-Id: <20210216224804.3355044-4-olteanv@gmail.com> [bmeng: split from "net: mdio: teach dm_eth_phy_connect to connect to fixed PHY"] Signed-off-by: Bin Meng Reviewed-by: Vladimir Oltean --- (no changes since v2) Changes in v2: - new patch: split from <20210216224804.3355044-4-olteanv@gmail.com> drivers/net/tsec.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index ec48689372..f801d020fb 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -707,11 +707,7 @@ static int init_phy(struct tsec_private *priv) tsec_configure_serdes(priv); #if defined(CONFIG_DM_ETH) && defined(CONFIG_DM_MDIO) - if (ofnode_valid(ofnode_find_subnode(dev_ofnode(priv->dev), - "fixed-link"))) - phydev = phy_connect(NULL, 0, priv->dev, priv->interface); - else - phydev = dm_eth_phy_connect(priv->dev); + phydev = dm_eth_phy_connect(priv->dev); #else phydev = phy_connect(priv->bus, priv->phyaddr, priv->dev, priv->interface); From patchwork Sun Mar 14 12:14:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452675 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=BXDmwM4M; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dyz9C1G9Wz9sRR for ; Sun, 14 Mar 2021 23:18:23 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C3DAE8296F; Sun, 14 Mar 2021 13:16:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="BXDmwM4M"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EC0F182952; Sun, 14 Mar 2021 13:16:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E6C6382927 for ; Sun, 14 Mar 2021 13:15:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pl1-x62d.google.com with SMTP id n17so10411853plc.7 for ; Sun, 14 Mar 2021 05:15:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8qv51VZ++MrJmDEMJ1frHh486mjJGvUvkpOgXovpk0c=; b=BXDmwM4M/cjg+lS15sFQkWJ5gckjtiQH3woyPYER+puwLNwCNPpZS2upPPbuROiOyY GSRNYODQ6Re0WPQHWyEeXfc+DNA03xeXaNRPVzii1xJSl1gSkUQayxvUo+qWpOBuzwqY B1k8JmZymZ/EKlKtxJBlkKt97Ue/hn4QpddcHJ1I+no9jCv6UHIH0gU4MSGoSkCcsyK/ eIVVMJ+6CTZRPZtPL7k5eEdNfR6i/ilsl9rmBUpFq4bi0Cc2LSBNQVoZ+LsydjhnwUx2 bccboPH0bSMxNEdq9Eb4iyjctRF7+8mkjT1S1SfZgbezTXfradZVZL68EoljeFo2cvz7 fyzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8qv51VZ++MrJmDEMJ1frHh486mjJGvUvkpOgXovpk0c=; b=LviodRDXdMIvkm1CQUbOoGEZi0LNc3yHi/B5cLyZFsYv3cxKwu6mHMbGmDZAebx4dS fJthGOwVsT0IAoCgU3mL/ayTv18ew/3LX6qdCXGVEieWHRSFvElAmlKb7ZV8BNOG7ids JPlKbEEew6bXxnfNh6/dOxapEqlAKMCdfNdIdMgdkPniO3/BEraWhKlcpJ2JxXTmO6FX 46OSAoeEPx8XJT3wNMscM9FOLMr5KL+adERkhZP9WxQhGhPe7CoG/eFStwMT3fwNq6wj vph9jsWEm7/HPAr2ECMQLH7ueJpyqicSj+WxZQNyR+P32gFX4n3S3frI1AY/NC/BGqGR zz2g== X-Gm-Message-State: AOAM531rTN7kvpxZsHkI1N1SK4CY9UQ79iJ5/TKgmhgPdI82QV4qqLDt 2SMnYAEcLuKighegzqC8cjYbtPmhFow= X-Google-Smtp-Source: ABdhPJxR4nXTOjnMIJpoUzjwVGP6JCs1UQO2YtXbCbMV3hJHMgBKy2pKYt3KCNUye/sn8Wss2XnGGg== X-Received: by 2002:a17:902:a513:b029:e5:d91c:2ede with SMTP id s19-20020a170902a513b02900e5d91c2edemr6758992plq.65.1615724156430; Sun, 14 Mar 2021 05:15:56 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.15.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:15:56 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Claudiu Manoil , Alex Marginean , Bin Meng Subject: [PATCH v4 13/22] sandbox: Add a DSA sandbox driver and unit test Date: Sun, 14 Mar 2021 20:14:57 +0800 Message-Id: <20210314121506.18303-14-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean From: Claudiu Manoil The DSA sandbox driver is used for unit testing the DSA class code. It implements a simple 2 port switch plus 1 CPU port, and uses a very simple tag to identify the ports. The DSA sandbox device is connected via CPU port to a regular Ethernet sandbox device, called 'dsa-test-eth, managed by the existing eth sandbox driver. The 'dsa-test-eth' is not intended for testing the eth class code however, but it is used to emulate traffic through the 'lan0' and 'lan1' front pannel switch ports. To achieve this the dsa sandbox driver registers a tx handler for the 'dsa-test-eth' device. The switch ports, labeled as 'lan0' and 'lan1', are also registered as eth devices by the dsa class code this time. So pinging through these switch ports is as easy as: => setenv ethact lan0 => ping 1.2.3.5 Unit tests for the dsa class code were also added. The 'dsa_probe' test exercises most API functions from dsa.h. The 'dsa' unit test simply exercises ARP/ICMP traffic through the two switch ports, including tag injection and extraction, with the help of the dsa sandbox driver. I took care to minimize the impact on the existing eth unit tests, though some adjustments needed to be made with the addition of extra eth interfaces used by the dsa unit tests. The additional eth interfaces also require MAC addresses, these have been added to the sandbox default environment. Signed-off-by: Alex Marginean Signed-off-by: Claudiu Manoil Reviewed-by: Simon Glass Signed-off-by: Vladimir Oltean Message-Id: <20210216224804.3355044-5-olteanv@gmail.com> Signed-off-by: Bin Meng --- (no changes since v1) arch/Kconfig | 2 + arch/sandbox/dts/test.dts | 48 ++++++++++ drivers/net/Kconfig | 9 ++ drivers/net/Makefile | 1 + drivers/net/dsa_sandbox.c | 179 ++++++++++++++++++++++++++++++++++++++ include/configs/sandbox.h | 2 + test/dm/Makefile | 1 + test/dm/dsa.c | 82 +++++++++++++++++ test/dm/eth.c | 10 +-- 9 files changed, 329 insertions(+), 5 deletions(-) create mode 100644 drivers/net/dsa_sandbox.c create mode 100644 test/dm/dsa.c diff --git a/arch/Kconfig b/arch/Kconfig index 27843cd79c..5672d1df7e 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -160,6 +160,8 @@ config SANDBOX imply CMD_CLONE imply SILENT_CONSOLE imply BOOTARGS_SUBST + imply PHY_FIXED + imply DM_DSA config SH bool "SuperH architecture" diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 2600360224..3ef3ba0b17 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -15,7 +15,9 @@ aliases { console = &uart0; eth0 = "/eth@10002000"; + eth2 = &swp_0; eth3 = ð_3; + eth4 = &dsa_eth0; eth5 = ð_5; gpio1 = &gpio_a; gpio2 = &gpio_b; @@ -478,6 +480,52 @@ fake-host-hwaddr = [00 00 66 44 22 22]; }; + dsa_eth0: dsa-test-eth { + compatible = "sandbox,eth"; + reg = <0x10006000 0x1000>; + fake-host-hwaddr = [00 00 66 44 22 66]; + }; + + dsa-test { + compatible = "sandbox,dsa"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + swp_0: port@0 { + reg = <0>; + label = "lan0"; + phy-mode = "rgmii-rxid"; + + fixed-link { + speed = <100>; + full-duplex; + }; + }; + + swp_1: port@1 { + reg = <1>; + label = "lan1"; + phy-mode = "rgmii-txid"; + + fixed-link { + speed = <100>; + full-duplex; + }; + }; + + port@2 { + reg = <2>; + ethernet = <&dsa_eth0>; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; + }; + firmware { sandbox_firmware: sandbox-firmware { compatible = "sandbox,firmware"; diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 0e84c22b50..f96ee64249 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -78,6 +78,15 @@ config DM_ETH_PHY help Enable driver model for Ethernet Generic PHY . +config DSA_SANDBOX + depends on DM_DSA && SANDBOX + default y + bool "Sandbox: Mocked DSA driver" + help + This driver implements a dummy DSA switch connected to a dummy sandbox + Ethernet device used as DSA master, to test DSA class code, including + exported DSA API and datapath processing of Ethernet traffic. + menuconfig NETDEVICES bool "Network device support" depends on NET diff --git a/drivers/net/Makefile b/drivers/net/Makefile index a19511aaa7..108138fdb9 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -22,6 +22,7 @@ obj-$(CONFIG_ETH_DESIGNWARE_SOCFPGA) += dwmac_socfpga.o obj-$(CONFIG_ETH_DESIGNWARE_S700) += dwmac_s700.o obj-$(CONFIG_DRIVER_DM9000) += dm9000x.o obj-$(CONFIG_DNET) += dnet.o +obj-$(CONFIG_DSA_SANDBOX) += dsa_sandbox.o obj-$(CONFIG_DM_ETH_PHY) += eth-phy-uclass.o obj-$(CONFIG_E1000) += e1000.o obj-$(CONFIG_E1000_SPI) += e1000_spi.o diff --git a/drivers/net/dsa_sandbox.c b/drivers/net/dsa_sandbox.c new file mode 100644 index 0000000000..4b62670e5d --- /dev/null +++ b/drivers/net/dsa_sandbox.c @@ -0,0 +1,179 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2019-2021 NXP Semiconductors + */ + +#include +#include +#include + +#define DSA_SANDBOX_MAGIC 0x00415344 +#define DSA_SANDBOX_TAG_LEN sizeof(struct dsa_sandbox_tag) + +struct dsa_sandbox_priv { + struct eth_sandbox_priv *master_priv; + int port_en_mask; +}; + +struct dsa_sandbox_tag { + u32 magic; + u32 port; +}; + +static bool sb_dsa_port_enabled(struct udevice *dev, int port) +{ + struct dsa_sandbox_priv *priv = dev_get_priv(dev); + + return priv->port_en_mask & BIT(port); +} + +static bool sb_dsa_master_enabled(struct udevice *dev) +{ + struct dsa_sandbox_priv *priv = dev_get_priv(dev); + + return !priv->master_priv->disabled; +} + +static int dsa_sandbox_port_enable(struct udevice *dev, int port, + struct phy_device *phy) +{ + struct dsa_sandbox_priv *priv = dev_get_priv(dev); + + if (!sb_dsa_master_enabled(dev)) + return -EFAULT; + + priv->port_en_mask |= BIT(port); + + return 0; +} + +static void dsa_sandbox_port_disable(struct udevice *dev, int port, + struct phy_device *phy) +{ + struct dsa_sandbox_priv *priv = dev_get_priv(dev); + + priv->port_en_mask &= ~BIT(port); +} + +static int dsa_sandbox_xmit(struct udevice *dev, int port, void *packet, + int length) +{ + struct dsa_sandbox_tag *tag = packet; + + if (!sb_dsa_master_enabled(dev)) + return -EFAULT; + + if (!sb_dsa_port_enabled(dev, port)) + return -EFAULT; + + tag->magic = DSA_SANDBOX_MAGIC; + tag->port = port; + + return 0; +} + +static int dsa_sandbox_rcv(struct udevice *dev, int *port, void *packet, + int length) +{ + struct dsa_sandbox_tag *tag = packet; + + if (!sb_dsa_master_enabled(dev)) + return -EFAULT; + + if (tag->magic != DSA_SANDBOX_MAGIC) + return -EFAULT; + + *port = tag->port; + if (!sb_dsa_port_enabled(dev, tag->port)) + return -EFAULT; + + return 0; +} + +static const struct dsa_ops dsa_sandbox_ops = { + .port_enable = dsa_sandbox_port_enable, + .port_disable = dsa_sandbox_port_disable, + .xmit = dsa_sandbox_xmit, + .rcv = dsa_sandbox_rcv, +}; + +static int sb_dsa_handler(struct udevice *dev, void *packet, + unsigned int len) +{ + struct eth_sandbox_priv *master_priv; + struct dsa_sandbox_tag *tag = packet; + struct udevice *dsa_dev; + u32 port_index; + void *rx_buf; + int i; + + /* this emulates the switch hw and the network side */ + if (tag->magic != DSA_SANDBOX_MAGIC) + return -EFAULT; + + port_index = tag->port; + master_priv = dev_get_priv(dev); + dsa_dev = master_priv->priv; + if (!sb_dsa_port_enabled(dsa_dev, port_index)) + return -EFAULT; + + packet += DSA_SANDBOX_TAG_LEN; + len -= DSA_SANDBOX_TAG_LEN; + + if (!sandbox_eth_arp_req_to_reply(dev, packet, len)) + goto dsa_tagging; + if (!sandbox_eth_ping_req_to_reply(dev, packet, len)) + goto dsa_tagging; + + return 0; + +dsa_tagging: + master_priv->recv_packets--; + i = master_priv->recv_packets; + rx_buf = master_priv->recv_packet_buffer[i]; + len = master_priv->recv_packet_length[i]; + memmove(rx_buf + DSA_SANDBOX_TAG_LEN, rx_buf, len); + + tag = rx_buf; + tag->magic = DSA_SANDBOX_MAGIC; + tag->port = port_index; + len += DSA_SANDBOX_TAG_LEN; + master_priv->recv_packet_length[i] = len; + master_priv->recv_packets++; + + return 0; +} + +static int dsa_sandbox_probe(struct udevice *dev) +{ + struct dsa_sandbox_priv *priv = dev_get_priv(dev); + struct udevice *master = dsa_get_master(dev); + struct eth_sandbox_priv *master_priv; + + if (!master) + return -ENODEV; + + dsa_set_tagging(dev, DSA_SANDBOX_TAG_LEN, 0); + + master_priv = dev_get_priv(master); + master_priv->priv = dev; + master_priv->tx_handler = sb_dsa_handler; + + priv->master_priv = master_priv; + + return 0; +} + +static const struct udevice_id dsa_sandbox_ids[] = { + { .compatible = "sandbox,dsa" }, + { } +}; + +U_BOOT_DRIVER(dsa_sandbox) = { + .name = "dsa_sandbox", + .id = UCLASS_DSA, + .of_match = dsa_sandbox_ids, + .probe = dsa_sandbox_probe, + .ops = &dsa_sandbox_ops, + .priv_auto = sizeof(struct dsa_sandbox_priv), +}; diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index e0708fe573..91f636b2c1 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -93,7 +93,9 @@ #endif #define SANDBOX_ETH_SETTINGS "ethaddr=00:00:11:22:33:44\0" \ + "eth2addr=00:00:11:22:33:48\0" \ "eth3addr=00:00:11:22:33:45\0" \ + "eth4addr=00:00:11:22:33:48\0" \ "eth5addr=00:00:11:22:33:46\0" \ "eth6addr=00:00:11:22:33:47\0" \ "ipaddr=1.2.3.4\0" diff --git a/test/dm/Makefile b/test/dm/Makefile index fd1455109d..1c2fa95f4a 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -29,6 +29,7 @@ obj-$(CONFIG_CLK) += clk.o clk_ccf.o obj-$(CONFIG_CROS_EC) += cros_ec.o obj-$(CONFIG_DEVRES) += devres.o obj-$(CONFIG_VIDEO_MIPI_DSI) += dsi_host.o +obj-$(CONFIG_DM_DSA) += dsa.o obj-$(CONFIG_DM_ETH) += eth.o obj-$(CONFIG_FIRMWARE) += firmware.o obj-$(CONFIG_DM_GPIO) += gpio.o diff --git a/test/dm/dsa.c b/test/dm/dsa.c new file mode 100644 index 0000000000..18c1776460 --- /dev/null +++ b/test/dm/dsa.c @@ -0,0 +1,82 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2020-2021 NXP Semiconductors + */ + +#include +#include +#include +#include +#include +#include + +/* This test exercises the major dsa.h API functions, after making sure + * that the DSA ports and the master Eth are correctly probed. + */ +static int dm_test_dsa_probe(struct unit_test_state *uts) +{ + struct udevice *dev_dsa, *dev_port, *dev_master; + struct dsa_pdata *dsa_pdata; + enum uclass_id id; + + id = uclass_get_by_name("dsa"); + ut_assert(id == UCLASS_DSA); + + ut_assertok(uclass_find_device_by_name(UCLASS_DSA, "dsa-test", + &dev_dsa)); + ut_assertok(uclass_find_device_by_name(UCLASS_ETH, "dsa-test-eth", + &dev_master)); + ut_assertok(device_probe(dev_master)); + + ut_assertok(uclass_find_device_by_name(UCLASS_ETH, "dsa-test@0", + &dev_port)); + ut_assertok(device_probe(dev_port)); + + ut_assertok(uclass_find_device_by_name(UCLASS_ETH, "dsa-test@1", + &dev_port)); + ut_assertok(device_probe(dev_port)); + + /* exercise DSA API */ + dsa_pdata = dev_get_uclass_plat(dev_dsa); + ut_assertnonnull(dsa_pdata); + /* includes CPU port */ + ut_assert(dsa_pdata->num_ports == 3); + + ut_assertok(uclass_find_device_by_name(UCLASS_ETH, "lan0", + &dev_port)); + ut_assertok(device_probe(dev_port)); + + ut_assertok(uclass_find_device_by_name(UCLASS_ETH, "lan1", + &dev_port)); + ut_assertok(device_probe(dev_port)); + + dev_master = dsa_get_master(dev_dsa); + ut_assertnonnull(dev_master); + ut_asserteq_str("dsa-test-eth", dev_master->name); + + return 0; +} + +DM_TEST(dm_test_dsa_probe, UT_TESTF_SCAN_FDT); + +/* This test sends ping requests with the local address through each DSA port + * via the sandbox DSA master Eth. + */ +static int dm_test_dsa(struct unit_test_state *uts) +{ + net_ping_ip = string_to_ip("1.2.3.5"); + + env_set("ethact", "eth2"); + ut_assertok(net_loop(PING)); + + env_set("ethact", "lan0"); + ut_assertok(net_loop(PING)); + env_set("ethact", "lan1"); + ut_assertok(net_loop(PING)); + + env_set("ethact", ""); + + return 0; +} + +DM_TEST(dm_test_dsa, UT_TESTF_SCAN_FDT); diff --git a/test/dm/eth.c b/test/dm/eth.c index fa8a69da70..e4ee695610 100644 --- a/test/dm/eth.c +++ b/test/dm/eth.c @@ -53,8 +53,8 @@ static int dm_test_eth_alias(struct unit_test_state *uts) ut_assertok(net_loop(PING)); ut_asserteq_str("eth@10004000", env_get("ethact")); - /* Expected to fail since eth2 is not defined in the device tree */ - env_set("ethact", "eth2"); + /* Expected to fail since eth1 is not defined in the device tree */ + env_set("ethact", "eth1"); ut_assertok(net_loop(PING)); ut_asserteq_str("eth@10002000", env_get("ethact")); @@ -227,7 +227,7 @@ static int _dm_test_net_retry(struct unit_test_state *uts) * the active device should be eth0 */ sandbox_eth_disable_response(1, true); - env_set("ethact", "eth@10004000"); + env_set("ethact", "lan1"); env_set("netretry", "yes"); sandbox_eth_skip_timeout(); ut_assertok(net_loop(PING)); @@ -237,11 +237,11 @@ static int _dm_test_net_retry(struct unit_test_state *uts) * eth1 is disabled and netretry is no, so the ping should fail and the * active device should be eth1 */ - env_set("ethact", "eth@10004000"); + env_set("ethact", "lan1"); env_set("netretry", "no"); sandbox_eth_skip_timeout(); ut_asserteq(-ENONET, net_loop(PING)); - ut_asserteq_str("eth@10004000", env_get("ethact")); + ut_asserteq_str("lan1", env_get("ethact")); return 0; } From patchwork Sun Mar 14 12:14:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452676 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=AITRipzp; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dyz9R5KZcz9sRR for ; Sun, 14 Mar 2021 23:18:35 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 73CF782937; Sun, 14 Mar 2021 13:16:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AITRipzp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 455F48295B; Sun, 14 Mar 2021 13:16:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 946FA82937 for ; Sun, 14 Mar 2021 13:16:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pl1-x62c.google.com with SMTP id e2so8707849pld.9 for ; Sun, 14 Mar 2021 05:16:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9Qa3FdIjrdxsD205xrrQ6mG9Amm3TEpBfH9avG06hV8=; b=AITRipzpb34KlBO7DAVEx+2c7krSJpESnciOLid/wrx0qBVovoQjrTVAYF3e00DUbe 0ljLdpK4ewWaXHoYtaSawHug88WxvFWgTTlMcrnHB8TJcvkO7nPMRB1KmXb+/pcC5vX1 /aUo7CxdZUBMnNdoHuQg+4G4XsO/nL2PN2oFUOAMTvT4bLxRXMmhaxfAZ33/bJqrRZgi 0S3agIalmsUdlagbLSBFUZ8hn6TORYwtSgGjnuUTbBhl/fdjAAUtywsTmRaaUgZFossC aBU3biWlrVJAChc867Ka/BHqFUvntELxrgummnYw4L2B9lDSPSL1b6enUtiUW1ABS5At sTkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9Qa3FdIjrdxsD205xrrQ6mG9Amm3TEpBfH9avG06hV8=; b=uECNrbkpYV4bOAPS9HrmzArYSsBxJUi73+ufJ5rnVuplfHGEZOCep5et9N0ORHolGR RMJqP4Y7i8fkFpTfTyaFdA7P/4oIOqC1UkmEGxCE6QdlpHWOoayKsQ0p3zezw9bBpjtj eA87s736Jjvvz/ub8ugv6sO2Nu9PZSWhci2cbMgaPvC+ClSGwDroPIZ8E7l/pAqicc6Z KRem1S22NecNemjUGL7nYurTURuq0C2yl8TvWFMevg9Cscu2lFjNQI3YAeW8tVnzWMr7 J6pgov2MYpFhCgNNLWdakoy2TMjseuDrwccz2u7PHlSikCl9iwUOXQqpW+3jsl+QFxVm Uatg== X-Gm-Message-State: AOAM531WsO4PDjYrrKmDPUt/tQJFpr3aOQtibLsRThKvbhpgwSLbPWCR +ux2KgR0wd+bhz8xte4XKz8= X-Google-Smtp-Source: ABdhPJyQDJJVbtfNKcn8wDRVseOsn06A/ocIJgjo3VSC4Ao+HnuJoQP4+8GqEh7FJrMUBgtExFUpEw== X-Received: by 2002:a17:90a:868c:: with SMTP id p12mr7579966pjn.82.1615724159241; Sun, 14 Mar 2021 05:15:59 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.15.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:15:58 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 14/22] test: dm: Add a case to test ofnode_phy_is_fixed_link() Date: Sun, 14 Mar 2021 20:14:58 +0800 Message-Id: <20210314121506.18303-15-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean This adds a test case to test the new ofnode_phy_is_fixed_link() API. Both the new and old DT bindings are covered. Signed-off-by: Bin Meng Reviewed-by: Simon Glass Reviewed-by: Vladimir Oltean --- (no changes since v3) Changes in v3: - reuse the sandbox dsa nodes for the fixed-link testing arch/sandbox/dts/test.dts | 6 +----- test/dm/of_extra.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 3ef3ba0b17..7ad16635ad 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -507,11 +507,7 @@ reg = <1>; label = "lan1"; phy-mode = "rgmii-txid"; - - fixed-link { - speed = <100>; - full-duplex; - }; + fixed-link = <0 1 100 0 0>; }; port@2 { diff --git a/test/dm/of_extra.c b/test/dm/of_extra.c index b19cd3787d..ac2d886892 100644 --- a/test/dm/of_extra.c +++ b/test/dm/of_extra.c @@ -36,3 +36,21 @@ static int dm_test_ofnode_read_fmap_entry(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_ofnode_read_fmap_entry, 0); + +static int dm_test_ofnode_phy_is_fixed_link(struct unit_test_state *uts) +{ + ofnode eth_node, phy_node, node; + + eth_node = ofnode_path("/dsa-test/ports/port@0"); + ut_assert(ofnode_phy_is_fixed_link(eth_node, &phy_node)); + node = ofnode_path("/dsa-test/ports/port@0/fixed-link"); + ut_asserteq_mem(&phy_node, &node, sizeof(ofnode)); + + eth_node = ofnode_path("/dsa-test/ports/port@1"); + ut_assert(ofnode_phy_is_fixed_link(eth_node, &phy_node)); + node = eth_node; + ut_asserteq_mem(&phy_node, &node, sizeof(ofnode)); + + return 0; +} +DM_TEST(dm_test_ofnode_phy_is_fixed_link, 0); From patchwork Sun Mar 14 12:14:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452677 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=LY9GcPZN; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dyz9h1rkHz9sRR for ; Sun, 14 Mar 2021 23:18:48 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6FDC08296B; Sun, 14 Mar 2021 13:16:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LY9GcPZN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 97E92828DB; Sun, 14 Mar 2021 13:16:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 834C182943 for ; Sun, 14 Mar 2021 13:16:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pj1-x1030.google.com with SMTP id ha17so6604794pjb.2 for ; Sun, 14 Mar 2021 05:16:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GhAzFtR5LoLrHYJ2g0+gBepfArw7sVvdjymeoftnTr4=; b=LY9GcPZNgcI5jmF1SID56e3a3XOi4Q98EYngRGJl7V2U/JIePjQfXrgjZeo1KwV0ek ETQCEXquYEaLt3DfyFcsOqRjGU4vhWxqlBZUyxJ4DtF3Vr0buw3YHtAnGvgZGnRGRvrg mnm8lOTpaLUqIPPUl8mWXsxjnffr25OJly36Yn/z1GgoJT5OOAeEOJORIakyYMEDSycT u1CuH8nookYAYDiZRiD8orNpwn9E6IIM+ktZdpsffY+PbNYf0QykMMsbPAke+Ki52xRD 1unmtnJBvlTa97z39A7KO7OCiSyeoOzSXmFoSJUJBV96ACmguZB09cy27uCyzC+Q4riN WltA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GhAzFtR5LoLrHYJ2g0+gBepfArw7sVvdjymeoftnTr4=; b=Q4NRhYfOvfsJPlHLZGopsPlEaKExWOr96sh+oY4A6Wu8dXXxzyAqY6yWPPuStdW7Vg RTswQ/jlMLqpoD47HCiP5NRWr58mwWQCAr8dH7aVQXcDepodSMG4enW9VTXCIZGOwczz BWYj/PKD86xZHdnTbrADR5bjZ46IYsYmOCARX6wp8a8FDZ8BbHki9ztfuS1novMOzfQ0 ZR9kdRo+u1qW23Dv5rA5JcvC926PXKyfuV3TyY4P078gNmx8rC0FZHJwZXxWZKOEo/4w vUIdET/As0xsLN6yjuexSehz23lFCodrsQhsp35jLcU2mo44R15fSo+MULJG2RzVnx0k bVXg== X-Gm-Message-State: AOAM530C5Vc+HstfjaNUT02peWhcfXE0O8wEtthgbyTXMdtWJPCjdcko PD/GXlfqR38z75wDBUwUcQY= X-Google-Smtp-Source: ABdhPJwkcS9D6Pv97v8cJyfFA9n+Uca1oNtk6CVfXkR50CjhIYGwvH9iowHdS2qJOn4S8k/l0Yc7Rg== X-Received: by 2002:a17:902:b60d:b029:e6:7a9:7f4 with SMTP id b13-20020a170902b60db02900e607a907f4mr6780041pls.3.1615724162152; Sun, 14 Mar 2021 05:16:02 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:16:01 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 15/22] net: tsec: Use map_physmem() directly instead of dev_remap_addr() Date: Sun, 14 Mar 2021 20:14:59 +0800 Message-Id: <20210314121506.18303-16-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean dev_remap_addr() eventually calls dev_read_addr_index(), while pdata->iobase holds the return value of dev_read_addr() that calls dev_read_addr_index() too. Such duplication can be avoided by using map_physmem() directly. Signed-off-by: Bin Meng Reviewed-by: Vladimir Oltean --- (no changes since v3) Changes in v3: - new patch: net: tsec: Use map_physmem() directly instead of dev_remap_addr() drivers/net/tsec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index f801d020fb..491d2ef1ae 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -833,7 +833,9 @@ int tsec_probe(struct udevice *dev) data = (struct tsec_data *)dev_get_driver_data(dev); pdata->iobase = (phys_addr_t)dev_read_addr(dev); - priv->regs = dev_remap_addr(dev); + if (pdata->iobase == FDT_ADDR_T_NONE) + return -ENOENT; + priv->regs = map_physmem(pdata->iobase, 0, MAP_NOCACHE); ret = dev_read_phandle_with_args(dev, "tbi-handle", NULL, 0, 0, &phandle_args); From patchwork Sun Mar 14 12:15:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452678 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Hoduorei; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dyz9w2sD9z9sRR for ; Sun, 14 Mar 2021 23:19:00 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C370F8297E; Sun, 14 Mar 2021 13:16:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Hoduorei"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2C165828DB; Sun, 14 Mar 2021 13:16:12 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 83E1282955 for ; Sun, 14 Mar 2021 13:16:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pg1-x532.google.com with SMTP id w34so17750025pga.8 for ; Sun, 14 Mar 2021 05:16:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g2BFws65pn+CmvUwulSFgQT4rtEwYQkNfBkqoMQoaGQ=; b=HoduoreimL/GDup/CCcfUnZZh8OqKW7DyoKvRM5LsTjVjsWILDpybjLnSmBsbFPZQz YMTwIlf+FX5eZCdRJULNdaA/SATQVMUOGfp3hG40UmrvKfmaqOeOl6tg+H1OCr2rNRQT vtZGywYtMHGe23WW+bYa2HHl/PkAqrx/5V5j7/McQ3ogaNZUiXdoqjjndKr/C6V7X+yf qFo0K2N0lCDraAhB9LThVgyZ7cN4dNEi51sWqHp0c9d6P7MBrLwhpmOOliIRpYjaSZC3 nLdfxRd3ECmajJKYte0yYjHZCB4zguHf37qvZwG9Lq3fD6TObO3F5NquXQuf0/SG+P9y BphQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g2BFws65pn+CmvUwulSFgQT4rtEwYQkNfBkqoMQoaGQ=; b=Trw8MhtsbbANe/GQ+7Mks8I6v9YDnVX/xfIfcbA9wXXY8ZjgfLVsYIBuni8QwoCSs/ HHbR9+YDh8CTSJvJwbIan6DLLI+ymQLDNJS4Rjum1h6S9fmJyFNUDktZEEtTTwRyNn17 Kujws3gm01MnnhABJ6m9+rtHHhVhHHoW/hxiCk4G8PxhD9CSiVXzCtTCDFDcDt7B5uhZ TrRmuVqsyTnPMxOn0BbK7puLaID8z9+eLIUkSpjxhtBBwvy3ZxBTXwMkEASQjINAx3gY qt4MqhEXKQMIumiqV3NW4/FkvBcGpVmWAZuwzbko45VmMW8PUc6aw6kB5+8a2/SyeVwl cQsQ== X-Gm-Message-State: AOAM532HE1UCLU2kyi+EKjFwxkVJ54oPtENVkKOpgujfgGXFEZ5vRShJ ID9KLATqvzqKFU295sTE01k= X-Google-Smtp-Source: ABdhPJwckvNIX0+p4Xh02YiEyEgydCGOT1DvT115LnqveDRLntVaM6W11fy+IusopRFX/TTjYRSK7w== X-Received: by 2002:a63:778e:: with SMTP id s136mr19068526pgc.433.1615724165047; Sun, 14 Mar 2021 05:16:05 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.16.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:16:04 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 16/22] dt-bindings: net: Update Freescale TSEC to support "queue-group" Date: Sun, 14 Mar 2021 20:15:00 +0800 Message-Id: <20210314121506.18303-17-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean At present the Freescale TSEC node DT bindings doc requires a property in the TSEC node. But this might not always be the case. In the upstream Linux kernel, there is no DT bindings doc for it but the kernel driver tests a subnode of a name prefixed with "queue-group", as we can see from gfar_of_init(): for_each_available_child_of_node(np, child) { if (!of_node_name_eq(child, "queue-group")) ... in drivers/net/ethernet/freescale/gianfar.c Update our DT bindings to describe this alternate description. Signed-off-by: Bin Meng Reviewed-by: Ramon Fried Reviewed-by: Vladimir Oltean --- Changes in v4: - describe "ranges" is required fo the alternate description Changes in v3: - add "ranges" in the alternate example doc/device-tree-bindings/net/fsl-tsec-phy.txt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/device-tree-bindings/net/fsl-tsec-phy.txt b/doc/device-tree-bindings/net/fsl-tsec-phy.txt index a44c5fd9d9..f68980352b 100644 --- a/doc/device-tree-bindings/net/fsl-tsec-phy.txt +++ b/doc/device-tree-bindings/net/fsl-tsec-phy.txt @@ -3,12 +3,17 @@ Properties: - compatible : Should be "fsl,etsec2" or "gianfar" - - reg : Offset and length of the register set for the device + - reg : Offset and length of the register set for the device. If this is + missing, a subnode with a name prefix "queue-group" must be provided to + provide the property. - phy-handle : See ethernet.txt file in the same directory. - phy-connection-type : See ethernet.txt file in the same directory. This property is only really needed if the connection is of type "rgmii-id", "rgmii-rxid" and "rgmii-txid" as all other connection types are detected by hardware. + - ranges : an value if subnode "queue-group" is present, specifying + that no address translation is required between them TSEC parent node and + the child "queue-group" node. Example: ethernet@24000 { @@ -18,6 +23,18 @@ Example: phy-connection-type = "sgmii"; }; +An alternate description with "queue-group" subnode example: + ethernet@24000 { + compatible = "fsl,etsec2"; + phy-handle = <&phy0>; + phy-connection-type = "sgmii"; + ranges; + + queue-group { + reg = <0x24000 0x1000>; + }; + }; + Child nodes of the TSEC controller are typically the individual PHY devices connected via the MDIO bus (sometimes the MDIO bus controller is separate). From patchwork Sun Mar 14 12:15:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452679 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=IvNfm9em; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DyzB91HVLz9sRR for ; Sun, 14 Mar 2021 23:19:12 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2620482986; Sun, 14 Mar 2021 13:16:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="IvNfm9em"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8662D828FA; Sun, 14 Mar 2021 13:16:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 42D0C82952 for ; Sun, 14 Mar 2021 13:16:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pf1-x42b.google.com with SMTP id t85so4875298pfc.13 for ; Sun, 14 Mar 2021 05:16:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yZtYFfIJn00Ry/YHTiSm0p8g1PW5QKAPkkP6jWWow5Y=; b=IvNfm9em2n87AxXmWaYPMfzUc8GoZUhHfKHRvF0Sj+x5G1uyEQBU9gwZPJjW8o34DY As7N35htU9jTlyDwTmVoGRshM0eWlrAY63dKiQjwrNghukISv7PX8vVFuXks+OpHEJxx NRs1v7ztxBxHc0r0JP3EiLxJosGkdsih4jV1haefbdC96VUGLMLtUN7jgS5CGzm/LDsF z3GCdOGwYS9sqLIYIT1Z6QxsaieTDcKv1waLpp626pMpY4d4//db5xZ0QPpW0tft2V6b 4VI7VNvUcg2mtqmyLPiGpMgz5Hl7Z8rsi+nHyY9+KF24AQQPZ+TqMyKG4gk/n7yC+vqG UpTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yZtYFfIJn00Ry/YHTiSm0p8g1PW5QKAPkkP6jWWow5Y=; b=sbzv05VArqATWMnnR9dZdFM1hu4/8gHreLGQz9nZXH9jsyW67QRHWsjPMZoGs2YR/P 9HtG022am9EUzjnFeFd6l9grKv6R2ZKV4ferOX6RI3ZtYgRQncXnVka0GNPpLxt675Nk 8kVivpjiSyQBnoB+MdcFmdG48AWk2ITytGSKIfGdKlSGe9QweBRre1vaL8yNeYUp8AhO KsOTZVZJYHbLdeOvlpda5MdHMLF1/h6h6T3VjOzVI675X6LL/fhHYRsOBGnzMdHj0iHS JARZCivDXDyiRBXiK21tkO+I0mSXN3TRsbCkEsJ4OqdmbNrcjx4d84vg/7jHI3/Os82b l5nA== X-Gm-Message-State: AOAM530PGkE3aUxnIhyXa4EZke+fCd6vW7+Q1hfViYcUy/0VKiyxxGOT zq+HLcCWiODfY4OFn2n7H0w= X-Google-Smtp-Source: ABdhPJwCWBDAwaSd6uR/XR/Rg4WQLHEpMo+pkF49Wg7We0e2pc+LYuJurQOuN6dVXwQTsEXSE3Pd/A== X-Received: by 2002:aa7:9293:0:b029:1df:4e2:c981 with SMTP id j19-20020aa792930000b02901df04e2c981mr20477317pfa.41.1615724167855; Sun, 14 Mar 2021 05:16:07 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:16:07 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 17/22] net: tsec: Support property from the subnode "queue-group" Date: Sun, 14 Mar 2021 20:15:01 +0800 Message-Id: <20210314121506.18303-18-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean At present the tsec driver uses a non-standard DT bindings to get its base / size. The upstream Linux kernel seems to require the base / size to be put under a subnode of the eTSEC node with a name prefix "queue-group". This is not documented in the kernel DT bindings, but it looks every dtsi file that contains the eTSEC node was written like this. This commit updates the tsec driver to handle this case. Signed-off-by: Bin Meng Reviewed-by: Ramon Fried Reviewed-by: Vladimir Oltean --- (no changes since v3) Changes in v3: - keep the variable definitions sorted - invert the strncmp logic to reduce the indentation level - add a comment to mention only the first "queue-group" is used - call the same map_physmem() in the common code path drivers/net/tsec.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 491d2ef1ae..c68e4b7fb5 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -826,15 +826,39 @@ int tsec_probe(struct udevice *dev) u32 tbiaddr = CONFIG_SYS_TBIPA_VALUE; struct tsec_data *data; const char *phy_mode; + ofnode parent, child; fdt_addr_t reg; - ofnode parent; int ret; data = (struct tsec_data *)dev_get_driver_data(dev); pdata->iobase = (phys_addr_t)dev_read_addr(dev); - if (pdata->iobase == FDT_ADDR_T_NONE) - return -ENOENT; + if (pdata->iobase == FDT_ADDR_T_NONE) { + ofnode_for_each_subnode(child, dev_ofnode(dev)) { + if (strncmp(ofnode_get_name(child), "queue-group", + strlen("queue-group"))) + continue; + + reg = ofnode_get_addr(child); + if (reg == FDT_ADDR_T_NONE) { + printf("No 'reg' property of \n"); + return -ENOENT; + } + pdata->iobase = reg; + + /* + * if there are multiple queue groups, + * only the first one is used. + */ + break; + } + + if (!ofnode_valid(child)) { + printf("No child node for ?\n"); + return -ENOENT; + } + } + priv->regs = map_physmem(pdata->iobase, 0, MAP_NOCACHE); ret = dev_read_phandle_with_args(dev, "tbi-handle", NULL, 0, 0, From patchwork Sun Mar 14 12:15:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452680 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=lMUuu3q7; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DyzBP5ppzz9sRR for ; Sun, 14 Mar 2021 23:19:25 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7F2B58298E; Sun, 14 Mar 2021 13:16:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lMUuu3q7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7275F82943; Sun, 14 Mar 2021 13:16:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 47D1182797 for ; Sun, 14 Mar 2021 13:16:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pj1-x1030.google.com with SMTP id f2-20020a17090a4a82b02900c67bf8dc69so12922491pjh.1 for ; Sun, 14 Mar 2021 05:16:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w3nJb4APUipoXirbqgwvIRa62QK1n9AJpKzuXj9J690=; b=lMUuu3q7mTRF+ncF/IpK9Jjok4fE50yy1zAV3eoLPlwHYNneyiWUbQ75TnTxMJ0N1d uWUWuQ269qyWFRX6XVJmRu4XURRveWUo32Qjy8ETqhRjlTlGUk3MyJJJRxLnthJTbQ4q UEpPaedUfCQjcXvnLAOli+lo7T/rDboO973mzJNOP12/z2xbm3A4D281CFrD3v8q1P19 EoUdlG8Q4C6getlG9tLghsbtuPeTwZ7xZfKTLutlWSc8OJCus1ZlS/zJTJX85MwLHvqb A6IOKC76+TikR78vq4LLW+sFMu15Yq2PJuWf8Bz88mhAX5+c7hFCstICkFz3VhLV00In iNYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w3nJb4APUipoXirbqgwvIRa62QK1n9AJpKzuXj9J690=; b=UP7YU/JjeMf+4SzGRHYwsi66Qbo5d9Za5qz9LnCYi/wP7OFH7wP4AieBlqyN+aNrCw hj29SM90/bzgGFgkyO8eH2Tyb372QTEi8BU6+rpQwAUwHK7XXCoekDrp9ryIWzj9fGFa FMngqj3GLj/K/NXVLZ15TspsjgOjljya0cmowX8oiAc1cfpG/SOt19qOlK+odNP+rBVp y0nFCJC0l3qC72j9+KDsZMj80cIG2q4bSlKTnW5Qu6P4iUqx6Lo38FooNah2LS3ckwKP ChEfPPuoiB/Rsbjdne49KlKjIH+UZf2rIr3yvhXfBWXma85PCAMLqgPMaelSozMBUpFq /dtA== X-Gm-Message-State: AOAM532s3WlssywzlWUPreb1LyQEkLfJSjhX2thjL+u5WHLDieZGPmQA rp/iZRbbE4mNN0+MM/zOa6M= X-Google-Smtp-Source: ABdhPJz3KUVs0+Wq3PHoxujR/kdGbJoWEKqfo7BuHyfRmXhC3fF2A7/IVaU3dq5xniK8deZWalqoAA== X-Received: by 2002:a17:902:6b42:b029:e6:733a:332 with SMTP id g2-20020a1709026b42b02900e6733a0332mr6651714plt.35.1615724170885; Sun, 14 Mar 2021 05:16:10 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.16.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:16:10 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 18/22] dm: core: Correctly read of simple-bus Date: Sun, 14 Mar 2021 20:15:02 +0800 Message-Id: <20210314121506.18303-19-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean At present we decode simple bus using the following assumption: - parent #address-cells 1 - child #address-cells 1 - child #size-cells 1 However this might not always be the case. Update to use fdt_addr_t and fdt_size_t in 'struct simple_bus_plat', and use fdt_read_ranges() to correctly decode it according to the actual parent and child #address-cells / #size-cells under a Kconfig option CONFIG_SIMPLE_BUS_CORRECT_RANGE which can be turned on for any board that needs it. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- (no changes since v2) Changes in v2: - include - use a Kconfig option CONFIG_SIMPLE_BUS_CORRECT_RANGE to control the new behavior for boards that want this drivers/core/Kconfig | 13 +++++++++++++ drivers/core/simple-bus.c | 32 +++++++++++++++++++++++++------- include/dm/simple_bus.h | 6 +++--- 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index 1eccac28c6..c7504edaf8 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -235,6 +235,19 @@ config SPL_SIMPLE_BUS Supports the 'simple-bus' driver, which is used on some systems in SPL. +config SIMPLE_BUS_CORRECT_RANGE + bool "Decode the 'simple-bus' by honoring the #address-cells and #size-cells" + depends on SIMPLE_BUS + help + Decoding the 'simple-bus' by honoring the #address-cells + and #size-cells of parent/child bus. If unset, #address-cells of + parent bus is assumed to be 1, #address-cells and #size-cells of + child bus is also assumed to be 1, to save some spaces of using + an advanced API to decode the , which benefits SPL image + builds that have size limits. + + If you are unsure about this, Say N here. + config SIMPLE_PM_BUS bool "Support simple-pm-bus driver" depends on DM && OF_CONTROL && CLK && POWER_DOMAIN diff --git a/drivers/core/simple-bus.c b/drivers/core/simple-bus.c index b0c2c20958..18f52d26df 100644 --- a/drivers/core/simple-bus.c +++ b/drivers/core/simple-bus.c @@ -4,8 +4,12 @@ */ #include +#include #include #include +#include + +DECLARE_GLOBAL_DATA_PTR; fdt_addr_t simple_bus_translate(struct udevice *dev, fdt_addr_t addr) { @@ -22,16 +26,30 @@ static int simple_bus_post_bind(struct udevice *dev) #if CONFIG_IS_ENABLED(OF_PLATDATA) return 0; #else - u32 cell[3]; + struct simple_bus_plat *plat = dev_get_uclass_plat(dev); int ret; - ret = dev_read_u32_array(dev, "ranges", cell, ARRAY_SIZE(cell)); - if (!ret) { - struct simple_bus_plat *plat = dev_get_uclass_plat(dev); + if (CONFIG_IS_ENABLED(SIMPLE_BUS_CORRECT_RANGE)) { + uint64_t caddr, paddr, len; + + /* only read range index 0 */ + ret = fdt_read_range((void *)gd->fdt_blob, dev_of_offset(dev), + 0, &caddr, &paddr, &len); + if (!ret) { + plat->base = caddr; + plat->target = paddr; + plat->size = len; + } + } else { + u32 cell[3]; - plat->base = cell[0]; - plat->target = cell[1]; - plat->size = cell[2]; + ret = dev_read_u32_array(dev, "ranges", cell, + ARRAY_SIZE(cell)); + if (!ret) { + plat->base = cell[0]; + plat->target = cell[1]; + plat->size = cell[2]; + } } return dm_scan_fdt_dev(dev); diff --git a/include/dm/simple_bus.h b/include/dm/simple_bus.h index 4ad4cc4051..b7104013c0 100644 --- a/include/dm/simple_bus.h +++ b/include/dm/simple_bus.h @@ -7,9 +7,9 @@ #define __DM_SIMPLE_BUS_H struct simple_bus_plat { - u32 base; - u32 size; - u32 target; + fdt_addr_t base; + fdt_size_t size; + fdt_addr_t target; }; #endif From patchwork Sun Mar 14 12:15:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452681 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Of6REb+k; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DyzBf4X0Pz9sRR for ; Sun, 14 Mar 2021 23:19:37 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AD2C782998; Sun, 14 Mar 2021 13:16:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Of6REb+k"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8EB3B82964; Sun, 14 Mar 2021 13:16:19 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2234F82937 for ; Sun, 14 Mar 2021 13:16:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pl1-x62e.google.com with SMTP id a8so7451989plp.13 for ; Sun, 14 Mar 2021 05:16:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cNTZZ2LnwOJBKWwg7XT4A6/G8a4ibVl/Gw7tQ/JimPQ=; b=Of6REb+kAJoGHjwxObnEmXXgkcv/qefkoUk2SvUuDzVzgqHSewV13i1dml71sl8TL/ XOD8rUo7l9omeUgh4aC6KfRO6nHnJhuDTqJGKvqVb3rzbcC39JbmNFDAqprKhRsO7kyD OXwJrmp6s0yGvk92zFHl/BpdaYSTfotOH9WyZY7mqkTedwKASxzkQKyHUAaNxecmANEk HAUKO8JsocwUwGk4URz5NM0xzFY02YG7W3RQoloXZZc/Rfr09q+rzc/qgV7U7GwxafFe tI3SbABN6mx0yLSCOHOPGUTgbKTITx8/sNT+8QYD66YBNUXMKgAf3NRD3Ph8i46dAKiH mY5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cNTZZ2LnwOJBKWwg7XT4A6/G8a4ibVl/Gw7tQ/JimPQ=; b=ayWzOE22SWJXtXBEtItpZSGa0WtOOXntTccGq9pPvIavYF6xFFDnwBZy45efoCwfKm zyKLqhSMgqiXao4dofuwMUFjJVLDyj02nJI5cpDgskbKHkqU9iZim9OQF93l9whLFPqY n61DLZIqzOnDDmb2DCwFiia+TgzUL4z8ESxgtpKs7xQefwoOMr4enpH+37tjcR3GXyO9 cuTYZAgMkYHgFD1LDlVoQ5PY/r302Wuh+oa7kh1tfiZB0nJkp0CLkdrd5IDa4sYCDTL1 g2KoWUw5NLdjPSRRB8ZpduN3tdpIF5UZEtHOylhy0Z75Gw74jevhd8RkkxAMI8/7RJqS WWNg== X-Gm-Message-State: AOAM5336xD545d7VmbQfDL0C93YkPue3YwpFinktMxq+ap37Tn3FgqJ9 kLsbZyJpMJXOPq/XvtkLup8= X-Google-Smtp-Source: ABdhPJyEBuVxLZAtJW8b3CYIDs2PWKAmXjmcE6ZLaySFY5id0kpTisKBBvsFlfUw4/M6P32iNQNt+g== X-Received: by 2002:a17:902:7287:b029:e5:bd05:4a97 with SMTP id d7-20020a1709027287b02900e5bd054a97mr6700002pll.27.1615724173770; Sun, 14 Mar 2021 05:16:13 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:16:13 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 19/22] test: dm: Add a test case for simple-bus Date: Sun, 14 Mar 2021 20:15:03 +0800 Message-Id: <20210314121506.18303-20-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean This adds a test case to verify reading of a simple-bus is working as expected. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- (no changes since v2) Changes in v2: - default y if SANDBOX for CONFIG_SIMPLE_BUS_CORRECT_RANGE drivers/core/Kconfig | 1 + test/dm/Makefile | 1 + test/dm/simple-bus.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 test/dm/simple-bus.c diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index c7504edaf8..a7c3120860 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -238,6 +238,7 @@ config SPL_SIMPLE_BUS config SIMPLE_BUS_CORRECT_RANGE bool "Decode the 'simple-bus' by honoring the #address-cells and #size-cells" depends on SIMPLE_BUS + default y if SANDBOX help Decoding the 'simple-bus' by honoring the #address-cells and #size-cells of parent/child bus. If unset, #address-cells of diff --git a/test/dm/Makefile b/test/dm/Makefile index 1c2fa95f4a..d0d46e7f7e 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -90,6 +90,7 @@ obj-$(CONFIG_DM_MDIO) += mdio.o obj-$(CONFIG_DM_MDIO_MUX) += mdio_mux.o obj-$(CONFIG_DM_RNG) += rng.o obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o +obj-$(CONFIG_SIMPLE_BUS) += simple-bus.o obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o obj-$(CONFIG_RESET_SYSCON) += syscon-reset.o obj-$(CONFIG_SCMI_FIRMWARE) += scmi.o diff --git a/test/dm/simple-bus.c b/test/dm/simple-bus.c new file mode 100644 index 0000000000..3530b47fac --- /dev/null +++ b/test/dm/simple-bus.c @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2021, Bin Meng + */ + +#include +#include +#include +#include +#include +#include + +static int dm_test_simple_bus(struct unit_test_state *uts) +{ + struct udevice *dev; + struct simple_bus_plat *plat; + + /* locate the dummy device @ translation-test node */ + ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, &dev)); + ut_asserteq_str("dev@0,0", dev->name); + + /* locate the parent node which is a simple-bus */ + ut_assertnonnull(dev = dev_get_parent(dev)); + ut_asserteq_str("translation-test@8000", dev->name); + + ut_assertnonnull(plat = dev_get_uclass_plat(dev)); + ut_asserteq(0, plat->base); + ut_asserteq(0x8000, plat->target); + ut_asserteq(0x1000, plat->size); + + return 0; +} +DM_TEST(dm_test_simple_bus, UT_TESTF_SCAN_FDT | UT_TESTF_FLAT_TREE); From patchwork Sun Mar 14 12:15:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452682 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=IJFBmgbY; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DyzBt3ttgz9sRR for ; Sun, 14 Mar 2021 23:19:50 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9AFC6829A2; Sun, 14 Mar 2021 13:16:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="IJFBmgbY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7CDF68296B; Sun, 14 Mar 2021 13:16:22 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1CC04828EE for ; Sun, 14 Mar 2021 13:16:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pl1-x62a.google.com with SMTP id s7so13966117plg.5 for ; Sun, 14 Mar 2021 05:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=h46t9JeboLQUGCx2GIOw0IYgibesUTbbyNrG5/GTQkA=; b=IJFBmgbYG0FLC7NuEKVjoYPdGI3x/G6YU4bg3pVDIqixn8rXfnThHhwOn5HFKU2H+9 iPxMYd3qrSG+gko2CoaRYR3GGA2+E3exSTdv7Obv+XjKIf0M7zjtqyxoc+q0DBwE/66E m8ycF3uahxXVIxJ6wgaN1zi3El/hZySpKVSctfGbJH05d450zs+vGWbj3RDa5dE7x8ph dQrt17lLm/JmTskFBeIq2Ix0VchcFEvzQILyamg1DS64rKqMvoTVfoExeoN7XK35eGSB 2jcvU+3scKUSl89TD6q7K2svfZWDQCK7tv+8uDrwKDoWJ3Y7L4w5uCvWF4/byK/Fjfex DOiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=h46t9JeboLQUGCx2GIOw0IYgibesUTbbyNrG5/GTQkA=; b=kFAoXpzPQqfxBt+qBb5ohCiDkUsyRli9FLDjnqQAxzXZ7inyH91PRvjc8BqBYt6Yjs 6s3U7U9l0lmoj6KiLH52IuOEOG2pcPu1wlQCEVP0Z2bTyDOP1B9T9/i4GyZMJv6Rnv8i EsTXjZijm4/FXTME7yhOAF3z5xb/E360FqUQgRdu+xau8PIdvpWNkpysX9LftcpY0Qrs W3fbBXDPo4M+mSNTexNddbyAfumxIbk7AXzVueQKYJbV1mpeIOLOpmsnUxHftIdDweEe /io5EUUlcbsS8lj7BQOFw1rTUxzkFitBONiKbCmwQDGlp1mjShYxrRA6CzdhNq+UsOi+ Asnw== X-Gm-Message-State: AOAM532El+VuxNvZpwNR+UUoCSAR4DxNlZL/4olWa5Pbdy/J+0T7RZn6 8vIISbAdFzZRBW51uPrGjVY= X-Google-Smtp-Source: ABdhPJxnAhhnN9mrE4yCbp7pTUo1nnvEaUhC35fNLXm/dcYfzzYE9+NssqkT241D7Od9a7sfhZpBPg== X-Received: by 2002:a17:90a:ec15:: with SMTP id l21mr7663066pjy.164.1615724176712; Sun, 14 Mar 2021 05:16:16 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.16.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:16:16 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 20/22] ppc: qemu: Create a virtual memory mapping of the platform bus Date: Sun, 14 Mar 2021 20:15:04 +0800 Message-Id: <20210314121506.18303-21-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean QEMU ppce500 target can dynamically instantiate an eTSEC device on a platform bus if "-device eTSEC" is given to QEMU. It is presented as a "simple-bus" in the device tree, with an additional compatible string "qemu,platform". Let's create a virtual memory mapping for it in misc_init_r(), in preparation to adding eTSEC support. Signed-off-by: Bin Meng Reviewed-by: Vladimir Oltean --- Changes in v4: - make platform_bus_map_region() return void Changes in v3: - extract platform bus virtual memory mapping codes to a new routine - add a "break" in case multiple "qemu,platform" nodes exist Changes in v2: - turn on CONFIG_SIMPLE_BUS_CORRECT_RANGE in qemu-ppce500_defconfig board/emulation/qemu-ppce500/Kconfig | 6 +++++ board/emulation/qemu-ppce500/qemu-ppce500.c | 29 +++++++++++++++++++++ configs/qemu-ppce500_defconfig | 1 + 3 files changed, 36 insertions(+) diff --git a/board/emulation/qemu-ppce500/Kconfig b/board/emulation/qemu-ppce500/Kconfig index 4312d986d8..1c5aa18aa9 100644 --- a/board/emulation/qemu-ppce500/Kconfig +++ b/board/emulation/qemu-ppce500/Kconfig @@ -9,4 +9,10 @@ config SYS_VENDOR config SYS_CONFIG_NAME default "qemu-ppce500" +config PLATFORM_BUS_MAP_ADDR + hex + default 0xf0000000 + help + The QEMU platform bus base mapped address in the virtual memory space. + endif diff --git a/board/emulation/qemu-ppce500/qemu-ppce500.c b/board/emulation/qemu-ppce500/qemu-ppce500.c index daa103c564..924cc02c4b 100644 --- a/board/emulation/qemu-ppce500/qemu-ppce500.c +++ b/board/emulation/qemu-ppce500/qemu-ppce500.c @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include #include #include @@ -109,6 +111,17 @@ static int pci_map_region(phys_addr_t paddr, phys_size_t size, ulong *pmap_addr) return 0; } +static void platform_bus_map_region(ulong map_addr, phys_addr_t paddr, + phys_size_t size) +{ + /* Align map_addr */ + map_addr += size - 1; + map_addr &= ~(size - 1); + + /* Map virtual memory for range */ + assert(!tlb_map_range(map_addr, paddr, size, TLB_MAP_IO)); +} + int misc_init_r(void) { struct udevice *dev; @@ -148,6 +161,22 @@ int misc_init_r(void) */ disable_tlb(find_tlb_idx((void *)CONFIG_SYS_TMPVIRT, 1)); + /* + * Detect the presence of the platform bus node, and + * create a virtual memory mapping for it. + */ + for (ret = uclass_find_first_device(UCLASS_SIMPLE_BUS, &dev); + dev; + ret = uclass_find_next_device(&dev)) { + if (device_is_compatible(dev, "qemu,platform")) { + struct simple_bus_plat *plat = dev_get_uclass_plat(dev); + + platform_bus_map_region(CONFIG_PLATFORM_BUS_MAP_ADDR, + plat->target, plat->size); + break; + } + } + return 0; } diff --git a/configs/qemu-ppce500_defconfig b/configs/qemu-ppce500_defconfig index 536fe7d6e1..151834b4cf 100644 --- a/configs/qemu-ppce500_defconfig +++ b/configs/qemu-ppce500_defconfig @@ -28,6 +28,7 @@ CONFIG_OF_BOARD=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM=y +CONFIG_SIMPLE_BUS_CORRECT_RANGE=y CONFIG_BLK=y CONFIG_HAVE_BLOCK_DEVICE=y CONFIG_MPC8XXX_GPIO=y From patchwork Sun Mar 14 12:15:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452683 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=HaY3WMo6; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DyzC70TX1z9sRR for ; Sun, 14 Mar 2021 23:20:02 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2AB02829B5; Sun, 14 Mar 2021 13:16:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HaY3WMo6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6C5A282975; Sun, 14 Mar 2021 13:16:24 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 09C8D82964 for ; Sun, 14 Mar 2021 13:16:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pl1-x633.google.com with SMTP id u18so13947835plc.12 for ; Sun, 14 Mar 2021 05:16:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0bRIoNK7wnz6bpEZRwPF28+YN4CARD5LNcDwt15rMLI=; b=HaY3WMo6RM6VwcjENlf1pvjdoXU8Tpr43ERLS4NCRAsQ3qim7fpVwjDUq7kpwLdHOb z5M2nJY7HVBmGHauMcIXsdLctw06hlTnHpk0ma31cqVXorzSN0d5aeFQEoaKNj3Fo0t8 dCk9BNVurP6H8TT+TS30lFPLpsJxZghF3oqFBB1Mu70vD6PXjYts2otytX4+LWWDaGrt 3mGDoZU2ujxhdXxAMxnobRy83SLY0sg/O4PlHUPA4ZiJoGGKFPyqzYC103PiOntKD9bP ZIGCcB5TOWl4hIcdaXRPbQ2HVOqlg2+bMSveckesTeVHni9XocOaZKr1AGSYW5UZdcAP CFvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0bRIoNK7wnz6bpEZRwPF28+YN4CARD5LNcDwt15rMLI=; b=KkUK0P7tDSPBm1OxS9KfhFzNVd6xvDiCXsueOmZcs0K7Ic8KmK/DabBCSMqxM6ay6C ifyO0vNgOFCjtdX7oLZYi14sACDkSYHkBX3ysvxokQSczbZ3MWYi4FNASfdkShBHTmMd wOvMNVIm8p7BQX5RcYP4v1b4pBGIHaF3+zs/nYGiWAdP/g8OYdFwskVx5GGEAaOobQOK HRywbLnpPwPxIUdxDbzt5rXsbZ7RJU9Rxp8Dym1s6XCRO+fKLWihxgUiUOUm5iUwlSiQ +YvMSBsqWvXHnwp9ppJmZfdGXBt9GT5Y6AHaiDCoTG0AlNMlu3dii9w2o/a+76ferzem TXjw== X-Gm-Message-State: AOAM531gGBcztu7VcbRMuumJRzGRCi4YtqhuQEBN/g7XpUiFDpqrq1i9 zW5dP1tjUUrVxNRGuJX1Kcs= X-Google-Smtp-Source: ABdhPJzsT0ZaVpS7ABiGU7U7az2yB5/QxDcVsFyrrp9zmNcJzO3skggZIpfZSVf3Eat2VCsIc2K2ew== X-Received: by 2002:a17:90a:f3cc:: with SMTP id ha12mr7709948pjb.180.1615724179696; Sun, 14 Mar 2021 05:16:19 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.16.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:16:19 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 21/22] ppc: qemu: Enable eTSEC support Date: Sun, 14 Mar 2021 20:15:05 +0800 Message-Id: <20210314121506.18303-22-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean QEMU ppce500 target can dynamically instantiate an eTSEC device if "-device eTSEC" is given to QEMU. This commit enables eTSEC driver and the required fixed PHY driver to create a usable network configuration using eTSEC. Unlike a real world 85xx board that usually stores the eTSEC MAC address in an EEPROM, CONFIG_NET_RANDOM_ETHADDR is required for QEMU otherwise U-Boot ethernet initialization complains no valid ethernet address is set. Signed-off-by: Bin Meng Reviewed-by: Vladimir Oltean --- (no changes since v1) configs/qemu-ppce500_defconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configs/qemu-ppce500_defconfig b/configs/qemu-ppce500_defconfig index 151834b4cf..a1b9ea56ca 100644 --- a/configs/qemu-ppce500_defconfig +++ b/configs/qemu-ppce500_defconfig @@ -27,6 +27,7 @@ CONFIG_OF_CONTROL=y CONFIG_OF_BOARD=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NET_RANDOM_ETHADDR=y CONFIG_DM=y CONFIG_SIMPLE_BUS_CORRECT_RANGE=y CONFIG_BLK=y @@ -35,8 +36,11 @@ CONFIG_MPC8XXX_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_FSL=y # CONFIG_MMC is not set +CONFIG_PHY_FIXED=y CONFIG_DM_ETH=y +CONFIG_DM_MDIO=y CONFIG_E1000=y +CONFIG_TSEC_ENET=y CONFIG_DM_PCI=y CONFIG_PCI_MPC85XX=y CONFIG_DM_RTC=y From patchwork Sun Mar 14 12:15:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452684 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=L7tPXxXK; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DyzCN70vsz9sRf for ; Sun, 14 Mar 2021 23:20:16 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D36D3829BA; Sun, 14 Mar 2021 13:16:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="L7tPXxXK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5F2808297B; Sun, 14 Mar 2021 13:16:27 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0294A82976 for ; Sun, 14 Mar 2021 13:16:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pj1-x102d.google.com with SMTP id w8so7357380pjf.4 for ; Sun, 14 Mar 2021 05:16:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oAsBJHhtLVB7yNuZTPt+naWaxLqqB0ejhIDZx66Re3s=; b=L7tPXxXKV+qqaI1v7JOiBnW3EfAdaanHUGs6Jn/PgRLm7nn5FzbOReauQyuwRGdUyY HIOy6IAhPuSCxxz341EfkWtr1fswP9p8BSHHHXKSnAv96WQxRdBE3ssxe6t2gk0HHylD tFwEgb2hCnW/423P0aOC/4g+YxZKC6aF/kQcrAvYmJfCxqw/tSQZiMKdh9eXNQ9sggOU KGBxwABFSgrp/94fwbhTKn9ZXyCbPDeIIVSyb95ByHz/ZjfjlnnO2PX4zEnqjdV53VTZ 9IuFPKDOI6/OIEwvx/P9t+YFwpGO32uRIyDoNuHA/h+1KFlym+UYbsG5JSMvNAhHyIVo GBkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oAsBJHhtLVB7yNuZTPt+naWaxLqqB0ejhIDZx66Re3s=; b=mwMrm8PP6BP8peJto5izHptsLW/Jd2V7xDKmJ/TxrSLFvlaiUrc8EjcMu0iCwKrrjz kqfVBE2A7RDByb/AR6w3W7jxVPQ5x3nHn+AgDoQH4qJouv/MvAbtf3cNmE6ZMcKO1rZB rs+Zuy1Rh+Jr92LmHQooxl9XgAAw/1i7KsYB2gReR3N4Hn9lk7GmQDuhxf+5S4PpgWSk oUDNpGtLodXPnccrupGT8JGbkJ5XDjIQhWiu9Rk8/TgmMrRj7D9A5VL62HXMX7v5WMlY 5xZ2PyGDH9Sy8276OSj5nDUsxIZ+i0xLYSfgJbl2z6T8NbQz89xmLx2mf9goL+tjc/kP n0aA== X-Gm-Message-State: AOAM532qPxGLQ+w6z5ib/yiA+MpDQOVkP0lO+07HoaqRkAH5J+NIKiwm VZebiQbqwbc7rmVK+IE6zDM= X-Google-Smtp-Source: ABdhPJwXP4eIlRcqDAfJHEAN3bdwFKm4YBjIbcN/2Si1s36rA15hxmTkkcXTaiBF87haoJwTaZQG3g== X-Received: by 2002:a17:90b:46d0:: with SMTP id jx16mr7790986pjb.3.1615724182582; Sun, 14 Mar 2021 05:16:22 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 2sm10504325pfi.116.2021.03.14.05.16.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:16:22 -0700 (PDT) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v4 22/22] doc: board: qemu-ppce500: Document eTSEC usage Date: Sun, 14 Mar 2021 20:15:06 +0800 Message-Id: <20210314121506.18303-23-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314121506.18303-1-bmeng.cn@gmail.com> References: <20210314121506.18303-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean Document how to launch a QEMU session with eTSEC as a network device. Signed-off-by: Bin Meng Reviewed-by: Vladimir Oltean --- (no changes since v1) doc/board/emulation/qemu-ppce500.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/board/emulation/qemu-ppce500.rst b/doc/board/emulation/qemu-ppce500.rst index 0a5c86c61a..5de0aaf55d 100644 --- a/doc/board/emulation/qemu-ppce500.rst +++ b/doc/board/emulation/qemu-ppce500.rst @@ -70,6 +70,11 @@ interface at PCI address 0.1.0, but we can switch that to an e1000 NIC by:: $ qemu-system-ppc -nographic -machine ppce500 -bios u-boot \ -nic tap,ifname=tap0,script=no,downscript=no,model=e1000 +The QEMU ppce500 machine can also dynamically instantiate an eTSEC device if +"-device eTSEC" is given to QEMU:: + + -netdev tap,ifname=tap0,script=no,downscript=no,id=net0 -device eTSEC,netdev=net0 + VirtIO BLK driver is also enabled to support booting from a disk image where a kernel image is stored. Append the following to QEMU::