Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2863557rdb; Tue, 26 Dec 2023 07:31:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHaSU9TgvhjfCNNEcU5+abSNs6SSO3pByeimOepdU4qjaQPjif7sr4QAoq6RfpInTQExsdt X-Received: by 2002:a17:902:7787:b0:1d3:45b7:bc11 with SMTP id o7-20020a170902778700b001d345b7bc11mr3026431pll.48.1703604671500; Tue, 26 Dec 2023 07:31:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703604671; cv=none; d=google.com; s=arc-20160816; b=FeT661zsM/OxqVyhMvGAmZPd0tOg26XhS/yU2OvCmkBZqeoHv4uSLCHSv6WLzKNbWK UQGXmHbxwREbnzOiRLL8XMH53DkP5SVhCi+PRZ4GzL8E6QQ6ehVrYZ5FGc4TlwQcnjwT 4ULMvELDotiHp/vFfqSv1ybvZiy3B0Mkz9p9lI4mwd1oK5zIMTy7d4e+bzXuRD+N27aX kVIBcLoi2IVP+giRtlhsdZDaMAeacFKJJmKU0BlUtKEwG3qYmTlGNHrE/5ZMcD90xTrg 9jOLSdXRHdjgOKDwiwqPh67WCjdOwhAMBLqUk/GW2JETMsHCa3A17MB+5/Jxkm9YPuMK J20Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=kgmuVd4P8obINlchnrnXm6SfRjG8GH/yAXA2zbhaFQw=; fh=AR8J9PkpiGPGk+EPpCZalbV0+j6uydswZmIwNkmFKgU=; b=KKrhtAbJ0eSQqh8qhZ7hFRTnmo3e9yOlNeyQICKh5zgftcFsC0PqRJPb/1IuOzvEKp 7kG3xsnwrUXtkr469lwpt99tzT2WITF4uCzuMirRwO3pDnjU/HqeAJCcbXQ8+DT95Uh5 FI7ALdIPywcJKGLRwtBjVHuJJrqxB9Fg5G+b3gBONGQIP5F+qogfJbzdHOYaYkViIbig nhKl5lbPPyhS82NNI9DpOI5gJznxFMoLaAjSvUCWD8v80IT6P9kTd/MRSFzG1/byobiv 750r9JnhPPoU/iQCMt3tCM1I1FsBFZ0d9AxqnTz3RpM7Uqcyfp2jAaGCcq/UTWnyf9dN SZ8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Kpe5o5Lt; spf=pass (google.com: domain of linux-kernel+bounces-11548-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11548-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j7-20020a170903024700b001d3ff189f4csi9669982plh.515.2023.12.26.07.31.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 07:31:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11548-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Kpe5o5Lt; spf=pass (google.com: domain of linux-kernel+bounces-11548-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11548-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DB4D228321D for ; Tue, 26 Dec 2023 15:31:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08D114F214; Tue, 26 Dec 2023 15:31:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Kpe5o5Lt" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C4A64F5E3; Tue, 26 Dec 2023 15:31:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-5534abbc637so4694041a12.0; Tue, 26 Dec 2023 07:31:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703604659; x=1704209459; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=kgmuVd4P8obINlchnrnXm6SfRjG8GH/yAXA2zbhaFQw=; b=Kpe5o5Ltn1lH8sQVykQbu6xTXnaaVZAyPSb+8Xo4L4A59efIs3W5uSHRnr+/m2qaVZ QzpvUqT3Ck+HDFLAa/lT4APV6uveLbKLEGXQtBARgv9n5TmFQQTqPg3I3ydj7e9M3PE0 lgPy8219T/q9vj1SfzkBRvJvBkeEOh+APY8UrZrsPENXlWG95rvYdE7Ex7fWvDiWoXH4 SJ7RnvuGWOInzRJQqlKibbNmCzhaZub9MgAQ3gdrtUq6AKS8k8E6lHQQmsvf34LyFACw rmaCLNNaNtH4cswjIwrnH54t0DXPDuPFk8dGbzFjDHOoKQwFfyXfCvD6sRovgXA2RYrb cmiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703604659; x=1704209459; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=kgmuVd4P8obINlchnrnXm6SfRjG8GH/yAXA2zbhaFQw=; b=lBvy8VhJfaSlJBesE93TQcTb8XB3k16tahYqfJaQbNldgXNcKYvg3/ElgqoignbfqD qmSyOtvY/1ajB60qClQTtjy5/cj3GJy/pvP3spVkjRp8scbK8uBZ8aoSpft8H/3pg9kV E5ItGs/DuVfBtZqUg/m13H3w5NOmOIj/JnPypRLW5w6TG+2vfqoqYWsjAffZ0W1Q1G5C Ag9piBt+/OViSKjZwgXtsTgTgKCMyPHjnDX7a5LYeSbxREDhQkwJko4jKN9Bbnfdks7t 7Pq6nmcLvGM0FHpQLqlj/+z6uqywa4j7MEWuAouHqQnxvfrUIOMD0S/W5UM2WlfCFEgi nP3A== X-Gm-Message-State: AOJu0YxFHwe7RW84uKCLf3PYyEszn1fFcUcAArZbEP3wbzS8bAlH89BL no1r1vzUkPWD6J5LY8xTz9M= X-Received: by 2002:a17:906:1091:b0:a26:cab2:a5d3 with SMTP id u17-20020a170906109100b00a26cab2a5d3mr2517414eju.115.1703604658574; Tue, 26 Dec 2023 07:30:58 -0800 (PST) Received: from skbuf ([188.25.255.53]) by smtp.gmail.com with ESMTPSA id fi8-20020a1709073ac800b00a272de16f52sm362556ejc.112.2023.12.26.07.30.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 07:30:58 -0800 (PST) Date: Tue, 26 Dec 2023 17:30:55 +0200 From: Vladimir Oltean To: Jagan Teki Cc: Andrew Lunn , Heiner Kallweit , "Andrew F. Davis" , Florian Fainelli , linux-kernel , netdev@vger.kernel.org, Michael Nazzareno Trimarchi , Ioana Ciornei , Shawn Guo , linux-arm-kernel , Fabio Estevam Subject: Re: PHY issue with SJA1105Q/DP84849I Design Message-ID: <20231226153055.4yihsmu6kiak6hkf@skbuf> References: <20231222145100.sfcuux7ayxtxgogo@skbuf> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Dec 26, 2023 at 01:11:08PM +0530, Jagan Teki wrote: > &fec { > pinctrl-names = "default"; > pinctrl-0 = <&pinctrl_enet>; > phy-mode = "mii"; > status = "okay"; tl;dr: I think what is missing is: fixed-link { speed = <100>; full-duplex; }; > > mdio { > #address-cells = <1>; > #size-cells = <0>; > > ethphy0: ethernet-phy@0 { > compatible = "ethernet-phy-ieee802.3-c22"; > reg = <0>; > }; > > ethphy1: ethernet-phy@1 { > compatible = "ethernet-phy-ieee802.3-c22"; > reg = <1>; > }; > }; > }; > > root@imx6solo:~# ip link set dev eth0 down > root@imx6solo:~# ip link set dev ethphy0 down > root@imx6solo:~# ip link set dev ethphy1 down > root@imx6solo:~# ip link set dev ethphy0 address 00:11:22:33:44:55 > root@imx6solo:~# ip link set dev ethphy1 address 00:11:22:33:44:66 > root@imx6solo:~# ip addr add dev ethphy0 192.168.1.1/16 > root@imx6solo:~# ip addr add dev ethphy1 192.168.1.5/16 > root@imx6solo:~# ip link set dev eth0 up > [ 617.126753] dp83848_config_init: ret 0 > [ 617.130831] TI DP83849I 10/100 Mbps PHY 2188000.ethernet-1:00: attached PHY driver (mii_bus:phy_addr=2188000.ethernet-1:00, irq=POLL) > root@imx6solo:~# [ 619.207519] fec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx > [ 619.215698] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready eth0 is the FEC port, right? > root@imx6solo:~# ip link set dev ethphy0 up > [ 634.114608] sja1105 spi1.0 ethphy0: configuring for phy/mii link mode > [ 634.126617] ------------[ cut here ]------------ > [ 634.131463] WARNING: CPU: 0 PID: 330 at drivers/net/phy/phy.c:1157 phy_start+0x58/0xb4 > [ 634.139627] called from state RUNNING > [ 634.143310] Modules linked in: bnep tag_sja1105 sja1105 pcs_xpcs brcmfmac brcmutil imx_sdma coda_vpu v4l2_jpeg imx_vdoa evbug > [ 634.154815] CPU: 0 PID: 330 Comm: ip Not tainted 6.1.58 #1 > [ 634.160321] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) > [ 634.166866] unwind_backtrace from show_stack+0x10/0x14 > [ 634.172125] show_stack from dump_stack_lvl+0x58/0x70 > [ 634.177205] dump_stack_lvl from __warn+0x70/0x1a4 > [ 634.182023] __warn from warn_slowpath_fmt+0x1bc/0x270 > [ 634.187181] warn_slowpath_fmt from phy_start+0x58/0xb4 > [ 634.192427] phy_start from dsa_port_enable_rt+0x54/0x9c > [ 634.197765] dsa_port_enable_rt from dsa_slave_open+0xb8/0x17c > [ 634.203624] dsa_slave_open from __dev_open+0xec/0x1ac > [ 634.208788] __dev_open from __dev_change_flags+0x18c/0x224 > [ 634.214377] __dev_change_flags from dev_change_flags+0x14/0x44 > [ 634.220313] dev_change_flags from do_setlink+0x254/0xe4c > [ 634.225737] do_setlink from rtnl_newlink+0x598/0x80c > [ 634.230811] rtnl_newlink from rtnetlink_rcv_msg+0x168/0x574 > [ 634.236485] rtnetlink_rcv_msg from netlink_rcv_skb+0xb8/0x11c > [ 634.242337] netlink_rcv_skb from netlink_unicast+0x1a8/0x2dc > [ 634.248108] netlink_unicast from netlink_sendmsg+0x1d8/0x450 > [ 634.253884] netlink_sendmsg from ____sys_sendmsg+0x188/0x258 > [ 634.259656] ____sys_sendmsg from ___sys_sendmsg+0x6c/0xa4 > [ 634.265164] ___sys_sendmsg from sys_sendmsg+0x50/0x98 > [ 634.270324] sys_sendmsg from ret_fast_syscall+0x0/0x1c > [ 634.275569] Exception stack(0xf1071fa8 to 0xf1071ff0) > [ 634.280637] 1fa0: 00000000 00000001 00000003 bef4d710 00000000 00000000 > [ 634.288828] 1fc0: 00000000 00000001 b6f415a0 00000128 626ad475 00000000 00531cc0 00531cc0 > [ 634.297016] 1fe0: 00000128 bef4d6b0 b6e3f6d3 b6db1ae6 > [ 634.302150] irq event stamp: 3327 > [ 634.305485] hardirqs last enabled at (3335): [] __up_console_sem+0x50/0x60 > [ 634.313404] hardirqs last disabled at (3344): [] __up_console_sem+0x3c/0x60 > [ 634.321318] softirqs last enabled at (3230): [] __do_softirq+0x2c0/0x57c > [ 634.329055] softirqs last disabled at (3187): [] __irq_exit_rcu+0x138/0x17c > [ 634.336971] ---[ end trace 0000000000000000 ]--- > root@imx6solo:~# ip link set dev ethphy1 up > [ 644.613564] sja1105 spi1.0 ethphy1: configuring for phy/mii link mode > root@imx6solo:~# [ 646.727549] sja1105 spi1.0 ethphy1: Link is Up - > 100Mbps/Full - flow control off > [ 646.735033] IPv6: ADDRCONF(NETDEV_CHANGE): ethphy1: link becomes ready Ok. The WARN_ON() is saying that the DSA user port's phy_start() found the attached PHY already in the RUNNING state. As if there was already someone else driving it. That "someone else" seems to be the FEC driver from the log above, which for some reason has connected to the DP83849I by itself, and phylink/phylib hasn't denied the second attempt to connect to the same PHY for some reason. If you look at fec_enet_mii_probe(), I see it has 2 code paths, one for when fep->phy_node (defined as the "phy-handle" reference) is non-NULL, and one for when it is NULL. What you're missing is a fixed-link specifier in the device tree for FEC, otherwise it tries to call phy_connect() to some random MDIO address on the bus and that breaks things in some way which I don't understand. The code which should have prevented this from happening is in phy_attach_direct(): if (phydev->attached_dev) { dev_err(&dev->dev, "PHY already attached\n"); err = -EBUSY; goto error; }