[U-Boot] [linux-sunxi] CONFIG_DM_USB breakage on sunxi boards with musb?

Jean-Jacques Hiblot jjhiblot at ti.com
Thu Dec 20 15:50:01 UTC 2018


On 19/12/2018 18:15, Priit Laes wrote:
> On Wed, Dec 19, 2018 at 01:14:22PM +0100, Jean-Jacques Hiblot wrote:
>> On 19/12/2018 12:37, Priit Laes wrote:
>>> On Wed, Dec 19, 2018 at 01:26:18PM +0530, Jagan Teki wrote:
>>>> On Wed, Dec 19, 2018 at 1:23 PM Priit Laes <plaes at plaes.org> wrote:
>>>>> Heya!
>>>>>
>>>>> I ran into following error when trying to fel-boot
>>>>> A20 OLinuxino Lime2 eMMC board with latest u-boot:
>>>>>
>>>>> [snip]
>>>>> U-Boot 2019.01-rc2-00005-gbf60dae9dd (Dec 19 2018 - 09:47:08 +0200) Allwinner Technology
>>>>>
>>>>> CPU:   Allwinner A20 (SUN7I)
>>>>> Model: Olimex A20-OLinuXino-LIME2-eMMC
>>>>> I2C:   ready
>>>>> DRAM:  1 GiB
>>>>> Error binding driver 'sunxi-musb': -96
>>>>> Some drivers failed to bind
>>>>> Error binding driver 'generic_simple_bus': -96
>>>>> Some drivers failed to bind
>>>>> initcall sequence 7efbdfc8 failed at call 4a00d07b (err=-96)
>>>>> ### ERROR ### Please RESET the board ###
>>>>> [/snip]
>>>>>
>>>>>
>>>>> Could it be caused by a side effect of the upcoming CONFIG_DM_USB
>>>>> changes?
>>>> No, board file change wrt this commit 0131162439508801b9f8a330fa731f04273c9337
>>>>
>>>> Need to figure out.
>>> Yup, bisecting points to the same commit and reverting fixes the issue.
>> Can you try with  DM_USB_GADGET enabled?
> Yes, the result is:
>
> drivers/usb/gadget/udc/udc-uclass.c:52: undefined reference to `dm_usb_gadget_handle_interrupts
>
> u-boot configuration file is A20-OLinuXino-Lime2-eMMC_defconfig

Thanks for testing.

Can you try with the following modifications?

It should provide the missing  UCLASS_DRIVER() without having to enable 
DM_USB_GADGET.

If that fixes your problem, I'll run it through buildman and submit a 
proper the patch.


diff --git a/drivers/usb/gadget/udc/Makefile 
b/drivers/usb/gadget/udc/Makefile
index 38ac2dd..73cf84f 100644
--- a/drivers/usb/gadget/udc/Makefile
+++ b/drivers/usb/gadget/udc/Makefile
@@ -6,4 +6,6 @@ ifndef CONFIG_$(SPL_)DM_USB_GADGET
  obj-$(CONFIG_USB_DWC3_GADGET)  += udc-core.o
  endif

-obj-$(CONFIG_$(SPL_)DM_USB_GADGET)     += udc-uclass.o udc-core.o
+obj-$(CONFIG_$(SPL_)DM_USB_GADGET)     += udc-core.o
+obj-$(CONFIG_$(SPL_)DM) += udc-uclass.o
+
diff --git a/drivers/usb/gadget/udc/udc-uclass.c 
b/drivers/usb/gadget/udc/udc-uclass.c
index e9f8f5f..8d78647 100644
--- a/drivers/usb/gadget/udc/udc-uclass.c
+++ b/drivers/usb/gadget/udc/udc-uclass.c
@@ -9,6 +9,7 @@
  #include <dm/device-internal.h>
  #include <linux/usb/gadget.h>

+#if CONFIG_IS_ENABLED(DM_USB_GADGET)
  #define MAX_UDC_DEVICES 4
  static struct udevice *dev_array[MAX_UDC_DEVICES];
  int usb_gadget_initialize(int index)
@@ -51,6 +52,7 @@ int usb_gadget_handle_interrupts(int index)
                 return -EINVAL;
         return dm_usb_gadget_handle_interrupts(dev_array[index]);
  }
+#endif

  UCLASS_DRIVER(usb_gadget_generic) = {
         .id             = UCLASS_USB_GADGET_GENERIC,


>
>>
>>> 0131162439508801b9f8a330fa731f04273c9337 is the first bad commit
>>> commit 0131162439508801b9f8a330fa731f04273c9337
>>> Author: Jean-Jacques Hiblot <jjhiblot at ti.com>
>>> Date:   Thu Nov 29 10:52:46 2018 +0100
>>>
>>>       dm: usb: create a new UCLASS ID for USB gadget devices
>>>       UCLASS_USB_DEV_GENERIC was meant for USB devices connected to host
>>>       controllers, not gadget devices.
>>>       Adding a new UCLASS for gadget devices alone.
>>>       Also move the generic DM code for USB gadgets in a separate file for
>>>       clarity.
>>>       Signed-off-by: Jean-Jacques Hiblot <jjhiblot at ti.com>
>>>
>>> :040000 040000 5223a6058a0c4a1e877f32355c947d4a607fef1b d3f89658db63ec26d887163740cf5d974dd2c0e5 M	board
>>> :040000 040000 67c4404917ada478595b408d7747a6f5c17c0c99 8c67ea39df65e4e982d9b9eeb984d66678a33fc8 M	drivers
>>> :040000 040000 89243fd62729e128489d80e206db4fa9b946dc99 16783bd1f210ae3454255cb1c4eaa05fe7eaa6ed M	include
>>>
>>> $ git bisect log
>>> git bisect start
>>> # bad: [058701534ffde8032649ba8421a0428959519b79] WIP
>>> git bisect bad 058701534ffde8032649ba8421a0428959519b79
>>> # bad: [d94604d558cda9f89722c967d6f8d6269a2db21c] Merge tag 'fsl-qoriq-for-v2019.01-rc2' of git://git.denx.de/u-boot-fsl-qoriq
>>> git bisect bad d94604d558cda9f89722c967d6f8d6269a2db21c
>>> # good: [c49aff3e66b930aa06936afee401cf5e19377958] Merge branch 'master' of git://git.denx.de/u-boot-sunxi
>>> git bisect good c49aff3e66b930aa06936afee401cf5e19377958
>>> # bad: [7ff485c68b7e5573e5a4a877066e98398283a24f] Merge branch 'master' of git://git.denx.de/u-boot-i2c
>>> git bisect bad 7ff485c68b7e5573e5a4a877066e98398283a24f
>>> # good: [19f8c4dfb6e744a31da59bdd23b24d144152f1dc] cmd: i2c: Fix help output of i2c command.
>>> git bisect good 19f8c4dfb6e744a31da59bdd23b24d144152f1dc
>>> # bad: [b491afa0f3c0df88027b08f18934cc034c40d659] configs: enable DM_USB and DM_USB_DEV for all DRA7 platforms
>>> git bisect bad b491afa0f3c0df88027b08f18934cc034c40d659
>>> # bad: [93991cf1969077108ae36e90acb3cd25a6a449ac] dwc3-generic: Add select_dr_mode operation
>>> git bisect bad 93991cf1969077108ae36e90acb3cd25a6a449ac
>>> # good: [20bebd866690bb09dd1c1cb8ac674c3b17b63c6d] dwc3_generic: do not probe the USB device driver when it's bound
>>> git bisect good 20bebd866690bb09dd1c1cb8ac674c3b17b63c6d
>>> # bad: [0131162439508801b9f8a330fa731f04273c9337] dm: usb: create a new UCLASS ID for USB gadget devices
>>> git bisect bad 0131162439508801b9f8a330fa731f04273c9337
>>> # good: [d648a50c0a27452a5439e7982b23b97c64820430] dwc3: move phy operation to core.c
>>> git bisect good d648a50c0a27452a5439e7982b23b97c64820430
>>> # first bad commit: [0131162439508801b9f8a330fa731f04273c9337] dm: usb: create a new UCLASS ID for USB gadget devices
>>>
>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.


More information about the U-Boot mailing list