Commit Graph

39 Commits

Author SHA1 Message Date
Anji Jagarlmudi 01868891ee staging: fsl_ppfe/eth: Enhance error checking in platform probe
Fix the kernel crash when MAC addr is not passed in dtb.

Signed-off-by: Anji Jagarlmudi <anji.jagarlmudi@nxp.com>
(cherry picked from commit 2be5e9c740)
2020-02-26 04:17:43 +08:00
Nagesh Koneti 3dc30dfb3d staging: fsl_ppfe/eth: Disable termination of CRC fwd.
LS1012A MAC PCS block has an erratum that is seen with specific PHY AR803x.
The issue is triggered by the (spec-compliant) operation of the AR803x PHY
on the LS1012A-FRWY board.Due to this, good FCS packet is reported as error
packet by MAC, so for these error packets FCS should be validated and
discard only real error packets in PFE Rx packet path.

Signed-off-by: Nagesh Koneti <koneti.nagesh@nxp.com>
Signed-off-by: Nagesh Koneti <“koneti.nagesh@nxp.com”>
2019-12-02 18:05:12 +08:00
Ting Liu 69b54742b6 staging: fsl_ppfe/eth: prefix header search paths with $(srctree)/
Currently, the rules for configuring search paths in Kbuild have
changed: https://lkml.org/lkml/2019/5/13/37

This will lead the below error:

fatal error: pfe/pfe.h: No such file or directory

Fix it by adding $(srctree)/ prefix to the search paths.

Signed-off-by: Ting Liu <ting.liu@nxp.com>
2019-12-02 18:05:10 +08:00
Li Yang 0594c1fff6 staging: fsl_ppfe/eth: remove 'fallback' argument from dev->ndo_select_queue()
To be consistent with upstream API change.

Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-12-02 18:05:09 +08:00
Calvin Johnson 658db0ba79 staging: fsl_ppfe/eth: use memremap() to map RAM area used by PFE
RAM area used by PFE should be mapped using memremap() instead of
directly traslating physical addr to virtual. This will ensure proper
checks are done before the area is used.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:09 +08:00
Calvin Johnson 24d69cea65 staging: fsl_ppfe/eth: use generic soc_device infra instead of fsl_guts_get_svr()
Commit ("soc: fsl: guts: make fsl_guts_get_svr() static") has
made fsl_guts_get_svr() static and hence use generic soc_device
infrastructure to check SoC revision.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:08 +08:00
Calvin Johnson 54fe1e0dd6 staging: fsl_ppfe/eth: adapt to link mode based phydev changes
Setting link mode bits have changed with the integration of
commit (3c1bcc8 net: ethernet: Convert phydev advertize and
supported from u32 to link mode). Adapt to the new method of
setting and clearing the link mode bits.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:08 +08:00
Calvin Johnson 9688f347dd staging: fsl_ppfe/eth: separate mdio init from mac init
- separate mdio initialization from mac initialization
- Define pfe_mdio_priv_s structure to hold mii_bus structure and other
  related data.
- Modify functions to work with the separted mdio init model.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:07 +08:00
Calvin Johnson e6092a5f07 staging: fsl_ppfe/eth: remove unused code
- remove gemac-bus-id related code that is unused.
- remove unused prototype gemac_set_mdc_div.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:07 +08:00
Calvin Johnson a498d8f7a0 staging: fsl_ppfe/eth: support single interface initialization
- arrange members of struct mii_bus in sequence matching phy.h
- if mdio node is defined, use of_mdiobus_register to register
  child nodes (phy devices) available on the mdio bus.
- remove of_phy_register_fixed_link from pfe_phy_init as it is being
  handled in pfe_get_gemac_if_properties
- remove mdio enabled check
- skip phy init, if no PHY or fixed-link

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:07 +08:00
Calvin Johnson f0645177f9 staging: fsl_ppfe/eth: reorganize platform phy parameters
- Use "phy-handle" and of_* functions to get phy node and fixed-link
parameters

- Reorganize phy parameters and initialize them only if phy-handle
or fixed-link is defined in the dtb.

- correct typo pfe_get_gemac_if_proprties to pfe_get_gemac_if_properties

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:06 +08:00
Calvin Johnson b44f7c508b staging: fsl_ppfe/eth: misc clean up
- remove redundant hwfeature init
- remove unused vars from ls1012a_eth_platform_data
- To handle ls1012a errata_a010897, PPFE driver requires GUTS driver
to be compiled in. Select FSL_GUTS when PPFE driver is compiled.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:06 +08:00
Calvin Johnson 1783b0624b staging: fsl_ppfe/eth: Update to use SPDX identifiers
Replace license text with corresponding SPDX identifiers and update the
format of existing SPDX identifiers to follow the new guideline
Documentation/process/license-rules.rst.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:05 +08:00
Akhil Goyal 1785151bb0 staging: fsl_ppfe: performance tuning for user space
interrupt coalescing of 100 usec is added.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
2019-12-02 18:05:05 +08:00
Akhil Goyal d2009ed1f0 staging: fsl_ppfe: enable hif event from userspace
HIF interrupts are enabled using ioctl from user space,
and epoll wait from user space wakes up when there is an HIF
interrupt.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
2019-12-02 18:05:05 +08:00
Shreyansh Jain 62d4c212c0 staging: fsl_ppfe: add support for a char dev for link status
Read and IOCTL support is added. Application would need to open,
read/ioctl the /dev/pfe_us_cdev device.
select is pending as it requires a wait_queue.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:04 +08:00
Calvin Johnson fab313f6f0 staging: fsl_ppfe/eth: add fixed-link support
In cases where MAC is not connected to a normal MDIO-managed PHY
device, and instead to a switch, it is configured as a "fixed-link".
Code to handle this scenario is added here.

phy_node in the dtb is checked to identify a fixed-link.
On identification of a fixed-link, it is registered and connected.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:03 +08:00
Calvin Johnson d75972b2ca staging: fsl_ppfe/eth: resolve indentation warning
Resolve the following indentation warning:

drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c:
In function ‘pfe_get_gemac_if_proprties’:
drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c:96:2:
warning: this ‘else’ clause does not guard...
[-Wmisleading-indentation]
  else
  ^~~~
drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c:98:3:
note: ...this statement, but the latter is misleadingly indented as
if it were guarded by the ‘else’
   pdata->ls1012a_eth_pdata[port].mdio_muxval = phy_id;
   ^~~~~

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:02 +08:00
Calvin Johnson dbff4fe66a staging: fsl_ppfe/eth: replace magic numbers
Replace magic numbers and some cosmetic changes.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:02 +08:00
Calvin Johnson 3d59ba5818 staging: fsl_ppfe/eth: handle ls1012a errata_a010897
On LS1012A rev 1.0, Jumbo frames are not supported as it causes
the PFE controller to hang. A reset of the entire chip is required
to resume normal operation.

To handle this errata, frames with length > 1900 are truncated for
rev 1.0 of LS1012A.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:02 +08:00
Calvin Johnson 3f288e369a staging: fsl_ppfe/eth: disable CRC removal
Disable CRC removal from the packet, so that packets are forwarded
as is to Linux.
CRC configuration in MAC will be reflected in the packet received
to Linux.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:01 +08:00
Calvin Johnson b9d5f651e6 staging: fsl_ppfe/eth: remove jumbo frame enable from gemac init
MAC Receive Control Register was configured to allow jumbo frames.
This is removed as jumbo frames can be supported anytime by changing
mtu which will in turn modify MAX_FL field of MAC RCR.
Jumbo frames caused pfe to hang on LS1012A rev 1.0 Silicon due to
erratum A-010897.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:01 +08:00
Calvin Johnson 3b7a66dc81 staging: fsl_ppfe/eth: define pfe ndo_change_mtu function
Define ndo_change_mtu function for pfe. This sets the max Rx frame
length to the new mtu.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:00 +08:00
Calvin Johnson 4f617ff735 staging: fsl_ppfe/eth: use mask for rx max frame len
Define and use PFE_RCR_MAX_FL_MASK to properly set Rx max frame
length of MAC Receive Control Register.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:04:59 +08:00
Calvin Johnson 5bf4094441 staging: fsl_ppfe/eth: reorganize pfe_netdev_ops
Reorganize members of struct pfe_netdev_ops to match with the order
of members in struct net_device_ops defined in include/linux/netdevice.h

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:04:59 +08:00
anuj batham 8ea7cbc859 staging: fsl_ppfe/eth: HW parse results for DPDK
HW Parse results are included in the packet headroom.
Length and Offset calculation now accommodates parse info size.

Signed-off-by: Archana Madhavan <archana.madhavan@nxp.com>
2019-12-02 18:04:58 +08:00
Calvin Johnson b0c6cb4781 staging: fsl_ppfe/eth: unregister netdev after pfe_phy_exit
rmmod pfe.ko throws below warning:

kernfs: can not remove 'phydev', no directory
------------[ cut here ]------------
WARNING: CPU: 0 PID: 2230 at fs/kernfs/dir.c:1481
kernfs_remove_by_name_ns+0x90/0xa0

This is caused when the unregistered netdev structure is accessed to
disconnect phy.

Resolve the issue by unregistering netdev after disconnecting phy.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:04:58 +08:00
Akhil Goyal 5c20cca334 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>
2019-12-02 18:04:58 +08:00
Calvin Johnson 11c4548e49 staging: fsl_ppfe/eth: calculate PFE_PKT_SIZE with SKB_DATA_ALIGN
pfe packet size was calculated without considering skb data alignment
and this resulted in jumbo frames crashing kernel when the
cacheline size increased from 64 to 128 bytes with
commit 9730348075 ("arm64: Increase the max granular size").

Modify pfe packet size caclulation to include skb data alignment of
sizeof(struct skb_shared_info).

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:04:57 +08:00
Bhaskar Upadhaya 1f13ccbbf0 staging: fsl_ppfe/eth: Disable autonegotiation for 2.5G SGMII
PCS initialization sequence for 2.5G SGMII interface governs
auto negotiation to be in disabled mode

Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
2019-12-02 18:04:57 +08:00
Bhaskar Upadhaya e947a43e6e staging: fsl_ppfe/eth: Enable PFE in clause 45 mode
when we opearate in clause 45 mode, we need to call
the function get_phy_device() with its 3rd argument as
"true" and then the resultant phy device needs to be
register with phy layer via phy_device_register()

Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
2019-12-02 18:04:57 +08:00
Kavi Akhila-B46177 d923279b92 staging: fsl_ppfe/eth: Avoid packet drop at TMU queues
Added flow control between TMU queues and PFE Linux driver,
based on TMU credits availability.
Added tx_qos module parameter to control this behavior.
Use queue-0 as default queue to transmit packets.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Akhila Kavi <akhila.kavi@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
2019-12-02 18:04:56 +08:00
Calvin Johnson 4dd92879c0 staging: fsl_ppfe/eth: add function to update tmu credits
__hif_lib_update_credit function is used to update the tmu credits.
If tx_qos is set, tmu credit is updated based on the number of packets
transmitted by tmu.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
2019-12-02 18:04:56 +08:00
Calvin Johnson eff1d7fc71 staging: fsl_ppfe/eth: Make phy_ethtool_ksettings_get return void
Make return value void since function never return meaningful value

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:04:55 +08:00
Calvin Johnson 6b7fa1fdb5 staging: fsl_ppfe/eth: fix read/write/ack idx issue
While fixing checkpatch errors some of the index increments
were commented out. They are enabled.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:04:55 +08:00
Calvin Johnson 782ffeea4c staging: fsl_ppfe/eth: remove unused functions
Remove unused functions hif_xmit_pkt & hif_lib_xmit_pkt.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:04:54 +08:00
Calvin Johnson 2162c084f7 staging: fsl_ppfe/eth: fix RGMII tx delay issue
Recently logic to enable RGMII tx delay was changed by
below patch.

https://patchwork.kernel.org/patch/9447581/

Based on the patch, appropriate change is made in PFE driver.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
2019-12-02 18:04:54 +08:00
Calvin Johnson 520f8c5cf5 staging: fsl_ppfe/eth: introduce pfe driver
This patch introduces Linux support for NXP's LS1012A Packet
Forwarding Engine (pfe_eth). LS1012A uses hardware packet forwarding
engine to provide high performance Ethernet interfaces. The device
includes two Ethernet ports.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
2019-12-02 18:04:53 +08:00
Calvin Johnson 23bf09a6eb staging: fsl_ppfe/eth: header files for pfe driver
This patch has all pfe header files.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
2019-12-02 18:04:53 +08:00