Re: Advise for adding Nuvoton BMC Synopsys USB 2.0 device controllers to Linux kernel USB Chipidea driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23-09-07 14:33:29, tomer.maimon@xxxxxxxxxxx wrote:
> Hi Peter
> 
> My name is Tomer I am working in Nuvoton system in the Linux kernel, our project developing BMC SoC for servers.
> In Nuvoton BMC (NPCM) there are ten identical Synopsys USB 2.0 device controllers called NPCM UDC.
> 
> Lately we started to work with USB Chipidea driver to add NPCM UDC as well.
> The NPCM BMC using only the UDC and not the USB host.
> 
> Using the default compatible<https://elixir.bootlin.com/linux/v5.15.130/C/ident/compatible> = "chipidea,usb2<https://elixir.bootlin.com/linux/v5.15.130/B/ident/chipidea%2Cusb2>" didn't work for us since:
> 
> 1.       The USB_MODE should be set at boot or after reset since the reset The USB_MODE is incorrect (0x15002)
> 
> [cid:image002.jpg@01D9E1B1.691030B0]
> 
> 
> It solved by setting USB_MODE during NPCM reset ci_hdrc_npcm_notify_event, now using unique npcm-udc compatible :)
> 
> 
> 
> 2.      vbus_active parameter don't change, stay 0.
> 
> The Device Control Capability Parameters Register (DCCPARAMS) is a read only register that indicate the module is only DC (Device Capable)
> 
> This is why the driver didn't indicate the driver is OTG
> 
> https://elixir.bootlin.com/linux/v6.5.2/source/drivers/usb/chipidea/core.c#L948
> 
>               ci<https://elixir.bootlin.com/linux/v6.5.2/C/ident/ci>->is_otg<https://elixir.bootlin.com/linux/v6.5.2/C/ident/is_otg> = (hw_read<https://elixir.bootlin.com/linux/v6.5.2/C/ident/hw_read>(ci<https://elixir.bootlin.com/linux/v6.5.2/C/ident/ci>, CAP_DCCPARAMS<https://elixir.bootlin.com/linux/v6.5.2/C/ident/CAP_DCCPARAMS>,
> 
>                            DCCPARAMS_DC<https://elixir.bootlin.com/linux/v6.5.2/C/ident/DCCPARAMS_DC> | DCCPARAMS_HC<https://elixir.bootlin.com/linux/v6.5.2/C/ident/DCCPARAMS_HC>)
> 
>                                   == (DCCPARAMS_DC<https://elixir.bootlin.com/linux/v6.5.2/C/ident/DCCPARAMS_DC> | DCCPARAMS_HC<https://elixir.bootlin.com/linux/v6.5.2/C/ident/DCCPARAMS_HC>));
> 
> Why otg is set only when DC and HC is set?
> 
> By enabling ci<https://elixir.bootlin.com/linux/v6.5.2/C/ident/ci>->is_otg<https://elixir.bootlin.com/linux/v6.5.2/C/ident/is_otg> = true we see we need to set the extcon in the device tree, why we need extcon to handle the vbus? Can the vbus be permanent?
> 
> 
> 
> Even after setting extcon vbus to dummy GPIO we succeed to modify the vbus_active parameter to is_active but it didn't worked in the end because it a dummy GPIO that not related to the USB vbus.
> 
> 
> 
> BTW,
> 
> If we adding ci->vbus_active = true at probe stage the UDC Chipidea driver works fine.
> 
> https://elixir.bootlin.com/linux/v6.5.2/source/drivers/usb/chipidea/core.c#L1123
> 
> 
> 
> Appreciate if you could you advise how should we overcome this issue

After loading the gadget driver, try to force "connect" udc using /sys
entry. See the below code at file: drivers/usb/gadget/udc/core.c

static ssize_t soft_connect_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t n)


Your issue is probably due to the UDC don't know it is connected, so DP
is not pulled up.

-- 

Thanks,
Peter Chen



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux