RE: [PATCH v3] phy: rcar-gen3-usb2: add sysfs for usb role swap

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

 



Hi,

> From: Peter Chen
> Sent: Tuesday, November 08, 2016 6:25 PM
> 
> On Wed, Nov 02, 2016 at 03:47:12PM +0900, Yoshihiro Shimoda wrote:
< snip >
> > +	/* If current and new mode is the same, this returns the error */
> > +	if (is_host == new_mode_is_host)
> > +		return -EINVAL;
> > +
> > +	if (new_mode_is_host) {
> > +		if (!is_b_device && !is_host)	/* A-Peripheral */
> > +			rcar_gen3_init_from_a_peri_to_a_host(ch);
> > +		if (is_b_device && !is_host)	/* B-Peripheral */
> > +			rcar_gen3_init_for_b_host(ch);
> 
> is_host must be false here

Thank you for the review!
I will clean up the code and submit v4 patch soon.

> > +	} else {
> > +		if (!is_b_device && is_host)	/* A-Host */
> > +			rcar_gen3_init_for_a_peri(ch);
> > +		if (is_b_device && is_host)	/* B-Host */
> > +			rcar_gen3_init_for_peri(ch);
> 
> is_host must be true here

Same the above.

> > +	}
> > +
> > +	return count;
> > +}
> > +
> 
> How can you handle the case which ID pin is incorrect, eg, ID is 0, but
> it is peripheral mode at the initialization?

This driver always checks the ID pin and sets the suitable mode in initialization timing.
So, we can ignore such a situation.

< In detail >
 phy_init()			@ drivers/phy/phy-core.c
 --> rcar_gen3_phy_usb2_init()
  --> rcar_gen3_phy_init_otg()
   --> rcar_gen3_device_recognition()
    --> if (!rcar_gen3_check_id(ch))
          rcar_gen3_init_for_host(ch);   <-- Sets the mode as host
        else
          rcar_gen3_init_for_peri(ch);   <-- Sets the mode as peripheral
++phy->init_count;		@ drivers/phy/phy-core.c

Best regards,
Yoshihiro Shimoda

> --
> 
> Best Regards,
> Peter Chen




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux