From patchwork Wed Nov 6 19:16:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13865362 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35D18D59F6B for ; Wed, 6 Nov 2024 19:26:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wkdCmAERLz7V2yyXzFGgEAsupyYpO1BiJhKuUb1TEsM=; b=P+A/e9QGbiYGwvdbKLLCoYA3Qv brAgCbOg7cnJw3ee1G2pjL/OrYDU6n1cS1JVDYNLtSXlNVC5ZBJGsVLhf9FWf5Nkyjfjgrfj4/yME blqp0JWfH/wfqF3ggBNjuueGkKRiS52GrXJzfcU/7NDlvykRoalazzSjZRJqf1Ftswh8xM20NCkxU kt2fFAdPmQKIHDISYQv49mMBuJNQg/jj4pwH1K81cre8z5XN0VbWzkg1hldBib1dXDl24TPwdOqgl BvJ3Oyx3FEPIKBswDoO3tMDz6v7talVI6FrvkaPz2nw2h+KlQ4G2K+mwfSynlH9EwhZufglPrayso HrBvfFcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t8lfV-00000004VRv-2qDA; Wed, 06 Nov 2024 19:26:17 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t8lXK-00000004TJC-1FCm for linux-arm-kernel@lists.infradead.org; Wed, 06 Nov 2024 19:17:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1730920669; x=1762456669; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=H0j6iihOjF3M/leKroRbJnhBJAJf/+snyIuEVahUA0o=; b=ki2jtpoWHEHKzPitMSJr3uUjvFVnk9ecQPZn83hKoCg9QYPW/2vqwmBt 8yo9nSgUVFK2gWhgevFjqmlqUwtK9nd2eQLHpZzvlrAFG/fDQYsUP+mcD VB3yBw9b8pv7bJqQBPY/khoyEgWXlrqW1DcVxck001MU0QeBz5PGGudD0 JIZHykDf5kH/Kqzo3nqs5sZo0NitmkEhbNNMqU3HJ0PEKvzgJmWcdGfKV SlO+KQJ+oA2gEvcqrp7S2VUGSKtl+rs74QMWIvUGfN0iHf7RKhEoIu2x0 Fp3IJDUwXEmYyHPYA9oNCMmwio5CIbaG+RFrRcdqLZiwmFlqC4+RXyaw3 A==; X-CSE-ConnectionGUID: R5B6jnU1TTWc0t0C0FxLpw== X-CSE-MsgGUID: Y8lHa7noTOuZ6Oet0XHKlA== X-IronPort-AV: E=Sophos;i="6.11,263,1725346800"; d="scan'208";a="37447984" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Nov 2024 12:17:46 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) 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.35; Wed, 6 Nov 2024 12:17:16 -0700 Received: from DEN-DL-M70577.microchip.com (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Wed, 6 Nov 2024 12:17:14 -0700 From: Daniel Machon Date: Wed, 6 Nov 2024 20:16:43 +0100 Subject: [PATCH net-next 5/7] net: sparx5: verify RGMII speeds MIME-Version: 1.0 Message-ID: <20241106-sparx5-lan969x-switch-driver-4-v1-5-f7f7316436bd@microchip.com> References: <20241106-sparx5-lan969x-switch-driver-4-v1-0-f7f7316436bd@microchip.com> In-Reply-To: <20241106-sparx5-lan969x-switch-driver-4-v1-0-f7f7316436bd@microchip.com> To: , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Lars Povlsen" , Steen Hegelund , Horatiu Vultur , Russell King , CC: , , X-Mailer: b4 0.14-dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241106_111750_385479_95B6051B X-CRM114-Status: UNSURE ( 9.91 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When doing a port config, we verify the port speed against the PHY mode and supported speeds of that PHY mode. Add checks for the four RGMII phy modes: RGMII, RGMII_ID, RGMII_TXID and RGMII_RXID. Reviewed-by: Steen Hegelund Reviewed-by: Horatiu Vultur Signed-off-by: Daniel Machon --- drivers/net/ethernet/microchip/sparx5/sparx5_port.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_port.c b/drivers/net/ethernet/microchip/sparx5/sparx5_port.c index fc1ca0cc4bb7..bd1fa5da47d7 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_port.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_port.c @@ -254,6 +254,15 @@ static int sparx5_port_verify_speed(struct sparx5 *sparx5, conf->speed != SPEED_25000)) return sparx5_port_error(port, conf, SPX5_PERR_SPEED); break; + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_TXID: + case PHY_INTERFACE_MODE_RGMII_RXID: + if (conf->speed != SPEED_1000 && + conf->speed != SPEED_100 && + conf->speed != SPEED_10) + return sparx5_port_error(port, conf, SPX5_PERR_SPEED); + break; default: return sparx5_port_error(port, conf, SPX5_PERR_IFTYPE); }