Skip to contentSkip to conversation

usb: gadget: Compile USB ethernet gadget only if NET is enabled

PATCH In review Marek Vasut 3 participants 12 messages Apr 30, 2023 – May 4, 2023 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: gadget: Compile USB ethernet gadget only if NET is enabled

In case NET networking is not enabled, it is not possible to compile the USB ethernet gadget. Protect the symbols in Makefile to avoid build failure. Such build failure may occur e.g. in case NET and USB ethernet gadget is enabled in U-Boot proper, but not in SPL.

---
Cc: Lukasz Majewski <[email protected]>

---
 drivers/usb/gadget/Makefile | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/gadget/Makefile +2 -0
index 6cfe0f3a041..36f65e7eb95 100644
@@ -34,8 +34,10 @@ endif
 
 obj-$(CONFIG_CI_UDC) += ci_udc.o
 
+ifeq ($(CONFIG_$(SPL_TPL_)NET),y)
 obj-$(CONFIG_USB_ETHER) += ether.o
 obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
+endif
 
 # Devices not related to the new gadget layer depend on CONFIG_USB_DEVICE
 # This is really only N900 and USBTTY now.
Signature · 1 line
2.39.2
#1 lore raw
Quoted 17 lines · Marek Vasut

In case NET networking is not enabled, it is not possible to compile the USB ethernet gadget. Protect the symbols in Makefile to avoid build failure. Such build failure may occur e.g. in case NET and USB ethernet gadget is enabled in U-Boot proper, but not in SPL.

---
Cc: Lukasz Majewski <[email protected]>

---
 drivers/usb/gadget/Makefile | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/gadget/Makefile +0 -0
index 6cfe0f3a041..36f65e7eb95 100644

drivers/usb/gadget/Makefile endif · line 43

Quoted 10 lines
drivers/usb/gadget/Makefile +2 -0
@@ -34,8 +34,10 @@ endif
 
 obj-$(CONFIG_CI_UDC) += ci_udc.o
 
+ifeq ($(CONFIG_$(SPL_TPL_)NET),y)
 obj-$(CONFIG_USB_ETHER) += ether.o
 obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
+endif
 
 # Devices not related to the new gadget layer depend on CONFIG_USB_DEVICE
 # This is really only N900 and USBTTY now.

Why can't we just enforce this via Kconfig?

Signature · 1 line
Tom
#2 lore raw
Quoted 27 lines · Tom Rini
Quoted 25 lines · Marek Vasut

In case NET networking is not enabled, it is not possible to compile the USB ethernet gadget. Protect the symbols in Makefile to avoid build failure. Such build failure may occur e.g. in case NET and USB ethernet gadget is enabled in U-Boot proper, but not in SPL.

---
Cc: Lukasz Majewski <[email protected]>

---
  drivers/usb/gadget/Makefile | 2 ++
  1 file changed, 2 insertions(+)
drivers/usb/gadget/Makefile +2 -0
index 6cfe0f3a041..36f65e7eb95 100644
@@ -34,8 +34,10 @@ endif
 
  obj-$(CONFIG_CI_UDC) += ci_udc.o
 
+ifeq ($(CONFIG_$(SPL_TPL_)NET),y)
  obj-$(CONFIG_USB_ETHER) += ether.o
  obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
+endif
 
Quoted 4 lines

drivers/usb/gadget/Makefile endif · line 43

Quoted 2 lines
drivers/usb/gadget/Makefile +0 -0
  # Devices not related to the new gadget layer depend on CONFIG_USB_DEVICE
  # This is really only N900 and USBTTY now.

Why can't we just enforce this via Kconfig?

Because there is no SPL/TPL USB_ETHER Kconfig . Do we want to grow the Kconfig file with those instead ?

#3 lore raw
Quoted 30 lines · Marek Vasut
Quoted 14 lines · Tom Rini
Quoted 12 lines · Marek Vasut

