From patchwork Mon Jan 9 21:18:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Ray X-Patchwork-Id: 41150 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2386336wrt; Mon, 9 Jan 2023 13:20:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXuLZkSkIEGdYbHT8as/hxDJH86AyTWmLNng0tLeOAG+9Y3DyrE6Ba9OKzVCbFZjdMx8PrJY X-Received: by 2002:a05:6a20:d39b:b0:af:7e01:706 with SMTP id iq27-20020a056a20d39b00b000af7e010706mr78695621pzb.52.1673299209633; Mon, 09 Jan 2023 13:20:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673299209; cv=none; d=google.com; s=arc-20160816; b=EeDHazSq5YZkyv7SIwW9i2jHcampn5y9XlmnLlvHUKXzmh+xTJqkTJ3jqhyKaQzgsy T5cwfOh/8ppacn5AHO4T8k2UWjTbCwxh57BAkxfAJ0zBTg3RGRDiZzUzxtGMJ8QL0XjB 5KIMCr70FVxfTLcwa5in5W/PVCI+ptROTzy4xkBcicl+DKQ5X+WlqJC9PM6Jwf1A1urk zVpn/kRiVxE5s/H8TcA0cRBPllwSOb617XuoVEkkm5sEQHmsVK1Sf4K8l0w64ZyXS68p vhaI/d/PRp1JL825ilO4VeVRz0X19nHVbTP8kPi4SDjp2htXyT8G7sO9IkTg6G1QFhNB HBwQ== 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=gBWIlYQjToYatuP2aCcah1xwEUZOJ5ahQTvu+HSa3+3x+1Mg+kiM/lOyRQjJoexKBp 6gnM+owfvEdLRXPNt0byj1QoQFja7eGVhRQUUqcoH0uOgcT0d2HMA7QmLi2ArToHUygN iWe99P1GMTtXMzl4BIElPCRkQ5kvnYq46q3IwZfZXtZChIvts4dCwZmvvJFiNTwuaCum xWye8GSETMLwsDlRDim/gNNUm29ylDL/g1eJ1cZx5rbP5x3jfZwAOoAUtQnpMy0z43oO 4Tg4iSSvZBc1goOJi5pnp5JTreQVV5RwjFKUMxOPIOL3VptWaB+CcWOqDC0dux1dIMH+ RUXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=D59hyTiE; 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 j18-20020a056a00131200b0057d97f8e38fsi9794619pfu.216.2023.01.09.13.19.57; Mon, 09 Jan 2023 13:20:09 -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=D59hyTiE; 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 S237896AbjAIVTs (ORCPT + 99 others); Mon, 9 Jan 2023 16:19:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237496AbjAIVTU (ORCPT ); Mon, 9 Jan 2023 16:19:20 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1FA4DFD4; Mon, 9 Jan 2023 13:18:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1673299136; x=1704835136; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=br/M5WmvwdwxFySfGnmU52+djJ0iOGc1/k2tY+9cOwU=; b=D59hyTiEax65gQWYuc8uameM98iwiTDW6Efm7LGXNhyDmL3IBO7n9nHt 1tqLzgCPtPw7gZP3YtESDvsx/GyrfnKsM5cbVKVHd+cpC3fs0BrWMiNvi Q6ZwShfDNmH0ooOjNrtIBMI8Qmhu/ZgQAUWtrZOYq0AMyYMwIZZgLa5l0 umOiNaSouvxbB4gdq10y6d8dZ3fchEzk4dASRyKbbi5MdZMgoAA0MHP8E cJNMswyyvuDS4D6tyNQNpNNzIKnRAD8/0/r60auR49yNGkgm4YZgH/0jO CGyMVnEpqTknInH89cFa5O3MSiieFcFbyt1jN9YFCbGRCe2BMdpW9WNbg Q==; X-IronPort-AV: E=Sophos;i="5.96,313,1665471600"; d="scan'208";a="131543878" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Jan 2023 14:18:56 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) 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.16; Mon, 9 Jan 2023 14:18:55 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Mon, 9 Jan 2023 14:18:53 -0700 From: Jerry Ray To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , Russell King , , , , Jerry Ray Subject: [PATCH net-next v6 1/6] dsa: lan9303: align dsa_switch_ops members Date: Mon, 9 Jan 2023 15:18:44 -0600 Message-ID: <20230109211849.32530-2-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230109211849.32530-1-jerry.ray@microchip.com> References: <20230109211849.32530-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?1754581391913699317?= X-GMAIL-MSGID: =?utf-8?q?1754581391913699317?= Whitespace preparatory patch, making the dsa_switch_ops table consistent. No code is added or removed. Signed-off-by: Jerry Ray Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- 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 Mon Jan 9 21:18:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Ray X-Patchwork-Id: 41151 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2386391wrt; Mon, 9 Jan 2023 13:20:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXvHQ8zlGwhnvpxZuSxn+OZyXZXdH/iyBUl69BAs522rym201uZj3W/629fiR075MrrnMEJ6 X-Received: by 2002:a17:90b:2485:b0:226:b9ed:178c with SMTP id nt5-20020a17090b248500b00226b9ed178cmr19002597pjb.40.1673299215318; Mon, 09 Jan 2023 13:20:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673299215; cv=none; d=google.com; s=arc-20160816; b=a3ZoLmYYar+bkeDffeFpwKMZ1e9tEGg+MYNcejKOYQXya17X2Nvgzggtw4JGnmXZEf hSHF/q7m/8qi7gDmZF86HI9NuxVu878rJKbOMN+XkFhQxC+JEdoCA7vOUqKpkAX7nhKy lpXFgl3J6Vy3VNGFGjopzJWoPKgmTbgUpFQPHpOwbzQHD6fhovyS/LBRxb4YR7AWnlz1 /caYfeB0zFbW/oO6bdNRsr2XHfzLiGgjTQjNVv/blCNaIXsyE6auMHfMY/JLD8Ngh0V8 Q/1NdV9rNqHpy8DveGdHfk6lfUPcfGJHhFLex7tslz2cb7LME/7yKqMkjeD7obHRK22u QjcQ== 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=q7WXaLfe+7ISb22qqcDWHtDOYRqLZQk14WTJBre13QA=; b=Hl0qNJ596IemnO5ZuBJqQ6jo7FtP7yIUt1MnW9rEOszN7qieUAIvmZ6wI6IVRZSsMZ HLz75xlBE19voGQ0X393K8vcjXencbgt7EyiQqHgW1TXBTcAUx4mEDj3for5tskAIOG3 L23FXzpGOctSipuWLoMH3xqC9U6MgwWi+yv04lFUEtfZXN5DOACgt2OgrK8++YhUdr6N UNCCFX1WjvcT8pUS76A696bMYgjZYQ9zcmxver/rQVGwDgo6q0635BYevqx/D0TWMTk5 zyYZXoTz9t3p2hQVRaOFaaiLbW0cheHhiCu5Jpyfjxdrt1iDa2ofJ5PCSE5T8KhiRhU2 8Irg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=hGefZ7Uv; 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 k71-20020a63844a000000b004b124f7a5eesi4052479pgd.387.2023.01.09.13.20.01; Mon, 09 Jan 2023 13:20:15 -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=hGefZ7Uv; 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 S237880AbjAIVTw (ORCPT + 99 others); Mon, 9 Jan 2023 16:19:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237545AbjAIVTU (ORCPT ); Mon, 9 Jan 2023 16:19:20 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0D2C193; Mon, 9 Jan 2023 13:19:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1673299143; x=1704835143; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=qk7EXgI2QvbLbQWUvseiawTbqOJcT8gGauJRmP837Hw=; b=hGefZ7UvoinO80K09A3YGXyk08JxrlsHvtmXbjd1trt4p5j+kGw2+rIE nWZz0HAANcclN4fZbC/XlxM8ZWQ3EOEM6bhMSUY1h72gbjKpPckw2Saj3 FrWAZXFltRs2nf+Huj6WKKto6/l0gXMRdKTrtYTUyod89lXxwVPQYieYN Xd7hI54iiEIXz7I4BwiDqIz4hN22hWzTIbrVIg+phZo9dZGE+wbQ1UgyT 3jrwQPKWzZG3BALOkE628JbplOy1gSWbVWUYe0G4dsio+Gsc/Fyehtmhc 7dNTZQLs+z1ARRBotmHkgEfSkt0+QTICN4tNJ26MajINmp9HfNVO6M/fe g==; X-IronPort-AV: E=Sophos;i="5.96,313,1665471600"; d="scan'208";a="131543894" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Jan 2023 14:19:02 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) 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.16; Mon, 9 Jan 2023 14:18:58 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Mon, 9 Jan 2023 14:18:56 -0700 From: Jerry Ray To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , Russell King , , , , Jerry Ray Subject: [PATCH net-next v6 2/6] dsa: lan9303: move Turbo Mode bit init Date: Mon, 9 Jan 2023 15:18:45 -0600 Message-ID: <20230109211849.32530-3-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230109211849.32530-1-jerry.ray@microchip.com> References: <20230109211849.32530-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?1754581397943711030?= X-GMAIL-MSGID: =?utf-8?q?1754581397943711030?= 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 | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 5a21fc96d479..50470fb09cb4 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; } @@ -1050,7 +1056,6 @@ static int lan9303_phy_write(struct dsa_switch *ds, int phy, int regnum, static void lan9303_adjust_link(struct dsa_switch *ds, int port, struct phy_device *phydev) { - struct lan9303 *chip = ds->priv; int ctl; if (!phy_is_pseudo_fixed_link(phydev)) @@ -1073,14 +1078,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 Mon Jan 9 21:18:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Ray X-Patchwork-Id: 41152 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2386397wrt; Mon, 9 Jan 2023 13:20:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXsSxWkBx4bhFB+GzBZEs5JgMFmZwbBHfGdMwLooYL5H5h/BkIQXJsUmt6bRafY2jiFkOq1K X-Received: by 2002:a05:6a00:2d8:b0:581:fdfb:9765 with SMTP id b24-20020a056a0002d800b00581fdfb9765mr35786969pft.1.1673299216492; Mon, 09 Jan 2023 13:20:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673299216; cv=none; d=google.com; s=arc-20160816; b=hZh86bh4n8kKST0UZt6B99n57p2WhcoR0+M38WCnKNy9nfe/imUXWIz0PRxv6Nn5TP u/7gEKpFA/NC6TRyJc5y9D3V3SugC8pRZORHoqTrOrVas+qtRAUrbIgio4T+7KXmID8B NaOjHH2megaboM6j87jznmF8wKU7BSKeL8gfM6aelCieYc4oTQV1YZcIT9KYb4D/cwIh jMK59+oifdpODvxRD5OksVBZBKUvvtpGLg+rceF1ufb/Vbitd27h3Pgb8EiL3JIzWntm jbMYRHUCgtRYvJvIR4Jz/SVUK5L0iVId1ZWYUDO1MDpMaRJO/pzEV5kCbLcEy0iGILfz 4H/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=/RDqyS1oYObbYjSMasdava4WvX8XdcYB+Qt4b/4lVbo=; b=bioGZajKXiG2UXCw4b6llrBOMyISazCp0/3crnckmzfUEl3cvhR3XJuoyvcTvBa20y qM+J9YutGN403Sbp1KfY4fmOUPUL2P922IuCcXIR29Ow/VMyMi+2neIOGTcnilBIe3H+ PjzMG+Id/TiViKmrYu7gzY/HKi09eWOdUvQhbw425SmS86qi/i2pohAwzQKd82eSTCow V7ZoY5ZghhYHYO6O3+pvQDp/5iiFg+42bVBBnDHnX84JdjsNHYLkE8F440YvWRddveT5 UqfmxgmbPlCb9YhGeeAV3MGfZO2JO132cLdvRqd1X1FwLjL1B7FcOarQ0ZTQGkE2FqZA qpMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=rLjjGqJ9; 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 e15-20020a056a00162f00b00588a0da3b50si3105965pfc.61.2023.01.09.13.20.04; Mon, 09 Jan 2023 13:20:16 -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=rLjjGqJ9; 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 S237927AbjAIVT4 (ORCPT + 99 others); Mon, 9 Jan 2023 16:19:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237554AbjAIVTV (ORCPT ); Mon, 9 Jan 2023 16:19:21 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EDCC189; Mon, 9 Jan 2023 13:19:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1673299144; x=1704835144; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=VxkEKNZWJ3KcbW8rhbq+3YllhYbn54Q2UHPI5yThc9c=; b=rLjjGqJ9wClvDy/rJaz7WXhSGdZ0W14ay/pj/VXLOU1VCr1ieBLr3Iqi TVhWDIlQqQ0OUu0SGYtaafMVobiIaMZXXuF0Q3fkfAivFZZtY4Xrp5BHU RcjwJC2J4USKjkDyQ9j2q74fC8kdmgkYBI80VVRzOGfLkNU4jiitkfdly 0a+dX8HsfcgefJMJhbYY2/IocicznELetZBmDwHGaoGxifXrX5Iqphmq/ SITqg3j+0sGnOQaP/aEhNbJ+8l2xFjaN2Hji4QBp++dGRoCVdofeGgwzV EGjJv2Gvb8Xpf750jC2zd9g34qZfEi6XyYPm5R8jeaUzqbAwCd5oS40fP w==; X-IronPort-AV: E=Sophos;i="5.96,313,1665471600"; d="scan'208";a="131543896" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Jan 2023 14:19:03 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) 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.16; Mon, 9 Jan 2023 14:19:01 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Mon, 9 Jan 2023 14:18:59 -0700 From: Jerry Ray To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , Russell King , , , , Jerry Ray Subject: [PATCH net-next v6 3/6] dsa: lan9303: Add exception logic for read failure Date: Mon, 9 Jan 2023 15:18:46 -0600 Message-ID: <20230109211849.32530-4-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230109211849.32530-1-jerry.ray@microchip.com> References: <20230109211849.32530-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?1754581399334041602?= X-GMAIL-MSGID: =?utf-8?q?1754581399334041602?= 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 50470fb09cb4..8eee340f6464 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 Mon Jan 9 21:18:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Ray X-Patchwork-Id: 41153 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2386426wrt; Mon, 9 Jan 2023 13:20:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXsHj2yDziGouq6x+Ys03OBUdXhpuvSwbVlBaJ3ZvODGpC+O1O9lcgUlv/g39TILnlN3MI+p X-Received: by 2002:a17:90a:5d13:b0:220:9794:249c with SMTP id s19-20020a17090a5d1300b002209794249cmr69575406pji.47.1673299219609; Mon, 09 Jan 2023 13:20:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673299219; cv=none; d=google.com; s=arc-20160816; b=qrhFTHst/vZlfGBBSth1E3o8D5VNXlg33NXQziDcbL6ZjrRCggLKA2FbGKrTy1XZqc FlIivpttpp34UY+/pleXmnsfx0uYr3TRL78vwbXCpRbVjnyebPBpvoaVzKUbLPelezAX RTMGF4IzhDJXtG6jbzkC5NUbZh3TpCYOGJeBPnq5RSHwL035ZWnHUNwFUbtAmj7fj6Ww zOflk56lt5RiKY6UmBqVs8hEpZARm9B8fqg5D9tVcrYcmoXyqBMJJmEljglM+1HLdYRr 7Sf/F5ua9d87utTQfQZ4sMyajCkzW+xhMSxT8m9NV78XMLBOCL7E3LXQabyyTT2uSTwj 2cQQ== 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=yx4airNtbVAiu4qOs67qaliwRRKay9ar5Z6sfaH/IgA=; b=lfT4hYUTeNz5cUqcOdOh6BrzzcDAZVNnxctEG6EYCH0rwdyGiNwF5SN4fV90YKuIF1 IoPNpu+HDw/OoqzZCZA6uHpO5djahC7nPNkY09LCGf6aNm7b+XD7JL6qLLmcS5F7fX6L hJroBHlXqyzUbdTok7Y5Djiukx4N5leEYAgExC+JVDAFziYdznfkBdxC2b1345Niomvt LrOqpfGJproIzeuFlnUn+MR8mbK0RxIEJ/agRtTXYvpKyXQeuRRDu9VI3hc02RbLqSDO Ozuht3r4DwasCKNDowpMpF5Zw2fwZreuByifYbfGeexhyEaTQTf10/pIlcJ1l+uGTuUm Jlxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=fQKl1gKI; 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 fz7-20020a17090b024700b00225f3c4288bsi9698389pjb.160.2023.01.09.13.20.06; Mon, 09 Jan 2023 13:20:19 -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=fQKl1gKI; 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 S237933AbjAIVUB (ORCPT + 99 others); Mon, 9 Jan 2023 16:20:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237557AbjAIVTV (ORCPT ); Mon, 9 Jan 2023 16:19:21 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 692E619D; Mon, 9 Jan 2023 13:19:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1673299145; x=1704835145; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=+spUW6W7ItozH7ki1a6AOa72sASOb3/uSrDwr95CuuI=; b=fQKl1gKINI6V7utDwLl94rarT2dR6jCM5YyetMrIBKQeNLrXN28Hnbhe 9eRPlYbkRXdWVNKvKNVGFLzv1ys+W10bLTdGZLNOd2YzmCPyuNvVSCx2j czmcUPmMaoJD93ze6S6s0skaSGCyENVBWv9s1aIxz+mq2THbtoemKl1jO 5XQH6ZbU5YGiEhW8Hjl+qKTECn9C00n9QsnX+DJ0b+K+xbkhB1SAwy9ld qpg25VjSHrgkdm2BLu/+o9Ec9westopqqtNIQoU8ofmtRy5sIIA7LHhbU ldPIvBlU7fQW+LwVfWENUR5bfbQyDiijo985Q6QzUG+lwMYtwbfqdS0f+ g==; X-IronPort-AV: E=Sophos;i="5.96,313,1665471600"; d="scan'208";a="131543910" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Jan 2023 14:19:04 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) 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.16; Mon, 9 Jan 2023 14:19:04 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Mon, 9 Jan 2023 14:19:01 -0700 From: Jerry Ray To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , Russell King , , , , Jerry Ray Subject: [PATCH net-next v6 4/6] dsa: lan9303: write reg only if necessary Date: Mon, 9 Jan 2023 15:18:47 -0600 Message-ID: <20230109211849.32530-5-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230109211849.32530-1-jerry.ray@microchip.com> References: <20230109211849.32530-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?1754581402768977845?= X-GMAIL-MSGID: =?utf-8?q?1754581402768977845?= As the regmap_write() is over a slow bus that will sleep, we can speed up the boot-up time a bit by 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 8eee340f6464..792ce6a26a6a 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 Mon Jan 9 21:18:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Ray X-Patchwork-Id: 41154 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2386456wrt; Mon, 9 Jan 2023 13:20:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXuYhtxVDUfsmXM8j1D1iIRPXTw7Ejba18NMXJFkFTFsd/UMglRqI1DN0XuCd8G5foOvX38+ X-Received: by 2002:a17:90a:1a49:b0:226:8803:3d3d with SMTP id 9-20020a17090a1a4900b0022688033d3dmr24499981pjl.14.1673299225862; Mon, 09 Jan 2023 13:20:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673299225; cv=none; d=google.com; s=arc-20160816; b=K/j/hPyJSC/esvW6lzHPGJBsfK8k7zI139EvtiLzdDuk1ZZIa5C8Orau7niaCdlVX2 ZZDsx1a2M0ELlQbW8fmcOgkPqdAuCsBh/29qL5mRyJU4S/3qfXJaIporI/crNaBS6W89 FhfaiW4RgTieU8WMsVGHUNvLivpuZxzMFPUPvibkRHI3vFOz9q0/JJlcx39SWO4H82KS tGRJ6PQkR3SBgDPI1QOpI5643rSSREcwM+aQZ44QZO4rT78ARbUaPWSu1S4Kb+d5goD7 pb8Frq6A6E2n4NcrarVlwwzddnT1ADs7IwvIDJa013IKHNTSn/3oQLsR6Y8an5LNl72j DfQA== 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=CWzF2ZPzrioi9xFt/8R7f0UK9kLlhSHbzWnHLpta1jY=; b=0RYmfOWPs4VqmEKD4KyIbTVqXZlzaQFrKXapl89MGGN/0KoZYyC+VHPY4UQjQJtJz6 /ARSQKpD2RQlECtZR3SgcHuI1+FDRBM3PQ2FvOc0gvyIUgPI7pFv+iWt9Rt4GD1AKTW4 aeEZG4fQleriWbyGrYtjCcT315JgQw2/5oC+/2KMJqQVkzcKx3HOUlM2HdrVv3YYdfKr rBr2je8vTIpNsPwS/xQ5nj6vfzdfrqhsk5xV6s7a3o5Fc5LaDp+f5ldFblq60nO9IbJs bFpUW1Iby50n+1dtn67JvymL3Pkqfovwb6EqRFOKhSmbDbbwPo0dRdhSNNPBM02B/GuU iUAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=ULHb+Xzk; 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 lp11-20020a17090b4a8b00b00218b76cda10si10376649pjb.0.2023.01.09.13.20.13; Mon, 09 Jan 2023 13:20:25 -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=ULHb+Xzk; 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 S237951AbjAIVUG (ORCPT + 99 others); Mon, 9 Jan 2023 16:20:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237699AbjAIVT2 (ORCPT ); Mon, 9 Jan 2023 16:19:28 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E67EF01D; Mon, 9 Jan 2023 13:19:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1673299152; x=1704835152; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=J1yPTJ30ftyyvOnC2+2vUGnUMmEFmadFpDvwb82hEIM=; b=ULHb+XzkpAZU1iMyNq8LWdweTltsPOzE8qfHkTQV9VN+AyqN5DdpoeK7 9t0GcIv4G2LDODqvi0ITX2ZN0vMxHU8+6/e39YYVAffbhXYlp0ostjTTK 5TCZXv73oEJHkz7Nb7ASUBZYisvVEORCO4g7e3rBgIkg08/EWM6Ss2cUM LzWM0j+N/0f+1aPaYyMUczRpm5+pIMs2kjsqV9T99C8ol36CM/rpKGB4A IPsW/29hcGtmY82Qf0hgyOo+DQtrxu4B/8XQx9CDWrlWsv+IXIQ6+PVZs 7FizB767DuzqkXmjtOkp2QQ0m//zwl2jdvNth59qRF9P0UyEiNKpAFPB4 A==; X-IronPort-AV: E=Sophos;i="5.96,313,1665471600"; d="scan'208";a="131543916" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Jan 2023 14:19:11 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) 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.16; Mon, 9 Jan 2023 14:19:07 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Mon, 9 Jan 2023 14:19:04 -0700 From: Jerry Ray To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , Russell King , , , , Jerry Ray Subject: [PATCH net-next v6 5/6] dsa: lan9303: Port 0 is xMII port Date: Mon, 9 Jan 2023 15:18:48 -0600 Message-ID: <20230109211849.32530-6-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230109211849.32530-1-jerry.ray@microchip.com> References: <20230109211849.32530-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?1754581408994839416?= X-GMAIL-MSGID: =?utf-8?q?1754581408994839416?= 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. In phylink_mac_link_up, the phydev pointer passed in for the CPU port is NULL, so we can't keep using phy_is_pseudo_fixed_link(phydev). Signed-off-by: Jerry Ray --- v5->v6: Using port 0 to identify the xMII port on the LAN9303. --- 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 792ce6a26a6a..7be4c491e5d9 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -1063,7 +1063,11 @@ static void lan9303_adjust_link(struct dsa_switch *ds, int port, { int ctl; - if (!phy_is_pseudo_fixed_link(phydev)) + /* On this device, we are only interested in doing something here if + * this is an xMII port. All other ports are 10/100 phys using MDIO + * to control there link settings. + */ + if (port != 0) return; ctl = lan9303_phy_read(ds, port, MII_BMCR); From patchwork Mon Jan 9 21:18:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Ray X-Patchwork-Id: 41155 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2386786wrt; Mon, 9 Jan 2023 13:21:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXugJYXuBvmdscJFp35pEscSP2R+roSs8WfJ+ThD+8XZp9CSmyFdl5NHwQ1zjoNfT18SA2sx X-Received: by 2002:a17:907:a0d6:b0:7d3:c516:6ef4 with SMTP id hw22-20020a170907a0d600b007d3c5166ef4mr74366551ejc.20.1673299271375; Mon, 09 Jan 2023 13:21:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673299271; cv=none; d=google.com; s=arc-20160816; b=gWwAyHxce+LRUorqEwmSMgXOnQ8ao8nkWgsxN2Zi/ZzYCPaa1uBxwp3ACfqK+2WGhW k0MxqlbwkodiYp+ntvaiFN28/WOWE2ZTAbEebXvOuiCQo4nAfvJenzGE5d36aAjM7Fhy Rg1M0oM24Eunk3DwDo1mZ3SDCcaW8YFLt6eMV4QRyDcCfyi11cWXvM7EAHbuge5K9eo9 XCoZ1+HPS+JJiVcHRkwHT83SgESW5/xOImhFis8NjZa9XYL7gc5uTD1OM4+SjS6YoMIw 5QBhR7x6T+DaW6Ierc91J1RyzRAk9IJ7FjvRhziicV6Z7XqcxFLGeYpcrSpvmYukm5r0 hLEA== 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=vMXpm/1M1AUHKgxamX5IcAw6KKXDUzr+9jNUjgAX3QA=; b=JiAFSjT4g/LdNEeDrFi4yztLn/vIWsSYtIxAVLkIsuKmK+bGKRMiUxsdnoo4K0kXzD yGnJW2Gc4XH/SZ1sR42KJVJVtfolzcZkZnvci3eiDAOa7XnVXbdt7p/GsStHRK7UT4C7 zYMPrMS9513PIcIdmIZq7SbB+EDR6Nqj1p3Cip8rJa4HQOYaStCwY94CpYHfQc/rQ1qJ pqmwHxPZxoLehYbCc5Ha6WyEOAIjZDsp9FYOJFKgz7MYawAWg1PVt6Xcv7pC8sky1c1T VxUrnmPmvBzX6yszk7i4UQJz+iZ6ra3o9WqZQKDsDsX5xYlaiqGszHZWu/MtoGDiOJBh St6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=N859cFPK; 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 ne26-20020a1709077b9a00b0077d854aa10dsi11384295ejc.57.2023.01.09.13.20.47; Mon, 09 Jan 2023 13:21:11 -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=N859cFPK; 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 S237718AbjAIVUN (ORCPT + 99 others); Mon, 9 Jan 2023 16:20:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237709AbjAIVT2 (ORCPT ); Mon, 9 Jan 2023 16:19:28 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0BAFEA0; Mon, 9 Jan 2023 13:19:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1673299152; x=1704835152; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=bF71XwdfkyXFfdauaOthhsM1+Sz7taE1BuvslIS1rog=; b=N859cFPKWrhNX/gvtgr60t7pb9k5ca1Ue24sqUGDTBac3ExkLZbbk+RT cli7BLymxjeUe5GsrJxcyyvU8j+Yfi4SuQN3I+QCntOGxe0HcNoawGve3 E3oVnjZgMlfvuCLIrMroh98LE0zg/7m15X/JodEyjGD3UnyhcJFIrz1Jb 28+2mFr8vaefihLgjw0c5kk197RWY17f2177SSsNM0re1veKocuNSI1VD 6LEcOyRba749TtDarPWX0kcQbZv70fKqb6Te7DlLaFu14UUA25maSfunb hl55rDjAhKAy3umFrQOqwhREQsnh8PtP8VnHM4NBlZi7spkaw36nOKwyH A==; X-IronPort-AV: E=Sophos;i="5.96,313,1665471600"; d="scan'208";a="196049306" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Jan 2023 14:19:11 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 9 Jan 2023 14:19:09 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Mon, 9 Jan 2023 14:19:07 -0700 From: Jerry Ray To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , Russell King , , , , Jerry Ray Subject: [PATCH net-next v6 6/6] dsa: lan9303: Migrate to PHYLINK Date: Mon, 9 Jan 2023 15:18:49 -0600 Message-ID: <20230109211849.32530-7-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230109211849.32530-1-jerry.ray@microchip.com> References: <20230109211849.32530-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?1754581456596160088?= X-GMAIL-MSGID: =?utf-8?q?1754581456596160088?= 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 --- v5->v6: - Moved to using port number to identify xMII port for the LAN9303. 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 | 101 ++++++++++++++++++++++----------- 1 file changed, 69 insertions(+), 32 deletions(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 7be4c491e5d9..e514fff81af6 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -1058,37 +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) -{ - int ctl; - - /* On this device, we are only interested in doing something here if - * this is an xMII port. All other ports are 10/100 phys using MDIO - * to control there link settings. - */ - if (port != 0) - 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) { @@ -1285,13 +1254,81 @@ 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 (port == 0) { + __set_bit(PHY_INTERFACE_MODE_RMII, + config->supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_MII, + config->supported_interfaces); + } else { + __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 xMII port. All other ports are 10/100 phys using MDIO + * to control there link settings. + */ + if (port != 0) + 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,