Skip to contentSkip to conversation

net: ethernet: ti: Remove TI_CPTS_MOD workaround

PATCH Applied Grygorii Strashko 4 participants 6 messages May 12, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 net: ethernet: ti: Remove TI_CPTS_MOD workaround

From: Clay McClure <[email protected]>

My recent commit b6d49cab44b5 ("net: Make PTP-specific drivers depend on PTP_1588_CLOCK") exposes a missing dependency in defconfigs that select TI_CPTS without selecting PTP_1588_CLOCK, leading to linker errors of the form:

drivers/net/ethernet/ti/cpsw.o: in function `cpsw_ndo_stop':
cpsw.c:(.text+0x680): undefined reference to `cpts_unregister'
...

That's because TI_CPTS_MOD (which is the symbol gating the _compilation_ of cpts.c) now depends on PTP_1588_CLOCK, and so is not enabled in these configurations, but TI_CPTS (which is the symbol gating _calls_ to the cpts functions) _is_ enabled. So we end up compiling calls to functions that don't exist, resulting in the linker errors.

This patch fixes build errors and restores previous behavior by:
- ensure PTP_1588_CLOCK=y in TI specific configs and CPTS will be built
- remove TI_CPTS_MOD and, instead, add dependencies from CPTS in TI_CPSW/TI_KEYSTONE_NETCP/TI_CPSW_SWITCHDEV as below:

   config TI_CPSW_SWITCHDEV
   ...
    depends on TI_CPTS || !TI_CPTS

which will ensure proper dependencies PTP_1588_CLOCK -> TI_CPTS ->
TI_CPSW/TI_KEYSTONE_NETCP/TI_CPSW_SWITCHDEV and build type selection.

Note. For NFS boot + CPTS all of above configs have to be built-in.

Cc Arnd Bergmann <[email protected]>
Cc Dan Murphy <[email protected]>
Cc Tony Lindgren <[email protected]>
Fixes b6d49cab44b5 ("net: Make PTP-specific drivers depend on PTP_1588_CLOCK")
[[email protected]: rewording, add deps cpsw/netcp from cpts, drop IS_REACHABLE]

---

v3: https://lkml.org/lkml/2020/5/8/356
v2: https://lkml.org/lkml/2020/5/4/751

 arch/arm/configs/keystone_defconfig  |  1 +
 arch/arm/configs/omap2plus_defconfig |  1 +
 drivers/net/ethernet/ti/Kconfig      | 16 ++++++----------
 drivers/net/ethernet/ti/Makefile     |  2 +-
 4 files changed, 9 insertions(+), 11 deletions(-)
arch/arm/configs/keystone_defconfig +1 -0
index 11e2211f9007..84a3b055f253 100644
@@ -147,6 +147,7 @@ CONFIG_I2C_DAVINCI=y
 CONFIG_SPI=y
 CONFIG_SPI_DAVINCI=y
 CONFIG_SPI_SPIDEV=y
+CONFIG_PTP_1588_CLOCK=y
 CONFIG_PINCTRL_SINGLE=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIO_SYSFS=y
arch/arm/configs/omap2plus_defconfig +1 -0
index 395588209b27..c3f749650d5d 100644
@@ -274,6 +274,7 @@ CONFIG_SPI_TI_QSPI=m
 CONFIG_HSI=m
 CONFIG_OMAP_SSI=m
 CONFIG_SSI_PROTOCOL=m
+CONFIG_PTP_1588_CLOCK=y
 CONFIG_PINCTRL_SINGLE=y
 CONFIG_DEBUG_GPIO=y
 CONFIG_GPIO_SYSFS=y
drivers/net/ethernet/ti/Kconfig +6 -10
index 8e348780efb6..62f809b67469 100644
@@ -49,6 +49,7 @@ config TI_CPSW_PHY_SEL
 config TI_CPSW
 	tristate "TI CPSW Switch Support"
 	depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || COMPILE_TEST
+	depends on TI_CPTS || !TI_CPTS
 	select TI_DAVINCI_MDIO
 	select MFD_SYSCON
 	select PAGE_POOL
