openwrt/package/kernel/qca-nss-dp/patches/0006-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch
Kristian Skramstad a5d12e7839 kernel: qca-nss-dp: update to 12.5.r2 for kernel 6.6
There is a new branch 12.5.r2 for kernel 6.6, so refresh
and update patches.

Delete patch 0010-nss-dp-include-net-netdev_rx_queue.h.patch

Changes:
2024-04-04 -5bf8b91 [qca-nss-dp] Adding support for port ID 3 & 4 in MHT switch
2024-03-28 -ce1e4cf [qca-nss-dp] Use skb_queue_head_init instead of __skb_queue_head_init.
2024-03-11 -0d26366 [qca-nss-dp] Read MHT LAN port status for ErP phase2
2024-03-22 -8382f14 [qca-nss-dp] Fix compilation issues seen on ginger branch for Miami profile
2023-05-02 -09b0983 [qca-nss-dp] vp list processing for capwap
2024-02-22 -bc09a01 [qca-nss-dp] EDMA ring reset for PPE-DS
2024-03-12 -2fcb586 [qca-nss-dp] Fix the EDMA clock frequency for the mitigation timer configuration
2024-02-23 -44ba1be [qca-nss-dp] Add API to retrieve ethernet netdevs for ErP
2024-02-09 -a5979b7 [qca-nss-dp] send napi and ip checksum for VP handler
2024-01-12 -1b9cb5d qca-nss-dp: User netdev_alloc_skb_fast instead of dev_alloc_skb
2024-01-08 -a859b48 [qca-nss-dp] NAPI Budget and EDMA Rx size change for KPI improvement.
2024-01-06 -8935523 [qca-nss-dp] Offload L3, L4 checksum to hardware for ppe-vp.
2023-12-07 -bbd9547 [qca-nss-dp] Fix Compilation issues on kernel6.6
2023-10-12 -bc55f75 [qca-nss-dp]: Enable legacy SCS for PPE-VP.
2023-09-08 -6bd771f [qca-nss-dp] Invalidate secondary descriptor before use.
2023-12-19 -b143df8 [qca-nss-dp] Fixed nss_dp_hal_hw_reset functionality for ipq53xx.
2023-12-16 -7cfde1d [qca-nss-dp] Added nss_dp_hal_hw_reset functionality for ipq53xx.
2023-11-02 -70af6c2 [qca-nss-dp] Implement EDMA hang recovery support
2023-11-27 -2202b29 [qca-nss-dp] Add support for adding the link speed for the Miami's port connected to the internal Switch.
2023-12-06 -bef68a8 [qca-nss-dp] Resolve ring utilization reporting issue in EDMA driver
2023-12-06 -eaa7627 [qca-nss-dp] Add/Delete static fdb entries only for physical ports
2023-10-16 -4551d0f [qca-nss-dp]: Support HLOST_TID_override from PPE_VP path.
2023-11-09 -42ad3f3 [qca-nss-dp] Correct the NAPI poll implementation for DS Rx fill handling
2023-10-16 -dfeb7d3 [qca-nss-dp] Check for disabled ethernet port in ErP functions
2023-11-09 -42ad3f3 [qca-nss-dp] Correct the NAPI poll implementation for DS Rx fill handling
2023-10-16 -dfeb7d3 [qca-nss-dp] Check for disabled ethernet port in ErP functions
2023-09-22 -03f83d6 [qca-nss-dp] Correct the mht device flag
2023-08-18 -5efd7f4 [qca-nss-dp] Add EDMA Tx rings for MHT ports
2023-09-11 -7808ba2 [qca-nss-dp] Move DP standby code to new file and use new SSDK API
2023-09-28 -22ade1e [qca-nss-dp] : enable PPE-DS support in 6.x kernel
2023-08-28 -1943922 [qca-nss-dp] Support for bitmap based CPU selection.
2023-08-16 -dcb82a7 qca-nss-dp: 512M profile changes for Miami+Pebble
2023-09-01 -18e51f3 [qca-nss-dp] Fix tx descriptor completion error.
2023-08-28 -0bfde2d [qca-nss-dp] Changes to enable ErP mode
2023-09-05 -f1d635a [qca-nss-dp] Enable fast recycled changes in dp for kernel 6.1
2023-06-15 -55d35bd [qca-nss-dp] Tracking the full utilization of EDMA rings
2023-08-25 -89b9c19 [qca-nss-dp] Restricting the MTU as 9216 for all interfaces in DP
2023-01-03 -5098a4f [qca-nss-dp] Requeue Tx packet in case of Tx-failure.
2023-04-06 -3576dbb [qca-nss-dp] Adding tx napi with four queue per interface.
2023-08-10 -d2b6921 [qca-nss-dp] : changes to support ppe-qdisc for linux 6.x
2023-08-08 -a1941fb [qca-nss-dp] moving SET_NETDEV_DEV for all netdev to set.
2023-07-18 -74d3178 [qca-nss-dp] Reordering the CPU code and ACL index processing.
2023-06-30 -ab03139 [qca-nss-dp] Configure port level PPE offload flag in PPE
2023-06-06 -e9bb8c5 [qca-nss-dp] Rate limit the debug logs.
2023-07-18 -43afb9b [qca-nss-dp] Support Core selection for PPE mirrored packets.
2023-07-11 -92edcfd [qca-nss-dp] Add sysctl to invalidate RX secondary descriptor.

