From patchwork Mon May 6 12:32:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13655396 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 AFFA3C25B10 for ; Mon, 6 May 2024 12:40:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Dmc3rM0lifTFTO3FsTvfkA/v+ZzWk0mtHbg0DcZO13I=; b=BU5wfjWx9deyPm hmP0qGRNPmmUvsu8arnIuX9O64se30RtsGovLG84OJ4Kpz0y+BnJhlgXR87uEE6oPjlNBsQlUlYMT C8TZa1yphyPciYm+esaHoNVnIR7J5KnR/8brzZEF685MgeNFFm96W+q4fLWNvLGFDpQ4w26Jen3pc JSER2uJX6GxkGLI35DpC2HKGlV7SleSyLzUSMFGWI1Djmjo6RGObYboE+CkbgVK+DpDSWPMrHDv3q hThblF6cfmgUHQOnllJqaBQLB7uG3Qgv1NkKjdd95t2/RYpDUGrTq1az8SouRFJ4aES9wXMU8nGka T5+LNqn/Wk7QfLVxdBCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s3xdW-00000007Jox-1lAJ; Mon, 06 May 2024 12:40:06 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s3xdT-00000007Jnq-1xo2 for linux-arm-kernel@lists.infradead.org; Mon, 06 May 2024 12:40:04 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-41bca450fa3so11204855e9.2 for ; Mon, 06 May 2024 05:40:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714999201; x=1715604001; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=rxjJb/KzzXIFQHfzAUi7FnhbwHdNprYeBkYOQsJcPKk=; b=XbQESLX9TH0pvQmG+0EbQf/azjqgvsRiSTt36UNfgee2uvZC90SVvKZYGlbEJ4mxzj 6PR+1kTjWcQLHMxgM3kjh0tqLS36bKZe6hxH7JI/CgwXHTFLcn9FVPgIlt1vAPgtU0Oh hBO/vt8K5P4JrJqiJ0VIlmlX9WY5hnFaA6BVvxEc6w2nvLXjxDNkM7L8mxMhHz1L1BHK VPjgVpGAeK2VPWXR8zOxNgdI3qOhEv12wBJUrbu/DqQiAJYRvw4hvv3qXw2trFr3BfXc J9BZ9IrMPtwpjKOLuycPM+72cUVbhXdeYIf47hEXpcp1tHj6CHBNbH4eyokVgmAa/zDO 4qNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714999201; x=1715604001; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rxjJb/KzzXIFQHfzAUi7FnhbwHdNprYeBkYOQsJcPKk=; b=Way9p1QGT0b8/9HzSJuqPAHcJVWZL8/vQFIdrv8oWa+v8DIV6Nwh+cWaQd5Ekv5S9B 8Qh4yqVz4Px9BNziGE8Bksahk1ZVByo0yeUa3wG/7HPq4NYvuMbDk0GRI6HHpJckpj9I VQkcW7Padpbf7qfkwPt3vSkWHrbmv4ZwiAm2gvZ6ZhPPzvfxPhYxO6HEEbB0N6k1pbeU VqmaWjdEVoapvO/XNaytzT3TEW97IieGofSX67nsrHWn8I3hcJ6Rdn8NzS6SvR9rnE+5 +zMblHcEZIGgM2c3aUYeYSO/PzF3H4OfWVNJkIa+9Sj9honrox/H07/KCilZE/Yr/7/Y oRSw== X-Forwarded-Encrypted: i=1; AJvYcCVao37ubUAcOPkKb7v9hCYN6jv2otm1UiKfuy3GwvO2TLVKMhIIxOAwv0oGmXjJd26KGFRJL6lsSnqQg4LEJamxgyQS5Vj/ZLvvZrJwRCa/V2hh7n4= X-Gm-Message-State: AOJu0YxBzdw92DUVqNTffGb3w2/8RoPIqXmBQgb0yw+yFjIB2B6DJ8DP xhHTs5fl3yajS9izsnr6wN3mLYoehDVdgFdu2jnyIt1s2yF9L0LL X-Google-Smtp-Source: AGHT+IFkCu+JtPeZm2GUtpMORrZzigCeL8aXT4N3/ncy5DZ8TaVMDuXbslHscLBHDWJBFqgIrb6ZgA== X-Received: by 2002:a05:600c:1c03:b0:41a:3868:d222 with SMTP id j3-20020a05600c1c0300b0041a3868d222mr7722487wms.0.1714999200464; Mon, 06 May 2024 05:40:00 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id g17-20020adfa491000000b0034de87e81c7sm10714865wrb.23.2024.05.06.05.39.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 05:39:59 -0700 (PDT) From: Christian Marangi To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH] net: stmmac: dwmac-ipq806x: account for rgmii-txid/rxid/id phy-mode Date: Mon, 6 May 2024 14:32:46 +0200 Message-ID: <20240506123248.17740-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240506_054003_534491_F6E6BBB7 X-CRM114-Status: GOOD ( 14.09 ) 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 Currently the ipq806x dwmac driver is almost always used attached to the CPU port of a switch and phy-mode was always set to "rgmii" or "sgmii". Some device came up with a special configuration where the PHY is directly attached to the GMAC port and in those case phy-mode needs to be set to "rgmii-id" to make the PHY correctly work and receive packets. Since the driver supports only "rgmii" and "sgmii" mode, when "rgmii-id" (or variants) mode is set, the mode is rejected and probe fails. Add support also for these phy-modes to correctly setup PHYs that requires delay applied to tx/rx. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c index 281687d7083b..4ba15873d5b1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c @@ -171,6 +171,9 @@ static int ipq806x_gmac_set_speed(struct ipq806x_gmac *gmac, unsigned int speed) switch (gmac->phy_mode) { case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: div = get_clk_div_rgmii(gmac, speed); clk_bits = NSS_COMMON_CLK_GATE_RGMII_RX_EN(gmac->id) | NSS_COMMON_CLK_GATE_RGMII_TX_EN(gmac->id); @@ -410,6 +413,9 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) val |= NSS_COMMON_GMAC_CTL_CSYS_REQ; switch (gmac->phy_mode) { case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: val |= NSS_COMMON_GMAC_CTL_PHY_IFACE_SEL; break; case PHY_INTERFACE_MODE_SGMII: @@ -425,6 +431,9 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) val &= ~(1 << NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id)); switch (gmac->phy_mode) { case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: val |= NSS_COMMON_CLK_SRC_CTRL_RGMII(gmac->id) << NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id); break; @@ -442,6 +451,9 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) val |= NSS_COMMON_CLK_GATE_PTP_EN(gmac->id); switch (gmac->phy_mode) { case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: val |= NSS_COMMON_CLK_GATE_RGMII_RX_EN(gmac->id) | NSS_COMMON_CLK_GATE_RGMII_TX_EN(gmac->id); break;