linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: <Dongsheng.wang@freescale.com>
Cc: kumar.gala@freescale.com, paulus@samba.org,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support
Date: Fri, 10 Aug 2012 15:37:42 -0500	[thread overview]
Message-ID: <50257116.3030207@freescale.com> (raw)
In-Reply-To: <1344578081-8095-1-git-send-email-Dongsheng.wang@freescale.com>

On 08/10/2012 12:54 AM, Dongsheng.wang@freescale.com wrote:
> +static int group_get_freq(struct group_priv *priv)
> +{
> +	if (priv->flags & FSL_GLOBAL_TIMER) {
> +		ccbfreq = fsl_get_sys_freq();
> +		priv->timerfreq = ccbfreq;
> +	} else {
> +		priv->timerfreq = in_be32(priv->group_tfrr);
> +	}

FSL MPICs have TFRR too.  I'm not sure that the lack of fsl,mpic is a
good indication that TFRR is being set (e.g. we have old device trees
for FSL chips with U-Boot that are labelled as ordinary openpics).

> +
> +	if (priv->timerfreq <= 0)
> +		return -EINVAL;
> +
> +	return 0;
> +}

timerfreq is unsigned.  It can never be < 0.

> +
> +static int group_init_regmap(struct device_node *np, struct group_priv *priv)
> +{
> +	priv->group_tfrr = of_iomap(np, 0);
> +	if (!priv->group_tfrr) {
> +		pr_err("%s: cannot ioremap tfrr address.\n",
> +				np->full_name);
> +		return -EINVAL;
> +	}
> +
> +	priv->regs = of_iomap(np, 1);
> +	if (!priv->regs) {
> +		pr_err("%s: cannot ioremap timer register address.\n",
> +				np->full_name);
> +		return -EINVAL;
> +	}
> +
> +	if (!(priv->flags & FSL_GLOBAL_TIMER))
> +		return 0;
> +
> +	priv->group_tcr = of_iomap(np, 2);
> +	if (!priv->group_tcr) {
> +		pr_err("%s: cannot ioremap tcr address.\n", np->full_name);
> +		return -EINVAL;
> +	}

This is not compatible with existing mpic timer nodes.

> +	p = of_get_property(np, "available-ranges", &len);
> +	if (p && len % (2 * sizeof(u32)) != 0) {
> +		pr_err("%s: malformed fsl,available-ranges property.\n",
> +				np->full_name);
> +		return -EINVAL;
> +	}

You need to support fsl,available-ranges since that's in an accepted
binding and people could have partitioned setups already using it.

You also have a mismatch between the property you check and the error
string.

-Scott

  parent reply	other threads:[~2012-08-10 20:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-10  5:54 [PATCH v2 2/2] powerpc/mpic: add global timer support Dongsheng.wang
2012-08-10 19:40 ` Scott Wood
2012-08-10 20:24   ` Gala Kumar-B11780
2012-08-13  5:53   ` Wang Dongsheng-B40534
2012-08-13  6:17     ` Li Yang-R58472
2012-08-13 16:50       ` Scott Wood
2012-08-13 16:49     ` Scott Wood
2012-08-14  2:06       ` Wang Dongsheng-B40534
2012-08-10 20:37 ` Scott Wood [this message]
2012-08-13  6:18   ` Wang Dongsheng-B40534
2012-08-13 17:36     ` Scott Wood
2012-08-14  2:00       ` Wang Dongsheng-B40534
2012-08-14  2:05         ` Scott Wood
2012-08-14  2:15           ` Wang Dongsheng-B40534
2012-08-14  2:18             ` Scott Wood
2012-08-14  2:32               ` Wang Dongsheng-B40534
2012-08-14 21:20                 ` Scott Wood
2012-08-11 13:10 ` Tabi Timur-B04825
2012-08-13  6:20   ` Wang Dongsheng-B40534
2012-08-13  6:25     ` Wang Dongsheng-B40534

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=50257116.3030207@freescale.com \
    --to=scottwood@freescale.com \
    --cc=Dongsheng.wang@freescale.com \
    --cc=kumar.gala@freescale.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    /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).