From: Felipe Balbi <balbi@ti.com>
To: Alessandro Rubini <rubini@gnudd.com>
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org, giancarlo.asnaghi@st.com
Subject: Re: [RFC PATCH] debugfs: add tools to printk 32-bit registers
Date: Wed, 16 Nov 2011 00:04:39 +0200 [thread overview]
Message-ID: <20111115220437.GA26711@legolas.emea.dhcp.ti.com> (raw)
In-Reply-To: <20111115213734.GA5094@mail.gnudd.com>
[-- Attachment #1: Type: text/plain, Size: 2685 bytes --]
Hi,
On Tue, Nov 15, 2011 at 10:37:34PM +0100, Alessandro Rubini wrote:
> Hi Greg. Thanks for looking.
>
> >> +/*
> >> + * The regset32 stuff is used to print 32-bit registers using the
> >> + * seq_file utilities. We offer printing a register set in an already-opened
> >> + * sequential file or create a debugfs file that only prints a regset32.
> >> + */
> >
> > Can this be part of the kerneldoc below somehow so that people are more
> > aware of it?
>
> Ok. There's also a file by Jon in Documentation that needs updating, as it
> has all the other debugfs file types.
>
> > +int debugfs_print_regs32(struct seq_file *s, struct debugfs_reg32 *regs,
> >> + int nregs, void __iomem *base, char *prefix)
>
> > This function also needs to be part of debugfs.h in the "debugfs is not
> > enabled" section of the file, right?
>
> Not really. The other one makes a regiters-only file, and it's good
> to register it withouth ifdef.
>
> This one is used to embed a register block in a file with more
> stuff, so it shouldn't be used if debugfs is not selected (btw,
> I compiled my internal stuff with and without CONFIG_DEBUG_FS
> before rebasing to next).
>
> Example:
>
> static int pl08x_debugfs_show(struct seq_file *s, void *data)
> {
> [...]
> list_for_each_entry(chan, &pl08x->slave.channels, chan.device_node) {
> seq_printf(s, "%s\t\t%s\n", chan->name,
> pl08x_state_str(chan->state));
> }
>
> /* dump registers */
> seq_printf(s, "\nPL08x registers\n");
> debugfs_print_regs32(s, pl08x_regs, ARRAY_SIZE(pl08x_regs),
> pl08x->base, "");
>
> seq_printf(s, "\nPL08x registers channel\n");
> for (i = 0; i < pl08x->vd->channels; i++) {
> [...]
> }
>
> So, I'll post a V2 shortly, unless you refuse it in reply to this.
this will be useful to dwc3 too, we currently have:
struct dwc3_register {
const char *name;
u32 offset;
};
#define dump_register(nm) \
{ \
.name = __stringify(nm), \
.offset = DWC3_ ##nm, \
}
static const struct dwc3_register dwc3_regs[] = {
dump_register(GSBUSCFG0),
dump_register(GSBUSCFG1),
dump_register(GTXTHRCFG),
...
};
static int dwc3_regdump_show(struct seq_file *s, void *unused)
{
struct dwc3 *dwc = s->private;
int i;
seq_printf(s, "DesignWare USB3 Core Register Dump\n");
for (i = 0; i < ARRAY_SIZE(dwc3_regs); i++) {
seq_printf(s, "%-20s : %08x\n", dwc3_regs[i].name,
dwc3_readl(dwc->regs, dwc3_regs[i].offset));
}
return 0;
}
...
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2011-11-15 22:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-15 13:02 [RFC PATCH] debugfs: add tools to printk 32-bit registers Alessandro Rubini
2011-11-15 21:20 ` Greg KH
2011-11-15 21:37 ` Alessandro Rubini
2011-11-15 22:04 ` Felipe Balbi [this message]
2011-11-15 22:21 ` Alessandro Rubini
2011-11-16 11:14 ` Felipe Balbi
2011-11-15 22:09 ` Greg KH
2011-11-16 11:31 ` Mark Brown
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=20111115220437.GA26711@legolas.emea.dhcp.ti.com \
--to=balbi@ti.com \
--cc=giancarlo.asnaghi@st.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=rubini@gnudd.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