diff mbox

[U-Boot,v2,2/4] usb: dwc3: Add helper functions to enable snooping and burst settings

Message ID 1465204596-6637-3-git-send-email-rajat.srivastava@nxp.com
State Superseded
Delegated to: York Sun
Headers show

Commit Message

Rajat Srivastava June 6, 2016, 9:16 a.m. UTC
Adds helper functions to enable snooping and outstanding burst beat
settings.

Signed-off-by: Rajat Srivastava <rajat.srivastava@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
---
Changes in v2:
 - Removes SoC specific flags and added helper functions

 drivers/usb/dwc3/core.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/dwc3/core.h |  7 +++++++
 2 files changed, 52 insertions(+)

Comments

Marek Vasut June 6, 2016, 12:54 p.m. UTC | #1
On 06/06/2016 11:16 AM, Rajat Srivastava wrote:
> Adds helper functions to enable snooping and outstanding burst beat
> settings.
> 
> Signed-off-by: Rajat Srivastava <rajat.srivastava@nxp.com>
> Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
> ---
> Changes in v2:
>  - Removes SoC specific flags and added helper functions
> 
>  drivers/usb/dwc3/core.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  drivers/usb/dwc3/core.h |  7 +++++++
>  2 files changed, 52 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 85cc96a..0b3c596 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -599,6 +599,51 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
>  
>  #define DWC3_ALIGN_MASK		(16 - 1)
>  
> +void dwc3_core_incr_burst_enable(int index, int btype_incr_val,
> +				 int breq_limit)
> +{
> +	struct dwc3 *dwc;
> +	u32 reg;
> +
> +	list_for_each_entry(dwc, &dwc3_list, list) {

Why is this iterating over a list of all controllers ?
Should this be enabled on per-controller basis by some DT prop ?

> +		if (dwc->index != index)
> +			continue;
> +
> +		/*
> +		 * Change burst beat and outstanding pipelined
> +		 * transfers requests
> +		 */
> +		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
> +		reg = (reg & ~DWC3_INCR_BTYPE_MASK) | btype_incr_val;
> +		dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
> +
> +		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG1);
> +		reg = (reg & ~DWC3_BREQ_LIMIT_MASK) | (breq_limit << 8);
> +		dwc3_writel(dwc->regs, DWC3_GSBUSCFG1, reg);
> +		break;
> +	}
> +}
> +
> +void dwc3_core_set_snooping(int index, bool snoop)
> +{
> +	struct dwc3 *dwc;
> +	u32 reg;
> +
> +	list_for_each_entry(dwc, &dwc3_list, list) {
> +		if (dwc->index != index)
> +			continue;
> +
> +		/* Enable/Disable snooping */
> +		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
> +		if (snoop)
> +			reg = reg | DWC3_SNOOP_ENABLE;
> +		else
> +			reg = reg & ~DWC3_SNOOP_ENABLE;
> +		dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
> +		break;
> +	}
> +}
> +
>  /**
>   * dwc3_uboot_init - dwc3 core uboot initialization code
>   * @dwc3_dev: struct dwc3_device containing initialization data
> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> index 72d2fcd..455e7fa 100644
> --- a/drivers/usb/dwc3/core.h
> +++ b/drivers/usb/dwc3/core.h
> @@ -593,6 +593,13 @@ struct dwc3_hwparams {
>  /* HWPARAMS7 */
>  #define DWC3_RAM1_DEPTH(n)	((n) & 0xffff)
>  
> +/* GSBUSCFG0 */
> +#define DWC3_SNOOP_ENABLE	(0x22220000)
> +#define DWC3_INCR_BTYPE_MASK	(0xff)
> +
> +/* GSBUSCFG1 */
> +#define DWC3_BREQ_LIMIT_MASK	(0xf00)
> +
>  struct dwc3_request {
>  	struct usb_request	request;
>  	struct list_head	list;
>
Rajesh Bhagat June 8, 2016, 9:44 a.m. UTC | #2
> -----Original Message-----
> From: Marek Vasut [mailto:marex@denx.de]
> Sent: Monday, June 06, 2016 6:24 PM
> To: Rajat Srivastava <rajat.srivastava@nxp.com>; u-boot@lists.denx.de
> Cc: l.majewski@samsung.com; sjg@chromium.org; albert.u.boot@aribaud.net;
> prabhakar@freescale.com; york sun <york.sun@nxp.com>; Mingkai Hu
> <mingkai.hu@nxp.com>; Rajesh Bhagat <rajesh.bhagat@nxp.com>;
> michal.simek@xilinx.com; felipe.balbi@linux.intel.com
> Subject: Re: [PATCH v2 2/4] usb: dwc3: Add helper functions to enable snooping and
> burst settings
> 
> On 06/06/2016 11:16 AM, Rajat Srivastava wrote:
> > Adds helper functions to enable snooping and outstanding burst beat
> > settings.
> >
> > Signed-off-by: Rajat Srivastava <rajat.srivastava@nxp.com>
> > Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
> > ---
> > Changes in v2:
> >  - Removes SoC specific flags and added helper functions
> >
> >  drivers/usb/dwc3/core.c | 45
> > +++++++++++++++++++++++++++++++++++++++++++++
> >  drivers/usb/dwc3/core.h |  7 +++++++
> >  2 files changed, 52 insertions(+)
> >
> > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index
> > 85cc96a..0b3c596 100644
> > --- a/drivers/usb/dwc3/core.c
> > +++ b/drivers/usb/dwc3/core.c
> > @@ -599,6 +599,51 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
> >
> >  #define DWC3_ALIGN_MASK		(16 - 1)
> >
> > +void dwc3_core_incr_burst_enable(int index, int btype_incr_val,
> > +				 int breq_limit)
> > +{
> > +	struct dwc3 *dwc;
> > +	u32 reg;
> > +
> > +	list_for_each_entry(dwc, &dwc3_list, list) {
> 

Hello Marek, 

> Why is this iterating over a list of all controllers ?

This function has to be called from Soc specific code to pass some register settings. And dwc pointer 
would not be available there. Hence, index is passed to determine dwc pointer. 

> Should this be enabled on per-controller basis by some DT prop ?
>

We are using dwc3 driver with non DT support. 

Best Regards,
Rajesh Bhagat 

 
> > +		if (dwc->index != index)
> > +			continue;
> > +
> > +		/*
> > +		 * Change burst beat and outstanding pipelined
> > +		 * transfers requests
> > +		 */
> > +		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
> > +		reg = (reg & ~DWC3_INCR_BTYPE_MASK) | btype_incr_val;
> > +		dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
> > +
> > +		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG1);
> > +		reg = (reg & ~DWC3_BREQ_LIMIT_MASK) | (breq_limit << 8);
> > +		dwc3_writel(dwc->regs, DWC3_GSBUSCFG1, reg);
> > +		break;
> > +	}
> > +}
> > +
> > +void dwc3_core_set_snooping(int index, bool snoop) {
> > +	struct dwc3 *dwc;
> > +	u32 reg;
> > +
> > +	list_for_each_entry(dwc, &dwc3_list, list) {
> > +		if (dwc->index != index)
> > +			continue;
> > +
> > +		/* Enable/Disable snooping */
> > +		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
> > +		if (snoop)
> > +			reg = reg | DWC3_SNOOP_ENABLE;
> > +		else
> > +			reg = reg & ~DWC3_SNOOP_ENABLE;
> > +		dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
> > +		break;
> > +	}
> > +}
> > +
> >  /**
> >   * dwc3_uboot_init - dwc3 core uboot initialization code
> >   * @dwc3_dev: struct dwc3_device containing initialization data diff
> > --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index
> > 72d2fcd..455e7fa 100644
> > --- a/drivers/usb/dwc3/core.h
> > +++ b/drivers/usb/dwc3/core.h
> > @@ -593,6 +593,13 @@ struct dwc3_hwparams {
> >  /* HWPARAMS7 */
> >  #define DWC3_RAM1_DEPTH(n)	((n) & 0xffff)
> >
> > +/* GSBUSCFG0 */
> > +#define DWC3_SNOOP_ENABLE	(0x22220000)
> > +#define DWC3_INCR_BTYPE_MASK	(0xff)
> > +
> > +/* GSBUSCFG1 */
> > +#define DWC3_BREQ_LIMIT_MASK	(0xf00)
> > +
> >  struct dwc3_request {
> >  	struct usb_request	request;
> >  	struct list_head	list;
> >
> 
> 
> --
> Best regards,
> Marek Vasut
Marek Vasut June 8, 2016, 1:26 p.m. UTC | #3
On 06/08/2016 11:44 AM, Rajesh Bhagat wrote:
> 
> 
>> -----Original Message-----
>> From: Marek Vasut [mailto:marex@denx.de]
>> Sent: Monday, June 06, 2016 6:24 PM
>> To: Rajat Srivastava <rajat.srivastava@nxp.com>; u-boot@lists.denx.de
>> Cc: l.majewski@samsung.com; sjg@chromium.org; albert.u.boot@aribaud.net;
>> prabhakar@freescale.com; york sun <york.sun@nxp.com>; Mingkai Hu
>> <mingkai.hu@nxp.com>; Rajesh Bhagat <rajesh.bhagat@nxp.com>;
>> michal.simek@xilinx.com; felipe.balbi@linux.intel.com
>> Subject: Re: [PATCH v2 2/4] usb: dwc3: Add helper functions to enable snooping and
>> burst settings
>>
>> On 06/06/2016 11:16 AM, Rajat Srivastava wrote:
>>> Adds helper functions to enable snooping and outstanding burst beat
>>> settings.
>>>
>>> Signed-off-by: Rajat Srivastava <rajat.srivastava@nxp.com>
>>> Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
>>> ---
>>> Changes in v2:
>>>  - Removes SoC specific flags and added helper functions
>>>
>>>  drivers/usb/dwc3/core.c | 45
>>> +++++++++++++++++++++++++++++++++++++++++++++
>>>  drivers/usb/dwc3/core.h |  7 +++++++
>>>  2 files changed, 52 insertions(+)
>>>
>>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index
>>> 85cc96a..0b3c596 100644
>>> --- a/drivers/usb/dwc3/core.c
>>> +++ b/drivers/usb/dwc3/core.c
>>> @@ -599,6 +599,51 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
>>>
>>>  #define DWC3_ALIGN_MASK		(16 - 1)
>>>
>>> +void dwc3_core_incr_burst_enable(int index, int btype_incr_val,
>>> +				 int breq_limit)
>>> +{
>>> +	struct dwc3 *dwc;
>>> +	u32 reg;
>>> +
>>> +	list_for_each_entry(dwc, &dwc3_list, list) {
>>
> 
> Hello Marek, 
> 
>> Why is this iterating over a list of all controllers ?
> 
> This function has to be called from Soc specific code to pass some register settings. And dwc pointer 
> would not be available there. Hence, index is passed to determine dwc pointer. 
> 
>> Should this be enabled on per-controller basis by some DT prop ?
>>
> 
> We are using dwc3 driver with non DT support. 

That's real unfortunate.

> Best Regards,
> Rajesh Bhagat 
> 
>  
>>> +		if (dwc->index != index)
>>> +			continue;
>>> +
>>> +		/*
>>> +		 * Change burst beat and outstanding pipelined
>>> +		 * transfers requests
>>> +		 */
>>> +		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
>>> +		reg = (reg & ~DWC3_INCR_BTYPE_MASK) | btype_incr_val;
>>> +		dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
>>> +
>>> +		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG1);
>>> +		reg = (reg & ~DWC3_BREQ_LIMIT_MASK) | (breq_limit << 8);
>>> +		dwc3_writel(dwc->regs, DWC3_GSBUSCFG1, reg);
>>> +		break;
>>> +	}
>>> +}
>>> +
>>> +void dwc3_core_set_snooping(int index, bool snoop) {
>>> +	struct dwc3 *dwc;
>>> +	u32 reg;
>>> +
>>> +	list_for_each_entry(dwc, &dwc3_list, list) {
>>> +		if (dwc->index != index)
>>> +			continue;
>>> +
>>> +		/* Enable/Disable snooping */
>>> +		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
>>> +		if (snoop)
>>> +			reg = reg | DWC3_SNOOP_ENABLE;
>>> +		else
>>> +			reg = reg & ~DWC3_SNOOP_ENABLE;
>>> +		dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
>>> +		break;
>>> +	}
>>> +}
>>> +
>>>  /**
>>>   * dwc3_uboot_init - dwc3 core uboot initialization code
>>>   * @dwc3_dev: struct dwc3_device containing initialization data diff
>>> --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index
>>> 72d2fcd..455e7fa 100644
>>> --- a/drivers/usb/dwc3/core.h
>>> +++ b/drivers/usb/dwc3/core.h
>>> @@ -593,6 +593,13 @@ struct dwc3_hwparams {
>>>  /* HWPARAMS7 */
>>>  #define DWC3_RAM1_DEPTH(n)	((n) & 0xffff)
>>>
>>> +/* GSBUSCFG0 */
>>> +#define DWC3_SNOOP_ENABLE	(0x22220000)
>>> +#define DWC3_INCR_BTYPE_MASK	(0xff)
>>> +
>>> +/* GSBUSCFG1 */
>>> +#define DWC3_BREQ_LIMIT_MASK	(0xf00)
>>> +
>>>  struct dwc3_request {
>>>  	struct usb_request	request;
>>>  	struct list_head	list;
>>>
>>
>>
>> --
>> Best regards,
>> Marek Vasut
Simon Glass June 10, 2016, 12:34 a.m. UTC | #4
Hi,

On 6 June 2016 at 03:16, Rajat Srivastava <rajat.srivastava@nxp.com> wrote:
> Adds helper functions to enable snooping and outstanding burst beat
> settings.
>
> Signed-off-by: Rajat Srivastava <rajat.srivastava@nxp.com>
> Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
> ---
> Changes in v2:
>  - Removes SoC specific flags and added helper functions
>
>  drivers/usb/dwc3/core.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  drivers/usb/dwc3/core.h |  7 +++++++
>  2 files changed, 52 insertions(+)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 85cc96a..0b3c596 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -599,6 +599,51 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
>
>  #define DWC3_ALIGN_MASK                (16 - 1)
>
> +void dwc3_core_incr_burst_enable(int index, int btype_incr_val,
> +                                int breq_limit)
> +{
> +       struct dwc3 *dwc;
> +       u32 reg;
> +
> +       list_for_each_entry(dwc, &dwc3_list, list) {

Ick - can this be converted to use driver model?

> +               if (dwc->index != index)
> +                       continue;
> +
> +               /*
> +                * Change burst beat and outstanding pipelined
> +                * transfers requests
> +                */
> +               reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
> +               reg = (reg & ~DWC3_INCR_BTYPE_MASK) | btype_incr_val;
> +               dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
> +
> +               reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG1);
> +               reg = (reg & ~DWC3_BREQ_LIMIT_MASK) | (breq_limit << 8);
> +               dwc3_writel(dwc->regs, DWC3_GSBUSCFG1, reg);
> +               break;
> +       }
> +}
> +
> +void dwc3_core_set_snooping(int index, bool snoop)
> +{
> +       struct dwc3 *dwc;
> +       u32 reg;
> +
> +       list_for_each_entry(dwc, &dwc3_list, list) {
> +               if (dwc->index != index)
> +                       continue;
> +
> +               /* Enable/Disable snooping */
> +               reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
> +               if (snoop)
> +                       reg = reg | DWC3_SNOOP_ENABLE;
> +               else
> +                       reg = reg & ~DWC3_SNOOP_ENABLE;
> +               dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
> +               break;
> +       }
> +}
> +
>  /**
>   * dwc3_uboot_init - dwc3 core uboot initialization code
>   * @dwc3_dev: struct dwc3_device containing initialization data
> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> index 72d2fcd..455e7fa 100644
> --- a/drivers/usb/dwc3/core.h
> +++ b/drivers/usb/dwc3/core.h
> @@ -593,6 +593,13 @@ struct dwc3_hwparams {
>  /* HWPARAMS7 */
>  #define DWC3_RAM1_DEPTH(n)     ((n) & 0xffff)
>
> +/* GSBUSCFG0 */
> +#define DWC3_SNOOP_ENABLE      (0x22220000)
> +#define DWC3_INCR_BTYPE_MASK   (0xff)
> +
> +/* GSBUSCFG1 */
> +#define DWC3_BREQ_LIMIT_MASK   (0xf00)
> +
>  struct dwc3_request {
>         struct usb_request      request;
>         struct list_head        list;
> --
> 2.6.2.198.g614a2ac
>

Regards,
Simon
Rajesh Bhagat June 14, 2016, 4:09 a.m. UTC | #5
> -----Original Message-----

> From: sjg@google.com [mailto:sjg@google.com] On Behalf Of Simon Glass

> Sent: Friday, June 10, 2016 6:05 AM

> To: Rajat Srivastava <rajat.srivastava@nxp.com>

> Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Lukasz Majewski

> <l.majewski@samsung.com>; Marek Vašut <marex@denx.de>; Albert ARIBAUD

> <albert.u.boot@aribaud.net>; Prabhakar Kushwaha <prabhakar@freescale.com>;

> york sun <york.sun@nxp.com>; Mingkai Hu <mingkai.hu@nxp.com>; Rajesh Bhagat

> <rajesh.bhagat@nxp.com>; Michal Simek <michal.simek@xilinx.com>;

> felipe.balbi@linux.intel.com

> Subject: Re: [PATCH v2 2/4] usb: dwc3: Add helper functions to enable snooping and

> burst settings

> 

> Hi,

> 

> On 6 June 2016 at 03:16, Rajat Srivastava <rajat.srivastava@nxp.com> wrote:

> > Adds helper functions to enable snooping and outstanding burst beat

> > settings.

> >

> > Signed-off-by: Rajat Srivastava <rajat.srivastava@nxp.com>

> > Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>

> > ---

> > Changes in v2:

> >  - Removes SoC specific flags and added helper functions

> >

> >  drivers/usb/dwc3/core.c | 45

> > +++++++++++++++++++++++++++++++++++++++++++++

> >  drivers/usb/dwc3/core.h |  7 +++++++

> >  2 files changed, 52 insertions(+)

> >

> > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index

> > 85cc96a..0b3c596 100644

> > --- a/drivers/usb/dwc3/core.c

> > +++ b/drivers/usb/dwc3/core.c

> > @@ -599,6 +599,51 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)

