public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@nvidia.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v6 15/20] tegra: fdt: Add function to return peripheral/clock ID
Date: Mon, 27 Feb 2012 16:41:18 -0700	[thread overview]
Message-ID: <4F4C149E.3070505@nvidia.com> (raw)
In-Reply-To: <1330375973-10681-16-git-send-email-sjg@chromium.org>

On 02/27/2012 01:52 PM, Simon Glass wrote:
> A common requirement is to find the clock ID for a peripheral. This is the
> second cell of the 'clocks' property (the first being the phandle itself).

> +int clock_decode_periph_id(const void *blob, int node)

> +	valid = clock_periph_id_isvalid(id);

clock_periph_id_isvalid() is not the correct function to use here; the
code should be checking for invalid IDs in the CAR binding, not invalid
IDs in the HW periph ID definition. They're different.

Just to be explicit, the function you need here would be:

int clkid_to_periphid(int clkid)
{
    if (clk_id > 95)
        return -1;
    switch (clk_id) {
    case 1:
    case 2:
    case 7:
    case 10:
    case 20:
    case 30:
    case 35:
    case 49:
    case 56:
    case 74:
    case 77:
    case 78:
    case 79:
    case 80:
    case 81:
    case 82:
    case 83:
    case 91:
    case 95:
        return -1;
    default:
        return clkid;
    }
}

-- 
nvpublic

  reply	other threads:[~2012-02-27 23:41 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-27 20:52 [U-Boot] [PATCH v6 0/20] tegra: Add fdt definitions and USB driver Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 01/20] fdt: Tidy up a few fdtdec problems Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 02/20] fdt: Add functions to access phandles, arrays and bools Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 03/20] fdt: Add basic support for decoding GPIO definitions Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 04/20] arm: fdt: Add skeleton device tree file from kernel Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 05/20] tegra: fdt: Add Tegra2x " Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 06/20] tegra: fdt: Add device tree file for Tegra2 Seaboard " Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 07/20] fdt: Add staging area for device tree binding documentation Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 08/20] fdt: Add tegra-usb bindings file from linux Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 09/20] tegra: fdt: Add additional USB binding Simon Glass
2012-02-27 23:27   ` Stephen Warren
2012-02-27 20:52 ` [U-Boot] [PATCH v6 10/20] tegra: fdt: Add clock bindings Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 11/20] tegra: fdt: Add clock bindings for Tegra2 Seaboard Simon Glass
2012-02-27 23:29   ` Stephen Warren
2012-02-28 17:20     ` Simon Glass
2012-02-28 17:32       ` Stephen Warren
2012-02-28 17:37         ` Simon Glass
2012-02-28 18:31           ` Stephen Warren
2012-02-28 18:37             ` Simon Glass
2012-02-28 18:41               ` Stephen Warren
2012-02-28 18:46                 ` Simon Glass
2012-02-28 22:16                   ` Albert ARIBAUD
2012-03-03 16:26                     ` Simon Glass
2012-03-05 20:46                 ` Tom Rini
2012-03-07  2:48                   ` Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 12/20] tegra: usb: fdt: Add additional device tree definitions for USB ports Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 13/20] tegra: usb: fdt: Add USB definitions for Tegra2 Seaboard Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 14/20] usb: Add support for txfifo threshold Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 15/20] tegra: fdt: Add function to return peripheral/clock ID Simon Glass
2012-02-27 23:41   ` Stephen Warren [this message]
2012-02-28 17:46     ` Simon Glass
2012-02-28 18:37       ` Stephen Warren
2012-02-28 18:44         ` Simon Glass
2012-02-28 18:51           ` Stephen Warren
2012-02-28 23:50             ` Simon Glass
2012-02-29 17:08               ` Stephen Warren
2012-02-27 20:52 ` [U-Boot] [PATCH v6 16/20] tegra: usb: Add support for Tegra USB peripheral Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 17/20] tegra: usb: Add USB support to nvidia boards Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 18/20] tegra: usb: Add common USB defines for tegra2 boards Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 19/20] tegra: usb: Enable USB on Seaboard Simon Glass
2012-02-27 20:52 ` [U-Boot] [PATCH v6 20/20] tegra: fdt: Enable FDT support for Seaboard Simon Glass
2012-02-27 23:42 ` [U-Boot] [PATCH v6 0/20] tegra: Add fdt definitions and USB driver Stephen Warren
2012-02-28 18:12   ` Simon Glass
2012-02-29 17:34     ` Simon Glass

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=4F4C149E.3070505@nvidia.com \
    --to=swarren@nvidia.com \
    --cc=u-boot@lists.denx.de \
    /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