From: Vinod Koul <vkoul@kernel.org>
To: Gustavo Pimentel <Gustavo.Pimentel@synopsys.com>
Cc: linux-pci@vger.kernel.org, dmaengine@vger.kernel.org,
Dan Williams <dan.j.williams@intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Russell King <rmk+kernel@armlinux.org.uk>,
Joao Pinto <Joao.Pinto@synopsys.com>
Subject: Re: [RFC v6 3/6] dmaengine: Add Synopsys eDMA IP version 0 debugfs support
Date: Mon, 6 May 2019 17:37:10 +0530 [thread overview]
Message-ID: <20190506120710.GG3845@vkoul-mobl.Dlink> (raw)
In-Reply-To: <ba56a34f11c4bb699079946ca51bb11244ac713e.1556043127.git.gustavo.pimentel@synopsys.com>
On 23-04-19, 20:30, Gustavo Pimentel wrote:
> int dw_edma_v0_core_debugfs_on(struct dw_edma_chip *chip)
> {
> - return 0;
> + return dw_edma_v0_debugfs_on(chip);
who calls this?
> +#define RD_PERM 0444
lets not use a macro for these, 444 is more readable :)
> +static int dw_edma_debugfs_u32_get(void *data, u64 *val)
> +{
> + if (dw->mode == EDMA_MODE_LEGACY &&
> + data >= (void *)®s->type.legacy.ch) {
> + void *ptr = (void *)®s->type.legacy.ch;
> + u32 viewport_sel = 0;
> + unsigned long flags;
> + u16 ch;
> +
> + for (ch = 0; ch < dw->wr_ch_cnt; ch++)
> + if (lim[0][ch].start >= data && data < lim[0][ch].end) {
> + ptr += (data - lim[0][ch].start);
> + goto legacy_sel_wr;
> + }
> +
> + for (ch = 0; ch < dw->rd_ch_cnt; ch++)
> + if (lim[1][ch].start >= data && data < lim[1][ch].end) {
> + ptr += (data - lim[1][ch].start);
> + goto legacy_sel_rd;
> + }
> +
> + return 0;
> +legacy_sel_rd:
> + viewport_sel = BIT(31);
> +legacy_sel_wr:
> + viewport_sel |= FIELD_PREP(EDMA_V0_VIEWPORT_MASK, ch);
> +
> + raw_spin_lock_irqsave(&dw->lock, flags);
> +
> + writel(viewport_sel, ®s->type.legacy.viewport_sel);
> + *val = readl((u32 *)ptr);
why do you need the cast?
> +static int dw_edma_debugfs_regs(void)
> +{
> + const struct debugfs_entries debugfs_regs[] = {
> + REGISTER(ctrl_data_arb_prior),
> + REGISTER(ctrl),
> + };
> + struct dentry *regs_dir;
> + int nr_entries, err;
> +
> + regs_dir = debugfs_create_dir(REGISTERS_STR, base_dir);
> + if (!regs_dir)
> + return -EPERM;
> +
> + nr_entries = ARRAY_SIZE(debugfs_regs);
> + err = dw_edma_debugfs_create_x32(debugfs_regs, nr_entries, regs_dir);
> + if (err)
> + return err;
> +
> + err = dw_edma_debugfs_regs_wr(regs_dir);
> + if (err)
> + return err;
> +
> + err = dw_edma_debugfs_regs_rd(regs_dir);
> + if (err)
> + return err;
> +
> + return 0;
single return err would suffice right?
> +int dw_edma_v0_debugfs_on(struct dw_edma_chip *chip)
> +{
> + struct dentry *entry;
> + int err;
> +
> + dw = chip->dw;
> + if (!dw)
> + return -EPERM;
> +
> + regs = (struct dw_edma_v0_regs *)dw->rg_region.vaddr;
> + if (!regs)
> + return -EPERM;
> +
> + base_dir = debugfs_create_dir(dw->name, 0);
> + if (!base_dir)
> + return -EPERM;
> +
> + entry = debugfs_create_u32("version", RD_PERM, base_dir, &dw->version);
> + if (!entry)
> + return -EPERM;
> +
> + entry = debugfs_create_u32("mode", RD_PERM, base_dir, &dw->mode);
> + if (!entry)
> + return -EPERM;
> +
> + entry = debugfs_create_u16("wr_ch_cnt", RD_PERM, base_dir,
> + &dw->wr_ch_cnt);
> + if (!entry)
> + return -EPERM;
> +
> + entry = debugfs_create_u16("rd_ch_cnt", RD_PERM, base_dir,
> + &dw->rd_ch_cnt);
> + if (!entry)
> + return -EPERM;
> +
> + err = dw_edma_debugfs_regs();
> + return err;
return dw_edma_debugfs_regs() perhpaps..?
--
~Vinod
next prev parent reply other threads:[~2019-05-06 12:07 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-23 18:30 [RFC v6 0/6] dmaengine: Add Synopsys eDMA IP driver (version 0) Gustavo Pimentel
2019-04-23 18:30 ` [RFC,v6,1/6] dmaengine: Add Synopsys eDMA IP core driver Gustavo Pimentel
2019-04-23 18:30 ` [RFC v6 1/6] " Gustavo Pimentel
2019-05-06 11:20 ` Vinod Koul
2019-05-06 16:42 ` Gustavo Pimentel
2019-05-07 5:03 ` Vinod Koul
2019-05-07 9:08 ` Gustavo Pimentel
2019-05-07 9:56 ` Vinod Koul
2019-04-23 18:30 ` [RFC,v6,2/6] dmaengine: Add Synopsys eDMA IP version 0 support Gustavo Pimentel
2019-04-23 18:30 ` [RFC v6 2/6] " Gustavo Pimentel
2019-05-06 11:56 ` Vinod Koul
2019-04-23 18:30 ` [RFC,v6,3/6] dmaengine: Add Synopsys eDMA IP version 0 debugfs support Gustavo Pimentel
2019-04-23 18:30 ` [RFC v6 3/6] " Gustavo Pimentel
2019-05-06 12:07 ` Vinod Koul [this message]
2019-05-06 17:09 ` Gustavo Pimentel
2019-05-07 5:11 ` Vinod Koul
2019-05-07 9:48 ` Gustavo Pimentel
2019-04-23 18:30 ` [RFC,v6,4/6] PCI: Add Synopsys endpoint EDDA Device ID Gustavo Pimentel
2019-04-23 18:30 ` [RFC v6 4/6] " Gustavo Pimentel
2019-04-23 18:30 ` [RFC,v6,5/6] dmaengine: Add Synopsys eDMA IP PCIe glue-logic Gustavo Pimentel
2019-04-23 18:30 ` [RFC v6 5/6] " Gustavo Pimentel
2019-04-23 18:30 ` [RFC,v6,6/6] MAINTAINERS: Add Synopsys eDMA IP driver maintainer Gustavo Pimentel
2019-04-23 18:30 ` [RFC v6 6/6] " Gustavo Pimentel
2019-05-06 8:12 ` [RFC v6 0/6] dmaengine: Add Synopsys eDMA IP driver (version 0) Gustavo Pimentel
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=20190506120710.GG3845@vkoul-mobl.Dlink \
--to=vkoul@kernel.org \
--cc=Gustavo.Pimentel@synopsys.com \
--cc=Joao.Pinto@synopsys.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=rmk+kernel@armlinux.org.uk \
/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).