Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1517038

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

From Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Newsgroups linux.kernel
Subject RE: [PATCH v3] phy: rcar-gen3-usb2: add sysfs for usb role swap
Date 2016-11-08 11:20 +0100
Message-ID <sBbFw-84M-29@gated-at.bofh.it> (permalink)
References <sBaT8-7uI-19@gated-at.bofh.it> <sBaT8-7uI-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH v3] phy: rcar-gen3-usb2: add sysfs for usb role swap Peter Chen <hzpeterchen@gmail.com> - 2016-11-08 10:30 +0100
  RE: [PATCH v3] phy: rcar-gen3-usb2: add sysfs for usb role swap Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - 2016-11-08 11:20 +0100

csiph-web