From nobody Sat Nov 23 09:23:01 2024 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F23F19CC24; Mon, 18 Nov 2024 13:01:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731934883; cv=none; b=R7/q/v4tvn5E5vVjepEp9ceMhkKKB0jGc6m5yFw4F3CetMKeSNSzGNVB32fUnP91I1/zD3WH+PDsgxIIu8OnnoCjAEHqM8GPnaQTeSdW2CHY/npDqkdvoc9RzVyDAIq7RlFyhEl5YDk9UVwM07lTSufEBHa3wHK032p4/6RZ6yc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731934883; c=relaxed/simple; bh=svbx3/Il10T0pAS9HC3iTDtx7A8zQjEjVIdly0SxNoc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=Rj7meBbw7+RDqwpDllaKv6ABg6EGj/icoCI+BK4U1N06giL2iOYvBud6VJ0UIZcy+CyxzIM+21//8Hm+VnMo9by2cP2908CBD0Ib4cJ8pdBbgfWZwyA+KW7fQ3NsBYI/wQ6RYe5UtVX2RnBS8nwAdjaRUIwTeUmj34UZB/HEu40= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=dYPhvNVF; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="dYPhvNVF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1731934882; x=1763470882; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=svbx3/Il10T0pAS9HC3iTDtx7A8zQjEjVIdly0SxNoc=; b=dYPhvNVFvpxGtvh2KPDHG6956wy3CFs3xa4nZac3t3EzHBs+LtT5dKbC vn5aehwLW7yxbdBLA8rDY9hudtwnD1PRFRI++srtpFz080lGtqL9dMop4 3TrAxKT9CoTz5kCgAlhrzrfR1XSDq2R0KeAOTsPpShejRqzV7xsA5aKm1 GChdIJQED3+icBeu9PhRJYAW9VC2Ux//qa5Tr7OOXSWH/edqb6OINpDae +gVLSO1liq3sZQpMhAMH1sBF6UB9a/PqFE8wqh5qa80AOgYySUipt4JeB qC7TEXae81uNkdihB25yj6ml6kb/7byvQRAGpCKuI0TI+7E2HYekdsUSz g==; X-CSE-ConnectionGUID: pV1s/Z6yQPOamzioY1xjCw== X-CSE-MsgGUID: oPE3UVcER06nyPXg7xXDJQ== X-IronPort-AV: E=Sophos;i="6.12,164,1728975600"; d="scan'208";a="34953030" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 18 Nov 2024 06:01:18 -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.35; Mon, 18 Nov 2024 06:01:05 -0700 Received: from DEN-DL-M70577.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Mon, 18 Nov 2024 06:01:03 -0700 From: Daniel Machon Date: Mon, 18 Nov 2024 14:00:49 +0100 Subject: [PATCH net-next v3 3/8] net: sparx5: use is_port_rgmii() throughout Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20241118-sparx5-lan969x-switch-driver-4-v3-3-3cefee5e7e3a@microchip.com> References: <20241118-sparx5-lan969x-switch-driver-4-v3-0-3cefee5e7e3a@microchip.com> In-Reply-To: <20241118-sparx5-lan969x-switch-driver-4-v3-0-3cefee5e7e3a@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 Now that we can check if a given port is an RGMII port, use it in the following cases: - To set RGMII PHY modes for RGMII port devices. - To avoid checking for a SerDes node in the devicetree, when the port is an RGMII port. - To bail out of sparx5_port_init() when the common configuration is done. Reviewed-by: Steen Hegelund Reviewed-by: Horatiu Vultur Signed-off-by: Daniel Machon --- .../net/ethernet/microchip/sparx5/sparx5_main.c | 28 +++++++++++++++---= ---- .../net/ethernet/microchip/sparx5/sparx5_port.c | 3 +++ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c b/drivers/= net/ethernet/microchip/sparx5/sparx5_main.c index ad8c048179c7..2967dd1952e9 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c @@ -313,10 +313,13 @@ static int sparx5_create_port(struct sparx5 *sparx5, struct initial_port_config *config) { struct sparx5_port *spx5_port; + const struct sparx5_ops *ops; struct net_device *ndev; struct phylink *phylink; int err; =20 + ops =3D sparx5->data->ops; + ndev =3D sparx5_create_netdev(sparx5, config->portno); if (IS_ERR(ndev)) { dev_err(sparx5->dev, "Could not create net device: %02u\n", @@ -357,6 +360,9 @@ static int sparx5_create_port(struct sparx5 *sparx5, MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD | MAC_2500FD | MAC_5000FD | MAC_10000FD | MAC_25000FD; =20 + if (ops->is_port_rgmii(spx5_port->portno)) + phy_interface_set_rgmii(spx5_port->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_SGMII, spx5_port->phylink_config.supported_interfaces); __set_bit(PHY_INTERFACE_MODE_QSGMII, @@ -831,6 +837,7 @@ static int mchp_sparx5_probe(struct platform_device *pd= ev) struct initial_port_config *configs, *config; struct device_node *np =3D pdev->dev.of_node; struct device_node *ports, *portnp; + const struct sparx5_ops *ops; struct reset_control *reset; struct sparx5 *sparx5; int idx =3D 0, err =3D 0; @@ -852,6 +859,7 @@ static int mchp_sparx5_probe(struct platform_device *pd= ev) return -EINVAL; =20 regs =3D sparx5->data->regs; + ops =3D sparx5->data->ops; =20 /* Do switch core reset if available */ reset =3D devm_reset_control_get_optional_shared(&pdev->dev, "switch"); @@ -881,7 +889,7 @@ static int mchp_sparx5_probe(struct platform_device *pd= ev) =20 for_each_available_child_of_node(ports, portnp) { struct sparx5_port_config *conf; - struct phy *serdes; + struct phy *serdes =3D NULL; u32 portno; =20 err =3D of_property_read_u32(portnp, "reg", &portno); @@ -911,13 +919,17 @@ static int mchp_sparx5_probe(struct platform_device *= pdev) conf->sd_sgpio =3D ~0; else sparx5->sd_sgpio_remapping =3D true; - serdes =3D devm_of_phy_get(sparx5->dev, portnp, NULL); - if (IS_ERR(serdes)) { - err =3D dev_err_probe(sparx5->dev, PTR_ERR(serdes), - "port %u: missing serdes\n", - portno); - of_node_put(portnp); - goto cleanup_config; + /* There is no SerDes node for RGMII ports. */ + if (!ops->is_port_rgmii(portno)) { + serdes =3D devm_of_phy_get(sparx5->dev, portnp, NULL); + if (IS_ERR(serdes)) { + err =3D dev_err_probe(sparx5->dev, + PTR_ERR(serdes), + "port %u: missing serdes\n", + portno); + of_node_put(portnp); + goto cleanup_config; + } } config->portno =3D portno; config->node =3D portnp; diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_port.c b/drivers/= net/ethernet/microchip/sparx5/sparx5_port.c index c929b2a63386..8f4f19a2bd65 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_port.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_port.c @@ -1090,6 +1090,9 @@ int sparx5_port_init(struct sparx5 *sparx5, ANA_CL_FILTER_CTRL_FILTER_SMAC_MC_DIS, sparx5, ANA_CL_FILTER_CTRL(port->portno)); =20 + if (ops->is_port_rgmii(port->portno)) + return 0; /* RGMII device - nothing more to configure */ + /* Configure MAC vlan awareness */ err =3D sparx5_port_max_tags_set(sparx5, port); if (err) --=20 2.34.1