RE: [RFC 10/21] xhci: replace xhci_readl() with readl() in xhci-dbg.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb-owner@xxxxxxxxxxxxxxx] On Behalf Of Pratyush Anand
> Sent: Thursday, September 12, 2013 8:50 PM
> 
> On Tue, Sep 10, 2013 at 02:03:15AM +0800, Xenia Ragiadakou wrote:
> > Function xhci_readl() is used to read 32bit xHC registers residing in MMIO
> > address space. It takes as first argument a pointer to the xhci_hcd although
> > it does not use it because internally it simply calls readl. This creates
> > an illusion that xhci_readl() is an xhci specific function that has to be
> > called in a context where a pointer to xhci_hcd is available.
> > This patch replaces calls to xhci_readl() with calls to readl() in xhci-dbg.c.
> > This is done so that xhci_readl() can be removed completely and code can
> > become more straight-forward.
> 
> Its fine that this replacement would simplify it. But, I have
> experienced that sometime such way of reading/writing a peripheral
> registers is quite helpful. I was able to find several issues in dwc3
> gadget isoc handling quickly because of the availability of dwc3_readl
> dwc3_writel.
> 
> With such peripheral specific exerciser one can log all register
> read/write in sequential order with timestamp with a little effort,
> which can further help in debugging critical issues. Sometime, they
> might be even helpful in diagnosis of hardware issues. Same sequence
> can be extracted and provided to hardware engineer for analysing the
> behaviour of device in simulation.

That's easy enough to do with some macro magic in xhci.h. Something like:

static inline u32 my_readl(const volatile void __iomem *addr)
{
	u32 value = readl(addr);
	/* do whatever you want with 'value' here */
	return value;
}

#undef readl
#define readl my_readl

You just need to make sure no other #include's follow xhci.h that might
override your redefinition of readl.

I used this technique in the early days of debugging dwc2.

-- 
Paul

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux