pretty: Add support for TI K3 CPSW registers and ALE table dump
Subsystems (3)
PATCH v3 1/1 pretty: Add support for TI K3 CPSW registers and ALE table dump
Add support to dump CPSW registers and ALE table for the CPSW instances on K3 SoCs that are configured using the am65-cpsw-nuss.c device-driver in Linux.
---
This patch is based on commit '7f58b7376cc6' of origin/next branch of Ethboot repository.
Link to v2:
https://lore.kernel.org/r/[email protected]/
Changes v2 to v3:
- Add entry to Makefile.am for new file added.
Makefile.am | 2 +- am65-cpsw-nuss.c | 510 +++++++++++++++++++++++++++++++++++++++++++++++ ethtool.c | 1 + internal.h | 4 + 4 files changed, 516 insertions(+), 1 deletion(-) create mode 100644 am65-cpsw-nuss.c
Makefile.am +1 -1
@@ -28,7 +28,7 @@ ethtool_SOURCES += \ sff-common.c sff-common.h module-common.c module-common.h \ sfpid.c sfpdiag.c ixgbevf.c tse.c vmxnet3.c qsfp.c qsfp.h \ fjes.c lan78xx.c igc.c cmis.c cmis.h bnxt.c cpsw.c lan743x.c \ - hns3.c fbnic.c hibmcge.c + hns3.c fbnic.c hibmcge.c am65-cpsw-nuss.c endif if ENABLE_BASH_COMPLETION
am65-cpsw-nuss.c new file +510 -0
510 lines not on this page · raw message
ethtool.c +1 -0
@@ -1262,6 +1262,7 @@ static const struct { { "hns3", hns3_dump_regs }, { "fbnic", fbnic_dump_regs }, { "hibmcge", hibmcge_dump_regs }, + { "am65-cpsw-nuss", am65_cpsw_dump_regs }, }; #endif
internal.h +4 -0
@@ -418,4 +418,8 @@ int lan743x_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);/* Meta Ethernet Controller */ int fbnic_dump_regs (struct ethtool_drvinfo *info,struct ethtool_regs *regs); + +/* TI K3 CPSW Ethernet Switch */ +int am65_cpsw_dump_regs (struct ethtool_drvinfo *info,struct ethtool_regs *regs); +#endif /* ETHTOOL_INTERNAL_H__ */
Signature · 1 line
2.34.1
Quoted 6 lines · Chintan Vankar
Add support to dump CPSW registers and ALE table for the CPSW instances on K3 SoCs that are configured using the
am65-cpsw-nuss.cdevice-driver in Linux.Reviewed-by Siddharth Vadapalli <[email protected]>Signed-off-by Chintan Vankar <[email protected]>
The patch breaks compilation with gcc7 which doesn't like variable declarations at the beginning of a case block in switch statement (lines 423 and 432 in am65-cpsw-nuss.c). Newer versions (at least 11-15) do not have a problem with this so it seems to be rather a bug in gcc7. Thus I'm going to apply the patch anyway (unless I find a real issue with it which is not likely).
That being said, putting variable declarations there is a bad habit as such case block is not a scope in C (causing errors e.g. when you use the same variable name in two different case blocks of the same switch statement) even if it seems to be optically.
But that's rather a cosmetic issue which can be addressed later. Standard cleanup is either declaring the variables earlier or, if you really want the scope of such variable to be within one case block, closing it into a { ... } block.
Michal