All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phy: renesas: rcar-gen3-usb2: follow the hardware manual procedure
@ 2018-11-21  8:10 ` Yoshihiro Shimoda
  0 siblings, 0 replies; 10+ messages in thread
From: Yoshihiro Shimoda @ 2018-11-21  8:10 UTC (permalink / raw)
  To: kishon; +Cc: linux-kernel, linux-renesas-soc, Yoshihiro Shimoda

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 <yoshihiro.shimoda.uh@renesas.com>
---
 This patch is based on the latest linux-phy / next branch
(commit id = 0eb86fa77f0f0c81631a030f10679a45c05df33a).

 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..a9e53e8 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;
 
+	rcar_gen3_set_linectrl(ch, 0, 1);
+	val = readl(usb2_base + USB2_LINECTRL1);
+	writel(val | USB2_LINECTRL1_DPRPD_EN | USB2_LINECTRL1_DMRPD_EN,
+	       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(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA);
+
+	rcar_gen3_control_otg_irq(ch, 1);
 
 	rcar_gen3_device_recognition(ch);
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] phy: renesas: rcar-gen3-usb2: follow the hardware manual procedure
@ 2018-11-21  8:10 ` Yoshihiro Shimoda
  0 siblings, 0 replies; 10+ messages in thread
From: Yoshihiro Shimoda @ 2018-11-21  8:10 UTC (permalink / raw)
  To: kishon; +Cc: linux-kernel, linux-renesas-soc, Yoshihiro Shimoda

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 <yoshihiro.shimoda.uh@renesas.com>
---
 This patch is based on the latest linux-phy / next branch
(commit id = 0eb86fa77f0f0c81631a030f10679a45c05df33a).

 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..a9e53e8 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;
 
+	rcar_gen3_set_linectrl(ch, 0, 1);
+	val = readl(usb2_base + USB2_LINECTRL1);
+	writel(val | USB2_LINECTRL1_DPRPD_EN | USB2_LINECTRL1_DMRPD_EN,
+	       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(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA);
+
+	rcar_gen3_control_otg_irq(ch, 1);
 
 	rcar_gen3_device_recognition(ch);
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] phy: renesas: rcar-gen3-usb2: follow the hardware manual procedure
  2018-11-21  8:10 ` Yoshihiro Shimoda
@ 2018-11-23  7:55   ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 10+ messages in thread
From: Kishon Vijay Abraham I @ 2018-11-23  7:55 UTC (permalink / raw)
  To: Yoshihiro Shimoda; +Cc: linux-kernel, linux-renesas-soc

Hi,

On 21/11/18 1:40 PM, Yoshihiro Shimoda wrote:
> 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 <yoshihiro.shimoda.uh@renesas.com>
> ---
>  This patch is based on the latest linux-phy / next branch
> (commit id = 0eb86fa77f0f0c81631a030f10679a45c05df33a).

This patch has some weird characters which I saw while applying.

You can see "=20", =3D in the raw format
https://lore.kernel.org/lkml/1542787663-32142-1-git-send-email-yoshihiro.shimoda.uh@renesas.com/raw

Please fix and repost the patch.

Thanks
Kishon
> 
>  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..a9e53e8 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;
>  
> +	rcar_gen3_set_linectrl(ch, 0, 1);
> +	val = readl(usb2_base + USB2_LINECTRL1);
> +	writel(val | USB2_LINECTRL1_DPRPD_EN | USB2_LINECTRL1_DMRPD_EN,
> +	       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(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA);
> +
> +	rcar_gen3_control_otg_irq(ch, 1);
>  
>  	rcar_gen3_device_recognition(ch);
>  }
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] phy: renesas: rcar-gen3-usb2: follow the hardware manual procedure
@ 2018-11-23  7:55   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 10+ messages in thread
From: Kishon Vijay Abraham I @ 2018-11-23  7:55 UTC (permalink / raw)
  To: Yoshihiro Shimoda; +Cc: linux-kernel, linux-renesas-soc

Hi,

On 21/11/18 1:40 PM, Yoshihiro Shimoda wrote:
> 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 <yoshihiro.shimoda.uh@renesas.com>
> ---
>  This patch is based on the latest linux-phy / next branch
> (commit id = 0eb86fa77f0f0c81631a030f10679a45c05df33a).

This patch has some weird characters which I saw while applying.

You can see "=20", =3D in the raw format
https://lore.kernel.org/lkml/1542787663-32142-1-git-send-email-yoshihiro.shimoda.uh@renesas.com/raw

Please fix and repost the patch.

Thanks
Kishon
> 
>  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..a9e53e8 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;
>  
> +	rcar_gen3_set_linectrl(ch, 0, 1);
> +	val = readl(usb2_base + USB2_LINECTRL1);
> +	writel(val | USB2_LINECTRL1_DPRPD_EN | USB2_LINECTRL1_DMRPD_EN,
> +	       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(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA);
> +
> +	rcar_gen3_control_otg_irq(ch, 1);
>  
>  	rcar_gen3_device_recognition(ch);
>  }
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH] phy: renesas: rcar-gen3-usb2: follow the hardware manual procedure
  2018-11-23  7:55   ` Kishon Vijay Abraham I
@ 2018-11-26  7:05     ` Yoshihiro Shimoda
  -1 siblings, 0 replies; 10+ messages in thread
From: Yoshihiro Shimoda @ 2018-11-26  7:05 UTC (permalink / raw)
  To: Kishon Vijay Abraham I; +Cc: linux-kernel, linux-renesas-soc

Hi Kishon-san,

> From: Kishon Vijay Abraham I, Sent: Friday, November 23, 2018 4:55 PM
> 
> Hi,
> 
> On 21/11/18 1:40 PM, Yoshihiro Shimoda wrote:
> > 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 <yoshihiro.shimoda.uh@renesas.com>
> > ---
> >  This patch is based on the latest linux-phy / next branch
> > (commit id = 0eb86fa77f0f0c81631a030f10679a45c05df33a).
> 
> This patch has some weird characters which I saw while applying.
> 
> You can see "=20", =3D in the raw format
> https://lore.kernel.org/lkml/1542787663-32142-1-git-send-email-yoshihiro.shimoda.uh@renesas.com/raw
> 
> Please fix and repost the patch.

I guess this issue seems our company's email server issue..

- From this month, our emails add "Content-Transfer-Encoding: quoted-printable" in the header.
 --> So, we can see "=20" and "=3D" on my emails... 
- Even if I tried to use some options [1] on git v2.19.2, the encoding is still "quoted-printable".

I'm asking our IT team about this behavior now. But, I guess it needs more time...
So, if possible, would you use mbox format [2] to apply this patch?

[1]
 case 1:
   --transfer-encoding=7bit
 case 2:
   --transfer-encoding=7bit --compose-encoding=us-ascii

[2]
https://patchwork.kernel.org/patch/10692091/mbox/

Best regards,
Yoshihiro Shimoda

> Thanks
> Kishon
> >
> >  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..a9e53e8 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;
> >
> > +	rcar_gen3_set_linectrl(ch, 0, 1);
> > +	val = readl(usb2_base + USB2_LINECTRL1);
> > +	writel(val | USB2_LINECTRL1_DPRPD_EN | USB2_LINECTRL1_DMRPD_EN,
> > +	       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(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA);
> > +
> > +	rcar_gen3_control_otg_irq(ch, 1);
> >
> >  	rcar_gen3_device_recognition(ch);
> >  }
> >

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH] phy: renesas: rcar-gen3-usb2: follow the hardware manual procedure
@ 2018-11-26  7:05     ` Yoshihiro Shimoda
  0 siblings, 0 replies; 10+ messages in thread
From: Yoshihiro Shimoda @ 2018-11-26  7:05 UTC (permalink / raw)
  To: Kishon Vijay Abraham I; +Cc: linux-kernel, linux-renesas-soc

Hi Kishon-san,

> From: Kishon Vijay Abraham I, Sent: Friday, November 23, 2018 4:55 PM
> 
> Hi,
> 
> On 21/11/18 1:40 PM, Yoshihiro Shimoda wrote:
> > 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 <yoshihiro.shimoda.uh@renesas.com>
> > ---
> >  This patch is based on the latest linux-phy / next branch
> > (commit id = 0eb86fa77f0f0c81631a030f10679a45c05df33a).
> 
> This patch has some weird characters which I saw while applying.
> 
> You can see "=20", =3D in the raw format
> https://lore.kernel.org/lkml/1542787663-32142-1-git-send-email-yoshihiro.shimoda.uh@renesas.com/raw
> 
> Please fix and repost the patch.

I guess this issue seems our company's email server issue..

- From this month, our emails add "Content-Transfer-Encoding: quoted-printable" in the header.
 --> So, we can see "=20" and "=3D" on my emails... 
- Even if I tried to use some options [1] on git v2.19.2, the encoding is still "quoted-printable".

I'm asking our IT team about this behavior now. But, I guess it needs more time...
So, if possible, would you use mbox format [2] to apply this patch?

[1]
 case 1:
   --transfer-encoding=7bit
 case 2:
   --transfer-encoding=7bit --compose-encoding=us-ascii

[2]
https://patchwork.kernel.org/patch/10692091/mbox/

Best regards,
Yoshihiro Shimoda

> Thanks
> Kishon
> >
> >  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..a9e53e8 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;
> >
> > +	rcar_gen3_set_linectrl(ch, 0, 1);
> > +	val = readl(usb2_base + USB2_LINECTRL1);
> > +	writel(val | USB2_LINECTRL1_DPRPD_EN | USB2_LINECTRL1_DMRPD_EN,
> > +	       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(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA);
> > +
> > +	rcar_gen3_control_otg_irq(ch, 1);
> >
> >  	rcar_gen3_device_recognition(ch);
> >  }
> >

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] phy: renesas: rcar-gen3-usb2: follow the hardware manual procedure
  2018-11-21  8:10 ` Yoshihiro Shimoda
@ 2018-11-26  9:39   ` Simon Horman
  -1 siblings, 0 replies; 10+ messages in thread
From: Simon Horman @ 2018-11-26  9:39 UTC (permalink / raw)
  To: Yoshihiro Shimoda; +Cc: kishon, linux-kernel, linux-renesas-soc

On Wed, Nov 21, 2018 at 08:10:06AM +0000, Yoshihiro Shimoda wrote:
> 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 <yoshihiro.shimoda.uh@renesas.com>
> ---
>  This patch is based on the latest linux-phy / next branch
> (commit id = 0eb86fa77f0f0c81631a030f10679a45c05df33a).
> 
>  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..a9e53e8 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;
>  
> +	rcar_gen3_set_linectrl(ch, 0, 1);
> +	val = readl(usb2_base + USB2_LINECTRL1);
> +	writel(val | USB2_LINECTRL1_DPRPD_EN | USB2_LINECTRL1_DMRPD_EN,
> +	       usb2_base + USB2_LINECTRL1);

I am wondering if as well as the above
USB2_LINECTRL1_DPRPD_EN should be set and
USB2_LINECTRL1_DP_RPD should be cleared.

> +
>  	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(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA);

I wonder if it is appropriate to write 0xffffffff to USB2_OBINTSTA 
and then USB2_OBINT_BITS to USB2_OBINTEN here.

> +
> +	rcar_gen3_control_otg_irq(ch, 1);
>  
>  	rcar_gen3_device_recognition(ch);
>  }
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] phy: renesas: rcar-gen3-usb2: follow the hardware manual procedure
@ 2018-11-26  9:39   ` Simon Horman
  0 siblings, 0 replies; 10+ messages in thread
From: Simon Horman @ 2018-11-26  9:39 UTC (permalink / raw)
  To: Yoshihiro Shimoda; +Cc: kishon, linux-kernel, linux-renesas-soc

On Wed, Nov 21, 2018 at 08:10:06AM +0000, Yoshihiro Shimoda wrote:
> 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 <yoshihiro.shimoda.uh@renesas.com>
> ---
>  This patch is based on the latest linux-phy / next branch
> (commit id = 0eb86fa77f0f0c81631a030f10679a45c05df33a).
> 
>  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..a9e53e8 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;
>  
> +	rcar_gen3_set_linectrl(ch, 0, 1);
> +	val = readl(usb2_base + USB2_LINECTRL1);
> +	writel(val | USB2_LINECTRL1_DPRPD_EN | USB2_LINECTRL1_DMRPD_EN,
> +	       usb2_base + USB2_LINECTRL1);

I am wondering if as well as the above
USB2_LINECTRL1_DPRPD_EN should be set and
USB2_LINECTRL1_DP_RPD should be cleared.

> +
>  	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(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA);

I wonder if it is appropriate to write 0xffffffff to USB2_OBINTSTA 
and then USB2_OBINT_BITS to USB2_OBINTEN here.

> +
> +	rcar_gen3_control_otg_irq(ch, 1);
>  
>  	rcar_gen3_device_recognition(ch);
>  }
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH] phy: renesas: rcar-gen3-usb2: follow the hardware manual procedure
  2018-11-26  9:39   ` Simon Horman
@ 2018-11-30  5:49     ` Yoshihiro Shimoda
  -1 siblings, 0 replies; 10+ messages in thread
From: Yoshihiro Shimoda @ 2018-11-30  5:49 UTC (permalink / raw)
  To: Simon Horman; +Cc: kishon, linux-kernel, linux-renesas-soc

Hi Simon-san,

Thank you for your review!

> From: Simon Horman, Sent: Monday, November 26, 2018 6:39 PM
> 
> On Wed, Nov 21, 2018 at 08:10:06AM +0000, Yoshihiro Shimoda wrote:
> > 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 <yoshihiro.shimoda.uh@renesas.com>
> > ---
> >  This patch is based on the latest linux-phy / next branch
> > (commit id = 0eb86fa77f0f0c81631a030f10679a45c05df33a).
> >
> >  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..a9e53e8 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;
> >
> > +	rcar_gen3_set_linectrl(ch, 0, 1);
> > +	val = readl(usb2_base + USB2_LINECTRL1);
> > +	writel(val | USB2_LINECTRL1_DPRPD_EN | USB2_LINECTRL1_DMRPD_EN,
> > +	       usb2_base + USB2_LINECTRL1);
> 
> I am wondering if as well as the above
> USB2_LINECTRL1_DPRPD_EN should be set and
> USB2_LINECTRL1_DP_RPD should be cleared.

I assumed rcar_gen3_set_linectrl(ch, 0, 1); did
"USB2_LINECTRL1_DP_RPD should be cleared ".
But, the patch is not readable. So, I will fix this.

> > +
> >  	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(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA);
> 
> I wonder if it is appropriate to write 0xffffffff to USB2_OBINTSTA

Also, I'll fix this.

> and then USB2_OBINT_BITS to USB2_OBINTEN here.

I assumed the rcar_gen3_control_otg_irq() below did that.
However, since rcar_gen3_control_otg_irq() does read-modify-write the register,
it is not good as the initial routine because a boot loader wrote the register
with other value. So, I also fix this not to call rcar_gen3_control_otg_irq().

> > +
> > +	rcar_gen3_control_otg_irq(ch, 1);

Best regards,
Yoshihiro Shimoda

> >  	rcar_gen3_device_recognition(ch);
> >  }
> > --
> > 1.9.1
> >

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH] phy: renesas: rcar-gen3-usb2: follow the hardware manual procedure
@ 2018-11-30  5:49     ` Yoshihiro Shimoda
  0 siblings, 0 replies; 10+ messages in thread
From: Yoshihiro Shimoda @ 2018-11-30  5:49 UTC (permalink / raw)
  To: Simon Horman; +Cc: kishon, linux-kernel, linux-renesas-soc

Hi Simon-san,

Thank you for your review!

> From: Simon Horman, Sent: Monday, November 26, 2018 6:39 PM
> 
> On Wed, Nov 21, 2018 at 08:10:06AM +0000, Yoshihiro Shimoda wrote:
> > 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 <yoshihiro.shimoda.uh@renesas.com>
> > ---
> >  This patch is based on the latest linux-phy / next branch
> > (commit id = 0eb86fa77f0f0c81631a030f10679a45c05df33a).
> >
> >  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..a9e53e8 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;
> >
> > +	rcar_gen3_set_linectrl(ch, 0, 1);
> > +	val = readl(usb2_base + USB2_LINECTRL1);
> > +	writel(val | USB2_LINECTRL1_DPRPD_EN | USB2_LINECTRL1_DMRPD_EN,
> > +	       usb2_base + USB2_LINECTRL1);
> 
> I am wondering if as well as the above
> USB2_LINECTRL1_DPRPD_EN should be set and
> USB2_LINECTRL1_DP_RPD should be cleared.

I assumed rcar_gen3_set_linectrl(ch, 0, 1); did
"USB2_LINECTRL1_DP_RPD should be cleared ".
But, the patch is not readable. So, I will fix this.

> > +
> >  	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(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA);
> 
> I wonder if it is appropriate to write 0xffffffff to USB2_OBINTSTA

Also, I'll fix this.

> and then USB2_OBINT_BITS to USB2_OBINTEN here.

I assumed the rcar_gen3_control_otg_irq() below did that.
However, since rcar_gen3_control_otg_irq() does read-modify-write the register,
it is not good as the initial routine because a boot loader wrote the register
with other value. So, I also fix this not to call rcar_gen3_control_otg_irq().

> > +
> > +	rcar_gen3_control_otg_irq(ch, 1);

Best regards,
Yoshihiro Shimoda

> >  	rcar_gen3_device_recognition(ch);
> >  }
> > --
> > 1.9.1
> >

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-11-30 16:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-21  8:10 [PATCH] phy: renesas: rcar-gen3-usb2: follow the hardware manual procedure Yoshihiro Shimoda
2018-11-21  8:10 ` Yoshihiro Shimoda
2018-11-23  7:55 ` Kishon Vijay Abraham I
2018-11-23  7:55   ` Kishon Vijay Abraham I
2018-11-26  7:05   ` Yoshihiro Shimoda
2018-11-26  7:05     ` Yoshihiro Shimoda
2018-11-26  9:39 ` Simon Horman
2018-11-26  9:39   ` Simon Horman
2018-11-30  5:49   ` Yoshihiro Shimoda
2018-11-30  5:49     ` Yoshihiro Shimoda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.