Skip to content

Conversation

@lmajewski
Copy link

@lmajewski lmajewski commented Apr 17, 2020

Following changes to Kinetics MCUX ENET driver:

  • Disable usage of SMI to read status of PHY device.
    Rationale:
    Some devices - like DSA switches (ksz8794) use SPI for configuration and reading its status
    (instead of MDIO). The current implementation of ENET driver (in eth_enet.c ) is very tightly coupled with SMI interrupts as they allow moving to the next stage of this driver's state machine. This change decouples driver logic from them when required.

  • Add support for 'fixed-link' DTS property
    With this patch set the enet driver now supports setting fixed transmission parameters between
    PHY (DSA) and ENET.

Please consider those changes as a preparatory work for DSA support for Zephyr.

@zephyrbot

This comment has been minimized.

@galak galak requested a review from agansari April 17, 2020 18:15
@jukkar jukkar requested a review from MaureenHelm April 20, 2020 06:14
Copy link
Member

@jukkar jukkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix also checkpatch warnings.

@galak
Copy link
Contributor

galak commented Apr 30, 2020

I need to look at the DT stuff, but think it can be handled possibly as a child. you can see something like dts/bindings/mtd/partition.yaml

@lmajewski lmajewski changed the title [RFC] Add support for 'fixed link' configuration on Kinetics MCUX ENET driver Add support for 'fixed link' configuration on Kinetics MCUX ENET driver Jun 11, 2020
@lmajewski lmajewski force-pushed the pr-mcux-fixed-link branch from 36d28ab to 8e7681f Compare June 11, 2020 19:35
@lmajewski lmajewski requested a review from jukkar June 11, 2020 21:17
@lmajewski lmajewski force-pushed the pr-mcux-fixed-link branch from 8e7681f to 1548ce7 Compare June 16, 2020 09:35
@github-actions github-actions bot added area: Device Tree area: Devicetree Binding PR modifies or adds a Device Tree binding labels Jun 30, 2020
@lmajewski lmajewski force-pushed the pr-mcux-fixed-link branch from 1548ce7 to 2705ee6 Compare July 1, 2020 14:26
@pfalcon
Copy link
Contributor

pfalcon commented Jul 22, 2020

@lmajewski: I usually all for having well-split, dine-detail commits, but sometimes, you can split too much. Your commit "eth: mcux: Support devices not using SMI for PHY setup" says in description "This change introduces a new Kconfig define - CONFIG_ETH_MCUX_NO_PHY_SMI", but it actually doesn't, and thus references an unknown CONFIG_* option. Bottom line: please squash "eth: Kconfig: Add new ETH_MCUX_NO_PHY_SMI Kconfig option" into that commit. (The rest seems to be ok.)

@pfalcon
Copy link
Contributor

pfalcon commented Jul 22, 2020

@lmajewski: Also, while doing the above, please consider whether it's worth to name the option CONFIG_ETH_MCUX_NO_PHY_SMI, maybe it makes sense to cut the negation, name it CONFIG_ETH_MCUX_PHY_SMI, have it "y" be default, and just disable for platforms where needed. Well, might worth asking @MaureenHelm whether she thinks that's anyhow important.

@pfalcon
Copy link
Contributor

pfalcon commented Jul 22, 2020

@jukkar: It seems that your previous comments were addressed, can you have a look and maybe dismiss your -1 to motivate other reviewers to look further into this?

@lmajewski
Copy link
Author

@lmajewski: I usually all for having well-split, dine-detail commits, but sometimes, you can split too much. Your commit "eth: mcux: Support devices not using SMI for PHY setup" says in description "This change introduces a new Kconfig define - CONFIG_ETH_MCUX_NO_PHY_SMI", but it actually doesn't, and thus references an unknown CONFIG_* option. Bottom line: please squash "eth: Kconfig: Add new ETH_MCUX_NO_PHY_SMI Kconfig option" into that commit. (The rest seems to be ok.)

I will squash those commits - thanks for pointing this out

@lmajewski: Also, while doing the above, please consider whether it's worth to name the option CONFIG_ETH_MCUX_NO_PHY_SMI, maybe it makes sense to cut the negation, name it CONFIG_ETH_MCUX_PHY_SMI, have it "y" be default, and just disable for platforms where needed. Well, might worth asking @MaureenHelm whether she thinks that's anyhow important.

As the eth_mcux.c driver uses PHY_SMI for all NXP SoCs excluding only DSA case - I think that it is more readable to use straight logic and put all the necessary code under
#ifdef CONFIG_ETH_MCUX_NO_PHY_SMI

Otherwise, we would have negation in the #ifdef - #ifndef which IMHO is far more difficult to read correctly. Additionally, with current approach we can only enable this option when we do need it - in the DSA case.

