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)
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”>
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>
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>
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>
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>
- 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>
- 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>
- 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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
__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>
While fixing checkpatch errors some of the index increments
were commented out. They are enabled.
Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
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>
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>
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>