Tested and working on WAX620.

Signed-off-by: Kristian Skramstad <kristian+github@83.no>
Link: https://github.com/openwrt/openwrt/pull/15383
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-07 10:04:00 +02:00

183 lines
5.6 KiB
Diff

From 5b05b1d7a2d2001d9711856608f61abaf7b9a9a5 Mon Sep 17 00:00:00 2001
From: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Date: Fri, 23 Jun 2023 13:34:56 +0200
Subject: [PATCH 6/8] nss_dp_main: Use a 'phy-handle' property to connect to
the PHY
The original method of connecting a PHY to the ethernet controller
requires the "qcom,link-poll", and "qcom,phy-mdio-addr" devicetree
properties. This is redundant. The PHY node already contains the MDIO
address, and attaching a PHY implies "link-poll".
Allow using a "phy-handle" property. Remove the following properties,
as they are no longer used:
* "qcom,link-poll"
* "qcom,phy-mdio-addr"
* "mdio-bus"
* "qcom,forced-speed"
* "qcom,forced-duplex"
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
include/nss_dp_dev.h | 5 +--
nss_dp_main.c | 91 +++++++-------------------------------------
2 files changed, 14 insertions(+), 82 deletions(-)
--- a/include/nss_dp_dev.h
+++ b/include/nss_dp_dev.h
@@ -225,13 +225,10 @@ struct nss_dp_dev {
unsigned long drv_flags; /* Driver specific feature flags */
/* Phy related stuff */
+ struct device_node *phy_node; /* Phy device OF node */
struct phy_device *phydev; /* Phy device */
struct mii_bus *miibus; /* MII bus */
uint32_t phy_mii_type; /* RGMII/SGMII/QSGMII */
- uint32_t phy_mdio_addr; /* Mdio address */
- bool link_poll; /* Link polling enable? */
- uint32_t forced_speed; /* Forced speed? */
- uint32_t forced_duplex; /* Forced duplex? */
uint32_t link_state; /* Current link state */
uint32_t pause; /* Current flow control settings */
--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -436,7 +436,7 @@ static int nss_dp_open(struct net_device
netif_start_queue(netdev);
- if (!dp_priv->link_poll) {
+ if (!dp_priv->phydev) {
/* Notify data plane link is up */
if (dp_priv->data_plane_ops->link_state(dp_priv->dpc, 1)) {
netdev_dbg(netdev, "Data plane set link failed\n");
@@ -633,6 +633,12 @@ static int32_t nss_dp_of_get_pdata(struc
return -EFAULT;
}
+ dp_priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
+ if (!dp_priv->phy_node) {
+ pr_err("%s: error parsing phy-handle\n", np->name);
+ return -EFAULT;
+ }
+
if (of_property_read_u32(np, "qcom,mactype", &hal_pdata->mactype)) {
pr_err("%s: error reading mactype\n", np->name);
return -EFAULT;
@@ -653,18 +659,6 @@ static int32_t nss_dp_of_get_pdata(struc
return -EFAULT;
#endif
- dp_priv->link_poll = of_property_read_bool(np, "qcom,link-poll");
- if (of_property_read_u32(np, "qcom,phy-mdio-addr",
- &dp_priv->phy_mdio_addr) && dp_priv->link_poll) {
- pr_err("%s: mdio addr required if link polling is enabled\n",
- np->name);
- return -EFAULT;
- }
-
- of_property_read_u32(np, "qcom,forced-speed", &dp_priv->forced_speed);
- of_property_read_u32(np, "qcom,forced-duplex", &dp_priv->forced_duplex);
-
-
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
maddr = (uint8_t *)of_get_mac_address(np);
#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 4, 0))
@@ -753,56 +747,6 @@ static int32_t nss_dp_of_get_pdata(struc
return 0;
}
-/*
- * nss_dp_mdio_attach()
- */
-static struct mii_bus *nss_dp_mdio_attach(struct platform_device *pdev)
-{
- struct device_node *mdio_node;
- struct platform_device *mdio_plat;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(6,1,0))
- struct ipq40xx_mdio_data *mdio_data;
-#endif
-
- /*
- * Find mii_bus using "mdio-bus" handle.
- */
- mdio_node = of_parse_phandle(pdev->dev.of_node, "mdio-bus", 0);
- if (mdio_node) {
- return of_mdio_find_bus(mdio_node);
- }
-
- mdio_node = of_find_compatible_node(NULL, NULL, "qcom,qca-mdio");
- if (!mdio_node) {
- mdio_node = of_find_compatible_node(NULL, NULL,
- "qcom,ipq40xx-mdio");
- if (!mdio_node) {
- dev_err(&pdev->dev, "cannot find mdio node by phandle\n");
- return NULL;
- }
- }
-
- mdio_plat = of_find_device_by_node(mdio_node);
- if (!mdio_plat) {
- dev_err(&pdev->dev, "cannot find platform device from mdio node\n");
- of_node_put(mdio_node);
- return NULL;
- }
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0))
- return dev_get_drvdata(&mdio_plat->dev);
-#else
- mdio_data = dev_get_drvdata(&mdio_plat->dev);
- if (!mdio_data) {
- dev_err(&pdev->dev, "cannot get mii bus reference from device data\n");
- of_node_put(mdio_node);
- return NULL;
- }
-
- return mdio_data->mii_bus;
-#endif
-}
-
#ifdef CONFIG_NET_SWITCHDEV
/*
* nss_dp_is_phy_dev()
@@ -861,7 +805,6 @@ static int32_t nss_dp_probe(struct platf
struct device_node *np = pdev->dev.of_node;
struct nss_gmac_hal_platform_data gmac_hal_pdata;
int32_t ret = 0;
- uint8_t phy_id[MII_BUS_ID_SIZE + 3];
#if defined(NSS_DP_PPE_SUPPORT)
uint32_t vsi_id;
fal_port_t port_id;
@@ -940,22 +883,15 @@ static int32_t nss_dp_probe(struct platf
dp_priv->drv_flags |= NSS_DP_PRIV_FLAG(INIT_DONE);
- if (dp_priv->link_poll) {
- dp_priv->miibus = nss_dp_mdio_attach(pdev);
- if (!dp_priv->miibus) {
- netdev_dbg(netdev, "failed to find miibus\n");
- goto phy_setup_fail;
- }
- snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT,
- dp_priv->miibus->id, dp_priv->phy_mdio_addr);
+ if (dp_priv->phy_node) {
- dp_priv->phydev = phy_connect(netdev, phy_id,
- &nss_dp_adjust_link,
- dp_priv->phy_mii_type);
- if (IS_ERR(dp_priv->phydev)) {
- netdev_dbg(netdev, "failed to connect to phy device\n");
- goto phy_setup_fail;
- }
+ dp_priv->phydev = of_phy_connect(netdev, dp_priv->phy_node,
+ &nss_dp_adjust_link, 0,
+ dp_priv->phy_mii_type);
+ if (!(dp_priv->phydev)) {
+ netdev_err(netdev, "failed to connect to phy device\n");
+ goto phy_setup_fail;
+ }
}
#if defined(NSS_DP_PPE_SUPPORT)