RE: [PATCH 2/2] usb: dwc2: gadget reuse ahbcfg assigned from platform

2015-02-12 Thread Kaukab, Yousaf
 -Original Message-
 From: John Youn [mailto:john.y...@synopsys.com]
 Sent: Wednesday, February 11, 2015 11:00 PM
 To: Zhangfei Gao; Kaukab, Yousaf
 Cc: ba...@ti.com; john.y...@synopsys.com; linux-usb@vger.kernel.org
 Subject: Re: [PATCH 2/2] usb: dwc2: gadget reuse ahbcfg assigned from
 platform
 
 On 2/6/2015 2:23 PM, John Youn wrote:
  On 2/6/2015 6:02 AM, Zhangfei Gao wrote:
  On 6 February 2015 at 16:07, Kaukab, Yousaf yousaf.kau...@intel.com
 wrote:
  GAHBCFG_HBSTLEN_INCR4  diff --git a/drivers/usb/dwc2/gadget.c
  b/drivers/usb/dwc2/gadget.c index 15aa578..20085de 100644
  --- a/drivers/usb/dwc2/gadget.c
  +++ b/drivers/usb/dwc2/gadget.c
  @@ -2314,9 +2314,13 @@ void
  s3c_hsotg_core_init_disconnected(struct
  dwc2_hsotg *hsotg,
GINTSTS_USBSUSP | GINTSTS_WKUPINT,
hsotg-regs + GINTMSK);
 
  + if ((hsotg-core_params)  (hsotg-core_params-ahbcfg !=
  + -
  1))
  + val = hsotg-core_params-ahbcfg 
  ~GAHBCFG_CTRL_MASK;
  + else
  + val = GAHBCFG_HBSTLEN_INCR4 
  GAHBCFG_HBSTLEN_SHIFT;
  +
