[U-Boot] [PATCH v2] usb: Make USB_MUSB_PIO_ONLY selected by USB_MUSB_SUNXI
Samuel Dionne-Riel
samuel at dionne-riel.com
Wed Nov 27 19:56:02 UTC 2019
This ensures the USB_MUSB_PIO_ONLY config is set to an apppropriate
value from the changes enabling USB_MUSB_GADGET does.
Namely, USB_MUSB_PIO_ONLY default to =y on USB_MUSB_SUNXI being y.
Signed-off-by: Samuel Dionne-Riel <samuel at dionne-riel.com>
---
Changes in v2:
- Use select as a reverse-dependency
As discussed on IRC with Marex,
Some additional context about the bug.
Using `make ..._defconfig` for a sunxi board, then using `make
menuconfig` to change the option `CONFIG_USB_MUSB_GADGET=y` causes
builds to fail. When the same option is set to `=y` via the defconfig
file, the option work. Follows the failure:
```
CC drivers/usb/musb-new/musb_gadget.o
drivers/usb/musb-new/musb_gadget.c: In function 'map_dma_buffer':
drivers/usb/musb-new/musb_gadget.c:103:26: warning: implicit declaration of function 'dma_map_single'; did you mean 'malloc_simple'? [-Wimplicit-function-declaration]
request->request.dma = dma_map_single(
^~~~~~~~~~~~~~
malloc_simple
drivers/usb/musb-new/musb_gadget.c:108:8: error: 'DMA_TO_DEVICE' undeclared (first use in this function); did you mean 'USB_DT_DEVICE'?
? DMA_TO_DEVICE
^~~~~~~~~~~~~
USB_DT_DEVICE
drivers/usb/musb-new/musb_gadget.c:108:8: note: each undeclared identifier is reported only once for each function it appears in
drivers/usb/musb-new/musb_gadget.c:109:8: error: 'DMA_FROM_DEVICE' undeclared (first use in this function); did you mean 'U_BOOT_DEVICE'?
: DMA_FROM_DEVICE);
^~~~~~~~~~~~~~~
U_BOOT_DEVICE
drivers/usb/musb-new/musb_gadget.c:112:3: warning: implicit declaration of function 'dma_sync_single_for_device' [-Wimplicit-function-declaration]
dma_sync_single_for_device(musb->controller,
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/musb-new/musb_gadget.c: In function 'unmap_dma_buffer':
drivers/usb/musb-new/musb_gadget.c:135:3: warning: implicit declaration of function 'dma_unmap_single' [-Wimplicit-function-declaration]
dma_unmap_single(musb->controller,
^~~~~~~~~~~~~~~~
drivers/usb/musb-new/musb_gadget.c:139:7: error: 'DMA_TO_DEVICE' undeclared (first use in this function); did you mean 'USB_DT_DEVICE'?
? DMA_TO_DEVICE
^~~~~~~~~~~~~
USB_DT_DEVICE
drivers/usb/musb-new/musb_gadget.c:140:7: error: 'DMA_FROM_DEVICE' undeclared (first use in this function); did you mean 'U_BOOT_DEVICE'?
: DMA_FROM_DEVICE);
^~~~~~~~~~~~~~~
U_BOOT_DEVICE
drivers/usb/musb-new/musb_gadget.c:143:3: warning: implicit declaration of function 'dma_sync_single_for_cpu' [-Wimplicit-function-declaration]
dma_sync_single_for_cpu(musb->controller,
^~~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [scripts/Makefile.build:279: drivers/usb/musb-new/musb_gadget.o] Error 1
```
By diffing the resulting configuration, Othe main difference found is
`CONFIG_USB_MUSB_PIO_ONLY` is not set when failing, and set to `=y`
when working. This was verified to be the missing option.
As far as I understand it in Kconfig, "is not set" basically marks the
option as using a negative "unset" value, and does not mean that it
will use the default value. This difference in meaning makes it so
that when toggling the option with `make menuconfig`, the option has
already been set to "is not set", and it does not change to its
default value.
The actual bug may be that there is a regression and the code should
work when this value is unset, in this case I do not know how to
provide the proper fix.
This fix corrects the issue by gating the option behind
`if USB_MUSB_HOST || USB_MUSB_GADGET`. To me, it looks like this was
the intention, in the initial patch, but might have been overlooked.
I assume so since the option was defined after the `if`, rather than
before, like the other options not gated behind the option.
drivers/usb/musb-new/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/musb-new/Kconfig b/drivers/usb/musb-new/Kconfig
index 79ad14ef66..d7754014e3 100644
--- a/drivers/usb/musb-new/Kconfig
+++ b/drivers/usb/musb-new/Kconfig
@@ -58,6 +58,7 @@ config USB_MUSB_PIC32
config USB_MUSB_SUNXI
bool "Enable sunxi OTG / DRC USB controller"
depends on ARCH_SUNXI
+ select USB_MUSB_PIO_ONLY
default y
---help---
Say y here to enable support for the sunxi OTG / DRC USB controller
--
2.23.0
More information about the U-Boot
mailing list