Message ID | 20190514145605.19112-6-chris.brandt@renesas.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Series | usb: Add host and device support for RZ/A2 | expand |
Hi Chris-san, > From: Chris Brandt, Sent: Tuesday, May 14, 2019 11:56 PM > > When not using OTG, the PHY will need to know if it should function as > host or peripheral by checking dr_mode in the PHY node (not the parent > controller node). > > Signed-off-by: Chris Brandt <chris.brandt@renesas.com> Thank you for the patch! Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Best regards, Yoshihiro Shimoda
On Tue, May 14, 2019 at 09:55:55AM -0500, Chris Brandt wrote: > When not using OTG, the PHY will need to know if it should function as > host or peripheral by checking dr_mode in the PHY node (not the parent > controller node). > > Signed-off-by: Chris Brandt <chris.brandt@renesas.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c index 06e0fc804226..29da9c46ad9b 100644 --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c @@ -412,6 +412,18 @@ static int rcar_gen3_phy_usb2_init(struct phy *p) if (rcar_gen3_needs_init_otg(channel)) rcar_gen3_init_otg(channel); rphy->otg_initialized = true; + } else { + /* Not OTG, so dr_mode should be set in PHY node */ + switch (usb_get_dr_mode(channel->dev)) { + case USB_DR_MODE_HOST: + rcar_gen3_set_host_mode(channel, 1); + break; + case USB_DR_MODE_PERIPHERAL: + rcar_gen3_set_host_mode(channel, 0); + break; + default: + break; + } } rphy->initialized = true;
When not using OTG, the PHY will need to know if it should function as host or peripheral by checking dr_mode in the PHY node (not the parent controller node). Signed-off-by: Chris Brandt <chris.brandt@renesas.com> --- v3: * changed 'if' to 'switch' * use rcar_gen3_set_host_mode() instead of writel() v2: * added braces to else statement * check if dr_mode is "host" --- drivers/phy/renesas/phy-rcar-gen3-usb2.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)