> >

> >  #define DWC3_ALIGN_MASK                (16 - 1)

> >

> > +void dwc3_core_incr_burst_enable(int index, int btype_incr_val,

> > +                                int breq_limit) {

> > +       struct dwc3 *dwc;

> > +       u32 reg;

> > +

> > +       list_for_each_entry(dwc, &dwc3_list, list) {


Hello Simon,

> 

> Ick - can this be converted to use driver model?

> 


We have not moved to use driver model yet :( . Is it possible to pass these 
register settings by some other mechanism ? 

Best Regards,
Rajesh Bhagat 

> > +               if (dwc->index != index)

> > +                       continue;

> > +

> > +               /*

> > +                * Change burst beat and outstanding pipelined

> > +                * transfers requests

> > +                */

> > +               reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);

> > +               reg = (reg & ~DWC3_INCR_BTYPE_MASK) | btype_incr_val;

> > +               dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);

> > +

> > +               reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG1);

> > +               reg = (reg & ~DWC3_BREQ_LIMIT_MASK) | (breq_limit << 8);

> > +               dwc3_writel(dwc->regs, DWC3_GSBUSCFG1, reg);

> > +               break;

> > +       }

> > +}

> > +

> > +void dwc3_core_set_snooping(int index, bool snoop) {

> > +       struct dwc3 *dwc;

> > +       u32 reg;

> > +

> > +       list_for_each_entry(dwc, &dwc3_list, list) {

> > +               if (dwc->index != index)

> > +                       continue;

> > +

> > +               /* Enable/Disable snooping */

> > +               reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);

> > +               if (snoop)

> > +                       reg = reg | DWC3_SNOOP_ENABLE;

> > +               else

> > +                       reg = reg & ~DWC3_SNOOP_ENABLE;

> > +               dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);

> > +               break;

> > +       }

> > +}

> > +

> >  /**

> >   * dwc3_uboot_init - dwc3 core uboot initialization code

> >   * @dwc3_dev: struct dwc3_device containing initialization data diff

> > --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index

> > 72d2fcd..455e7fa 100644

> > --- a/drivers/usb/dwc3/core.h

> > +++ b/drivers/usb/dwc3/core.h

> > @@ -593,6 +593,13 @@ struct dwc3_hwparams {

> >  /* HWPARAMS7 */

> >  #define DWC3_RAM1_DEPTH(n)     ((n) & 0xffff)

> >

> > +/* GSBUSCFG0 */

> > +#define DWC3_SNOOP_ENABLE      (0x22220000)

> > +#define DWC3_INCR_BTYPE_MASK   (0xff)

> > +

> > +/* GSBUSCFG1 */

> > +#define DWC3_BREQ_LIMIT_MASK   (0xf00)

> > +

> >  struct dwc3_request {

> >         struct usb_request      request;

> >         struct list_head        list;

> > --

> > 2.6.2.198.g614a2ac

> >

> 

> Regards,

> Simon
Simon Glass June 17, 2016, 3:51 a.m. UTC | #6
Hi Rajesh,

On 13 June 2016 at 22:09, Rajesh Bhagat <rajesh.bhagat@nxp.com> wrote:
>
>
>> -----Original Message-----
>> From: sjg@google.com [mailto:sjg@google.com] On Behalf Of Simon Glass
>> Sent: Friday, June 10, 2016 6:05 AM
>> To: Rajat Srivastava <rajat.srivastava@nxp.com>
>> Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Lukasz Majewski
>> <l.majewski@samsung.com>; Marek Vašut <marex@denx.de>; Albert ARIBAUD
>> <albert.u.boot@aribaud.net>; Prabhakar Kushwaha <prabhakar@freescale.com>;
>> york sun <york.sun@nxp.com>; Mingkai Hu <mingkai.hu@nxp.com>; Rajesh Bhagat
>> <rajesh.bhagat@nxp.com>; Michal Simek <michal.simek@xilinx.com>;
>> felipe.balbi@linux.intel.com
>> Subject: Re: [PATCH v2 2/4] usb: dwc3: Add helper functions to enable snooping and
>> burst settings
>>
>> Hi,
>>
>> On 6 June 2016 at 03:16, Rajat Srivastava <rajat.srivastava@nxp.com> wrote:
>> > Adds helper functions to enable snooping and outstanding burst beat
>> > settings.
>> >
>> > Signed-off-by: Rajat Srivastava <rajat.srivastava@nxp.com>
>> > Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
>> > ---
>> > Changes in v2:
>> >  - Removes SoC specific flags and added helper functions
>> >
>> >  drivers/usb/dwc3/core.c | 45
>> > +++++++++++++++++++++++++++++++++++++++++++++
>> >  drivers/usb/dwc3/core.h |  7 +++++++
>> >  2 files changed, 52 insertions(+)
>> >
>> > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index
>> > 85cc96a..0b3c596 100644
>> > --- a/drivers/usb/dwc3/core.c
>> > +++ b/drivers/usb/dwc3/core.c
>> > @@ -599,6 +599,51 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
>> >
>> >  #define DWC3_ALIGN_MASK                (16 - 1)
>> >
>> > +void dwc3_core_incr_burst_enable(int index, int btype_incr_val,
>> > +                                int breq_limit) {
>> > +       struct dwc3 *dwc;
>> > +       u32 reg;
>> > +
>> > +       list_for_each_entry(dwc, &dwc3_list, list) {
>
> Hello Simon,
>
>>
>> Ick - can this be converted to use driver model?
>>
>
> We have not moved to use driver model yet :( . Is it possible to pass these
> register settings by some other mechanism ?

Not that I know of - is there any reason not to convert to driver model now?

>
> Best Regards,
> Rajesh Bhagat
>
>> > +               if (dwc->index != index)
>> > +                       continue;
>> > +
>> > +               /*
>> > +                * Change burst beat and outstanding pipelined
>> > +                * transfers requests
>> > +                */
>> > +               reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
>> > +               reg = (reg & ~DWC3_INCR_BTYPE_MASK) | btype_incr_val;
>> > +               dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
>> > +
>> > +               reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG1);
>> > +               reg = (reg & ~DWC3_BREQ_LIMIT_MASK) | (breq_limit << 8);
>> > +               dwc3_writel(dwc->regs, DWC3_GSBUSCFG1, reg);
>> > +               break;
>> > +       }
>> > +}
>> > +
>> > +void dwc3_core_set_snooping(int index, bool snoop) {
>> > +       struct dwc3 *dwc;
>> > +       u32 reg;
>> > +
>> > +       list_for_each_entry(dwc, &dwc3_list, list) {
>> > +               if (dwc->index != index)
>> > +                       continue;
>> > +
>> > +               /* Enable/Disable snooping */
>> > +               reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
>> > +               if (snoop)
>> > +                       reg = reg | DWC3_SNOOP_ENABLE;
>> > +               else
>> > +                       reg = reg & ~DWC3_SNOOP_ENABLE;
>> > +               dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
>> > +               break;
>> > +       }
>> > +}
>> > +
>> >  /**
>> >   * dwc3_uboot_init - dwc3 core uboot initialization code
>> >   * @dwc3_dev: struct dwc3_device containing initialization data diff
>> > --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index
>> > 72d2fcd..455e7fa 100644
>> > --- a/drivers/usb/dwc3/core.h
>> > +++ b/drivers/usb/dwc3/core.h
>> > @@ -593,6 +593,13 @@ struct dwc3_hwparams {
>> >  /* HWPARAMS7 */
>> >  #define DWC3_RAM1_DEPTH(n)     ((n) & 0xffff)
>> >
>> > +/* GSBUSCFG0 */
>> > +#define DWC3_SNOOP_ENABLE      (0x22220000)
>> > +#define DWC3_INCR_BTYPE_MASK   (0xff)
>> > +
>> > +/* GSBUSCFG1 */
>> > +#define DWC3_BREQ_LIMIT_MASK   (0xf00)
>> > +
>> >  struct dwc3_request {
>> >         struct usb_request      request;
>> >         struct list_head        list;
>> > --
>> > 2.6.2.198.g614a2ac
>> >
>>
>> Regards,
>> Simon

Regards,
Simon
Łukasz Majewski June 23, 2016, 2:53 p.m. UTC | #7
Hi Rajat,

> Adds helper functions to enable snooping and outstanding burst beat
> settings.
> 
> Signed-off-by: Rajat Srivastava <rajat.srivastava@nxp.com>
> Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
> ---
> Changes in v2:
>  - Removes SoC specific flags and added helper functions
> 
>  drivers/usb/dwc3/core.c | 45
> +++++++++++++++++++++++++++++++++++++++++++++ drivers/usb/dwc3/core.h
> |  7 +++++++ 2 files changed, 52 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 85cc96a..0b3c596 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -599,6 +599,51 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
>  
>  #define DWC3_ALIGN_MASK		(16 - 1)
>  
> +void dwc3_core_incr_burst_enable(int index, int btype_incr_val,
> +				 int breq_limit)
> +{
> +	struct dwc3 *dwc;
> +	u32 reg;
> +
> +	list_for_each_entry(dwc, &dwc3_list, list) {
> +		if (dwc->index != index)
> +			continue;
> +
> +		/*
> +		 * Change burst beat and outstanding pipelined
> +		 * transfers requests
> +		 */
> +		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
> +		reg = (reg & ~DWC3_INCR_BTYPE_MASK) | btype_incr_val;
> +		dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
> +
> +		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG1);
> +		reg = (reg & ~DWC3_BREQ_LIMIT_MASK) | (breq_limit <<
> 8);
> +		dwc3_writel(dwc->regs, DWC3_GSBUSCFG1, reg);
> +		break;
> +	}
> +}
> +
> +void dwc3_core_set_snooping(int index, bool snoop)
> +{
> +	struct dwc3 *dwc;
> +	u32 reg;
> +
> +	list_for_each_entry(dwc, &dwc3_list, list) {
> +		if (dwc->index != index)
> +			continue;
> +
> +		/* Enable/Disable snooping */
> +		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
> +		if (snoop)
> +			reg = reg | DWC3_SNOOP_ENABLE;

You can replace the above line with reg |= DWC3_SNOOP_ENABLE

> +		else
> +			reg = reg & ~DWC3_SNOOP_ENABLE;

The same here - req &= ~DWC3_SNOOP_ENABLE

> +		dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
> +		break;
> +	}
> +}
> +
>  /**
>   * dwc3_uboot_init - dwc3 core uboot initialization code
>   * @dwc3_dev: struct dwc3_device containing initialization data
> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> index 72d2fcd..455e7fa 100644
> --- a/drivers/usb/dwc3/core.h
> +++ b/drivers/usb/dwc3/core.h
> @@ -593,6 +593,13 @@ struct dwc3_hwparams {
>  /* HWPARAMS7 */
>  #define DWC3_RAM1_DEPTH(n)	((n) & 0xffff)
>  
> +/* GSBUSCFG0 */
> +#define DWC3_SNOOP_ENABLE	(0x22220000)
> +#define DWC3_INCR_BTYPE_MASK	(0xff)
> +
> +/* GSBUSCFG1 */
> +#define DWC3_BREQ_LIMIT_MASK	(0xf00)
> +
>  struct dwc3_request {
>  	struct usb_request	request;
>  	struct list_head	list;
Rajesh Bhagat July 4, 2016, 4:33 a.m. UTC | #8
> -----Original Message-----

> From: sjg@google.com [mailto:sjg@google.com] On Behalf Of Simon Glass

> Sent: Friday, June 17, 2016 9:22 AM

> To: Rajesh Bhagat <rajesh.bhagat@nxp.com>

> Cc: Rajat Srivastava <rajat.srivastava@nxp.com>; U-Boot Mailing List <u-

> boot@lists.denx.de>; Lukasz Majewski <l.majewski@samsung.com>; Marek Vašut

> <marex@denx.de>; Albert ARIBAUD <albert.u.boot@aribaud.net>; Prabhakar

> Kushwaha <prabhakar@freescale.com>; york sun <york.sun@nxp.com>; Mingkai Hu

> <mingkai.hu@nxp.com>; Michal Simek <michal.simek@xilinx.com>;

> felipe.balbi@linux.intel.com

> Subject: Re: [PATCH v2 2/4] usb: dwc3: Add helper functions to enable snooping and

> burst settings

> 

> Hi Rajesh,

> 

> On 13 June 2016 at 22:09, Rajesh Bhagat <rajesh.bhagat@nxp.com> wrote:

> >

> >

> >> -----Original Message-----

> >> From: sjg@google.com [mailto:sjg@google.com] On Behalf Of Simon Glass

> >> Sent: Friday, June 10, 2016 6:05 AM

> >> To: Rajat Srivastava <rajat.srivastava@nxp.com>

> >> Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Lukasz Majewski

> >> <l.majewski@samsung.com>; Marek Vašut <marex@denx.de>; Albert ARIBAUD

> >> <albert.u.boot@aribaud.net>; Prabhakar Kushwaha

> >> <prabhakar@freescale.com>; york sun <york.sun@nxp.com>; Mingkai Hu

> >> <mingkai.hu@nxp.com>; Rajesh Bhagat <rajesh.bhagat@nxp.com>; Michal

> >> Simek <michal.simek@xilinx.com>; felipe.balbi@linux.intel.com

> >> Subject: Re: [PATCH v2 2/4] usb: dwc3: Add helper functions to enable

> >> snooping and burst settings

> >>

> >> Hi,

> >>

> >> On 6 June 2016 at 03:16, Rajat Srivastava <rajat.srivastava@nxp.com> wrote:

> >> > Adds helper functions to enable snooping and outstanding burst beat

> >> > settings.

> >> >

> >> > Signed-off-by: Rajat Srivastava <rajat.srivastava@nxp.com>

> >> > Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>

> >> > ---

> >> > Changes in v2:

> >> >  - Removes SoC specific flags and added helper functions

> >> >

> >> >  drivers/usb/dwc3/core.c | 45

> >> > +++++++++++++++++++++++++++++++++++++++++++++

> >> >  drivers/usb/dwc3/core.h |  7 +++++++

> >> >  2 files changed, 52 insertions(+)

> >> >

> >> > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c

> >> > index

> >> > 85cc96a..0b3c596 100644

> >> > --- a/drivers/usb/dwc3/core.c

> >> > +++ b/drivers/usb/dwc3/core.c

> >> > @@ -599,6 +599,51 @@ static void dwc3_core_exit_mode(struct dwc3

> >> > *dwc)

> >> >

> >> >  #define DWC3_ALIGN_MASK                (16 - 1)

> >> >

> >> > +void dwc3_core_incr_burst_enable(int index, int btype_incr_val,

> >> > +                                int breq_limit) {

> >> > +       struct dwc3 *dwc;

> >> > +       u32 reg;

> >> > +

> >> > +       list_for_each_entry(dwc, &dwc3_list, list) {

> >

> > Hello Simon,

> >

> >>

> >> Ick - can this be converted to use driver model?

> >>

> >

> > We have not moved to use driver model yet :( . Is it possible to pass

> > these register settings by some other mechanism ?

> 


Hello Simon,


> Not that I know of - is there any reason not to convert to driver model now?

> 


Reason is, the dwc3 driver itself as not moved to CONFIG_DM_USB, and seems to 
be in progress by patch "driver model bring-up of dwc3 usb peripheral" (sent by Mugunthan
V N).

Best Regards,
Rajesh Bhagat 
> >

> > Best Regards,

> > Rajesh Bhagat

> >

> >> > +               if (dwc->index != index)

> >> > +                       continue;

> >> > +

> >> > +               /*

> >> > +                * Change burst beat and outstanding pipelined

> >> > +                * transfers requests

> >> > +                */

> >> > +               reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);

> >> > +               reg = (reg & ~DWC3_INCR_BTYPE_MASK) | btype_incr_val;

> >> > +               dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);

> >> > +

> >> > +               reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG1);

> >> > +               reg = (reg & ~DWC3_BREQ_LIMIT_MASK) | (breq_limit << 8);

> >> > +               dwc3_writel(dwc->regs, DWC3_GSBUSCFG1, reg);

> >> > +               break;

> >> > +       }

> >> > +}

> >> > +

> >> > +void dwc3_core_set_snooping(int index, bool snoop) {

> >> > +       struct dwc3 *dwc;

> >> > +       u32 reg;

> >> > +

> >> > +       list_for_each_entry(dwc, &dwc3_list, list) {

> >> > +               if (dwc->index != index)

> >> > +                       continue;

> >> > +

> >> > +               /* Enable/Disable snooping */

> >> > +               reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);

> >> > +               if (snoop)

> >> > +                       reg = reg | DWC3_SNOOP_ENABLE;

> >> > +               else

> >> > +                       reg = reg & ~DWC3_SNOOP_ENABLE;

> >> > +               dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);

> >> > +               break;

> >> > +       }

> >> > +}

> >> > +

> >> >  /**

> >> >   * dwc3_uboot_init - dwc3 core uboot initialization code

> >> >   * @dwc3_dev: struct dwc3_device containing initialization data

> >> > diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h

> >> > index 72d2fcd..455e7fa 100644

> >> > --- a/drivers/usb/dwc3/core.h

> >> > +++ b/drivers/usb/dwc3/core.h

> >> > @@ -593,6 +593,13 @@ struct dwc3_hwparams {

> >> >  /* HWPARAMS7 */

> >> >  #define DWC3_RAM1_DEPTH(n)     ((n) & 0xffff)

> >> >

> >> > +/* GSBUSCFG0 */

> >> > +#define DWC3_SNOOP_ENABLE      (0x22220000)

> >> > +#define DWC3_INCR_BTYPE_MASK   (0xff)

> >> > +

> >> > +/* GSBUSCFG1 */

> >> > +#define DWC3_BREQ_LIMIT_MASK   (0xf00)

> >> > +

> >> >  struct dwc3_request {

> >> >         struct usb_request      request;

> >> >         struct list_head        list;

> >> > --

> >> > 2.6.2.198.g614a2ac

> >> >

> >>

> >> Regards,

> >> Simon

> 

> Regards,

> Simon
Rajesh Bhagat July 4, 2016, 4:37 a.m. UTC | #9
> -----Original Message-----
> From: Lukasz Majewski [mailto:l.majewski@samsung.com]
> Sent: Thursday, June 23, 2016 8:23 PM
> To: Rajat Srivastava <rajat.srivastava@nxp.com>
> Cc: u-boot@lists.denx.de; sjg@chromium.org; marex@denx.de;
> albert.u.boot@aribaud.net; prabhakar@freescale.com; york sun
> <york.sun@nxp.com>; Mingkai Hu <mingkai.hu@nxp.com>; Rajesh Bhagat
> <rajesh.bhagat@nxp.com>; michal.simek@xilinx.com; felipe.balbi@linux.intel.com
> Subject: Re: [PATCH v2 2/4] usb: dwc3: Add helper functions to enable snooping and
> burst settings
> 
> Hi Rajat,
> 
> > Adds helper functions to enable snooping and outstanding burst beat
> > settings.
> >
> > Signed-off-by: Rajat Srivastava <rajat.srivastava@nxp.com>
> > Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
> > ---
> > Changes in v2:
> >  - Removes SoC specific flags and added helper functions
> >
> >  drivers/usb/dwc3/core.c | 45
> > +++++++++++++++++++++++++++++++++++++++++++++
> drivers/usb/dwc3/core.h
> > |  7 +++++++ 2 files changed, 52 insertions(+)
> >
> > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index
> > 85cc96a..0b3c596 100644
> > --- a/drivers/usb/dwc3/core.c
> > +++ b/drivers/usb/dwc3/core.c
> > @@ -599,6 +599,51 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
> >
> >  #define DWC3_ALIGN_MASK		(16 - 1)
> >
> > +void dwc3_core_incr_burst_enable(int index, int btype_incr_val,
> > +				 int breq_limit)
> > +{
> > +	struct dwc3 *dwc;
> > +	u32 reg;
> > +
> > +	list_for_each_entry(dwc, &dwc3_list, list) {
> > +		if (dwc->index != index)
> > +			continue;
> > +
> > +		/*
> > +		 * Change burst beat and outstanding pipelined
> > +		 * transfers requests
> > +		 */
> > +		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
> > +		reg = (reg & ~DWC3_INCR_BTYPE_MASK) | btype_incr_val;
> > +		dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
> > +
> > +		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG1);
> > +		reg = (reg & ~DWC3_BREQ_LIMIT_MASK) | (breq_limit <<
> > 8);
> > +		dwc3_writel(dwc->regs, DWC3_GSBUSCFG1, reg);
> > +		break;
> > +	}
> > +}
> > +
> > +void dwc3_core_set_snooping(int index, bool snoop) {
> > +	struct dwc3 *dwc;
> > +	u32 reg;
> > +
> > +	list_for_each_entry(dwc, &dwc3_list, list) {
> > +		if (dwc->index != index)
> > +			continue;
> > +
> > +		/* Enable/Disable snooping */
> > +		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
> > +		if (snoop)
> > +			reg = reg | DWC3_SNOOP_ENABLE;

Hello Lukasz, 

> 
> You can replace the above line with reg |= DWC3_SNOOP_ENABLE
> 

Will take care in v3.

> > +		else
> > +			reg = reg & ~DWC3_SNOOP_ENABLE;
> 
> The same here - req &= ~DWC3_SNOOP_ENABLE
> 

Will take care in v3.

> > +		dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
> > +		break;
> > +	}
> > +}
> > +
> >  /**
> >   * dwc3_uboot_init - dwc3 core uboot initialization code
> >   * @dwc3_dev: struct dwc3_device containing initialization data diff
> > --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index
> > 72d2fcd..455e7fa 100644
> > --- a/drivers/usb/dwc3/core.h
> > +++ b/drivers/usb/dwc3/core.h
> > @@ -593,6 +593,13 @@ struct dwc3_hwparams {
> >  /* HWPARAMS7 */
> >  #define DWC3_RAM1_DEPTH(n)	((n) & 0xffff)
> >
> > +/* GSBUSCFG0 */
> > +#define DWC3_SNOOP_ENABLE	(0x22220000)
> > +#define DWC3_INCR_BTYPE_MASK	(0xff)
> > +
> > +/* GSBUSCFG1 */
> > +#define DWC3_BREQ_LIMIT_MASK	(0xf00)
> > +
> >  struct dwc3_request {
> >  	struct usb_request	request;
> >  	struct list_head	list;
> 
> 

Best Regards,
Rajesh Bhagat 

> 
> --
> Best regards,
> 
> Lukasz Majewski
> 
> Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
York Sun July 27, 2016, 5 p.m. UTC | #10
On 07/03/2016 09:37 PM, Rajesh Bhagat wrote:
>
>
> Will take care in v3.
>

Did you send v3 patch set?

York
diff mbox

Patch

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 85cc96a..0b3c596 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -599,6 +599,51 @@  static void dwc3_core_exit_mode(struct dwc3 *dwc)
 
 #define DWC3_ALIGN_MASK		(16 - 1)
 
+void dwc3_core_incr_burst_enable(int index, int btype_incr_val,
+				 int breq_limit)
+{
+	struct dwc3 *dwc;
+	u32 reg;
+
+	list_for_each_entry(dwc, &dwc3_list, list) {
+		if (dwc->index != index)
+			continue;
+
+		/*
+		 * Change burst beat and outstanding pipelined
+		 * transfers requests
+		 */
+		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
+		reg = (reg & ~DWC3_INCR_BTYPE_MASK) | btype_incr_val;
+		dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
+
+		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG1);
+		reg = (reg & ~DWC3_BREQ_LIMIT_MASK) | (breq_limit << 8);
+		dwc3_writel(dwc->regs, DWC3_GSBUSCFG1, reg);
+		break;
+	}
+}
+
+void dwc3_core_set_snooping(int index, bool snoop)
+{
+	struct dwc3 *dwc;
+	u32 reg;
+
+	list_for_each_entry(dwc, &dwc3_list, list) {
+		if (dwc->index != index)
+			continue;
+
+		/* Enable/Disable snooping */
+		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
+		if (snoop)
+			reg = reg | DWC3_SNOOP_ENABLE;
+		else
+			reg = reg & ~DWC3_SNOOP_ENABLE;
+		dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
+		break;
+	}
+}
+
 /**
  * dwc3_uboot_init - dwc3 core uboot initialization code
  * @dwc3_dev: struct dwc3_device containing initialization data
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 72d2fcd..455e7fa 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -593,6 +593,13 @@  struct dwc3_hwparams {
 /* HWPARAMS7 */
 #define DWC3_RAM1_DEPTH(n)	((n) & 0xffff)
 
+/* GSBUSCFG0 */
+#define DWC3_SNOOP_ENABLE	(0x22220000)
+#define DWC3_INCR_BTYPE_MASK	(0xff)
+
+/* GSBUSCFG1 */
+#define DWC3_BREQ_LIMIT_MASK	(0xf00)
+
 struct dwc3_request {
 	struct usb_request	request;
 	struct list_head	list;