@@ -64,6 +65,7 @@ config TI_CPSW_SWITCHDEV
 	tristate "TI CPSW Switch Support with switchdev"
 	depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || COMPILE_TEST
 	depends on NET_SWITCHDEV
+	depends on TI_CPTS || !TI_CPTS
 	select PAGE_POOL
 	select TI_DAVINCI_MDIO
 	select MFD_SYSCON
@@ -77,23 +79,16 @@ config TI_CPSW_SWITCHDEV
 	  will be called cpsw_new.
 
 config TI_CPTS
-	bool "TI Common Platform Time Sync (CPTS) Support"
-	depends on TI_CPSW || TI_KEYSTONE_NETCP || TI_CPSW_SWITCHDEV || COMPILE_TEST
+	tristate "TI Common Platform Time Sync (CPTS) Support"
+	depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || COMPILE_TEST
 	depends on COMMON_CLK
-	depends on POSIX_TIMERS
+	depends on PTP_1588_CLOCK
 	---help---
 	  This driver supports the Common Platform Time Sync unit of
 	  the CPSW Ethernet Switch and Keystone 2 1g/10g Switch Subsystem.
 	  The unit can time stamp PTP UDP/IPv4 and Layer 2 packets, and the
 	  driver offers a PTP Hardware Clock.
 
-config TI_CPTS_MOD
-	tristate
-	depends on TI_CPTS
-	depends on PTP_1588_CLOCK
-	default y if TI_CPSW=y || TI_KEYSTONE_NETCP=y || TI_CPSW_SWITCHDEV=y
-	default m
-
 config TI_K3_AM65_CPSW_NUSS
 	tristate "TI K3 AM654x/J721E CPSW Ethernet driver"
 	depends on ARCH_K3 && OF && TI_K3_UDMA_GLUE_LAYER
@@ -114,6 +109,7 @@ config TI_KEYSTONE_NETCP
 	select TI_DAVINCI_MDIO
 	depends on OF
 	depends on KEYSTONE_NAVIGATOR_DMA && KEYSTONE_NAVIGATOR_QMSS
+	depends on TI_CPTS || !TI_CPTS
 	---help---
 	  This driver supports TI's Keystone NETCP Core.
 
drivers/net/ethernet/ti/Makefile +1 -1
index 53792190e9c2..cb26a9d21869 100644
@@ -13,7 +13,7 @@ obj-$(CONFIG_TI_DAVINCI_EMAC) += ti_davinci_emac.o
 ti_davinci_emac-y := davinci_emac.o davinci_cpdma.o
 obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o
 obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o
-obj-$(CONFIG_TI_CPTS_MOD) += cpts.o
+obj-$(CONFIG_TI_CPTS) += cpts.o
 obj-$(CONFIG_TI_CPSW) += ti_cpsw.o
 ti_cpsw-y := cpsw.o davinci_cpdma.o cpsw_ale.o cpsw_priv.o cpsw_sl.o cpsw_ethtool.o
 obj-$(CONFIG_TI_CPSW_SWITCHDEV) += ti_cpsw_new.o
Signature · 1 line
2.17.1
Reviewed-by on v4 1/1
#1 lore raw
Quoted 32 lines · Grygorii Strashko

From: Clay McClure <[email protected]>

My recent commit b6d49cab44b5 ("net: Make PTP-specific drivers depend on PTP_1588_CLOCK") exposes a missing dependency in defconfigs that select TI_CPTS without selecting PTP_1588_CLOCK, leading to linker errors of the form:

drivers/net/ethernet/ti/cpsw.o: in function `cpsw_ndo_stop':
cpsw.c:(.text+0x680): undefined reference to `cpts_unregister'
...

That's because TI_CPTS_MOD (which is the symbol gating the _compilation_ of cpts.c) now depends on PTP_1588_CLOCK, and so is not enabled in these configurations, but TI_CPTS (which is the symbol gating _calls_ to the cpts functions) _is_ enabled. So we end up compiling calls to functions that don't exist, resulting in the linker errors.