In case NET networking is not enabled, it is not possible to compile the USB ethernet gadget. Protect the symbols in Makefile to avoid build failure. Such build failure may occur e.g. in case NET and USB ethernet gadget is enabled in U-Boot proper, but not in SPL.

---
Cc: Lukasz Majewski <[email protected]>

---
  drivers/usb/gadget/Makefile | 2 ++
  1 file changed, 2 insertions(+)
Quoted 14 lines

drivers/usb/gadget/Makefile endif · line 40

Quoted 12 lines
drivers/usb/gadget/Makefile +2 -0
index 6cfe0f3a041..36f65e7eb95 100644
@@ -34,8 +34,10 @@ endif
  obj-$(CONFIG_CI_UDC) += ci_udc.o
+ifeq ($(CONFIG_$(SPL_TPL_)NET),y)
  obj-$(CONFIG_USB_ETHER) += ether.o
  obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
+endif
  # Devices not related to the new gadget layer depend on CONFIG_USB_DEVICE
  # This is really only N900 and USBTTY now.

Why can't we just enforce this via Kconfig?

Quoted 2 lines

Because there is no SPL/TPL USB_ETHER Kconfig . Do we want to grow the Kconfig file with those instead ?

Ah right. Yes, we have SPL_USB_ETHER today, and could just add SPL_USB_ETH_RNDIS. Are there TPL users today for this? There's no TPL_USB at all.

Signature · 1 line
Tom
#4 lore raw
Quoted 31 lines · Tom Rini
Quoted 30 lines · Marek Vasut
Quoted 28 lines · Tom Rini
Quoted 17 lines · Marek Vasut

In case NET networking is not enabled, it is not possible to compile the USB ethernet gadget. Protect the symbols in Makefile to avoid build failure. Such build failure may occur e.g. in case NET and USB ethernet gadget is enabled in U-Boot proper, but not in SPL.

---
Cc: Lukasz Majewski <[email protected]>

---
   drivers/usb/gadget/Makefile | 2 ++
   1 file changed, 2 insertions(+)
drivers/usb/gadget/Makefile +0 -0
index 6cfe0f3a041..36f65e7eb95 100644

drivers/usb/gadget/Makefile endif · line 40

Quoted 7 lines
drivers/usb/gadget/Makefile +2 -0
@@ -34,8 +34,10 @@ endif
   obj-$(CONFIG_CI_UDC) += ci_udc.o
+ifeq ($(CONFIG_$(SPL_TPL_)NET),y)
   obj-$(CONFIG_USB_ETHER) += ether.o
   obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
+endif
   # Devices not related to the new gadget layer depend on CONFIG_USB_DEVICE
   # This is really only N900 and USBTTY now.

Why can't we just enforce this via Kconfig?

Quoted 4 lines
Quoted 2 lines

Because there is no SPL/TPL USB_ETHER Kconfig . Do we want to grow the Kconfig file with those instead ?

Ah right. Yes, we have SPL_USB_ETHER today

This is exactly the opposite of what I wrote.

And no, we do NOT have this symbol, see:

$ git grep SPL_USB_ETHER drivers/usb | wc -l
0

, and could just add

Quoted 2 lines

SPL_USB_ETH_RNDIS. Are there TPL users today for this? There's no TPL_USB at all.

[...]

#5 lore raw
Quoted 35 lines · Marek Vasut
Quoted 34 lines · Tom Rini
Quoted 32 lines · Marek Vasut
Quoted 14 lines · Tom Rini
Quoted 12 lines · Marek Vasut

In case NET networking is not enabled, it is not possible to compile the USB ethernet gadget. Protect the symbols in Makefile to avoid build failure. Such build failure may occur e.g. in case NET and USB ethernet gadget is enabled in U-Boot proper, but not in SPL.

---
Cc: Lukasz Majewski <[email protected]>

---
   drivers/usb/gadget/Makefile | 2 ++
   1 file changed, 2 insertions(+)
Quoted 14 lines

drivers/usb/gadget/Makefile endif · line 40

Quoted 12 lines
drivers/usb/gadget/Makefile +2 -0
index 6cfe0f3a041..36f65e7eb95 100644
@@ -34,8 +34,10 @@ endif
   obj-$(CONFIG_CI_UDC) += ci_udc.o
+ifeq ($(CONFIG_$(SPL_TPL_)NET),y)
   obj-$(CONFIG_USB_ETHER) += ether.o
   obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
+endif
   # Devices not related to the new gadget layer depend on CONFIG_USB_DEVICE
   # This is really only N900 and USBTTY now.

Why can't we just enforce this via Kconfig?

Because there is no SPL/TPL USB_ETHER Kconfig . Do we want to grow the Kconfig file with those instead ?

Quoted 8 lines
Quoted 1 line

Ah right. Yes, we have SPL_USB_ETHER today

This is exactly the opposite of what I wrote.

And no, we do NOT have this symbol, see:

$ git grep SPL_USB_ETHER drivers/usb | wc -l
0

Yes, it resides in common/spl/Kconfig

Signature · 1 line
Tom
#6 lore raw
Quoted 38 lines · Tom Rini
Quoted 37 lines · Marek Vasut
Quoted 35 lines · Tom Rini
Quoted 30 lines · Marek Vasut
Quoted 14 lines · Tom Rini
Quoted 12 lines · Marek Vasut

In case NET networking is not enabled, it is not possible to compile the USB ethernet gadget. Protect the symbols in Makefile to avoid build failure. Such build failure may occur e.g. in case NET and USB ethernet gadget is enabled in U-Boot proper, but not in SPL.

---
Cc: Lukasz Majewski <[email protected]>

---
    drivers/usb/gadget/Makefile | 2 ++
    1 file changed, 2 insertions(+)
Quoted 14 lines

drivers/usb/gadget/Makefile endif · line 40

Quoted 12 lines
drivers/usb/gadget/Makefile +2 -0
index 6cfe0f3a041..36f65e7eb95 100644
@@ -34,8 +34,10 @@ endif
    obj-$(CONFIG_CI_UDC) += ci_udc.o
+ifeq ($(CONFIG_$(SPL_TPL_)NET),y)
    obj-$(CONFIG_USB_ETHER) += ether.o
    obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
+endif
    # Devices not related to the new gadget layer depend on CONFIG_USB_DEVICE
    # This is really only N900 and USBTTY now.

Why can't we just enforce this via Kconfig?

Quoted 2 lines

Because there is no SPL/TPL USB_ETHER Kconfig . Do we want to grow the Kconfig file with those instead ?

Ah right. Yes, we have SPL_USB_ETHER today

Quoted 8 lines
Quoted 6 lines

This is exactly the opposite of what I wrote.

And no, we do NOT have this symbol, see:

$ git grep SPL_USB_ETHER drivers/usb | wc -l
0

Yes, it resides in common/spl/Kconfig

Uhhhhh, such USB symbol is not supposed to be there in the first place.

However, looking at the meaning of that symbol, it seems it governs something else -- USB ethernet device(s) (like the USB-ethernet adapter which you plug into USB host port). So, the SPL_USB_ETHER symbol name is incorrectly named too and should be renamed to something else first I think ?

Do I read it right ?

And if so, then, back to my original reply -- there is no SPL_USB_ETHER symbol. Does it make more sense to really add one (not misnamed one) or not ?

#7 lore raw
Quoted 41 lines · Marek Vasut
Quoted 40 lines · Tom Rini
Quoted 39 lines · Marek Vasut
Quoted 31 lines · Tom Rini
Quoted 30 lines · Marek Vasut
Quoted 28 lines · Tom Rini
Quoted 17 lines · Marek Vasut

In case NET networking is not enabled, it is not possible to compile the USB ethernet gadget. Protect the symbols in Makefile to avoid build failure. Such build failure may occur e.g. in case NET and USB ethernet gadget is enabled in U-Boot proper, but not in SPL.

