Skip to contentSkip to conversation

phy: tegra: Clean-up Makefile for Tegra186

PATCH Applied Jon Hunter 4 participants 5 messages Oct 12 – Nov 12

Subsystems (3)
lore
Share & tools
lore

Jon Hunter

author maintainer
#0 lore raw

PATCH 1/1 phy: tegra: Clean-up Makefile for Tegra186

The Makefile for the Tegra XUSB PHY driver has an entry for every Tegra SoC that compiles the xusb-tegra186.c file. Clean this up by adding a new Kconfig option called PHY_TEGRA186_XUSB that when defined compiles the xusb-tegra186.c file.

Finally, update the xusb.[ch] files to use this new config option as well instead of using the individual SoC Kconfig options.

---
 drivers/phy/tegra/Kconfig  |  6 ++++++
 drivers/phy/tegra/Makefile |  6 +-----
 drivers/phy/tegra/xusb.c   | 10 +---------
 drivers/phy/tegra/xusb.h   | 10 +---------
 4 files changed, 9 insertions(+), 23 deletions(-)
drivers/phy/tegra/Kconfig +6 -0
index b5ed5bc0c8ef..bc14c1c443b1 100644
@@ -11,6 +11,12 @@ config PHY_TEGRA_XUSB
 	  To compile this driver as a module, choose M here: the module will
 	  be called phy-tegra-xusb.
 
+config PHY_TEGRA186_XUSB
+	bool
+	default y if ARCH_TEGRA_186_SOC || ARCH_TEGRA_194_SOC || \
+		     ARCH_TEGRA_234_SOC || ARCH_TEGRA_238_SOC || \
+		     ARCH_TEGRA_264_SOC
+
 config PHY_TEGRA194_P2U
 	tristate "NVIDIA Tegra194 PIPE2UPHY PHY driver"
 	depends on ARCH_TEGRA || COMPILE_TEST
drivers/phy/tegra/Makefile +1 -5
index 018a4cab2b40..7d9c05149d6b 100644
@@ -5,10 +5,6 @@ phy-tegra-xusb-y += xusb.o
 phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_124_SOC) += xusb-tegra124.o
 phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_132_SOC) += xusb-tegra124.o
 phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_210_SOC) += xusb-tegra210.o
-phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_186_SOC) += xusb-tegra186.o
-phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_194_SOC) += xusb-tegra186.o
-phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_234_SOC) += xusb-tegra186.o
-phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_238_SOC) += xusb-tegra186.o
-phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_264_SOC) += xusb-tegra186.o
+phy-tegra-xusb-$(CONFIG_PHY_TEGRA186_XUSB) += xusb-tegra186.o
 obj-$(CONFIG_PHY_TEGRA194_P2U) += phy-tegra194-p2u.o
 obj-$(CONFIG_PHY_TEGRA_MPHY) += phy-tegra-mphy.o
drivers/phy/tegra/xusb.c +1 -9
index 89ce9ac87300..79a3624faa10 100644
@@ -60,31 +60,23 @@ static const struct of_device_id tegra_xusb_padctl_of_match[] = {
 		.data = &tegra210_xusb_padctl_soc,
 	},
 #endif
-#if defined(CONFIG_ARCH_TEGRA_186_SOC)
+#if defined(CONFIG_PHY_TEGRA186_XUSB)
 	{
 		.compatible = "nvidia,tegra186-xusb-padctl",
 		.data = &tegra186_xusb_padctl_soc,
 	},
-#endif
-#if defined(CONFIG_ARCH_TEGRA_194_SOC)
 	{
 		.compatible = "nvidia,tegra194-xusb-padctl",
 		.data = &tegra194_xusb_padctl_soc,
 	},
-#endif
-#if defined(CONFIG_ARCH_TEGRA_234_SOC)
 	{
 		.compatible = "nvidia,tegra234-xusb-padctl",
 		.data = &tegra234_xusb_padctl_soc,
 	},
-#endif
-#if defined(CONFIG_ARCH_TEGRA_238_SOC)
 	{
 		.compatible = "nvidia,tegra238-xusb-padctl",
 		.data = &tegra238_xusb_padctl_soc,
 	},
-#endif
-#if defined(CONFIG_ARCH_TEGRA_264_SOC)
 	{
 		.compatible = "nvidia,tegra264-xusb-padctl",
 		.data = &tegra264_xusb_padctl_soc,
drivers/phy/tegra/xusb.h +1 -9
index b9de4f3b5781..086bb2d09bda 100644
@@ -505,19 +505,11 @@ extern const struct tegra_xusb_padctl_soc tegra124_xusb_padctl_soc;
 #if defined(CONFIG_ARCH_TEGRA_210_SOC)
 extern const struct tegra_xusb_padctl_soc tegra210_xusb_padctl_soc;
 #endif
-#if defined(CONFIG_ARCH_TEGRA_186_SOC)
+#if defined(CONFIG_PHY_TEGRA186_XUSB)
 extern const struct tegra_xusb_padctl_soc tegra186_xusb_padctl_soc;
-#endif
-#if defined(CONFIG_ARCH_TEGRA_194_SOC)
 extern const struct tegra_xusb_padctl_soc tegra194_xusb_padctl_soc;
-#endif
-#if defined(CONFIG_ARCH_TEGRA_234_SOC)
 extern const struct tegra_xusb_padctl_soc tegra234_xusb_padctl_soc;
-#endif
-#if defined(CONFIG_ARCH_TEGRA_238_SOC)
 extern const struct tegra_xusb_padctl_soc tegra238_xusb_padctl_soc;
-#endif
-#if defined(CONFIG_ARCH_TEGRA_264_SOC)
 extern const struct tegra_xusb_padctl_soc tegra264_xusb_padctl_soc;
 #endif
 

---
base-commit: becb95e45ef0dda9ffb35156d909d3da7a2789c3
change-id: 20261012-tegra-phy-e951c11e733c

Best regards,

Signature · 1 line
Jon Hunter <[email protected]>
maintainer
#1 lore raw
Quoted 38 lines · Jon Hunter

The Makefile for the Tegra XUSB PHY driver has an entry for every Tegra SoC that compiles the xusb-tegra186.c file. Clean this up by adding a new Kconfig option called PHY_TEGRA186_XUSB that when defined compiles the xusb-tegra186.c file.

Finally, update the xusb.[ch] files to use this new config option as well instead of using the individual SoC Kconfig options.

---
 drivers/phy/tegra/Kconfig  |  6 ++++++
 drivers/phy/tegra/Makefile |  6 +-----
 drivers/phy/tegra/xusb.c   | 10 +---------
 drivers/phy/tegra/xusb.h   | 10 +---------
 4 files changed, 9 insertions(+), 23 deletions(-)
drivers/phy/tegra/Kconfig +6 -0
index b5ed5bc0c8ef..bc14c1c443b1 100644
@@ -11,6 +11,12 @@ config PHY_TEGRA_XUSB
 	  To compile this driver as a module, choose M here: the module will
 	  be called phy-tegra-xusb.
 
+config PHY_TEGRA186_XUSB
+	bool
+	default y if ARCH_TEGRA_186_SOC || ARCH_TEGRA_194_SOC || \
+		     ARCH_TEGRA_234_SOC || ARCH_TEGRA_238_SOC || \
+		     ARCH_TEGRA_264_SOC
+
 config PHY_TEGRA194_P2U
 	tristate "NVIDIA Tegra194 PIPE2UPHY PHY driver"
 	depends on ARCH_TEGRA || COMPILE_TEST
drivers/phy/tegra/Makefile +0 -0
index 018a4cab2b40..7d9c05149d6b 100644

drivers/phy/tegra/Makefile phy-tegra-xusb-y += xusb.o · line 8

Quoted 9 lines
drivers/phy/tegra/Makefile +1 -5
@@ -5,10 +5,6 @@ phy-tegra-xusb-y += xusb.o
 phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_124_SOC) += xusb-tegra124.o
 phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_132_SOC) += xusb-tegra124.o
 phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_210_SOC) += xusb-tegra210.o
-phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_186_SOC) += xusb-tegra186.o
-phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_194_SOC) += xusb-tegra186.o
-phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_234_SOC) += xusb-tegra186.o
-phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_238_SOC) += xusb-tegra186.o
-phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_264_SOC) += xusb-tegra186.o
+phy-tegra-xusb-$(CONFIG_PHY_TEGRA186_XUSB) += xusb-tegra186.o

I suppose that's one way of doing it, but I don't know if I see the advantage in it. You're effectively trading 5 lines of Makefile for 6 lines of Kconfig.

Quoted 29 lines
drivers/phy/tegra/Makefile +0 -0
 obj-$(CONFIG_PHY_TEGRA194_P2U) += phy-tegra194-p2u.o
 obj-$(CONFIG_PHY_TEGRA_MPHY) += phy-tegra-mphy.o
drivers/phy/tegra/xusb.c +1 -6
index 89ce9ac87300..79a3624faa10 100644
@@ -60,31 +60,23 @@ static const struct of_device_id tegra_xusb_padctl_of_match[] = {
 		.data = &tegra210_xusb_padctl_soc,
 	},
 #endif
-#if defined(CONFIG_ARCH_TEGRA_186_SOC)
+#if defined(CONFIG_PHY_TEGRA186_XUSB)
 	{
 		.compatible = "nvidia,tegra186-xusb-padctl",
 		.data = &tegra186_xusb_padctl_soc,
 	},
-#endif
-#if defined(CONFIG_ARCH_TEGRA_194_SOC)
 	{
 		.compatible = "nvidia,tegra194-xusb-padctl",
 		.data = &tegra194_xusb_padctl_soc,
 	},
-#endif
-#if defined(CONFIG_ARCH_TEGRA_234_SOC)
 	{
 		.compatible = "nvidia,tegra234-xusb-padctl",
 		.data = &tegra234_xusb_padctl_soc,
 	},
-#endif

drivers/phy/tegra/xusb.c static const struct of_device_id tegra_xusb_padctl_of_match[] = { · line 82

Quoted 10 lines
drivers/phy/tegra/xusb.c +0 -3
-#if defined(CONFIG_ARCH_TEGRA_238_SOC)
 	{
 		.compatible = "nvidia,tegra238-xusb-padctl",
 		.data = &tegra238_xusb_padctl_soc,
 	},
-#endif
-#if defined(CONFIG_ARCH_TEGRA_264_SOC)
 	{
 		.compatible = "nvidia,tegra264-xusb-padctl",
 		.data = &tegra264_xusb_padctl_soc,

And this means you now get data for all SoCs as soon as one of them is enabled. Yes, I know that most of the time we want to build multi-SoC kernels anyway, but it now is not just a clean up anymore.

Thierry

author maintainer
#2 lore raw
Quoted 10 lines · Thierry Reding
Quoted 9 lines · Jon Hunter

The Makefile for the Tegra XUSB PHY driver has an entry for every Tegra SoC that compiles the xusb-tegra186.c file. Clean this up by adding a new Kconfig option called PHY_TEGRA186_XUSB that when defined compiles the xusb-tegra186.c file.

Finally, update the xusb.[ch] files to use this new config option as well instead of using the individual SoC Kconfig options.

...

Quoted 33 lines
Quoted 33 lines
drivers/phy/tegra/xusb.c +1 -8
index 89ce9ac87300..79a3624faa10 100644
@@ -60,31 +60,23 @@ static const struct of_device_id tegra_xusb_padctl_of_match[] = {
 		.data = &tegra210_xusb_padctl_soc,
 	},
 #endif
-#if defined(CONFIG_ARCH_TEGRA_186_SOC)
+#if defined(CONFIG_PHY_TEGRA186_XUSB)
 	{
 		.compatible = "nvidia,tegra186-xusb-padctl",
 		.data = &tegra186_xusb_padctl_soc,
 	},
-#endif
-#if defined(CONFIG_ARCH_TEGRA_194_SOC)
 	{
 		.compatible = "nvidia,tegra194-xusb-padctl",
 		.data = &tegra194_xusb_padctl_soc,
 	},
-#endif
-#if defined(CONFIG_ARCH_TEGRA_234_SOC)
 	{
 		.compatible = "nvidia,tegra234-xusb-padctl",
 		.data = &tegra234_xusb_padctl_soc,
 	},
-#endif
-#if defined(CONFIG_ARCH_TEGRA_238_SOC)
 	{
 		.compatible = "nvidia,tegra238-xusb-padctl",
 		.data = &tegra238_xusb_padctl_soc,
 	},
-#endif
Quoted 8 lines

drivers/phy/tegra/xusb.c static const struct of_device_id tegra_xusb_padctl_of_match[] = { · line 82

Quoted 4 lines
drivers/phy/tegra/xusb.c +0 -1
-#if defined(CONFIG_ARCH_TEGRA_264_SOC)
 	{
 		.compatible = "nvidia,tegra264-xusb-padctl",
 		.data = &tegra264_xusb_padctl_soc,

And this means you now get data for all SoCs as soon as one of them is enabled. Yes, I know that most of the time we want to build multi-SoC kernels anyway, but it now is not just a clean up anymore.

So you already get all the data for all the SoCs. This is simply populating the compatible string and pointer for the data structure in the match table.

Prior to commit 8f56fdf3d8cb ("phy: tegra: Add support for Tegra238 XUSB pad controller") it was possible to only have some of the SoC data present, however, due to all the inter-dependencies between all the underlying structures, IMO it became pointless and messy.

So I still see this as a clean-up overall.

Jon

Signature · 1 line
nvpublic
reviewer Reviewed-by on v1 1/1
#3 lore raw
In reply to Jon Hunter
Quoted 9 lines · Jon Hunter

The Makefile for the Tegra XUSB PHY driver has an entry for every Tegra SoC that compiles the xusb-tegra186.c file. Clean this up by adding a new Kconfig option called PHY_TEGRA186_XUSB that when defined compiles the xusb-tegra186.c file.

Finally, update the xusb.[ch] files to use this new config option as well instead of using the individual SoC Kconfig options.

- Mani

maintainer Applied
#4 lore raw
In reply to Jon Hunter
Quoted 9 lines · Jon Hunter

The Makefile for the Tegra XUSB PHY driver has an entry for every Tegra SoC that compiles the xusb-tegra186.c file. Clean this up by adding a new Kconfig option called PHY_TEGRA186_XUSB that when defined compiles the xusb-tegra186.c file.

Finally, update the xusb.[ch] files to use this new config option as well instead of using the individual SoC Kconfig options.

[...]

Applied, thanks!

[1/1] phy: tegra: Clean-up Makefile for Tegra186

      commit: 96dbc4521e9410912b296e1683a025815cff3fcf

Best regards,

Signature · 1 line
~Vinod