This patch fixes build errors and restores previous behavior by:
- ensure PTP_1588_CLOCK=y in TI specific configs and CPTS will be built
- remove TI_CPTS_MOD and, instead, add dependencies from CPTS in TI_CPSW/TI_KEYSTONE_NETCP/TI_CPSW_SWITCHDEV as below:

   config TI_CPSW_SWITCHDEV
   ...
    depends on TI_CPTS || !TI_CPTS
   which will ensure proper dependencies PTP_1588_CLOCK -> TI_CPTS ->

TI_CPSW/TI_KEYSTONE_NETCP/TI_CPSW_SWITCHDEV and build type selection.

Note. For NFS boot + CPTS all of above configs have to be built-in.

Quoted 8 lines
Cc Arnd Bergmann <[email protected]>
Cc Dan Murphy <[email protected]>
Cc Tony Lindgren <[email protected]>
Fixes b6d49cab44b5 ("net: Make PTP-specific drivers depend on PTP_1588_CLOCK")
[[email protected]: rewording, add deps cpsw/netcp from cpts, drop IS_REACHABLE]
maintainer Tested-by on v4 1/1
#2 lore raw
In reply to Grygorii Strashko

Hi,

Quoted 22 lines · Grygorii Strashko

From: Clay McClure <[email protected]>

My recent commit b6d49cab44b5 ("net: Make PTP-specific drivers depend on PTP_1588_CLOCK") exposes a missing dependency in defconfigs that select TI_CPTS without selecting PTP_1588_CLOCK, leading to linker errors of the form:

drivers/net/ethernet/ti/cpsw.o: in function `cpsw_ndo_stop':
cpsw.c:(.text+0x680): undefined reference to `cpts_unregister'
...

That's because TI_CPTS_MOD (which is the symbol gating the _compilation_ of cpts.c) now depends on PTP_1588_CLOCK, and so is not enabled in these configurations, but TI_CPTS (which is the symbol gating _calls_ to the cpts functions) _is_ enabled. So we end up compiling calls to functions that don't exist, resulting in the linker errors.

This patch fixes build errors and restores previous behavior by:
- ensure PTP_1588_CLOCK=y in TI specific configs and CPTS will be built
- remove TI_CPTS_MOD and, instead, add dependencies from CPTS in TI_CPSW/TI_KEYSTONE_NETCP/TI_CPSW_SWITCHDEV as below:

Quoted 8 lines
   config TI_CPSW_SWITCHDEV
   ...
    depends on TI_CPTS || !TI_CPTS
   which will ensure proper dependencies PTP_1588_CLOCK -> TI_CPTS ->

TI_CPSW/TI_KEYSTONE_NETCP/TI_CPSW_SWITCHDEV and build type selection.

Note. For NFS boot + CPTS all of above configs have to be built-in.

This builds and boots on BBB and beagle x15 with NFSroot so:

However, there's at least one more issue left that shows up at least on ti81xx dra62x-j5eco-evm on v5.7-rc5 that has commit b46b2b7ba6e1 ("ARM: dts: Fix dm814x Ethernet by changing to use rgmii-id mode").

I think this is a different issue though, any ideas?

Regards,

Tony