---
Cc: Lukasz Majewski <[email protected]>

---
    drivers/usb/gadget/Makefile | 2 ++
    1 file changed, 2 insertions(+)
drivers/usb/gadget/Makefile +0 -0
index 6cfe0f3a041..36f65e7eb95 100644

drivers/usb/gadget/Makefile endif · line 40

Quoted 7 lines
drivers/usb/gadget/Makefile +2 -0
@@ -34,8 +34,10 @@ endif
    obj-$(CONFIG_CI_UDC) += ci_udc.o
+ifeq ($(CONFIG_$(SPL_TPL_)NET),y)
    obj-$(CONFIG_USB_ETHER) += ether.o
    obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
+endif
    # Devices not related to the new gadget layer depend on CONFIG_USB_DEVICE
    # This is really only N900 and USBTTY now.

Why can't we just enforce this via Kconfig?

Quoted 4 lines
Quoted 2 lines

Because there is no SPL/TPL USB_ETHER Kconfig . Do we want to grow the Kconfig file with those instead ?

Ah right. Yes, we have SPL_USB_ETHER today

This is exactly the opposite of what I wrote.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

And no, we do NOT have this symbol, see:

$ git grep SPL_USB_ETHER drivers/usb | wc -l
0

Yes, it resides in common/spl/Kconfig

Uhhhhh, such USB symbol is not supposed to be there in the first place.

There's long running debate on where some symbols should be for a better overall experience of enabling features.

Quoted 11 lines

However, looking at the meaning of that symbol, it seems it governs something else -- USB ethernet device(s) (like the USB-ethernet adapter which you plug into USB host port). So, the SPL_USB_ETHER symbol name is incorrectly named too and should be renamed to something else first I think ?

Do I read it right ?

And if so, then, back to my original reply -- there is no SPL_USB_ETHER symbol. Does it make more sense to really add one (not misnamed one) or not ?

We should re-work things as needed so that we have more Kconfig symbols, as needed. There's some overlap / overloading of things today as platforms have been able to (and I think am335x_evm is still one that builds for) supporting making a USB RNDIS gadget device happen in SPL, so that we can then be fed the next stage of U-Boot.

Signature · 1 line
Tom
#8 lore raw
Quoted 47 lines · Tom Rini
Quoted 46 lines · Marek Vasut
Quoted 45 lines · Tom Rini
Quoted 43 lines · Marek Vasut
Quoted 31 lines · Tom Rini
Quoted 30 lines · Marek Vasut
Quoted 28 lines · Tom Rini
Quoted 17 lines · Marek Vasut

In case NET networking is not enabled, it is not possible to compile the USB ethernet gadget. Protect the symbols in Makefile to avoid build failure. Such build failure may occur e.g. in case NET and USB ethernet gadget is enabled in U-Boot proper, but not in SPL.

---
Cc: Lukasz Majewski <[email protected]>

---
     drivers/usb/gadget/Makefile | 2 ++
     1 file changed, 2 insertions(+)
drivers/usb/gadget/Makefile +0 -0
index 6cfe0f3a041..36f65e7eb95 100644

drivers/usb/gadget/Makefile endif · line 40

Quoted 7 lines
drivers/usb/gadget/Makefile +2 -0
@@ -34,8 +34,10 @@ endif
     obj-$(CONFIG_CI_UDC) += ci_udc.o
+ifeq ($(CONFIG_$(SPL_TPL_)NET),y)
     obj-$(CONFIG_USB_ETHER) += ether.o
     obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
+endif
     # Devices not related to the new gadget layer depend on CONFIG_USB_DEVICE
     # This is really only N900 and USBTTY now.

Why can't we just enforce this via Kconfig?

Quoted 4 lines
Quoted 2 lines

Because there is no SPL/TPL USB_ETHER Kconfig . Do we want to grow the Kconfig file with those instead ?

Ah right. Yes, we have SPL_USB_ETHER today

This is exactly the opposite of what I wrote.

And no, we do NOT have this symbol, see:

$ git grep SPL_USB_ETHER drivers/usb | wc -l
0
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Yes, it resides in common/spl/Kconfig

Uhhhhh, such USB symbol is not supposed to be there in the first place.

There's long running debate on where some symbols should be for a better overall experience of enabling features.

Putting my USB maintainer hat on, USB drivers related symbols should be in drivers/usb/ .

Quoted 12 lines
Quoted 11 lines

However, looking at the meaning of that symbol, it seems it governs something else -- USB ethernet device(s) (like the USB-ethernet adapter which you plug into USB host port). So, the SPL_USB_ETHER symbol name is incorrectly named too and should be renamed to something else first I think ?

Do I read it right ?

And if so, then, back to my original reply -- there is no SPL_USB_ETHER symbol. Does it make more sense to really add one (not misnamed one) or not ?

Quoted 5 lines

We should re-work things as needed so that we have more Kconfig symbols, as needed. There's some overlap / overloading of things today as platforms have been able to (and I think am335x_evm is still one that builds for) supporting making a USB RNDIS gadget device happen in SPL, so that we can then be fed the next stage of U-Boot.

I have a hardware where I only want USB ethernet support in U-Boot, not in SPL, hence this patch.

But the symbol which is currently named SPL_USB_ETHER as defined in common/ does NOT ungate SPL CDC ethernet support, it ungates SPL USB host ethernet (like those ASIX USB-ethernet adapters), do you agree ?

If yes, then the symbol itself should be renamed .

#9 lore raw
Quoted 50 lines · Marek Vasut
Quoted 49 lines · Tom Rini
Quoted 48 lines · Marek Vasut
Quoted 46 lines · Tom Rini
Quoted 35 lines · Marek Vasut
Quoted 34 lines · Tom Rini
Quoted 32 lines · Marek Vasut
Quoted 14 lines · Tom Rini
Quoted 12 lines · Marek Vasut

In case NET networking is not enabled, it is not possible to compile the USB ethernet gadget. Protect the symbols in Makefile to avoid build failure. Such build failure may occur e.g. in case NET and USB ethernet gadget is enabled in U-Boot proper, but not in SPL.

---
Cc: Lukasz Majewski <[email protected]>

---
     drivers/usb/gadget/Makefile | 2 ++
     1 file changed, 2 insertions(+)
Quoted 14 lines

drivers/usb/gadget/Makefile endif · line 40

Quoted 12 lines
drivers/usb/gadget/Makefile +2 -0
index 6cfe0f3a041..36f65e7eb95 100644
@@ -34,8 +34,10 @@ endif
     obj-$(CONFIG_CI_UDC) += ci_udc.o
+ifeq ($(CONFIG_$(SPL_TPL_)NET),y)
     obj-$(CONFIG_USB_ETHER) += ether.o
     obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
+endif
     # Devices not related to the new gadget layer depend on CONFIG_USB_DEVICE
     # This is really only N900 and USBTTY now.

Why can't we just enforce this via Kconfig?

Because there is no SPL/TPL USB_ETHER Kconfig . Do we want to grow the Kconfig file with those instead ?

Quoted 8 lines
Quoted 1 line

Ah right. Yes, we have SPL_USB_ETHER today

This is exactly the opposite of what I wrote.

And no, we do NOT have this symbol, see:

$ git grep SPL_USB_ETHER drivers/usb | wc -l
0

Yes, it resides in common/spl/Kconfig

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Uhhhhh, such USB symbol is not supposed to be there in the first place.

There's long running debate on where some symbols should be for a better overall experience of enabling features.

Putting my USB maintainer hat on, USB drivers related symbols should be in drivers/usb/ .

With everything in Kconfig finally, I have no objection to someone making patches to clean up and make the menus more consistent. However you'd like to move all of SPL*USB* out of common/spl/Kconfig and under drivers/usb/ is OK with me.

Quoted 18 lines
Quoted 12 lines
Quoted 11 lines

However, looking at the meaning of that symbol, it seems it governs something else -- USB ethernet device(s) (like the USB-ethernet adapter which you plug into USB host port). So, the SPL_USB_ETHER symbol name is incorrectly named too and should be renamed to something else first I think ?

Do I read it right ?

And if so, then, back to my original reply -- there is no SPL_USB_ETHER symbol. Does it make more sense to really add one (not misnamed one) or not ?

Quoted 5 lines

We should re-work things as needed so that we have more Kconfig symbols, as needed. There's some overlap / overloading of things today as platforms have been able to (and I think am335x_evm is still one that builds for) supporting making a USB RNDIS gadget device happen in SPL, so that we can then be fed the next stage of U-Boot.

Quoted 8 lines

I have a hardware where I only want USB ethernet support in U-Boot, not in SPL, hence this patch.

But the symbol which is currently named SPL_USB_ETHER as defined in common/ does NOT ungate SPL CDC ethernet support, it ungates SPL USB host ethernet (like those ASIX USB-ethernet adapters), do you agree ?

If yes, then the symbol itself should be renamed .

What I see in terms of wording in common/spl/Kconfig doesn't match what it builds, which is what it's intended to build. Fire up a build of am335x_evm_defconfig and look at what's under drivers/usb/ which is what the platform wants. Gadget ethernet via RNDIS. So the help is wrong on SPL_USB_ETHER.

Signature · 1 line
Tom
Reviewed-by on v1 1/1
#10 lore raw
In reply to Marek Vasut
Quoted 26 lines · On Sun, 30 Apr 2023 23:20:35 +0200 Marek Vasut <[email protected]> wrote:

In case NET networking is not enabled, it is not possible to compile the USB ethernet gadget. Protect the symbols in Makefile to avoid build failure. Such build failure may occur e.g. in case NET and USB ethernet gadget is enabled in U-Boot proper, but not in SPL.

---
Cc: Lukasz Majewski <[email protected]>

---
 drivers/usb/gadget/Makefile | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/gadget/Makefile +2 -0
index 6cfe0f3a041..36f65e7eb95 100644
@@ -34,8 +34,10 @@ endif
 
 obj-$(CONFIG_CI_UDC) += ci_udc.o
 
+ifeq ($(CONFIG_$(SPL_TPL_)NET),y)
 obj-$(CONFIG_USB_ETHER) += ether.o
 obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
+endif
 
 # Devices not related to the new gadget layer depend on
Quoted 1 line

CONFIG_USB_DEVICE # This is really only N900 and USBTTY now.

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

author NAK
#11 lore raw
Quoted 28 lines · Lukasz Majewski
Quoted 25 lines · On Sun, 30 Apr 2023 23:20:35 +0200 Marek Vasut <[email protected]> wrote:

In case NET networking is not enabled, it is not possible to compile the USB ethernet gadget. Protect the symbols in Makefile to avoid build failure. Such build failure may occur e.g. in case NET and USB ethernet gadget is enabled in U-Boot proper, but not in SPL.

---
Cc: Lukasz Majewski <[email protected]>

---
  drivers/usb/gadget/Makefile | 2 ++
  1 file changed, 2 insertions(+)
drivers/usb/gadget/Makefile +2 -0
index 6cfe0f3a041..36f65e7eb95 100644
@@ -34,8 +34,10 @@ endif
 
  obj-$(CONFIG_CI_UDC) += ci_udc.o
 
+ifeq ($(CONFIG_$(SPL_TPL_)NET),y)
  obj-$(CONFIG_USB_ETHER) += ether.o
  obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
+endif
 
Quoted 4 lines
Quoted 2 lines
drivers/usb/gadget/Makefile +0 -0
  # Devices not related to the new gadget layer depend on

CONFIG_USB_DEVICE # This is really only N900 and USBTTY now.

NAK

(so this does not get applied by accident, because ongoing discussion about Kconfig symbols)