From patchwork Fri Dec 8 14:51:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 175830 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5506293vqy; Fri, 8 Dec 2023 06:54:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IF8ZD7Q37jG8iHKgxGnaWvAycBNodHZvA5Wl45/5a7QvaKDMH/AALuFerBqisgYUHTNv6Ut X-Received: by 2002:a05:6a00:3a19:b0:6b2:baa0:6d4c with SMTP id fj25-20020a056a003a1900b006b2baa06d4cmr142299pfb.33.1702047276568; Fri, 08 Dec 2023 06:54:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702047276; cv=none; d=google.com; s=arc-20160816; b=NGCUi4Dcg8bx8+27ggpXXcr4rHj0jhV749o0tZh982NaS1f5Re10azA9LElVGsm+8x 60njmVkHkXml4ZJ3wT0o5lRXq3BhtEjD/V9Vt/Pn7jL3U9hdJCU5SqswJJQ3aEj3331l RmZpSXraI6l1kHqnZzai6mEW+GaNlsZ1tNm5Nl/xgqYCSW0pcF8thoHAkhhx5ZEYSdBz EOcszvo+OtkSaxtyH1gkocarAV7KFhPyHXl+7gMirRu0xYEA2BG0rqZDhpbzmLC+IiTV YAYAikoF9NrkxVmVQ76BSYEvTKni8BMpI6FLlmV+i0ASUC2/NZOzKq6AG7Virj1nuUSn Hj0Q== 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=MfZOawQYQNHqU9ZIBqp6/PMD5jOFrh8dAxaGlSct1Og=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=W78dOrZUOpxJUMLabKnc9QsoW3DN5LR6ou4YyTczvjkbyL/SMxkgKacFrpSehh2a+8 J8sgvar6RTtW4Vn0svhUsxDQisGDnVoLW2/aVO9bDViMIb6+37yZVu6Z5ZG89Gytk3nA WoDL1wajbv7Qe15D5ciRZNBxepu7gyjy/M6+d5TGoTz28TzqmVzqdDRRli+9UhThPrpR bmmpeiKhjlnh0R+K7PhV7pUn84UkVtXkdgP3f9L42/vnGXfzQXNIFPN5my/psB8+H0jd Sfwb08KA7JLAI6o/fxLOJl9p5yP4qKzjzFQSpe/bWwWay8KCWUxk+tMVpEHBzwtSAcKT ezpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FRJoZFQs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id m12-20020a056a00080c00b006ce5b632ff6si1745118pfk.54.2023.12.08.06.54.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:54:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FRJoZFQs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id BD7F9810D673; Fri, 8 Dec 2023 06:54:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574235AbjLHOyV (ORCPT + 99 others); Fri, 8 Dec 2023 09:54:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574204AbjLHOyA (ORCPT ); Fri, 8 Dec 2023 09:54:00 -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 D9C433593; Fri, 8 Dec 2023 06:52:10 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40c0a074e71so22114895e9.1; Fri, 08 Dec 2023 06:52:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047128; x=1702651928; 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=MfZOawQYQNHqU9ZIBqp6/PMD5jOFrh8dAxaGlSct1Og=; b=FRJoZFQsDPDD0RUzEkwDOo1X7mfxWnGks1qhHw6m8zGRfsWnFN54vxpkOUpoyARiae 9ZENINeGoEkyoYX21VLSY95v8a3iNL87iALUCsvZLmCpMsRrSfl9VkL6qOy+ntYM1mbN 1LikYqz9CZBy/SgmpNoKIXZ3uvWq4SHl5g/1ee6ROABbG0T4jk1QXGv3G4PcVRcI+jPz hQKF51jp37ZnSKRD/+HVxTE5tnywe21zJ3m0lZ5dH8T0gnFxKHFztGm4qHgIPLTxSSP9 dO7KlsUlc3SYlQKcgS10zCvSHquUQuUxxBQFSgShiVCsOKS6nfIhvnVN+SJwAmvWHaOO J0Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047128; x=1702651928; 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=MfZOawQYQNHqU9ZIBqp6/PMD5jOFrh8dAxaGlSct1Og=; b=STFg5l4cMnX3jfxrU+GsZnGHsmb4zttimbKgwZvzMbEzhhit/RUQxh5LRo5fhJ1Wa6 z3ZfWwuiAi2Yjrssyg6BlbOxgduPA1L3ebK68nTEwgKM6ZAc7+sVBwNQ7urUmVlNhpBa yvTCchWNMfZBzU9O6J2HIFh4/tf5yUDzGM/FaO+Qh0t2XFA9RWLRzpBkKeJj3mamOl4c FdRhJAyKFWSHkrVJ90e6Xieh0j5duVo3wS7HskozNIiWOO5Q+/HSLbgg9PPZJZVvjhZj 751lm+n+bzVPYpEPT0AjyOVkDcr9PVD2z6GqnmQJ7Ox4sltrTUs3ub+aYptrs6hy7Uwl m4vA== X-Gm-Message-State: AOJu0Yz7YW7CAU7zdb4ZzNOP16UV4G1E4eXOBxyswJr4hKP/rqYnM0Av tUZ9G18Alv2O7oTPGZfBCPc= X-Received: by 2002:a05:600c:378d:b0:40c:2b29:1bbe with SMTP id o13-20020a05600c378d00b0040c2b291bbemr71535wmr.54.1702047128143; Fri, 08 Dec 2023 06:52:08 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:07 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v4 01/13] net: phy: at803x: fix passing the wrong reference for config_intr Date: Fri, 8 Dec 2023 15:51:48 +0100 Message-Id: <20231208145200.25162-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 08 Dec 2023 06:54:34 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784725925062133894 X-GMAIL-MSGID: 1784725925062133894 Fix passing the wrong reference for config_initr on passing the function pointer, drop the wrong & from at803x_config_intr in the PHY struct. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 37fb033e1c29..ef203b0807e5 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -2104,7 +2104,7 @@ static struct phy_driver at803x_driver[] = { .write_page = at803x_write_page, .get_features = at803x_get_features, .read_status = at803x_read_status, - .config_intr = &at803x_config_intr, + .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .get_tunable = at803x_get_tunable, .set_tunable = at803x_set_tunable, @@ -2134,7 +2134,7 @@ static struct phy_driver at803x_driver[] = { .resume = at803x_resume, .flags = PHY_POLL_CABLE_TEST, /* PHY_BASIC_FEATURES */ - .config_intr = &at803x_config_intr, + .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .cable_test_start = at803x_cable_test_start, .cable_test_get_status = at803x_cable_test_get_status, @@ -2150,7 +2150,7 @@ static struct phy_driver at803x_driver[] = { .resume = at803x_resume, .flags = PHY_POLL_CABLE_TEST, /* PHY_BASIC_FEATURES */ - .config_intr = &at803x_config_intr, + .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .cable_test_start = at803x_cable_test_start, .cable_test_get_status = at803x_cable_test_get_status, From patchwork Fri Dec 8 14:51:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 175831 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5506323vqy; Fri, 8 Dec 2023 06:54:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IFSJiHH+b56zczfCFZ93X4HdFUXnvLDm76vFjtqH679cslEU3eKnBqap15hsM8bpaX59piT X-Received: by 2002:a05:6a00:1acb:b0:6ce:dbc1:4500 with SMTP id f11-20020a056a001acb00b006cedbc14500mr99184pfv.66.1702047279718; Fri, 08 Dec 2023 06:54:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702047279; cv=none; d=google.com; s=arc-20160816; b=sR2W1PTz8djjglCps3de3uQHEyZ3/pvxUmJHcx2Egmn1eoHGt5Fd7inA3Apv4D0rjX c4fOeGWkucxJ9ynXSsmDQ9y517n/JazgQC3CV2p98W7eEPSQ/ia7osqrBBbKM8V5culD WiyVzXh865sG1RJrqLVF+kozqdQXxhwB/0fM67CYlLpL+LAx4jNsjLwMMRMNUKfFrVoT 4kn1idOtpqK4D4XLE883Os1QX5rp5GAmlOogPPPUiZTGV1D8qfhxsoDDTlbZMqCekFzx kfQsqo21+6uikvPr7Gthk3gltOflZGpC4K4DJ/6tD8if06MdlTkP9C7lxl5Dag8Pwx0I 0LeA== 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=WHoMR2yNKpJ7vVM7Ri3zOKS32TyWFv4sZETti3k6Nk8=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=E90OO4OEWuiirzCINW/6UjYE2OGAt47rl91UnSs1HJm5nystNcsUd+YcSL3KFwc+bh IhRoTIa5ifo956HTaIbxIN2RKf4PwNDzn3G2jAO0Lv4d/P3m52hiGQOhkRTfKfeD+YpQ tGHwZJQJ1OU0n67CuPlwjuXqqhn3c9PLVFwoU/mf3ejB4XRWW63M85uabdB34gRL/wAh Ws4mm2/4cpfQ1wSeO0xPCMt21GABbdfTL2VyqSojz8n9t+kPv3bhYrGckMEugO5VVV+2 TTVLPz+0u2NgGiSzL+J16FYfkODh2CXOXQclSvndBoGO/R865GRY3RHH7FXU+g3JbEsY zglw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=R+33ggdu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id d3-20020a056a00244300b006cd989cfe57si1655647pfj.195.2023.12.08.06.54.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:54:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=R+33ggdu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 188EF844BC52; Fri, 8 Dec 2023 06:54:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574228AbjLHOyO (ORCPT + 99 others); Fri, 8 Dec 2023 09:54:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574199AbjLHOx6 (ORCPT ); Fri, 8 Dec 2023 09:53:58 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63B603599; Fri, 8 Dec 2023 06:52:11 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40c19f5f822so12487275e9.1; Fri, 08 Dec 2023 06:52:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047129; x=1702651929; 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=WHoMR2yNKpJ7vVM7Ri3zOKS32TyWFv4sZETti3k6Nk8=; b=R+33ggduWCjCTF1BvF01ieHH1wTi6d8Y7MMnKviA5ufCXgTG8+lV5bKkk8E12BagVf 81b5ySelnVbKLbDSEuQkxojOaIKftmkZRtCrHlC4+KTrt67z+p1x319qW6ikdatR+/99 8sKQAjDtPO5oPyYsqv307trkcwPtl3DD55crTTI/3SAVirmFIwcPs925jyluxYgbcHCB VeGSXBef+y92lPIn4qL/0qT711+gVeaL3TMLhO8eFgGEIa4cCqN16iLQ2W6Kyvtrh56U 28vAzE0wFvnahq5sj/OI4ntFqupIaphsWD9sqs78tma1aBAxOfNU4RGD/RIK/EqFkf9p 1kKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047129; x=1702651929; 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=WHoMR2yNKpJ7vVM7Ri3zOKS32TyWFv4sZETti3k6Nk8=; b=upKXKyn5Q3mkhEgA7lQsy28Pk2BmeVr6icE2e0iOQODcmYMljci+yi+2oGwcq+wRyJ SfpoFQPY2Eh8vo2Qe5Tw3aR4V8wy4nUZy1HLhmhprJYUb/JDt0EJGlVFcZxDuyv8vBXL rbLsEZNaAAqGFODTTJy0Jui2AUAvI/rH+9ao1uGiv3pxrvO8513/b5NKYhIkqXkK1T6I TvmGYMxCIt9VbqEOsJ+XaKV3TH//MS3WL2NjZJKoS73ElFEBSgc7bXC5r8+w3DPrOGxZ OwU4YWrw4cIMQEv/SQpFm0eEM+E7Gyps6GmCPOBke/h1FqH5FoAyCB/dKYtlAQBe6Agt kzPw== X-Gm-Message-State: AOJu0Yw6GxScyOQI+FUw/6fwEcO2p9ZWQDXY6haJ+B3mFUvWUgVlrv5Y EZtG4/p8BoGEBO0mmRA3C7E= X-Received: by 2002:a05:600c:4fd3:b0:40b:5e56:7b44 with SMTP id o19-20020a05600c4fd300b0040b5e567b44mr127875wmq.141.1702047129250; Fri, 08 Dec 2023 06:52:09 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:08 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v4 02/13] net: phy: at803x: move disable WOL to specific at8031 probe Date: Fri, 8 Dec 2023 15:51:49 +0100 Message-Id: <20231208145200.25162-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 howler.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 (howler.vger.email [0.0.0.0]); Fri, 08 Dec 2023 06:54:37 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784725928508019810 X-GMAIL-MSGID: 1784725928508019810 Move the WOL disable call to specific at8031 probe to make at803x_probe more generic and drop extra check for PHY ID. Keep the same previous behaviour by first calling at803x_probe and then disabling WOL. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index ef203b0807e5..b8f3c215d0e8 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -886,15 +886,6 @@ static int at803x_probe(struct phy_device *phydev) priv->is_fiber = true; break; } - - /* Disable WoL in 1588 register which is enabled - * by default - */ - ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, - AT803X_PHY_MMD3_WOL_CTRL, - AT803X_WOL_EN, 0); - if (ret) - return ret; } return 0; @@ -1591,6 +1582,22 @@ static int at803x_cable_test_start(struct phy_device *phydev) return 0; } +static int at8031_probe(struct phy_device *phydev) +{ + int ret; + + ret = at803x_probe(phydev); + if (ret) + return ret; + + /* Disable WoL in 1588 register which is enabled + * by default + */ + return phy_modify_mmd(phydev, MDIO_MMD_PCS, + AT803X_PHY_MMD3_WOL_CTRL, + AT803X_WOL_EN, 0); +} + static int qca83xx_config_init(struct phy_device *phydev) { u8 switch_revision; @@ -2092,7 +2099,7 @@ static struct phy_driver at803x_driver[] = { PHY_ID_MATCH_EXACT(ATH8031_PHY_ID), .name = "Qualcomm Atheros AR8031/AR8033", .flags = PHY_POLL_CABLE_TEST, - .probe = at803x_probe, + .probe = at8031_probe, .config_init = at803x_config_init, .config_aneg = at803x_config_aneg, .soft_reset = genphy_soft_reset, From patchwork Fri Dec 8 14:51:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 175828 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5506241vqy; Fri, 8 Dec 2023 06:54:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPd01ago8oxTIHecAvyggh9cCWSrh1C7MpS+FN/QtnPL8ZEOHlrSymYAWI24q+hnCT03fc X-Received: by 2002:a17:90b:43:b0:288:7113:db with SMTP id d3-20020a17090b004300b00288711300dbmr138741pjt.68.1702047270467; Fri, 08 Dec 2023 06:54:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702047270; cv=none; d=google.com; s=arc-20160816; b=GDai43UOD792gWnbgEBeAek8c+LvhLYdIg0KyFuGa1g9p14ArgQYdmn2NrjL5aVdpp bvFytJuSCgMaiyqiiEElPAGg4nvsGpgi6tAlZl1L85gV5D5SfkG2r9g3eVeEF6iFLEt+ e5HcjbRpTXVYpzotxQPGlejURis3Dqte0QQVk7yWWoRzEgIHHa3e1JaSw2bYPNfbXR2f ozsc+saP/URQDn+cSVB1HVSZT1/5szEabtcaRL8lFZAPIrzv//WwRn82LLMwykKagyqE LbHDTdaYniWEFE1XtEcPBB0KnUnRUlZSVBmHsiLzll8ECEj4U47Hsitu2N0sDgKQ6PeA IAPA== 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=k3CRHE2JlPJvxR2z8QlM71Lcm2zabL9cZ1I1qY4IDPc=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=aUiuJ6EPTTdqPB+DsyOotN6q8Lt5+F2H5nt7HpezdrmGmiRHb8fJNJ39hPmuMzfj37 97eqrVjLzFsNNtJuji1ahatWhZnbpwwUEHM/YVeV6ACN1ePTphPPDZ9/dSb+j3yDVtJD NpwGv+KftX7uhXif9lkzGlsPElQ4IkfjCWP0WVEZHZixjml2MRTzd2A2O+obqCHwlpDV 5+/jSt3N2KGVNtOC8y+WzqdhxOmemcUXxEO/3qpIszlEWco4BJDhAaEJoXY3Z/eIdmuM YyqCdcccO1Y8L831NHTEF2PkX+qH2P2JwEh9R74DKa0jMV8YDtHWpN3OQIRU95RiSPy+ Know== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=grGzUsrq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id p2-20020a17090ab90200b00286c168876asi3108740pjr.54.2023.12.08.06.54.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:54:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=grGzUsrq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id E9AAC82DB450; Fri, 8 Dec 2023 06:54:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574164AbjLHOyL (ORCPT + 99 others); Fri, 8 Dec 2023 09:54:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574114AbjLHOx6 (ORCPT ); Fri, 8 Dec 2023 09:53:58 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 670BD1BE8; Fri, 8 Dec 2023 06:52:12 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40c09d0b045so25400185e9.0; Fri, 08 Dec 2023 06:52:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047130; x=1702651930; 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=k3CRHE2JlPJvxR2z8QlM71Lcm2zabL9cZ1I1qY4IDPc=; b=grGzUsrqvep430CEdV8YFprBx8rmBxEQNtfiXKP+2a2KYEJke2JxqQnWttFRy4Katn X+K0aCsVsW+J4OdeyExEPOKtlg+Bl7Uib1q68k9EpSxW7r+C8UPbZeC8ThJGZBVp+T4x hPY3TbAud7vIfXGs81qpSkRPXMPXH1YD0NFvIVYTXQAQqJXUVi1a4ndZ4bzdyhK1lGbq dEU59m0q+I8CGqyHZD9+xFzFQ9BnLr6HgdrZVyik6WvLO5GDla3Z5fQyiuRWJJhhLKgb W929lcbzmZ8tgSdOLlzD3oElkNd+j89JA0doNygzLDTRsQux27hhco27DohNSog3ixsr +mDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047130; x=1702651930; 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=k3CRHE2JlPJvxR2z8QlM71Lcm2zabL9cZ1I1qY4IDPc=; b=AW1Rfj7PnmSTQ4wmLEYrJTmSZZlHH/iYgQWs0XZpSiuzRUBKFm0BZr1QUg/WYVNbOm 8ENqGLXgr9IrbqUNtC19dafMfLXVN+auVMHhEXbFKdy3Q2tA2kbK4jwSDbQVv6169vQN Bkxl2RpoZ1JRA+ljF6kJ4YHC5J3PJNoZmL7E4R0Hy++Q59nRufSTr5EKwQPOemMpARgX TmaqTKRGYlgJHy1EUp/z4JlTHrxQF4vNXZ6HiZgzzkHc6HFQiU8t7lnxOaCf4PJl2N64 fYEWiid3JR0lZQHUrs/2fjlt3OXnYItotH+27jMwTxWgDE9nGfBCxhNxAcff0qcHxP2k PiAg== X-Gm-Message-State: AOJu0YxTxi2/tXl+yI+uFbH5z3UxzzFRMb905tZw9RiC71p4ogakcdXh CBvGzsrbWiiW7IGGMBMz+A8= X-Received: by 2002:a7b:cd12:0:b0:40c:3742:5a3 with SMTP id f18-20020a7bcd12000000b0040c374205a3mr27161wmj.256.1702047130293; Fri, 08 Dec 2023 06:52:10 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:09 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v4 03/13] net: phy: at803x: raname hw_stats functions to qca83xx specific name Date: Fri, 8 Dec 2023 15:51:50 +0100 Message-Id: <20231208145200.25162-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 pete.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 (pete.vger.email [0.0.0.0]); Fri, 08 Dec 2023 06:54:24 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784725918899614738 X-GMAIL-MSGID: 1784725918899614738 The function and the struct related to hw_stats were specific to qca83xx PHY but were called following the convention in the driver of calling everything with at803x prefix. To better organize the code, rename these function a more specific name to better describe that they are specific to 83xx PHY family. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index b8f3c215d0e8..277a6c27af7c 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -295,7 +295,7 @@ struct at803x_hw_stat { enum stat_access_type access_type; }; -static struct at803x_hw_stat at803x_hw_stats[] = { +static struct at803x_hw_stat qca83xx_hw_stats[] = { { "phy_idle_errors", 0xa, GENMASK(7, 0), PHY}, { "phy_receive_errors", 0x15, GENMASK(15, 0), PHY}, { "eee_wake_errors", 0x16, GENMASK(15, 0), MMD}, @@ -311,7 +311,7 @@ struct at803x_priv { bool is_1000basex; struct regulator_dev *vddio_rdev; struct regulator_dev *vddh_rdev; - u64 stats[ARRAY_SIZE(at803x_hw_stats)]; + u64 stats[ARRAY_SIZE(qca83xx_hw_stats)]; }; struct at803x_context { @@ -529,24 +529,24 @@ static void at803x_get_wol(struct phy_device *phydev, wol->wolopts |= WAKE_MAGIC; } -static int at803x_get_sset_count(struct phy_device *phydev) +static int qca83xx_get_sset_count(struct phy_device *phydev) { - return ARRAY_SIZE(at803x_hw_stats); + return ARRAY_SIZE(qca83xx_hw_stats); } -static void at803x_get_strings(struct phy_device *phydev, u8 *data) +static void qca83xx_get_strings(struct phy_device *phydev, u8 *data) { int i; - for (i = 0; i < ARRAY_SIZE(at803x_hw_stats); i++) { + for (i = 0; i < ARRAY_SIZE(qca83xx_hw_stats); i++) { strscpy(data + i * ETH_GSTRING_LEN, - at803x_hw_stats[i].string, ETH_GSTRING_LEN); + qca83xx_hw_stats[i].string, ETH_GSTRING_LEN); } } -static u64 at803x_get_stat(struct phy_device *phydev, int i) +static u64 qca83xx_get_stat(struct phy_device *phydev, int i) { - struct at803x_hw_stat stat = at803x_hw_stats[i]; + struct at803x_hw_stat stat = qca83xx_hw_stats[i]; struct at803x_priv *priv = phydev->priv; int val; u64 ret; @@ -567,13 +567,13 @@ static u64 at803x_get_stat(struct phy_device *phydev, int i) return ret; } -static void at803x_get_stats(struct phy_device *phydev, - struct ethtool_stats *stats, u64 *data) +static void qca83xx_get_stats(struct phy_device *phydev, + struct ethtool_stats *stats, u64 *data) { int i; - for (i = 0; i < ARRAY_SIZE(at803x_hw_stats); i++) - data[i] = at803x_get_stat(phydev, i); + for (i = 0; i < ARRAY_SIZE(qca83xx_hw_stats); i++) + data[i] = qca83xx_get_stat(phydev, i); } static int at803x_suspend(struct phy_device *phydev) @@ -2175,9 +2175,9 @@ static struct phy_driver at803x_driver[] = { .flags = PHY_IS_INTERNAL, .config_init = qca83xx_config_init, .soft_reset = genphy_soft_reset, - .get_sset_count = at803x_get_sset_count, - .get_strings = at803x_get_strings, - .get_stats = at803x_get_stats, + .get_sset_count = qca83xx_get_sset_count, + .get_strings = qca83xx_get_strings, + .get_stats = qca83xx_get_stats, .suspend = qca83xx_suspend, .resume = qca83xx_resume, }, { @@ -2191,9 +2191,9 @@ static struct phy_driver at803x_driver[] = { .flags = PHY_IS_INTERNAL, .config_init = qca83xx_config_init, .soft_reset = genphy_soft_reset, - .get_sset_count = at803x_get_sset_count, - .get_strings = at803x_get_strings, - .get_stats = at803x_get_stats, + .get_sset_count = qca83xx_get_sset_count, + .get_strings = qca83xx_get_strings, + .get_stats = qca83xx_get_stats, .suspend = qca83xx_suspend, .resume = qca83xx_resume, }, { @@ -2207,9 +2207,9 @@ static struct phy_driver at803x_driver[] = { .flags = PHY_IS_INTERNAL, .config_init = qca83xx_config_init, .soft_reset = genphy_soft_reset, - .get_sset_count = at803x_get_sset_count, - .get_strings = at803x_get_strings, - .get_stats = at803x_get_stats, + .get_sset_count = qca83xx_get_sset_count, + .get_strings = qca83xx_get_strings, + .get_stats = qca83xx_get_stats, .suspend = qca83xx_suspend, .resume = qca83xx_resume, }, { From patchwork Fri Dec 8 14:51:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 175839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5507442vqy; Fri, 8 Dec 2023 06:56:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzeg0DyYHbGJqcnFx8rfKymhRvgLoyq+xKrtaDCqmCwiDtMYi7e2f+1DZhzVxk0WmhmqIQ X-Received: by 2002:a17:90a:1217:b0:286:db95:b12 with SMTP id f23-20020a17090a121700b00286db950b12mr172752pja.46.1702047419103; Fri, 08 Dec 2023 06:56:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702047419; cv=none; d=google.com; s=arc-20160816; b=JyfliN00wpSFGoROuEt3utATicCFwe1BiB49uEfLOx0b2hXROxI1Y0dJatf3BiYTlv DV/qf/pz/77GEHpfFbYiMz4KSpnclcQg6kyW8kF4gjxLvbGtcg/Sev0AmsW3ISMFvdRS 8smt3k39o8ymUl+Yn05bRVIcmLDu+f0+YjQLTRBmv8V6q0ABCsUKNREEA7UKBbnJ1xHn 8gBpthE3t69wGUTgZlHCp4TSPjehEYGnU0z/UGgG1oAxGW3iFCiyjkpX38aK4gJybZNr 3X6EfA+XeESNpqqrHC8NFo9jgmcmOLGkK/kR7pfYJfJe5g1yMNZoHCsq9UiQG0n7QQVY 7Qxw== 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=5feJ9c621I5/VZmz7DYVtyWPMsJYNgURBm5K+LW+VFE=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=dIU1jqIpcAHq/sZYLgM1FRPM083PRgnFBFUE9L3T95t5OEn0494d8SxsHOpVlXrRNR xExXBSvCCUo/GR3aB8ewv4m6ISkW686BBZ42gXt2blH95KGG5P0m1SId3DS0TZOOMYBO AasTJcJaT6Ca07QRKpzXLJrSIo1Idz5l++mo0rPyerSH4YdM4ztjV3WeI3GdIKrny+MZ upQjCPYp2wMeQChIU8FRzr6NJ/3eG0jnvPfTa9elxyu1TXjCFjbwL5zr/B71kXwiZEwI m5K2Gb4ZQQEJXLTPTFbQx2OjP21NSRwh+p6kC5WN7LmBT9K6hc9YMy39ofwKg7qclX0G zfWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="VAvE848/"; 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 w9-20020a17090aad4900b00285f918f395si1718343pjv.190.2023.12.08.06.56.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:56:59 -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="VAvE848/"; 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 16B6E80C2541; Fri, 8 Dec 2023 06:56:56 -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 S1574182AbjLHO4h (ORCPT + 99 others); Fri, 8 Dec 2023 09:56:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574177AbjLHO4V (ORCPT ); Fri, 8 Dec 2023 09:56:21 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31DC835AA; Fri, 8 Dec 2023 06:52:13 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40c039e9719so24711325e9.1; Fri, 08 Dec 2023 06:52:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047131; x=1702651931; 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=5feJ9c621I5/VZmz7DYVtyWPMsJYNgURBm5K+LW+VFE=; b=VAvE848/Z4AsZCW4EnDdXInW35aj5vHwd+v+LiAWGNVd9VNfkEkWH6E8w6WXhLtnMl 22GK8JFTxnAn90Pmw71FJ5ufMNhWePVUeN6ml1Y8d3NbnKWh4Qre0kZdveTRCy0/cuxN ITbZD7GwSOr6oD+Rr9E7I3rXra3fftKpx6YFIB1TuuHQ6ukBEbE6O+JJ8J6H5J8j0Dei 4f0G+37zF8C12l/s9nlp/BbyINrUCql36goPEThGUu6ovjS5UyxHbasJDBi6jlFb6hdQ B0jydWazDdgaBKKOrlKiK/Etso8Gr5lxR1gl94LLv2ckSdIa02amYLBHvmUSiy24dH2q F2MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047131; x=1702651931; 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=5feJ9c621I5/VZmz7DYVtyWPMsJYNgURBm5K+LW+VFE=; b=u9RXusz4fBWaZL36K50ureiC3odlN1Pc7c9cM+z67cwy1f7tXb0zSepwyF0R676OC2 YH55kyFTDxhDVlofWZF0an8baMHlocPpGKFdUEkdAvpokWnCwgOympPe25+8F4y9/XKD xiN7Zw/pD8/IxxGZvgK936fHTG4PpY+RL1NfVxmUKMQ0zE9seuVCGDDUqBI9AFKIUJ3V /bL0WZkqSNidt3uMnp//bY8zzX7rOS3X7qZHeQQRofPi2NJkyUuELBe5b8wBP+vn0oDG WaI/NX8QMuZLKU9NJdOEHlW0EcMIaAAzVXtpIRmu8nTeip4jd9RfB3TvfO0srU9o4WHH egmA== X-Gm-Message-State: AOJu0Yz57HOGl1Ja99AekQbP268EWKG2ihEnYoObP1vLl72KsV8CH8rS 0XX3wk2/F3TsY+ZX0WSi58Y= X-Received: by 2002:a05:600c:2b0f:b0:40c:33be:d166 with SMTP id y15-20020a05600c2b0f00b0040c33bed166mr49417wme.87.1702047131342; Fri, 08 Dec 2023 06:52:11 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:10 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v4 04/13] net: phy: at803x: move qca83xx specific check in dedicated functions Date: Fri, 8 Dec 2023 15:51:51 +0100 Message-Id: <20231208145200.25162-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-1-ansuelsmth@gmail.com> MIME-Version: 1.0 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]); Fri, 08 Dec 2023 06:56:56 -0800 (PST) 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784726074616519315 X-GMAIL-MSGID: 1784726074616519315 Rework qca83xx specific check to dedicated function to tidy things up and drop useless phy_id check. Also drop an useless link_change_notify for QCA8337 as it did nothing an returned early. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 68 ++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 277a6c27af7c..fa412a4e080d 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -1623,27 +1623,26 @@ static int qca83xx_config_init(struct phy_device *phydev) break; } + /* Following original QCA sourcecode set port to prefer master */ + phy_set_bits(phydev, MII_CTRL1000, CTL1000_PREFER_MASTER); + + return 0; +} + +static int qca8327_config_init(struct phy_device *phydev) +{ /* QCA8327 require DAC amplitude adjustment for 100m set to +6%. * Disable on init and enable only with 100m speed following * qca original source code. */ - if (phydev->drv->phy_id == QCA8327_A_PHY_ID || - phydev->drv->phy_id == QCA8327_B_PHY_ID) - at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL, - QCA8327_DEBUG_MANU_CTRL_EN, 0); + at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL, + QCA8327_DEBUG_MANU_CTRL_EN, 0); - /* Following original QCA sourcecode set port to prefer master */ - phy_set_bits(phydev, MII_CTRL1000, CTL1000_PREFER_MASTER); - - return 0; + return qca83xx_config_init(phydev); } static void qca83xx_link_change_notify(struct phy_device *phydev) { - /* QCA8337 doesn't require DAC Amplitude adjustement */ - if (phydev->drv->phy_id == QCA8337_PHY_ID) - return; - /* Set DAC Amplitude adjustment to +6% for 100m on link running */ if (phydev->state == PHY_RUNNING) { if (phydev->speed == SPEED_100) @@ -1686,19 +1685,6 @@ static int qca83xx_resume(struct phy_device *phydev) static int qca83xx_suspend(struct phy_device *phydev) { - u16 mask = 0; - - /* Only QCA8337 support actual suspend. - * QCA8327 cause port unreliability when phy suspend - * is set. - */ - if (phydev->drv->phy_id == QCA8337_PHY_ID) { - genphy_suspend(phydev); - } else { - mask |= ~(BMCR_SPEED1000 | BMCR_FULLDPLX); - phy_modify(phydev, MII_BMCR, mask, 0); - } - at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_GREEN, AT803X_DEBUG_GATE_CLK_IN1000, 0); @@ -1709,6 +1695,27 @@ static int qca83xx_suspend(struct phy_device *phydev) return 0; } +static int qca8337_suspend(struct phy_device *phydev) +{ + /* Only QCA8337 support actual suspend. */ + genphy_suspend(phydev); + + return qca83xx_suspend(phydev); +} + +static int qca8327_suspend(struct phy_device *phydev) +{ + u16 mask = 0; + + /* QCA8327 cause port unreliability when phy suspend + * is set. + */ + mask |= ~(BMCR_SPEED1000 | BMCR_FULLDPLX); + phy_modify(phydev, MII_BMCR, mask, 0); + + return qca83xx_suspend(phydev); +} + static int qca808x_phy_fast_retrain_config(struct phy_device *phydev) { int ret; @@ -2170,7 +2177,6 @@ static struct phy_driver at803x_driver[] = { .phy_id_mask = QCA8K_PHY_ID_MASK, .name = "Qualcomm Atheros 8337 internal PHY", /* PHY_GBIT_FEATURES */ - .link_change_notify = qca83xx_link_change_notify, .probe = at803x_probe, .flags = PHY_IS_INTERNAL, .config_init = qca83xx_config_init, @@ -2178,7 +2184,7 @@ static struct phy_driver at803x_driver[] = { .get_sset_count = qca83xx_get_sset_count, .get_strings = qca83xx_get_strings, .get_stats = qca83xx_get_stats, - .suspend = qca83xx_suspend, + .suspend = qca8337_suspend, .resume = qca83xx_resume, }, { /* QCA8327-A from switch QCA8327-AL1A */ @@ -2189,12 +2195,12 @@ static struct phy_driver at803x_driver[] = { .link_change_notify = qca83xx_link_change_notify, .probe = at803x_probe, .flags = PHY_IS_INTERNAL, - .config_init = qca83xx_config_init, + .config_init = qca8327_config_init, .soft_reset = genphy_soft_reset, .get_sset_count = qca83xx_get_sset_count, .get_strings = qca83xx_get_strings, .get_stats = qca83xx_get_stats, - .suspend = qca83xx_suspend, + .suspend = qca8327_suspend, .resume = qca83xx_resume, }, { /* QCA8327-B from switch QCA8327-BL1A */ @@ -2205,12 +2211,12 @@ static struct phy_driver at803x_driver[] = { .link_change_notify = qca83xx_link_change_notify, .probe = at803x_probe, .flags = PHY_IS_INTERNAL, - .config_init = qca83xx_config_init, + .config_init = qca8327_config_init, .soft_reset = genphy_soft_reset, .get_sset_count = qca83xx_get_sset_count, .get_strings = qca83xx_get_strings, .get_stats = qca83xx_get_stats, - .suspend = qca83xx_suspend, + .suspend = qca8327_suspend, .resume = qca83xx_resume, }, { /* Qualcomm QCA8081 */ From patchwork Fri Dec 8 14:51:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 175837 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5506804vqy; Fri, 8 Dec 2023 06:55:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEAmEnkp8marrwIH9nf6yRgtnLE98lQEkVLH+Asm5vMsltg/pPerjzfjeLQPi/RFntD5rZp X-Received: by 2002:a05:6e02:18c6:b0:35d:5995:1d64 with SMTP id s6-20020a056e0218c600b0035d59951d64mr301136ilu.41.1702047334960; Fri, 08 Dec 2023 06:55:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702047334; cv=none; d=google.com; s=arc-20160816; b=dJv2sBYZDPZNqTnaY2/T80NphjM/mbOMeP4kA37UZ2EgfxgfHU0Xib7Dztf+ruoZv8 +PrBLS0LFaKVeDtTG0cGgtF1nureFacP/BntUKJFQ5N23/ks8ApvKpMhWeb5i2hPljDH +KObYFgF1pgvXeujEcR97e9rZdJw9lxFgg0k4Egc2Yu5WqiVR0eSXvLKxul98911TwIv KNAW83nqjrS5Em7pXvcwUql64wGCWXHNUBGVPvw/jVI29EUg6Akq8mjOiniMbMIZATKH 5NetuJbqA23NmWSCNZXfHbi985dbb9f6itbl2LLlu1g9f2Ci1Gcv2gPnVNYgb+8a86ue aMyw== 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=SKdApVa1/ad6QR0kGy/pXmtTCWwb2YcJRtG4h3T2bUY=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=dXBULHEA/W2edaFxACwJ64IgsR/Te8BG8fgeG1m5MtS55gTXCO7NL7fBLKjfBsb4ns 2YHvx4ngP91P8iUkdtyeuhHQxQSZPeGQJPG3EwpX5PErx+6eF1CphBDtIhUqLVN9hyT+ jpweF9mgQJ9zB6/ZUtXGPsmcwhLPpKH4EqRahaCY6tWDJ8LSq9ChYKlsxbSqENHA9XVF xsFD2sYKfgKBBy9KJ2IF1/ac/KATk6jct0P53KHrsVEkcSzL1nI/TfsNu+v24f6dnKyE BsrDrU+TZh/7nZADEmJIFU1/VoGyV1O9i95JPVIjNVuBwyJcqx9E6ITZ3/zsKrki0WbK BqRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fMS8AMWu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id g192-20020a636bc9000000b005c6faf0a668si487048pgc.225.2023.12.08.06.55.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:55:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fMS8AMWu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 09111810F0D6; Fri, 8 Dec 2023 06:55:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574204AbjLHOzD (ORCPT + 99 others); Fri, 8 Dec 2023 09:55:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574183AbjLHOyY (ORCPT ); Fri, 8 Dec 2023 09:54:24 -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 3535C35B1; Fri, 8 Dec 2023 06:52:14 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40c0f3a7717so24649315e9.1; Fri, 08 Dec 2023 06:52:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047132; x=1702651932; 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=SKdApVa1/ad6QR0kGy/pXmtTCWwb2YcJRtG4h3T2bUY=; b=fMS8AMWuOCa8yU1df2vi/+X0nowQfPxHdBkEworfzHRmYXd99vc4clBYy3WyM5nIoH Di5CVXTufCJMwc2bpq0pw98QldBiJIMegvhb7iJVtdZKB3bPNLO3YwUQx0pNMwPinIcz tvOUxqAS7jzzbu4AT+JHYClX38SUFNrOVbYpjA2cKD7SAlRp58LuPf/nSz336ra0WxMU FVu9hiBKWoDE+4ZQwghpoT7+6weIynO7Ut0XS6pJXAaQK5K6MVhFNqJX+EeXiZKwrBkL NOZVYWnds207MGhvbjw5egcbH3gFiunJ06ZODcvmgnZPBi0QGagg1K5tawthEaqzlK6v 4lSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047132; x=1702651932; 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=SKdApVa1/ad6QR0kGy/pXmtTCWwb2YcJRtG4h3T2bUY=; b=bJZJ4thDxrJDWYkJlA6uOPamihu/B3jPFIRgaOs+oH8LFP4mNWUgFselalrVdfhNXu T4iGEPeRFj94uz2n857T1tf3aOMxPHKE/L4Jzl0PDt+5PLHjHc+sEWA7iJhfkSMWgCD6 AeZyPKfKYel/PJPJkbAuie4pxpnhSG9dk6GH1VU39VGpAXS7NNwhryaKTIYFS4Ops5Np Cvtd5sDAQrCPGRJVZeKNWY/ttPezoKCQrGLQnMcbQcOpFJS56axPKP7AWDWcczGv0EIJ e3g8RzKylwcM774xUqyPSUw+zwNrgZ9xndWnGYX4or8sqt/KoooGy8FEfpXSy7TJbzRo IYJA== X-Gm-Message-State: AOJu0YymTPCbLb0ZWU2dEgqFXI/5KlTYp35y1lbuIkJ4/Q3UWp8AXlpA VLvHMRTeMHkbr1FgfDvnaiw= X-Received: by 2002:a1c:740d:0:b0:40b:5e22:2f6 with SMTP id p13-20020a1c740d000000b0040b5e2202f6mr27184wmc.98.1702047132401; Fri, 08 Dec 2023 06:52:12 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:11 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v4 05/13] net: phy: at803x: move specific DT option for at8031 to specific probe Date: Fri, 8 Dec 2023 15:51:52 +0100 Message-Id: <20231208145200.25162-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 08 Dec 2023 06:55:29 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784725986664365826 X-GMAIL-MSGID: 1784725986664365826 Move specific DT options for at8031 to specific probe to tidy things up and make at803x_parse_dt more generic. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 55 ++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index fa412a4e080d..5694c2667b4d 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -825,30 +825,6 @@ static int at803x_parse_dt(struct phy_device *phydev) } } - /* Only supported on AR8031/AR8033, the AR8030/AR8035 use strapping - * options. - */ - if (phydev->drv->phy_id == ATH8031_PHY_ID) { - if (of_property_read_bool(node, "qca,keep-pll-enabled")) - priv->flags |= AT803X_KEEP_PLL_ENABLED; - - ret = at8031_register_regulators(phydev); - if (ret < 0) - return ret; - - ret = devm_regulator_get_enable_optional(&phydev->mdio.dev, - "vddio"); - if (ret) { - phydev_err(phydev, "failed to get VDDIO regulator\n"); - return ret; - } - - /* Only AR8031/8033 support 1000Base-X for SFP modules */ - ret = phy_sfp_probe(phydev, &at803x_sfp_ops); - if (ret < 0) - return ret; - } - return 0; } @@ -1582,6 +1558,30 @@ static int at803x_cable_test_start(struct phy_device *phydev) return 0; } +static int at8031_parse_dt(struct phy_device *phydev) +{ + struct device_node *node = phydev->mdio.dev.of_node; + struct at803x_priv *priv = phydev->priv; + int ret; + + if (of_property_read_bool(node, "qca,keep-pll-enabled")) + priv->flags |= AT803X_KEEP_PLL_ENABLED; + + ret = at8031_register_regulators(phydev); + if (ret < 0) + return ret; + + ret = devm_regulator_get_enable_optional(&phydev->mdio.dev, + "vddio"); + if (ret) { + phydev_err(phydev, "failed to get VDDIO regulator\n"); + return ret; + } + + /* Only AR8031/8033 support 1000Base-X for SFP modules */ + return phy_sfp_probe(phydev, &at803x_sfp_ops); +} + static int at8031_probe(struct phy_device *phydev) { int ret; @@ -1590,6 +1590,13 @@ static int at8031_probe(struct phy_device *phydev) if (ret) return ret; + /* Only supported on AR8031/AR8033, the AR8030/AR8035 use strapping + * options. + */ + ret = at8031_parse_dt(phydev); + if (ret) + return ret; + /* Disable WoL in 1588 register which is enabled * by default */ From patchwork Fri Dec 8 14:51:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 175832 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5506349vqy; Fri, 8 Dec 2023 06:54:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IHe+/rAvDw+oYw3EuuPYAmSRCwxYjqyK17aaBdl4Pf0yZ7vyUJhtDnTpr5eajfebwAyYKUo X-Received: by 2002:a17:902:ce8a:b0:1d0:9162:75fb with SMTP id f10-20020a170902ce8a00b001d0916275fbmr151265plg.0.1702047282427; Fri, 08 Dec 2023 06:54:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702047282; cv=none; d=google.com; s=arc-20160816; b=VedmrMO1gWO/XG8kQksOVtAaYzk4QPOPzrKaXp6X+Azwwqo/RANJDEYsZMpJsbsbwF OLLJ9Kf+/fwYy3hVUiExOX4ORWHj3wuEhY8z/7aYoIw/ABMJ8rOosFvBWP4Y+R7wGjZf DGh6Da81TvF2gu2GKJwqoAmElN1ixuZznj6Le64+PXgiib7Ut2TD6qP27o7MW9N7MeZb Py7HusgMBp/qouksrrSGEdhi2GKaoyhRPbfDs953xZrX7akJZNSuuBAPsZuWQqy0+qtw kJfeH2MyhwJQS+E/gFea4nKBi8tEDMMGoU6zKjPZrYCE3+M6oqyQeHzvKbi7bTXzGkD1 oQNg== 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=+xPT5eitsPLMWqf9JvP+rrRy2e2KvhKrvYQ5CxZDAVg=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=A0fHUc4UG6W8oHk/JZXojGpGSLCrwy4ZQRUsgqHGBRFwZktxQFNxiQs8sUWt8CmI1I ikrxVXIq/bfehNt+3DicaQId9CVbS0t7Cbhac8ZP+mE3W/AWf+nV6FNpgq7yUL4qVtRh kMqtLtRgs76BjKhxQdFIcDNg1yPdnKXyE1NVPWipgKoX6Qd+pqtwszutBPZrZHe5zrF0 M6m96nnY100t+c0TW64ECwon6CiZh8GeZcgDenenXXzwvkjOpWllEgTSia45mvZYJZmX 6FGSWWw5j1WMfi7bYQf70Dhvzs6gvmsCyoZ/hOgJTv6FP3qapiQ4EgoXlM92rRVLIO3o O/4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=k6VZUtd+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id k10-20020a170902694a00b001bc162f3318si1614409plt.640.2023.12.08.06.54.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:54:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=k6VZUtd+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 8C155844BC69; Fri, 8 Dec 2023 06:54:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574133AbjLHOyZ (ORCPT + 99 others); Fri, 8 Dec 2023 09:54:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574070AbjLHOyB (ORCPT ); Fri, 8 Dec 2023 09:54:01 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4808419A1; Fri, 8 Dec 2023 06:52:15 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40c09f4bea8so23343965e9.1; Fri, 08 Dec 2023 06:52:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047133; x=1702651933; 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=+xPT5eitsPLMWqf9JvP+rrRy2e2KvhKrvYQ5CxZDAVg=; b=k6VZUtd+i34aIFvxN1LZ2iwjt9OiyogBuCb1Pb8ApKbvskaenCfqhVgqhdni9tq1x7 PiblA+ZwQjp9HktUxlzCM9eoiYP0m9fFVrLwohq5s4u04vb4PMabsdwQBJorNkbHqY7x 8v+EfLg5ist3XDdmoZOQpNuE63RRhp9baOS3lyow6V+9SHddJ3uDpVqfCxrgZSoQJgwK 9K/ph74veol19tCfyc+XZnxGx7nSqr6+ufEXfOSP1uU087Wk8YPsvVn3W251leVN1T9z WUNb1v5FCRV5suFQkYmfePy+RhCKUPEsujVOmBWJiQBWxeJKjcl6HBJdRH/81Slp/mEO qSKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047133; x=1702651933; 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=+xPT5eitsPLMWqf9JvP+rrRy2e2KvhKrvYQ5CxZDAVg=; b=ABQipJLm5pUd6/llphZ5UO1pJuELtRYj2c/cgr8/Jw92mC5vpfn8tbwG9NrAhu1okR 9Her9aDtSTsBPwTXq9dTT87qS7a6jsN67WI5mzKzmjX9tdk24P6y34h4Vr0LeiDxWzUh TNhgzIrfPeAI+TfkK5Mn57YDk++Wz9szfBpQeyAfUXs/2AEbGSmJHqfLADjWLDALLBjW S/Hmt9dgAotiBJjpkav2v2ZgGql3EYEezY4K2rDYyhxXztp7AJmwwAYAIfBo2xhXuhji +i35o7D0s1Z3d8al5W3z9sZHdxeQPbF4tzieMOIaSAkhh2r576eF0r4D7AcPXobervFk d+kw== X-Gm-Message-State: AOJu0Yznbc0Ii2Q+2lWCCGXpeqkVIz9uixj470fyrxi9GlAmNryNu/5I tGlI8sBH6QYEiM8FglYjD4Y= X-Received: by 2002:a05:600c:4709:b0:40b:3dae:1ff6 with SMTP id v9-20020a05600c470900b0040b3dae1ff6mr60904wmo.14.1702047133519; Fri, 08 Dec 2023 06:52:13 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:13 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v4 06/13] net: phy: at803x: move specific at8031 probe mode check to dedicated probe Date: Fri, 8 Dec 2023 15:51:53 +0100 Message-Id: <20231208145200.25162-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 howler.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 (howler.vger.email [0.0.0.0]); Fri, 08 Dec 2023 06:54:38 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784725931363460064 X-GMAIL-MSGID: 1784725931363460064 Move specific at8031 probe mode check to dedicated probe to make at803x_probe more generic and keep code tidy. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 5694c2667b4d..6cb41af31818 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -844,26 +844,6 @@ static int at803x_probe(struct phy_device *phydev) if (ret) return ret; - if (phydev->drv->phy_id == ATH8031_PHY_ID) { - int ccr = phy_read(phydev, AT803X_REG_CHIP_CONFIG); - int mode_cfg; - - if (ccr < 0) - return ccr; - mode_cfg = ccr & AT803X_MODE_CFG_MASK; - - switch (mode_cfg) { - case AT803X_MODE_CFG_BX1000_RGMII_50OHM: - case AT803X_MODE_CFG_BX1000_RGMII_75OHM: - priv->is_1000basex = true; - fallthrough; - case AT803X_MODE_CFG_FX100_RGMII_50OHM: - case AT803X_MODE_CFG_FX100_RGMII_75OHM: - priv->is_fiber = true; - break; - } - } - return 0; } @@ -1584,6 +1564,9 @@ static int at8031_parse_dt(struct phy_device *phydev) static int at8031_probe(struct phy_device *phydev) { + struct at803x_priv *priv = phydev->priv; + int mode_cfg; + int ccr; int ret; ret = at803x_probe(phydev); @@ -1597,6 +1580,22 @@ static int at8031_probe(struct phy_device *phydev) if (ret) return ret; + ccr = phy_read(phydev, AT803X_REG_CHIP_CONFIG); + if (ccr < 0) + return ccr; + mode_cfg = ccr & AT803X_MODE_CFG_MASK; + + switch (mode_cfg) { + case AT803X_MODE_CFG_BX1000_RGMII_50OHM: + case AT803X_MODE_CFG_BX1000_RGMII_75OHM: + priv->is_1000basex = true; + fallthrough; + case AT803X_MODE_CFG_FX100_RGMII_50OHM: + case AT803X_MODE_CFG_FX100_RGMII_75OHM: + priv->is_fiber = true; + break; + } + /* Disable WoL in 1588 register which is enabled * by default */ From patchwork Fri Dec 8 14:51:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 175829 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5506291vqy; Fri, 8 Dec 2023 06:54:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFwkkWTPZVFXPnPoP9LKsmv+LKhfBewpSCXPVWPb7vErNsaBCiEYetf7ejErAdTUg9FTQx0 X-Received: by 2002:a17:90b:108:b0:286:cc10:f2c6 with SMTP id p8-20020a17090b010800b00286cc10f2c6mr188600pjz.20.1702047276050; Fri, 08 Dec 2023 06:54:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702047276; cv=none; d=google.com; s=arc-20160816; b=LbF1rRxgDRLybXLZI/jpbOT9l6wc7PGqP0AdHnvZsNg6uyPLugGLylSnYU/IAgIjJP tV8040JM/+myOUNDox6m8wnKlbBvGB9uUhOkzRPf+7dbDBdizgu64yScEJ6BtHdQupTO /ijnTiHhTlSlaxkgOsd0OjPBBdfxf3o9EKflwtGaQRKNP2NdHChaRLgtHw+Z5gpax/wG vzDd58S8rIrJB0AxCe4TERrJJnq3CYz2JLkOIzjuVmNiR6Vfl6g32ONn/SFGseOxjcy5 +hrLZEzTU4QSkPn/sJ1DKXrob+14wVn6MnT0GJxVT+JJYQESDaoTCLRD+OrHCjIdVZqA nYPA== 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=P5/O/H6nUdwu1//MonWtOM4w7F6u3pPBln032X6Yzks=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=EV89aJIb6Be8lEol8XXlICEbYopggrhU7lmRzrSvQ79CRGMKGd3Muro84Jpq4Zu8w+ s5jlK6RAvRi6L1KMyRTp6XjljQd0c83nDk4PjvXqfXyywLN6PL7LscfVk+qARJ6/jmet s9Ez9xXVFuIGDjDDbGnT8olU3dDdw2bv7wBhaFZly04ahUePxRZgo7quts8j437CRe9r obJp/xP1CQSNlKYrdGN+1uuOeBqLtqDLCOvCWHhInC+ydFHWeEZS2uHpzXDbjV6cM5ey NxDyT6C/353JU0Fs3X22vVHEfpO7dUD27Ym62m4OTvBDn6y05mGITkY1PF+0+1X5JA2b qQoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=cCjhuI4V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id e7-20020a17090ac20700b0028658eed319si1779795pjt.180.2023.12.08.06.54.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:54:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=cCjhuI4V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 98E1781BDBB5; Fri, 8 Dec 2023 06:54:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574230AbjLHOyR (ORCPT + 99 others); Fri, 8 Dec 2023 09:54:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574202AbjLHOx7 (ORCPT ); Fri, 8 Dec 2023 09:53:59 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A006B3848; Fri, 8 Dec 2023 06:52:16 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40c19467a63so24583635e9.3; Fri, 08 Dec 2023 06:52:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047135; x=1702651935; 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=P5/O/H6nUdwu1//MonWtOM4w7F6u3pPBln032X6Yzks=; b=cCjhuI4V7g3BKattb0Qk7pUDvdvXOUbdqVoi3KEzIO8aYKFHk3HrmPIkmpQnZt5KPz 7X1nPZZP0oeUZpUzL+lbLAW2cNmmqmjE3/UfE9Ixyvu7zS/Vi6j3p0vG9CaB2CnzduWm irqQ1UwjmPIBEfuqh4h0mt1rYuYKWC7abhq4pBK2zu2g7M9CrAnJY2QJfN84NDpV1H+C hzFyz7RacH6scZAvhSIla7649KCUp84GhVC3PTOotfKN72F+oOTeNY/WMUjGUQojKeXo aFqwzQjGN3cA76EwCXZuFirb7H3GbpXrVnKlo4Ow33TSInBMMzraFt1EJ4Q5Vv4y5B7I R/mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047135; x=1702651935; 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=P5/O/H6nUdwu1//MonWtOM4w7F6u3pPBln032X6Yzks=; b=A3ymuCLvmFKpcniWP13ZM8fd0VCzhGsfTIPMm8G5LMhFTo6hY7DoF6vuHsvro9UgoI cODRXC4CES8MmCy+9c/VGAwi7HzjQgx20wI1JDYmjuW2+cgRbvFyHgV9eUgwZ270l88J Usruz0ktP4yrirfaDDFZIvAmQo7M3E8+Ue0WxiqSsL7KHROsjYtvZ6Xqm79ELKH2NUu+ GItHV60Gt0q6pGGJ2m4VP6MdwGhWLBHHU53N6kd5PdL/9/pGWTxNFDSSK+P+ydujuCkG G7OIGc/LWxJ1kIwj06r1dA6C0YM0wmYsd3SnnXninbvJMtGWeVjubdf7iFzUVySYjj4W 4qHw== X-Gm-Message-State: AOJu0YyXtRsxSiBTCBhimdXPPPcmrY0qOkDBxB9Q0b6hR0jajW/UQyb5 P4IX4C1PFe5aRH6dQW0BpgM/fVpAoy8= X-Received: by 2002:a05:600c:204b:b0:40b:5e59:e9f3 with SMTP id p11-20020a05600c204b00b0040b5e59e9f3mr40459wmg.146.1702047134544; Fri, 08 Dec 2023 06:52:14 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:14 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v4 07/13] net: phy: at803x: move specific at8031 config_init to dedicated function Date: Fri, 8 Dec 2023 15:51:54 +0100 Message-Id: <20231208145200.25162-8-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 fry.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 (fry.vger.email [0.0.0.0]); Fri, 08 Dec 2023 06:54:33 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784725924799951901 X-GMAIL-MSGID: 1784725924799951901 Move specific at8031 config_init to dedicated function to make at803x_config_init more generic and tidy things up. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 45 ++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 6cb41af31818..e2bf5a16ba3c 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -951,27 +951,8 @@ static int at803x_hibernation_mode_config(struct phy_device *phydev) static int at803x_config_init(struct phy_device *phydev) { - struct at803x_priv *priv = phydev->priv; int ret; - if (phydev->drv->phy_id == ATH8031_PHY_ID) { - /* Some bootloaders leave the fiber page selected. - * Switch to the appropriate page (fiber or copper), as otherwise we - * read the PHY capabilities from the wrong page. - */ - phy_lock_mdio_bus(phydev); - ret = at803x_write_page(phydev, - priv->is_fiber ? AT803X_PAGE_FIBER : - AT803X_PAGE_COPPER); - phy_unlock_mdio_bus(phydev); - if (ret) - return ret; - - ret = at8031_pll_config(phydev); - if (ret < 0) - return ret; - } - /* The RX and TX delay default is: * after HW reset: RX delay enabled and TX delay disabled * after SW reset: RX delay enabled, while TX delay retains the @@ -1604,6 +1585,30 @@ static int at8031_probe(struct phy_device *phydev) AT803X_WOL_EN, 0); } +static int at8031_config_init(struct phy_device *phydev) +{ + struct at803x_priv *priv = phydev->priv; + int ret; + + /* Some bootloaders leave the fiber page selected. + * Switch to the appropriate page (fiber or copper), as otherwise we + * read the PHY capabilities from the wrong page. + */ + phy_lock_mdio_bus(phydev); + ret = at803x_write_page(phydev, + priv->is_fiber ? AT803X_PAGE_FIBER : + AT803X_PAGE_COPPER); + phy_unlock_mdio_bus(phydev); + if (ret) + return ret; + + ret = at8031_pll_config(phydev); + if (ret < 0) + return ret; + + return at803x_config_init(phydev); +} + static int qca83xx_config_init(struct phy_device *phydev) { u8 switch_revision; @@ -2113,7 +2118,7 @@ static struct phy_driver at803x_driver[] = { .name = "Qualcomm Atheros AR8031/AR8033", .flags = PHY_POLL_CABLE_TEST, .probe = at8031_probe, - .config_init = at803x_config_init, + .config_init = at8031_config_init, .config_aneg = at803x_config_aneg, .soft_reset = genphy_soft_reset, .set_wol = at803x_set_wol, From patchwork Fri Dec 8 14:51:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 175842 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5512342vqy; Fri, 8 Dec 2023 07:03:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IGkhTpcRnBREdZkYjIUYxyiBF7YCVZZVzTsAe/sAaukMfnATCLsIBkng8HJxeOddlzy9ebQ X-Received: by 2002:a17:90a:ea14:b0:286:a734:be46 with SMTP id w20-20020a17090aea1400b00286a734be46mr204448pjy.7.1702047819730; Fri, 08 Dec 2023 07:03:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702047819; cv=none; d=google.com; s=arc-20160816; b=pBn4fnaTK4NcdlO+VHVttDR/L1wrIJj8vt7HYfIFqTdsjcyiCdgStd94KyznK7q9ly Ic7zreTDLVEv+zJVry+xzctiE5X0oAAOhvhOdWTQR+Pmxowl+h81dYu+REh/WS1Amyw6 Ni5KxlNO/AG76AQwwLn/OducU1cdciLIn3RnaqhiXcjbr3fg6J5tap7dlQ/aFpAR6DWO murwdnmWEzBBScgtseDI7SCXxO1rr4fdWnBHLHilLiW2SL6nukU33x0xffDvba4cTB8N 6zKlZeIEEbmx/4s+CbHF9iK7A1G+vIloKwXmCCVwIvk0sepFNJl+ClgpjxD2WDmCQ1qz AREA== 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=jUWRj8SMGfke2llijADB8r/5G0kPfaXc58R9QB7gQMQ=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=MWHLwFQvTNO2qeKfvy2GreKi9F7ixUku42nrhxz9QJ8Kn10TYUiTqSuSuE1AXTnI8U K5cmfPWh93QNz/u+FCpsVqIqPTLgBbZJ1peGQ57fs9I0n8dlx99tz7th8rL23h2G4Zh5 zbL+MN7RzP6CCPQ1wx40+K2AMrLvrEPN2Mx9ws+qYJezF9i8ltZx3I5Me5p+aHRFoD64 RVh4owFbaVjusHOCybTkpUXwrJfi9baLSkcjevhICw6oajtsWd2LgkIWYPvd1JCE4His D6ArprnAtWiTY2omxc0ju19rmoWr9rqhe5xIhqCtlQNej1dwpQQO2RX26EPOKK9o+jFe MFXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="jnT/hZqf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id u10-20020a170903124a00b001cfa8f0e365si1713039plh.305.2023.12.08.07.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 07:03:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="jnT/hZqf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 618D180E9EAB; Fri, 8 Dec 2023 07:03:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574178AbjLHPDZ (ORCPT + 99 others); Fri, 8 Dec 2023 10:03:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574051AbjLHPDP (ORCPT ); Fri, 8 Dec 2023 10:03:15 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E6FF3853; Fri, 8 Dec 2023 06:52:17 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40c2718a768so22048665e9.0; Fri, 08 Dec 2023 06:52:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047136; x=1702651936; 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=jUWRj8SMGfke2llijADB8r/5G0kPfaXc58R9QB7gQMQ=; b=jnT/hZqfNztMEu/jSWkZpVQ97zYhtCSDzbi8qMIFt/CLCZ/T48CgWGud9qnG6btfZ4 BTZGRtBRbpFfpaNGdGr4+OoG8q/az0hUlq3Vuj7SU1Uxblg647JqLougto2ul7FwO0j1 88RXDOva5/9fHFWx6Savykqh8ahOZbu0HMLZNHU0O3RJ+zjZRg3y/WDzLp1etdl9urVf GJSVvDaWzBBDWwUTxXze7H5AOfTYDqEIxeJRl8cG74tX8NSbJvTjfZJ5OJz903PnZqmp wFk1+BzgefH2o6NnpkskBlxTrDoUxzLax58p5JuIt8RVwP3gD3r8rHEv+WtH6UnHo5mj 3/hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047136; x=1702651936; 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=jUWRj8SMGfke2llijADB8r/5G0kPfaXc58R9QB7gQMQ=; b=p6/qSnmwQNWTx4w86Bt3PZg+O744ZdMxjexGF61s7cVTseNcAxjemKsnsNZ8iAkj8l +DK+QixFXv6XCZlmCUiVJZcpTgsotjH/ScQWxEo/pyo0/xN3aoeOpvyOzrpKGm7bOhTN RXkk0r+q/WCc4WadhA/l3n6Syayi0bSXAUyvyOV4/dwDFOfAvH0i2Ol6elSWbnBr3YXP RjrjbrbRPiAVqaVw3ftz9HrTazgruAgNTWoKtjmuEpYwApb3I0pTbhQtZcVaODFQYGBQ lF2u795vH/CvQdPwdsL0QdRECtoMmLTFGUc1/oB1lhQTyTcQqcPL2NA+qNZfrAVj2Pq6 YheQ== X-Gm-Message-State: AOJu0Yx8/R4I3Vwtoy/j7VcWVTNevS/nlRChWMthCh9yFz31Z3EbHHvu VeTxbmasJ9jMT6Y4ybpWLxcuEN6FRPY= X-Received: by 2002:a05:600c:32af:b0:40c:2c2f:a5f0 with SMTP id t47-20020a05600c32af00b0040c2c2fa5f0mr41351wmp.92.1702047135709; Fri, 08 Dec 2023 06:52:15 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:15 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v4 08/13] net: phy: at803x: move specific at8031 WOL bits to dedicated function Date: Fri, 8 Dec 2023 15:51:55 +0100 Message-Id: <20231208145200.25162-9-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 08 Dec 2023 07:03:34 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784726494315375445 X-GMAIL-MSGID: 1784726494315375445 Move specific at8031 WOL enable/disable to dedicated function to make at803x_set_wol more generic. This is needed in preparation for PHY driver split as qca8081 share the same function to toggle WOL settings. In this new implementation WOL module in at8031 is enabled after the generic interrupt is setup. This should not cause any problem as the WOL_INT has a separate implementation and only relay on MAC bits. Signed-off-by: Christian Marangi --- drivers/net/phy/at803x.c | 42 ++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index e2bf5a16ba3c..862ec08ad86b 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -466,27 +466,11 @@ static int at803x_set_wol(struct phy_device *phydev, phy_write_mmd(phydev, MDIO_MMD_PCS, offsets[i], mac[(i * 2) + 1] | (mac[(i * 2)] << 8)); - /* Enable WOL function for 1588 */ - if (phydev->drv->phy_id == ATH8031_PHY_ID) { - ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, - AT803X_PHY_MMD3_WOL_CTRL, - 0, AT803X_WOL_EN); - if (ret) - return ret; - } /* Enable WOL interrupt */ ret = phy_modify(phydev, AT803X_INTR_ENABLE, 0, AT803X_INTR_ENABLE_WOL); if (ret) return ret; } else { - /* Disable WoL function for 1588 */ - if (phydev->drv->phy_id == ATH8031_PHY_ID) { - ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, - AT803X_PHY_MMD3_WOL_CTRL, - AT803X_WOL_EN, 0); - if (ret) - return ret; - } /* Disable WOL interrupt */ ret = phy_modify(phydev, AT803X_INTR_ENABLE, AT803X_INTR_ENABLE_WOL, 0); if (ret) @@ -1609,6 +1593,30 @@ static int at8031_config_init(struct phy_device *phydev) return at803x_config_init(phydev); } +static int at8031_set_wol(struct phy_device *phydev, + struct ethtool_wolinfo *wol) +{ + int ret; + + /* First setup MAC address and enable WOL interrupt */ + ret = at803x_set_wol(phydev, wol); + if (ret) + return ret; + + if (wol->wolopts & WAKE_MAGIC) + /* Enable WOL function for 1588 */ + ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, + AT803X_PHY_MMD3_WOL_CTRL, + 0, AT803X_WOL_EN); + else + /* Disable WoL function for 1588 */ + ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, + AT803X_PHY_MMD3_WOL_CTRL, + AT803X_WOL_EN, 0); + + return ret; +} + static int qca83xx_config_init(struct phy_device *phydev) { u8 switch_revision; @@ -2121,7 +2129,7 @@ static struct phy_driver at803x_driver[] = { .config_init = at8031_config_init, .config_aneg = at803x_config_aneg, .soft_reset = genphy_soft_reset, - .set_wol = at803x_set_wol, + .set_wol = at8031_set_wol, .get_wol = at803x_get_wol, .suspend = at803x_suspend, .resume = at803x_resume, From patchwork Fri Dec 8 14:51:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 175835 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5506515vqy; Fri, 8 Dec 2023 06:55:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IGBFf6LpHVpCMZ+pz6yHSJCOPI4k1kQPFZDTrjBvfOmS2Ml17psCjnZp82YAcf1VlYH0xgJ X-Received: by 2002:a05:6a00:aca:b0:68e:2f6e:b4c0 with SMTP id c10-20020a056a000aca00b0068e2f6eb4c0mr174568pfl.28.1702047304994; Fri, 08 Dec 2023 06:55:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702047304; cv=none; d=google.com; s=arc-20160816; b=EMTK1+3M4JY1DWMGY3TMC3nYXGtCl2nw26pGHW0G687c6GtUGQsVEuiDPOrTwarVMB Fuo3ML/ByMFFCT2j9uowkIF9IjWyjcru6SAmX8gJwH4UkDOn0y7Y34alA6NJZAcNTmP2 CyrBycSBxU6GP1OPUsOz8rPC0pTicYYJI2fhN2RFmJznehauGHv6zA7yzBgStQoGM9dD qxW1hJYDFPwficH+F4z3azPDv7Et59S1buPcglZIjgtn7UZXxFiCJPyeHPGLZ57WwH+K 753582pJtEYIUzll5vRZvPWsevMLWVwhmGAiKyb6aXsfbnk8xxUUJhxxJxmV6q0ihxLl P4oA== 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=Ire9TzxrqfCVF6+oXacCtQAHi8rA2FHZhZNxfVwYUAk=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=Rkx6OwZKMoLpyyCisE+/SUgXF3mlSRq09g6ypQXXMXeKF6+XApGILQWt8gkOCXj33V julCM5ehIChsJBC77D3p8TEuOc6OFc+j/vz3DV1WT8Ezs/r0TzPjm/ul4d8wcOuvWizQ VJPaCeN687Cb3Hx82yhvz6y510dbKw/CBaYzAvHPNKedGYpYz01qsFy8PXnsjBeKnWnK OTLSTpA8yzjCrlx//m29tmiEyIneeCfsLrMFV8LPWJsjke0FQf5H00zbFMbT+ZzRHOb7 3GfDjtChgkzQS20s+o7Pq/X/aaF861mM9WKWDGe6vDEOZmRsNcgKiE2IzczAg0HEUtYp zgtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Fq+TVfSK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id fa3-20020a056a002d0300b006cb6fb35b87si1704923pfb.94.2023.12.08.06.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:55:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Fq+TVfSK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 8E7FE844BC62; Fri, 8 Dec 2023 06:55:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574105AbjLHOyu (ORCPT + 99 others); Fri, 8 Dec 2023 09:54:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574056AbjLHOyH (ORCPT ); Fri, 8 Dec 2023 09:54:07 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5E0A3860; Fri, 8 Dec 2023 06:52:18 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40c32df9174so8939985e9.3; Fri, 08 Dec 2023 06:52:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047137; x=1702651937; 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=Ire9TzxrqfCVF6+oXacCtQAHi8rA2FHZhZNxfVwYUAk=; b=Fq+TVfSKYAxiWrGtf3VtEXuYgOLVOQnXZzmSlb3mM0CtUGBvP122/kcep7Vqb+bK4K oywyMa6xrbseYkeGLCWmXZ/lswNIsHswwifZ4eoqVxM138Gn46sG9FQ5DZZOG49VmvtW 6UlME8F1fi3P/PJIAmC+vVqzr1M9+2Z2aOXZheSJoPjY3c9mgEUbUi2lUFtNQ1QSO0e7 KErl4iKuWGTCeF5Z4IPTSiptNQygxgP3UubUBv5SVyfLa83sM9YAX7zzNL+Qb7/uRjIB HDu0MRh/NrDc2SCObA+k/8v+8QJ8Q4Ai6XM+ZvwssdYi48fDlABJ8GUhCnAWInl/Aj9x aTbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047137; x=1702651937; 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=Ire9TzxrqfCVF6+oXacCtQAHi8rA2FHZhZNxfVwYUAk=; b=AS7cpmS6jtXPEJOWhYNdYRxcPGNOeBTsXf32VXTBxJkHY9GPGRTVGED4q4mVsSGFp7 VE1crID2fQsBeh0n6vbtPJmPg9V+e18BLEP59UJZjEJGfjxUe22q2klcuJ8c98eEg0nl pAq63uEB5YrIOe5Jvvmzuj3iZ2d+7bz0apVgQhGfwCNCrB8j+dNfw5ID6eZDGYSHLEN/ jh+MmIif4IUatxlbd5Ynr4Unmukm47NBJukvl+XuMlygsLPi5nvuteAUm2pvD25200/G A4LdoJaqNpw94BOEWahzIofotRWVJxjpUX00TRKOBePkhdkarFfJgRrQKwMUZd11KOpB UqDw== X-Gm-Message-State: AOJu0YwwK6Nm0Aam9TQAVgPPSTrKZenyl5OxLHaqHam4BYIMEngD3ZsT Sy7dAYL8HuFV9tsr0jIcOF8= X-Received: by 2002:a1c:7c1a:0:b0:40b:5e21:c5b6 with SMTP id x26-20020a1c7c1a000000b0040b5e21c5b6mr30370wmc.132.1702047136938; Fri, 08 Dec 2023 06:52:16 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:16 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v4 09/13] net: phy: at803x: move specific at8031 config_intr to dedicated function Date: Fri, 8 Dec 2023 15:51:56 +0100 Message-Id: <20231208145200.25162-10-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 howler.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 (howler.vger.email [0.0.0.0]); Fri, 08 Dec 2023 06:55:02 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784725955017580100 X-GMAIL-MSGID: 1784725955017580100 Move specific at8031 config_intr bits to dedicated function to make at803x_config_initr more generic. This is needed in preparation for PHY driver split as qca8081 share the same function to setup interrupts. Signed-off-by: Christian Marangi --- drivers/net/phy/at803x.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 862ec08ad86b..83428305281b 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -990,7 +990,6 @@ static int at803x_ack_interrupt(struct phy_device *phydev) static int at803x_config_intr(struct phy_device *phydev) { - struct at803x_priv *priv = phydev->priv; int err; int value; @@ -1007,10 +1006,6 @@ static int at803x_config_intr(struct phy_device *phydev) value |= AT803X_INTR_ENABLE_DUPLEX_CHANGED; value |= AT803X_INTR_ENABLE_LINK_FAIL; value |= AT803X_INTR_ENABLE_LINK_SUCCESS; - if (priv->is_fiber) { - value |= AT803X_INTR_ENABLE_LINK_FAIL_BX; - value |= AT803X_INTR_ENABLE_LINK_SUCCESS_BX; - } err = phy_write(phydev, AT803X_INTR_ENABLE, value); } else { @@ -1617,6 +1612,29 @@ static int at8031_set_wol(struct phy_device *phydev, return ret; } +static int at8031_config_intr(struct phy_device *phydev) +{ + struct at803x_priv *priv = phydev->priv; + int err, value = 0; + + if (phydev->interrupts == PHY_INTERRUPT_ENABLED && + priv->is_fiber) { + /* Clear any pending interrupts */ + err = at803x_ack_interrupt(phydev); + if (err) + return err; + + value |= AT803X_INTR_ENABLE_LINK_FAIL_BX; + value |= AT803X_INTR_ENABLE_LINK_SUCCESS_BX; + + err = phy_set_bits(phydev, AT803X_INTR_ENABLE, value); + if (err) + return err; + } + + return at803x_config_intr(phydev); +} + static int qca83xx_config_init(struct phy_device *phydev) { u8 switch_revision; @@ -2137,7 +2155,7 @@ static struct phy_driver at803x_driver[] = { .write_page = at803x_write_page, .get_features = at803x_get_features, .read_status = at803x_read_status, - .config_intr = at803x_config_intr, + .config_intr = at8031_config_intr, .handle_interrupt = at803x_handle_interrupt, .get_tunable = at803x_get_tunable, .set_tunable = at803x_set_tunable, From patchwork Fri Dec 8 14:51:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 175833 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5506354vqy; Fri, 8 Dec 2023 06:54:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IGLFSRWCCxKcoubS4NSnE+J6aM7ciF2YsDPeXqVDmWqwSlMLiPm7+yGNE5shF3Q6P5imv7N X-Received: by 2002:a17:903:298e:b0:1d0:d196:2658 with SMTP id lm14-20020a170903298e00b001d0d1962658mr172593plb.19.1702047282798; Fri, 08 Dec 2023 06:54:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702047282; cv=none; d=google.com; s=arc-20160816; b=ZyeXB50oz8gao5UCJbdHUmuKB78uLvl0+TH/lluK8nvQVn1qhP7IsisC5RbEAX23Fj mHMBHUrI4n6AMIQkxaiqX5vxSnz0wZ7a991Ik3Lsn2hLo0HyLuWT1cOq0W7l8MfNtZ4R PVaRFBQalzy/IEKp/o/dluoVCZtopZnJu8HtFKbf1FpLQtnihykNCcFpBa4vKJ8NusTw 3kq6GYNl7iiljAz/QOs79IIi1ggOeeiWLUeoj9dwUz2uV8mDqfu6NKgt1LZwQfgwLZ92 17XFLrZ1lsxFrkNx1fCTp+Wf43zgoNcCjA+OhAu/bf50E2F5Z4NIDNEM+7N1l5BHdJ8n t0CQ== 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=l/LkCIkEWQjEgEt2tt9hxl04Qa/tBAKJsHnx5bVDjm0=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=c7pTaMK0+83uvFOJ2Zt4GDxzWmnVRxbwdlVHXS0+S9e6Xu/daPuUZjrMZWk8By8cO0 QxSUlgg9dt9ipM1z0Nbddiun25n++4Ju8KwQxnmMwefP02K5OgBPKqlY2BeuCc7StQ4f Lzak+lh4gM9dcZDV658EyQV1cmwS4ZXRz1Q+tHXUKyB3ejEl9kYSvvYLmLAHoP6GwJ53 nbh9j7XKOM5ahI9aNVB4I0cye9tjsD5UqlXKRG9dsWBuig6Il3HpuaDM8ghU+7iZMzPX AGHcr3ml1918ybRAQWXYdhnBfJwBfzl5UVKWMCFh3BDDvOL1q4bvmFUs6jOKpWCwPOlD /7+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="QSan3pD/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id o2-20020a170902d4c200b001d0a35a098bsi1732088plg.566.2023.12.08.06.54.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:54:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="QSan3pD/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id C419F844BC46; Fri, 8 Dec 2023 06:54:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574253AbjLHOy2 (ORCPT + 99 others); Fri, 8 Dec 2023 09:54:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574038AbjLHOyC (ORCPT ); Fri, 8 Dec 2023 09:54:02 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B786386F; Fri, 8 Dec 2023 06:52:20 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40c256ffdbcso22578955e9.2; Fri, 08 Dec 2023 06:52:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047138; x=1702651938; 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=l/LkCIkEWQjEgEt2tt9hxl04Qa/tBAKJsHnx5bVDjm0=; b=QSan3pD/hLnk9N111xORmrs2/4lCjvmbEvF+NYk87r5FeV4Y1G9Z23+scCPLEZ8AZG BN/iDpS02MmF0QfYnvzIMomea8ny6F3OYFRwvS7VTRfLGgkdMYUa9c3/HczoSSrwqec+ 1acM9FlauXk3y0LQb4SXouffuOqi7MTuJEOduHPqt/RzWRTE9YHAhMy+gHlSgKsRYJJP FOcE05gL6Zp0w1e8TezMY/DcwkzeV+EUYtGqSi0eHdYClfjEwsvb6j/pgE4QLKoqi4AC MyyiLWDei7d461icI0QiIL8MGgB9K4NzCnRsW2eSeGbFpZdVnRZDhxkFdGKLr5XxVtpc WKsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047138; x=1702651938; 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=l/LkCIkEWQjEgEt2tt9hxl04Qa/tBAKJsHnx5bVDjm0=; b=Z1e5h31I6OIhU4IDnDMhcHAprV6qupIwfYaqxWlq2wuPFjQEr82CTYlrP6uspuljUY diMKxZChlfeJPMDbvHuIJQp6O48tFSfHMs9XwGrIO+A9qqcIrwA6KmiYj8RZictHvf1I yXbYrq90ZNkIZnkImP94LreDokCkQASUGZRZJxh/hzqOQoFPvBaC58WK8zBZAeipDDIO Wlgrx6qLIlAM+7e3Y3f2gj9xlZjsyeIyDC24HKJiu27bmQQacmbLBXoIel7dhlI10Eev KIAhTD+KmKoIOL4gFWyPPjmQ6u16WetbRL9Jy6WWMFcM/HS4EOlGfYMZdCzK2td5blLw cc9w== X-Gm-Message-State: AOJu0YwEiVTX7cwB3r7HscKrTyg/3wjDTSfEA/qUDAi6ievH4J9MxyMQ GinrPAx99kDG2Tg5cL8aq4g= X-Received: by 2002:a05:600c:492f:b0:40b:5e1e:cf6 with SMTP id f47-20020a05600c492f00b0040b5e1e0cf6mr53165wmp.49.1702047138266; Fri, 08 Dec 2023 06:52:18 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:17 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v4 10/13] net: phy: at803x: make at8031 related DT functions name more specific Date: Fri, 8 Dec 2023 15:51:57 +0100 Message-Id: <20231208145200.25162-11-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 howler.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 (howler.vger.email [0.0.0.0]); Fri, 08 Dec 2023 06:54:40 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784725931606515736 X-GMAIL-MSGID: 1784725931606515736 Rename at8031 related DT function name to a more specific name referencing they are only related to at8031 and not to the generic at803x PHY family. Signed-off-by: Christian Marangi --- drivers/net/phy/at803x.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 83428305281b..7443bc8fe17c 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -583,7 +583,7 @@ static int at803x_resume(struct phy_device *phydev) return phy_modify(phydev, MII_BMCR, BMCR_PDOWN | BMCR_ISOLATE, 0); } -static int at803x_rgmii_reg_set_voltage_sel(struct regulator_dev *rdev, +static int at8031_rgmii_reg_set_voltage_sel(struct regulator_dev *rdev, unsigned int selector) { struct phy_device *phydev = rdev_get_drvdata(rdev); @@ -596,7 +596,7 @@ static int at803x_rgmii_reg_set_voltage_sel(struct regulator_dev *rdev, AT803X_DEBUG_RGMII_1V8, 0); } -static int at803x_rgmii_reg_get_voltage_sel(struct regulator_dev *rdev) +static int at8031_rgmii_reg_get_voltage_sel(struct regulator_dev *rdev) { struct phy_device *phydev = rdev_get_drvdata(rdev); int val; @@ -610,8 +610,8 @@ static int at803x_rgmii_reg_get_voltage_sel(struct regulator_dev *rdev) static const struct regulator_ops vddio_regulator_ops = { .list_voltage = regulator_list_voltage_table, - .set_voltage_sel = at803x_rgmii_reg_set_voltage_sel, - .get_voltage_sel = at803x_rgmii_reg_get_voltage_sel, + .set_voltage_sel = at8031_rgmii_reg_set_voltage_sel, + .get_voltage_sel = at8031_rgmii_reg_get_voltage_sel, }; static const unsigned int vddio_voltage_table[] = { @@ -666,7 +666,7 @@ static int at8031_register_regulators(struct phy_device *phydev) return 0; } -static int at803x_sfp_insert(void *upstream, const struct sfp_eeprom_id *id) +static int at8031_sfp_insert(void *upstream, const struct sfp_eeprom_id *id) { struct phy_device *phydev = upstream; __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_support); @@ -710,10 +710,10 @@ static int at803x_sfp_insert(void *upstream, const struct sfp_eeprom_id *id) return 0; } -static const struct sfp_upstream_ops at803x_sfp_ops = { +static const struct sfp_upstream_ops at8031_sfp_ops = { .attach = phy_sfp_attach, .detach = phy_sfp_detach, - .module_insert = at803x_sfp_insert, + .module_insert = at8031_sfp_insert, }; static int at803x_parse_dt(struct phy_device *phydev) @@ -1519,7 +1519,7 @@ static int at8031_parse_dt(struct phy_device *phydev) } /* Only AR8031/8033 support 1000Base-X for SFP modules */ - return phy_sfp_probe(phydev, &at803x_sfp_ops); + return phy_sfp_probe(phydev, &at8031_sfp_ops); } static int at8031_probe(struct phy_device *phydev) From patchwork Fri Dec 8 14:51:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 175836 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5506537vqy; Fri, 8 Dec 2023 06:55:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IFan0LCaVm5O/Ux6bc2K8N3zjvHuEdLlaA9uypIHp4m3r//JdsdB+YVZqY5dQX+dmvIA5IZ X-Received: by 2002:a17:90a:c214:b0:286:e5c0:eb4e with SMTP id e20-20020a17090ac21400b00286e5c0eb4emr160328pjt.50.1702047306514; Fri, 08 Dec 2023 06:55:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702047306; cv=none; d=google.com; s=arc-20160816; b=PNpV1x0yoWL/LhJb+kVW1w7195ecti2hM7zm07UMpG4vE7b5LwAxpImHRuiZssv5vp L8aPadk15Ob0SFaQU2LlHkB9V8YMWxHqLKRXK0GEoZG4kYLguyTlp7H4if/6hDx3smdY MuUycJlj/3bkCkc7ban7J1TfEePklmuHpZq52/lHKmYcQry0iuRIUcREYgLX+HxKG5XE ZI+cApe2c7Bj+o8lgExhNqWNe2MRDKMLN0MdbGNjJM/0MOuM5JGH+twVOBMWaHfkjPcD ufw08ah92lNOL1Ut4xDtDT28bovtduACqE95RRH4iNDfZiD+B56DO7N+XT2mxvv6qhg3 3+vA== 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=kxuFbcbCxLZZxQ+emdGZsDK+ZXhQqCPZYukVIrO9V20=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=B3gCEux3tPddJLELUokyznbshaRmU4Dgvfpwu9HFPC9ZJwiptOUebiZg4S0A/SfOti /3T/IvD4SUJiWJhZ/czicStNTsZPHo37dcrSiySQ0r1nDSPD7ERz5k3sWR5tOLrYSngE 7QDgB2ZG50lDvYi9L6HBnGb8M8p0Z7ojz2FM+F5xV8yLn+6a+FY/ADylliH38gESS8h5 /QYLeP9ravEGVd2Qcpj10ioOIHLOWMKB6zPdkcMnqDRkPeAmOxPEwrjj6AndowAS6ksI Ygh16aJ8S7bcXAUpjyEjuSjqk6znxDGkGFgKrmEEJjv3IGhXRfrEbI0xcStpxvSk/iN0 8A+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="OvNqJ3Y/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id o12-20020a17090a744c00b00286f67f01b4si2938434pjk.184.2023.12.08.06.55.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:55:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="OvNqJ3Y/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 9A76F810D646; Fri, 8 Dec 2023 06:55:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574049AbjLHOyj (ORCPT + 99 others); Fri, 8 Dec 2023 09:54:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574151AbjLHOyF (ORCPT ); Fri, 8 Dec 2023 09:54:05 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F74A3871; Fri, 8 Dec 2023 06:52:21 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40c19467a63so24584715e9.3; Fri, 08 Dec 2023 06:52:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047139; x=1702651939; 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=kxuFbcbCxLZZxQ+emdGZsDK+ZXhQqCPZYukVIrO9V20=; b=OvNqJ3Y/qp79ELQCaAtHV7bLPx1MDlPgXYqz+jDY5NP3Mi95fXBQSLU0T9Ue3U9nTP k0S2YV/XPPu7HOeawn+PzkHvUQWYl/hvcogIomo+Ur0tcbLTnhpybiWqNu9pYhsMjp4Z 507ZmxV2+lQe/k447osPzY8nB1ZZANzQsIItcMIZxJCaCSqiXb4iO8UMFqbbWpnFWQo3 7elvGYFpz6x1rE0aGdZUtLDx1UmIfyfbLjAR/bJs56Up08zCLro4NaYABuUyv8en+WpI FlMxj7uvFAjj7E9h/pS3JKdIFBtW4JYpa0uiXTUo3ftYG9nYP+vMxfZ5yfH+nPAyxpu7 YoVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047139; x=1702651939; 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=kxuFbcbCxLZZxQ+emdGZsDK+ZXhQqCPZYukVIrO9V20=; b=NiUEyKDDqIk2nH/bK8v2lw72S2w44aRBH37dNU6zpAS+BXA9+SSkr0jUHmeVG2aOcV 3kvZjgp0skeMQCp3+HG11Cuv0N1fbwKZNm9+xltMV30JdnpdveSzkfJhfBqZr4m4pBOc uBzCtC1eb7i6QGtyAVXZz9ia3969Efg2jyKJERd8jnL6fth4/DXZvDL60iM6glOyKh1N Q/pRJ1vevAYLccYxBjjHEueAjRgYlWQRdTbj4/SymUqXVhseyeS6MvmmWN52qBUwgaUp A+q9rO0gRt7M10+qylvMMsgErp4Dc4+6P1kvRUrTAOR/SVdA0VI9E+dkLcAfbcJUgHZK hJYA== X-Gm-Message-State: AOJu0YxSfUGIzVOZE/yYGdj5PeZE/M6gML7BiU6ajZWT/DwKSZU+NG54 z1PonxgiELh9hzWXmCYWnYOY3BJ+OJs= X-Received: by 2002:a05:600c:518a:b0:405:4776:735a with SMTP id fa10-20020a05600c518a00b004054776735amr61561wmb.2.1702047139231; Fri, 08 Dec 2023 06:52:19 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:18 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v4 11/13] net: phy: at803x: move at8031 functions in dedicated section Date: Fri, 8 Dec 2023 15:51:58 +0100 Message-Id: <20231208145200.25162-12-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 08 Dec 2023 06:55:03 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784725956651301704 X-GMAIL-MSGID: 1784725956651301704 Move at8031 functions in dedicated section with dedicated at8031 parse_dt and probe. Signed-off-by: Christian Marangi --- drivers/net/phy/at803x.c | 266 +++++++++++++++++++-------------------- 1 file changed, 133 insertions(+), 133 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 7443bc8fe17c..c08d3c4f097f 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -583,139 +583,6 @@ static int at803x_resume(struct phy_device *phydev) return phy_modify(phydev, MII_BMCR, BMCR_PDOWN | BMCR_ISOLATE, 0); } -static int at8031_rgmii_reg_set_voltage_sel(struct regulator_dev *rdev, - unsigned int selector) -{ - struct phy_device *phydev = rdev_get_drvdata(rdev); - - if (selector) - return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_1F, - 0, AT803X_DEBUG_RGMII_1V8); - else - return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_1F, - AT803X_DEBUG_RGMII_1V8, 0); -} - -static int at8031_rgmii_reg_get_voltage_sel(struct regulator_dev *rdev) -{ - struct phy_device *phydev = rdev_get_drvdata(rdev); - int val; - - val = at803x_debug_reg_read(phydev, AT803X_DEBUG_REG_1F); - if (val < 0) - return val; - - return (val & AT803X_DEBUG_RGMII_1V8) ? 1 : 0; -} - -static const struct regulator_ops vddio_regulator_ops = { - .list_voltage = regulator_list_voltage_table, - .set_voltage_sel = at8031_rgmii_reg_set_voltage_sel, - .get_voltage_sel = at8031_rgmii_reg_get_voltage_sel, -}; - -static const unsigned int vddio_voltage_table[] = { - 1500000, - 1800000, -}; - -static const struct regulator_desc vddio_desc = { - .name = "vddio", - .of_match = of_match_ptr("vddio-regulator"), - .n_voltages = ARRAY_SIZE(vddio_voltage_table), - .volt_table = vddio_voltage_table, - .ops = &vddio_regulator_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, -}; - -static const struct regulator_ops vddh_regulator_ops = { -}; - -static const struct regulator_desc vddh_desc = { - .name = "vddh", - .of_match = of_match_ptr("vddh-regulator"), - .n_voltages = 1, - .fixed_uV = 2500000, - .ops = &vddh_regulator_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, -}; - -static int at8031_register_regulators(struct phy_device *phydev) -{ - struct at803x_priv *priv = phydev->priv; - struct device *dev = &phydev->mdio.dev; - struct regulator_config config = { }; - - config.dev = dev; - config.driver_data = phydev; - - priv->vddio_rdev = devm_regulator_register(dev, &vddio_desc, &config); - if (IS_ERR(priv->vddio_rdev)) { - phydev_err(phydev, "failed to register VDDIO regulator\n"); - return PTR_ERR(priv->vddio_rdev); - } - - priv->vddh_rdev = devm_regulator_register(dev, &vddh_desc, &config); - if (IS_ERR(priv->vddh_rdev)) { - phydev_err(phydev, "failed to register VDDH regulator\n"); - return PTR_ERR(priv->vddh_rdev); - } - - return 0; -} - -static int at8031_sfp_insert(void *upstream, const struct sfp_eeprom_id *id) -{ - struct phy_device *phydev = upstream; - __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_support); - __ETHTOOL_DECLARE_LINK_MODE_MASK(sfp_support); - DECLARE_PHY_INTERFACE_MASK(interfaces); - phy_interface_t iface; - - linkmode_zero(phy_support); - phylink_set(phy_support, 1000baseX_Full); - phylink_set(phy_support, 1000baseT_Full); - phylink_set(phy_support, Autoneg); - phylink_set(phy_support, Pause); - phylink_set(phy_support, Asym_Pause); - - linkmode_zero(sfp_support); - sfp_parse_support(phydev->sfp_bus, id, sfp_support, interfaces); - /* Some modules support 10G modes as well as others we support. - * Mask out non-supported modes so the correct interface is picked. - */ - linkmode_and(sfp_support, phy_support, sfp_support); - - if (linkmode_empty(sfp_support)) { - dev_err(&phydev->mdio.dev, "incompatible SFP module inserted\n"); - return -EINVAL; - } - - iface = sfp_select_interface(phydev->sfp_bus, sfp_support); - - /* Only 1000Base-X is supported by AR8031/8033 as the downstream SerDes - * interface for use with SFP modules. - * However, some copper modules detected as having a preferred SGMII - * interface do default to and function in 1000Base-X mode, so just - * print a warning and allow such modules, as they may have some chance - * of working. - */ - if (iface == PHY_INTERFACE_MODE_SGMII) - dev_warn(&phydev->mdio.dev, "module may not function if 1000Base-X not supported\n"); - else if (iface != PHY_INTERFACE_MODE_1000BASEX) - return -EINVAL; - - return 0; -} - -static const struct sfp_upstream_ops at8031_sfp_ops = { - .attach = phy_sfp_attach, - .detach = phy_sfp_detach, - .module_insert = at8031_sfp_insert, -}; - static int at803x_parse_dt(struct phy_device *phydev) { struct device_node *node = phydev->mdio.dev.of_node; @@ -1498,6 +1365,139 @@ static int at803x_cable_test_start(struct phy_device *phydev) return 0; } +static int at8031_rgmii_reg_set_voltage_sel(struct regulator_dev *rdev, + unsigned int selector) +{ + struct phy_device *phydev = rdev_get_drvdata(rdev); + + if (selector) + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_1F, + 0, AT803X_DEBUG_RGMII_1V8); + else + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_1F, + AT803X_DEBUG_RGMII_1V8, 0); +} + +static int at8031_rgmii_reg_get_voltage_sel(struct regulator_dev *rdev) +{ + struct phy_device *phydev = rdev_get_drvdata(rdev); + int val; + + val = at803x_debug_reg_read(phydev, AT803X_DEBUG_REG_1F); + if (val < 0) + return val; + + return (val & AT803X_DEBUG_RGMII_1V8) ? 1 : 0; +} + +static const struct regulator_ops vddio_regulator_ops = { + .list_voltage = regulator_list_voltage_table, + .set_voltage_sel = at8031_rgmii_reg_set_voltage_sel, + .get_voltage_sel = at8031_rgmii_reg_get_voltage_sel, +}; + +static const unsigned int vddio_voltage_table[] = { + 1500000, + 1800000, +}; + +static const struct regulator_desc vddio_desc = { + .name = "vddio", + .of_match = of_match_ptr("vddio-regulator"), + .n_voltages = ARRAY_SIZE(vddio_voltage_table), + .volt_table = vddio_voltage_table, + .ops = &vddio_regulator_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, +}; + +static const struct regulator_ops vddh_regulator_ops = { +}; + +static const struct regulator_desc vddh_desc = { + .name = "vddh", + .of_match = of_match_ptr("vddh-regulator"), + .n_voltages = 1, + .fixed_uV = 2500000, + .ops = &vddh_regulator_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, +}; + +static int at8031_register_regulators(struct phy_device *phydev) +{ + struct at803x_priv *priv = phydev->priv; + struct device *dev = &phydev->mdio.dev; + struct regulator_config config = { }; + + config.dev = dev; + config.driver_data = phydev; + + priv->vddio_rdev = devm_regulator_register(dev, &vddio_desc, &config); + if (IS_ERR(priv->vddio_rdev)) { + phydev_err(phydev, "failed to register VDDIO regulator\n"); + return PTR_ERR(priv->vddio_rdev); + } + + priv->vddh_rdev = devm_regulator_register(dev, &vddh_desc, &config); + if (IS_ERR(priv->vddh_rdev)) { + phydev_err(phydev, "failed to register VDDH regulator\n"); + return PTR_ERR(priv->vddh_rdev); + } + + return 0; +} + +static int at8031_sfp_insert(void *upstream, const struct sfp_eeprom_id *id) +{ + struct phy_device *phydev = upstream; + __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_support); + __ETHTOOL_DECLARE_LINK_MODE_MASK(sfp_support); + DECLARE_PHY_INTERFACE_MASK(interfaces); + phy_interface_t iface; + + linkmode_zero(phy_support); + phylink_set(phy_support, 1000baseX_Full); + phylink_set(phy_support, 1000baseT_Full); + phylink_set(phy_support, Autoneg); + phylink_set(phy_support, Pause); + phylink_set(phy_support, Asym_Pause); + + linkmode_zero(sfp_support); + sfp_parse_support(phydev->sfp_bus, id, sfp_support, interfaces); + /* Some modules support 10G modes as well as others we support. + * Mask out non-supported modes so the correct interface is picked. + */ + linkmode_and(sfp_support, phy_support, sfp_support); + + if (linkmode_empty(sfp_support)) { + dev_err(&phydev->mdio.dev, "incompatible SFP module inserted\n"); + return -EINVAL; + } + + iface = sfp_select_interface(phydev->sfp_bus, sfp_support); + + /* Only 1000Base-X is supported by AR8031/8033 as the downstream SerDes + * interface for use with SFP modules. + * However, some copper modules detected as having a preferred SGMII + * interface do default to and function in 1000Base-X mode, so just + * print a warning and allow such modules, as they may have some chance + * of working. + */ + if (iface == PHY_INTERFACE_MODE_SGMII) + dev_warn(&phydev->mdio.dev, "module may not function if 1000Base-X not supported\n"); + else if (iface != PHY_INTERFACE_MODE_1000BASEX) + return -EINVAL; + + return 0; +} + +static const struct sfp_upstream_ops at8031_sfp_ops = { + .attach = phy_sfp_attach, + .detach = phy_sfp_detach, + .module_insert = at8031_sfp_insert, +}; + static int at8031_parse_dt(struct phy_device *phydev) { struct device_node *node = phydev->mdio.dev.of_node; From patchwork Fri Dec 8 14:51:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 175834 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5506374vqy; Fri, 8 Dec 2023 06:54:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IFnOuinxV7C34g0YF+eiRpieUiTJMjYXrA9Vl9QPOyTxK4bvhhGWw2tF3C+EVK2UxB8QfQD X-Received: by 2002:a05:6a20:244d:b0:18c:2d7:c4b0 with SMTP id t13-20020a056a20244d00b0018c02d7c4b0mr173569pzc.4.1702047286762; Fri, 08 Dec 2023 06:54:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702047286; cv=none; d=google.com; s=arc-20160816; b=FqpiKjy97ie0S+jEyyc+awLPNeo/bYPOlzd+T1gduW79h1We9g+bQdV2OIxu9AP+j5 pwf01UKjSRbq2DRHuiVpM12o52CZ5qkBQHBS3tbxyCqLjoUoASq87JkahjsPCEc4ZoFf 1yHr498AnWUpTvBmtooxDeE/flvAK5++s7fDthSL4M+IlEFvbYBMmbD+qSBHzN1Bl6Zt HR1OggfLWXVGtn1AGEQaUao64KzbEd6fuJwA9wR7bxjulGTb/DWytAKZ14bHbDfUeC6C gWccvDvFSaV8LthKIHJVyHcRaYxvht7yxNyRCZffgp9CWAXJv6Y8I60bNF2vtTEElYdp URnw== 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=svpeSInqcPybABBCUtSaJ0EECZ2cPeIJlTmLy81gfdg=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=CmKld3ygS7E4TZKCVyg94tXpyBafsHkESsU1/XhnOTyZFWJelEWfMCadiwew2lLW1A kmNM6PJWqqViX7bhVYz0KfOZaIWcQC+cplPUC7OijScnsP6yPOvufYenMjx32+7fpYR7 nT3hKYTKatPq0wCgQWf/+iI7i+blAGD9YkrR3fzHw56LVB1E8GXtB3ADcA09Wg2F9AJV rxkSbJ0mcygsefuBsK1L6FYqiR3XQOd/J7zyrxS3kSVXLzdoOO1iqNPJq3T6EN8dSPcZ ohghlKDkvZlCFcHOJji3hw2efchxf7WlTlmmuasn+q/4v7T6241LqBBi5stXv6dp6Q3r NqRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FPlxBK4M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bz39-20020a056a02062700b005c5e24c7e8csi1818793pgb.414.2023.12.08.06.54.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:54:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FPlxBK4M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 99B1180E7135; Fri, 8 Dec 2023 06:54:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574265AbjLHOyc (ORCPT + 99 others); Fri, 8 Dec 2023 09:54:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574148AbjLHOyE (ORCPT ); Fri, 8 Dec 2023 09:54:04 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19DDB387D; Fri, 8 Dec 2023 06:52:21 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40c09f4814eso28992975e9.1; Fri, 08 Dec 2023 06:52:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047140; x=1702651940; 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=svpeSInqcPybABBCUtSaJ0EECZ2cPeIJlTmLy81gfdg=; b=FPlxBK4MRu+/soRdfLrZBTgz1ovbdftFcggpVP+akAOIZeLn0s3JAs4Es3rgVe1/lD 80x2esOW+VAO7KgFeV18WnWeZ8yh5qnOLDz3+tz72+ZAjyzNCNs7iR1qTc9GWcwuZk05 sQZwd+ZD9GY8hyueZIChtVkux2ei/lseL9BW+2SDC8RfP4qxAoSTsGox5ALUF726OGBF I88EGJKRNvWfx9oGiXdzGtj6kbtbBgcWefpGwPXO5aBkS7e34SAC1dDMVg62ba88vclA e1EdDx8bSy3rWfGcj0HC8w00vrd0HDMpzJ2fvauj7bpoNAPdnqJbcW5lvcsZpdsMzPTS H6bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047140; x=1702651940; 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=svpeSInqcPybABBCUtSaJ0EECZ2cPeIJlTmLy81gfdg=; b=dnOkESTVUGc1sDra7bZfxI6qQKta94IUlDZBkoTzanwHGp47yTur6PU1ziFJ6P+Ybj 2tB0TNr15oQjmumEMO7tPsINcClg/DezHfA3oFwyP2fg9z8kAldjYoDXBa7VZsh4H87W kDpPfCSzludM4O4a6zd5EoYKg5ku9f4KRTPsffYMXLs1aUvLuGlD8rp4O1rHn9aZBot/ taKtC3sU3R5lVBN+w0/ruuM8OC/z/t/JWNHVMiMIKwycoheS5ZQJtT1ldFlWBx3if3Gd 30AmfeXXpzwT8Bvb1D/blFNZNUIL77kfNaBdfonL1FZLt1hN0tkJmB/PHWvxHd4pGVdr QvMA== X-Gm-Message-State: AOJu0YwIZJY0X6XZMRFWpadoqKpb5JSAl77l4QB4cMmEas8TchIlgxdy fwqVfd9Fo2VJKqBSIEVDhbM= X-Received: by 2002:a05:600c:2214:b0:40c:3308:3aec with SMTP id z20-20020a05600c221400b0040c33083aecmr54376wml.132.1702047140270; Fri, 08 Dec 2023 06:52:20 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:19 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v4 12/13] net: phy: at803x: move at8035 specific DT parse to dedicated probe Date: Fri, 8 Dec 2023 15:51:59 +0100 Message-Id: <20231208145200.25162-13-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 08 Dec 2023 06:54:45 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784725935360447857 X-GMAIL-MSGID: 1784725935360447857 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. Detection logic is changed, we check if the clk 25m mask is set and if it's not zero, we assume the qca,clk-out-frequency property is set. The property is checked in the generic at803x_parse_dt called by at803x_probe. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 60 +++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index c08d3c4f097f..da3506fd19c8 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -638,23 +638,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); @@ -1635,6 +1618,45 @@ static int at8031_config_intr(struct phy_device *phydev) return at803x_config_intr(phydev); } +static int at8035_parse_dt(struct phy_device *phydev) +{ + struct at803x_priv *priv = phydev->priv; + + /* Mask is set by the generic at803x_parse_dt + * if property is set. Assume property is set + * with the mask not zero. + */ + if (priv->clk_25m_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. + */ + priv->clk_25m_reg &= AT8035_CLK_OUT_MASK; + priv->clk_25m_mask &= AT8035_CLK_OUT_MASK; + } + + return 0; +} + +/* AR8030 and AR8035 shared the same special mask for clk_25m */ +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_config_init(struct phy_device *phydev) { u8 switch_revision; @@ -2107,7 +2129,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, @@ -2128,7 +2150,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, From patchwork Fri Dec 8 14:52:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 175840 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5507553vqy; Fri, 8 Dec 2023 06:57:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFauQK1z/aF3B9Mn8FlXnvgbDT5tmhnU6psS8nBdrtWw6upyUkdkZIwr0hs785R956ZzZNf X-Received: by 2002:a17:902:db09:b0:1d0:6ffe:a04 with SMTP id m9-20020a170902db0900b001d06ffe0a04mr155478plx.98.1702047431350; Fri, 08 Dec 2023 06:57:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702047431; cv=none; d=google.com; s=arc-20160816; b=assJp1DumrbvsTVv/d30BPbArekeSIHC8NbDq5y/5L72l6qfEoqNXFKYPsEuFemG9F KFxpuRM2bJ0S2cSg2AsH7Fo2l25Ono5+DqOWFBQAwH9UKf40TuN/tl2fBvPa9BWDsnZT +DoLokbrcxLeQqq2SpIKwj7xzAdMdlAViBByGgiFTH/l0ByGGDwdhDJpeHxuAVmSMRB8 jbC3jyohFZzuZELZ+EyjODAGBrgg0AFt+IVib6aKbsewbCaLJWD7I0ERfyBwYWZG1zf6 84RG6jtnBJFxjr1TLPRPbxbWizdJ80aBseWZg+C4MIRsOFnPUV5YBBjvPWPrwIYUewuc xInw== 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=wXKo4SROCMc9mbMIHxYwIaoEGcT/NyrozQrh4hVTf9Q=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=LSxBbOyv75MenXLg2RPq93Jo9xsk+KHatnBxZhysI3VcWEuxS6wSdPKba6VmHsha92 /v2wAYi2HKXZkYJSTcsxx5bosNcGMDbsbDqMgr2DsYWUtuOL+k9Q9/52oYyQJUrEjBaA 769ub9ZYAf/9ECcZFWQ53/ZgCxIM+VGr//Fm06CzQNMLW0ndoHyGmsv/ZsTcybgnF2Jx +nv6dYSpJvs7HYuyWK6gVH89xigqDQAF3obzsnZUwXfrtn6aI3zYkcbksX/281SA/VQz aAomBgzxZKu0pZSouqI15FNHamqoNElkW3g0vIjW9othj7B242P3h2PQuYCY10t5cKdk nSGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Nw1Rl4Gs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id x19-20020a170902b41300b001d071eb5904si1664858plr.276.2023.12.08.06.57.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:57:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Nw1Rl4Gs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 4097D8078671; Fri, 8 Dec 2023 06:56:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574229AbjLHO4Z (ORCPT + 99 others); Fri, 8 Dec 2023 09:56:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574231AbjLHO4L (ORCPT ); Fri, 8 Dec 2023 09:56:11 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87A013A8B; Fri, 8 Dec 2023 06:52:23 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40b595bf5d2so25234445e9.2; Fri, 08 Dec 2023 06:52:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047141; x=1702651941; 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=wXKo4SROCMc9mbMIHxYwIaoEGcT/NyrozQrh4hVTf9Q=; b=Nw1Rl4Gs9IChcfVh/cf3B25PqJ5vatx0llIe8D4HlIzV18ujmHd6ge5SyrQFm7AsbE kaKrGikmdWPmXdsBUxUEJzB//c+18LUGJI3o3lxHRZkiz1wCyeFqWqUtXHIVZVIbI9dA ixeoOeQ4XuhLWIO3fhB3jArVZzB/tMhPlv8HJxx89Ey14DdDz++88E28SetCNICKGf1B 68FLYQ09Cc5D717u63bbSwRgQfQcROSQ4QWT/USma2Nr3zyEabJ/LHNStRFRzKBL3Nr9 EKhwOiYCpYThEFsyz53l9GcqvbqqRrtIkbZ1hLbPC6IZgfNWjrebBKG37sM428ynUABL dPNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047141; x=1702651941; 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=wXKo4SROCMc9mbMIHxYwIaoEGcT/NyrozQrh4hVTf9Q=; b=RZjXgMpFraw3ZkvsVOxz9KWqte3qegepbHr8NsIK8KtODFTjXkGlbaHZ1VBdOM0X3k 4uFWdxz9PUKxbcbeCBeLXrb+AIWNOC8tiV4+xp5pT0f839SAsc8OyygGqKDUcf87JjZz ZcK+dx0O6ZvGyEl5zH0VSQnC1M5GDi5csJTw7GC7OMtDMVYfDeaRBV7GIGIrEcSFPMJV Z3qrabDvW/lAIYoKpkTNbTA2pyjM6BVm5auOhIGT4YIn53za+L/HSNIvZL47L1gGiBUS Wmhq/z89O3TC8uXEd2NcKaU3+XsAcz3cVGy+IR6RVcP+h0Kf56Dz0+o9RXR+O8GsOMcF 7TGA== X-Gm-Message-State: AOJu0YziE/vSQJmgWkqTsXEG0Lu7dFo4eYdkI4Hmc5gwcGlDrL5HUjqk 38Ai1hq2xtl0wMXrP8FDX4M= X-Received: by 2002:a05:600c:1715:b0:40b:5e21:c5b5 with SMTP id c21-20020a05600c171500b0040b5e21c5b5mr29432wmn.131.1702047141418; Fri, 08 Dec 2023 06:52:21 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:20 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v4 13/13] net: phy: at803x: drop specific PHY ID check from cable test functions Date: Fri, 8 Dec 2023 15:52:00 +0100 Message-Id: <20231208145200.25162-14-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-1-ansuelsmth@gmail.com> MIME-Version: 1.0 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 (morse.vger.email [0.0.0.0]); Fri, 08 Dec 2023 06:56:35 -0800 (PST) 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 morse.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784726087206146920 X-GMAIL-MSGID: 1784726087206146920 Drop specific PHY ID check for cable test functions for at803x. This is done to make functions more generic. While at it better describe what the functions does by using more symbolic function names. PHYs that requires to set additional reg are moved to specific function calling the more generic one. cdt_start and cdt_wait_for_completion are changed to take an additional arg to pass specific values specific to the PHY. Signed-off-by: Christian Marangi --- drivers/net/phy/at803x.c | 95 +++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 45 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index da3506fd19c8..b9d3a26cf6dc 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -1222,31 +1222,16 @@ static int at803x_cdt_fault_length(u16 status) return (dt * 824) / 10; } -static int at803x_cdt_start(struct phy_device *phydev, int pair) +static int at803x_cdt_start(struct phy_device *phydev, + u32 cdt_start) { - u16 cdt; - - /* qca8081 takes the different bit 15 to enable CDT test */ - if (phydev->drv->phy_id == QCA8081_PHY_ID) - cdt = QCA808X_CDT_ENABLE_TEST | - QCA808X_CDT_LENGTH_UNIT | - QCA808X_CDT_INTER_CHECK_DIS; - else - cdt = FIELD_PREP(AT803X_CDT_MDI_PAIR_MASK, pair) | - AT803X_CDT_ENABLE_TEST; - - return phy_write(phydev, AT803X_CDT, cdt); + return phy_write(phydev, AT803X_CDT, cdt_start); } -static int at803x_cdt_wait_for_completion(struct phy_device *phydev) +static int at803x_cdt_wait_for_completion(struct phy_device *phydev, + u32 cdt_en) { int val, ret; - u16 cdt_en; - - if (phydev->drv->phy_id == QCA8081_PHY_ID) - cdt_en = QCA808X_CDT_ENABLE_TEST; - else - cdt_en = AT803X_CDT_ENABLE_TEST; /* One test run takes about 25ms */ ret = phy_read_poll_timeout(phydev, AT803X_CDT, val, @@ -1266,11 +1251,13 @@ static int at803x_cable_test_one_pair(struct phy_device *phydev, int pair) }; int ret, val; - ret = at803x_cdt_start(phydev, pair); + val = FIELD_PREP(AT803X_CDT_MDI_PAIR_MASK, pair) | + AT803X_CDT_ENABLE_TEST; + ret = at803x_cdt_start(phydev, val); if (ret) return ret; - ret = at803x_cdt_wait_for_completion(phydev); + ret = at803x_cdt_wait_for_completion(phydev, AT803X_CDT_ENABLE_TEST); if (ret) return ret; @@ -1292,19 +1279,11 @@ static int at803x_cable_test_one_pair(struct phy_device *phydev, int pair) } static int at803x_cable_test_get_status(struct phy_device *phydev, - bool *finished) + bool *finished, unsigned long pair_mask) { - unsigned long pair_mask; int retries = 20; int pair, ret; - if (phydev->phy_id == ATH9331_PHY_ID || - phydev->phy_id == ATH8032_PHY_ID || - phydev->phy_id == QCA9561_PHY_ID) - pair_mask = 0x3; - else - pair_mask = 0xf; - *finished = false; /* According to the datasheet the CDT can be performed when @@ -1331,7 +1310,7 @@ static int at803x_cable_test_get_status(struct phy_device *phydev, return 0; } -static int at803x_cable_test_start(struct phy_device *phydev) +static void at803x_cable_test_autoneg(struct phy_device *phydev) { /* Enable auto-negotiation, but advertise no capabilities, no link * will be established. A restart of the auto-negotiation is not @@ -1339,11 +1318,11 @@ static int at803x_cable_test_start(struct phy_device *phydev) */ phy_write(phydev, MII_BMCR, BMCR_ANENABLE); phy_write(phydev, MII_ADVERTISE, ADVERTISE_CSMA); - if (phydev->phy_id != ATH9331_PHY_ID && - phydev->phy_id != ATH8032_PHY_ID && - phydev->phy_id != QCA9561_PHY_ID) - phy_write(phydev, MII_CTRL1000, 0); +} +static int at803x_cable_test_start(struct phy_device *phydev) +{ + at803x_cable_test_autoneg(phydev); /* we do all the (time consuming) work later */ return 0; } @@ -1618,6 +1597,29 @@ static int at8031_config_intr(struct phy_device *phydev) return at803x_config_intr(phydev); } +/* AR8031 and AR8035 share the same cable test get status reg */ +static int at8031_cable_test_get_status(struct phy_device *phydev, + bool *finished) +{ + return at803x_cable_test_get_status(phydev, finished, 0xf); +} + +/* AR8031 and AR8035 share the same cable test start logic */ +static int at8031_cable_test_start(struct phy_device *phydev) +{ + at803x_cable_test_autoneg(phydev); + phy_write(phydev, MII_CTRL1000, 0); + /* we do all the (time consuming) work later */ + return 0; +} + +/* AR8032, AR9331 and QCA9561 share the same cable test get status reg */ +static int at8032_cable_test_get_status(struct phy_device *phydev, + bool *finished) +{ + return at803x_cable_test_get_status(phydev, finished, 0x3); +} + static int at8035_parse_dt(struct phy_device *phydev) { struct at803x_priv *priv = phydev->priv; @@ -2041,11 +2043,14 @@ static int qca808x_cable_test_get_status(struct phy_device *phydev, bool *finish *finished = false; - ret = at803x_cdt_start(phydev, 0); + val = QCA808X_CDT_ENABLE_TEST | + QCA808X_CDT_LENGTH_UNIT | + QCA808X_CDT_INTER_CHECK_DIS; + ret = at803x_cdt_start(phydev, val); if (ret) return ret; - ret = at803x_cdt_wait_for_completion(phydev); + ret = at803x_cdt_wait_for_completion(phydev, QCA808X_CDT_ENABLE_TEST); if (ret) return ret; @@ -2143,8 +2148,8 @@ static struct phy_driver at803x_driver[] = { .handle_interrupt = at803x_handle_interrupt, .get_tunable = at803x_get_tunable, .set_tunable = at803x_set_tunable, - .cable_test_start = at803x_cable_test_start, - .cable_test_get_status = at803x_cable_test_get_status, + .cable_test_start = at8031_cable_test_start, + .cable_test_get_status = at8031_cable_test_get_status, }, { /* Qualcomm Atheros AR8030 */ .phy_id = ATH8030_PHY_ID, @@ -2181,8 +2186,8 @@ static struct phy_driver at803x_driver[] = { .handle_interrupt = at803x_handle_interrupt, .get_tunable = at803x_get_tunable, .set_tunable = at803x_set_tunable, - .cable_test_start = at803x_cable_test_start, - .cable_test_get_status = at803x_cable_test_get_status, + .cable_test_start = at8031_cable_test_start, + .cable_test_get_status = at8031_cable_test_get_status, }, { /* Qualcomm Atheros AR8032 */ PHY_ID_MATCH_EXACT(ATH8032_PHY_ID), @@ -2197,7 +2202,7 @@ static struct phy_driver at803x_driver[] = { .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .cable_test_start = at803x_cable_test_start, - .cable_test_get_status = at803x_cable_test_get_status, + .cable_test_get_status = at8032_cable_test_get_status, }, { /* ATHEROS AR9331 */ PHY_ID_MATCH_EXACT(ATH9331_PHY_ID), @@ -2210,7 +2215,7 @@ static struct phy_driver at803x_driver[] = { .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .cable_test_start = at803x_cable_test_start, - .cable_test_get_status = at803x_cable_test_get_status, + .cable_test_get_status = at8032_cable_test_get_status, .read_status = at803x_read_status, .soft_reset = genphy_soft_reset, .config_aneg = at803x_config_aneg, @@ -2226,7 +2231,7 @@ static struct phy_driver at803x_driver[] = { .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .cable_test_start = at803x_cable_test_start, - .cable_test_get_status = at803x_cable_test_get_status, + .cable_test_get_status = at8032_cable_test_get_status, .read_status = at803x_read_status, .soft_reset = genphy_soft_reset, .config_aneg = at803x_config_aneg,