Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-02-08 Thread Lu Baolu
Hi Ingo, On 01/26/2017 03:22 PM, Ingo Molnar wrote: > * Lu Baolu wrote: > >> Hi, >> >> On 01/25/2017 10:38 PM, Peter Zijlstra wrote: >>> On Wed, Jan 25, 2017 at 08:27:38PM +0800, Lu Baolu wrote: In my driver, udelay() is mostly used to handle time out.

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-02-08 Thread Lu Baolu
Hi Ingo, On 01/26/2017 03:19 PM, Ingo Molnar wrote: > * Lu Baolu wrote: > >> Fair enough. >> >> USB connection is stable enough, unless the user unplugs the >> USB cable during debugging. > What does the hardware do in this case? The XHCI registers are in the host >

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-26 Thread Ingo Molnar
* Peter Zijlstra wrote: > On Thu, Jan 26, 2017 at 05:01:05PM +0100, Ingo Molnar wrote: > > > > > > > > I.e. if there's any polling component then it would be reasonable to > > > > add an error > > > > component: poll the status and if it goes 'disconnected' then disable

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-26 Thread Peter Zijlstra
On Thu, Jan 26, 2017 at 05:01:05PM +0100, Ingo Molnar wrote: > > > > > > I.e. if there's any polling component then it would be reasonable to add > > > an error > > > component: poll the status and if it goes 'disconnected' then disable > > > early-printk > > > altogether in this case and

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-26 Thread Ingo Molnar
* Peter Zijlstra wrote: > On Thu, Jan 26, 2017 at 08:19:37AM +0100, Ingo Molnar wrote: > > > > * Lu Baolu wrote: > > > > > Fair enough. > > > > > > USB connection is stable enough, unless the user unplugs the > > > USB cable during debugging.

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-26 Thread Peter Zijlstra
On Thu, Jan 26, 2017 at 08:19:37AM +0100, Ingo Molnar wrote: > > * Lu Baolu wrote: > > > Fair enough. > > > > USB connection is stable enough, unless the user unplugs the > > USB cable during debugging. > > What does the hardware do in this case? The XHCI registers

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-26 Thread Ingo Molnar
* Lu Baolu wrote: > Hi Ingo, > > On 01/26/2017 03:19 PM, Ingo Molnar wrote: > > * Lu Baolu wrote: > > > >> Fair enough. > >> > >> USB connection is stable enough, unless the user unplugs the > >> USB cable during debugging. > > What does the

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-25 Thread Lu Baolu
Hi Ingo, On 01/26/2017 03:19 PM, Ingo Molnar wrote: > * Lu Baolu wrote: > >> Fair enough. >> >> USB connection is stable enough, unless the user unplugs the >> USB cable during debugging. > What does the hardware do in this case? The XHCI registers are in the host >

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-25 Thread Ingo Molnar
* Lu Baolu wrote: > > Hi, > > On 01/25/2017 10:38 PM, Peter Zijlstra wrote: > > On Wed, Jan 25, 2017 at 08:27:38PM +0800, Lu Baolu wrote: > >> In my driver, udelay() is mostly used to handle time out. > >> > >> Xdbc hides most USB things in its firmware. Early printk

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-25 Thread Ingo Molnar
* Lu Baolu wrote: > Fair enough. > > USB connection is stable enough, unless the user unplugs the > USB cable during debugging. What does the hardware do in this case? The XHCI registers are in the host hardware, so they won't disappear, right? Is there some cable

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-25 Thread Lu Baolu
Hi, On 01/26/2017 12:16 AM, Peter Zijlstra wrote: > On Wed, Jan 25, 2017 at 11:51:34PM +0800, Lu Baolu wrote: > >>> What is timeout and why? >> Put it in simple: >> >> The driver sets the RUN bit in control register and polls READY >> bit in status register for the successful USB device

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-25 Thread Lu Baolu
Hi Ingo, On 01/25/2017 05:23 PM, Ingo Molnar wrote: > * Lu Baolu wrote: > >>> Hiding essentially an early udelay() implementation in an early-printk >>> driver is >>> ugly and counterproductive. >> Sure. How about below change? >> >> diff --git

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-25 Thread Peter Zijlstra
On Wed, Jan 25, 2017 at 11:51:34PM +0800, Lu Baolu wrote: > > What is timeout and why? > > Put it in simple: > > The driver sets the RUN bit in control register and polls READY > bit in status register for the successful USB device enumeration. > As the USB device enumeration might fail and the

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-25 Thread Lu Baolu
Hi, On 01/25/2017 10:38 PM, Peter Zijlstra wrote: > On Wed, Jan 25, 2017 at 08:27:38PM +0800, Lu Baolu wrote: >> In my driver, udelay() is mostly used to handle time out. >> >> Xdbc hides most USB things in its firmware. Early printk driver only needs >> to setup the registers/data structures

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-25 Thread Peter Zijlstra
On Wed, Jan 25, 2017 at 08:27:38PM +0800, Lu Baolu wrote: > In my driver, udelay() is mostly used to handle time out. > > Xdbc hides most USB things in its firmware. Early printk driver only needs > to setup the registers/data structures and wait until link ready or time out. > Without udelay(),

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-25 Thread Lu Baolu
Hi, On 01/25/2017 05:57 PM, Peter Zijlstra wrote: > On Wed, Jan 25, 2017 at 10:23:55AM +0100, Ingo Molnar wrote: >> * Lu Baolu wrote: >> Hiding essentially an early udelay() implementation in an early-printk driver is ugly and counterproductive. >> Yeah

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-25 Thread Lu Baolu
Hi, On 01/25/2017 05:23 PM, Ingo Molnar wrote: > * Lu Baolu wrote: > >>> Hiding essentially an early udelay() implementation in an early-printk >>> driver is >>> ugly and counterproductive. >> Sure. How about below change? >> >> diff --git

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-25 Thread Peter Zijlstra
On Wed, Jan 25, 2017 at 10:23:55AM +0100, Ingo Molnar wrote: > > * Lu Baolu wrote: > > > > Hiding essentially an early udelay() implementation in an early-printk > > > driver is > > > ugly and counterproductive. > Yeah - so could we do this in a more generic

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-25 Thread Ingo Molnar
* Lu Baolu wrote: > > Hiding essentially an early udelay() implementation in an early-printk > > driver is > > ugly and counterproductive. > > Sure. How about below change? > > diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c > index

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-24 Thread Lu Baolu
Hi Ingo, On 01/24/2017 04:20 PM, Ingo Molnar wrote: > * Lu Baolu wrote: > >> Hi Ingo, >> >> On 01/22/2017 05:04 PM, Ingo Molnar wrote: >>> * Lu Baolu wrote: >>> >> +static void xdbc_runtime_delay(unsigned long count) >> +{ >> +

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-24 Thread Ingo Molnar
* Lu Baolu wrote: > Hi Ingo, > > On 01/22/2017 05:04 PM, Ingo Molnar wrote: > > * Lu Baolu wrote: > > > +static void xdbc_runtime_delay(unsigned long count) > +{ > +udelay(count); > +} > +static void

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-23 Thread Lu Baolu
Hi Ingo, On 01/22/2017 05:04 PM, Ingo Molnar wrote: > * Lu Baolu wrote: > +static void xdbc_runtime_delay(unsigned long count) +{ + udelay(count); +} +static void (*xdbc_delay)(unsigned long) = xdbc_early_delay; >>> Is this udelay()

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-22 Thread Ingo Molnar
* Lu Baolu wrote: > > > >> +static void xdbc_runtime_delay(unsigned long count) > >> +{ > >> + udelay(count); > >> +} > >> +static void (*xdbc_delay)(unsigned long) = xdbc_early_delay; > > Is this udelay() complication really necessary? udelay() should work fine > >

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-19 Thread Lu Baolu
Hi Ingo, I'm very appreciated for your review comments. I've put my replies in lines. On 01/19/2017 05:37 PM, Ingo Molnar wrote: > * Lu Baolu wrote: > >> xHCI debug capability (DbC) is an optional but standalone >> functionality provided by an xHCI host controller.

Re: [PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2017-01-19 Thread Ingo Molnar
* Lu Baolu wrote: > xHCI debug capability (DbC) is an optional but standalone > functionality provided by an xHCI host controller. Software > learns this capability by walking through the extended > capability list of the host. xHCI specification describes > DbC in

[PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2016-11-14 Thread Lu Baolu
xHCI debug capability (DbC) is an optional but standalone functionality provided by an xHCI host controller. Software learns this capability by walking through the extended capability list of the host. xHCI specification describes DbC in section 7.6. This patch introduces the code to probe and