To sum up:
I would prefer to keep the name CONFIG_ETH_MCUX_NO_PHY_SMI (and current approach) as it shows that this code doesn't use
SMI interrupts for eth_mcux operation.

@pfalcon
Copy link
Contributor

pfalcon commented Jul 23, 2020

Otherwise, we would have negation in the #ifdef - #ifndef which IMHO is far more difficult to read correctly.

I would disagree with that, it's easier to deal with standard language syntax of #ifdef/#ifndef which applies to any situation, than to adhocly named options which embed some kind of negation somewhere in their names.

That said, as long as that option is considered, and you have arguments to prefer the current situation, it sounds good to me.

@lmajewski
Copy link
Author

Otherwise, we would have negation in the #ifdef - #ifndef which IMHO is far more difficult to read correctly.

I would disagree with that, it's easier to deal with standard language syntax of #ifdef/#ifndef which applies to any situation, than to adhocly named options which embed some kind of negation somewhere in their names.

That said, as long as that option is considered, and you have arguments to prefer the current situation, it sounds good to me.

Please correct me if I've misunderstood something - you are OK to keep things as they are proposed in this patch set (as I've pointed out arguments for such situation).

However, you disagree with the generic approach to have CONFIG_* names with negation in them and you prefer to use #ifndef instead when applicable?

Lukasz Majewski added 6 commits July 23, 2020 11:02
Some ICs - like DSA switches (e.g. ksz8794) - do not use SMI to setup
and configure PHY.

This change introduces a new Kconfig define - CONFIG_ETH_MCUX_NO_PHY_SMI
- to allow replacing SMI communication with SPI or I2C.

Signed-off-by: Lukasz Majewski <[email protected]>
The ip_k66f board has KSZ8794 connected to K66F's enet, which
requires fixed link operation.


Signed-off-by: Lukasz Majewski <[email protected]>
This patch adds description for 'fixed-link' node in ethernet DTS
node. It supports setting speed and duplex.

Signed-off-by: Lukasz Majewski <[email protected]>
This commit enables support for parsing 'fixed-link' node when it
is added to node described in 'ethernet,fixed-link.yaml'.

Signed-off-by: Lukasz Majewski <[email protected]>
This commit adds support for setting fixed configuration, read
from device tree, for ENET ETH interface and PHY.

Signed-off-by: Lukasz Majewski <[email protected]>
This change adds the 'fixed-link' sub-node of the ip_k66f board's
ethernet node. The fixed link is set to work with 100 Mbps and
full duplex.

Signed-off-by: Lukasz Majewski <[email protected]>
@pfalcon
Copy link
Contributor

pfalcon commented Jul 23, 2020

Please correct me if I've misunderstood something - you are OK to keep things as they are proposed in this patch set (as I've pointed out arguments for such situation).

Yes.

However, you disagree with the generic approach to have CONFIG_* names with negation in them and you prefer to use #ifndef instead when applicable?

Yes, I just share my personal opinion on that matter. Maybe you'll find some merit in it and consider it next time (maybe not). Likewise, I'm listening to arguments of others. All that should help make the project better/more consistent/easier to use for everyone.

Bottom line: please make the commit squash discussed above. Then, from my side, I'd just like to test it on frdm_k64f (keeping fingers crossed that I'll have time for that this week).

@lmajewski lmajewski force-pushed the pr-mcux-fixed-link branch from 2705ee6 to 31585f7 Compare July 23, 2020 11:31
Copy link
Contributor

@agansari agansari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks okay, waiting for @pfalcon to test it to approve.

My comment related to Kconfig: I find the double negation sometimes harder to follow
#ifndef CONFIG_ETH_MCUX_NO_PHY_SMI
In logic a double negation is a truth statement, but it's not as clear and straight forward as a direct truth claim when following code.

Copy link
Contributor

@pfalcon pfalcon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay here, tested on frdm_k64f with my usual tests - dumb_http_server, total ~5000 requests, and big_http_download, 3 iterations, total 20MB downloaded.

Ideally, I wish this was reviewed/approved by @agansari and/ot @MaureenHelm, but as this waited in queue for so long, let me cast +1 from me now.

Copy link
Member

@MaureenHelm MaureenHelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree the double negative is confusing and I generally prefer to see positive logic in Kconfigs. But given that 3 networking folks have +1-ed this, I'm ok to keep it as it is.

@MaureenHelm MaureenHelm merged commit 8dd6644 into zephyrproject-rtos:master Aug 4, 2020
@lmajewski lmajewski deleted the pr-mcux-fixed-link branch August 10, 2020 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants