From patchwork Mon Jan 16 10:04:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 44049 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1112317wrn; Mon, 16 Jan 2023 02:13:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXujOrJoHLHj72rR9M6/m3FnF5MFOr6jwnCIjpdCgY9TmbNBNpFzLKlwEb3JwSIva9ztd1E5 X-Received: by 2002:a05:6a20:2d0c:b0:b6:a58c:d01 with SMTP id g12-20020a056a202d0c00b000b6a58c0d01mr14106996pzl.30.1673863984684; Mon, 16 Jan 2023 02:13:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673863984; cv=none; d=google.com; s=arc-20160816; b=oVsEhVn2bmr3D+vawVKCiIyIlKsieWKw8pJsSxyhC07aGdw14wO3i+0s3SO4FBCuzT d333y8zOEFyRlyuh1xUXTDuf7B+5T6nLWchncVDvtZJDmCbOPi7CstRVab61ID/EoIzy BUsTDOBs11NhXK+cO74GwXGxtrAk+KEk5xzMHtF3Sv2zPVscAZJON0B4KC0nyTZR/LdE 4LA5h8fSB20hegwfjY4aSSyPOG/LpYBHWoOikW1w3xGRL3+7M48iC45Q9IvWLT4WnIia M65SB9WSbvPFinHf5qXKU7x7JNMLSBNtBNGoeg5zg3wMNRycsbmMOS96cW/fQSyD/Uvi wB0Q== 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=hWViJWP0MS0t9JaQ6c1hdhw0IoiQzYBzBBrucS1yyyU=; b=DCSHHA2zME8qJbNLWw1+DcaiIaCgEWBzsiFfNepX06ZxEOn0CmzILLqeufxD8NYZ45 QvPmN13cDTPk8tfbfa6rKpXKRacu1E8S24PWvpSnV9im+v1NfDrdAzkGXT+f6YxBGTMl lYPLVBW53067rYRUtMf+awniREcv6EU27A0GfJ5Wi7eIJBD27MOB+JJU0lIYxCAHMnQH EbCXJh/dPyHvvvjGJMN/kHoq55/nmcOHxxK705cdrrSyG7K1Iu7TG1vhd/1OaQGv4sVS JoTMQsMPUBIVsvNpeXx66iL+R0WRBjZ0IAxQ/fLhI1dkhqgf2N2v2laH8+Ss3E8vE4Gv i1GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=O4I37HOi; 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 h188-20020a636cc5000000b004b4e4162ccasi20070347pgc.446.2023.01.16.02.12.52; Mon, 16 Jan 2023 02:13:04 -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=O4I37HOi; 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 S229712AbjAPKE0 (ORCPT + 99 others); Mon, 16 Jan 2023 05:04:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbjAPKER (ORCPT ); Mon, 16 Jan 2023 05:04:17 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 526B817CE6; Mon, 16 Jan 2023 02:04:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1673863456; x=1705399456; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XRRLzzOXeevXebWQAE/XcwmvSXhfQ30Z0QGr+p2NfNk=; b=O4I37HOiEPC0MZ03tGo5k3YA6dsyJPndsoflo+4dhn57ozPcWDr3hG8z pAr8h3NDTZRSMpPVZrTtWe22dXJ2GVQafNFDywvTnzKdoqmBaRa7ze5gR h3IgTeRADCK6YA6/G/bzn3misiIbMGb00Kp0FLi5nLJ2j1Jo+9MgxOXwM //6d46NCOtW1NNs6rPB4lbQ9JYpi4nU2/SNn6uLzzEOicJ6TelJdxANfN XuKlo7S5EN6L+NzdJgODSYLM4EDOLNvcVGwPB4oxjwNdex9XmgK13rjZg QSoYQii57CGnRsLFS/8JKoOk+eJhYRWEDJ/BcQxBQwF/ZaFShhgg550ru g==; X-IronPort-AV: E=Sophos;i="5.97,220,1669100400"; d="scan'208";a="196807029" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 16 Jan 2023 03:04:15 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) 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, 16 Jan 2023 03:04:15 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Mon, 16 Jan 2023 03:04:11 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , , , Subject: [PATCH net 1/2] net: dsa: microchip: ksz9477: port map correction in ALU table entry register Date: Mon, 16 Jan 2023 15:34:59 +0530 Message-ID: <20230116100500.614444-2-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230116100500.614444-1-rakesh.sankaranarayanan@microchip.com> References: <20230116100500.614444-1-rakesh.sankaranarayanan@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?1755173601565078788?= X-GMAIL-MSGID: =?utf-8?q?1755173601565078788?= ALU table entry 2 register in KSZ9477 have bit positions reserved for forwarding port map. This field is referred in ksz9477_fdb_del() for clearing forward port map and alu table. But current fdb_del refer ALU table entry 3 register for accessing forward port map. Update ksz9477_fdb_del() to get forward port map from correct alu table entry register. With this bug, issue can be observed while deleting static MAC entries. Delete any specific MAC entry using "bridge fdb del" command. This should clear all the specified MAC entries. But it is observed that entries with self static alone are retained. Tested on LAN9370 EVB since ksz9477_fdb_del() is used common across LAN937x and KSZ series. Fixes: b987e98e50ab ("dsa: add DSA switch driver for Microchip KSZ9477") Signed-off-by: Rakesh Sankaranarayanan Reviewed-by: Vladimir Oltean --- drivers/net/dsa/microchip/ksz9477.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c index 47b54ecf2c6f..6178a96e389f 100644 --- a/drivers/net/dsa/microchip/ksz9477.c +++ b/drivers/net/dsa/microchip/ksz9477.c @@ -540,10 +540,10 @@ int ksz9477_fdb_del(struct ksz_device *dev, int port, ksz_read32(dev, REG_SW_ALU_VAL_D, &alu_table[3]); /* clear forwarding port */ - alu_table[2] &= ~BIT(port); + alu_table[1] &= ~BIT(port); /* if there is no port to forward, clear table */ - if ((alu_table[2] & ALU_V_PORT_MAP) == 0) { + if ((alu_table[1] & ALU_V_PORT_MAP) == 0) { alu_table[0] = 0; alu_table[1] = 0; alu_table[2] = 0; From patchwork Mon Jan 16 10:05:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 44050 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1112406wrn; Mon, 16 Jan 2023 02:13:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXvcVRnMTHP8mHN6KBRP+BA0stHwjcx4o2Qa7iaGaKONfeHmfD0hmFpxo5oN8zwj7XdyoVR2 X-Received: by 2002:a05:6a20:1e51:b0:b2:2e66:5482 with SMTP id cy17-20020a056a201e5100b000b22e665482mr92868265pzb.7.1673863997464; Mon, 16 Jan 2023 02:13:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673863997; cv=none; d=google.com; s=arc-20160816; b=DRZW8tKc7NI4sKFrz01cTfdCnYpbwW75555N0I1/4gYYi0uORmj4X8CYEWBuMIhOG7 HHaqzeheaVfNSZt5B2IvWFK9GNPgUTD8XG4DQOHDYEP71vE7oWreTOMTyBs6e/dtemNH i9I5v/M0XaAld8PMC8GDPez8ftW1vq+zkvysIRfuoKHwbWcObc/IqZYu29eZ0fS4NRAP 5fksM9G/mctB1Ga1cCPpdRLJ0Ol7DqJ5FXZSQLPhfdhAAItZmJQxPCBUSyGaUwkbgHhI iMbVBXVYGtB20GOzTECV4NXo2oAsQ+TuN68himmcv6srwU3YDY3JZ4gcvD6jqJALFuGZ ed1A== 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=QJEHiQSs+Qo64got4rGsVgSNfo5x/Zp21j7BcKDgQTQ=; b=lpKSnVEHC9sqZAALOHvhjX5NzL3UCj96JjatYX5ZQzKnkXVgmHlZnDc+OIzK79wxkE omLAoqjhK4TmSeplu1izaLefOlus5cv15ASjKbYsyesRkqT7u4aEm8gBA2M/T18DnnzZ /Vv3zR8Ki1+0ws4slS5ymKEDL/IwICdRDkHokzrblNjU/eOzeawPBgmzbchjbtO67JGZ CdHwZcr4L+IeHNH8ZrH0BRRUbDBcEe6fXiqqi92Uj5ln8JQ8NwXxVnn6OOsD1Lgk1+7+ sq2Tv4OKGAW5lgX/O4PZSg4eNn9gJheNIBr3ryJsHMdMy5bLLPOZKDtjsBIw0X7FHV41 HgIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="hbSmm/XR"; 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 r132-20020a632b8a000000b00478a09699f8si849794pgr.126.2023.01.16.02.13.05; Mon, 16 Jan 2023 02:13:17 -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="hbSmm/XR"; 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 S229917AbjAPKEl (ORCPT + 99 others); Mon, 16 Jan 2023 05:04:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbjAPKEd (ORCPT ); Mon, 16 Jan 2023 05:04:33 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F264193D0; Mon, 16 Jan 2023 02:04:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1673863464; x=1705399464; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sTsxJqX2e2ybi62OwFJhMFA7w+2USmVJlU5/icGHZIQ=; b=hbSmm/XRHUUGsqxW/uJoyYZveKtb5oNR5Y7A+fyphEsTfi2VxkSryqA4 /OedHjItW2YkhpiijAQSUz+WcNQACP7t6baD9J7LJl6vBnEPNiIHWv7uI PkHMoHZZ1VbI5C2M12r2G5v797kocuNqR09yFITBroM8Pe/J4KPfycpjq bLOQZzRUUKWd/gojGPhpAmMvVLBFSQGfuNJy+RLHiCId5rdEdwspMe4Yq /TsKGRHmZDrU35IQbaH2dQbOmmMZzsdJiv+BrekudhfTPqSH1YvAGyK/A GVzAG/p6xc9ffvbQ3S0IUw8SEpEZhuDrXshVuVwOae0H//ER+CZbNgTv+ w==; X-IronPort-AV: E=Sophos;i="5.97,220,1669100400"; d="scan'208";a="132508148" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 16 Jan 2023 03:04:23 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) 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, 16 Jan 2023 03:04:21 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Mon, 16 Jan 2023 03:04:16 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , , , Subject: [PATCH net 2/2] net: dsa: microchip: lan937x: run phy initialization during each link update Date: Mon, 16 Jan 2023 15:35:00 +0530 Message-ID: <20230116100500.614444-3-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230116100500.614444-1-rakesh.sankaranarayanan@microchip.com> References: <20230116100500.614444-1-rakesh.sankaranarayanan@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?1755173615441305600?= X-GMAIL-MSGID: =?utf-8?q?1755173615441305600?= PHY initialization is supposed to run on every mode changes. "lan87xx_config_aneg()" verifies every mode change using "phy_modify_changed()" function. Earlier code had phy_modify_changed() followed by genphy_soft_reset. But soft_reset resets all the pre-configured register values to default state, and lost all the initialization done. With this reason gen_phy_reset was removed. But it need to go through init sequence each time the mode changed. Update lan97xx_config_aneg() to invoke phy_init once successful mode update is detected. PHY init sequence added in lan87xx_phy_init() have slave init commands executed every time. Update the init sequence to run slave init only if phydev is in slave mode. Test setup contains LAN9370 EVB connected to SAMA5D3 (Running DSA), and issue can be reproduced by connecting link to any of the available ports after SAMA5D3 boot-up. With this issue, port will fail to update link state. But once the SAMA5D3 is reset with LAN9370 link in connected state itself, on boot-up link state will be reported as UP. But Again after some time, if link is moved to DOWN state, it will not get reported. Fixes: b2cd2cde7d69 ("net: phy: LAN87xx: remove genphy_softreset in config_aneg") Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/phy/microchip_t1.c | 70 +++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c index 8569a545e0a3..78618c8cb6bf 100644 --- a/drivers/net/phy/microchip_t1.c +++ b/drivers/net/phy/microchip_t1.c @@ -245,15 +245,42 @@ static int lan87xx_config_rgmii_delay(struct phy_device *phydev) PHYACC_ATTR_BANK_MISC, LAN87XX_CTRL_1, rc); } +static int lan87xx_phy_init_cmd(struct phy_device *phydev, + const struct access_ereg_val *cmd_seq, int cnt) +{ + int ret, i; + + for (i = 0; i < cnt; i++) { + if (cmd_seq[i].mode == PHYACC_ATTR_MODE_POLL && + cmd_seq[i].bank == PHYACC_ATTR_BANK_SMI) { + ret = access_smi_poll_timeout(phydev, + cmd_seq[i].offset, + cmd_seq[i].val, + cmd_seq[i].mask); + } else { + ret = access_ereg(phydev, cmd_seq[i].mode, + cmd_seq[i].bank, cmd_seq[i].offset, + cmd_seq[i].val); + } + if (ret < 0) + return ret; + } + + return ret; +} + static int lan87xx_phy_init(struct phy_device *phydev) { - static const struct access_ereg_val init[] = { + static const struct access_ereg_val hw_init[] = { /* TXPD/TXAMP6 Configs */ { PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_AFE, T1_AFE_PORT_CFG1_REG, 0x002D, 0 }, /* HW_Init Hi and Force_ED */ { PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_SMI, T1_POWER_DOWN_CONTROL_REG, 0x0308, 0 }, + }; + + static const struct access_ereg_val slave_init[] = { /* Equalizer Full Duplex Freeze - T1 Slave */ { PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_DSP, T1_EQ_FD_STG1_FRZ_CFG, 0x0002, 0 }, @@ -267,6 +294,9 @@ static int lan87xx_phy_init(struct phy_device *phydev) T1_EQ_WT_FD_LCK_FRZ_CFG, 0x0002, 0 }, { PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_DSP, T1_PST_EQ_LCK_STG1_FRZ_CFG, 0x0002, 0 }, + }; + + static const struct access_ereg_val phy_init[] = { /* Slave Full Duplex Multi Configs */ { PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_DSP, T1_SLV_FD_MULT_CFG_REG, 0x0D53, 0 }, @@ -397,7 +427,7 @@ static int lan87xx_phy_init(struct phy_device *phydev) { PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_SMI, T1_POWER_DOWN_CONTROL_REG, 0x0300, 0 }, }; - int rc, i; + int rc; /* phy Soft reset */ rc = genphy_soft_reset(phydev); @@ -405,21 +435,28 @@ static int lan87xx_phy_init(struct phy_device *phydev) return rc; /* PHY Initialization */ - for (i = 0; i < ARRAY_SIZE(init); i++) { - if (init[i].mode == PHYACC_ATTR_MODE_POLL && - init[i].bank == PHYACC_ATTR_BANK_SMI) { - rc = access_smi_poll_timeout(phydev, - init[i].offset, - init[i].val, - init[i].mask); - } else { - rc = access_ereg(phydev, init[i].mode, init[i].bank, - init[i].offset, init[i].val); - } + rc = lan87xx_phy_init_cmd(phydev, hw_init, ARRAY_SIZE(hw_init)); + if (rc < 0) + return rc; + + rc = genphy_read_master_slave(phydev); + if (rc) + return rc; + + /* Following squence need to run only if phydev is in + * slave mode. + */ + if (phydev->master_slave_state == MASTER_SLAVE_STATE_SLAVE) { + rc = lan87xx_phy_init_cmd(phydev, slave_init, + ARRAY_SIZE(slave_init)); if (rc < 0) return rc; } + rc = lan87xx_phy_init_cmd(phydev, phy_init, ARRAY_SIZE(phy_init)); + if (rc < 0) + return rc; + return lan87xx_config_rgmii_delay(phydev); } @@ -775,6 +812,7 @@ static int lan87xx_read_status(struct phy_device *phydev) static int lan87xx_config_aneg(struct phy_device *phydev) { u16 ctl = 0; + int ret; switch (phydev->master_slave_set) { case MASTER_SLAVE_CFG_MASTER_FORCE: @@ -790,7 +828,11 @@ static int lan87xx_config_aneg(struct phy_device *phydev) return -EOPNOTSUPP; } - return phy_modify_changed(phydev, MII_CTRL1000, CTL1000_AS_MASTER, ctl); + ret = phy_modify_changed(phydev, MII_CTRL1000, CTL1000_AS_MASTER, ctl); + if (ret == 1) + return phy_init_hw(phydev); + + return ret; } static int lan87xx_get_sqi(struct phy_device *phydev)