diff mbox series

[net-next] net: ethernet: ti: am65-cpts: fix build

Message ID 20200505162123.13366-1-grygorii.strashko@ti.com (mailing list archive)
State Mainlined
Commit 01241aa000ab0a685062a448b0d7d97f470f446f
Headers show
Series [net-next] net: ethernet: ti: am65-cpts: fix build | expand

Commit Message

Grygorii Strashko May 5, 2020, 4:21 p.m. UTC
It's possible to have build configuration which will force PTP_1588_CLOCK=m
and so TI_K3_AM65_CPTS=m while still have TI_K3_AM65_CPSW_NUSS=y. This will
cause build failures:

aarch64-linux-gnu-ld: ../drivers/net/ethernet/ti/am65-cpsw-nuss.o: in function `am65_cpsw_init_cpts':
../drivers/net/ethernet/ti/am65-cpsw-nuss.c:1685: undefined reference to `am65_cpts_create'
aarch64-linux-gnu-ld: ../drivers/net/ethernet/ti/am65-cpsw-nuss.c:1685:(.text+0x2e20):
relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `am65_cpts_create'

Fix it by adding dependencies from CPTS in TI_K3_AM65_CPSW_NUSS as below:
   config TI_K3_AM65_CPSW_NUSS
   ...
     depends on TI_K3_AM65_CPTS || !TI_K3_AM65_CPTS

Note. This will create below dependencies and for NFS boot + CPTS all of them
have to be built-in.
  PTP_1588_CLOCK -> TI_K3_AM65_CPTS -> TI_K3_AM65_CPSW_NUSS

While here, clean up TI_K3_AM65_CPTS definition.

Fixes: b1f66a5bee07 ("net: ethernet: ti: am65-cpsw-nuss: enable packet timestamping support")
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reported-by: Anders Roxell <anders.roxell@linaro.org>
---
 drivers/net/ethernet/ti/Kconfig | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Anders Roxell May 5, 2020, 6:50 p.m. UTC | #1
On Tue, 5 May 2020 at 18:21, Grygorii Strashko <grygorii.strashko@ti.com> wrote:
>
> It's possible to have build configuration which will force PTP_1588_CLOCK=m
> and so TI_K3_AM65_CPTS=m while still have TI_K3_AM65_CPSW_NUSS=y. This will
> cause build failures:
>
> aarch64-linux-gnu-ld: ../drivers/net/ethernet/ti/am65-cpsw-nuss.o: in function `am65_cpsw_init_cpts':
> ../drivers/net/ethernet/ti/am65-cpsw-nuss.c:1685: undefined reference to `am65_cpts_create'
> aarch64-linux-gnu-ld: ../drivers/net/ethernet/ti/am65-cpsw-nuss.c:1685:(.text+0x2e20):
> relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `am65_cpts_create'
>
> Fix it by adding dependencies from CPTS in TI_K3_AM65_CPSW_NUSS as below:
>    config TI_K3_AM65_CPSW_NUSS
>    ...
>      depends on TI_K3_AM65_CPTS || !TI_K3_AM65_CPTS
>
> Note. This will create below dependencies and for NFS boot + CPTS all of them
> have to be built-in.
>   PTP_1588_CLOCK -> TI_K3_AM65_CPTS -> TI_K3_AM65_CPSW_NUSS
>
> While here, clean up TI_K3_AM65_CPTS definition.
>
> Fixes: b1f66a5bee07 ("net: ethernet: ti: am65-cpsw-nuss: enable packet timestamping support")
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> Reported-by: Anders Roxell <anders.roxell@linaro.org>

Tested-by: Anders Roxell <anders.roxell@linaro.org>

> ---
>  drivers/net/ethernet/ti/Kconfig | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
> index 4ab35ce7b451..988e907e3322 100644
> --- a/drivers/net/ethernet/ti/Kconfig
> +++ b/drivers/net/ethernet/ti/Kconfig
> @@ -99,7 +99,7 @@ config TI_K3_AM65_CPSW_NUSS
>         depends on ARCH_K3 && OF && TI_K3_UDMA_GLUE_LAYER
>         select TI_DAVINCI_MDIO
>         imply PHY_TI_GMII_SEL
> -       imply TI_AM65_CPTS
> +       depends on TI_K3_AM65_CPTS || !TI_K3_AM65_CPTS

