Message ID | 20240130003546.1546-1-ansuelsmth@gmail.com |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-43674-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp917220dyb; Mon, 29 Jan 2024 16:36:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdxhy0PrYsnSFBRjNGrbG4HX0f01ku5lCWg/2angi8Do254fyUSC2e0EIyAgdcjlatzwac X-Received: by 2002:a05:6808:1886:b0:3bd:e3cb:70d2 with SMTP id bi6-20020a056808188600b003bde3cb70d2mr3718759oib.2.1706575003197; Mon, 29 Jan 2024 16:36:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706575003; cv=pass; d=google.com; s=arc-20160816; b=lCnWDFJ4cWSQK7zslVwwr1mdKKRw1zwODTchXI4V8+r122gXGvn08ENbO1V32AcZdr m/93AK6T7+F6djBqSznDA/heAoKJCWCUfhOucFAClSL+MMX/17+lw15t8+gC//seu8Jc +L9gXDmCEJ/YemDMGeRK4OOEFhKHad+5irgndgVZfv1/9Oh7Eme13dnjD5kwwv//0YUA Y/K22jRO4vsgKMOvueowrkh/eBD+kegsDtK4XIMLJyHYux0yD+1purVVBFUUZI3nCAxG LIAbKrhGf2k8d6kMl1TAoJdIwnVRrPtfGZHrUHqhixm32X0iWpNruymyyq7UrDwqxZwL MfYw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=TKfKNYMatjFN+InDvnfGVCOEtv8nXBV5jhJHJ4q+47M=; fh=cQ7XA3MYQ9nsuIQUoAwOGxcdk1xJQL7zXSk9w8uvCAc=; b=YuNh7GzJQzg6KfhHQJcJ6QX7EA8Jr25NukBpd3aDpulOYtOyu94tqzwTA0VT2QNHnC 5oaaeNYXzo0BhXoXG4o72Ly9P//FfHgksH6Y7ZfW3Ra9e0DPKjlkjfRxVPXKXfEKE+fA 9vU6KbsUPz5zVx04aYlWdGxaF2fiCI0Y4rsJKh95vDKimAvil4eu5nvdy7Q9YEoXVrGN Kac7+k/NfOnfdVxFD+ElKC4Q+BaaiB8HeTb7vvLY0n0ST46YCbvJytJAUwAcRJ+4Xnf9 o+Db+XRHPMf75nHVrcH0LxUOG4g8otFgJb7UISiM+bAoeMcXD369FSzN2VTMRJBfurMA MsSw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=U7H1f7kt; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-43674-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43674-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u2-20020a656702000000b005d8b68b191csi4912684pgf.584.2024.01.29.16.36.43 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 16:36:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43674-ouuuleilei=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=U7H1f7kt; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-43674-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43674-ouuuleilei=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 E9CCB286209 for <ouuuleilei@gmail.com>; Tue, 30 Jan 2024 00:36:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B10C236132; Tue, 30 Jan 2024 00:36:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U7H1f7kt" Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 34B7ED53C; Tue, 30 Jan 2024 00:36:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706574964; cv=none; b=k74Si18KkK5duOtQJvdVnApRDZiCc7FKWCvP8XPEw0HtSoVJ0Dvcy/wrgMDeOGRbd3n+POIW8AxEzYPz2KnsQpuRP/sNJGrMulpYlDj0MXnkVaKHPzF2ejrZFCs7viWko3TetQMsk4mayvg0VEHysI2hAiuDhropmPo41mVW0SM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706574964; c=relaxed/simple; bh=Suw9KF5ktIVTK5uerX+D/DxxdHAK+pd3QV3U4IsNHGM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=mVWw7xkIzWYMkB5tZkz8X8cLfOB07CUtsLmVXXSvURX1Zw9WXuYWCwOrsHTTwIbxjblDJmZr8tdgp4kIh9/LFQMvBGlSdl2ei9l6ubJ+B70WbHQJGgiHvWD38FTns7RUFWzsjnV2mawncZPkt/JTtQGuEzmXY4PyC+w7K8LqEEo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=U7H1f7kt; arc=none smtp.client-ip=209.85.221.54 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-wr1-f54.google.com with SMTP id ffacd0b85a97d-33aeb088324so1239140f8f.2; Mon, 29 Jan 2024 16:36:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706574961; x=1707179761; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TKfKNYMatjFN+InDvnfGVCOEtv8nXBV5jhJHJ4q+47M=; b=U7H1f7ktTXjyAEv78fPV4xO4vS6e8Dk9kb3AVMEwztOGkuXDwerZrManR4N5gzt9Fy PIsvU2gbm0p5+z7WwotfKTdfvsMVt+csSPIyq4NfjXWKHQvmTcDE1AgLr2PoKSJdVvhm h1PF09vuQ3siRlfZkL6UdoXdI1lry7AvVs+TusggtbMp6N47jow0IBJwJvDM33wvVBoO 7EKBC9jIcQVVcwrslvalMWB7SlS+6WFHjtFQTGyPGsP8oqblAYbOp84FghBa8kBk43aR 1iW3Pg5u7VrMpNXuqTiQLh7IYTKRHoRBWqWo7vhuyHf0Cw8A4SsL19njr9GqBwpxhcGh xC5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706574961; x=1707179761; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TKfKNYMatjFN+InDvnfGVCOEtv8nXBV5jhJHJ4q+47M=; b=GdnEIoB4hetaMFadyBxMa+HeGdEascRgJIILbTBPKqfOu+bFormf8hs9kdGt4RnI69 BLO/lbA+rX/ki7n4WDETvXnw0k5upTl6b3PxXRuvwTtIO/ATO3YajlVhGhT2QeUhPf/H eTD3yAQPISzRSfFEhJS1gSHzkMY7110AANJY5YhlTG1HfUe4aTM/BIylsfENsN4R5ww3 C4PW5C0YXYpF9SrCJ6kh3wh4hG/CDW53Rd9LxrYGKvW+iCG1qHXAnHYmlEnoYqgnatZw xey419/xbzEDZUFFWf3UXeJ/zUMGv74DSoRIi/Mf8CTJgHFZjjmbkR1xbLbGSK/ytyni jn+Q== X-Gm-Message-State: AOJu0Ywuj3+tX6NxBrlwcDZJZfXh6OTdY4Wp1LUgzY+jxyN6g6x0JzjG 49/rgZmw0YFFoVD+A8STaeScz1x7Xv1yeKK972Iuzt6RjGBpNfM9YFA/ABTs X-Received: by 2002:a05:6000:dcb:b0:33a:ea63:90cb with SMTP id dw11-20020a0560000dcb00b0033aea6390cbmr4128799wrb.55.1706574960959; Mon, 29 Jan 2024 16:36:00 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id l10-20020a056000022a00b0033af350fb88sm2542167wrz.25.2024.01.29.16.35.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 16:36:00 -0800 (PST) From: Christian Marangi <ansuelsmth@gmail.com> To: Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, Robert Marko <robert.marko@sartura.hr>, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Jie Luo <quic_luoj@quicinc.com> Cc: Christian Marangi <ansuelsmth@gmail.com> Subject: [net-next PATCH v2 0/3] net: mdio-ipq4019: fix wrong default MDC rate Date: Tue, 30 Jan 2024 01:35:19 +0100 Message-ID: <20240130003546.1546-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789009337602950300 X-GMAIL-MSGID: 1789473590557031185 |
Series |
net: mdio-ipq4019: fix wrong default MDC rate
|
|
Message
Christian Marangi
Jan. 30, 2024, 12:35 a.m. UTC
This was a long journey to arrive and discover this problem. To not waste too much char, there is a race problem with PHY and driver probe. This was observed with Aquantia PHY firmware loading. With some hacks the race problem was workarounded but an interesting thing was notice. It took more than a minute for the firmware to load via MDIO. This was strange as the same operation was done by UBoot in at max 5 second and the same data was loaded. A similar problem was observed on a mtk board that also had an Aquantia PHY where the load was very slow. It was notice that the cause was the MDIO bus running at a very low speed and the firmware was missing a property (present in mtk sdk) that set the right frequency to the MDIO bus. It was fun to find that THE VERY SAME PROBLEM is present on IPQ in a different form. The MDIO apply internally a division to the feed clock resulting in the bus running at 390KHz instead of 6.25Mhz. Searching around the web for some documentation and some include and analyzing the uboot codeflow resulted in the divider being set wrongly at /256 instead of /16 as the value was actually never set. Applying the value restore the original load time for the Aquantia PHY. This series mainly handle this by adding support for the "clock-frequency" property. Changes v2: - Use DIV_ROUND_UP - Introduce logic to chose a default value for 802.3 spec 2.5MHz Christian Marangi (3): dt-bindings: net: ipq4019-mdio: document now supported clock-frequency net: mdio: ipq4019: add support for clock-frequency property arm64: dts: qcom: ipq8074: add clock-frequency to MDIO node .../bindings/net/qcom,ipq4019-mdio.yaml | 15 +++ arch/arm64/boot/dts/qcom/ipq8074.dtsi | 2 + drivers/net/mdio/mdio-ipq4019.c | 109 +++++++++++++++++- 3 files changed, 120 insertions(+), 6 deletions(-)
Comments
On Tue, 30 Jan 2024 01:57:36 +0100 Christian Marangi wrote: > > If we merge this via netdev, is a merge conflict likely? Any other > > changes expected in this area, given the changes which might happen to > > GCC soon, etc? > > > > Reviewed-by: Andrew Lunn <andrew@lunn.ch> > > Honestly I don't expect much to change here in the mdio node. > > If it's a problem I can submit in a separate patch in linux-msm. The arch maintainers usually prefer to take the DTS patches, so if there isn't anything special here we should probably default to that.
On 2/4/2024 11:22 PM, Andrew Lunn wrote: > On Sun, Feb 04, 2024 at 05:59:10PM +0800, Jie Luo wrote: >> >> >> On 1/30/2024 8:35 AM, Christian Marangi wrote: >>> + >>> + /* If div is /256 assume nobody have set this value and >>> + * try to find one MDC rate that is close the 802.3 spec of >>> + * 2.5MHz >>> + */ >>> + for (div = 256; div >= 8; div /= 2) { >>> + /* Stop as soon as we found a divider that >>> + * reached the closest value to 2.5MHz >>> + */ >>> + if (DIV_ROUND_UP(ahb_rate, div) > 2500000) >>> + break; >> >> Hi Christian, >> Sorry for the delayed review. >> >> The MDIO hardware block supports higher frequency 6.25M and 12.5M, >> Would you remove this 2.5MHZ limitation? On the IPQ platform, we >> normally use 6.25MHZ. > > 802.3 says the clock has a maximum of 2.5MHz. So this code is correct. > > It is however O.K. to go faster, but since that breaks the standard, > you need each board to indicate it knows all the devices on the bus do > support higher speeds and its O.K. to break the standard. You indicate > this by using the DT property in its .dts file. For an MDIO bus which > is totally internal, you could however put the DT property in the SoC > .dtsi file. > > Andrew Understand it, Thanks Andrew.