All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Kumar Gala <galak@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org, regis.odeye@kontron.com
Subject: Re: [RFC/example] powerpc: add the mpic global timer support
Date: Thu, 29 Jan 2009 11:54:06 -0600	[thread overview]
Message-ID: <4981ED3E.9050602@freescale.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0901062200550.19321@blarg.am.freescale.net>

Kumar Gala wrote:
> +		timer@41100 {
> +			compatible = "fsl,mpic-global-timer";
> +			reg = <0x41100 0x204>;
> +			interrupts = <0xf7 0x2>;
> +			interrupt-parent = <&mpic>;
> +		};

Why is this a separate node from the MPIC?  Seems like it should at 
least be a child node, if not just implied by one of the compatibles on 
the mpic node.

> +static ssize_t mpic_tm_timeout_store(struct device *dev,
> +				struct device_attribute *attr,
> +				const char *buf, size_t count)
> +{
> +	struct mpic_tm_priv *priv = dev_get_drvdata(dev);
> +	unsigned long interval = simple_strtoul(buf, NULL, 0);
> +	unsigned long temp;
> +
> +	if (interval > 0x7fffffff) {
> +		dev_dbg(dev, "mpic_tm: interval %lu (in ns) too long\n", interval);
> +		return -EINVAL;
> +	}
> +
> +	interval *= priv->ticks_per_sec;

In nanoseconds, or seconds?

> +static DEVICE_ATTR(timeout, 0660, mpic_tm_timeout_show, mpic_tm_timeout_store);
> +
> +static int __devinit mpic_tm_probe(struct of_device *dev,
> +				const struct of_device_id *match)
> +{
> +	struct device_node *np = dev->node;
> +	struct resource res;
> +	struct mpic_tm_priv *priv;
> +	struct mpic_type *type = match->data;
> +	int has_tcr = type->has_tcr;
> +	u32 busfreq = fsl_get_sys_freq();
> +	int ret = 0;
> +
> +	if (busfreq == 0) {
> +		dev_err(&dev->dev, "mpic_tm: No bus frequency in device tree.\n");
> +		return -ENODEV;
> +	}

Maybe put clock-frequency in the timer (or mpic) node itself?

This seems to try to support non-FSL MPIC timers, but fsl_get_sys_freq() 
wouldn't be appropriate in such a case.

> +	priv = kmalloc(sizeof(struct mpic_tm_priv), GFP_KERNEL);
> +	if (!priv)
> +		return -ENOMEM;
> +
> +	spin_lock_init(&priv->lock);
> +	dev_set_drvdata(&dev->dev, priv);
> +
> +	ret = of_address_to_resource(np, 0, &res);
> +	if (ret)
> +		goto out;

of_iomap()?

> +	ret = request_irq(priv->irq, mpic_tm_isr, 0, "mpic timer 0", priv);
> +	if (ret)
> +		goto out;

Hardcoded zero in string?

> +	printk("MPIC global timer init done.\n");

KERN_DEBUG?

-Scott

      parent reply	other threads:[~2009-01-29 17:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-29  5:09 [RFC/example] powerpc: add the mpic global timer support Kumar Gala
2009-01-29 17:47 ` Régis Odeyé
2009-01-29 17:54 ` Scott Wood [this message]

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=4981ED3E.9050602@freescale.com \
    --to=scottwood@freescale.com \
    --cc=galak@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=regis.odeye@kontron.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 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.