RE: [PATCH V4 4/7] usb: gadget: udc: renesas_usb3: Use usb_role_switch framework

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

 



Hi Biju-san,

Thank you for the patch!

> From: Biju Das, Sent: Tuesday, April 16, 2019 6:38 PM
> 
> RZ/G2E cat874 board is capable of detecting cable connect and disconnect
> events. Add support for renesas_usb3 to receive connect and disconnect
> events and support dual-role switch using usb-role-switch framework.
> 
> Signed-off-by: Biju Das <biju.das@xxxxxxxxxxxxxx>
> ---
>  V3-->V4
>    * No Change
>  V2-->V3
>    * Incorporated Shimoda-san's review comment
>      (https://patchwork.kernel.org/patch/10852507/)
>    * Used renesas,usb-role-switch property for differentiating USB
>      role switch associated with Type-C port controller driver.
>  V1-->V2
>    * Driver uses usb role clas for handling dual role switch and handling
>      connect/disconnect events instead of extcon.
<snip>

> +static void usb3_check_vbus(struct renesas_usb3 *usb3)
> +{
> +	if (usb3->workaround_for_vbus) {
> +		if (usb3->usb_role_switch_property) {
> +			if (usb3->connection_state == USB_ROLE_DEVICE) {
> +				usb3_mode_config(usb3, false, false);

I should have pointed it out the previous version though,
why does this usb3_mode_config() calling need?
My guess is:
 - renesas_usb3_start() calls renesas_usb3_init_controller().
 -- renesas_usb3_init_controller() calls usb3_check_id() and then usb_check_vbus().
 --- usb_check_id() calls usb3_mode_config(usb3, true, true) and then the HW acts as host mode.
 ----> So, you'd like the HW to acts as peripheral mode when the connection_state is USB_ROLE_DEVICE,
       you added that the usb3_check_vbus() calls usb3_mode_config(usb3, false, false).

Is my guess correct? If so, I'd like to add such code into usb3_check_id() like below:

	if ((usb3->extcon_host && !usb3->forced_b_device) ||
	    (usb3->usb_role_switch_property &&
	     usb3->connection_state == USB_ROLE_HOST))
		usb3_mode_config(usb3, true, true);
	else
		usb3_mode_config(usb3, false, false);

What do you think?

Best regards,
Yoshihiro Shimoda





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

  Powered by Linux