[U-Boot] [PATCH v2 2/4] usb: dwc3: Add helper functions to enable snooping and burst settings
Rajesh Bhagat
rajesh.bhagat at nxp.com
Tue Jun 14 06:09:41 CEST 2016
> -----Original Message-----
> From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
> Sent: Friday, June 10, 2016 6:05 AM
> To: Rajat Srivastava <rajat.srivastava at nxp.com>
> Cc: U-Boot Mailing List <u-boot at lists.denx.de>; Lukasz Majewski
> <l.majewski at samsung.com>; Marek Vašut <marex at denx.de>; Albert ARIBAUD
> <albert.u.boot at aribaud.net>; Prabhakar Kushwaha <prabhakar at freescale.com>;
> york sun <york.sun at nxp.com>; Mingkai Hu <mingkai.hu at nxp.com>; Rajesh Bhagat
> <rajesh.bhagat at nxp.com>; Michal Simek <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
>
> Hi,
>
> On 6 June 2016 at 03:16, Rajat Srivastava <rajat.srivastava at nxp.com> wrote:
> > Adds helper functions to enable snooping and outstanding burst beat
> > settings.
> >
> > Signed-off-by: Rajat Srivastava <rajat.srivastava at nxp.com>
> > Signed-off-by: Rajesh Bhagat <rajesh.bhagat at 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
More information about the U-Boot
mailing list