From patchwork Wed Dec 6 23:57:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 174800 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4455468vqy; Wed, 6 Dec 2023 16:02:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IF6O3fvad88SCiu4vjjpz8itlCz9U8YqnAr+mdDUYnSttg4FxHV2iwFNGblgyOXZ9MjbYpk X-Received: by 2002:a05:6e02:1d81:b0:35d:5995:7994 with SMTP id h1-20020a056e021d8100b0035d59957994mr2335949ila.46.1701907346029; Wed, 06 Dec 2023 16:02:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701907345; cv=none; d=google.com; s=arc-20160816; b=cBrYwk1Zfccfu4RLC/pv9FrvVtTk9sWJaMEA7/OD69OXmw4CsFKQ2EUEihTHWdwNYq UwZNKTBDIigtNdunIMjxbGi8xuJ+IdvraKfDobWoNTol81+RCkNRogizy0F5OIH2CchD pW0O0lgzIUfhsbsfEZ2WmqEEmPbyLKnLvbvhm7NVitGe000SrVfGCAvw811douvsta7P Xmc2lrnNoE1H1YVzikR3SkzwZ4Io8jxENKaJ4+xa0k486i+lhlOPdvNwWR0TKMUIeVEL Olw8jFYjWwQM6Y2nFgx1ofqhYJyVL9MKIrJgnwqd7lN5wz5qwbclYgWICeHbT1/O5Nnp 0ckA== 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=XP8d+nS2WbKBuNDSG72Eoada8x+yfubvXoLVOEQ6ymhmJbzJnkl1SL/EZ0SAuh06sC Bz3brK3E2a4+DmDcXV5ZhtW0iYtZaynnExmim3vUblp8GAPtH9o2LO7qwGJtWlKPg/EV 13ZvppORQCcNOO9UW5Ryj85IKHSeNFQFLMHtbn91Xdjfj/sDG8eGI12Dx2THXIO0nQv0 UsRwO1cg6U4FSnQNVupLliESx6jvba3vcYrsuBJkh5Zl46GLBjxq23Gb2hFRLWGpw++/ 0hLRi259KAV0CrNSMG4eeniLqmrtipJ3h01dbirXSAVPBjpVoyAv3Oavm0Um2+42aVGs B0kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="hQC3tj/p"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ck9-20020a056a02090900b005c693ea6618si96103pgb.523.2023.12.06.16.02.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:02:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="hQC3tj/p"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 EB6FB80D6E6A; Wed, 6 Dec 2023 16:00:46 -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 S1441806AbjLGAAc (ORCPT + 99 others); Wed, 6 Dec 2023 19:00:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441882AbjLGAAO (ORCPT ); Wed, 6 Dec 2023 19:00:14 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04D7DD5A; Wed, 6 Dec 2023 16:00:18 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40c256ffdbcso3955175e9.2; Wed, 06 Dec 2023 16:00:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907216; x=1702512016; 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=hQC3tj/p0CV0CP+18+KrPYRR3wt0ZXfAirIY+Ry04RtClYu0gNx1nANlfpcWJ2UCYE mydpDvITtcsIsFIl3DTOJkZz3rYrLpGVGib+e5+sHhKNkx3s3UG++o6fDAuVnzJGC1IS qwE7XOnz6bO4RT1FGTYAgMJJmhPSSwEFAz0EYeQqis9AJSbVO77F4u6GOwfoktG0LI3E CTE6EAkFMss/djr6+BPCnZecHCvD+UjUlvmhgbJfzsWzn1huf0G+vYw69zfWDq35dqdu vWjvzPUVgJ0idNAJgZYRcm2quzTvRwI6O24aDYRIGSy5aTY4z+l+0nEzX1dtB/QX7KKe F35w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907216; x=1702512016; 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=Q5K/RAeZHQNme55DQRCpvLrDwgbQ1hOtkQ85OaBwGnF3vKSBSJ+azgMPg5BaTrB8AB I4JqtQxd8H6yrRzalhhbL7we4s04Ns39lWpSK8ezQPqZqDoqdDpleKUo8S7fKAdkJQk4 fBeHW028rNDPflAB46FI5Ja1J2w7y7O/Q4NZMTr3Tw3ZzaH8tjA3ScLFyrv5OTU6yB2/ QEaeSn02UHE2TJYR6chSU0rM22NjaqNKwTyeUzIR3WpOBNyTjOoww1T1NGcr9KBUvZAU ytQL68/7p5CZv+XxoCzLr/xzsKZCoIfrZQp14JP66o+/vahT/TpEfMxSEYmU/LgyTArB zG4g== X-Gm-Message-State: AOJu0Yy34IdSk6KG0i90kk8HWcNcSPI+ZjREa37MzxrOhTUlilZbXaLr hKsQW0slQw+f63ze9RVZ4eY= X-Received: by 2002:a05:600c:4c94:b0:40b:5e59:c55a with SMTP id g20-20020a05600c4c9400b0040b5e59c55amr1063335wmp.132.1701907216123; Wed, 06 Dec 2023 16:00:16 -0800 (PST) Received: from localhost.localdomain (host-79-26-252-6.retail.telecomitalia.it. [79.26.252.6]) by smtp.googlemail.com with ESMTPSA id je16-20020a05600c1f9000b00405442edc69sm50280wmb.14.2023.12.06.16.00.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00: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 v3 01/13] net: phy: at803x: fix passing the wrong reference for config_intr Date: Thu, 7 Dec 2023 00:57:16 +0100 Message-Id: <20231206235728.6985-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231206235728.6985-1-ansuelsmth@gmail.com> References: <20231206235728.6985-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_BLOCKED,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]); Wed, 06 Dec 2023 16:00:47 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784579197341130628 X-GMAIL-MSGID: 1784579197341130628 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 Wed Dec 6 23:57:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 174784 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4454345vqy; Wed, 6 Dec 2023 16:00:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IFf2xmlHM4OFDPo/K+75O6yTrwVAQj2KSF6ZT4CT6k3Bm11xsLyHJyQ6CgBKoqQUdE4DGzz X-Received: by 2002:a05:6871:d108:b0:1fb:1620:9d0e with SMTP id pi8-20020a056871d10800b001fb16209d0emr1719813oac.108.1701907248993; Wed, 06 Dec 2023 16:00:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701907248; cv=none; d=google.com; s=arc-20160816; b=th2FSLytOhZUuH8P+mAfnWqnSMGucX1xkN06wKNKTNF7xZzSg7OHuKYrYqV0T4jQn4 gYl+Yi0MbePDUg0syulRgWP5+CzzpdMhglyDpqC//byksCGRyxW93WQvAvmU24xfzkNr rBvUj1h6tom1rVOU3Xu0KzQMlEcc/V+aZ0LsELQZ/qAFR7mhdM/tQGtLvXd1/eU70c8D T/xYVbZ1ZpxkaUxA7hcZK4F/I4OWEUA8CxepADyou+s0ZZYehG3zEfR3MhPrk3BWjNPs VsGhIcbhGRiX3dHHgu+Y75SVf7SYYt+rHUyqB7puqOAI017H0TwLnSXeqv0Vz7rP6d5q b1lA== 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=Ry9/OcH5p4w9QNEkHN6mJ+DUe89PzwuGd5SiP435vxk=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=x+wiJJSwfnCv5qlQWrNQoS7RcmNdqEkcjyZPgNkbV9T1Ufp9tgHDka87jeTO64MGbN QOWYkg1QarnxlPor8nJwSitaPQr/GT2T714XcJLNt/2QJeD/6/WRufWwmINlNt0PDDSc YxMfm2fkBx/Txe/d/4lL6TD0LuZ319aon/L6Y+VXaWWRcNgkkpxnoUTvOyritEBWTsIJ DumdsDPXIXQGdDW673gSPuL3d0lgvTqrn09qoWmfKomqz/wnuu0Kh8rvDVibctdD0JxV Y5GGHK6ZoTyIbpVO0E2Q3j+FKL6adBjUT8WCr9X9xJTGdnxqDwi0Jo3ni1rKbjh8xNVg tHlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=h3ETGmDy; 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 x13-20020a63cc0d000000b005c69bfbde6dsi117421pgf.202.2023.12.06.16.00.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:48 -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=h3ETGmDy; 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 34D4B8078E3F; Wed, 6 Dec 2023 16:00:45 -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 S1441931AbjLGAAf (ORCPT + 99 others); Wed, 6 Dec 2023 19:00:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441887AbjLGAAO (ORCPT ); Wed, 6 Dec 2023 19:00:14 -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 4B95BD68; Wed, 6 Dec 2023 16:00:19 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40c2718a768so3802305e9.0; Wed, 06 Dec 2023 16:00:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907218; x=1702512018; 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=Ry9/OcH5p4w9QNEkHN6mJ+DUe89PzwuGd5SiP435vxk=; b=h3ETGmDyxfUwxk5YuR3+UGL2MPxUwBtznM/dF5GOD8RYC/+JopiWr/ICZsvoRrhpQG oevjoeoP24IV9m88vMsch0yGicwbLPztDolXKfWkRg+nyA9oDtYWEiYabXv8/mOQ6+qv ukfm15IwFPop/9fwMU7TM+Sz0YDRHXBMDggfLBWjdYKdMlyOadmal4HfZ/64ofi3LS7T Hbsp2HMoXRthORfDIIGSfbW9chmf2b0OcbBWTsA326vxzwrc+N2+LdBR4vUw/tHTFFR7 qhoLC6qjZmOIIGOHjet+JjZmWSGSULLzqVlBGDc6M2WijFG8t6osKhTBFAHOWK9HNMCo pw/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907218; x=1702512018; 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=Ry9/OcH5p4w9QNEkHN6mJ+DUe89PzwuGd5SiP435vxk=; b=S+rBLWpR5bDI+BunnDAYE17fNNJJ9nTkozsNWo3w7QwN3wBoTDZh5kiG1vDXWsgZjz q0xs1nrggqsikiuNVphepSsQQ8w7+RAqADOCKpP//PRVHtnpIDBzyj+JZ3nIv0kBG06J p5TmSscJx9ZDYzIJIfFQau1pmCAAtPptUO2WFG2JdqweN8SFsT4UyIeJIQXIuBrVPA2K bwpDaugJO75xS431rO2MY6sssFfO0YS/1jCyvC0zdLRF6Z/qThkI+cmMdXamNo+u5xaI FK7qgfhEW+rpBvePxT7LzB4vyIoUAalnSLV2AYlHRrhzjaDzJDr1JmfUNHBJxP67qcfP uQ5Q== X-Gm-Message-State: AOJu0YyoI2XvRpSZtnaxIJLBWWTbl8AhKh3xufJT6kokfUViMUcZvcaj Sl9XaKo21dt3R+eNZ0HWsbc= X-Received: by 2002:a7b:cbc6:0:b0:40b:5e22:98e with SMTP id n6-20020a7bcbc6000000b0040b5e22098emr1216967wmi.125.1701907217409; Wed, 06 Dec 2023 16:00:17 -0800 (PST) Received: from localhost.localdomain (host-79-26-252-6.retail.telecomitalia.it. [79.26.252.6]) by smtp.googlemail.com with ESMTPSA id je16-20020a05600c1f9000b00405442edc69sm50280wmb.14.2023.12.06.16.00.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00: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 v3 02/13] net: phy: at803x: move disable WOL to specific at8031 probe Date: Thu, 7 Dec 2023 00:57:17 +0100 Message-Id: <20231206235728.6985-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231206235728.6985-1-ansuelsmth@gmail.com> References: <20231206235728.6985-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=ham 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]); Wed, 06 Dec 2023 16:00:45 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784579095350432499 X-GMAIL-MSGID: 1784579095350432499 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 | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index ef203b0807e5..85302d96d133 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,24 @@ 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 + */ + 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; @@ -2092,7 +2101,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 Wed Dec 6 23:57:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 174786 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4454555vqy; Wed, 6 Dec 2023 16:01:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IERjlpM64Fha30qTd/P2C4hO+L1owa9uzuItQiqeMZ6GMlkdyWwG+ANfF2NcvGaZhD47jdh X-Received: by 2002:a05:6a00:338a:b0:6ce:2732:58a with SMTP id cm10-20020a056a00338a00b006ce2732058amr2537067pfb.59.1701907268379; Wed, 06 Dec 2023 16:01:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701907268; cv=none; d=google.com; s=arc-20160816; b=qJtx51S5N3Y6YUz1K0YKLLf+lGIzTVoIdxDe+m5NBLrqDhtU96hnKGz1sj1k3aEY4a b1BFWRSm6XQQEOfTxdEttcrRhcg16anuVU1eQIb1sMb49Q5BfPA9MscE74cSdALTcxdK SJgFHputFHItvdkQCf343PovfMq7VTIkK8meBxTb68KsANL4U1esMjxJnXEWKio6x5uj E78XxLoB5XDCKrZtIxj/CzTBqyVhHpJKTiEOJIssZrxu3Ys4NrqCByc7P8kX9mPy0jG5 BpfUqmg+H86uST7iY+S0Z7+YQNKn57LdIbNAoCAN+zEVeDxNqw89cLHnbtUaJfwX2/fx gFsA== 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=YrcJkPIDuZzmYGZsrVgKVn9yf3oQKZHA4PrUxB3CbJA=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=qog6bfyf+0DI+QTLHLK3BD2Q2JxP2EbHSdU7CbUoPgvpuvUHJT3ln/uVoetxOXT16p W7aRwwTSdWzWmLiCPjcgccC9KZ2WamToYtq95CyE2C3jnXzANcNz+/j8GtrJK1dojCch T25w2+rvGVrgDAM/mBTwkn+5rk9GhAYnhgZvO6g5Oap7Zcpnjexgm0DAXYwWMwYqPACv ox7VesRD5OcL95GbKIjr0g//GzNNQdE660zntaEa5SCpjVj0BCswDrfrtjrUfEWoeFW4 pt4nI58upjXUvCHGKs9jXFTONWggtP3jruyZYlHBEYzzYG6P1ZIZsVk7NqkGR6SKuiSL payA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZUq2wWfa; 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 cw28-20020a056a00451c00b006cd8567235bsi148482pfb.237.2023.12.06.16.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:01:08 -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=ZUq2wWfa; 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 CCE1081F3214; Wed, 6 Dec 2023 16:01:04 -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 S1441921AbjLGAAi (ORCPT + 99 others); Wed, 6 Dec 2023 19:00:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441889AbjLGAAP (ORCPT ); Wed, 6 Dec 2023 19:00:15 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 698E1D6F; Wed, 6 Dec 2023 16:00:20 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40c1e3ea2f2so3785545e9.2; Wed, 06 Dec 2023 16:00:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907219; x=1702512019; 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=YrcJkPIDuZzmYGZsrVgKVn9yf3oQKZHA4PrUxB3CbJA=; b=ZUq2wWfavQeOa3p2ucQUTBLy4NGT+EIeT1gH4obYjgJrH61pbxefgbfgiqclyG1OEy L0H2R9CobnQD6JsqnMhUCdzoEHloBg81Il+Tmb5vm3irNlEcBaGFdC87LwgysYcIBA29 WJ/rFPbdNZajEGaDKowjdP0uGul2kwK4hdxbwc8l7x2Y8Vl+NvK42B1D1rRcLgR1svNP 7YGaWw46YXFRNPl3bnnNuN5awzcjufT5HNg2Al1z/G/uCFdXAxE4d6ypFJT3LmN/LbiX Wj+bHhBuaONrRvp8OtEiULDALclmU90bIGj0hWHYDgz8POqOWIlxEh19EuOwTob3lDTc /h0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907219; x=1702512019; 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=YrcJkPIDuZzmYGZsrVgKVn9yf3oQKZHA4PrUxB3CbJA=; b=rKGBBkEl0DCS3J/EFnjFnnzysrkux+FuNruwpINj5p+nR2cYnAfuPWY41iNiYamisN S3hVfp9W4qMBPVomlIkALXG/zCckD+QOi9pS3cDFmMJMBlPVnWMn9XCdh9D9e4lcu2Cr AOlAuUFJfLrbx4MMpMhFs0b7UwGSOnFQ94Uv94ZuvHDbYEqsGXVQgR3HZnUHB31J8SWP 0IURyzjljznIMN4JbioC8cw/3cO4R1CV1DLGBldBBBtmAHfjL0SXTD3CkW1DMonQipjb yZRi1U5iRm74XRMq+sSMkkzlNYJUZsw62UhABPmai6rUrMieCJsgOpSBMdoanlqfyR38 Vi2g== X-Gm-Message-State: AOJu0YzAcfYXeZgjFonaUMMBjmEFdR6QQxBIG6+HMBHNBvWMu0Xfn94v 8Tk0EbW+cAfeq1wT5RAYW/s= X-Received: by 2002:a7b:cb95:0:b0:40c:1855:1c27 with SMTP id m21-20020a7bcb95000000b0040c18551c27mr999316wmi.103.1701907218720; Wed, 06 Dec 2023 16:00:18 -0800 (PST) Received: from localhost.localdomain (host-79-26-252-6.retail.telecomitalia.it. [79.26.252.6]) by smtp.googlemail.com with ESMTPSA id je16-20020a05600c1f9000b00405442edc69sm50280wmb.14.2023.12.06.16.00.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00: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 v3 03/13] net: phy: at803x: raname hw_stats functions to qca83xx specific name Date: Thu, 7 Dec 2023 00:57:18 +0100 Message-Id: <20231206235728.6985-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231206235728.6985-1-ansuelsmth@gmail.com> References: <20231206235728.6985-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]); Wed, 06 Dec 2023 16:01:05 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784579115569037497 X-GMAIL-MSGID: 1784579115569037497 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 85302d96d133..b1ea52ba3f07 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) @@ -2177,9 +2177,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, }, { @@ -2193,9 +2193,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, }, { @@ -2209,9 +2209,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 Wed Dec 6 23:57:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 174788 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4454604vqy; Wed, 6 Dec 2023 16:01:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvDSYYW70FcurdFP4a04IudLyrPTbrF9HWoPmW1PRWOviSL/cGGwtrCwvYt5BhyqNFw2rt X-Received: by 2002:a05:6a20:a123:b0:18f:97c:8a14 with SMTP id q35-20020a056a20a12300b0018f097c8a14mr2108155pzk.63.1701907272737; Wed, 06 Dec 2023 16:01:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701907272; cv=none; d=google.com; s=arc-20160816; b=oKnQmULhn+oIdySyTJ3dtaDSl8cPip/a6mnVvo43mMOOW4BFpLmgxRNeQFwAK/sh70 GHvU112FvdFQdOEKAgi4PPZKVKWNCAZaYK0Mt4cwoPeHM+MuZIxoOYbc2S6kGCtEiDm1 Zxm8apWhaxfrb0Go95YDbQTpyjImTJM6dEUHlQbUNHQXtbbR8JVPAM+EiSTB7+x7S6WH XuV9QnHzCmImsYzDOcvxOaADWWp4Wc46nF7aj/umPPCPBBF8q1XTUe/7P0kgwFf76W7O e8td3zUY2pDXAbaPT/Qd51eLUFKUsWwH7C+m8S86okx3Lg3J/ny1DxYBp1doO7DMEU53 H0Qw== 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=5CMZETdDgYu5hG2aMQ54/zJsbch0uzjPkjbZMzkqZ7k=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=GrQlkVy8C7vaBPc7r4H+lC7OX1KggRAkrKcjpYDZ7vjBoog6yJeqn4Ex+HXpvwgkz5 nvDvF3yICXCMHVbdkg7ROuL2FqzoLpiTM1R+4Uxh7qnha+/bfM0pwOWBHUDojb3L+BQd NoYAyxHuZynDMKctMEo9pTidfZj4u3mPQuO7ftT0xrRMtuD/ht34g+ZJtmOj6ZrOsZJv +3gBJo1djPVmI14RyUHieq70Ng6lHM9D/ddRm6IUwFwHpL3SAch01FwZWGvhXJALOGg0 pelLfGpNhKU+CoNGF4go13HtLoZIUQLLIHgeiK06Aalx5KW4PAnaWiVKonXAdtYjPe9U r44Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=l256Hu76; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id w67-20020a636246000000b005c66e00ffccsi98423pgb.260.2023.12.06.16.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:01:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=l256Hu76; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id BAFA280AE50D; Wed, 6 Dec 2023 16:01:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442958AbjLGAAn (ORCPT + 99 others); Wed, 6 Dec 2023 19:00:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441896AbjLGAAR (ORCPT ); Wed, 6 Dec 2023 19:00:17 -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 D03F319E; Wed, 6 Dec 2023 16:00:21 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40c2308faedso4060085e9.1; Wed, 06 Dec 2023 16:00:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907220; x=1702512020; 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=5CMZETdDgYu5hG2aMQ54/zJsbch0uzjPkjbZMzkqZ7k=; b=l256Hu769S3aPPSPv7+NabZ/IhJNxgTGjqN9tXHJxghBS/AIFrx9kUzlWfN4iyj1kS DvGlAZdYl9S8vYpAXDQ7bGbVIGK2jgq+NYp5wgIFn5k81cPnUb2vVEprEwdswWECCSBZ AZYxLiSmOPLEBEGdUsW+12ht5LdQYYUsIvfGJDJJ2y0Q4Elw8LKTG1ozY8/tlVIL/Akz iWKcmYLzAy+ialczS1kbcZLVnVNltgsHR2iu+0NaTV7dX89oZGKb/VBg1qGxOQG8cAuO BRJ/s8SYjMLGCMkjjLQQNAXuWgip0o+h/SPgJrJJ+HUWaWcLU7i8qnqBZxKJ/ZfJz3bG QSXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907220; x=1702512020; 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=5CMZETdDgYu5hG2aMQ54/zJsbch0uzjPkjbZMzkqZ7k=; b=qmlJu9UXuED0IZ/WN/RSTD7T1vc4uBR9YOMV52/SXV1eqCRztprVseyCcASilLwOWP Lio/4j4vqw1sWwqkU7Q+ykA8oHGTBICqoXQ2+j3bZ02+eRVKSC8xWpMMdNgejhz57evX mGzaDo6CN406whHtyzW4jF9NDJxcaTEbXA8MU+SiX00WHbaJ4dVxY6ptYXE7TeDwkJcU NdoFXxkjzjwusrjeVp83BCXWWBfMytnmaqBlLT02MfGm6UQWPhi79tHSfq8YfoBoyG3z o2D2Ykb811Qetau0XUqEsRasOaWalinPgodXKIjw43nD01ld8Xc4jp32mA70MWrihpO5 lKNQ== X-Gm-Message-State: AOJu0Ywm/G2Tl5pXAeoWiFIMuzUpdsiHHOHHtEYbs1W+FX/bA9ftitOj +S8gMNlgHZLS2X7E+ESDntA= X-Received: by 2002:a05:600c:cb:b0:40b:5e59:c58a with SMTP id u11-20020a05600c00cb00b0040b5e59c58amr1017932wmm.180.1701907219993; Wed, 06 Dec 2023 16:00:19 -0800 (PST) Received: from localhost.localdomain (host-79-26-252-6.retail.telecomitalia.it. [79.26.252.6]) by smtp.googlemail.com with ESMTPSA id je16-20020a05600c1f9000b00405442edc69sm50280wmb.14.2023.12.06.16.00.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00: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 v3 04/13] net: phy: at803x: move qca83xx specific check in dedicated functions Date: Thu, 7 Dec 2023 00:57:19 +0100 Message-Id: <20231206235728.6985-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231206235728.6985-1-ansuelsmth@gmail.com> References: <20231206235728.6985-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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Wed, 06 Dec 2023 16:01:00 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784579120669435719 X-GMAIL-MSGID: 1784579120669435719 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 b1ea52ba3f07..779e0835fa5d 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -1625,27 +1625,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) @@ -1688,19 +1687,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); @@ -1711,6 +1697,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; @@ -2172,7 +2179,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, @@ -2180,7 +2186,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 */ @@ -2191,12 +2197,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 */ @@ -2207,12 +2213,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 Wed Dec 6 23:57:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 174801 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4455550vqy; Wed, 6 Dec 2023 16:02:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFpmlURC6YTPjSLng2t6iDgGjVPciknDSp3WM3cDo2Fv3wgjyGYDcuBVDuQqmmq4y4BeXf5 X-Received: by 2002:a05:6a21:3299:b0:18f:ce60:ceeb with SMTP id yt25-20020a056a21329900b0018fce60ceebmr2577264pzb.23.1701907352039; Wed, 06 Dec 2023 16:02:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701907352; cv=none; d=google.com; s=arc-20160816; b=hDpUnD67Akgna4+9sSCsYd7b61zLpUlL1qjzeAkb1doLNCeM9qJNlgJncfmolJGQv/ pt/k/kr1VvTb5QDuAu4CErTOCGYcROv+mLtypF6PnLkiKhDjCxNjHIdpYyA5FzDANzou i80CdlegNun6BQJjEY5AN7ymlGD9EoSaZrsI6CHbek1bgyaZ/SdRSxUzjZxptnM6A0WJ RJhsZ0q4AC0jQ8IPmPBxxJIOszO9YqHQnpDQkyK5n716Wn/w1U71FMqjBY3BjwpfL9cG 27aX6JelPUBiogRm9UGT+S5B4zomZkgGORysqH3fGzieP39NQSmi5a75ivYhJm7JECg2 VQDw== 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=7z3Xda0RnvaE2hW0I0S04OmD8rJgdjIJIqIdkvOJgVw=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=mYUAIXMtZqu6uOVr8KqB67e6cJq7rZcVRpjU/759SekCZD8ykupfgAF03O46CDP0U9 Ijr9apJVYiGw2WPI7LIcbAkzhk4PJBAkWhCDvRz/QHCw343HtW/Rr4Cv/JEiTVuzn+F9 sraN1oFsAZ4OnnhCNB5wcCK4kvoQJ86Y9d17bNCadA5EznxJ9UM4P3Y3iIh8x9C+WwDU Cr0f3yS7PLHr1F+xW7hJL0OyxXQKrK3LQtc1KDG82nH6Op+9dLIHQK6rthvWE/SKtbNn nofGimNEoi0mRXhhJHU09Lj9nYm2ua/fHT2T1H6YbaZUXtz3fHdR3jgC4K5hV0LINN+B ZfGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LGIu+u4L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id h31-20020a63f91f000000b0059cc8d682dfsi99340pgi.814.2023.12.06.16.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:02:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LGIu+u4L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 3B6CF80D7E4D; Wed, 6 Dec 2023 16:01:08 -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 S231557AbjLGAAq (ORCPT + 99 others); Wed, 6 Dec 2023 19:00:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441899AbjLGAAS (ORCPT ); Wed, 6 Dec 2023 19:00:18 -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 DB831D44; Wed, 6 Dec 2023 16:00:22 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40c19467a63so4251385e9.3; Wed, 06 Dec 2023 16:00:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907221; x=1702512021; 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=7z3Xda0RnvaE2hW0I0S04OmD8rJgdjIJIqIdkvOJgVw=; b=LGIu+u4L6kkzX+UonEB482yBXGJyLkqQGE7twT9R0+TCNNeBKMSZrLstviiAcO14Y2 lDU/7++jreiUHeHrShcTxzuslViACKBOOky9VblNKlrgffMZtB0qs+Bh7g0Iv2ZT2ioP d2ULVUdgpu0pqt3f/TE9IJe5Fd2RLhje4grS62Qz2djNZfUgKlUincg4xjcMTc+/kuXM LrPZl7ijGniCUI2E3mPGKhFHei/NT+yWvIaEB86RmEcPqrXl5o6yqYYp9r29vM6MetgS Klu5YGURde8Wt30LibL14yowv9USc8PzVKHS1sUMECJh4bgen9Ow0xkz6dDdldOcPBpz 1yxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907221; x=1702512021; 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=7z3Xda0RnvaE2hW0I0S04OmD8rJgdjIJIqIdkvOJgVw=; b=eiJrtzV5kUtzezh6/DeTYXKa8VrhKuitDp4I6LrlWVsZ2BLnTRUF9QVVVt8Xrqi5ks QICkMc1Pz2Zw/XrHIDVkRz3AjyRFiro5/KFOB7G4Paht73EpQ52h6CpRQPWvoKhP1NhA IVRl53P45MLkxZiEtWe07NE9+3O1fRyvpHylnm0tWmy0hzR9HYeaeezQ4FwuPOJykaXu mk8U95i3a26mX1ZxErUWjrIZ92KiIVfx69TZ6o9/XzT+Y/gsbKqhwBnwuV+m/fMjFnJe bfC+otMeV2RlfPhQJhnqqDM7LQH8iTqMCDNAUoe0bmf5nbjwPOUBm73fynQ2APWdIUD4 EP/w== X-Gm-Message-State: AOJu0YwrbBrIVm7Ecgbk0F+2JcHBTSBRot0iFHv1UE5spEZ3Ukr3x0eO 0zUnVK2tCstJBWQ5Hs8Pk/s= X-Received: by 2002:a05:600c:444e:b0:40b:5e21:ec13 with SMTP id v14-20020a05600c444e00b0040b5e21ec13mr1037512wmn.69.1701907221286; Wed, 06 Dec 2023 16:00:21 -0800 (PST) Received: from localhost.localdomain (host-79-26-252-6.retail.telecomitalia.it. [79.26.252.6]) by smtp.googlemail.com with ESMTPSA id je16-20020a05600c1f9000b00405442edc69sm50280wmb.14.2023.12.06.16.00.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:21 -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 v3 05/13] net: phy: at803x: move specific DT option for at8031 to specific probe Date: Thu, 7 Dec 2023 00:57:20 +0100 Message-Id: <20231206235728.6985-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231206235728.6985-1-ansuelsmth@gmail.com> References: <20231206235728.6985-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_BLOCKED,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]); Wed, 06 Dec 2023 16:01:08 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784579203476988862 X-GMAIL-MSGID: 1784579203476988862 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 779e0835fa5d..e507bf2c9bdd 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 Wed Dec 6 23:57:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 174789 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4454608vqy; Wed, 6 Dec 2023 16:01:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFBuedZlkfND2IXokir+mtfOVhgV9nXK4lfHstNUeVIvMlELAnrs5jFfNZ3rWSDyXowTpxN X-Received: by 2002:a05:6a20:1455:b0:187:b2a7:c6cd with SMTP id a21-20020a056a20145500b00187b2a7c6cdmr1748310pzi.57.1701907272932; Wed, 06 Dec 2023 16:01:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701907272; cv=none; d=google.com; s=arc-20160816; b=loh2GRv7Z7mIOgX2OSH6ku4AzGNo/WonX77MHZx0x4o9DZoTlV7LZYdz/yOCxTE+Ba MUdM4lP3G3w1GMdPcNVVj3suW5gud9r+xe6k4lxXYr4HZGKjVfYMbcvoybHw6CLmznP6 Ntp/h3UcI6vriy7JPW1SBdSuBBvmFK9+EKGoiII7TOBdPt1D8fEbp+dNTcKDnNNrArWh WS9Ab3OK8kOkEob9GocjGrHmBVVkNSN8OsXoKefSYLWzzql6qHvZEch0eFrSzDbqIpOg PLm/kqQ9jLVv5peBAnqO6NhuBamVoXwLIqAzCgxBrIDRrhPvp+gupMQTID2E824DnGXL vNdA== 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=9VxI3+LUEvRyW0jRbv9Ny2+Yv44I4YEi8/tstLSQ5Is=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=Eo0qtZjeyGjen7P+oOwy8wJo1K15JDzvkHXeDy+10tHsc2qomG+iQJTlaDg4gVHrvW gYZoaCSBd9uealb789IdJXRA3R9gcLXD5AEDW7a+j3DJ3fm91U5AAqULKieqys1jSF3y RjHeL62o79gQF+51UVxeNTi2KXhfpSv80T1RjS1i2VGsW3QmJaOl+DjACNdKJ81SLX0e DwLHJl5pMEtnn7HOnyrJZJNQ8zwbZvPEKrY5pmQjLs9acexu9Dvex32vsj07mDaa59XW iPVXJwl8C3Ph+RwxdVKzDC92J2be3jI2i10Vnjt+V3rs+CKFhTEk28lusqOkNcpdX6UO 32tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=H3djEn6w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id ne22-20020a17090b375600b0028876b8b056si29130pjb.118.2023.12.06.16.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:01:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=H3djEn6w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 1E6EF8024CC0; Wed, 6 Dec 2023 16:01:09 -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 S1441861AbjLGAAw (ORCPT + 99 others); Wed, 6 Dec 2023 19:00:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441902AbjLGAAT (ORCPT ); Wed, 6 Dec 2023 19:00:19 -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 627F4D72; Wed, 6 Dec 2023 16:00:24 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40c2718a768so3803185e9.0; Wed, 06 Dec 2023 16:00:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907223; x=1702512023; 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=9VxI3+LUEvRyW0jRbv9Ny2+Yv44I4YEi8/tstLSQ5Is=; b=H3djEn6wj8VvIEQXAkV6/zID4wz3v9QW0YhJY2WMO+uwKiNxbglDpA2ZTQME+W09G2 EZyXHukeVD+0N+FsmqkHbGnCeA9LKizVyDMEly+GweYfs18CV1ucDE+GaQsYjT+GKBKH eRtM8POZJsyM0wk3IWm8oZ+fAF9ds7xFkDu5FCW6rLh6Mn6u4O3sNbGf3mGOoWegjxaA ghqop/41iqYOy3LSLdjnSh3yawT5LazBrDG6GadmMwgsk1ku3Bvr98EXSd/RD3vsKxex 1Rx364V/ij0/usqtRLRjz3ev17CRUik0yxKQsUhUcL4l+YeZA0fkiKdsw7wB0/TCwepn oLpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907223; x=1702512023; 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=9VxI3+LUEvRyW0jRbv9Ny2+Yv44I4YEi8/tstLSQ5Is=; b=qCQpzYTAKn5SI7wJjIqN94JF7rWalSU2eQor7dIjq6p5XOjzFM4yksNBjG6XRSD1wT AN1FRUzj4LHIGqAQooSPyttfe8d0h2CixixktWZyZQx6eMF+9fd9r6QABCt7KXox+myl DMIps0Yr7eP3EGscgXrUwqD2dWG0BxhVIZspgfHvRdmUuHtm/ntHeh8R/XuVc0xDvaxW PPHazAEM1vDUHJ0dhF0qIi1LspNSYnV6Jf28Mf/aIlZA77t7cTg8yIv/DuWtOuNCC/Yh B2kkxRUoW24VAB0/av6yKW6/Zk6IDoKbnMDGMQvKNqgcbhJ47llpqa1KxXX70viVbcF9 Bnsw== X-Gm-Message-State: AOJu0YwdBufJ3O4MCRiWQn/Y07Djl/OV12PMGFe1BgwiPVIVDWyIo2D3 UXA1A8FBBleVY8XRFNUUP7Q= X-Received: by 2002:a05:600c:35d1:b0:40b:5e22:956 with SMTP id r17-20020a05600c35d100b0040b5e220956mr1185988wmq.69.1701907222670; Wed, 06 Dec 2023 16:00:22 -0800 (PST) Received: from localhost.localdomain (host-79-26-252-6.retail.telecomitalia.it. [79.26.252.6]) by smtp.googlemail.com with ESMTPSA id je16-20020a05600c1f9000b00405442edc69sm50280wmb.14.2023.12.06.16.00.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:22 -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 v3 06/13] net: phy: at803x: move specific at8031 probe mode check to dedicated probe Date: Thu, 7 Dec 2023 00:57:21 +0100 Message-Id: <20231206235728.6985-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231206235728.6985-1-ansuelsmth@gmail.com> References: <20231206235728.6985-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]); Wed, 06 Dec 2023 16:01:09 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784579120651398629 X-GMAIL-MSGID: 1784579120651398629 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 e507bf2c9bdd..ed3be7ed5463 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 Wed Dec 6 23:57:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 174795 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4455162vqy; Wed, 6 Dec 2023 16:02:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IErFs7ZTCKg6fWST6WHnkEWspRH2eZm6akRRDpJH2Ld6SNXZawEZAEockEbuaQGhYv4Gq8G X-Received: by 2002:a17:902:f68e:b0:1d0:8f0d:b6e4 with SMTP id l14-20020a170902f68e00b001d08f0db6e4mr1399461plg.111.1701907320411; Wed, 06 Dec 2023 16:02:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701907320; cv=none; d=google.com; s=arc-20160816; b=q25SLQd9PfOBcZejyQUEviRqgOheCagyJsNSfs2/yzyZn96nkkWU7+slFRrLSoC5q4 +9Zu88ET1JeJjPOBMU81ODgqDsXh8XpwdcC/tjrbyP6PTYWrR43QtbsH7z0xdjdd36pI gdRfunKW8y+3ijO47ANEhsOCduFlAvylyhOTH4z7/dyt2k3b1mc/K+ZpS/V4ZvxIvWGe Z7cMku9hAQf8eQiNdpN5yG0whtXO4Ovz+Wl888skGF/E+0aNQBAtPpQotl2x07jFla1J PXwwobM5/3SFrzPRTzaKNfeN23/X9DKQAylwJj2J9JGsmZhbhPw++zVm8SbQLNOaZV32 lYBQ== 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=GUKJ3W+rMNjz35Sa6zupf98XVAv1Y8sQonmYjlaTAA4=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=MwRCOHKTT7rv4pBt5TENkMYwszLaWNoOqW+FUpOShEcW/Z+vMg1kb9jOfoWmbuPcdE NXoeBOy4AN4T0DmOVdd1gjvLFNXMKSRHf4Pg0U42j4PGkVHmFkNWrziBPP+Xh5UwmEji 4+WlNKbd4ERuIVUhdZLRVKnzt7C9a9M9udDbiiRWkM17VuVUQAbU2GfpCJ3dAuO7pU+7 QBwrZk7bMl1E7jwOKhe/E/pPPr93FA7naFLtWpeIGaS+4T/Hnhg5IIhpoFHYO7btJHNN P0E6Q6ajHPwAOzek3gxXMK1kzCfSv/+zuniYz2HAdAzDkSLeg1x0hGiZT8URAUu5AoZA nBJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hrcoXchF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id t6-20020a170902e84600b001cfde84f92esi65801plg.82.2023.12.06.16.01.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:02:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hrcoXchF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 F0C408025779; Wed, 6 Dec 2023 16:01:50 -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 S1441899AbjLGAA5 (ORCPT + 99 others); Wed, 6 Dec 2023 19:00:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441907AbjLGAAU (ORCPT ); Wed, 6 Dec 2023 19:00:20 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A040D7D; Wed, 6 Dec 2023 16:00:26 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40c09d0b045so4634715e9.0; Wed, 06 Dec 2023 16:00:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907224; x=1702512024; 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=GUKJ3W+rMNjz35Sa6zupf98XVAv1Y8sQonmYjlaTAA4=; b=hrcoXchFoSHDYwlCGgwosP9ICXBlpqE/4bHSv240xdP2uyHHrSNzhDzSdf1OhDDCDu gZ9VXqaysxf3Ms6tdibaDOmHQh97dCbSn0YkVzGUUFQ8pfmaI1hNaeqi/uOhiIWBg/IJ WIPED+4pEekYhbtd/Hffg7sAnA1ntesjYoenLeNc4mTl7JMMa27a1QxbLIOCwSPElAHO bUIIu9L4+wiyWJq+MR+cQNUuiqHXKupv2NXtKeiWll/C+5ZSf0vaFgTK0p2SK09+iKGx HrSST+k0hUUmHN57fRhvOvDnglm6hmGAE83D5uTdBooWR5MizQdoVLst3MTRfv+69o1B a5UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907224; x=1702512024; 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=GUKJ3W+rMNjz35Sa6zupf98XVAv1Y8sQonmYjlaTAA4=; b=dWa6ttRMYTO66uODV7sMuo5DzEsbsu1b9+6InczU3/k6FNjPHq9WyhaIskH3VPlM83 fP2toOFTrRWnCL7832kYLPJTHvnJYSu7qJeGaauwmLO4VR+zQ8a7H+TE3KLDghhcf+rv T12peUBW7QVDCRHNTDdwbkGddjT1R7SMQqYMU+A9FpLBmBzKhhSwitk6cuGlMByrB75F FVSKLdtqrQKo/PzSYDp2Yzp8omskl0eSK50eRVYB+FQl8JSaQYd1Eu1OuEQ+woCKPNmB iffynLtIe3i3rgnRP5dxuShHQgPix30m+Ioc4zfKLzv0ujia+BWdeR69hNL/BhCiP9mF h4Cw== X-Gm-Message-State: AOJu0YxsJIcAz5C8PKBVoTxqXPzpe/MAbDs3p3eqoDCkhKF0CQVCfI8t 4K7vuJqv0z/sWLpgyQQM2H4= X-Received: by 2002:a1c:720c:0:b0:40c:25c1:3c02 with SMTP id n12-20020a1c720c000000b0040c25c13c02mr325178wmc.159.1701907224273; Wed, 06 Dec 2023 16:00:24 -0800 (PST) Received: from localhost.localdomain (host-79-26-252-6.retail.telecomitalia.it. [79.26.252.6]) by smtp.googlemail.com with ESMTPSA id je16-20020a05600c1f9000b00405442edc69sm50280wmb.14.2023.12.06.16.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:23 -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 v3 07/13] net: phy: at803x: move specific at8031 config_init to dedicated function Date: Thu, 7 Dec 2023 00:57:22 +0100 Message-Id: <20231206235728.6985-8-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231206235728.6985-1-ansuelsmth@gmail.com> References: <20231206235728.6985-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]); Wed, 06 Dec 2023 16:01:51 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784579170752518900 X-GMAIL-MSGID: 1784579170752518900 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 ed3be7ed5463..02ac71f98466 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 @@ -1606,6 +1587,30 @@ static int at8031_probe(struct phy_device *phydev) return ret; } +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; @@ -2115,7 +2120,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 Wed Dec 6 23:57:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 174790 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4454807vqy; Wed, 6 Dec 2023 16:01:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+kLZDCdSlV/ubGtf9iM8l9n4wiEn3lOwUuvjArbBfwHx56ra07U/kuiHwXbzsm1jVR1yi X-Received: by 2002:a05:6a20:4308:b0:18a:d7a8:5e5e with SMTP id h8-20020a056a20430800b0018ad7a85e5emr1434953pzk.41.1701907289451; Wed, 06 Dec 2023 16:01:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701907289; cv=none; d=google.com; s=arc-20160816; b=0AETTkcejRlja5ZHJxUaVIzYFp8KzHUkty05ZE73Q43ImJ31HPxaDh1fJ6xvHjSeNu lbBpcbS2Cve4MGAjw4xmkjRhw7dYj5S0zTUwpjij28whacgKO29zlVjv/xhRjvDEmlyU mUaHLqzZTCWfKrFCpuSVmJh5nD2eFNIY/XoU76GFBoXaat3ch48bS4YWe5qoSTVjGuou 3OvTL5RAcJ3Ls7z3fRFthlB7dN+8NsiUD3dBi18w8j7KyMkdbYm65Ko6avmZE0a26WqZ DT1OT+bYIwBjWEkpfdP8RUT4urWJMCgN5zqos2sYLINT0rM+V6AMUTpZgcvrNTCap9aT vMtg== 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=Lg7qa9kgNv3JPVirMlKzkE9ZBdZKAWAeOTAv7Yn8WPU=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=L3/vye82ktB1mOHoH2SdHocGho5VIgSWgzdd366rS7mLk+f//Mw7uI68JpjwsauzOj ifO00JJ83ZjC0RzK3oL7cGijrWsQy1sXzxmveojCYUJjWwhIYjZTuIP8E3iP+V3ahrKS zI3I1nUNBxjGSAPYk64Si4oN+EiPEBkPe6Et2488CxeH7mSGYnnKEtpHirN8EqajXUw2 vrUui7fG+h8ZrJv/X5+fPqWbecnKGG1p75N8eHYOCeJ6s8mIcCMfUc9wEu+CYHHGsytt QfWi+eAmscXXdPHxO+CYl5q1qrR7W3dkD+zlVNGM5PJZd/7meoitcDPe4Bv9pj56OIh3 fTAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=huKiWaSC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id b5-20020a056a000a8500b006cb7f9ddbd5si138369pfl.321.2023.12.06.16.01.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:01:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=huKiWaSC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 0CBC7809E89B; Wed, 6 Dec 2023 16:01:23 -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 S1441919AbjLGABA (ORCPT + 99 others); Wed, 6 Dec 2023 19:01:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231264AbjLGAAV (ORCPT ); Wed, 6 Dec 2023 19:00:21 -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 60E01D5A; Wed, 6 Dec 2023 16:00:27 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40c0a074e71so3854965e9.1; Wed, 06 Dec 2023 16:00:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907226; x=1702512026; 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=Lg7qa9kgNv3JPVirMlKzkE9ZBdZKAWAeOTAv7Yn8WPU=; b=huKiWaSCh+YdySp5i9DkG1WF+yhoGmQ2TUtQuNXaigT4jCthFflqoNBXGkZWC+miaK irckehxWvsaX0J8Od1aABDti+uwp/zoVS9hg4RVzfmESolEmFEfNjq39dKtL/AlmmzPU 7aDvXfC8a3cxPsHSTj+cnasEPcD6aSuBmfvUO0HfJarYWtRL74Xnr5SF74gcMtNINwLL cX87IE8oE+e0l3vyYOKtRq45bEl271bW3HWdY9t64+5gEvJZLOmA4mhOXFajRQrDUN/7 YfX+R5sB2sq3TFnuCiP/+5yubOz9M5qKSn9/FRKqEEmueIIsN5+B32PPJUDBwfLDWT+j Db2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907226; x=1702512026; 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=Lg7qa9kgNv3JPVirMlKzkE9ZBdZKAWAeOTAv7Yn8WPU=; b=Aa6rph3TLgKJ5w4qPuYZwfU+ImIwaNP1na/oSZlOPvoJPhxqXMh+KjRIVD65N8neGE XhO7JhHwbteBKFvBabVQeds+cGX0FbGXktV1CgpxbJ2OV0mKMBGXDFgu9PLJneV2rIBX g/zM9MugoYayJWe2PTw5qFC+X/n6UC395NDcdj75nkVV+E6AxYG5BRUm8MOvQmPRh8Z/ aESCaHThDYETEIbY4OA0dUM//qJS9Dr/r3cy7yR89FiENTvfmYcpBsugAwydQGA5EbAZ PW/08sFU7evAVG1jDawEhRB/umYUuAoPo8FpMGoIa9/tvhv4PUoPHVAkMIj3+Bfjl1nx +zCw== X-Gm-Message-State: AOJu0YwoMewE6oBaHyeskauD7LikHdT8FORoNz23VE7cGoveBczdHPtR 4YhvfLPASaAaoEYt7PuQWSI= X-Received: by 2002:a05:600c:1c20:b0:40b:4805:f829 with SMTP id j32-20020a05600c1c2000b0040b4805f829mr1061028wms.22.1701907225756; Wed, 06 Dec 2023 16:00:25 -0800 (PST) Received: from localhost.localdomain (host-79-26-252-6.retail.telecomitalia.it. [79.26.252.6]) by smtp.googlemail.com with ESMTPSA id je16-20020a05600c1f9000b00405442edc69sm50280wmb.14.2023.12.06.16.00.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:25 -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 v3 08/13] net: phy: at803x: move specific at8031 WOL bits to dedicated function Date: Thu, 7 Dec 2023 00:57:23 +0100 Message-Id: <20231206235728.6985-9-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231206235728.6985-1-ansuelsmth@gmail.com> References: <20231206235728.6985-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 morse.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 (morse.vger.email [0.0.0.0]); Wed, 06 Dec 2023 16:01:23 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784579137664995343 X-GMAIL-MSGID: 1784579137664995343 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 02ac71f98466..2de7a59c0faa 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) @@ -1611,6 +1595,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; @@ -2123,7 +2131,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 Wed Dec 6 23:57:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 174792 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4454885vqy; Wed, 6 Dec 2023 16:01:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IH8Z3VScO6sQ+Woq3yc81m8eLMJPgt0YYNtx/6UKKid5tewICC7BR1dhjmijT2hEL7zVT7y X-Received: by 2002:a92:c108:0:b0:35c:cd3e:e444 with SMTP id p8-20020a92c108000000b0035ccd3ee444mr1927363ile.28.1701907294446; Wed, 06 Dec 2023 16:01:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701907294; cv=none; d=google.com; s=arc-20160816; b=BcdB+jlveJdzR+/O92zHtg8SGQv8mOgFaPJedHe0dkhTmoqQq7/QmFKmaVjR8eZvyP 3Ug1M3WEJYNOjuQjRg6kX6T+1IiNU3GpteOWxj7bRc1CzbAhZOrvidnMKUQ754tvLstq /n/qnoLXE/VwwzDkWyjKtkMMhFeiWiCJR0GZBGAQqElxVKQ04eI8Yxy6ZZQloYnrz0A6 qT0rnmM4otmwGCOg8mhuxNBEp6WtuqJEjjVz+s7w33Gxb6NNfWq8cp9jnlB2aK8Wn60S w9gj1J0eWm2t3Phukd2FsndQhuvqnin3jiTXoAlMwEXmrzAE32z1YQUtKzmbNO/sPgau iztQ== 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=rYf/4x1S6Xi4qxCbsW/ZhILQxOYsjDvuEIJRKEsMK/k=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=TZ7KJlSJ0pOw37eP0nj5EsVa4aeGzYRKQ/1LfWcWVErm6InhXWiCejhwpa78IDFMks TTFnPjNIJamD7WhVfomtQ2jOt7MTuza/rEVt8B1bqlMvckZxl+nrHFleW73DGs8KjDaZ aoLQG6RmrBjpzImdZtwoBOivP8QlQuhDH9rteXsQ2PXK8m8Id+Mn9/E4ucrwU8Yyk+w6 hyQcNaIJG+3oIZEhHl7WHA/GT7UsxYZbh/bb23NA9q4MVg1PNScDdrx4FdamtFU76znV 7JFH/6/+pZIqnK6ZNru4xGRPU1DA46RNhC8jqKx0cBqG8TyMH7XMFoiKRWvf/GOQFwE6 JdiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RBFiFxZv; 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 b22-20020a656696000000b0056959099f46si93070pgw.856.2023.12.06.16.01.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:01:34 -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=RBFiFxZv; 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 EAA2481F3235; Wed, 6 Dec 2023 16:01:25 -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 S232043AbjLGABE (ORCPT + 99 others); Wed, 6 Dec 2023 19:01:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232366AbjLGAAW (ORCPT ); Wed, 6 Dec 2023 19:00:22 -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 A869ED62; Wed, 6 Dec 2023 16:00:28 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40b2ad4953cso8433275e9.0; Wed, 06 Dec 2023 16:00:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907227; x=1702512027; 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=rYf/4x1S6Xi4qxCbsW/ZhILQxOYsjDvuEIJRKEsMK/k=; b=RBFiFxZvRRQzYOeDmuZrldz20PDWn4DKI+awAiIwtSUPIn+npVFpkMfV6EJTA64Be8 lWCqjQ0JcxrnFn8k+VkgYeYrJuKPuH6GCh+0o3gSSrWzSPaNPIraOiag/+0JZm6gFGsn YmK5QhTgCR12YFdKI8joW6Unxk02n7Ji7jXoCO/1hQrrz3TjkG71rg0Nfn2RXGCfr4Ih GgrMRaJHPMNRsaPEi/HFMRc0nON9bC41GAJ5PC4R5QZUi0TM7M87W+MLJebPKgvo5aSQ mXjhneK2mcP6QsY/GbzUemVBhow/lKmmAmqU6xXt8XJUWWYpNzLAL53ugTdhqzAqsjrM XErA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907227; x=1702512027; 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=rYf/4x1S6Xi4qxCbsW/ZhILQxOYsjDvuEIJRKEsMK/k=; b=DZT4henzxJ6aIPI+LqOyx1qaue9OF6sC7eSh2DED7ejjZE2X7DN5TAkG8TBt2DPlnd gP+njGBzyKThOEnY9aq5hmhGKO+cOoxtFBjWfcrNEsMMiLxdBpNQ0lQSubR4g6r6cfvl m965c2+nrpAsSrjGkXhns3F9RrBWTkJKIynjpgBh8dNu98S4hcTcG0/q+SCQQHpAKlb4 O5SvcOL3VCxTR+TTLyvGAYCm8z2beqZiOOq7eq2vjtrZsjwyVB8SD7snT552qcNcx2pS T49qWzi10TjohX2SS2bA9UbYIiFOEf65kIAxu5yiXlH1Dt6VUSCbuVWfMCfLx6PNl6gp gS3w== X-Gm-Message-State: AOJu0YwGhzZtjEz0c0pPDlU2mbpRXlXLKqZ5G15rSXtBMoeuZAg+Ip+Z 8izACVpKVnSRlh/ubVd6hYo= X-Received: by 2002:a7b:ce08:0:b0:40b:5e56:7b67 with SMTP id m8-20020a7bce08000000b0040b5e567b67mr2141779wmc.176.1701907227032; Wed, 06 Dec 2023 16:00:27 -0800 (PST) Received: from localhost.localdomain (host-79-26-252-6.retail.telecomitalia.it. [79.26.252.6]) by smtp.googlemail.com with ESMTPSA id je16-20020a05600c1f9000b00405442edc69sm50280wmb.14.2023.12.06.16.00.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:26 -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 v3 09/13] net: phy: at803x: move specific at8031 config_intr to dedicated function Date: Thu, 7 Dec 2023 00:57:24 +0100 Message-Id: <20231206235728.6985-10-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231206235728.6985-1-ansuelsmth@gmail.com> References: <20231206235728.6985-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]); Wed, 06 Dec 2023 16:01:26 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784579142959919228 X-GMAIL-MSGID: 1784579142959919228 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 2de7a59c0faa..1897030667d9 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 { @@ -1619,6 +1614,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; @@ -2139,7 +2157,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 Wed Dec 6 23:57:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 174793 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4455094vqy; Wed, 6 Dec 2023 16:01:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEoPo1jHEwsnGi//e3qcRbIoBOwGq799+8OOftjWfSXdP4wczDeG5GFVtBCdOAsGmVpeNy/ X-Received: by 2002:a17:90b:188d:b0:288:7c06:52e4 with SMTP id mn13-20020a17090b188d00b002887c0652e4mr1066194pjb.4.1701907313205; Wed, 06 Dec 2023 16:01:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701907313; cv=none; d=google.com; s=arc-20160816; b=q8dcoSN7MYEJneEjbVoey+l4wm8fNQiyvfTcIaTmwHRdGqDteDAjAijTn/MXbnGPC9 HdEaypxuI7579zBDkZY3r6JqO3Z89YJ3dfaASjcmu39fs+1WMYqRLdZJzhXnYXaqbN6A 4AUmfvVKncSkYuIzQxs42VdsIB0qjAAQfPBTatiEa6NmWK7IZtcwvmO6EhygCelpm0vC V5pHd+UdS/4oydGKJMg3GmSSXZXIhsDVW9UgGv5iyXU60vVXId6X8VBQr5x9Dqf52myd ZbKDt32tPvo05Fag4xRFGgqIWHrNcvmkpQyoDnLSiYqUa740ztrMPXHKLXOLIN1KbBc6 tKgA== 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=wLw2n/+QIBoz3p532oZh6o9IUO9Ie7XX1RcGDA2Pv8M=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=UVDe+pbcCmcgE5eX2IwruwQF7Bt2azpRcffkktyBdjEYsSzNeBYteYdeRDhMnwVS+F WXeR9l5CrF/WJEYGo4K/Q85zFzaZZB29EMrOY5GwetJwolrewZGMzXDJCZdp8Fw9H+Pg ZzxYA/niRJzmwX+kAXflAPYi9DqzW/51LqZBlTp4xm3MGtbUhoMri+5KXMyzHrAPcBqc wlKDJdxuCWoso9/kl1G/G4dtfvwLLol0YRpDvbspDSoUSLBBk8sD+mTFqfA8LG6qzGs4 wZecjEVngMG35lmyxChAyV8xb+Kg85wjlSxvkM9A7rPSyKHXCc6FZeu40MXFHG5EeXGT AkZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="fy5jm9o/"; 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 x18-20020a17090aca1200b00285a62cc148si28523pjt.134.2023.12.06.16.01.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:01:53 -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="fy5jm9o/"; 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 E612180A95B6; Wed, 6 Dec 2023 16:01:47 -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 S1441813AbjLGABN (ORCPT + 99 others); Wed, 6 Dec 2023 19:01:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441917AbjLGAAZ (ORCPT ); Wed, 6 Dec 2023 19:00:25 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1266CD68; Wed, 6 Dec 2023 16:00:30 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40a4848c6e1so4785655e9.1; Wed, 06 Dec 2023 16:00:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907228; x=1702512028; 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=wLw2n/+QIBoz3p532oZh6o9IUO9Ie7XX1RcGDA2Pv8M=; b=fy5jm9o/tpuHjCmNhFrpgSWXiItoD+O9L7greFax7czsIt6myYI5tnHyrzqGZno1/D ovDLnGnAv21Ug9CTQeE+OabVduuGnal9AZ1bqweMvtZxuDeR60vddRFBea3BRhzyQwG/ k1y6yRXkIfliSvzO/HAeEJhbXGTDeGVhCkF8rk+l05lwhducVu+wi8j9AYORhXRV9D89 SP+hcGaLwrCx0LrWNWs0A7+MIKqEtaS7B82zkCkW8n0HSkQ8JHNuMg/bHR3bZqwxNWg+ DxBMOosLDxvIBo/0F212HR103iSAg+You5mxp0kEHf8nkwbQYMfss78M+xN8zgmqzm1S JB4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907228; x=1702512028; 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=wLw2n/+QIBoz3p532oZh6o9IUO9Ie7XX1RcGDA2Pv8M=; b=sV89OZqQ4+fremdYvi1PMV9g80Uo+IIhz6JU8rvrmwgeh3jqQ0v8PlUuTcbu/0Mkkc LsE5R528RLyoStXFxAhHgucMiSAMNhE5EQlNqUr87q4awFchWVegLlcWG7dgWvwxKRJq +bGbOc1l7Meax6ffeiaqwcneBy4+zeEBsJ66XMaPMzMBJ1erdIiHagNsaXPSc/lepJF0 tOvIb/t+0p2Ai5Z2DJFB4crFjEL80HpxtjWKMjR7IY26KnAOmcnS7nUTX4WQuZ75ZUE0 6cjvwYivgVZS6OTZyqDEsctK4th4WUUq45aHMiLIc4sgi/gmaqCeGDj9iIK4nzbIYskL PTcg== X-Gm-Message-State: AOJu0Yw8mVpMJM96hlw1YrSO0WOrk+psDfSIe3fIBthj/uJcO0ehMaXc tsr7LjpSD5PqOuCXYTO7uWw= X-Received: by 2002:a05:600c:468d:b0:40b:5e4a:406a with SMTP id p13-20020a05600c468d00b0040b5e4a406amr996898wmo.138.1701907228314; Wed, 06 Dec 2023 16:00:28 -0800 (PST) Received: from localhost.localdomain (host-79-26-252-6.retail.telecomitalia.it. [79.26.252.6]) by smtp.googlemail.com with ESMTPSA id je16-20020a05600c1f9000b00405442edc69sm50280wmb.14.2023.12.06.16.00.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:28 -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 v3 10/13] net: phy: at803x: make at8031 related DT functions name more specific Date: Thu, 7 Dec 2023 00:57:25 +0100 Message-Id: <20231206235728.6985-11-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231206235728.6985-1-ansuelsmth@gmail.com> References: <20231206235728.6985-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 morse.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 (morse.vger.email [0.0.0.0]); Wed, 06 Dec 2023 16:01:48 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784579163278672242 X-GMAIL-MSGID: 1784579163278672242 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 1897030667d9..3ae15ed7d634 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 Wed Dec 6 23:57:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 174797 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4455300vqy; Wed, 6 Dec 2023 16:02:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/RdSmJhF5kzXjGULPQ8YJqy04D5Rv7QbFZL05lEjonJviT42X/51G8ScMMZmCpUe5WNQ0 X-Received: by 2002:a05:6a20:4323:b0:18f:d9ed:fcda with SMTP id h35-20020a056a20432300b0018fd9edfcdamr2668319pzk.13.1701907331974; Wed, 06 Dec 2023 16:02:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701907331; cv=none; d=google.com; s=arc-20160816; b=kzrYuFHW3aprJ93H7DptPxz0d1xz5W9FhxYHvkPRRjyn7PbwF5g4/LUZlGjodFGdWR wyIkWyDH1DmanNANqwxsUbVAP+jcrnJDCBbIp89nVndotqeURgW1EaN92cB6qP65aQPj Wh3Ql9Io+beT9yLSUPi/FZ7BdD3aQHFGLRxJOzN4yb/wQ3St7/Sg88gheegwsHCNp5Jf g2QE1C7HbIK8eet1ZAZl4kthpl7r/j8to8bHPg0KcBKKu0ukMTjsML/9VvI9HARYK3tB Sa9LfSNUNhWS7PjU/ZjI83TFGNr2ZI88z+/KpcYTUwIA2L6DFdyR6ODf9hlIPKlUUP6K g05Q== 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=Q1GjoFCHwWRz6fRwuR7ibzQ19O6g0gXQ8gbR6f752RI=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=Xhyp/mzd3PHj9k1hAdpe34jyKi170Rj496VuNlFMo7ZVZXuU27V69XCz/Yp2l+aTi2 Rls1bY95vXwvMov1xJfziV8c2AOCxrzdMLrO+O874tCi2ibp1/p0ZDEkp2sD1JycIBUB 9OEjc+QFAPqXeQPTV6sD8vCo6HH+5pBrdmw9BMNzc3e9U2gTlDxw+FvTJO2CQN1ToJmZ +NkMgJCML21s8th+DqvNz3NC50erPIJbTJjjnQMelEjRGY732EfJD0TX5tNcL4BPRjRU pcAi8kpcgHormSjYOudigm4vRgzM989abElhXw/tzvvnGfbgl2WZ7fLAPwbTe3TMb/Oo afsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kgTs+1q4; 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 t4-20020a656084000000b005c624c6c8c0si103891pgu.536.2023.12.06.16.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:02:11 -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=kgTs+1q4; 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 203328024CD1; Wed, 6 Dec 2023 16:02:07 -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 S1441819AbjLGABI (ORCPT + 99 others); Wed, 6 Dec 2023 19:01:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441920AbjLGAA0 (ORCPT ); Wed, 6 Dec 2023 19:00:26 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68A9B10C3; Wed, 6 Dec 2023 16:00:31 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40c1e3ea2f2so3787145e9.2; Wed, 06 Dec 2023 16:00:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907230; x=1702512030; 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=Q1GjoFCHwWRz6fRwuR7ibzQ19O6g0gXQ8gbR6f752RI=; b=kgTs+1q4xbcaFHdcXfiVH4sl+tA1vJPUEriiBIGOh7nlKjP7JPsnKhYnBsv+5BZYfM KCckmuAfYsQZh5iA9B+YihSU3PXNSSXn3u5YG+KnEAd+4vyCVODAP5D9Wr6FmoOL2LJ+ KnwsD6BJIWHq1BOWm5kLU++7JUmQvnOqgS+4ANGbW7K8nJCgZrR/BWcW8N6UMqI95qai KdmYyrmyJ1/UdEvQQ3yasnFgQaIYuigHnfv88LW8nGnY675sXiK2V1riUZRAtRZDK6oM vy3p9Axc52490nWyAIVyA93og7ntIjlD8yg2RzeL2SB7vo7cHFYIztKZxAB3lLh6ZsON yMrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907230; x=1702512030; 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=Q1GjoFCHwWRz6fRwuR7ibzQ19O6g0gXQ8gbR6f752RI=; b=MkoovLu8E1pITLU1vB/fv6cWoKV4thmPN7Ooy8zH3w5tjYQdBdsSBD3wedWGdVMog0 SoDIpsE4HL6lXaitF5Db5wZrg7AZ2KftZH7HTjBiT6hGoHtqVJbgcDCcQO+eSDSh2KAv P912o8nMImN5YLM1MG0rSRCo+DpX06URFnVJm5BguhpQto//mgIRahkQva/12J5i2js1 TuNzBcbDXJNdAEMZNdCNBLQKuw3Ow+QvK/5k5eDP76gQCRvOLSIOnz/mZh655zSrm5nR TKnx0EtUUzCHi55Y+puo81FmOftMxAUBzD6wM/RYCPL6qrNvNj+jzQ7BX6M/g5RFhN/z ZiyA== X-Gm-Message-State: AOJu0Yx4kN3HZYzzwWF7mk2+SDIsbvzK/ufE+DLn8udRQEDWpxxkvfCg 6uclRfjlcsYxhu/HtoUt9Ag= X-Received: by 2002:a05:600c:b46:b0:40b:5e1b:54a4 with SMTP id k6-20020a05600c0b4600b0040b5e1b54a4mr1209251wmr.48.1701907229812; Wed, 06 Dec 2023 16:00:29 -0800 (PST) Received: from localhost.localdomain (host-79-26-252-6.retail.telecomitalia.it. [79.26.252.6]) by smtp.googlemail.com with ESMTPSA id je16-20020a05600c1f9000b00405442edc69sm50280wmb.14.2023.12.06.16.00.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:29 -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 v3 11/13] net: phy: at803x: move at8031 functions in dedicated section Date: Thu, 7 Dec 2023 00:57:26 +0100 Message-Id: <20231206235728.6985-12-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231206235728.6985-1-ansuelsmth@gmail.com> References: <20231206235728.6985-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]); Wed, 06 Dec 2023 16:02:07 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784579182533875209 X-GMAIL-MSGID: 1784579182533875209 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 3ae15ed7d634..73d1a5e29202 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 Wed Dec 6 23:57:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 174802 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4455611vqy; Wed, 6 Dec 2023 16:02:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkTWwQ91p8HUW9GLBcMLRounfrB6XTCiLQh/9LOmmTp9XbWWHjhckGNM1IPbchgAIjnpLn X-Received: by 2002:a17:90b:1bc4:b0:286:b271:39a1 with SMTP id oa4-20020a17090b1bc400b00286b27139a1mr2313290pjb.27.1701907359513; Wed, 06 Dec 2023 16:02:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701907359; cv=none; d=google.com; s=arc-20160816; b=vYL04MORqhM7hqsMKGR+h/G6nPLh2WiyaM7lwsis+tmoQAqPXEuyqKKHe3dfgC53Fh RBPJtY8YfAgEVIQ0iODO3sMZkhojK6rP1XzZ4LoqvQWNKxJglStHti2VfjoHaStzMxdA VzUXUc4biWCf+yGCcJQ8iR1tqFDyDfEvnCehcWcfOcFScw13NOtqxjv06UwO0rFutt0u y245SAUwk7ESEdRZ1UJHT/nZ1MNJmUQMVgPS2d7EkytHdNwVOb+HACYOoO66spYjOs/u sWYBNef7Eg1F+UocML6IMnnXBpX3ckSKYcMPSZMwtH60kHZYpk5b++87mWzMpGlWdu/i 2BiA== 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=cJTYW3+VwtWQ9mxnVIQxaCRT7NyQ9rnqwM6rkDrYRts=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=zJZN4mxDkw/4/DE2o3ZgR3oHqixBeECts7N0LpjNhf6ppjOfr54C1qaxzZbfEyIILv ZWq29kAq9gDsmk3RkPefGVwFFVy9uExVtv6tNkhh+Ak3Tgf+5CvfZrKYkvqjlqvu1Hhj 1DXRNERlar7Gcoq1+yFfwaQ7SytDrH4Kpnu1EZR13u5EUwTO800bQIh0d2NkmKrE2tBA k+QNxy65QVOJu79bphjDisJozZ3R+S8rAp2gVMNs8bwyOqhno9e4EVQU8Z/ZXUdZyPzd IElsSAZk0kV/idktO4ancje+Ojebwxa9g6POL9+t7+kpFOlu9roY77lIR8P4GqrLdVF3 Klsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=T6CsprVe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id q7-20020a17090a2dc700b00286b6bfe6dcsi62154pjm.0.2023.12.06.16.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:02:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=T6CsprVe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 E7B6980D8F59; Wed, 6 Dec 2023 16:01:41 -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 S1441954AbjLGABT (ORCPT + 99 others); Wed, 6 Dec 2023 19:01:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441866AbjLGAA2 (ORCPT ); Wed, 6 Dec 2023 19:00:28 -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 3366310C8; Wed, 6 Dec 2023 16:00:33 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40b2ad4953cso8433535e9.0; Wed, 06 Dec 2023 16:00:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907231; x=1702512031; 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=cJTYW3+VwtWQ9mxnVIQxaCRT7NyQ9rnqwM6rkDrYRts=; b=T6CsprVeOX9+SOx8MQkMZlDpoLUxczaqIlSLp7b6R3cynC9Q62BS2drX97Ic41CUaH hgqy8Y6RC8S536RAFwdNd+BNhP6oV/aS+JoOkkLSAZponhMFdNifkq/ltmFiMnY5tp1Z XTQXoADi13GN2xBUYrsjYZXUiJqaXiBey/nUTH/q4WrftkQZLN3eXdCRKxyq6xkVvuJ8 mGylMtFljUKTVG9K0lLbHrerzKee5PzyL7WisPjnVeQu2cjxG/Lg9JXwHIj74VgiSbv+ PjTw9I1cn0jyP2UkQoVKxEMMK+rx0DxdtMfXQGFjDQRmQZ28xIgUkLJtM9TENb9STphk Bn8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907231; x=1702512031; 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=cJTYW3+VwtWQ9mxnVIQxaCRT7NyQ9rnqwM6rkDrYRts=; b=gDATlOpp63izFO1AJfkyjufIdr5yX0VGpl4WSaPbXVeiAY8oIdlo98Eq0wmTDUhTC3 nt8CCs1ChzbbtSeaIfy469rfsxCb+OAb78iPC3HX13/uJPL/2hHcgGBMv99XwSJHBvLG huYgslgKuV2yxVGaKsukxfrBfdfBCjZSd8j6sccQuyu3lMZ9NlHfeanhdptUPEgqc8i7 uVN+tX/R44qIFvBbBE3kmGdFNVd3fpenYJn721/E8l1mU6tJyk5TFHJKryizzNHXZD2R p+a4zoKxaGhZOCKAudJYh/QUPlM5zu9PC8Rwuyist/syRtwUAw9QqNlZktN59SffmjLi Cd/Q== X-Gm-Message-State: AOJu0YyZA/dar75Tft6HmCZJddfJ9xgDKjlciZz7e77sB2AXi6zyy17j Ie2KG0thqC5ovdObKxJOjo8= X-Received: by 2002:a05:600c:4f07:b0:40b:5e4a:233f with SMTP id l7-20020a05600c4f0700b0040b5e4a233fmr2176639wmq.65.1701907231466; Wed, 06 Dec 2023 16:00:31 -0800 (PST) Received: from localhost.localdomain (host-79-26-252-6.retail.telecomitalia.it. [79.26.252.6]) by smtp.googlemail.com with ESMTPSA id je16-20020a05600c1f9000b00405442edc69sm50280wmb.14.2023.12.06.16.00.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:31 -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 v3 12/13] net: phy: at803x: move at8035 specific DT parse to dedicated probe Date: Thu, 7 Dec 2023 00:57:27 +0100 Message-Id: <20231206235728.6985-13-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231206235728.6985-1-ansuelsmth@gmail.com> References: <20231206235728.6985-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_BLOCKED,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]); Wed, 06 Dec 2023 16:01:46 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784579211604934784 X-GMAIL-MSGID: 1784579211604934784 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 73d1a5e29202..27dc0a9ca076 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); @@ -1637,6 +1620,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; @@ -2109,7 +2131,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, @@ -2130,7 +2152,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 Wed Dec 6 23:57:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 174794 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4455122vqy; Wed, 6 Dec 2023 16:01:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IHuVdiuM7xbiKHplRVjl4cnQrqm6kilNdx1CMtzNWwsRpzV4EIQ1l5CQt6yFoecCK+DoUHE X-Received: by 2002:a05:6a00:2451:b0:6ce:4010:d206 with SMTP id d17-20020a056a00245100b006ce4010d206mr1711375pfj.20.1701907315685; Wed, 06 Dec 2023 16:01:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701907315; cv=none; d=google.com; s=arc-20160816; b=Xldwzi8+NPSbatX3knW+StSCRZojiPvcMn/rHtMXtEnfM9k6bSBVlgZnn6KvO/wjJc Qr7vGSFpYjBZQkQS8VZiPZc3dUdfnLgQNbS1LSI00xifTByzObaQ/cjw8G5wuBPLQGFw cBDin8v9Yapnf91MXQXxRo9duCm6HrUsip0x7ja0AbBN9fDDNwhtdwTZWs4FiyN2Ew3M PnyDaqUtigP9vt9VkotC6WzmOyGjNlYh/Ybm3RPDPxhRTXgQ3fWqTvSgDmZ/hUQ+r5j9 zvgB2Z33xHVHsBZVRiN18vUwibNgFb7I+q6k3+bBjSRaCE/qtARmxgvaT/s4zL+99dXB adRg== 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=E05UGHQ4N7O1lFKOAb+MxjheYxLzG4PbQZQyg7KHlkU=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=FWPL3lnKY40hC5jWXfP4u4NotPzizKWd92SbMULlCOhrrLR90AOL64XH7ysMBh37et qbxoGsgdGAoteyvga9aLTjDLW9pIB5qBekNilrTQcsKmIr0Z6pSvAxQBlel3nAuL9iaM UWPgwMacYDSR7aidfkIg98afYFZRZmgynPvX58dMGt9FzmyQ70zSkcBqIv7uatJ9Ldcc zVfFrxCUJ6eeO2npd/42k7jXpggowr6b3TqyXAhw3UmPhPzUEFiNpSwReaFh2KxKCVd2 Fad/qoWooJlvS4gAq/dJYP7DMf9FEpuUiURkAiFoO4dSUV/UAyDmU53X3HSthkOXZ8no /8fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=K17L3WnI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id b2-20020a63eb42000000b005c678d5eec1si100608pgk.607.2023.12.06.16.01.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:01:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=K17L3WnI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 CB12C802407E; Wed, 6 Dec 2023 16:01:45 -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 S1442946AbjLGABX (ORCPT + 99 others); Wed, 6 Dec 2023 19:01:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441897AbjLGAA3 (ORCPT ); Wed, 6 Dec 2023 19:00:29 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1720519E; Wed, 6 Dec 2023 16:00:34 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-40b5155e154so4694545e9.3; Wed, 06 Dec 2023 16:00:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907233; x=1702512033; 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=E05UGHQ4N7O1lFKOAb+MxjheYxLzG4PbQZQyg7KHlkU=; b=K17L3WnIMDYg/DJcmukoYgTHmhuUu8zblYO+0DJZ4N3FgYJM2MLb/XRrxFvTvwYnBr Z9imFBlJgR2kbsNPjKflcoLZWGtaZHn3IPWHvxl4+kvOnYYz5RuYi9PG6l0buyDHeNO8 kziJlkZllTji9+6eB4/D8uwzz1UjoOzNzsroh5Wf1IvgEXpRmvjtDXBsQATD2jQxuN7g mNKwHtOr2+Z0GawfIHKmPa9Q0FGS/v8awMJDuGbnDtU/jhO/RApglUC30kBehuwDRokM TQsp37FgW5pSe6sVz3OXBdyavzUZ+zvK5Ob3Gp8Vz96g+/fK8fhPgQ56owytMa8eWECI wPVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907233; x=1702512033; 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=E05UGHQ4N7O1lFKOAb+MxjheYxLzG4PbQZQyg7KHlkU=; b=DuKTCE2F6JLM5Av1A2vv8xqFAxd/JEpcU58Ha2BwG3iK8qEUr00Y6DX0Tigi3NT0Mk kmxyZ2VJylH4/AMbNFy0JDb2fMWFKdqXxZdC0YO92WYtdwG3rM8UCdZgTPkJ6ig0fLu9 eXY9QRiLHz8PB075JJPW/0Vc3Rh3Sjno7Lln4hmTLormuH7imicMwraw0/bNyQat6Rnm JCFg3tEtivS1AVwhNZ8PcsFjpidTWPW9HLQPoIb7CjTVUEdJzjsoTMU7O47oURfbtZuZ R9T/mSmhmIvkCzDdaiCkMjd0g9SnukDjAEQT/28FGJOXoaCsvFdHcX5kGydIE//2WMBw gklA== X-Gm-Message-State: AOJu0YydgrL2Ywt/xSOJWcY8d0M4/+TJU+5/CSGueDMqqY14SvLVD8GC kGNGvjTjba+ofGMj+Qw8anI8e8afnVU= X-Received: by 2002:a05:600c:1f86:b0:40b:5e4a:406d with SMTP id je6-20020a05600c1f8600b0040b5e4a406dmr991376wmb.141.1701907233227; Wed, 06 Dec 2023 16:00:33 -0800 (PST) Received: from localhost.localdomain (host-79-26-252-6.retail.telecomitalia.it. [79.26.252.6]) by smtp.googlemail.com with ESMTPSA id je16-20020a05600c1f9000b00405442edc69sm50280wmb.14.2023.12.06.16.00.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:32 -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 v3 13/13] net: phy: at803x: drop specific PHY ID check from cable test functions Date: Thu, 7 Dec 2023 00:57:28 +0100 Message-Id: <20231206235728.6985-14-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231206235728.6985-1-ansuelsmth@gmail.com> References: <20231206235728.6985-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]); Wed, 06 Dec 2023 16:01:46 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784579165426236161 X-GMAIL-MSGID: 1784579165426236161 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 27dc0a9ca076..d102f826db73 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; } @@ -1620,6 +1599,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; @@ -2043,11 +2045,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; @@ -2145,8 +2150,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, @@ -2183,8 +2188,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), @@ -2199,7 +2204,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), @@ -2212,7 +2217,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, @@ -2228,7 +2233,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,