On 05/07/2019 02:46 AM, 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 <[email protected]>
> ---
> drivers/phy/renesas/phy-rcar-gen3-usb2.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> index 218b32e458cb..4eaa228ebd30 100644
> --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> @@ -408,7 +408,12 @@ 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
Wait, don't we neeed {} here?
> + /* Not OTG, so dr_mode should be set in PHY node */
> + if (usb_get_dr_mode(channel->dev) == USB_DR_MODE_PERIPHERAL)
> + writel(0x80000000, usb2_base + USB2_COMMCTRL);
> + else
> + writel(0x00000000, usb2_base + USB2_COMMCTRL);
>
> rphy->initialized = true;
>
MBR, Sergei