linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: David Sin <davidsin@ti.com>
Cc: linux-arm-kernel@lists.arm.linux.org.uk,
	linux-omap@vger.kernel.org, Tony Lindgren <tony@atomide.com>,
	Hari Kanigeri <h-kanigeri2@ti.com>,
	Ohad Ben-Cohen <ohad@wizery.com>,
	Vaibhav Hiremath <hvaibhav@ti.com>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Lajos Molnar <molnar@ti.com>
Subject: Re: [RFC 1/8] TILER-DMM: DMM-PAT driver for TI TILER
Date: Sat, 24 Jul 2010 09:09:15 +0100	[thread overview]
Message-ID: <20100724080915.GC15064@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1279927348-21750-2-git-send-email-davidsin@ti.com>

On Fri, Jul 23, 2010 at 06:22:21PM -0500, David Sin wrote:
> +static struct platform_driver dmm_driver_ldm = {
> +	.driver = {
> +		.owner = THIS_MODULE,
> +		.name = "dmm",
> +	},
> +	.probe = NULL,
> +	.shutdown = NULL,
> +	.remove = NULL,
> +};

What's the point of this driver structure?

> +s32 dmm_pat_refill(struct dmm *dmm, struct pat *pd, enum pat_mode mode)
> +{
> +	void __iomem *r;
> +	u32 v;
> +
> +	/* Only manual refill supported */
> +	if (mode != MANUAL)
> +		return -EFAULT;
> +
> +	/* Check that the DMM_PAT_STATUS register has not reported an error */
> +	r = dmm->base + DMM_PAT_STATUS__0;
> +	v = __raw_readl(r);
> +	if (WARN(v & 0xFC00, KERN_ERR "dmm_pat_refill() error.\n"))
> +		return -EIO;
> +
> +	/* Set "next" register to NULL */
> +	r = dmm->base + DMM_PAT_DESCR__0;
> +	v = __raw_readl(r);
> +	v = SET_FLD(v, 31, 4, (u32) NULL);
> +	__raw_writel(v, r);
> +
> +	/* Set area to be refilled */
> +	r = dmm->base + DMM_PAT_AREA__0;
> +	v = __raw_readl(r);
> +	v = SET_FLD(v, 30, 24, pd->area.y1);
> +	v = SET_FLD(v, 23, 16, pd->area.x1);
> +	v = SET_FLD(v, 14, 8, pd->area.y0);
> +	v = SET_FLD(v, 7, 0, pd->area.x0);
> +	__raw_writel(v, r);
> +	wmb();

Maybe use writel() (which will contain the barrier _before_ the write op.)

> +
> +	/* First, clear the DMM_PAT_IRQSTATUS register */
> +	r = dmm->base + DMM_PAT_IRQSTATUS;
> +	__raw_writel(0xFFFFFFFF, r);
> +	wmb();

And consider using:
	writel(0xffffffff, dmm->base + DMM_PAT_IRQSTATUS);

In any case, writes to devices are ordered, so there's no real need to
add barriers between each write - in which case writel_relaxed() or
__raw_writel() can be used (which'll be added soon.)

> +
> +	r = dmm->base + DMM_PAT_IRQSTATUS_RAW;
> +	while (__raw_readl(r) != 0)
> +		;

It's normal to use cpu_relax() in busy-wait loops.  What if the IRQ status
never becomes zero?

> +MODULE_LICENSE("GPL v2");
> +MODULE_AUTHOR("davidsin@ti.com");
> +MODULE_AUTHOR("molnar@ti.com");

MODULE_AUTHOR("Name <email>"); or just MODULE_AUTHOR("Name");

  parent reply	other threads:[~2010-07-24  8:09 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 23:22 [RFC 0/8] TI TILER-DMM driver David Sin
2010-07-23 23:22 ` [RFC 1/8] TILER-DMM: DMM-PAT driver for TI TILER David Sin
2010-07-23 23:22   ` [RFC 2/8] TILER-DMM: Container manager interface and utility definitons David Sin
2010-07-23 23:22     ` [RFC 3/8] TILER-DMM: Sample TCM implementation: Simple TILER Allocator David Sin
2010-07-23 23:22       ` [RFC 4/8] TILER-DMM: TILER Memory Manager interface and implementation David Sin
2010-07-23 23:22         ` [RFC 5/8] TILER-DMM: TILER interface file and documentation David Sin
2010-07-23 23:22           ` [RFC 6/8] TILER-DMM: Geometry and view manipulation functions David Sin
2010-07-23 23:22             ` [RFC 7/8] TILER-DMM: Main TILER driver implementation David Sin
2010-07-23 23:22               ` [RFC 8/8] TILER-DMM: Linking TILER driver into the Linux kernel build David Sin
2010-07-24  7:32               ` [RFC 7/8] TILER-DMM: Main TILER driver implementation Shilimkar, Santosh
2010-07-24 13:41                 ` Hari Kanigeri
2010-07-24 13:53                   ` Shilimkar, Santosh
2010-07-24  7:55               ` Russell King - ARM Linux
2010-07-24  7:21           ` [RFC 5/8] TILER-DMM: TILER interface file and documentation Shilimkar, Santosh
2010-07-24  8:01         ` [RFC 4/8] TILER-DMM: TILER Memory Manager interface and implementation Russell King - ARM Linux
2010-07-26 19:34           ` Sin, David
2010-08-02 14:40           ` Sin, David
2010-08-02 14:44             ` Shilimkar, Santosh
2010-08-02 14:49               ` Sin, David
2010-08-02 14:52                 ` Shilimkar, Santosh
2010-08-02 14:55                   ` Sin, David
     [not found]                   ` <9DCA1E44C5805D4EB7C1626D5FD1739E048EDA223B@dlee02.ent.ti.com>
2010-08-03 19:49                     ` Sin, David
2010-07-28  5:53         ` Hiremath, Vaibhav
2010-07-24  7:13       ` [RFC 3/8] TILER-DMM: Sample TCM implementation: Simple TILER Allocator Shilimkar, Santosh
2010-07-25 15:45         ` Molnar, Lajos
2010-07-26 19:33         ` Sin, David
2010-07-27 20:41       ` Hiremath, Vaibhav
2010-07-24  6:56     ` [RFC 2/8] TILER-DMM: Container manager interface and utility definitons Shilimkar, Santosh
2010-07-27 20:21     ` Hiremath, Vaibhav
2010-07-24  6:51   ` [RFC 1/8] TILER-DMM: DMM-PAT driver for TI TILER Shilimkar, Santosh
2010-07-24  8:09   ` Russell King - ARM Linux [this message]
2010-07-24 10:15     ` Russell King - ARM Linux
2010-07-26 19:28     ` Sin, David
2010-07-27 18:37   ` Hiremath, Vaibhav
2010-07-27 19:05     ` Sin, David
2010-07-27 19:53       ` Hiremath, Vaibhav
2010-07-28 10:00         ` Laurent Pinchart
2010-07-28 14:39           ` Sin, David
2010-07-28 15:46             ` Hiremath, Vaibhav
2010-07-28  9:45       ` Laurent Pinchart
2010-07-24  7:44 ` [RFC 0/8] TI TILER-DMM driver Shilimkar, Santosh
2010-07-26 19:20   ` Sin, David
2010-07-24 11:12 ` Hans Verkuil
2010-07-28 15:23   ` Sin, David
2010-07-28 17:30     ` Hiremath, Vaibhav
2010-07-28 19:15       ` Sin, David
     [not found] <1279927694-26138-1-git-send-email-davidsin@ti.com>
     [not found] ` <1279927694-26138-2-git-send-email-davidsin@ti.com>
     [not found]   ` <201007261013.16666.laurent.pinchart@ideasonboard.com>
2010-07-26 19:59     ` [RFC 1/8] TILER-DMM: DMM-PAT driver for TI TILER Sin, David

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=20100724080915.GC15064@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=davidsin@ti.com \
    --cc=h-kanigeri2@ti.com \
    --cc=hvaibhav@ti.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-omap@vger.kernel.org \
    --cc=molnar@ti.com \
    --cc=ohad@wizery.com \
    --cc=santosh.shilimkar@ti.com \
    --cc=tony@atomide.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).