[    7.278339] 8<--- cut here ---
[    7.281421] Unhandled fault: external abort on non-linefetch (0x1008) at 0xf0169004
[    7.289116] pgd = (ptrval)
[    7.291836] [f0169004] *pgd=ae83a811, *pte=4a101653, *ppte=4a101453
[    7.298154] Internal error: : 1008 [#1] SMP ARM
[    7.302707] Modules linked in:
[    7.305789] CPU: 0 PID: 73 Comm: kworker/0:3 Not tainted 5.7.0-rc5-dirty #1969
[    7.313042] Hardware name: Generic ti814x (Flattened Device Tree)
[    7.319190] Workqueue: pm pm_runtime_work
[    7.323241] PC is at davinci_mdio_runtime_suspend+0xc/0x8c
[    7.328753] LR is at __rpm_callback+0x84/0x154
[    7.333218] pc : [<c0703c98>]    lr : [<c063f2a4>]    psr: a0000013
[    7.339513] sp : eed7be80  ip : fffffffa  fp : 00000008
[    7.344761] r10: ffffe000  r9 : eed3ba40  r8 : 00000000
[    7.350010] r7 : 00000000  r6 : c063c810  r5 : c063c810  r4 : eed1c010
[    7.356568] r3 : f0169000  r2 : 000000d4  r1 : eed1c010  r0 : eed1c010
[    7.363129] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[    7.370297] Control: 10c5387d  Table: 80004019  DAC: 00000051
[    7.376069] Process kworker/0:3 (pid: 73, stack limit = 0x(ptrval))
[    7.382367] Stack: (0xeed7be80 to 0xeed7c000)
[    7.386755] be80: eed1c010 c063c810 c063c810 00000000 00000000 c0e051c8 ffffe000 c063f2a4
[    7.394978] bea0: eed1c010 c063c810 0000000a 00000000 00000000 c063f394 eed1c010 c063c810
[    7.403202] bec0: 0000000a c063f4f0 c0e00018 ef4e2400 ee979880 c0e088c0 00000000 00000001
[    7.411425] bee0: 00000000 ef4e2400 eed7bf44 c09293e8 00000000 ea441c81 0efa67ff eed1c0f4
[    7.419648] bf00: eed5ca80 ef4e2000 ff7edc00 00000000 00000000 c0ebf890 ffffe000 c0640af0
[    7.427871] bf20: eed1c0f4 c0155338 ee979880 ef4e2000 00000008 eed5ca80 eed5ca94 ef4e2000
[    7.436094] bf40: 00000008 ef4e2018 c0e03d00 ef4e2000 ffffe000 c0155eb0 ffffe000 eed5ca80
[    7.444318] bf60: c0155e84 00000000 eed5a880 eed5a840 eed7a000 eed5ca80 c0155e84 ee915eac
[    7.452542] bf80: eed5a85c c015bf38 00000001 eed5a880 c015be04 00000000 00000000 00000000
[    7.460763] bfa0: 00000000 00000000 00000000 c0100168 00000000 00000000 00000000 00000000
[    7.468985] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    7.477207] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[    7.485450] [<c0703c98>] (davinci_mdio_runtime_suspend) from [<c063f2a4>] (__rpm_callback+0x84/0x154)
[    7.494720] [<c063f2a4>] (__rpm_callback) from [<c063f394>] (rpm_callback+0x20/0x80)
[    7.502506] [<c063f394>] (rpm_callback) from [<c063f4f0>] (rpm_suspend+0xfc/0x6ac)
[    7.510117] [<c063f4f0>] (rpm_suspend) from [<c0640af0>] (pm_runtime_work+0x88/0xa4)
[    7.517916] [<c0640af0>] (pm_runtime_work) from [<c0155338>] (process_one_work+0x228/0x568)
[    7.526317] [<c0155338>] (process_one_work) from [<c0155eb0>] (worker_thread+0x2c/0x5d4)
[    7.534460] [<c0155eb0>] (worker_thread) from [<c015bf38>] (kthread+0x134/0x148)
[    7.541900] [<c015bf38>] (kthread) from [<c0100168>] (ret_from_fork+0x14/0x2c)
[    7.549155] Exception stack(0xeed7bfb0 to 0xeed7bff8)
[    7.554233] bfa0:                                     00000000 00000000 00000000 00000000
[    7.562455] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    7.570676] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    7.577331] Code: e8bd8070 e92d47f0 e5909040 e5993004 (e5935004)
[    7.583459] ---[ end trace 42a064f19df2a2ea ]---
[    7.588333] 8<--- cut here ---
#3 lore raw
Quoted 29 lines · Tony Lindgren

Hi,

Quoted 26 lines · Grygorii Strashko

From: Clay McClure <[email protected]>

My recent commit b6d49cab44b5 ("net: Make PTP-specific drivers depend on PTP_1588_CLOCK") exposes a missing dependency in defconfigs that select TI_CPTS without selecting PTP_1588_CLOCK, leading to linker errors of the form:

drivers/net/ethernet/ti/cpsw.o: in function `cpsw_ndo_stop':
cpsw.c:(.text+0x680): undefined reference to `cpts_unregister'
...

That's because TI_CPTS_MOD (which is the symbol gating the _compilation_ of cpts.c) now depends on PTP_1588_CLOCK, and so is not enabled in these configurations, but TI_CPTS (which is the symbol gating _calls_ to the cpts functions) _is_ enabled. So we end up compiling calls to functions that don't exist, resulting in the linker errors.

