Thread (8 messages) 8 messages, 4 authors, 2020-05-07

Re: [PATCH v2] net: ethernet: ti: Remove TI_CPTS_MOD workaround

From: Arnd Bergmann <arnd@arndb.de>
Date: 2020-05-07 21:37:55
Also in: linux-arm-kernel, linux-omap, lkml
Subsystem: networking drivers, the rest · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

On Wed, May 6, 2020 at 10:57 PM Grygorii Strashko
[off-list ref] wrote:
On 06/05/2020 09:51, Clay McClure wrote:
quoted
On Tue, May 05, 2020 at 10:41:26AM +0300, Grygorii Strashko wrote:
quoted hunk ↗ jump to hunk
quoted
Ok. After some thinking and hence you commit b6d49cab44b5 ("net: Make PTP-specific drivers depend on PTP_1588_CLOCK")
seems was merged in net (not net-next)
1) for-net: defconfig changes can be separated to fix build fail, but add change for multi_v7_defconfig
2) for-net-next: rest of changes plus below diff on top of it
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index f3f8bb724294..62f809b67469 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -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
@@ -78,11 +80,9 @@ config TI_CPSW_SWITCHDEV

  config TI_CPTS
         tristate "TI Common Platform Time Sync (CPTS) Support"
-       depends on TI_CPSW || TI_KEYSTONE_NETCP || TI_CPSW_SWITCHDEV || COMPILE_TEST
+       depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || COMPILE_TEST
         depends on COMMON_CLK
         depends on PTP_1588_CLOCK
-       default y if TI_CPSW=y || TI_KEYSTONE_NETCP=y || TI_CPSW_SWITCHDEV=y
-       default m
         ---help---
           This driver supports the Common Platform Time Sync unit of
           the CPSW Ethernet Switch and Keystone 2 1g/10g Switch Subsystem.
@@ -109,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.
It should properly resolve "M" vs "Y" dependencies between
  PTP_1588_CLOCK->TI_CPTS->TI_CPSW

On thing, TI_CPTS can be selected without TI_CPSW, but it's probably ok.
I think that solution is reasonable. I had come up with a different
for when I ran
into the build failure, but I like yours better. Here is my patch, for
reference:


commit 94233d78655876f735189890eb40ef33c49e8523 (HEAD -> randconfig)
Author: Arnd Bergmann [off-list ref]
Date:   Thu May 7 21:25:59 2020 +0200

    cpsw: fix cpts link failure

    When CONFIG_PTP_1588_CLOCK is a loadable module, trying to build cpts
    support into the built-in cpsw driver results in a link error:

    arm-linux-gnueabi-ld: drivers/net/ethernet/ti/cpsw.o: in function
`cpsw_probe':
    cpsw.c:(.text+0x918): undefined reference to `cpts_release'
    arm-linux-gnueabi-ld: drivers/net/ethernet/ti/cpsw.o: in function
`cpsw_remove':
    cpsw.c:(.text+0x1048): undefined reference to `cpts_release'
    arm-linux-gnueabi-ld: drivers/net/ethernet/ti/cpsw.o: in function
`cpsw_rx_handler':
    cpsw.c:(.text+0x12c0): undefined reference to `cpts_rx_timestamp'
    arm-linux-gnueabi-ld: drivers/net/ethernet/ti/cpsw.o: in function
`cpsw_ndo_open':

    Add a dependency for CPTS that only allows it to be enabled when
    doing so does not cause link-time probles.

    Fixes: b6d49cab44b5 ("net: Make PTP-specific drivers depend on
PTP_1588_CLOCK")
    Signed-off-by: Arnd Bergmann [off-list ref]
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index 4ab35ce7b451..571caf4192c5 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -79,6 +79,9 @@ config TI_CPSW_SWITCHDEV
 config TI_CPTS
        bool "TI Common Platform Time Sync (CPTS) Support"
        depends on TI_CPSW || TI_KEYSTONE_NETCP || TI_CPSW_SWITCHDEV
|| COMPILE_TEST
+       depends on TI_CPSW=n || TI_CPSW=PTP_1588_CLOCK || PTP_1588_CLOCK=y
+       depends on TI_KEYSTONE_NETCP=n ||
TI_KEYSTONE_NETCP=PTP_1588_CLOCK || PTP_1588_CLOCK=y
+       depends on TI_CPSW_SWITCHDEV=n ||
TI_CPSW_SWITCHDEV=PTP_1588_CLOCK || PTP_1588_CLOCK=y
        depends on COMMON_CLK
        depends on POSIX_TIMERS
        ---help---
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help