Don't we want to move this so it is below the other 'depends on' ?

Cheers,
Anders

>         help
>           This driver supports TI K3 AM654/J721E CPSW2G Ethernet SubSystem.
>           The two-port Gigabit Ethernet MAC (MCU_CPSW0) subsystem provides
> @@ -112,9 +112,8 @@ config TI_K3_AM65_CPSW_NUSS
>
>  config TI_K3_AM65_CPTS
>         tristate "TI K3 AM65x CPTS"
> -       depends on ARCH_K3 && OF && PTP_1588_CLOCK
> +       depends on ARCH_K3 && OF
>         depends on PTP_1588_CLOCK
> -       select NET_PTP_CLASSIFY
>         help
>           Say y here to support the TI K3 AM65x CPTS with 1588 features such as
>           PTP hardware clock for each CPTS device and network packets
> --
> 2.17.1
>
David Miller May 5, 2020, 8:24 p.m. UTC | #2
From: Grygorii Strashko <grygorii.strashko@ti.com>
Date: Tue, 5 May 2020 19:21:23 +0300

> It's possible to have build configuration which will force PTP_1588_CLOCK=m
> and so TI_K3_AM65_CPTS=m while still have TI_K3_AM65_CPSW_NUSS=y. This will
> cause build failures:
> 
> aarch64-linux-gnu-ld: ../drivers/net/ethernet/ti/am65-cpsw-nuss.o: in function `am65_cpsw_init_cpts':
> ../drivers/net/ethernet/ti/am65-cpsw-nuss.c:1685: undefined reference to `am65_cpts_create'
> aarch64-linux-gnu-ld: ../drivers/net/ethernet/ti/am65-cpsw-nuss.c:1685:(.text+0x2e20):
> relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `am65_cpts_create'
> 
> Fix it by adding dependencies from CPTS in TI_K3_AM65_CPSW_NUSS as below:
>    config TI_K3_AM65_CPSW_NUSS
>    ...
>      depends on TI_K3_AM65_CPTS || !TI_K3_AM65_CPTS
> 
> Note. This will create below dependencies and for NFS boot + CPTS all of them
> have to be built-in.
>   PTP_1588_CLOCK -> TI_K3_AM65_CPTS -> TI_K3_AM65_CPSW_NUSS
> 
> While here, clean up TI_K3_AM65_CPTS definition.
> 
> Fixes: b1f66a5bee07 ("net: ethernet: ti: am65-cpsw-nuss: enable packet timestamping support")
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> Reported-by: Anders Roxell <anders.roxell@linaro.org>

Applied.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index 4ab35ce7b451..988e907e3322 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -99,7 +99,7 @@  config TI_K3_AM65_CPSW_NUSS
 	depends on ARCH_K3 && OF && TI_K3_UDMA_GLUE_LAYER
 	select TI_DAVINCI_MDIO
 	imply PHY_TI_GMII_SEL
-	imply TI_AM65_CPTS
+	depends on TI_K3_AM65_CPTS || !TI_K3_AM65_CPTS
 	help
 	  This driver supports TI K3 AM654/J721E CPSW2G Ethernet SubSystem.
 	  The two-port Gigabit Ethernet MAC (MCU_CPSW0) subsystem provides
@@ -112,9 +112,8 @@  config TI_K3_AM65_CPSW_NUSS
 
 config TI_K3_AM65_CPTS
 	tristate "TI K3 AM65x CPTS"
-	depends on ARCH_K3 && OF && PTP_1588_CLOCK
+	depends on ARCH_K3 && OF
 	depends on PTP_1588_CLOCK
-	select NET_PTP_CLASSIFY
 	help
 	  Say y here to support the TI K3 AM65x CPTS with 1588 features such as
 	  PTP hardware clock for each CPTS device and network packets