public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/4] usb: dwc3: Add helper functions to enable snooping and burst settings
Date: Wed, 08 Jun 2016 15:26:54 +0200	[thread overview]
Message-ID: <57581D1E.7040303@denx.de> (raw)
In-Reply-To: <HE1PR0401MB2028F5317C9680A019AE411CE35E0@HE1PR0401MB2028.eurprd04.prod.outlook.com>

On 06/08/2016 11:44 AM, Rajesh Bhagat wrote:
> 
> 
>> -----Original Message-----
>> From: Marek Vasut [mailto:marex at denx.de]
>> Sent: Monday, June 06, 2016 6:24 PM
>> To: Rajat Srivastava <rajat.srivastava@nxp.com>; u-boot at lists.denx.de
>> Cc: l.majewski at samsung.com; sjg at chromium.org; albert.u.boot at aribaud.net;
>> prabhakar at freescale.com; york sun <york.sun@nxp.com>; Mingkai Hu
>> <mingkai.hu@nxp.com>; Rajesh Bhagat <rajesh.bhagat@nxp.com>;
>> michal.simek at xilinx.com; felipe.balbi at 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


-- 
Best regards,
Marek Vasut

  reply	other threads:[~2016-06-08 13:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06  9:16 [U-Boot] [PATCH v2 0/4] armv8/fsl-layerscape: add dwc3 gadget driver support Rajat Srivastava
2016-06-06  9:16 ` [U-Boot] [PATCH v2 1/4] usb: ums: support multiple controllers using controller_index Rajat Srivastava
2016-06-23 14:44   ` Lukasz Majewski
2016-06-06  9:16 ` [U-Boot] [PATCH v2 2/4] usb: dwc3: Add helper functions to enable snooping and burst settings Rajat Srivastava
2016-06-06 12:54   ` Marek Vasut
2016-06-08  9:44     ` Rajesh Bhagat
2016-06-08 13:26       ` Marek Vasut [this message]
2016-06-10  0:34   ` Simon Glass
2016-06-14  4:09     ` Rajesh Bhagat
2016-06-17  3:51       ` Simon Glass
2016-07-04  4:33         ` Rajesh Bhagat
2016-06-23 14:53   ` Lukasz Majewski
2016-07-04  4:37     ` Rajesh Bhagat
2016-07-27 17:00       ` york sun
2016-06-06  9:16 ` [U-Boot] [PATCH v2 3/4] armv8/fsl-layerscape: add dwc3 gadget driver support Rajat Srivastava
2016-06-10  0:35   ` Simon Glass
2016-06-14  4:11     ` Rajesh Bhagat
2016-06-23 14:57   ` Lukasz Majewski
2016-07-04  4:37     ` Rajesh Bhagat
2016-07-04  7:18       ` Lukasz Majewski
2016-06-06  9:16 ` [U-Boot] [PATCH v2 4/4] armv8/fsl-layerscape: enable " Rajat Srivastava
2016-06-23 14:57   ` Lukasz Majewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57581D1E.7040303@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox