From patchwork Fri Dec 9 22:47:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Ray X-Patchwork-Id: 31945 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1029103wrr; Fri, 9 Dec 2022 14:51:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf5d8ESV98MH8a2U5cUc/D1oF/5839LyU3SgL2vS5BUZIYjUIOHf5NI5lym2/Hktc76WuL5/ X-Received: by 2002:a05:6402:4486:b0:46d:53d7:d21e with SMTP id er6-20020a056402448600b0046d53d7d21emr7089639edb.27.1670626274826; Fri, 09 Dec 2022 14:51:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670626274; cv=none; d=google.com; s=arc-20160816; b=OyL3L8NjhdbXecgh4Tz5ZSO6gZWjerS5bPi3YQex776sA52g/dIPe74tnGYbAuuT2+ kA9IR/n+RvdymAAMV3cD0pIryjqESkQZsyzez4+nyuSLA5Lh6cedNHRa4cguiSMek06L FrCrlGIfvKveZjuhcCNXUHYBD3/KdGzEfrydkp7E4c/SDxQlNEe4Ho9CYF36z+i4Msx2 XnGsIdKvpKiFl6YlrBxbmvKBTZxIPRdDKSihwbulLdDwB0ipCamqGjP4lwu9lCjNYPpf olJgg3p/1aiydV4EW4RiAsTcVsqd5QR0iTZr/1XWrVZWh/4SDKjnQmYNw1LJPT2+HHFX iA+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=zkOYDWpMQFLKfFpUO9z4FlRfP66s9vbtXWwulfELTV4=; b=0AEdWTqf9pkUCmFX12D9i2eQYeX1SioAhFUyO5C4fZZuV8UJliSdKnGyV/GFgRRdIy IPoZ9Wmni5ZhTZzFmW4ETiYkHiA+Wg/646m4H9FuKDRRFhV6mgBnDBIWaL6hl3NP5GH8 bUIeyBgEVu8nSZHgoU+f83SnawODRkvvkiFbFSjbwDzjDGKi+3QahH/ImOaNF5Z1kQQX hquOD3d8aIQyQ6lx7yPH8+Vh/QeGFyDx1JdSmhxbqDwU+ob1TpYHWkOHbz6cL4cXY6aN CFrr31pq5eV2Vze7clRdzFx3MOlWKdbsl3coti+JLP1pHJJkvWck1bMtjuxF4H8HF6c2 k5Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=d2fDZWAQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a23-20020a056402169700b0046799762e48si2114819edv.437.2022.12.09.14.50.52; Fri, 09 Dec 2022 14:51:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=d2fDZWAQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229932AbiLIWr1 (ORCPT + 99 others); Fri, 9 Dec 2022 17:47:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229626AbiLIWrT (ORCPT ); Fri, 9 Dec 2022 17:47:19 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51EC21C433; Fri, 9 Dec 2022 14:47:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1670626037; x=1702162037; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=br/M5WmvwdwxFySfGnmU52+djJ0iOGc1/k2tY+9cOwU=; b=d2fDZWAQSDLvSzlpy2YM37lyqnwnrz9UDT3tAaQgBJkOf8h7mtsahMdv khd3cNX9hwNq4dpxyDjVu8U0aVWPtoRh7VE9AOxFGFkMYUCt9LMr169d/ RcT4DOLX8PtQx10Qy8ngPVqy0wvkw2AfIO07mFF7gV35TeE+Dy0XthHmA lTPAh7dLatzd/I/bSf+5zaOUkmYmQrBx9tzDLTv2K5hQ+SO00PfeerJbg AGHRNSJ2rXP20hIfwAF61bmOLkfFMIbz9dTR9qEwwa5OmAhtAAMR4pIS6 D5l9o7FqJrWqeeP48Dwh+0XSeaSnqtFXHpAwFUz65cUPOqnkRVAD+hzhM w==; X-IronPort-AV: E=Sophos;i="5.96,232,1665471600"; d="scan'208";a="192458900" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Dec 2022 15:47:17 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 9 Dec 2022 15:47:16 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 9 Dec 2022 15:47:15 -0700 From: Jerry Ray To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , , , , , Jerry Ray Subject: [PATCH net-next v5 1/6] dsa: lan9303: align dsa_switch_ops members Date: Fri, 9 Dec 2022 16:47:08 -0600 Message-ID: <20221209224713.19980-2-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221209224713.19980-1-jerry.ray@microchip.com> References: <20221209224713.19980-1-jerry.ray@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751778616367819652?= X-GMAIL-MSGID: =?utf-8?q?1751778616367819652?= Whitespace preparatory patch, making the dsa_switch_ops table consistent. No code is added or removed. Signed-off-by: Jerry Ray --- v4->v5: changed patch title to be less generic Addressed space-tab issue missed in the initial patch. --- drivers/net/dsa/lan9303-core.c | 38 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 80f07bd20593..5a21fc96d479 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -1280,25 +1280,25 @@ static int lan9303_port_mdb_del(struct dsa_switch *ds, int port, } static const struct dsa_switch_ops lan9303_switch_ops = { - .get_tag_protocol = lan9303_get_tag_protocol, - .setup = lan9303_setup, - .get_strings = lan9303_get_strings, - .phy_read = lan9303_phy_read, - .phy_write = lan9303_phy_write, - .adjust_link = lan9303_adjust_link, - .get_ethtool_stats = lan9303_get_ethtool_stats, - .get_sset_count = lan9303_get_sset_count, - .port_enable = lan9303_port_enable, - .port_disable = lan9303_port_disable, - .port_bridge_join = lan9303_port_bridge_join, - .port_bridge_leave = lan9303_port_bridge_leave, - .port_stp_state_set = lan9303_port_stp_state_set, - .port_fast_age = lan9303_port_fast_age, - .port_fdb_add = lan9303_port_fdb_add, - .port_fdb_del = lan9303_port_fdb_del, - .port_fdb_dump = lan9303_port_fdb_dump, - .port_mdb_add = lan9303_port_mdb_add, - .port_mdb_del = lan9303_port_mdb_del, + .get_tag_protocol = lan9303_get_tag_protocol, + .setup = lan9303_setup, + .get_strings = lan9303_get_strings, + .phy_read = lan9303_phy_read, + .phy_write = lan9303_phy_write, + .adjust_link = lan9303_adjust_link, + .get_ethtool_stats = lan9303_get_ethtool_stats, + .get_sset_count = lan9303_get_sset_count, + .port_enable = lan9303_port_enable, + .port_disable = lan9303_port_disable, + .port_bridge_join = lan9303_port_bridge_join, + .port_bridge_leave = lan9303_port_bridge_leave, + .port_stp_state_set = lan9303_port_stp_state_set, + .port_fast_age = lan9303_port_fast_age, + .port_fdb_add = lan9303_port_fdb_add, + .port_fdb_del = lan9303_port_fdb_del, + .port_fdb_dump = lan9303_port_fdb_dump, + .port_mdb_add = lan9303_port_mdb_add, + .port_mdb_del = lan9303_port_mdb_del, }; static int lan9303_register_switch(struct lan9303 *chip) From patchwork Fri Dec 9 22:47:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Ray X-Patchwork-Id: 31943 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1028888wrr; Fri, 9 Dec 2022 14:50:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf5FtD4stmkkgfweSR4vRozOLMCldBhggTOZUiP9e+/0w3SolPNFvay2xMOo+R/DBpAdKEQ1 X-Received: by 2002:a17:907:8999:b0:7b9:9417:274e with SMTP id rr25-20020a170907899900b007b99417274emr8473927ejc.4.1670626246089; Fri, 09 Dec 2022 14:50:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670626246; cv=none; d=google.com; s=arc-20160816; b=TKdzAfw4xDQkU4Cd1X4fhSCXJ7P6sCB7TXkGRp6lX5vIZngbG0KzBGDE3cdgFrcPeP DsdYMYsN7OfyacAnFRI4jaR9Si9IIau1tpehy2R3mSk7wh6zK11PvmgSUS8iiod3K9Ek 3b/xwvGwLW0u0gHrq2L4u/2h+AiaRpdXSZhuyDJT+zumM0eyiPIA36VAVdn5LK1rcfwM qrGRe09dx9ODlMeUCQnkUApKntkfziYIea4IVm3yR13IbAcTKjQ+/b0EwY5g0DR2VVoT DpMZuk6rkgVQnJfF9xFeWbM6huU2x7xqV3jp6Fx+NPj5eKYDDvJyxtS0A7IFrDW9UQe7 F0Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=eHNZg5/s7ulxsRXkIVG1c/XWvgftct4YyliIS52fQ/s=; b=YFwoOi9QKUz/DSn22F1W0gM0oCbpfCy/NhJwDsOV/cLbqosqCoIdqgdMmzyegeku+K sB1Z/3rlswZkvFxwSvHk2g7k9oPZh6VL3XUEu8efdaOhHzvnXG22jD60jPA1AoanJMMT yDQaoG0K2c0wwlBU3Iuf3hwTv+sT9RqDDYDdV+EG6pCmhJNARi2DRGReU5OM5u7MgJS6 K6qb6TfQokXNC6qQGPRS2J4COMqdzRSwke/RfLvcmEBmqVROscFWsfsoPkrSmfPHoyYI xN/iDJa/JmP0gwm9snfZgu4tRgAoTISWec++VAB/HrE+Vt13axqBmlDNO7N8cSSnnlsM TO3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=HurkNQeA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm10-20020a170907948a00b007809c50fd78si778209ejc.262.2022.12.09.14.50.23; Fri, 09 Dec 2022 14:50:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=HurkNQeA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229942AbiLIWrd (ORCPT + 99 others); Fri, 9 Dec 2022 17:47:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229655AbiLIWrU (ORCPT ); Fri, 9 Dec 2022 17:47:20 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC50121830; Fri, 9 Dec 2022 14:47:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1670626038; x=1702162038; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=NxICK9YEAX5kiUZz9Kaz68Sx6I6kNikV7yxiKfqD0gQ=; b=HurkNQeA64dxssepArH1PUj4sRDrclHXbCxB0zWxyv4mZxIzDwwRDw9H 0h8rqMFLm0oDH3A69YRoRLAwVSi7eQ9u6P2ziT+e1x/a+bSAsun959PCw hgj+0cRtEfAzdAX8d56tXHqxt6NFwD5ya/SEM+NCVE5gyqVPbsYznkTbq LM+tl8jTUJhjpk3SevNVVvRw22r873CjxuLVy7aLkjsAY/i2ZBVjAzQSe VqrutDNVP8Fq1vMGgn0TwWdUGZNw3XJBhco0tmrry41wsUEKP9wlb2xSa UCAaV4zg0FgMavbk7aQ92FW1VqHtpB7DrZJGYGasPVgxxo0/Gk6nKf1yt A==; X-IronPort-AV: E=Sophos;i="5.96,232,1665471600"; d="scan'208";a="203381000" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Dec 2022 15:47:18 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 9 Dec 2022 15:47:17 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 9 Dec 2022 15:47:16 -0700 From: Jerry Ray To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , , , , , Jerry Ray Subject: [PATCH net-next v5 2/6] dsa: lan9303: move Turbo Mode bit initialization Date: Fri, 9 Dec 2022 16:47:09 -0600 Message-ID: <20221209224713.19980-3-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221209224713.19980-1-jerry.ray@microchip.com> References: <20221209224713.19980-1-jerry.ray@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751778586673737251?= X-GMAIL-MSGID: =?utf-8?q?1751778586673737251?= In preparing to remove the .adjust_link api, I am moving the one-time initialization of the device's Turbo Mode bit into a different execution path. This code clears (disables) the Turbo Mode bit which is never used by this driver. Turbo Mode is a non-standard mode that would allow the 100Mbps RMII interface to run at 200Mbps. Signed-off-by: Jerry Ray --- drivers/net/dsa/lan9303-core.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 5a21fc96d479..20fc2af62531 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -886,6 +886,12 @@ static int lan9303_check_device(struct lan9303 *chip) return ret; } + /* Virtual Phy: Remove Turbo 200Mbit mode */ + lan9303_read(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, ®); + + reg &= ~LAN9303_VIRT_SPECIAL_TURBO; + regmap_write(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, reg); + return 0; } @@ -1073,14 +1079,6 @@ static void lan9303_adjust_link(struct dsa_switch *ds, int port, ctl &= ~BMCR_FULLDPLX; lan9303_phy_write(ds, port, MII_BMCR, ctl); - - if (port == chip->phy_addr_base) { - /* Virtual Phy: Remove Turbo 200Mbit mode */ - lan9303_read(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, &ctl); - - ctl &= ~LAN9303_VIRT_SPECIAL_TURBO; - regmap_write(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, ctl); - } } static int lan9303_port_enable(struct dsa_switch *ds, int port, From patchwork Fri Dec 9 22:47:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Ray X-Patchwork-Id: 31944 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1028921wrr; Fri, 9 Dec 2022 14:50:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf5RZRSjgZXWtCQiulcxiADL9kk3IflfLDtXsK/TiRi/vuLdMA4y3yIFzynSSzNndbVdrUPl X-Received: by 2002:a17:906:38c8:b0:7ba:5993:90e8 with SMTP id r8-20020a17090638c800b007ba599390e8mr6259119ejd.65.1670626251609; Fri, 09 Dec 2022 14:50:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670626251; cv=none; d=google.com; s=arc-20160816; b=TIP2Lzs4DFE76k/CZj5R9dKMq+SmN9safuxlFDmj1UmYD4Eb9lZSzRuHv8AwbpAbot ikX9ekrDANXOa6USqGLMXu/637UIlmzbfwxpxKtZfQAUicNEzt6GIl43L1+/vYblZY+F nA3ibru/hwWcPavn5Art7Pqe+ckkBp44+TGP14jqz+6UisyRpJDKvHHqPMIhzLjgm3jt dnXBwScykVkJBGcOq+Hm5KwZVwt+wNDA7j8D/sMEcuY7byyyGWo6i48t44NNvrFNCqv/ G5Z9jDAZnKpnotyTnYQ3NxRG8v6Hmiej/oozgVDi14tXidDtCaT8Qn2NrGNWkCmJ9xq0 Jo/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=RRd5g+dOpsaZAILzWmtnqtAGKKwPxVKxYmY8c9dV/44=; b=rUK8LQaXXAaI951cdxvns4zinsotQHZdncJyGC8X2xzOTcgfAp70S1P+Sl8lOIrIcp cZTQZiNa9kltaxrS3MKnR9CrhnRN0ShT3630KR9+BYJ2Vi0kz0SoXwTOcQikYLH3aYdK AbeMPUqKJjS+Qj3Xzx3Q+S7d2L1OcVWd6Z0GONt51wEHXx5EoxGRBasQmEDowiysWIOW 6x+lxFRHkGedopUxWO8P89gsB6D5DLnDkGjeTTEqDwy2WAZ9Go2RY5predKGaf6u6ht4 f/L32EBTDWYaxygot34hi5qS8BEsKgxdDHh+Uy4kkyc8SgXRuJhC9VDNJsABN+UrpWqa OSqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=UanF4I5g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn14-20020a17090794ce00b0078db6f488cesi993153ejc.112.2022.12.09.14.50.28; Fri, 09 Dec 2022 14:50:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=UanF4I5g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229936AbiLIWrm (ORCPT + 99 others); Fri, 9 Dec 2022 17:47:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229876AbiLIWrV (ORCPT ); Fri, 9 Dec 2022 17:47:21 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54C52A5DDC; Fri, 9 Dec 2022 14:47:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1670626040; x=1702162040; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=B2lfXxHngQm03n83AdhmQkCAaE+4zb2T+WSAC7zt58o=; b=UanF4I5ghcQex1rlFV0NZZfYDT/Kl+4h3Vx/pDW9gxbv1HNln03R0+SO 5OQEdb0Aly1ZqhUrhVwHBYEn8ZeapnVN/BvVn1K5l6Z6JZGSOcyurbGNF Gv0nIM61dG3LYBau8vhWtPGcBH8J3/GGvXCfUlBr9eT6hkw06nO5WLFj9 y2dUKlNJdxJfi0DPZUTi9z2+f7peJZCHlNa9xcolhjy5jG8bUcoabNPtG 7H4qyvU+xZ6vjLXIAJmlDwSMfMlfJZuth/aLzrIvkDGCVZ6PXdK7/vfWD +84MLyPFgZDCZ/qbhOIEIf7Zle1EeAQM0xHeMVaujQUrZhQ4KwruO3c9A A==; X-IronPort-AV: E=Sophos;i="5.96,232,1665471600"; d="scan'208";a="203381007" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Dec 2022 15:47:19 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 9 Dec 2022 15:47:18 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 9 Dec 2022 15:47:17 -0700 From: Jerry Ray To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , , , , , Jerry Ray Subject: [PATCH net-next v5 3/6] dsa: lan9303: Add exception logic for read failure Date: Fri, 9 Dec 2022 16:47:10 -0600 Message-ID: <20221209224713.19980-4-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221209224713.19980-1-jerry.ray@microchip.com> References: <20221209224713.19980-1-jerry.ray@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751778592244107502?= X-GMAIL-MSGID: =?utf-8?q?1751778592244107502?= While it is highly unlikely a read will ever fail, This code fragment is now in a function that allows us to return an error code. A read failure here will cause the lan9303_probe to fail. Signed-off-by: Jerry Ray --- drivers/net/dsa/lan9303-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 20fc2af62531..b0f49d9c3d0c 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -887,7 +887,9 @@ static int lan9303_check_device(struct lan9303 *chip) } /* Virtual Phy: Remove Turbo 200Mbit mode */ - lan9303_read(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, ®); + ret = lan9303_read(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, ®); + if (ret) + return (ret); reg &= ~LAN9303_VIRT_SPECIAL_TURBO; regmap_write(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, reg); From patchwork Fri Dec 9 22:47:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Ray X-Patchwork-Id: 31946 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1029866wrr; Fri, 9 Dec 2022 14:53:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf5k60ssGxx6bSlq5nfE7utxRdkop7/dgnbN1GN159EhPp7nVGsvc9m6glp3P14tjrxIDa87 X-Received: by 2002:a17:906:70d0:b0:7c0:8371:97aa with SMTP id g16-20020a17090670d000b007c0837197aamr6781166ejk.28.1670626388277; Fri, 09 Dec 2022 14:53:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670626388; cv=none; d=google.com; s=arc-20160816; b=hHLGCS2/F1iGFsdJnzrMjbFPAV8PqQHmrgZsr1FMYtF4FWIxOqMCJRBOf/SnOuDnib 4QUpZgcx63/6NlKoluzh/mh7TGk9a/7ZeLSpEnmpgA4Jfm5ijvYNQV4ZvEyQK/wP5Yn/ JWHuTsOgI1xsHlPwMr/XPnjeHgPJVbC1EwkN1JmmlZfpt30H6o8wYgZoaSlhIplzhk3O Ruzh4XqO+ILIw+BSTq7ArDjpPDtDnLCFL63BL3zjtZlxd98imlHxXH9WZU+4Z0/t6+/r 6kqW91j0lGHcb0rVUEAyZZCxFyqvORrrZzM9/dsgcXYZQD8caRzXgFWhx6Ne6BNaE9Qn AHaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=UU0ssHiXfET+hqVagIrjrzQ0MzF4VHIU8OBAjoMRpW4=; b=E4VyqAZ72ednMvhyqWd4+HOdiAVY9Jiw9H0f/k9aV1AYyL0t9b791tx7vBCOq0T6wc icnnvx5VxTlH+OHcF6eklwfvcTWKVoZ3UGMM4peSwhybYU6Lxhk0YUKyiSvuTENwlU1z LNDeH7AyvuQOh50D4H3bYTF97n/kz2NWZPTTrOYMMlqwPiN6m5fsfOsBUw4ywUkf3sEg trA1QwMS6omcoCsakyNfWWX3G7zsu1znvBmuAwjmn22qlv9JMrOnALyl3K5UX75ACTHb 5nVgsQDtPB2lXhQjldlQ+uu81vzBVa12zvYpb1SOVBefeAOpJOJevssOWH77wvD5cidH OpGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=PpkHHs37; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rv25-20020a17090710d900b007b5dd3e6995si607647ejb.917.2022.12.09.14.52.43; Fri, 09 Dec 2022 14:53:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=PpkHHs37; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229876AbiLIWrp (ORCPT + 99 others); Fri, 9 Dec 2022 17:47:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229885AbiLIWrV (ORCPT ); Fri, 9 Dec 2022 17:47:21 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69499A5DE4; Fri, 9 Dec 2022 14:47:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1670626040; x=1702162040; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=01J1GdfGeDpMqj5EEuZPKItLr8DiKEKk/dDza5yX0co=; b=PpkHHs37s77kPHiDMUJG1YQGSUS+MiBZ2E+Jf6VbtXjRAiljUCmj5oo+ cjsPXbxXjqvAhAIlBbBzJ+WYfvJ6x82IUwthUfgpuArnZ0JKpknFnXxyb 4bameXe1tJOqbyg2CjDRSYhs4yePjTgi62/acZfhX+TX+LLVc4B3FPKs/ azJ9revQuxKwR2qNZdLxLbc/4HZ5GBiNCbvyTyhTCR3Qe69nHacNCim2o XXK0JrpQdF1JBkHRetziDjzBAT//ybYUYGKK4yyKjkQP2CLVUQNHHmhTb 27t5Oi8slqJ1ujO4bQa+tv51YDcs9QyU+LjroP1BjLIp6mZf7seKw32hs Q==; X-IronPort-AV: E=Sophos;i="5.96,232,1665471600"; d="scan'208";a="203381009" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Dec 2022 15:47:19 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 9 Dec 2022 15:47:19 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 9 Dec 2022 15:47:18 -0700 From: Jerry Ray To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , , , , , Jerry Ray Subject: [PATCH net-next v5 4/6] dsa: lan9303: Performance Optimization Date: Fri, 9 Dec 2022 16:47:11 -0600 Message-ID: <20221209224713.19980-5-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221209224713.19980-1-jerry.ray@microchip.com> References: <20221209224713.19980-1-jerry.ray@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751778735567642247?= X-GMAIL-MSGID: =?utf-8?q?1751778735567642247?= As the regmap_write() is over a slow bus that will sleep, we can speed up the boot-up time a bit my not bothering to clear a bit that is already clear. Signed-off-by: Jerry Ray --- drivers/net/dsa/lan9303-core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index b0f49d9c3d0c..694249aa1f19 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -891,8 +891,11 @@ static int lan9303_check_device(struct lan9303 *chip) if (ret) return (ret); - reg &= ~LAN9303_VIRT_SPECIAL_TURBO; - regmap_write(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, reg); + /* Clear the TURBO Mode bit if it was set. */ + if (reg & LAN9303_VIRT_SPECIAL_TURBO) { + reg &= ~LAN9303_VIRT_SPECIAL_TURBO; + regmap_write(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, reg); + } return 0; } From patchwork Fri Dec 9 22:47:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Ray X-Patchwork-Id: 31947 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1029988wrr; Fri, 9 Dec 2022 14:53:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf7FJ/7MYSx9hT8ctV1hGoyl3KxrofbysL5RU68Y7lHnz3pSnyAK3I4hhEpbRrgiGUKSiVVx X-Received: by 2002:a17:906:eddd:b0:7c1:439:2ad4 with SMTP id sb29-20020a170906eddd00b007c104392ad4mr7168666ejb.57.1670626413117; Fri, 09 Dec 2022 14:53:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670626413; cv=none; d=google.com; s=arc-20160816; b=ggA7Hk3cSlBqRN1yMXlp6uU7IW/9IcFz4e47IRxKGKdmbd8Wv18Zhqv886PCFMnaM3 t+0j0OWCjJGz1pxMvXOZnzagiKduI+Ldo4lxr25pf+qhlY6SD4z0AGoxTNhvMgciENmm CTbu6B69ihAejM+gnDUdl2Ua+zD1+62EZ4KFJNojCbJmFaEWV6JpEMtBNrlw+8DlO1tz qpxNTquk3UehvjiDhUIpB51J9w8HjFK2/5BWzSQFB0J0w0ALJx0yBlSqefzk7UwjgVbh gZWjrfopitV+tTfWuXU4RPwvOkWFZhqrvEDKdR3sYQyyV8qQfpwi4/ky8dL4qTqx6XwX WTEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=Zu+X0wWblNWuSMZQH6lF+ORTq/EbVz0uqh9AM1U4qCw=; b=eNV7anW2ZkiH1r5M7yC3izT3x2mvKZBzoaIxA932aaOErdfv19N0Wz0nojGd4K9JSb jZEmqVSHX89xr7eCxRlydXV7TH+uj2jrs0VVAAe7kN1zvd8hY/luJgc7fm5bxBKB+Rzx W8V4Lxs1rqEMjiXKxpANkgSox7Rqy6zr3uC9DXmVyGYeToDbTpW9JeSRuXxGeW7juxIJ 0HWlH/HTSUS5tXR/4Mw+EnJ13VIF4IXUqAPo+MZJQCTkZE+R2mYuCHhoI1KTLiSqbyxU Aaj11hDJCzDGJZ/VQDk1umD6JHg/O7N/WadJd0Vo8erIgdc0D9kjbjo3iimhPSV64pyD C1yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=zXWENwvK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp16-20020a1709071b1000b007330c08fe49si743055ejc.206.2022.12.09.14.53.10; Fri, 09 Dec 2022 14:53:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=zXWENwvK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230007AbiLIWrs (ORCPT + 99 others); Fri, 9 Dec 2022 17:47:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbiLIWrW (ORCPT ); Fri, 9 Dec 2022 17:47:22 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 533761C12A; Fri, 9 Dec 2022 14:47:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1670626042; x=1702162042; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=l7YBKmMzDz1O5Koq1YvREF/7MqTU5nkmnxEBATNyr3s=; b=zXWENwvKe+AaZCmmgO5cFca27no0p2e9STU1IIYln6Y0esS1ttIZ8QtU SSJLTuKazA+I1/XmUKr2gTjHB3y5nAPL//yAgxujAiP8kKtTUvW8ivrWx PCoAnOSzmW1niG9mlCQ2ejNI0ODRy7QtZbeBucAHS4uEC55MuGqLw26FG 3EQtQmye+YdTketwjv6qnyyee2u9Gdyk3PvOUr4zTUrpsihRd1eHY9peU PXqInpwBAYJn1/DgaZ4/B5MQpnxR25pmCKaCKis1H2N9Fz5FkVNZME3a2 qsO8B1iwMvdirH+ZuuVcE37jg8nuMKqkkpqKmNA8vvvHszoO13unOj/ve Q==; X-IronPort-AV: E=Sophos;i="5.96,232,1665471600"; d="scan'208";a="192458907" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Dec 2022 15:47:21 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 9 Dec 2022 15:47:20 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 9 Dec 2022 15:47:19 -0700 From: Jerry Ray To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , , , , , Jerry Ray Subject: [PATCH net-next v5 5/6] dsa: lan9303: Determine CPU port based on dsa_switch ptr Date: Fri, 9 Dec 2022 16:47:12 -0600 Message-ID: <20221209224713.19980-6-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221209224713.19980-1-jerry.ray@microchip.com> References: <20221209224713.19980-1-jerry.ray@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751778761729866286?= X-GMAIL-MSGID: =?utf-8?q?1751778761729866286?= In preparing to move the adjust_link logic into the phylink_mac_link_up api, change the macro used to check for the cpu port. Signed-off-by: Jerry Ray --- drivers/net/dsa/lan9303-core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 694249aa1f19..1d22e4b74308 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -1064,7 +1064,11 @@ static void lan9303_adjust_link(struct dsa_switch *ds, int port, struct lan9303 *chip = ds->priv; int ctl; - if (!phy_is_pseudo_fixed_link(phydev)) + /* On this device, we are only interested in doing something here if + * this is the CPU port. All other ports are 10/100 phys using MDIO + * to control there link settings. + */ + if (!dsa_is_cpu_port(ds, port)) return; ctl = lan9303_phy_read(ds, port, MII_BMCR); From patchwork Fri Dec 9 22:47:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Ray X-Patchwork-Id: 31948 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1030152wrr; Fri, 9 Dec 2022 14:54:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf42mfb3MEGgsSfpzWENK+XAB/lhV0pN2QvGCbInR+25zNWoDkeSQ4G1mZ+rINS4sD2KleJz X-Received: by 2002:a05:6402:5290:b0:45c:834b:eb4a with SMTP id en16-20020a056402529000b0045c834beb4amr8452090edb.21.1670626446210; Fri, 09 Dec 2022 14:54:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670626446; cv=none; d=google.com; s=arc-20160816; b=XAeHzI06Otsml5ZM0oTjkkD/on9f6LVOpF0JsNzPU5qbRgNK/Pnbq5y2a3jOl8INfl s5F3/nrGJt38WNtsqNQ9Bhr250xg9T2zfcul9ChesNtvw9ZyHcwcb1SfUFWPTGcYkckl qSMEQG65gU+AePUHoTyH8XriGRc0C95adrK+MmaowuMajG4/lrhhvwNyEqSfGRhvAwiT /GWT1USomrtWwsrYG07z26GSMz0jq5m2PCkLRsK4N8ojl2r61ylJqLYq8yUw3MBEOPh5 5AAW1sP2FhCUDYwfRml9fubrn1J2D9Mv7tm9c37tWQYw/8u5SbHvbluy6H+XPsH6T+BZ GkYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=XOCj/81wyH7CcxvCGXHhPB2F1m3EiVc/nQw8aezjs1M=; b=ANQpemXxYyCg6ZFMp14+iGjTDcZNw/vrBbLn7oHftWJbuZi85JV8anIEtedMfxfAQB BvSZeVpodkJmzpD1R63RE6CU0U9UEenOcFaV6p79o8Q9mCfyTKpdS+kuKKCPbcdWezhv udVU4CV0ytAmrRuaRX193SVxULQWk9M9M3SPb5YXpBW6+cCLor6wHaGxgaejPqEnb1PF ASK3fR/YbEmF+Hlpfor05cIzr99/Qm/au/YUBBG/N2CTQLIQr4H25dg6L+rBbCAx4yXg aO3mXQQxwmAAG9YF1Nr3ZQbdSix0RhecFTbZzwgc1c/HvoJEjEb1no+u4cvikvZNloVO pbdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=oWIjY+Ck; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r13-20020aa7d14d000000b0046ab57f617bsi1997760edo.633.2022.12.09.14.53.42; Fri, 09 Dec 2022 14:54:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=oWIjY+Ck; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230010AbiLIWrw (ORCPT + 99 others); Fri, 9 Dec 2022 17:47:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbiLIWrX (ORCPT ); Fri, 9 Dec 2022 17:47:23 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79B201C12A; Fri, 9 Dec 2022 14:47:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1670626042; x=1702162042; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=kjBJ1T++jGq2uuDcVYJJloH539ccBnmbGCsz+c3/b0g=; b=oWIjY+Ck9rbXsBoT7RajY5umG2wc3mWtv5LipU4Ov5YS49hAXT13gGWr TJcBL3prhwfNqhtknE+fMqlytkKqTUJIwdcOzs32bGWESk6CUA4+95Xka xjK3am8KnQcC6TIEXRM9Lt4VyVz/bNveP/b+70QINUod/aNu3/WZzgr76 BoxuMq4NFuxq1Dkq48JK8B4GjQm2ff8EFEQ7SK9TIJFlFOtlpIWSFlNte MvUtK0ucvZ99fIJyaVc8oIbZirnQKam0goo+E7t+u39TC2ioZDYL2wLL9 NcWGF3xWoq7k8kk4Xq6JezYOCGUvmovr+tKieUxpjxG/mnmOQzMtPhRd6 A==; X-IronPort-AV: E=Sophos;i="5.96,232,1665471600"; d="scan'208";a="203381022" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Dec 2022 15:47:22 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 9 Dec 2022 15:47:21 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 9 Dec 2022 15:47:20 -0700 From: Jerry Ray To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , , , , , Jerry Ray Subject: [PATCH net-next v5 6/6] dsa: lan9303: Migrate to PHYLINK Date: Fri, 9 Dec 2022 16:47:13 -0600 Message-ID: <20221209224713.19980-7-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221209224713.19980-1-jerry.ray@microchip.com> References: <20221209224713.19980-1-jerry.ray@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751778796293083614?= X-GMAIL-MSGID: =?utf-8?q?1751778796293083614?= This patch replaces the adjust_link api with the phylink apis that provide equivalent functionality. The remaining functionality from the adjust_link is now covered in the phylink_mac_link_up api. Removes: .adjust_link Adds: .phylink_get_caps .phylink_mac_link_up Signed-off-by: Jerry Ray --- v4->v5: - Added various prep patches to better show the movement of the logic. v3->v4: - Reworked the implementation to preserve the adjust_link functionality by including it in the phylink_mac_link_up api. v2->v3: Added back in disabling Turbo Mode on the CPU MII interface. Removed the unnecessary clearing of the phy supported interfaces. --- drivers/net/dsa/lan9303-core.c | 104 ++++++++++++++++++++++----------- 1 file changed, 71 insertions(+), 33 deletions(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 1d22e4b74308..810aef527fe1 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -1058,38 +1058,6 @@ static int lan9303_phy_write(struct dsa_switch *ds, int phy, int regnum, return chip->ops->phy_write(chip, phy, regnum, val); } -static void lan9303_adjust_link(struct dsa_switch *ds, int port, - struct phy_device *phydev) -{ - struct lan9303 *chip = ds->priv; - int ctl; - - /* On this device, we are only interested in doing something here if - * this is the CPU port. All other ports are 10/100 phys using MDIO - * to control there link settings. - */ - if (!dsa_is_cpu_port(ds, port)) - return; - - ctl = lan9303_phy_read(ds, port, MII_BMCR); - - ctl &= ~BMCR_ANENABLE; - - if (phydev->speed == SPEED_100) - ctl |= BMCR_SPEED100; - else if (phydev->speed == SPEED_10) - ctl &= ~BMCR_SPEED100; - else - dev_err(ds->dev, "unsupported speed: %d\n", phydev->speed); - - if (phydev->duplex == DUPLEX_FULL) - ctl |= BMCR_FULLDPLX; - else - ctl &= ~BMCR_FULLDPLX; - - lan9303_phy_write(ds, port, MII_BMCR, ctl); -} - static int lan9303_port_enable(struct dsa_switch *ds, int port, struct phy_device *phy) { @@ -1286,13 +1254,83 @@ static int lan9303_port_mdb_del(struct dsa_switch *ds, int port, return 0; } +static void lan9303_phylink_get_caps(struct dsa_switch *ds, int port, + struct phylink_config *config) +{ + struct lan9303 *chip = ds->priv; + + dev_dbg(chip->dev, "%s(%d) entered.", __func__, port); + + config->mac_capabilities = MAC_10 | MAC_100 | MAC_ASYM_PAUSE | + MAC_SYM_PAUSE; + + if (dsa_port_is_cpu(dsa_to_port(ds, port))) { + /* cpu port */ + __set_bit(PHY_INTERFACE_MODE_RMII, + config->supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_MII, + config->supported_interfaces); + } else { + /* internal ports */ + __set_bit(PHY_INTERFACE_MODE_INTERNAL, + config->supported_interfaces); + /* Compatibility for phylib's default interface type when the + * phy-mode property is absent + */ + __set_bit(PHY_INTERFACE_MODE_GMII, + config->supported_interfaces); + } + + /* This driver does not make use of the speed, duplex, pause or the + * advertisement in its mac_config, so it is safe to mark this driver + * as non-legacy. + */ + config->legacy_pre_march2020 = false; +} + +static void lan9303_phylink_mac_link_up(struct dsa_switch *ds, int port, + unsigned int mode, + phy_interface_t interface, + struct phy_device *phydev, int speed, + int duplex, bool tx_pause, + bool rx_pause) +{ + u32 ctl; + + /* On this device, we are only interested in doing something here if + * this is the CPU port. All other ports are 10/100 phys using MDIO + * to control there link settings. + */ + if (!dsa_is_cpu_port(ds, port)) + return; + + ctl = lan9303_phy_read(ds, port, MII_BMCR); + + ctl &= ~BMCR_ANENABLE; + + if (speed == SPEED_100) + ctl |= BMCR_SPEED100; + else if (speed == SPEED_10) + ctl &= ~BMCR_SPEED100; + else + dev_err(ds->dev, "unsupported speed: %d\n", speed); + + if (duplex == DUPLEX_FULL) + ctl |= BMCR_FULLDPLX; + else + ctl &= ~BMCR_FULLDPLX; + + lan9303_phy_write(ds, port, MII_BMCR, ctl); +} + static const struct dsa_switch_ops lan9303_switch_ops = { .get_tag_protocol = lan9303_get_tag_protocol, .setup = lan9303_setup, .get_strings = lan9303_get_strings, .phy_read = lan9303_phy_read, .phy_write = lan9303_phy_write, - .adjust_link = lan9303_adjust_link, + .phylink_get_caps = lan9303_phylink_get_caps, + .phylink_mac_link_up = lan9303_phylink_mac_link_up, .get_ethtool_stats = lan9303_get_ethtool_stats, .get_sset_count = lan9303_get_sset_count, .port_enable = lan9303_port_enable,