From patchwork Wed Nov 29 02:12:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 171030 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp68425vqn; Tue, 28 Nov 2023 18:13:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IEKf8g9EvqAG+gAjWr6+WDBHmWuU3PwtSbhGCZ+XaF0Gm0BOaQMJHiGFsbiC/z1yyLybCyk X-Received: by 2002:a05:6a20:9e4d:b0:14c:c511:387d with SMTP id mt13-20020a056a209e4d00b0014cc511387dmr19299446pzb.9.1701223989258; Tue, 28 Nov 2023 18:13:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701223989; cv=none; d=google.com; s=arc-20160816; b=MpqvHrYUnKoSjlNB60BtgFFg8diuxojV6fUOm61PaRTKhonBCEXWnrM9m1TRSQMlml oz72iEdtFe6jTi8IFhq0vT+fz3BDWlC0ajx6Hyb2ClGgEMH+p8Rdsi0gtQqo2pW+YCkw 7dfWKhSQBy4bWLMxzhJHLj4kqtNiCq83yjK7bBTILgSJx2QPZvS1IaR8UBAXOjXpyV7I HGgyoUJIHMUgsIW8x7UwT0w5jBBJtzjN2WoIADWDZP2w2UX2i7mV/7d0Kca8atGx1cng WtOiKy9M+F+sqaCvxm6o6AzyYy2mpDo687BHKl4jK3ZXkZPYM282F6/t+72//nmRF/3Q sRDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5v5tvMkrHBHUZzomW/zRyl4hZOMTbCoPspKHkGLKUJU=; fh=M/Mg9TtngevyqXgZJCTwFV5p5//1sl9LEorA0JOhC3o=; b=xvZHC4d/QQA4QVG9slRZUa7iPmsHrXhInji+gXgKeTWIqBW+UWWcLto33l6Io/e8QI TxYiIunMACISOwJv351EOPhOoJgpTIhMQ4Tv+66TCC/8bOO58T41Sc7DGq8y7YaGCRQv vUnyPeQ2hfKw990Ts1QJnXL7o7ULlIXDneZv2qqNfz9+DL2JgOfcto/7n3uJeuT1jaRM ZUGOawD9EUerD8LHWhb1KutWguRq0QurdIlkcWt0pBRBc7zUZGJFtyJRk28pXVc5DPPW 7tbstn9uu8qGikXmghbCjpqxz4J2bZiU0sowtY5ypoeObpTTQMHAScbpA5Pl/WJvkm77 eDRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jIbZx8VU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id k5-20020a17090a9d8500b00285259acbcesi310123pjp.142.2023.11.28.18.13.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 18:13:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jIbZx8VU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8C87380A9AA7; Tue, 28 Nov 2023 18:13:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376772AbjK2CMr (ORCPT + 99 others); Tue, 28 Nov 2023 21:12:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234847AbjK2CMi (ORCPT ); Tue, 28 Nov 2023 21:12:38 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC7DF19BE; Tue, 28 Nov 2023 18:12:37 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40b479b9c35so20646755e9.1; Tue, 28 Nov 2023 18:12:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701223956; x=1701828756; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5v5tvMkrHBHUZzomW/zRyl4hZOMTbCoPspKHkGLKUJU=; b=jIbZx8VUvI/3erv6YejseXUsgbkFvYozPCTtwgR82PVrwefs29qm0YYoW/owwtHIEi 4CQiSbi7QQHuHiUj9jCareUSILWDCj6W0B5x440Fp/DspsjbuveYPtDrvV4LE0roiZVN DO2jND2ESJ6QUBQ3/YL2rDQXHN4m6BIavY/Xw+Po2fs38jYcYSyMX6AUHS9/trpJeTqL JyXa8vSKjyPv96z7Xqmo3Y52tT0xR39bUNMniSp5LpCd6clYiZ2aH9jwe9ZRrnp0x/7O wu/z3qDbpffeCBVQ9iBE4yhSgssggUsFnlsecaAHYx6+wgICyOzBEyVcOw5uBD03VKaw 9tZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701223956; x=1701828756; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5v5tvMkrHBHUZzomW/zRyl4hZOMTbCoPspKHkGLKUJU=; b=dWE6MKa4VezfJY4ismi+7wJIC/B2/Oyymrs4PvWvozPhq0mcd9iWDNxGTH3ZZEKcfq qJ31861Hf3dX8fJdAlgiiiIlNnGajJ1Rvf3NdhJgAwSuDQeqNpUefJCMjwGv8N57ToMV MACYRG2WO/kaIa1I19uW2uKkr/JChDZcf9nkyqbNVkkhbXtkihvHWCaQR6Kep7FsHiFQ X4Wm1TXSznjLDGPg8d1ERlhB+n1B4+bPvDEqaF/FbdisZ0MZcsS7xpNp9uSRGFLQzSgT P4+sUoWt3/9W9HyZRmvmLfaw8iwz9qidByy1hV4K9NAarv6k375ffbW2fa2JHUYUW454 Bh2w== X-Gm-Message-State: AOJu0YwNLqW+hdSLWpIrnF8fr1DR/JgBPr8ypEU8nN1/BfkC8GLZCG6n F/IGsKQNWxWrnccpQ4iSboE= X-Received: by 2002:a05:600c:1989:b0:408:3f87:cba with SMTP id t9-20020a05600c198900b004083f870cbamr11340219wmq.39.1701223955827; Tue, 28 Nov 2023 18:12:35 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id b19-20020a05600c4e1300b0040648217f4fsm321406wmq.39.2023.11.28.18.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 18:12:35 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andy Gross , Bjorn Andersson , Konrad Dybcio , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH 07/14] net: phy: at803x: move at8035 specific DT parse to dedicated probe Date: Wed, 29 Nov 2023 03:12:12 +0100 Message-Id: <20231129021219.20914-8-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231129021219.20914-1-ansuelsmth@gmail.com> References: <20231129021219.20914-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 28 Nov 2023 18:13:02 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783862645257244601 X-GMAIL-MSGID: 1783862645257244601 Move at8035 specific DT parse for clock out frequency to dedicated probe to make at803x probe function more generic. This is to tidy code and no behaviour change are intended. Signed-off-by: Christian Marangi --- drivers/net/phy/at803x.c | 62 ++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 19 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index b83422c6db74..e7d006ca1676 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -647,23 +647,6 @@ static int at803x_parse_dt(struct phy_device *phydev) priv->clk_25m_reg |= FIELD_PREP(AT803X_CLK_OUT_MASK, sel); priv->clk_25m_mask |= AT803X_CLK_OUT_MASK; - - /* Fixup for the AR8030/AR8035. This chip has another mask and - * doesn't support the DSP reference. Eg. the lowest bit of the - * mask. The upper two bits select the same frequencies. Mask - * the lowest bit here. - * - * Warning: - * There was no datasheet for the AR8030 available so this is - * just a guess. But the AR8035 is listed as pin compatible - * to the AR8030 so there might be a good chance it works on - * the AR8030 too. - */ - if (phydev->drv->phy_id == ATH8030_PHY_ID || - phydev->drv->phy_id == ATH8035_PHY_ID) { - priv->clk_25m_reg &= AT8035_CLK_OUT_MASK; - priv->clk_25m_mask &= AT8035_CLK_OUT_MASK; - } } ret = of_property_read_u32(node, "qca,clk-out-strength", &strength); @@ -1681,6 +1664,47 @@ static int at8031_set_wol(struct phy_device *phydev, return at803x_set_wol(phydev, wol); } +static int at8035_parse_dt(struct phy_device *phydev) +{ + struct device_node *node = phydev->mdio.dev.of_node; + struct at803x_priv *priv = phydev->priv; + u32 freq; + int ret; + + if (!IS_ENABLED(CONFIG_OF_MDIO)) + return 0; + + ret = of_property_read_u32(node, "qca,clk-out-frequency", &freq); + if (!ret) { + /* Fixup for the AR8030/AR8035. This chip has another mask and + * doesn't support the DSP reference. Eg. the lowest bit of the + * mask. The upper two bits select the same frequencies. Mask + * the lowest bit here. + * + * Warning: + * There was no datasheet for the AR8030 available so this is + * just a guess. But the AR8035 is listed as pin compatible + * to the AR8030 so there might be a good chance it works on + * the AR8030 too. + */ + priv->clk_25m_reg &= AT8035_CLK_OUT_MASK; + priv->clk_25m_mask &= AT8035_CLK_OUT_MASK; + } + + return 0; +} + +static int at8035_probe(struct phy_device *phydev) +{ + int ret; + + ret = at803x_probe(phydev); + if (ret) + return ret; + + return at8035_parse_dt(phydev); +} + static int qca83xx_probe(struct phy_device *phydev) { struct device *dev = &phydev->mdio.dev; @@ -2167,7 +2191,7 @@ static struct phy_driver at803x_driver[] = { PHY_ID_MATCH_EXACT(ATH8035_PHY_ID), .name = "Qualcomm Atheros AR8035", .flags = PHY_POLL_CABLE_TEST, - .probe = at803x_probe, + .probe = at8035_probe, .config_aneg = at803x_config_aneg, .config_init = at803x_config_init, .soft_reset = genphy_soft_reset, @@ -2188,7 +2212,7 @@ static struct phy_driver at803x_driver[] = { .phy_id = ATH8030_PHY_ID, .name = "Qualcomm Atheros AR8030", .phy_id_mask = AT8030_PHY_ID_MASK, - .probe = at803x_probe, + .probe = at8035_probe, .config_init = at803x_config_init, .link_change_notify = at803x_link_change_notify, .set_wol = at803x_set_wol,