2018-11-30 07:05:22

by Yoshihiro Shimoda

[permalink] [raw]
Subject: [PATCH v2] phy: renesas: rcar-gen3-usb2: follow the hardware manual procedure

This patch modifies rcar_gen3_init_otg() procedure to follow Figure
73.4 of "R-Car Series, 3rd Generation User's Manual: Hardware Rev.1.00".

Signed-off-by: Yoshihiro Shimoda <[email protected]>
---
This patch is based on linux-phy.git / latest next branch
(commit id = 9b28b23a7a12cb07536da93100a907f772f00fea)

Changes from v1:
- Just write value to registers instead of read-modify-write functions
(rcar_gen3_set_linectrl() and rcar_gen3_control_otg_irq().

Also, this is the first email I send after changing the email server
to avoid using quoted-printable encoding.

drivers/phy/renesas/phy-rcar-gen3-usb2.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
index d0f412c..0a34782 100644
--- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
@@ -307,16 +307,21 @@ static void rcar_gen3_init_otg(struct rcar_gen3_chan *ch)
void __iomem *usb2_base = ch->base;
u32 val;

+ /* Should not use functions of read-modify-write a register */
+ val = readl(usb2_base + USB2_LINECTRL1);
+ val = (val & ~USB2_LINECTRL1_DP_RPD) | USB2_LINECTRL1_DPRPD_EN |
+ USB2_LINECTRL1_DMRPD_EN | USB2_LINECTRL1_DM_RPD;
+ writel(val, usb2_base + USB2_LINECTRL1);
+
val = readl(usb2_base + USB2_VBCTRL);
writel(val | USB2_VBCTRL_DRVVBUSSEL, usb2_base + USB2_VBCTRL);
- writel(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA);
- rcar_gen3_control_otg_irq(ch, 1);
val = readl(usb2_base + USB2_ADPCTRL);
writel(val | USB2_ADPCTRL_IDPULLUP, usb2_base + USB2_ADPCTRL);
- val = readl(usb2_base + USB2_LINECTRL1);
- rcar_gen3_set_linectrl(ch, 0, 0);
- writel(val | USB2_LINECTRL1_DPRPD_EN | USB2_LINECTRL1_DMRPD_EN,
- usb2_base + USB2_LINECTRL1);
+
+ msleep(20);
+
+ writel(0xffffffff, usb2_base + USB2_OBINTSTA);
+ writel(USB2_OBINT_BITS, usb2_base + USB2_OBINTEN);

rcar_gen3_device_recognition(ch);
}
--
1.9.1



2018-11-30 07:10:15

by Yoshihiro Shimoda

[permalink] [raw]
Subject: RE: [PATCH v2] phy: renesas: rcar-gen3-usb2: follow the hardware manual procedure

> From: Yoshihiro Shimoda, Sent: Friday, November 30, 2018 4:01 PM
>
<snip>
> Also, this is the first email I send after changing the email server
> to avoid using quoted-printable encoding.

This seems to work :)
https://lore.kernel.org/lkml/1543561257-27594-1-git-send-email-yoshihiro.shimoda.uh@renesas.com/raw

Best regards,
Yoshihiro Shimoda


2018-12-04 05:21:09

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: Re: [PATCH v2] phy: renesas: rcar-gen3-usb2: follow the hardware manual procedure



On 30/11/18 12:39 PM, Yoshihiro Shimoda wrote:
>> From: Yoshihiro Shimoda, Sent: Friday, November 30, 2018 4:01 PM
>>
> <snip>
>> Also, this is the first email I send after changing the email server
>> to avoid using quoted-printable encoding.
>
> This seems to work :)
> https://lore.kernel.org/lkml/1543561257-27594-1-git-send-email-yoshihiro.shimoda.uh@renesas.com/raw

merged now, thanks.

-Kishon
>
> Best regards,
> Yoshihiro Shimoda
>