1
0
Fork 0
Commit Graph

26 Commits (redonkable)

Author SHA1 Message Date
Ioana Ciornei e41f1a1fa2 staging: fsl-dpaa2/mac: do not stop MAC when the net_dev is not up
In case the net_device is not up, there is no need to call
dpmac_mac_stop(). Guard the call by checking the IFF_UP flag.
This patch will also solve the following warning generated by removing a
dpmac that is not up.

[   40.942937] called from state READY
[   40.946442] WARNING: CPU: 0 PID: 755 at drivers/net/phy/phy.c:838
phy_stop+0x6c/0x78
[   40.954171] Modules linked in:
[   40.957214] CPU: 0 PID: 755 Comm: bash Tainted: G        W
5.4.0-03629-gfd7102c32b2c-dirty #911
[   40.966592] Hardware name: NXP Layerscape LX2160ARDB (DT)
[   40.971978] pstate: 40000005 (nZcv daif -PAN -UAO)
[   40.976756] pc : phy_stop+0x6c/0x78
[   40.980232] lr : phy_stop+0x6c/0x78
(..)
[   41.066487] Call trace:
[   41.068922]  phy_stop+0x6c/0x78
[   41.072052]  dpaa2_mac_stop.part.4+0x34/0x5c
[   41.076309]  dpaa2_mac_remove+0x9c/0xa8

Also, remove the IFF_UP flag from the mac netdev since the PHY is not
anymore started at probe time but is rather started/stopped on ifconfig
up/down.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-19 19:34:56 +02:00
Ioana Ciornei fd7102c32b staging: fsl-dpaa2/mac: reverse order of handling stop/start IRQs
Both the LINK_UP_REQ and the LINK_DOWN_REQ IRQs can be received in the
same time when a reset is performed on the DPMAC's partner.
Handle first the link down and then the link up so that we do not
trigger a phylib WARNING like the following:

[  446.272011] called from state NOLINK
[  446.275604] WARNING: CPU: 0 PID: 473 at drivers/net/phy/phy.c:874
phy_start+0x44/0xa8

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-12 14:06:29 +02:00
Ioana Ciornei e814c1c730 staging: fsl-dpaa2/mac: do not call dpmac_set_link_state() when nothing changed
In case nothing changed in the link configuration do not call
dpmac_set_link_state().
This is needed in case of the following sequence of commands.

$ ip link set dev eth1 up; ip link set dev eth2 down

Phylib brings the link down when the aneg is started on the phy which
translates in a link down from phy in MC and confuses the MC linkman.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-12 14:06:28 +02:00
Florin Chiculita ff6084127b staging: dpaa2-mac: add link up/down events for dpmac
Fix a limitation that affects the networking behavior when the user
issues ifconfig down/up on a DPNI and the link remains down.
The actual problem was that the mac driver was not aware of the
dpni link change event. Now, the event is sent by firmware and
phylib state machine is manipulated conveniently.

Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-02 18:03:58 +08:00
Ioana Radulescu 43996c56e3 staging: dpaa2-mac: Update interface mode array
We used to set PHY_INTERFACE_MODE_XGMII as a placeholder
for interface modes listed by MC but not defined in the
linux kernel. Some of these modes have been added in upstream,
so update the interface mode array to better match actual PHYs.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:57 +08:00
Ioana Radulescu 2f5eda5940 staging: fsl-dpaa2/mac: add pause frames support for managed phys
Read the configured dpmac options and depending on the supported
features set the according advertising bit.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:57 +08:00
Ioana Ciornei 54f2696bc9 staging: fsl-dpaa2/mac: connect to the fixed phy
This patch is formed from 2 parts:
   - first it moves the code that determines the if_mode to the
     beginning so that it's used for both fixed link and phy mode.
   - secondly, when in fixed link mode, call the phy_connect_phy
     function as needed.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-02 18:03:57 +08:00
Ioana Radulescu 0e5fc90a7b staging: fsl-dpaa2/mac: Add autoneg support
For MC versions that support it, use the new DPMAC link APIs, which
allow setting/getting of advertised and supported link modes.

A mapping between DPMAC link modes and phydev ones is created to
help converting from one to the other.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Valentin Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
2019-12-02 18:03:56 +08:00
Ioana Radulescu e6254bc596 staging: fsl-dpaa2/mac: Add support for new link state APIs
Add v2 of dpmac_set_link_state() and dpmac_get_link_cfg() commands.
The new version allows setting & getting advertised and supported
link options.

Signed-off-by: Valentin Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:56 +08:00
Ioana Radulescu d14909d06d staging: fsl-dpaa2/mac: Fix dpmac_set_link_state() command
The instruction writing link state value in the MC command
structure wasn't correct, but it happened to work nonetheless.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:55 +08:00
Ioana Radulescu c45948a39f staging: fsl-dpaa2/mac: Check DPMAC version
Read the current API version exposed by the DPMAC object.
Add a check at probe time to make sure it is compatible with
the set of MC commands we intend to use on it.
Also, print the version number through ethtool driver info.

Signed-off-by: Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:55 +08:00
Ioana Radulescu 009177ecdf staging: fsl-dpaa2/mac: Add more PHY modes
Add support for CAUI, USXGMII and 1000BASE-X.

Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
Signed-off-by: Valentin Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:54 +08:00
Ioana Radulescu a6accaf7fa staging: fsl-dpaa2/mac: read phy mode from device tree
If the a dpmac node defines its phy mode in the device tree using
the 'phy-mode' or the 'phy-connection-type' attributes this will take
precedence over the interface mode reported by the MC in the
dpmac attributes structure.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:54 +08:00
Ioana Radulescu bc3333ba01 staging: fsl-dpaa2/mac: Fix uninitialized variable
Reported by coverity.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:53 +08:00
Ioana Radulescu 4f489198bb staging: fsl-dpaa2/mac: probe phy as fixed link based on dpmac properties
Keep in sync the PHY type settings in DPC and Linux device tree.

If the dpmac is connected to a fixed link PHY based on dpc config,
treat it as a fixed-link device, regardless of whether the "phy-handle"
property is present in the device tree node or not.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:53 +08:00
Razvan Stefanescu 7165c0b6d4 staging: fsl-dpaa2/mac: make compatible with upstream MC bus
Update the mc.h include path.
Rename struct mc_command to struct fsl_mc_command.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
2019-12-02 18:03:53 +08:00
Ioana Radulescu 64b3a33fcd staging: fsl-dpaa2/mac: defer probe if no mc portal is found
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:53 +08:00
Bogdan Purcareata 7038d1de65 staging: fsl-dpaa2/mac: Free phydev on unbind
Stop polling and unregister / disconnect the phydev structure on DPAA2
mac driver unbind.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2019-12-02 18:03:52 +08:00
Bogdan Purcareata cdb4ed7cb9 staging: fsl-dpaa2/mac: Cleanup code
- move dpaa2_mac_open and dpaa2_mac_stop out of
  CONFIG_FSL_DPAA2_MAC_NETDEVS, since their implementation is necessary
  regardless of it
- reorder ndo ops to match function implementation order
- update comment to describe the phy connection mode that's to be used -
  it no longer depends on DPC, but on the device tree

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2019-12-02 18:03:50 +08:00
Bogdan Purcareata bd94632ec4 staging: fsl-dpaa2/mac: Remove redundant free
free_netdev (put_device) already handles freeing the private data
structure, and KASAN will complain due to a free after free if we
explicitly do the same afterwards.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2019-12-02 18:03:50 +08:00
Ioana Radulescu 91e1a4d583 staging: fsl-dpaa2/mac: Request atomic context MC portals
The MAC driver may need to issue MC commands while in atomic
context (e.g. dpaa2_mac_get_stats can be called from a critical
section), so we need to use MC portals that don't sleep while
waiting for a command response to arrive.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:49 +08:00
Ioana Radulescu 9de4f517fb staging: fsl-dpaa2/mac: Comply with mc bus header updates
The fsl-mc bus driver reorganized some of its headers, so
update our includes accordingly.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:49 +08:00
Ioana Radulescu eb452924e7 staging: fsl-dpaa2/mac: Update ethtool ops
Ethtool ops get/set_settings() are deprecated, so implement
get/set_link_ksettings() instead.

These now call the corresponding phy_ethtool_ksettings_*
generic functions, as the old ones also got deprecated
and removed from the kernel entirely.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:49 +08:00
costi 2425e80aa5 staging: fsl-dpaa2/mac: Remove link type from phy sel logic
Signed-off-by: Constantin Tudor <constantin.tudor@nxp.com>
2019-12-02 18:03:48 +08:00
Bogdan Purcareata e97ed1f13d staging: fsl-dpaa2/mac: Add Freescale DPAA2 mac driver
Introduce the DPAA2 mac driver, which manages Datapath
Media Access Control (DPMAC) objects discovered on the
MC bus.

This driver works as a proxy between phylib including phy
drivers and the Management Complex firmware. It receives
updates on link state changes from PHY lib and forwards
them to the Management Complex and receives interrupts
from the Management Complex whenever a request is made to
change the link state.

This is a squashed commit containing contributions of the
following owners:
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@nxp.com>
Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: J. German Rivera <German.Rivera@freescale.com>
Signed-off-by: Itai Katz <itai.katz@freescale.com>

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2019-12-02 18:03:48 +08:00
Bogdan Purcareata bdb3d15e00 staging: fsl-dpaa2/mac: Add APIs for DPMAC objects
Add the command build/parse APIs for operating on DPMAC
objects through the DPAA2 Management Complex.

Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@nxp.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2019-12-02 18:03:47 +08:00