This patch fixes build errors and restores previous behavior by:
- ensure PTP_1588_CLOCK=y in TI specific configs and CPTS will be built
- remove TI_CPTS_MOD and, instead, add dependencies from CPTS in

    TI_CPSW/TI_KEYSTONE_NETCP/TI_CPSW_SWITCHDEV as below:

    config TI_CPSW_SWITCHDEV
    ...
     depends on TI_CPTS || !TI_CPTS
Quoted 9 lines
Quoted 4 lines
    which will ensure proper dependencies PTP_1588_CLOCK -> TI_CPTS ->

TI_CPSW/TI_KEYSTONE_NETCP/TI_CPSW_SWITCHDEV and build type selection.

Note. For NFS boot + CPTS all of above configs have to be built-in.

This builds and boots on BBB and beagle x15 with NFSroot so:

Thank you for testing.

Quoted 6 lines

However, there's at least one more issue left that shows up at least on ti81xx dra62x-j5eco-evm on v5.7-rc5 that has commit b46b2b7ba6e1 ("ARM: dts: Fix dm814x Ethernet by changing to use rgmii-id mode").

I think this is a different issue though, any ideas?

This seems like completely different issue. Could we have separate thread started for this, pls?

Signature · 2 lines
Best regards,
grygorii
maintainer
#4 lore raw
Quoted 9 lines · Grygorii Strashko
Quoted 6 lines · Tony Lindgren

However, there's at least one more issue left that shows up at least on ti81xx dra62x-j5eco-evm on v5.7-rc5 that has commit b46b2b7ba6e1 ("ARM: dts: Fix dm814x Ethernet by changing to use rgmii-id mode").

I think this is a different issue though, any ideas?

This seems like completely different issue.

OK thanks for checking.

Quoted 1 line

Could we have separate thread started for this, pls?

Sure. No objections to the $subject fix.

Regards,

Tony

maintainer Applied
#5 lore raw
In reply to Grygorii Strashko

From: Grygorii Strashko <[email protected]>
Date: Tue, 12 May 2020 13:02:30 +0300

Quoted 31 lines

From: Clay McClure <[email protected]>

My recent commit b6d49cab44b5 ("net: Make PTP-specific drivers depend on PTP_1588_CLOCK") exposes a missing dependency in defconfigs that select TI_CPTS without selecting PTP_1588_CLOCK, leading to linker errors of the form:

drivers/net/ethernet/ti/cpsw.o: in function `cpsw_ndo_stop':
cpsw.c:(.text+0x680): undefined reference to `cpts_unregister'
...

That's because TI_CPTS_MOD (which is the symbol gating the _compilation_ of cpts.c) now depends on PTP_1588_CLOCK, and so is not enabled in these configurations, but TI_CPTS (which is the symbol gating _calls_ to the cpts functions) _is_ enabled. So we end up compiling calls to functions that don't exist, resulting in the linker errors.

This patch fixes build errors and restores previous behavior by:
- ensure PTP_1588_CLOCK=y in TI specific configs and CPTS will be built
- remove TI_CPTS_MOD and, instead, add dependencies from CPTS in TI_CPSW/TI_KEYSTONE_NETCP/TI_CPSW_SWITCHDEV as below:

   config TI_CPSW_SWITCHDEV
   ...
    depends on TI_CPTS || !TI_CPTS
   which will ensure proper dependencies PTP_1588_CLOCK -> TI_CPTS ->

TI_CPSW/TI_KEYSTONE_NETCP/TI_CPSW_SWITCHDEV and build type selection.

Note. For NFS boot + CPTS all of above configs have to be built-in.

Quoted 8 lines
Cc Arnd Bergmann <[email protected]>
Cc Dan Murphy <[email protected]>
Cc Tony Lindgren <[email protected]>
Fixes b6d49cab44b5 ("net: Make PTP-specific drivers depend on PTP_1588_CLOCK")
[[email protected]: rewording, add deps cpsw/netcp from cpts, drop IS_REACHABLE]

Applied, thanks.