linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Thinh Nguyen <thinh.nguyen@synopsys.com>, linux-usb@vger.kernel.org
Cc: John Youn <john.youn@synopsys.com>
Subject: usb: dwc3: debugfs: Dump internal states
Date: Mon, 05 Nov 2018 14:16:05 +0200	[thread overview]
Message-ID: <87tvkvwwhm.fsf@linux.intel.com> (raw)

Hi,

Thinh Nguyen <thinh.nguyen@synopsys.com> writes:
> +static void dwc3_dump_gadget_internal_states(struct seq_file *s)
> +{
> +	struct dwc3		*dwc = s->private;
> +	int			num_selects = 16;
> +	int			i;
> +	u32			reg;
> +	u64			ep_info;
> +
> +	for (i = 0; i < num_selects; i++) {
> +		reg = dwc3_gadget_lsp_register(dwc, i);
> +		seq_printf(s, "GDBGLSP[%d] = 0x%08x\n", i, reg);
> +	}
> +
> +	for (i = 0; i < dwc->num_eps; i++) {
> +		ep_info = dwc3_ep_info_register(dwc, i);
> +		seq_printf(s, "GDBGEPINFO[%d] = 0x%016llx\n", i, ep_info);
> +	}
> +}

we have per-endpoint directories already. Why don't you dump endpoint
debug info there? Also, while at that, could you write a patch that
properly decodes the queue sizes? It looks to me as the queue sizes are
in same units as GTXFIFOSIZ registers

> +static int dwc3_internal_states_show(struct seq_file *s, void *unused)
> +{
> +	struct dwc3		*dwc = s->private;
> +	unsigned int		current_mode;
> +	unsigned long		flags;
> +	u32			reg;
> +
> +	spin_lock_irqsave(&dwc->lock, flags);
> +	reg = dwc3_readl(dwc->regs, DWC3_GSTS);
> +	current_mode = DWC3_GSTS_CURMOD(reg);
> +
> +	reg = dwc3_readl(dwc->regs, DWC3_GDBGBMU);
> +	spin_unlock_irqrestore(&dwc->lock, flags);
> +
> +	seq_printf(s, "GDBGBMU = 0x%08x\n", reg);

shouldn't the print be done with locks held?

> +static ssize_t dwc3_internal_states_write(struct file *file,
> +		const char __user *ubuf, size_t count, loff_t *ppos)

why is this necessary? Seems like it would be nicer to create a
directory structure if the current operating mode is host so that we
don't need to write anything.

             reply	other threads:[~2018-11-05 12:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-05 12:16 Felipe Balbi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-11-07 10:54 usb: dwc3: debugfs: Dump internal states Greg Kroah-Hartman
2018-11-07 10:45 Felipe Balbi
2018-11-07  9:22 Greg Kroah-Hartman
2018-11-07  4:01 Thinh Nguyen
2018-11-06  7:35 Felipe Balbi
2018-11-05 19:07 Thinh Nguyen
2018-11-03  1:38 Thinh Nguyen

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=87tvkvwwhm.fsf@linux.intel.com \
    --to=balbi@kernel.org \
    --cc=john.youn@synopsys.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=thinh.nguyen@synopsys.com \
    /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;
as well as URLs for NNTP newsgroup(s).