if (using_dma(hsotg))
  - writel(GAHBCFG_GLBL_INTR_EN |
  GAHBCFG_DMA_EN |
  -(GAHBCFG_HBSTLEN_INCR4 
  GAHBCFG_HBSTLEN_SHIFT),
  + writel(GAHBCFG_GLBL_INTR_EN |
  GAHBCFG_DMA_EN | val,
   hsotg-regs + GAHBCFG);
else
writel(((hsotg-dedicated_fifos) ?
  (GAHBCFG_NP_TXF_EMP_LVL |
 
  There are other bits in GAHBCFG that can be set from platform.
  They will be
  preserved by your patch, as they are not part of GAHBCFG_CTRL_MASK,
  but only in case dma is enabled. Perhaps preserve them in non-dma case
 as well.
 
  Here may have issue if also set hsotg-core_params-ahbcfg for
  non-dma case, since GAHBCFG[4:1] may be set.
 
  You can mask off HBstLen in that case. However, I don't think setting 
  burst
 length will be an issue in non DMA case as DWC2 will not act as a bus master.
 John, can you please confirm if setting burst length will be an issue in 
 non-dma
 case?
 
  I don't think it hurts to preserve those bits, but I will check.
 
 
 I can confirm that AHB_SINGLE, NOTI_ALL_DMA_WRIT, REM_MEM_SUPP,
 HBSTLEN, and INV_DESC_ENDIANNESS only apply in DMA mode and are
 ignored in slave mode operation.

John, thank you! So, there is no harm in setting these in non-dma mode.

 
 John
 
 

BR,
Yousaf
N�r��yb�X��ǧv�^�)޺{.n�+{��^n�r���z���h����G���h�(�階�ݢj���m��z�ޖ���f���h���~�m�

Re: [PATCH 2/2] usb: dwc2: gadget reuse ahbcfg assigned from platform

2015-02-12 Thread John Youn
On 2/12/2015 1:04 AM, Kaukab, Yousaf wrote:
 -Original Message-
 From: John Youn [mailto:john.y...@synopsys.com]
 Sent: Wednesday, February 11, 2015 11:00 PM
 To: Zhangfei Gao; Kaukab, Yousaf
 Cc: ba...@ti.com; john.y...@synopsys.com; linux-usb@vger.kernel.org
 Subject: Re: [PATCH 2/2] usb: dwc2: gadget reuse ahbcfg assigned from
 platform

 On 2/6/2015 2:23 PM, John Youn wrote:
 On 2/6/2015 6:02 AM, Zhangfei Gao wrote:
 On 6 February 2015 at 16:07, Kaukab, Yousaf yousaf.kau...@intel.com
 wrote:
 GAHBCFG_HBSTLEN_INCR4  diff --git a/drivers/usb/dwc2/gadget.c
 b/drivers/usb/dwc2/gadget.c index 15aa578..20085de 100644
 --- a/drivers/usb/dwc2/gadget.c
 +++ b/drivers/usb/dwc2/gadget.c
 @@ -2314,9 +2314,13 @@ void
 s3c_hsotg_core_init_disconnected(struct
 dwc2_hsotg *hsotg,
   GINTSTS_USBSUSP | GINTSTS_WKUPINT,
   hsotg-regs + GINTMSK);

 + if ((hsotg-core_params)  (hsotg-core_params-ahbcfg !=
 + -
 1))
 + val = hsotg-core_params-ahbcfg 
 ~GAHBCFG_CTRL_MASK;
 + else
 + val = GAHBCFG_HBSTLEN_INCR4 
 GAHBCFG_HBSTLEN_SHIFT;
 +
   if (using_dma(hsotg))
 - writel(GAHBCFG_GLBL_INTR_EN |
 GAHBCFG_DMA_EN |
 -(GAHBCFG_HBSTLEN_INCR4 
 GAHBCFG_HBSTLEN_SHIFT),
 + writel(GAHBCFG_GLBL_INTR_EN |
 GAHBCFG_DMA_EN | val,
  hsotg-regs + GAHBCFG);
   else
   writel(((hsotg-dedicated_fifos) ?
 (GAHBCFG_NP_TXF_EMP_LVL |

 There are other bits in GAHBCFG that can be set from platform.
 They will be
 preserved by your patch, as they are not part of GAHBCFG_CTRL_MASK,
 but only in case dma is enabled. Perhaps preserve them in non-dma case
 as well.

 Here may have issue if also set hsotg-core_params-ahbcfg for
 non-dma case, since GAHBCFG[4:1] may be set.

 You can mask off HBstLen in that case. However, I don't think setting 
 burst
 length will be an issue in non DMA case as DWC2 will not act as a bus master.
 John, can you please confirm if setting burst length will be an issue in 
 non-dma
 case?

 I don't think it hurts to preserve those bits, but I will check.


 I can confirm that AHB_SINGLE, NOTI_ALL_DMA_WRIT, REM_MEM_SUPP,
 HBSTLEN, and INV_DESC_ENDIANNESS only apply in DMA mode and are
 ignored in slave mode operation.
 
 John, thank you! So, there is no harm in setting these in non-dma mode.
 

That's correct.

John



--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] usb: dwc2: gadget reuse ahbcfg assigned from platform

2015-02-11 Thread John Youn
On 2/6/2015 2:23 PM, John Youn wrote:
 On 2/6/2015 6:02 AM, Zhangfei Gao wrote:
 On 6 February 2015 at 16:07, Kaukab, Yousaf yousaf.kau...@intel.com wrote:
 GAHBCFG_HBSTLEN_INCR4  diff --git a/drivers/usb/dwc2/gadget.c
 b/drivers/usb/dwc2/gadget.c index 15aa578..20085de 100644
 --- a/drivers/usb/dwc2/gadget.c
 +++ b/drivers/usb/dwc2/gadget.c
 @@ -2314,9 +2314,13 @@ void s3c_hsotg_core_init_disconnected(struct
 dwc2_hsotg *hsotg,
   GINTSTS_USBSUSP | GINTSTS_WKUPINT,
   hsotg-regs + GINTMSK);

 + if ((hsotg-core_params)  (hsotg-core_params-ahbcfg != -
 1))
 + val = hsotg-core_params-ahbcfg 
 ~GAHBCFG_CTRL_MASK;
 + else
 + val = GAHBCFG_HBSTLEN_INCR4 
 GAHBCFG_HBSTLEN_SHIFT;
 +
   if (using_dma(hsotg))
 - writel(GAHBCFG_GLBL_INTR_EN |
 GAHBCFG_DMA_EN |
 -(GAHBCFG_HBSTLEN_INCR4 
 GAHBCFG_HBSTLEN_SHIFT),
 + writel(GAHBCFG_GLBL_INTR_EN |
 GAHBCFG_DMA_EN | val,
  hsotg-regs + GAHBCFG);
   else
   writel(((hsotg-dedicated_fifos) ?
 (GAHBCFG_NP_TXF_EMP_LVL |

 There are other bits in GAHBCFG that can be set from platform. They will 
 be
 preserved by your patch, as they are not part of GAHBCFG_CTRL_MASK, but
 only in case dma is enabled. Perhaps preserve them in non-dma case as well.

 Here may have issue if also set hsotg-core_params-ahbcfg for non-dma 
 case,
 since GAHBCFG[4:1] may be set.

 You can mask off HBstLen in that case. However, I don't think setting burst 
 length will be an issue in non DMA case as DWC2 will not act as a bus 
 master. John, can you please confirm if setting burst length will be an 
 issue in non-dma case?
 
 I don't think it hurts to preserve those bits, but I will check.
 

I can confirm that AHB_SINGLE, NOTI_ALL_DMA_WRIT, REM_MEM_SUPP, HBSTLEN,
and INV_DESC_ENDIANNESS only apply in DMA mode and are ignored in
slave mode operation.

John



--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 2/2] usb: dwc2: gadget reuse ahbcfg assigned from platform

2015-02-06 Thread Kaukab, Yousaf


 -Original Message-
 From: Zhangfei Gao [mailto:zhangfei@linaro.org]
 Sent: Thursday, February 5, 2015 3:22 AM
 To: Kaukab, Yousaf
 Cc: ba...@ti.com; john.y...@synopsys.com; linux-usb@vger.kernel.org
 Subject: Re: [PATCH 2/2] usb: dwc2: gadget reuse ahbcfg assigned from
 platform
 
 Hi Yousaf
 
 On 4 February 2015 at 17:41, Kaukab, Yousaf yousaf.kau...@intel.com
 wrote:
  diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index
  d5197d4..8d388cc 100644
  --- a/drivers/usb/dwc2/core.c
  +++ b/drivers/usb/dwc2/core.c
  @@ -2563,7 +2563,7 @@ void dwc2_set_param_reload_ctl(struct
  dwc2_hsotg *hsotg, int val)
 
   void dwc2_set_param_ahbcfg(struct dwc2_hsotg *hsotg, int val)  {
  - if (val != -1)
  + if (val)
hsotg-core_params-ahbcfg = val;
else
hsotg-core_params-ahbcfg =
  GAHBCFG_HBSTLEN_INCR4  diff --git a/drivers/usb/dwc2/gadget.c
  b/drivers/usb/dwc2/gadget.c index 15aa578..20085de 100644
  --- a/drivers/usb/dwc2/gadget.c
  +++ b/drivers/usb/dwc2/gadget.c
  @@ -2314,9 +2314,13 @@ void s3c_hsotg_core_init_disconnected(struct
  dwc2_hsotg *hsotg,
GINTSTS_USBSUSP | GINTSTS_WKUPINT,
hsotg-regs + GINTMSK);
 
  + if ((hsotg-core_params)  (hsotg-core_params-ahbcfg != -
  1))
  + val = hsotg-core_params-ahbcfg 
  ~GAHBCFG_CTRL_MASK;
  + else
  + val = GAHBCFG_HBSTLEN_INCR4 
  GAHBCFG_HBSTLEN_SHIFT;
  +
if (using_dma(hsotg))
  - writel(GAHBCFG_GLBL_INTR_EN |
  GAHBCFG_DMA_EN |
  -(GAHBCFG_HBSTLEN_INCR4 
  GAHBCFG_HBSTLEN_SHIFT),
  + writel(GAHBCFG_GLBL_INTR_EN |
  GAHBCFG_DMA_EN | val,
   hsotg-regs + GAHBCFG);
else
writel(((hsotg-dedicated_fifos) ?
  (GAHBCFG_NP_TXF_EMP_LVL |
 
  There are other bits in GAHBCFG that can be set from platform. They will be
 preserved by your patch, as they are not part of GAHBCFG_CTRL_MASK, but
 only in case dma is enabled. Perhaps preserve them in non-dma case as well.
 
 Here may have issue if also set hsotg-core_params-ahbcfg for non-dma case,
 since GAHBCFG[4:1] may be set.

You can mask off HBstLen in that case. However, I don't think setting burst 
length will be an issue in non DMA case as DWC2 will not act as a bus master. 
John, can you please confirm if setting burst length will be an issue in 
non-dma case?

 
 Though from drivers/usb/dwc2/core.h we can not see @ahbcfg is specifically
 used for dma case, most case in drivers/usb/dwc2/platform.c use ahbcfg is set
 hbstlen, GAHBCFG[4:1].
 For example, our platform set GAHBCFG_HBSTLEN_INCR16.
 
 So I just assume @ahbcfg is used for dma case.
 What do you think.

While you are fixing it, why not fix it for other bits, for example AHBSingle, 
InvDescEndianness etc.,  which are part of the same register and will be 
overwritten at the same place.
 
 Thanks

BR,
Yousaf


Re: [PATCH 2/2] usb: dwc2: gadget reuse ahbcfg assigned from platform

2015-02-06 Thread John Youn
On 2/6/2015 6:02 AM, Zhangfei Gao wrote:
 On 6 February 2015 at 16:07, Kaukab, Yousaf yousaf.kau...@intel.com wrote:
 GAHBCFG_HBSTLEN_INCR4  diff --git a/drivers/usb/dwc2/gadget.c
 b/drivers/usb/dwc2/gadget.c index 15aa578..20085de 100644
 --- a/drivers/usb/dwc2/gadget.c
 +++ b/drivers/usb/dwc2/gadget.c
 @@ -2314,9 +2314,13 @@ void s3c_hsotg_core_init_disconnected(struct
 dwc2_hsotg *hsotg,
   GINTSTS_USBSUSP | GINTSTS_WKUPINT,
   hsotg-regs + GINTMSK);

 + if ((hsotg-core_params)  (hsotg-core_params-ahbcfg != -
 1))
 + val = hsotg-core_params-ahbcfg 
 ~GAHBCFG_CTRL_MASK;
 + else
 + val = GAHBCFG_HBSTLEN_INCR4 
 GAHBCFG_HBSTLEN_SHIFT;
 +
   if (using_dma(hsotg))
 - writel(GAHBCFG_GLBL_INTR_EN |
 GAHBCFG_DMA_EN |
 -(GAHBCFG_HBSTLEN_INCR4 
 GAHBCFG_HBSTLEN_SHIFT),
 + writel(GAHBCFG_GLBL_INTR_EN |
 GAHBCFG_DMA_EN | val,
  hsotg-regs + GAHBCFG);
   else
   writel(((hsotg-dedicated_fifos) ?
 (GAHBCFG_NP_TXF_EMP_LVL |

 There are other bits in GAHBCFG that can be set from platform. They will be
 preserved by your patch, as they are not part of GAHBCFG_CTRL_MASK, but
 only in case dma is enabled. Perhaps preserve them in non-dma case as well.

 Here may have issue if also set hsotg-core_params-ahbcfg for non-dma case,
 since GAHBCFG[4:1] may be set.

 You can mask off HBstLen in that case. However, I don't think setting burst 
 length will be an issue in non DMA case as DWC2 will not act as a bus 
 master. John, can you please confirm if setting burst length will be an 
 issue in non-dma case?

I don't think it hurts to preserve those bits, but I will check.


 diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index
 d5197d4..8d388cc 100644
 --- a/drivers/usb/dwc2/core.c
 +++ b/drivers/usb/dwc2/core.c
 @@ -2563,7 +2563,7 @@ void dwc2_set_param_reload_ctl(struct dwc2_hsotg
 *hsotg, int val)
 
  void dwc2_set_param_ahbcfg(struct dwc2_hsotg *hsotg, int val)  {
 - if (val != -1)
 + if (val)
   hsotg-core_params-ahbcfg = val;
   else
   hsotg-core_params-ahbcfg =

Doesn't this already takes care of setting a default value if
unset? So you can leave this unchanged and just use the value in
gadget.c without any further checking.

Regards,
John



--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] usb: dwc2: gadget reuse ahbcfg assigned from platform

2015-02-06 Thread Zhangfei Gao
On 6 February 2015 at 16:07, Kaukab, Yousaf yousaf.kau...@intel.com wrote:
  GAHBCFG_HBSTLEN_INCR4  diff --git a/drivers/usb/dwc2/gadget.c
  b/drivers/usb/dwc2/gadget.c index 15aa578..20085de 100644
  --- a/drivers/usb/dwc2/gadget.c
  +++ b/drivers/usb/dwc2/gadget.c
  @@ -2314,9 +2314,13 @@ void s3c_hsotg_core_init_disconnected(struct
  dwc2_hsotg *hsotg,
GINTSTS_USBSUSP | GINTSTS_WKUPINT,
hsotg-regs + GINTMSK);
 
  + if ((hsotg-core_params)  (hsotg-core_params-ahbcfg != -
  1))
  + val = hsotg-core_params-ahbcfg 
  ~GAHBCFG_CTRL_MASK;
  + else
  + val = GAHBCFG_HBSTLEN_INCR4 
  GAHBCFG_HBSTLEN_SHIFT;
  +
if (using_dma(hsotg))
  - writel(GAHBCFG_GLBL_INTR_EN |
  GAHBCFG_DMA_EN |
  -(GAHBCFG_HBSTLEN_INCR4 
  GAHBCFG_HBSTLEN_SHIFT),
  + writel(GAHBCFG_GLBL_INTR_EN |
  GAHBCFG_DMA_EN | val,
   hsotg-regs + GAHBCFG);
else
writel(((hsotg-dedicated_fifos) ?
  (GAHBCFG_NP_TXF_EMP_LVL |
 
  There are other bits in GAHBCFG that can be set from platform. They will be
 preserved by your patch, as they are not part of GAHBCFG_CTRL_MASK, but
 only in case dma is enabled. Perhaps preserve them in non-dma case as well.

 Here may have issue if also set hsotg-core_params-ahbcfg for non-dma case,
 since GAHBCFG[4:1] may be set.

 You can mask off HBstLen in that case. However, I don't think setting burst 
 length will be an issue in non DMA case as DWC2 will not act as a bus master. 
 John, can you please confirm if setting burst length will be an issue in 
 non-dma case?

It would be great if John has some input.
I am not sure, just doubt ahbcfg is specifically used for dma mode.

static int dwc2_gahbcfg_init(struct dwc2_hsotg *hsotg)
{
case GHWCFG2_INT_DMA_ARCH:
dev_dbg(hsotg-dev, Internal DMA Mode\n);
if (hsotg-core_params-ahbcfg != -1) {
ahbcfg = GAHBCFG_CTRL_MASK;
ahbcfg |= hsotg-core_params-ahbcfg 
  ~GAHBCFG_CTRL_MASK;
}
break;
}

Looks like only GHWCFG2_INT_DMA_ARCH case cares the value of ahbcfg.



 Though from drivers/usb/dwc2/core.h we can not see @ahbcfg is specifically
 used for dma case, most case in drivers/usb/dwc2/platform.c use ahbcfg is set
 hbstlen, GAHBCFG[4:1].
 For example, our platform set GAHBCFG_HBSTLEN_INCR16.

 So I just assume @ahbcfg is used for dma case.
 What do you think.

 While you are fixing it, why not fix it for other bits, for example 
 AHBSingle, InvDescEndianness etc.,  which are part of the same register and 
 will be overwritten at the same place.

Yes, understand.
Not sure other value need to be overwirtten, if only GAHBCFG[4:1],
burst len, maybe we can add another property?

Will update accordingly after John give some info.

Thanks Yousaf
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 2/2] usb: dwc2: gadget reuse ahbcfg assigned from platform

2015-02-04 Thread Kaukab, Yousaf


 -Original Message-
 From: Zhangfei Gao [mailto:zhangfei@linaro.org]
 Sent: Wednesday, February 4, 2015 9:01 AM
 To: Kaukab, Yousaf; ba...@ti.com; john.y...@synopsys.com
 Cc: linux-usb@vger.kernel.org; Zhangfei Gao
 Subject: [PATCH 2/2] usb: dwc2: gadget reuse ahbcfg assigned from platform
 
 Gadget directly set GAHBCFG_HBSTLEN_INCR4, reuse ahbcfg if assigned from
 platform
 
 Signed-off-by: Zhangfei Gao zhangfei@linaro.org
 ---
  drivers/usb/dwc2/core.c   | 2 +-
  drivers/usb/dwc2/gadget.c | 8 ++--
  2 files changed, 7 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index
 d5197d4..8d388cc 100644
 --- a/drivers/usb/dwc2/core.c
 +++ b/drivers/usb/dwc2/core.c
 @@ -2563,7 +2563,7 @@ void dwc2_set_param_reload_ctl(struct dwc2_hsotg
 *hsotg, int val)
 
  void dwc2_set_param_ahbcfg(struct dwc2_hsotg *hsotg, int val)  {
 - if (val != -1)
 + if (val)
   hsotg-core_params-ahbcfg = val;
   else
   hsotg-core_params-ahbcfg =
 GAHBCFG_HBSTLEN_INCR4  diff --git a/drivers/usb/dwc2/gadget.c
 b/drivers/usb/dwc2/gadget.c index 15aa578..20085de 100644
 --- a/drivers/usb/dwc2/gadget.c
 +++ b/drivers/usb/dwc2/gadget.c
 @@ -2314,9 +2314,13 @@ void s3c_hsotg_core_init_disconnected(struct
 dwc2_hsotg *hsotg,
   GINTSTS_USBSUSP | GINTSTS_WKUPINT,
   hsotg-regs + GINTMSK);
 
 + if ((hsotg-core_params)  (hsotg-core_params-ahbcfg != -
 1))
 + val = hsotg-core_params-ahbcfg 
 ~GAHBCFG_CTRL_MASK;
 + else
 + val = GAHBCFG_HBSTLEN_INCR4 
 GAHBCFG_HBSTLEN_SHIFT;
 +
   if (using_dma(hsotg))
 - writel(GAHBCFG_GLBL_INTR_EN |
 GAHBCFG_DMA_EN |
 -(GAHBCFG_HBSTLEN_INCR4 
 GAHBCFG_HBSTLEN_SHIFT),
 + writel(GAHBCFG_GLBL_INTR_EN |
 GAHBCFG_DMA_EN | val,
  hsotg-regs + GAHBCFG);
   else
   writel(((hsotg-dedicated_fifos) ?
 (GAHBCFG_NP_TXF_EMP_LVL |

There are other bits in GAHBCFG that can be set from platform. They will be 
preserved by your patch, as they are not part of GAHBCFG_CTRL_MASK, but only in 
case dma is enabled. Perhaps preserve them in non-dma case as well.

 --
 1.9.1

BR,
Yousaf

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] usb: dwc2: gadget reuse ahbcfg assigned from platform

2015-02-04 Thread Zhangfei Gao
Hi Yousaf

On 4 February 2015 at 17:41, Kaukab, Yousaf yousaf.kau...@intel.com wrote:
 diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index
 d5197d4..8d388cc 100644
 --- a/drivers/usb/dwc2/core.c
 +++ b/drivers/usb/dwc2/core.c
 @@ -2563,7 +2563,7 @@ void dwc2_set_param_reload_ctl(struct dwc2_hsotg
 *hsotg, int val)

  void dwc2_set_param_ahbcfg(struct dwc2_hsotg *hsotg, int val)  {
 - if (val != -1)
 + if (val)
   hsotg-core_params-ahbcfg = val;
   else
   hsotg-core_params-ahbcfg =
 GAHBCFG_HBSTLEN_INCR4  diff --git a/drivers/usb/dwc2/gadget.c
 b/drivers/usb/dwc2/gadget.c index 15aa578..20085de 100644
 --- a/drivers/usb/dwc2/gadget.c
 +++ b/drivers/usb/dwc2/gadget.c
 @@ -2314,9 +2314,13 @@ void s3c_hsotg_core_init_disconnected(struct
 dwc2_hsotg *hsotg,
   GINTSTS_USBSUSP | GINTSTS_WKUPINT,
   hsotg-regs + GINTMSK);

 + if ((hsotg-core_params)  (hsotg-core_params-ahbcfg != -
 1))
 + val = hsotg-core_params-ahbcfg 
 ~GAHBCFG_CTRL_MASK;
 + else
 + val = GAHBCFG_HBSTLEN_INCR4 
 GAHBCFG_HBSTLEN_SHIFT;
 +
   if (using_dma(hsotg))
 - writel(GAHBCFG_GLBL_INTR_EN |
 GAHBCFG_DMA_EN |
 -(GAHBCFG_HBSTLEN_INCR4 
 GAHBCFG_HBSTLEN_SHIFT),
 + writel(GAHBCFG_GLBL_INTR_EN |
 GAHBCFG_DMA_EN | val,
  hsotg-regs + GAHBCFG);
   else
   writel(((hsotg-dedicated_fifos) ?
 (GAHBCFG_NP_TXF_EMP_LVL |

 There are other bits in GAHBCFG that can be set from platform. They will be 
 preserved by your patch, as they are not part of GAHBCFG_CTRL_MASK, but only 
 in case dma is enabled. Perhaps preserve them in non-dma case as well.

Here may have issue if also set hsotg-core_params-ahbcfg for non-dma case,
since GAHBCFG[4:1] may be set.

Though from drivers/usb/dwc2/core.h we can not see @ahbcfg is
specifically used for dma case,
most case in drivers/usb/dwc2/platform.c use ahbcfg is set hbstlen,
GAHBCFG[4:1].
For example, our platform set GAHBCFG_HBSTLEN_INCR16.

So I just assume @ahbcfg is used for dma case.
What do you think.

Thanks
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] usb: dwc2: gadget reuse ahbcfg assigned from platform

2015-02-04 Thread Zhangfei Gao
On 4 February 2015 at 21:51, Sergei Shtylyov
sergei.shtyl...@cogentembedded.com wrote:
 diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
 index 15aa578..20085de 100644
 --- a/drivers/usb/dwc2/gadget.c
 +++ b/drivers/usb/dwc2/gadget.c
 @@ -2314,9 +2314,13 @@ void s3c_hsotg_core_init_disconnected(struct
 dwc2_hsotg *hsotg,
 GINTSTS_USBSUSP | GINTSTS_WKUPINT,
 hsotg-regs + GINTMSK);

 +   if ((hsotg-core_params)  (hsotg-core_params-ahbcfg != -1))


Inner pares not needed, especially the first ones.

Yes, definitely.
Thanks Sergei.
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] usb: dwc2: gadget reuse ahbcfg assigned from platform

2015-02-04 Thread Sergei Shtylyov

Hello.

On 02/04/2015 11:01 AM, Zhangfei Gao wrote:


Gadget directly set GAHBCFG_HBSTLEN_INCR4, reuse ahbcfg if assigned from 
platform



Signed-off-by: Zhangfei Gao zhangfei@linaro.org


[...]


diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 15aa578..20085de 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2314,9 +2314,13 @@ void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg 
*hsotg,
GINTSTS_USBSUSP | GINTSTS_WKUPINT,
hsotg-regs + GINTMSK);

+   if ((hsotg-core_params)  (hsotg-core_params-ahbcfg != -1))


   Inner pares not needed, especially the first ones.

[...]

WBR, Sergei

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html