From patchwork Fri Dec 1 00:14:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 172179 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp775857vqy; Thu, 30 Nov 2023 16:15:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/I32UoFwp6kJ9ZCfkkLADJvYcT6lFIAi7ePvHD32mCcDOluVpDaFhQANE1alYcsAAavnq X-Received: by 2002:a05:6a21:33aa:b0:18b:ef96:be44 with SMTP id yy42-20020a056a2133aa00b0018bef96be44mr26791285pzb.26.1701389703032; Thu, 30 Nov 2023 16:15:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701389703; cv=none; d=google.com; s=arc-20160816; b=aTFW/NuknCzDIObwDtv6q1oE/gCJdzrTTXktW55hKYDwqcOe8Icd8bPu0d6//zhylo 9G2+g0byCITvldT5bq7V4M+vdlzHObY/Rr4A6aEGjjr8sjFfAcKErjoXu2YXqOcWr7Ku d7MzS7ktY+P4yQnUgRxLevsFTTfFPPts98bxE8A+ic/ly4Tjyqzozu/btkxpEXUM9fEB y+83zEuc3cWkib5mmDriyWS+Q4QzosLAF+RWYA4hUFIsiq4Y5RL/Rdl3mEi0NIs1HGiO GOnHS9q9Pcm3uE1ERbuhONzY0s9HtFl8orhEZKGYn+UB+Zi+y3lmkrTa2pTSbTlsVN2I QeeQ== 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=pUSeqy4WySQYXhbD2mXV47B5k3379luBzTFabqL8YMKiZ2OeGQ64r7vd3hyfzdojK6 NpH3Y6xxS85GskJv61dpwzWh8Ej1glHYCoKoog5qZuWYcMr5Mq+duuPBJdbx9PiFLVEP YgbRbzHbAO1FBfPA5/qnEAcOS989oA9th3uBn/1kzQdUOZrdvKJH66FeY1NMd6QhlKKf Fqb9ZnJtYIEV4OACxFU4+Wgcsbbup1b3fhanDCR9EO8MLfhA9DfFZeOsMNIZIwOi3Sjm M8vlOGLWGW8QTZJgBdMPOhNxbcycFQRc1bzsm92GkxbPqSAx3Ly0dCBX1gksdpfE3bYK cmRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FL+dykhW; 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 fa25-20020a056a002d1900b0068a65b26fc6si2317290pfb.43.2023.11.30.16.15.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:15:03 -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=FL+dykhW; 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 E8FD782E330F; Thu, 30 Nov 2023 16:14:57 -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 S1377399AbjLAAOr (ORCPT + 99 others); Thu, 30 Nov 2023 19:14:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377352AbjLAAOp (ORCPT ); Thu, 30 Nov 2023 19:14:45 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6F6C133; Thu, 30 Nov 2023 16:14:51 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-332d5c852a0so962672f8f.3; Thu, 30 Nov 2023 16:14:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701389690; x=1701994490; 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=FL+dykhWQ4ZSqV5/x7Wn7K8cFzAEKi9QQLwXYscHPGGqGqlYGR154qzpNrHORKGYF0 Noz6LchtQdQ0ADDS8VJW/N2JnCHhXGDX+DU83YmrmF9kTCT7DV2y8X2RVD5c+Hts64N1 etdnBG/Ro56KOfOhj/PngNIvdNLQisZuxS2VFoT0Bt9MCnJrHWqw4TIgRLKKwuOJ9SIr LcVCnExUzBbXavwLvOFOLDTXetLjvPfaUDCSsYGy6DxZrh3QcOmV+tTzKYJo6m1zgltI armakfJUWte+3Ibrxxp0Sf30ihO509RX0HvTd/IBC31A4U/cWVdqoArG5G17EkS9xBrI GaLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701389690; x=1701994490; 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=Fhdw4R4Qo24XS8XPZfGoVWw5WPu/rn8evDPp4IkuqG9jd46nenEHIv2Lm4HMhJ9rAN wvHQ/IzTUi6UxhA7vUrHnnpLi1NXPA1fa1R57yk4f2lBARlWplZJnOvsd+bytPnECG8k o6VbdeOkX0P/BOfw6qRVSbaZERFDmU/ocNxNZRkqop7fupng4/sI4cdh4eXQLurK5Zti +26tw3NCUtoSp80AenYLWM7T0vM7MJuDs05wyMQIyl5MbP7M8xHaxqOc4wtqmTG0VRmQ Juz9vDQRv90hnff8AzmELOgKXFJ7dh2zCtHsAEfAYlmrELOs94maoNa5idYh6XWPbsBz pOcw== X-Gm-Message-State: AOJu0YxJvTAymQbMQX2oL2p94tDbihW78N3RqQLWLIYn7wXOeu1f3EaW ZHqOOL9d0gBqmFK5+++/vt0= X-Received: by 2002:a05:6000:1372:b0:333:2fd2:5d42 with SMTP id q18-20020a056000137200b003332fd25d42mr203533wrz.116.1701389689788; Thu, 30 Nov 2023 16:14:49 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g16-20020a05600c4ed000b0040b47c53610sm3535457wmq.14.2023.11.30.16.14.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:14:49 -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 v2 01/12] net: phy: at803x: fix passing the wrong reference for config_intr Date: Fri, 1 Dec 2023 01:14:11 +0100 Message-Id: <20231201001423.20989-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231201001423.20989-1-ansuelsmth@gmail.com> References: <20231201001423.20989-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]); Thu, 30 Nov 2023 16:14:58 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784036409361316586 X-GMAIL-MSGID: 1784036409361316586 Fix passing the wrong reference for config_initr on passing the function pointer, drop the wrong & from at803x_config_intr in the PHY struct. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 37fb033e1c29..ef203b0807e5 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -2104,7 +2104,7 @@ static struct phy_driver at803x_driver[] = { .write_page = at803x_write_page, .get_features = at803x_get_features, .read_status = at803x_read_status, - .config_intr = &at803x_config_intr, + .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .get_tunable = at803x_get_tunable, .set_tunable = at803x_set_tunable, @@ -2134,7 +2134,7 @@ static struct phy_driver at803x_driver[] = { .resume = at803x_resume, .flags = PHY_POLL_CABLE_TEST, /* PHY_BASIC_FEATURES */ - .config_intr = &at803x_config_intr, + .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .cable_test_start = at803x_cable_test_start, .cable_test_get_status = at803x_cable_test_get_status, @@ -2150,7 +2150,7 @@ static struct phy_driver at803x_driver[] = { .resume = at803x_resume, .flags = PHY_POLL_CABLE_TEST, /* PHY_BASIC_FEATURES */ - .config_intr = &at803x_config_intr, + .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .cable_test_start = at803x_cable_test_start, .cable_test_get_status = at803x_cable_test_get_status, From patchwork Fri Dec 1 00:14:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 172180 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp775873vqy; Thu, 30 Nov 2023 16:15:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IETrR1dnlNPw9IomubWqTpf6X8xwiqLjnsaip8s79KZg7N5s2lr0l8wmH3OKV+T+vwyABvD X-Received: by 2002:a17:902:e80d:b0:1cf:b56f:5359 with SMTP id u13-20020a170902e80d00b001cfb56f5359mr20881771plg.16.1701389705227; Thu, 30 Nov 2023 16:15:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701389705; cv=none; d=google.com; s=arc-20160816; b=S1ohS8XtXbPPsf29y9wGx1R4uPzWe0KwqPHDZfqbO+HA5fCoa50L/LHEyCndCyKQsn fiy7RsgBpwb4mnfiOPLDSutOuofxrZ/hU6YUhwSai3F6Mohm6VON8iB+w/aLogtBM6bm 65njR1LOfrP3Jy8YwVKvmrX8GFRLMBYQseQLtJ94jaKkWNON3oRUgSCS898QSXnzplMN CBjZhPjDytL4wbrtn5duQtsp7XUdbxQyOWdKsZXGo7jbruN3phNP2bG3mTVaB3OtqHaf gmb1C0RhJcIOwjt2jpWrdhR4VsDYx6yvge4E+/V1EQ0+1Ug9E+R+bmqEV69wumg06D1/ fvUA== 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=4S8WGKa0/D4CAm9y6YGXWUP7HyKdLd55ppGa7UA6g6A=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=zkmGC9j5WMk//fC5p6aUgW2358nQhVXM8bQSKklbHrgF/KJhZagOfZRR3LrLJGUrH2 zymzfrZgA6BU98euGbh9dZTzt4goJSYknD3iwNlf9IJNUqgS/6DCvfFxz2YPqvn9kvhO pX/VCjpE3KrHI+4GB9aIt/w6Pc+Tu5wSFqSReDHom8tJ77YNwx4mr8AueHwDehyE8AlC 8BB3unxRKcs6NpNmAJJXeyxinKdkIXQRyWVPrCZW4gn1rodv4St6ydVKg4Cg3DzrCw29 i/0RHIbjVC5q8l0LPkn1TBQ7k1RDxHJ5in0iYfkcaOPQZIMecbFSkpDGVjzues0QN/XQ oX1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=EKEHcGR6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id p22-20020a170902b09600b001d00ff4bf6csi2089435plr.466.2023.11.30.16.15.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:15:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=EKEHcGR6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id AD00D805DC31; Thu, 30 Nov 2023 16:15:03 -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 S1377406AbjLAAOs (ORCPT + 99 others); Thu, 30 Nov 2023 19:14:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377397AbjLAAOq (ORCPT ); Thu, 30 Nov 2023 19:14:46 -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 B9AAF197; Thu, 30 Nov 2023 16:14:52 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40b4f6006d5so14732935e9.1; Thu, 30 Nov 2023 16:14:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701389691; x=1701994491; 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=4S8WGKa0/D4CAm9y6YGXWUP7HyKdLd55ppGa7UA6g6A=; b=EKEHcGR6/nE0E41Kr0tfotrGUkcpewpralAzjadCewrbWBHTTQLz4GaMnuSq3ZdLx6 zC/gQ52sYhSi+Ehyt41vAoV6ai13smD5WOFqII2BYTgaMjsCsB4tkO7EoIXIPQLLijiU b7tZU3IFekrp7an8AlY5W4ATDX7j86Ls7GRyf0G0A1SfXYkXG1mVhgj5JhDPpbe8SsbD 9VJCCqMd8Q4SnbcEexeHA9KbNnr0dQJHZgd/3YUzwVRvlzNchtvmHUNDuavtWsAy+z5c pep+Owqek9SE1K3jPhBwb5TPWm3cH1DT15mTxLEGMrvI/IIRG/oLcLF9BeNLO3BfL6TA dOgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701389691; x=1701994491; 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=4S8WGKa0/D4CAm9y6YGXWUP7HyKdLd55ppGa7UA6g6A=; b=ukknrkaa5e6Sx8Goqy0UlVpn2lD8rJSgdCsh1iUc/SRnfK1nSLzpGjPN22xHQzly88 eZsrf0ArPKcu+vDyzMtDE6YkbiRp0fzzFIpue6CluSDQEUnoMqyom/FGhBTLo5rLUr6K efzz5QKW7F1HjiCBiUlwGlDJkJ58HMPskkprfXr1awQirjQWDaoike3dESR9z3KyQgEr G7mR8oeueMUXmOs1eruQ1e2H0KoeZMNlmeKgV80vugi9Fqk9I7chAQUv2THA7XriDo9r /5LXmKTnhsZASW0RAxekL3t9P+Ey5if4wFGkagcumJ1xvT6pDFn1ANmcujkH/Bd+yVkJ ZxGQ== X-Gm-Message-State: AOJu0YyeOINgdtWvNRHGkas/qAVcHwBwum3PBGzqD2GedJlOfkbY/PSO riTbF8tDCiH8GmTVvSi9aB0= X-Received: by 2002:a05:600c:524d:b0:40b:473d:6b82 with SMTP id fc13-20020a05600c524d00b0040b473d6b82mr110234wmb.12.1701389690879; Thu, 30 Nov 2023 16:14:50 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g16-20020a05600c4ed000b0040b47c53610sm3535457wmq.14.2023.11.30.16.14.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:14:50 -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 v2 02/12] net: phy: at803x: move disable WOL to specific at8031 probe Date: Fri, 1 Dec 2023 01:14:12 +0100 Message-Id: <20231201001423.20989-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231201001423.20989-1-ansuelsmth@gmail.com> References: <20231201001423.20989-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 30 Nov 2023 16:15:03 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784036411394961105 X-GMAIL-MSGID: 1784036411394961105 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 Fri Dec 1 00:14:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 172181 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp776084vqy; Thu, 30 Nov 2023 16:15:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IEbM/4mA1nM7s8XrDVK0zS1UmkEacYOwAyR7WDaDbZfakM9mAm0F1iqe+48AZzQRBaJwpqo X-Received: by 2002:a05:6a00:438d:b0:6cd:e3f3:d01f with SMTP id bt13-20020a056a00438d00b006cde3f3d01fmr4658798pfb.26.1701389725618; Thu, 30 Nov 2023 16:15:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701389725; cv=none; d=google.com; s=arc-20160816; b=kd7bJnFwuSbuWQcASEKGVfCWS5yOqYiaozxvNRe+CG5dtkknP/dwdUYQAQInjurVUZ Y87mpWCWGj6+mzdxIq6doMLqabtzpz/tJSN8OrzX+EXEVAhQcr1SXUVvHXg7UdqqahES ngt4HwOga4Y4jo5cEfJv7ILQMQiGNpEWDjT4AbRMJFxdj1dDm2NM2Yn1VpwbrCnVz2s0 re+kKg9kbV87Diqs9XS0dQCdHkmt4Srj5vKAf+XmqX5LcWmWDpJxuOOlB9KDOSOzHIYU CC+SClI1if90fwDiQe12ikzvLH56MPTV3J64hTit+qlTc0sAYQAwu4Fm2SYBiz/tS3oi /FxA== 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=C30f0t/B4CUzPHehchJ3Oji8G2Pn+xCu1HFN9C+jMr+Kd4otScW/dnSFNO9AvLVbe1 29//ta+/WDUb+xUMFDnroTS80ozKjR5w7CQrI6jQsCQ+lu+VgOalOe3LfyPDCTbSMpgg y6uWDueHaXx0j8o06f1nKT+/T6i0r7OXW3vw0BghlrQ+S/OytKSIPGZzIa9WhzZVvfKp wMSMNYzw3Lfd6ll3uZkeprd1Mr90ssrAtnozCymXx2YO1A9wIIcAJTABv82vHLfb80RZ 1SPz4ZgG5pLynwhgIhUuE6W9R3iAQEKyU5H1ZRj67v2lhqNU94KiqupUzvolBdK7QDTU Uxwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IFM+41if; 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 f12-20020a63f74c000000b005bdc49ba91bsi2384191pgk.151.2023.11.30.16.15.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:15:25 -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=IFM+41if; 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 057A1801CFF5; Thu, 30 Nov 2023 16:15:06 -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 S1377419AbjLAAOu (ORCPT + 99 others); Thu, 30 Nov 2023 19:14:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377402AbjLAAOr (ORCPT ); Thu, 30 Nov 2023 19:14:47 -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 7D0FF196; Thu, 30 Nov 2023 16:14:53 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-40b40423df8so13523955e9.0; Thu, 30 Nov 2023 16:14:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701389692; x=1701994492; 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=IFM+41ifytpBdNfnHq8My1Mqrj5+fex2MklwzjuhL5pTjjCqFgFtyoX7rNvgbU1Ctu tjVm3bvmRRkaCPl4V13F8vkyuKKtx1iVt0etS05xfwUURNVXPVn1i6DqlYzh9/z/NWEl 6QLBSnjif2dsNMznutR5qbAhUrVg3C1V17A//winFI2RU908HNmVkIUmvIotxxsqWCIa fnqZqoLomBwEb5wnwpdG6XSmor/n/48QWUV9ysbKlA7Etgg4xmL87eNevHr9mUH+QRR3 HavAvkRF15gcny/mKfS3hul4MD7F/7pvQ2SLhYAz1dOXgSx0vmyFPKOtSuuZC6oFv0NZ AM7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701389692; x=1701994492; 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=ZgaY4l82X+Tc6U0s5/+DuQBWvGTpILUWq5DP3Hk/jHzm/t65Jx1gbp1mMuWcFVBPvh 28Va3JzbGeS56fcVEpzHtGjA/orjcPPsfig2cUdULAW0xr3kwXwWTKBPs+WrAMxxZKep um4f2WeYyglTbfW09UwDK5AgFUarmhxQGpAEo8vtSmrmamG3pKGZ8rcRAJgvhcucL6ar uz0qVSIikRDlGkgZoDpkFtufD5wy/bT7WL2XIaRUWSXuZOLBhIxh+aZ6DtMPO6/udC1g CDzK7LiZ8xyrDhxZHZiepthZYZng6ulxpuO7WnrCc7qUZc355+UQMYSYCNWHye2hnGw+ KkPw== X-Gm-Message-State: AOJu0YwFxzstosjEsw6L0FVbyBFZprjTWsW0u5ZjJP8fyT6sqLAVrBas CgWmVS3zJc14lcIAztVHBz4= X-Received: by 2002:a7b:ce13:0:b0:40b:5e4a:40bc with SMTP id m19-20020a7bce13000000b0040b5e4a40bcmr74203wmc.220.1701389691912; Thu, 30 Nov 2023 16:14:51 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g16-20020a05600c4ed000b0040b47c53610sm3535457wmq.14.2023.11.30.16.14.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:14:51 -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 v2 03/12] net: phy: at803x: raname hw_stats functions to qca83xx specific name Date: Fri, 1 Dec 2023 01:14:13 +0100 Message-Id: <20231201001423.20989-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231201001423.20989-1-ansuelsmth@gmail.com> References: <20231201001423.20989-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]); Thu, 30 Nov 2023 16:15:07 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784036432923440119 X-GMAIL-MSGID: 1784036432923440119 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 Fri Dec 1 00:14:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 172183 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp776179vqy; Thu, 30 Nov 2023 16:15:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IE0m6cySmmI7ocEIpYgeLGd93u216chxX8ObGpFCkXMd13jdQ5ZCIPPlDBK60a2180cv9nM X-Received: by 2002:a05:6a20:a10b:b0:187:2c9a:c9ad with SMTP id q11-20020a056a20a10b00b001872c9ac9admr25356673pzk.55.1701389735042; Thu, 30 Nov 2023 16:15:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701389735; cv=none; d=google.com; s=arc-20160816; b=Sgfbm1xZL4aYUBu24a9pHUiB5dpTjKzmpDZdaxDRXUXdK+NAGK6jlRf6VivyS/ibqp z1OzwdRwOgL9NgYkpr0jIrod0Cc+vcqUmSzJXjzyrrExAmdBeBnSb+k1ZqSulaYWaM1G d3r0cek1jWFDikUmJb47Fvpad7j1fujpkiSJvaWP95hhUZZwXXJsq8fy2FFdT71MBn9n g9siASY9GM2BhNV8ebvtaR+fPvFCowbr01XjXBSxDri3kYE5CV8aiffFspVnjuokLD9a ZqqyF+TXW9y1n8o4ZlcFvkoVOQVLtptY0jDxSI9hSw36PDflznYYjPO+QuUyxpV5d18u xBzA== 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=ai9cSwOv4e1xAVm7Ebrs3oJ1olzuYBI1UlxUqmManot0FNm+QyrNXpogbkg+2uEhcS DUiPB9N+y6PJpa6gPD93jn5EKAsQyQfjsDh8iKI/W53/SXlqyznPpgC/0kA8I8Hkkzlk PfnFS4ag1w24iFcjfbws0tT558HIFOFzDD/j5zm61+c3Pxzr+LaIDIZb0kI6F4sHxbzy L8DDNyFUwu+L/VMTNKLs+Bd8ygEYQFI9ALt324LYpnAtWn/076mtjc8VBfg7oRqig0cX IBXEOCy1svlKj3o9vEyzh1zexoR7lWxqJEzQgKdgZreMHe6XJje9PUcihJ9NIDwVzm5j 3zQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XIinhrnj; 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 u2-20020a656702000000b005c289c5cb5esi2264754pgf.762.2023.11.30.16.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:15:35 -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=XIinhrnj; 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 68DAF80DECC1; Thu, 30 Nov 2023 16:15:07 -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 S1377424AbjLAAOw (ORCPT + 99 others); Thu, 30 Nov 2023 19:14:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377405AbjLAAOs (ORCPT ); Thu, 30 Nov 2023 19:14:48 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1B0710E2; Thu, 30 Nov 2023 16:14:54 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40b472f98b1so13895985e9.3; Thu, 30 Nov 2023 16:14:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701389693; x=1701994493; 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=XIinhrnjz7dWzJYuskefNNY5GyQyoSmQxBU8bXbcRKp9X2onzoFcGebpwI9MVq2sp3 Pnp0IVoddaQdW5BhKZDZEuryVM2jHaRof0l9thRylgrNnVayUwOdycP4NHYr1ZvE3Yc7 qUoauW+El07A3VzupbgTmhK51DQewIKzSnV7Fqk5nz4pEo0FxOdeSKEObz+MAEty/1iS t35cY2+mASKotbARy/QxzNtlVMe0Pt3PlHx5UPCEka701M5F0ziuNip8atDHP2LOrSo4 rG0tWguo+WJsB/KMH97v+KgDzwo0nd2P8VSDUTB6+kmSG5G0wYuJPfVazU3uc8vAGtr8 uuXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701389693; x=1701994493; 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=ItFmUJfr3sCZMDZLAz8ZnPVNDPwQ2YKTpksY/R1Q9q+jO2OTglxZTUq9OEa1CN31K5 zXJ03M2wWAFqsR0UCbEkZ8OBx4CMwFvDtQC0c2Rtu2BoREBYBnuMDzhV8PbqiOTAey6w CiF33zLmqZSud/acBY9ldcFEeP9aJ7ncnsMrKlDYJ3ROX6O9rmWpnGNGgYM141LAVjFC ygFOmdAx8rwJCgnrQFnWOaJEO7zUoDtGftCohP4lECbjVhGToi+0NZvZhK11GJtVMpN7 nQ2qKiJUWIHHTx+IubEkFm1BGMi/wTsb/Sl/8nCogz8SrUCt3BrUhwK+D9uwg8VwN3vj Qo9Q== X-Gm-Message-State: AOJu0YxVNUtxSVVG2pqFuE/KT/Okdu+tS5V1D41LkpBNi7rseQo/cvJ7 2xG4C/gwJrydUzEyVF5HkwQ= X-Received: by 2002:a7b:c8d5:0:b0:40b:5e59:ea1c with SMTP id f21-20020a7bc8d5000000b0040b5e59ea1cmr92057wml.187.1701389692734; Thu, 30 Nov 2023 16:14:52 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g16-20020a05600c4ed000b0040b47c53610sm3535457wmq.14.2023.11.30.16.14.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:14:52 -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 v2 04/12] net: phy: at803x: move qca83xx specific check in dedicated functions Date: Fri, 1 Dec 2023 01:14:14 +0100 Message-Id: <20231201001423.20989-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231201001423.20989-1-ansuelsmth@gmail.com> References: <20231201001423.20989-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]); Thu, 30 Nov 2023 16:15:07 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784036442732188956 X-GMAIL-MSGID: 1784036442732188956 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 Fri Dec 1 00:14:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 172184 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp776250vqy; Thu, 30 Nov 2023 16:15:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFY7REx4C2Cb+YMrvh+8FHxTUs0eb2WhH55ns53ajB2ouf9D3/VwVKzPYF6jZGImB7DNEAb X-Received: by 2002:a05:6a21:3714:b0:18b:8147:91fb with SMTP id yl20-20020a056a21371400b0018b814791fbmr17500168pzb.19.1701389743747; Thu, 30 Nov 2023 16:15:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701389743; cv=none; d=google.com; s=arc-20160816; b=G2mkcP2ovczoEd5RlpRI107ITzCWgQaimCGwuhvz/0uAlH6tMWIMzNdqwv4/wSsDbT d+PoQMa7byLZlhE9k1s1mCmYBQiHNKH5dmR+rzSn2emgNtFW4qzQfB3bSTs+X8HebpSF lduc/xE8/n+hOxVud22z4NWgnnh1ul9d6BLrsXRmPGN3qokLxi0oP8XcyYfVOJFQ1AdW HUvuJ763kdp6AHG6oJDAFDzS4adAv+j3K4iWaKo9qg747Hy8lYtoNqoY6xUjMM/xEBhf 7V/utuS5628DsdXau1xTHRQWvmRW+iJAVgoQZNaJJZ+b4vGZPGxBxqPVPkgg1KlpLqNr 3yYQ== 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=eeuD35kl9OZh7RWQWxD6o92Iwh3LhKseRWsjP+na1qo=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=TumtZ45tePiElbjzklA2eBkdd1WfkOOs7qEGidlH+HVdhpxB4Q60RmBf8vsoi7xaB/ TKfdgunzpvVIRfkH2x4EWx3K606IFYRAhnMAXOKDJS8cpkgPjDp0AGJNbVwQ9Hm/RJeH gMUxxJfR2kJ09x+fJC4aFGC0w2CsU+nOtJ+igEl2mXmOsUfWyyoz6bwS+ZqUC9RwH0zz JAnAPy2bmtYDfou9l5HL51ZnroCGAZpY17rx0phJPXeThxIHm5WTjxOcaP/yX122iHym Qx2Qv77Ap/kIr8XlLbQMPvYNkTVm5i6C7WBel4CfC3ZODzmauRuOWKQmgNRzOfPa+OoQ 0N4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=h5dEEg5p; 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 s7-20020a632147000000b005c1cc9caf0asi2284261pgm.899.2023.11.30.16.15.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:15:43 -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=h5dEEg5p; 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 8BDC680CB16C; Thu, 30 Nov 2023 16:15:31 -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 S1377404AbjLAAOz (ORCPT + 99 others); Thu, 30 Nov 2023 19:14:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377413AbjLAAOt (ORCPT ); Thu, 30 Nov 2023 19:14:49 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8897F10FA; Thu, 30 Nov 2023 16:14:55 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40b4c2ef584so13633705e9.3; Thu, 30 Nov 2023 16:14:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701389694; x=1701994494; 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=eeuD35kl9OZh7RWQWxD6o92Iwh3LhKseRWsjP+na1qo=; b=h5dEEg5pyfWLVWC4z2wap13deccfUxkwFEfdPVWUzm44uR+SRG9XQVA3tHXeCv0qzf nZ278Q8lAt6ZNP4phwWosuvl1z3DZGmd74MmV3K6XCHmemYd7qvgTbEMlEfugPdr6dRT m9W7x/STcixl3DSVpluZJZ0I2V98CW2PUX0Y/OgmpuYRtudyQl9CnLGmB5RFewGyKkd6 iwU3a8r0PDv1aCgA0VIUcPIYlAcxRDVVMWyVxdxdsIvsVkTY8jxxpiuIll19+PBuWodW D3O39S/yrz+xOA/eStWdjzU3zFtcC4OeeFQrHs8VYATi9N0hEQF8o4jEke43Y1w5qiOY 9XMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701389694; x=1701994494; 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=eeuD35kl9OZh7RWQWxD6o92Iwh3LhKseRWsjP+na1qo=; b=jZVzVj8kcluJnI5Eb8LkDGMstl6ncGw8JGsM1jiI7Y39AtaBwJvs4sPFy5HpGro/YO EQ+xqmiY99/YU3n93MyfdbGHFFHgMFzjGi0H4jOKDyzDvh8OsAOhi7WmAXJtfHTf0jyX eRVZ1Pm9qDYkwn69tRZe7S70x5J2LwsV8wDlAOpG+8V/VQEgxYPC5c3s1B/uu2OY13KV zj7q3UePwTeEv/BOC+s1pR3My8jpIBNxZ9JtkXF7aLMjinpix13plkFG4xeqUd9+39PW vq4fFnfJ9+EJkfkJ78VBgS6PHSrqAk56FwbZlpdxewz8+y8U5iJ2Xpn2bEyUqsZLcwBS paxg== X-Gm-Message-State: AOJu0YykSZFMfSSfQuGFD9Ee/c1+j0HuCUd61Pl+lYPMZppTNyJ5gGVN 7rxlWg9vX2VgCK3iZPGH71JxaWjxP3o= X-Received: by 2002:a05:600c:4f0d:b0:40b:5e22:95d with SMTP id l13-20020a05600c4f0d00b0040b5e22095dmr187662wmq.76.1701389693826; Thu, 30 Nov 2023 16:14:53 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g16-20020a05600c4ed000b0040b47c53610sm3535457wmq.14.2023.11.30.16.14.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:14:53 -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 v2 05/12] net: phy: at803x: move specific DT option for at8031 to specific probe Date: Fri, 1 Dec 2023 01:14:15 +0100 Message-Id: <20231201001423.20989-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231201001423.20989-1-ansuelsmth@gmail.com> References: <20231201001423.20989-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]); Thu, 30 Nov 2023 16:15:31 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784036452212383048 X-GMAIL-MSGID: 1784036452212383048 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 Fri Dec 1 00:14: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: 172182 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp776111vqy; Thu, 30 Nov 2023 16:15:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3y+QSvOBxZI4JX5718jEMVBqmvLpRKWw5JI4rcvsSjtfCIQtRVkLkWSBYrxE1dkrCkhJE X-Received: by 2002:a05:6a21:150b:b0:148:f952:552b with SMTP id nq11-20020a056a21150b00b00148f952552bmr31630616pzb.51.1701389728917; Thu, 30 Nov 2023 16:15:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701389728; cv=none; d=google.com; s=arc-20160816; b=CdamaVscJAz5MeOAZ97BH/BCsljmevyNyerlIjZjcK6LsX/XqD7k4eYOrV4P6GeDSW 4zMVsWENMeuwGkNbnLpqVkQpfpj+8Ei3XqFbMkhBQLqElefbfstcHWK5Oi0zwSxzo1jZ w7agiQ6wvN6cSTvk0cO9pYcBTDV8/jL7cj89nGI1RSIk37FjNftHsSDCsiVusZ1DeNOv F+C0jnGLpm2A5FvnFSPv2eG5xaj+TiWRbQGTFjCH9i5uCWnFxLvmGV+v5BDkE1NwzlmB qxa0D4A+MES1LovzfrRsux/qHv1vgFGZZnEBjKIdHV7BR0VWedDMdCkxo+eTMK2yxTxD FbFA== 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=UtJoPBjW5rnAlurZq2lS+01nGhFNdESFfyXMasseLeU=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=r0B+TH5TPRhahqjbDFWUv6/QjT7pCHgy/cBWoP+JHa8LgMuQZgfGcXj0zAeESUXWtU nnL+gCjN4/g/HDjckYjtyCw2yiyWkHRbiLBOwThup4gRzecO6ODf0RfK6P+HfFV2EuEQ n1zO5YsDkvDqOsSZ1+sltNrGmjnQEW6ggSitLf9V464pyaoGGuoLvOaBXRSykv0ynCvg XSTQUtaNFODhugKsTyKTDjqC0ohfS4O1lX7T1wwujJViONdQBu830DcXHx0XwZK+GTRk YqBrehaTnU0hoW5PWOY+cQnUkoMmbGN8tvymD9TUr94RKuOL1tZtxA69mVhFSLony6VQ n73Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FB0oQb9m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id z27-20020a630a5b000000b005bdf5961646si2214532pgk.268.2023.11.30.16.15.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:15:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FB0oQb9m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id AE9FF85F6E89; Thu, 30 Nov 2023 16:15:22 -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 S1377457AbjLAAPG (ORCPT + 99 others); Thu, 30 Nov 2023 19:15:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377445AbjLAAPB (ORCPT ); Thu, 30 Nov 2023 19:15:01 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 786CD170B; Thu, 30 Nov 2023 16:14:56 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40838915cecso14649305e9.2; Thu, 30 Nov 2023 16:14:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701389695; x=1701994495; 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=UtJoPBjW5rnAlurZq2lS+01nGhFNdESFfyXMasseLeU=; b=FB0oQb9mVqUxKEVx96/3Qm3mtA1Y5bC7DPqP8yRdIO9kQDCRy6dm/qQl8x0T4XUlD5 EE8PJnVJgM/nEO31NVeq1FfPH713Tpk+JATlggS1vCdKlxPF+2tK7YcufyG9gJZD9zv6 2jnB2WYxT6CG8mqb0MjlCkgIXJ5kLRhqTt+Oqacx3KzixSNdD5PqyxHS60jNiifjQ06Q c2mM6iyoAZwHIpCxz17DjqTAtJ9wO1Hbsvn5Ns/sENw9EURxHO3bfZCZEOxOAj/CORTL CuSUWU31lqyJ2CEUodkxEIyerF2ifIK5tBPAVot6GTK656KLnjADRAjbptViz70yyqxz jUVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701389695; x=1701994495; 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=UtJoPBjW5rnAlurZq2lS+01nGhFNdESFfyXMasseLeU=; b=iTVvODyMqkDiQerDJW23HIXegAlcujLTjGEo/qfIX0PXWgMjJAx46vunT3AHfjlTNt KI22Q/25Q4XYI26Q1HLK58J3HRzwHDWFl2AYgx3wXYHPAPPKSiC3tFxxo8LArNEM4Tsb HktWSkN2p964mkPC2nXagY2KJE3gfCRIiphG9ypdoKOQZuW69ymuKwN9+Hbze94KbIvt xmoIp2aNCYeQlLKAJrSnt5OVz6MuLqaIlpepBpB/siDCqmBAYmNHWrWYSprY2is0YWVJ ck4kpbwigVA2FxTgtxSARlxenCy8NgUay0zX8yn1ob8oBATU4iZjAqTz/EImfss5rUU+ tGGQ== X-Gm-Message-State: AOJu0YzainiCBz6WPedGAE1AgsGr37hQkHj6/ZZe2r+XuYaz0j7GFGOg R3HeDdLsLneDCPk4iK8GORg= X-Received: by 2002:a05:600c:2318:b0:40b:5e21:e274 with SMTP id 24-20020a05600c231800b0040b5e21e274mr110188wmo.97.1701389694743; Thu, 30 Nov 2023 16:14:54 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g16-20020a05600c4ed000b0040b47c53610sm3535457wmq.14.2023.11.30.16.14.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:14:54 -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 v2 06/12] net: phy: at803x: move specific at8031 probe mode check to dedicated probe Date: Fri, 1 Dec 2023 01:14:16 +0100 Message-Id: <20231201001423.20989-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231201001423.20989-1-ansuelsmth@gmail.com> References: <20231201001423.20989-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 30 Nov 2023 16:15:22 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784036436333252873 X-GMAIL-MSGID: 1784036436333252873 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 Fri Dec 1 00:14: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: 172188 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp776484vqy; Thu, 30 Nov 2023 16:16:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IFktF67MIXdndirlewGGKuSY1a2Ch660WO6Mg1pFFXgBydPXDCxNlNVVI8pUARC6GSfHhdw X-Received: by 2002:a05:6a20:438a:b0:18a:e176:5283 with SMTP id i10-20020a056a20438a00b0018ae1765283mr23997611pzl.39.1701389772273; Thu, 30 Nov 2023 16:16:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701389772; cv=none; d=google.com; s=arc-20160816; b=b6+kICt0N75rAKaQZj2LCloqS8DHrTauKf08cvW6S28pSJZLCo+Ny3wrFGSzKgOVpv 6tEM7OK8ly9c8aGGFMC/TsIBaPcDUB0e52D/vzfIxdQe2/R43gTKtNl49jB94YX396Dg xHj3ZvUFnMs+JcQyajT001lp2C5kCnVw7Ni9BWY9Yeu/KGwer/ViEEpHEjUElfb3a4S8 +y9s9kHfm+7ZnGQYrY61hIieTrUTs1w9FHdsqnIkHj/0GbypQubis8um0MxlZYS+pJMU 40JyoSe60TE7KU8dcd/Q493czpZln9UU8Fipbn4AG9pBqjoCQR6WjLt6s9CR4ZB1dpxV sAWg== 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=VyfugPgXL8moAZoSDe7LFzttEirMMzMWF2wGXHc3eNQ=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=ph1XesrVgLZ5VH9E1CxJXuiEXForahcLzZjzfRL0nLMqpQt3QEcrIS3VrGTSXV/iDg sHIWFZT3CkpHNPQ1k+n+VzfDhQOG4RsAVDnrn220PMoVmh/lY7FsZhibkQlvzbebX6Z5 y/14PeK2+ogAETDbCiVKfhhZ9S8dHWwZysH4teiEXx8HkpWzoVWh86c10yoZCEfS/srn BK/hwg5/eKFB5SsCFwsdoO/wR1UvY0CxyMMN/lf8+lsqnTYDtS5XjRYG9akCkcFgOJXr bE++/3Tpo5YIl2tB5Udgzznjnl+yanRPt1Mwky0/43atnB+uar7zJKU9E0GkALHtDQ4P k2fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=I92BYbQt; 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 t2-20020a63f342000000b005b92d41764dsi2183330pgj.794.2023.11.30.16.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:16:12 -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=I92BYbQt; 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 006478098EA5; Thu, 30 Nov 2023 16:15:47 -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 S1377474AbjLAAPJ (ORCPT + 99 others); Thu, 30 Nov 2023 19:15:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377393AbjLAAPC (ORCPT ); Thu, 30 Nov 2023 19:15:02 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9A3C1711; Thu, 30 Nov 2023 16:14:57 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-3316a4bc37dso1371376f8f.2; Thu, 30 Nov 2023 16:14:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701389696; x=1701994496; 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=VyfugPgXL8moAZoSDe7LFzttEirMMzMWF2wGXHc3eNQ=; b=I92BYbQt11nmjugpTzr3xobap8MLBZXQFFi1Q/krW0HrQmXDYYapjYX9PR+Mnva6GV wuoXvyZwAbKlYC9s74DUEGNDZTa8KXOkS82HWNg/nSbZd4HsBpktgjNm4IPg3670jsCo JVMht8AEmTU+tfFYmdgGP25K8ApD+EhW/Nm7UhpFsZwophh5K4GCGuvqoUfBEJcWFxpg ZjJkxXOUr1AeCrMIrt963U+kLB2k4YsT1drQossEWd7FdLkeE2J+In+Tmj6TaUZtTsmA rWcfaziay5HrK1sU/cCMpcDuKY5e4m3lG6ZA1dFYSiZUED3BN2HmFDN/lUjGdPhO1uzB Iwcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701389696; x=1701994496; 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=VyfugPgXL8moAZoSDe7LFzttEirMMzMWF2wGXHc3eNQ=; b=mMkV/8tgIpvlicSIbMWqoh2YjCNgiyQAhnbdqcyGeT41oVz9G4OX+sgPHWyMxKAZ/b Bz5aO+snsfAl0r+e2eZhbaZgRQVIb393A3NdsWzlpMGUlLUDcU37bt6FV1mTU5dlUbJ1 z++Z2Qdr38KMPzADHDQ5myehQFs2b00wSlK3uhZqBnCo9jZ2LMKSmyiE/MguFjZBeoaT To5LzaFj3bPGxyym8+hVocm1YeDLwZgsC+AfAhAQbqkoBz4RQ2a1A5TOTXzVZ7MwSNDP UKKKyQakrBjY8DuzkDlYSJI7/J96ssvOgeVQRuRcl/xhg0zhS0NhtsgeN4XWFKRvkjCN GqDw== X-Gm-Message-State: AOJu0YznwwXdKgnT21plvZ4cmylbEmEOHqiy0r6rRL6iAhyJvk9oBXif qWoNpW++QF1zyUsFZD8KVfE= X-Received: by 2002:adf:a195:0:b0:333:2fd2:4ae0 with SMTP id u21-20020adfa195000000b003332fd24ae0mr225872wru.92.1701389695912; Thu, 30 Nov 2023 16:14:55 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g16-20020a05600c4ed000b0040b47c53610sm3535457wmq.14.2023.11.30.16.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:14:55 -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 v2 07/12] net: phy: at803x: move specific at8031 config_init to dedicated function Date: Fri, 1 Dec 2023 01:14:17 +0100 Message-Id: <20231201001423.20989-8-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231201001423.20989-1-ansuelsmth@gmail.com> References: <20231201001423.20989-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]); Thu, 30 Nov 2023 16:15:48 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784036481596601108 X-GMAIL-MSGID: 1784036481596601108 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 Fri Dec 1 00:14: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: 172189 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp776528vqy; Thu, 30 Nov 2023 16:16:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGjz2DbMlTh2P6vJMJIG4TrxddcVeJsgxvPmwXMRjeqWP5DrlB44yXTaX1QMrejL++ItIDc X-Received: by 2002:a05:6a20:3c9f:b0:187:e3a5:b35d with SMTP id b31-20020a056a203c9f00b00187e3a5b35dmr30249918pzj.13.1701389777326; Thu, 30 Nov 2023 16:16:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701389777; cv=none; d=google.com; s=arc-20160816; b=siTcCKH+z32lTGpl08Ve915u68IW3SAXuZkG5ESFmWqu5VjiSIbUiNAkHe/DCLkrHk GLs/KYYmggGJnZU3mrjLion8rvXe3+j9XPbPqsp6diRHSm6qZbsxPtU+bOy91Oi25zNb R4w68DCoXdHPI0bcpik/rWKtC/thM/PcIdLxtFZsjTdH5jGGwuiGbrT+Lv4x1jjd3+wg bKWk2hJxprvp25UUA05gmeZCVhNqjDzgfg75GFEpAtANLry9y7cGoJz6ZknaUIw3N9mW MOzfLS5t0lPrLZLFloqteUybIU2UjZcLGGkjDMfuqCprE37kteaCJwLOwSzxqpiTj2gl 3IeQ== 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=Pzfe/KMAv9Y7t5s3wWNixWy1/EaRQiLJFlbKHwsePMWRxqY98OywqP85A74eRut55o 3wtSCQH8b5iOgA73G9eWQ1hHcp/I+/i8sMg92WOEddOIze85D+HShc4oWMftmTWy+VHn /L3WOEPh4ypGR1CuvkttodOoLHs6V48hA7SPQ3gIDDozE0UrSSpibGlu1TMPxbxgs8XR dCh6+tXQyKOCNsgybMoMAj0H9li3g0RVsVVc+plGc10uGVh05RR54QtCHz18zpDgCowP a868A4P53WaRW6E0wNfiYEBAFVIlHoH6bpTYzewzfI6Gqnd2bBSjO451+/qnaRAe5wSr q9BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GovzP+pz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id s38-20020a056a0017a600b006cd8cabde34si2325998pfg.71.2023.11.30.16.16.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:16:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GovzP+pz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 29B7880F6D16; Thu, 30 Nov 2023 16:16:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377411AbjLAAPO (ORCPT + 99 others); Thu, 30 Nov 2023 19:15:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377416AbjLAAPC (ORCPT ); Thu, 30 Nov 2023 19:15:02 -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 8FFCE1713; Thu, 30 Nov 2023 16:14:58 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40b474c925bso11565075e9.3; Thu, 30 Nov 2023 16:14:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701389697; x=1701994497; 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=GovzP+pz0W2rx7ANrQQ4VMX3XgKrw74AF64oBej8McdvMoNfjfXa8xIXyVZVYZgsm6 98QjPBaLEykVUKjZzgdlgOlTQ+4ut1jttbgxySpbLtuEGc6E32XolJUQoV/B5p4t6zVc lk/J251gNAJgGxSC1j0aSqxWwhur7qzEe4LiZt1iqwwlh2BESzHsxPoQpaNh7YfPSHA4 MGFSoVJLSFIrqvZmz3eTeWjJT7c5F2kvMRwYeUV/I9ZZjhGFmtOfc/Whb2r+vD2XCqWz mVbI1qkCvqVLOjDDbUZ7ltiOakOClAryd8vRxCTBPIaDCccLTpRXtkuE17teFAwaNO9P V/Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701389697; x=1701994497; 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=vdj+zSUNBvsGOLEuR9bfKwl3mX1T1vmxJa/aMZq18FfvztuGWnwmBQiOKcnPW6/s+j cTuE2oCPwEkxZLoAn9f4jLrGNZjjj29761/kioNu6do5KTwp63rdhmMrCLOM5V8fK1C6 Zr9w9UJK6T5Q+AR4gaKxUeedHPmb+ZwM/qf1kFDk0LzZxFlviYd/O23bPwq7bSzS5gUt a7+5ilmcm0JqNVwfWshgheYArwUa41gDERxqV9NZhj1NxBgGwXOQViDlwpq1EAygH/4h aO9VjtYfR3E//KaJWEVbHcYR8aXpM7hsNL1lxV5l8/Mvo0Q9EpakndB1QspIceN8ZcfV sX2A== X-Gm-Message-State: AOJu0Yw8Y9mctAZ9OB76fWCs1i7AumW+26rfQX5R1cWu2nI0JMuuMQqS NL63z3Rs8H7F6FG/qRLbC4eq8a/t2mQ= X-Received: by 2002:a1c:7c0d:0:b0:40b:5e59:b7c5 with SMTP id x13-20020a1c7c0d000000b0040b5e59b7c5mr129344wmc.162.1701389696941; Thu, 30 Nov 2023 16:14:56 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g16-20020a05600c4ed000b0040b47c53610sm3535457wmq.14.2023.11.30.16.14.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:14:56 -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 v2 08/12] net: phy: at803x: move specific at8031 WOL bits to dedicated function Date: Fri, 1 Dec 2023 01:14:18 +0100 Message-Id: <20231201001423.20989-9-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231201001423.20989-1-ansuelsmth@gmail.com> References: <20231201001423.20989-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 30 Nov 2023 16:16:08 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784036486926115767 X-GMAIL-MSGID: 1784036486926115767 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 Fri Dec 1 00:14: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: 172186 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp776417vqy; Thu, 30 Nov 2023 16:16:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHm1zDiTvpZZ7oFT8C6EcZi6TcKGw23YEYLcXMZTAV1FYqm2Y+9aQie5Fz9JKuRVdDV9U9 X-Received: by 2002:a17:90b:1d8c:b0:285:b7b9:dcd4 with SMTP id pf12-20020a17090b1d8c00b00285b7b9dcd4mr19489914pjb.16.1701389764530; Thu, 30 Nov 2023 16:16:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701389764; cv=none; d=google.com; s=arc-20160816; b=aedyJ5JFCzYhbdAtlkfB1YrtnCC5IufsvzR7oZZuTxoRhJk8wlM5pq2tOplPHfPMBW A9uquPKZJl6l0Bfe/tLcxy/Qkr1rbkzJC4DBc5xKgaAJCIGoQDfLtc7+BFwUNZ2vFR4m /wBV0yaC7L1hhWwbfBEQP4R6aH/CKyhT5vCQpHYEaA/48FNEeF59vnHSK7Vhht4GCrbt 6HYbcpdoFyAe7tYC2RWKWLDuiokzxEtcODQWQMGUefsfLASR26+fjg5tL8IsiYedWJSw Z45Dj4hd0pk3hdZzzxgdQ6J/oGe4A5J17DvYux1nKl1U7in7bzCvvg39SDr6ihJt8I5X G3HQ== 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=ulC3rTz4GOx4oR026AGKXuN1cHvk5x1HTfMqCQFkz7RTDozpOZ4WkryoW7elYeBr5p qJ4fHNdRU/WpFRxugjbys8RA2+jyyoy5r5/WUAb+ZDUhTAPJhfpHsnJtMl/nUqufmfln mPe6Ot5uCtsrag65jV7D5huWtMB//e/aRHlQNc3Nnhp1ecz4QptHISxXypwWueUOf5Y9 0OFYfE7xeoPuaKkqdZqVmMX0DtTdMxyjEq7SJFtsbd6Pa3KGeBTL71M3jTgQbfnCxBRc 31CWTIBV/xAt0dlKIBKD20/osNhtQxyHq+7SEd9dNN/UbFmEDPQ6ohDkemSAcrV+k4S6 nobw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BY6FVuHh; 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 oe8-20020a17090b394800b002858a291a45si2518935pjb.141.2023.11.30.16.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:16:04 -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=BY6FVuHh; 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 A8FAE807E420; Thu, 30 Nov 2023 16:15:31 -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 S1377495AbjLAAPR (ORCPT + 99 others); Thu, 30 Nov 2023 19:15:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377447AbjLAAPD (ORCPT ); Thu, 30 Nov 2023 19:15:03 -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 9CEC41722; Thu, 30 Nov 2023 16:14:59 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-40b2ddab817so14657935e9.3; Thu, 30 Nov 2023 16:14:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701389698; x=1701994498; 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=BY6FVuHhiIpA1VGHZ1mmqCF8dsAlNTB2kwvzy0oWO6K8Z/dcl+iRSlkLVPkkssEuns L055R9M91icT9YeBXqgdk/EOI+e1gHvAxVa08YshdeoexvF4XAes4JlNb9OkX7EtIi3+ FusEWBAbRgwtI3zn7E4cJd5p9hnC9QS7evrhpSmCHs9Xxm6M5tBj/tAfn57Md6qUmpQD 0gwFy0nkHaabq+/gJnkT49R0d5mXG3fBHMSKATgBshJ09gk9fD8dwej5Z0giKgdwoxRV gH6i979byCbAsLmb8ByQKAlePmwPKZnW2a3SJszcXsRBQQFPdNbZXyLw3qZzL0wuCt34 T3UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701389698; x=1701994498; 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=vAqVmHffckItnsIfK58RfNh70AkJVKi+N4fFHAEyrfors9Mm5nAsVt7rsIhgDyyySj 0x1M/NMQuNOtkkK2mFv9WN4tv9WEyLR2H6UU56DLOJe6T0So5Z5JKqpmDWxfT3iWF/vi YjYVHnhVpmWtfmntKAMaLPRekGFO4vwERc5Szz/4Rn5HpCcBt78FtWddLRq5mfoDJ0ID ihTdNAWBtKcWVB4F4SZY69Az6zX+9tIlAzZzsSqNapjWyAUzaJ6RC3cNEY5xJwZLsMr9 EBxaMhRz+Sc4l0hHR998XO7X2qdG+GXOO68AxLeDJp8I30Sw5xPO0Yc/ZlzU9IeDvywB QTSw== X-Gm-Message-State: AOJu0YxvVHesz6X5Bd2RAmEXGadviqws+MK+WSvzKZI3GpEonXoIffNw leQ82hYkh+oS/x7J6UJUl9TDOuxnoGw= X-Received: by 2002:a7b:c3d9:0:b0:40b:5e59:da9a with SMTP id t25-20020a7bc3d9000000b0040b5e59da9amr108816wmj.173.1701389697891; Thu, 30 Nov 2023 16:14:57 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g16-20020a05600c4ed000b0040b47c53610sm3535457wmq.14.2023.11.30.16.14.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:14:57 -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 v2 09/12] net: phy: at803x: move specific at8031 config_intr to dedicated function Date: Fri, 1 Dec 2023 01:14:19 +0100 Message-Id: <20231201001423.20989-10-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231201001423.20989-1-ansuelsmth@gmail.com> References: <20231201001423.20989-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]); Thu, 30 Nov 2023 16:15:31 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784036473309865477 X-GMAIL-MSGID: 1784036473309865477 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 Fri Dec 1 00:14: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: 172190 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp776709vqy; Thu, 30 Nov 2023 16:16:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IEmF961Ew3Rt0vIJXYxVbxoYJ1AVdKsozTz7PCaaJyx0bDoMw8twfvyw8KVUBJSGsTAJ+f5 X-Received: by 2002:a05:6a20:4419:b0:187:4ee0:e95e with SMTP id ce25-20020a056a20441900b001874ee0e95emr26671402pzb.52.1701389797426; Thu, 30 Nov 2023 16:16:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701389797; cv=none; d=google.com; s=arc-20160816; b=lMK7owfxJttsf1DKwqTAit+rjkIXdsoCjn+/2klgFPsNamoPBy+Pfq/OKJGHbWHwA9 om3Q7mejk//+WUj5mpLpksboqHtz7+WW4tHBxo0C++Q588nq+Gj79ft9aQTIbioe7jEj 4YsLRhb+In+m08pddksTt/leuEUeX/1XBag8tNmWS/ZOvoGzWfc9trqVVsG36r4Kjxja Hjp48eDYhZW+Op8sgche9arCgsCgYhxJSjcpmSoI20n6fDH5v5gpOGZga3r9c7W2PRj0 j4apLE1Sh+k9FDo/GWiQNPw/XnQ0XY9CUM8Jgkc7sUVME1ZZMCywGc45NVNfJpAtFOrN NBdw== 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=xlc394zhfhzVq8aAP75het7E8RUg91LzoOZRny54CvY=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=UXdr7eRW77qDo0nGPOeYMW375NebY0L1ZD57Df0i6gTVWxieGuzgnM8RIbzLf/+JhG Mg2rqFT8Jacloh4HZUrDaqi32K2udh2UpnPkwoLtcYStnLx0CedPxIjLAAx61idPAUii UH/R/wxLc4ojXQvpM4bY9yVXReIP5ud6sBoltfkQ1w0WktyTdR5xPujyvTv8Uq6QTYxG 44sNknpn2Rr1dNDsxtJiz6OflCa+0I/ZrnQwJvbVwEXQnwwbPg9UXDMYO9AK3CPusruW vc8S6SY0d+McDEOjB7kGQHgTfS59/RJmfDU/pkMYA7Mjl6helkstARy4GgVI1UwixmPI Swfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ETpdoLCf; 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 y65-20020a638a44000000b005ac8d44bad4si2221185pgd.592.2023.11.30.16.16.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:16:37 -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=ETpdoLCf; 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 B6ACE85BF2FC; Thu, 30 Nov 2023 16:16:22 -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 S1377501AbjLAAPV (ORCPT + 99 others); Thu, 30 Nov 2023 19:15:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377443AbjLAAPE (ORCPT ); Thu, 30 Nov 2023 19:15:04 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CE431729; Thu, 30 Nov 2023 16:15:00 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40b538d5c4eso11652535e9.1; Thu, 30 Nov 2023 16:15:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701389699; x=1701994499; 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=xlc394zhfhzVq8aAP75het7E8RUg91LzoOZRny54CvY=; b=ETpdoLCfgi8S+/R23XPUatPQz+jto6TXmohgozLiX9wwQ+ahb1iZT+D8ZYHqGGUCH4 z4MmxMhcS9c7RNvAqYCCqAP8NiVOUqLg9LNKTG4d3CVTcU6FZBi6T4QbprkBiDqHaFpj k3BvFUm6dwA9m1XBIZVZmiJyq7YzVovy9HWBTGiGA8h2c9Rz3c6C/ZZLCsbYu0TObsuI GJLiD64LzDjbGQX6gDmgZUZ2Lf5NYxZIohe7dzS97Q0FdhUyz4tYAntZT3ujFjFS3dI5 hzgbQWqSpMWzbDwQpVatN+N29A7WpMEzZc72gHDOQmSaonB4QiTEtrzJf1iEblaqmtUu uABA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701389699; x=1701994499; 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=xlc394zhfhzVq8aAP75het7E8RUg91LzoOZRny54CvY=; b=fw5fl+JwqNv0DbV+u/rengw1NRUu8qCFUIGqsgaxj6GhfH/g/7bIIsDYgnRGDrVa7U iWvoYMMpqzOw3kElON4rhg0gPuVExGy/xHs+Ep6CSkS5ALbw5JwfWLyWvpXypT27+ObJ AYcd3vs94d+APMTH8hg+fuVuZMeOM3HdNv2Zxa1dVOAwwTMgLd4g6Ua1q87PfpXRA3VQ gCDIcZGPuP2tLYCGdmufTDF43oOcPTJMGdLxPCpuxqMOQBR6CZDMEmQui8PiEv2NFW2G x50JrkGWp+hj4MGDNSjsYL9NVmeDzdo4zMWUT+7+iKeG/z2V1lyUuonICJWy6eMoTSVp k8gw== X-Gm-Message-State: AOJu0YzBOIGIKzH5C6C3ePVZTyVZmQtcUSSonIS9k+g3qNt/J2EpuqPD iGYp2XbOS+b1Lkha/aGgcSeICDPvmDE= X-Received: by 2002:a7b:cd92:0:b0:40b:5e59:b7a5 with SMTP id y18-20020a7bcd92000000b0040b5e59b7a5mr114394wmj.130.1701389698798; Thu, 30 Nov 2023 16:14:58 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g16-20020a05600c4ed000b0040b47c53610sm3535457wmq.14.2023.11.30.16.14.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:14:58 -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 v2 10/12] net: phy: at803x: make at8031 related DT functions name more specific Date: Fri, 1 Dec 2023 01:14:20 +0100 Message-Id: <20231201001423.20989-11-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231201001423.20989-1-ansuelsmth@gmail.com> References: <20231201001423.20989-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 30 Nov 2023 16:16:22 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784036508313896002 X-GMAIL-MSGID: 1784036508313896002 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 | 268 +++++++++++++++++++-------------------- 1 file changed, 134 insertions(+), 134 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 1897030667d9..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 at803x_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 at803x_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 = at803x_rgmii_reg_set_voltage_sel, - .get_voltage_sel = at803x_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 at803x_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 at803x_sfp_ops = { - .attach = phy_sfp_attach, - .detach = phy_sfp_detach, - .module_insert = at803x_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; @@ -1519,7 +1519,7 @@ static int at8031_parse_dt(struct phy_device *phydev) } /* Only AR8031/8033 support 1000Base-X for SFP modules */ - return phy_sfp_probe(phydev, &at803x_sfp_ops); + return phy_sfp_probe(phydev, &at8031_sfp_ops); } static int at8031_probe(struct phy_device *phydev) From patchwork Fri Dec 1 00:14: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: 172185 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp776379vqy; Thu, 30 Nov 2023 16:16:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IELeukQZLcumZXt2SxeoBTMe4GnYfGuxgtnURzz0UavRqAEoxcj9Yeo8EF3aa3A9oudH/6N X-Received: by 2002:a17:90a:1910:b0:281:d55:6fe8 with SMTP id 16-20020a17090a191000b002810d556fe8mr19501743pjg.24.1701389760998; Thu, 30 Nov 2023 16:16:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701389760; cv=none; d=google.com; s=arc-20160816; b=rAzDaCOyC8UMiGLBHzmPIzsyX8oCcWpolGCrstH8/fXtdUBn6nl4utCPKJzWWUjWwx HMGVpo/8TaW9FNcc2svFcTwg0RhILF7z+NdZ+Kvh9RIDmwIIw6l4F/Kz1Yj/OaGZMkb3 Q5EDd6BQKUkCIgkBmKH4xafpZeqxdFsjpJ0BWBXxpwYTYiuZhQp7Oxj2UbqRiGbE5DNq ld2CMlqV1yogYMIDnNbz7F+SrwQeKQamKLk0ZvsiwNRuvexIqL2n4ZPvTu5HxAASHzoC GMUX3J9KMPsJ9Wi4GiW9Tzd9do+ipvJhFTp7WGCjNq7etmeVQoxK+2EK166fB5LPgrkG RZSA== 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=i12Gu+wY1CypxJPzomZzPt1KEPWiDTFBh+rmjVLvo38=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=fxKa52+Zk4NQAT16HxzDqNBYOvx3Na7hOmB0M+5R4EWgdx0T5jliMkUU6vqrxQwIR3 m2gIiawSfyqffJKYPiRq6dP8PnzaxtxTS+5JsgtK8erzDQ4z7U0HUX/boW9WxBfq70ka cm1N4iYE6UpXR2qqvZBiScLWXVs7rGQ6l1YR2uGuE9gdZjeAMa4xXakoRmLX1VCnr6k1 C9kqFZiOwU0pUpEXDCprDE4BS859f0yVGwblMJdq0ROBm8YXHDYcYfqBM3U5X5CSxP+H VIBwD9PenD21sZjX3L/fqXnBt6j0G146eDRVCU0h5z7ZUt1E0RuYeFLntTY729+E+0Qs 7bQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bT3b7giL; 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 sm15-20020a17090b2e4f00b002839aba9d89si2580902pjb.25.2023.11.30.16.16.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:16:00 -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=bT3b7giL; 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 F32AC8061B46; Thu, 30 Nov 2023 16:15:40 -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 S1377525AbjLAAPb (ORCPT + 99 others); Thu, 30 Nov 2023 19:15:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377466AbjLAAPJ (ORCPT ); Thu, 30 Nov 2023 19:15:09 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDCB11981; Thu, 30 Nov 2023 16:15:01 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-333308c3683so131198f8f.3; Thu, 30 Nov 2023 16:15:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701389700; x=1701994500; 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=i12Gu+wY1CypxJPzomZzPt1KEPWiDTFBh+rmjVLvo38=; b=bT3b7giLwZKBWt200a+53yO984RsbHnFC4N+s2Eh/tR+xviHSbC57cZ8OpuXZ1wSA+ 8KaIx4BQqTdiCUitQciHfXc6wkBy0r5w17lyXU0gmMA+dJGyfG1gH7sNDjZMN5fP8/MN /iDLd9IFMIBFGuVkRXzHdsiMeCRidRMYnqtzTMTTKKgcX9UmEx4VfV7zKPWSmAO8nBtB BUQADlN/MJ1hXzFZjhWgwIvaI8uOplQGm41WbCqzmrxUl/BWmLJEAitVkvaJn2IYNjHZ RpczfCwPLSbhxjqfacSDti9RrLPy+zIlo4N16fcKcfcD/kAGUBAjFCNXMX1LZsCt9dZt 82IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701389700; x=1701994500; 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=i12Gu+wY1CypxJPzomZzPt1KEPWiDTFBh+rmjVLvo38=; b=ms8h2pSwWFQl0uEahISUe4CZnYW1lYgxjnrc+/MbdiVeakJ5ySFafbMibhCiGvzbqi WMwkA1mvX4hUDtRCYKha0sNxH8a8xuDSZpumuWzi9au6sQ/eEpgIKBeu13lqvLnzW6/T L8bwgMDmqn/QBGoFny1W7il1FJPehos7yNcyv4yTveNpwOnaOliEskwAUhNeQ5XYJppk ZIH8LZ0aMav6h6xXqNRTcM0aIe6OB4zY5Gqi51Kyu6CwMWZBQL1JITSWpRcgarFZFpHW iZ+6JUrWxaPocwBXPkMblso6HdRr+T2LOAgRRWIq4ZyceWY+wNgK+9gfe/fmZ4vtr4L4 c1xg== X-Gm-Message-State: AOJu0YxEej46lcIpM7V1S3aturIn1eWnJd3NIrqel7lOKU+a9uvdI4F/ M7GzUD7d64GYPz368f3zL40= X-Received: by 2002:a5d:484b:0:b0:333:1a1c:50f5 with SMTP id n11-20020a5d484b000000b003331a1c50f5mr135853wrs.62.1701389699724; Thu, 30 Nov 2023 16:14:59 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g16-20020a05600c4ed000b0040b47c53610sm3535457wmq.14.2023.11.30.16.14.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:14:59 -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 v2 11/12] net: phy: at803x: move at8035 specific DT parse to dedicated probe Date: Fri, 1 Dec 2023 01:14:21 +0100 Message-Id: <20231201001423.20989-12-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231201001423.20989-1-ansuelsmth@gmail.com> References: <20231201001423.20989-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]); Thu, 30 Nov 2023 16:15:41 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784036469621882454 X-GMAIL-MSGID: 1784036469621882454 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 Fri Dec 1 00:14: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: 172187 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp776420vqy; Thu, 30 Nov 2023 16:16:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHsFqhIS9IkEltPS6XaczADD5emY/XrWKDImKHBhwoU8f2OgmeywAtIrDd3V+YreAV++MEP X-Received: by 2002:a05:6a20:2445:b0:187:f7d3:fe4 with SMTP id t5-20020a056a20244500b00187f7d30fe4mr25805190pzc.11.1701389765010; Thu, 30 Nov 2023 16:16:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701389764; cv=none; d=google.com; s=arc-20160816; b=FYaWZasaW+RQSH5xd93AvsGE4M/bfYJViwpA0kcuSd7B+kF9VOgHAdK2NWniCCg+hU G1yadIJ+bNkP9jyxdSxIubDqE9GpPXOZTzxmLOFskdg7Lo6iCs6NWzF0nbjUaXNh02NJ 4NKAIwGKNpJ8Y3Ho+1p7UJIL9xumol/QCEQ2d2gqdkgBH/AkrlDXS5TphadWC1s8Fo8H TNcAWsnFAG9avyPuOwarqIvbhP5mPtVEYUhToabxTGB0K/MDT16QzHsQ3v6YMIhz25BB YHPFof2D9FDukcqKyCAEK4HJa/W1/Fj+o8lAKOeqKKFt3yBTPsEq192HcKSk+Lww4pAV aWLA== 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=o0La5H0sjddNIq/VvoGQu8ZG94GEUi31ycq7n/iZy+E=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=uc952lpeV9x0EqUXiHTI8xvTz6PgRRnCb2zClvTVlNBkBaLIezHAixvAdpLXlstTvU 8rp6oh5nsRFrjcplhTiJS+fMd4RuaoOhYziH5jdtRJp8m78d3Ax5hpl7jkfHeMEFSSLm blXsahSdlm3BPYP1CBuiFNP6HDOUY4kUbL/kdwD4uYi9i4fBI6WRmAaOeuRIKeytRgoj Ba1GizSQAFnMjAWmXHYCHYOg6pcIqO4dOGyuvv14mxZqIPqsdHhjEO3HPX/p4SUZ/oL6 ZKlKBuB+b2EbFALCEVzCAAyi0PJZ9goaFPBA6ZUor65OtDV4UMpAl+H3xOEguOD1JAJI hydQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jq3pdT26; 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 r16-20020a6560d0000000b005c16f07b3e6si2224409pgv.164.2023.11.30.16.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:16:04 -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=jq3pdT26; 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 A3DB080A9AAC; Thu, 30 Nov 2023 16:15:55 -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 S1377457AbjLAAPp (ORCPT + 99 others); Thu, 30 Nov 2023 19:15:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377440AbjLAAPK (ORCPT ); Thu, 30 Nov 2023 19:15:10 -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 83CD8199D; Thu, 30 Nov 2023 16:15:03 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40b595bf5d2so11459665e9.2; Thu, 30 Nov 2023 16:15:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701389701; x=1701994501; 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=o0La5H0sjddNIq/VvoGQu8ZG94GEUi31ycq7n/iZy+E=; b=jq3pdT26z2bx314KexihN4nYi1TPpZWhkt4N2MrvzQsTpb3RHq7zC7YjAdJEyDki4c t3HPOwJ3s/pcyTFykSrq9sKTRzcYIr/IVau4Pg93D8qCZUTm03wh/NO84peUKS66dQ/g ApqoyVPRCPeOc64RPLkrHOE184JQDYTI+2//ztBRw3kEKKlzeupQlEfx6GOq6bqZktOE OwFQ3UDP2VHrf5HW1Lzbp/L6+RBhMcXHHbEMEs1MMnMU70I9YdXMfzpAuRiKCoCywKmf Msl4cDWu6zly+r2tG7w/JMc0K6J8VUYJiXoE9PDkPVOSyTh+rZy9V3vNPGNNXZJAn8CP 9Nfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701389701; x=1701994501; 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=o0La5H0sjddNIq/VvoGQu8ZG94GEUi31ycq7n/iZy+E=; b=RNS65/RNPCYsE/A2Ab5FEJJIcbToxRVX/fN5b5HWi8qzoBUUj+6cCMuxaxfqwjVBkU ShAET4jBSlVrTwKiuV1qFP0pt/4bs9acng2JBarqNbSautnluPOTB0pavaLhph/WpbYQ ZSNz7NAg7vkvPcvqS+TaaeSh137L75+GPb1jbm7mKK8ZeneAYAw4fCevsVFUULC89cAg 8A/rVXe7s0IKM39iwqD6Lz2mZ0MjhiP6s29ZFqhDj8GiGE6r0845vTmuMHT86+BI8iFD 7wj5bizgVaOLakIAYryc45djUWkUAW9DklPBybHlARvwMUGG0G78NVOI2sPB2DLRQxcU D9yQ== X-Gm-Message-State: AOJu0YwfQ09at8pmew4Z+xefIUkZWYdGBLZd2Vlju0EYa/aCq5k+zfeO j83z4RO+RWvXlMql0yzrn6w= X-Received: by 2002:a05:600c:46c9:b0:40b:3faa:c964 with SMTP id q9-20020a05600c46c900b0040b3faac964mr81262wmo.27.1701389701515; Thu, 30 Nov 2023 16:15:01 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g16-20020a05600c4ed000b0040b47c53610sm3535457wmq.14.2023.11.30.16.15.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:15:01 -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 v2 12/12] net: phy: at803x: drop specific PHY id check from cable test functions Date: Fri, 1 Dec 2023 01:14:23 +0100 Message-Id: <20231201001423.20989-14-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231201001423.20989-1-ansuelsmth@gmail.com> References: <20231201001423.20989-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]); Thu, 30 Nov 2023 16:15:55 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784036473856556134 X-GMAIL-MSGID: 1784036473856556134 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,