From: Greg KH <gregkh@linuxfoundation.org>
To: changbin.du@intel.com
Cc: balbi@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: dwc3: add debugfs node to dump FIFO/Queue available space
Date: Wed, 6 Apr 2016 05:25:09 -0400 [thread overview]
Message-ID: <20160406092509.GA29930@kroah.com> (raw)
In-Reply-To: <1459931243-26405-1-git-send-email-changbin.du@intel.com>
On Wed, Apr 06, 2016 at 04:27:23PM +0800, changbin.du@intel.com wrote:
> From: "Du, Changbin" <changbin.du@intel.com>
>
> For DWC3 USB controller, the Global Debug Queue/FIFO Space Available
> Register(GDBGFIFOSPACE) can be used to dump FIFO/Queue available space.
> This can be used to check some special issues, like whether data is
> successfully copied from memory to fifo when a trb is blocked.
>
> Signed-off-by: Du, Changbin <changbin.du@intel.com>
> ---
> drivers/usb/dwc3/core.h | 5 +++++
> drivers/usb/dwc3/debugfs.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 50 insertions(+)
Why did you not include the linux-usb@vger mailing list?
>
> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> index 6254b2f..899cf76 100644
> --- a/drivers/usb/dwc3/core.h
> +++ b/drivers/usb/dwc3/core.h
> @@ -348,6 +348,11 @@
> #define DWC3_DSTS_LOWSPEED (2 << 0)
> #define DWC3_DSTS_FULLSPEED1 (3 << 0)
>
> +/* Global Debug Queue/FIFO Space Available Register */
> +#define DWC3_GDBGFIFOSPACE_NUM(x) (((x) << 0) & 0x1F)
> +#define DWC3_GDBGFIFOSPACE_TYPE(x) (((x) << 5) & 0xE0)
> +#define DWC3_GDBGFIFOSPACE_GET_SPACE(x) (((x) >> 16) & 0xFFFF)
> +
> /* Device Generic Command Register */
> #define DWC3_DGCMD_SET_LMP 0x01
> #define DWC3_DGCMD_SET_PERIODIC_PAR 0x02
> diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c
> index 9ac37fe..f9a8d9e 100644
> --- a/drivers/usb/dwc3/debugfs.c
> +++ b/drivers/usb/dwc3/debugfs.c
> @@ -426,6 +426,45 @@ static const struct file_operations dwc3_mode_fops = {
> .release = single_release,
> };
>
> +static int dwc3_fifo_show(struct seq_file *s, void *unused)
> +{
> + struct dwc3 *dwc = s->private;
> + unsigned long flags;
> + unsigned int type, index;
> + const char *name;
> + u32 reg;
> +
> + static const char * const fifo_names[] = {
> + "TxFIFO", "RxFIFO", "TxReqQ", "RxReqQ", "RxInfoQ",
> + "DescFetchQ", "EventQ", "ProtocolStatusQ"};
> + spin_lock_irqsave(&dwc->lock, flags);
> + for (type = 0; type < 8; type++) {
> + name = fifo_names[type];
> + for (index = 0; index < 32; index++) {
> + dwc3_writel(dwc->regs, DWC3_GDBGFIFOSPACE,
> + DWC3_GDBGFIFOSPACE_NUM(index) |
> + DWC3_GDBGFIFOSPACE_TYPE(type));
> + reg = dwc3_readl(dwc->regs, DWC3_GDBGFIFOSPACE);
> + seq_printf(s, "%s%02d = %d\n", name, index,
> + DWC3_GDBGFIFOSPACE_GET_SPACE(reg));
> + }
> + }
> + spin_unlock_irqrestore(&dwc->lock, flags);
> + return 0;
> +}
> +
> +static int dwc3_fifo_open(struct inode *inode, struct file *file)
> +{
> + return single_open(file, dwc3_fifo_show, inode->i_private);
> +}
> +
> +static const struct file_operations dwc3_fifo_fops = {
> + .open = dwc3_fifo_open,
> + .read = seq_read,
> + .llseek = seq_lseek,
> + .release = single_release,
> +};
> +
> static int dwc3_testmode_show(struct seq_file *s, void *unused)
> {
> struct dwc3 *dwc = s->private;
> @@ -648,6 +687,12 @@ int dwc3_debugfs_init(struct dwc3 *dwc)
> goto err1;
> }
>
> + file = debugfs_create_file("fifo", S_IRUGO, root, dwc, &dwc3_fifo_fops);
> + if (!file) {
> + ret = -ENOMEM;
Um, no, that's not the error here. You shouldn't care at all about
debugfs api call results. Just keep moving on here please.
thanks,
greg k-h
next prev parent reply other threads:[~2016-04-06 9:25 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-06 8:27 [PATCH] usb: dwc3: add debugfs node to dump FIFO/Queue available space changbin.du
2016-04-06 9:25 ` Greg KH [this message]
2016-04-06 11:38 ` Du, Changbin
2016-04-06 12:24 ` Felipe Balbi
2016-04-06 15:44 ` [PATCH v2 0/3] Improvement, fix and new entry for dwc3 debugfs changbin.du
2016-04-07 5:05 ` Felipe Balbi
2016-04-07 5:21 ` Du, Changbin
2016-04-07 5:22 ` Felipe Balbi
2016-04-08 9:34 ` [PATCH v3 0/2] Add a new debugfs entry to dump FIFO/Queue available space changbin.du
2016-04-08 9:34 ` [PATCH v3 1/2] usb: dwc3: make dwc3_debugfs_init return value be void changbin.du
2016-04-11 8:14 ` Felipe Balbi
2016-04-11 11:19 ` Du, Changbin
2016-04-11 11:23 ` Felipe Balbi
2016-04-12 11:10 ` [PATCH v4 0/2] Add a new debugfs entry to dump FIFO/Queue available space changbin.du
2016-04-12 11:10 ` [PATCH v4 1/2] usb: dwc3: make dwc3_debugfs_init return value be void changbin.du
2016-04-12 11:10 ` [PATCH v4 2/2] usb: dwc3: add debugfs node to dump FIFO/Queue available space changbin.du
2016-04-12 12:58 ` Sergei Shtylyov
2016-04-14 3:27 ` Du, Changbin
2016-04-14 8:02 ` Felipe Balbi
2016-04-14 11:15 ` Du, Changbin
2016-04-14 11:18 ` Felipe Balbi
2016-04-14 11:37 ` Du, Changbin
2016-04-14 11:41 ` Felipe Balbi
2016-04-14 11:58 ` Du, Changbin
2016-04-08 9:34 ` [PATCH v3 " changbin.du
2016-04-06 15:44 ` [PATCH v2 1/3] usb: dwc3: make dwc3_debugfs_init return value be void changbin.du
2016-04-06 15:44 ` [PATCH v2 2/3] usb: dwc3: free dwc->regset on dwc3_debugfs_exit changbin.du
2016-04-06 21:08 ` Greg KH
2016-04-07 5:05 ` Felipe Balbi
2016-04-06 15:44 ` [PATCH v2 3/3] usb: dwc3: add debugfs node to dump FIFO/Queue available space changbin.du
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=20160406092509.GA29930@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=balbi@kernel.org \
--cc=changbin.du@intel.com \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.