1
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-06-14 03:03:52 +02:00
openwrt/target/linux/layerscape/patches-5.4/701-net-0296-staging-fsl_ppfe-eth-support-for-userspace-networkin.patch
Yangbo Lu cddd459140 layerscape: add patches-5.4
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release
which was tagged LSDK-20.04-V5.4.
https://source.codeaurora.org/external/qoriq/qoriq-components/linux/

For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in
LSDK, port the dts patches from 4.14.

The patches are sorted into the following categories:
  301-arch-xxxx
  302-dts-xxxx
  303-core-xxxx
  701-net-xxxx
  801-audio-xxxx
  802-can-xxxx
  803-clock-xxxx
  804-crypto-xxxx
  805-display-xxxx
  806-dma-xxxx
  807-gpio-xxxx
  808-i2c-xxxx
  809-jailhouse-xxxx
  810-keys-xxxx
  811-kvm-xxxx
  812-pcie-xxxx
  813-pm-xxxx
  814-qe-xxxx
  815-sata-xxxx
  816-sdhc-xxxx
  817-spi-xxxx
  818-thermal-xxxx
  819-uart-xxxx
  820-usb-xxxx
  821-vfio-xxxx

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2020-05-07 12:53:06 +02:00

156 lines
3.6 KiB
Diff

From 25d189ea016270d1d7ab67eafc57bc8989b5381c Mon Sep 17 00:00:00 2001
From: Akhil Goyal <akhil.goyal@nxp.com>
Date: Fri, 13 Apr 2018 15:41:28 +0530
Subject: [PATCH] staging: fsl_ppfe/eth: support for userspace networking
This patch adds the userspace mode support to fsl_ppfe network driver.
In the new mode, basic hardware initialization is performed in kernel, while
the datapath and HIF handling is the responsibility of the userspace.
The new command line parameter is added to initialize the ppfe module
in userspace mode. By default the module remains in kernelspace networking
mode.
To enable userspace mode, use "insmod pfe.ko us=1"
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/staging/fsl_ppfe/pfe_eth.c | 21 +++++++++++++++++++--
drivers/staging/fsl_ppfe/pfe_mod.c | 15 +++++++++++++++
drivers/staging/fsl_ppfe/pfe_mod.h | 2 ++
3 files changed, 36 insertions(+), 2 deletions(-)
--- a/drivers/staging/fsl_ppfe/pfe_eth.c
+++ b/drivers/staging/fsl_ppfe/pfe_eth.c
@@ -2296,6 +2296,8 @@ static int pfe_eth_init_one(struct pfe *
goto err0;
}
+ if (us)
+ emac_txq_cnt = EMAC_TXQ_CNT;
/* Create an ethernet device instance */
ndev = alloc_etherdev_mq(sizeof(*priv), emac_txq_cnt);
@@ -2342,6 +2344,9 @@ static int pfe_eth_init_one(struct pfe *
}
}
+ if (us)
+ goto phy_init;
+
ndev->mtu = 1500;
/* Set MTU limits */
@@ -2381,6 +2386,8 @@ static int pfe_eth_init_one(struct pfe *
netdev_err(ndev, "register_netdev() failed\n");
goto err3;
}
+
+phy_init:
device_init_wakeup(&ndev->dev, WAKE_MAGIC);
if (!(priv->einfo->phy_flags & GEMAC_NO_PHY)) {
@@ -2392,6 +2399,12 @@ static int pfe_eth_init_one(struct pfe *
}
}
+ if (us) {
+ if (priv->phydev)
+ phy_start(priv->phydev);
+ return 0;
+ }
+
netif_carrier_on(ndev);
/* Create all the sysfs files */
@@ -2403,6 +2416,8 @@ static int pfe_eth_init_one(struct pfe *
return 0;
err4:
+ if (us)
+ goto err3;
unregister_netdev(ndev);
err3:
pfe_eth_mdio_exit(priv->mii_bus);
@@ -2449,9 +2464,11 @@ static void pfe_eth_exit_one(struct pfe_
{
netif_info(priv, probe, priv->ndev, "%s\n", __func__);
- pfe_eth_sysfs_exit(priv->ndev);
+ if (!us) {
+ pfe_eth_sysfs_exit(priv->ndev);
- unregister_netdev(priv->ndev);
+ unregister_netdev(priv->ndev);
+ }
if (!(priv->einfo->phy_flags & GEMAC_NO_PHY))
pfe_phy_exit(priv->ndev);
--- a/drivers/staging/fsl_ppfe/pfe_mod.c
+++ b/drivers/staging/fsl_ppfe/pfe_mod.c
@@ -19,6 +19,10 @@
#include <linux/dma-mapping.h>
#include "pfe_mod.h"
+unsigned int us;
+module_param(us, uint, 0444);
+MODULE_PARM_DESC(us, "0: module enabled for kernel networking (DEFAULT)\n"
+ "1: module enabled for userspace networking\n");
struct pfe *pfe;
/*
@@ -56,6 +60,9 @@ int pfe_probe(struct pfe *pfe)
if (rc < 0)
goto err_hw;
+ if (us)
+ goto firmware_init;
+
rc = pfe_hif_lib_init(pfe);
if (rc < 0)
goto err_hif_lib;
@@ -64,6 +71,7 @@ int pfe_probe(struct pfe *pfe)
if (rc < 0)
goto err_hif;
+firmware_init:
rc = pfe_firmware_init(pfe);
if (rc < 0)
goto err_firmware;
@@ -99,6 +107,9 @@ err_ctrl:
pfe_firmware_exit(pfe);
err_firmware:
+ if (us)
+ goto err_hif_lib;
+
pfe_hif_exit(pfe);
err_hif:
@@ -131,10 +142,14 @@ int pfe_remove(struct pfe *pfe)
#endif
pfe_firmware_exit(pfe);
+ if (us)
+ goto hw_exit;
+
pfe_hif_exit(pfe);
pfe_hif_lib_exit(pfe);
+hw_exit:
pfe_hw_exit(pfe);
return 0;
--- a/drivers/staging/fsl_ppfe/pfe_mod.h
+++ b/drivers/staging/fsl_ppfe/pfe_mod.h
@@ -22,6 +22,8 @@
#include <linux/device.h>
#include <linux/elf.h>
+extern unsigned int us;
+
struct pfe;
#include "pfe_hw.h"