All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: U-Boot Mailing List
	<u-boot-0aAXYlwwYIKGBzrmiIFOJg@public.gmane.org>,
	Tom Warren <TWarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Jerry Van Baren
	<vanbaren-He//nVnquyzQT0dZR+AlfA@public.gmane.org>,
	Devicetree Discuss
	<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>
Subject: Re: [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-F7+t8E8rja9g9hUCZPvPmw@public.gmane.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

WARNING: multiple messages have this Message-ID (diff)
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

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

Thread overview: 83+ 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 ` [PATCH v6 01/20] fdt: Tidy up a few fdtdec problems Simon Glass
2012-02-27 20:52   ` [U-Boot] " Simon Glass
2012-02-27 20:52 ` [PATCH v6 02/20] fdt: Add functions to access phandles, arrays and bools Simon Glass
2012-02-27 20:52   ` [U-Boot] " Simon Glass
2012-02-27 20:52 ` [PATCH v6 03/20] fdt: Add basic support for decoding GPIO definitions Simon Glass
2012-02-27 20:52   ` [U-Boot] " Simon Glass
2012-02-27 20:52 ` [PATCH v6 04/20] arm: fdt: Add skeleton device tree file from kernel Simon Glass
2012-02-27 20:52   ` [U-Boot] " Simon Glass
2012-02-27 20:52 ` [PATCH v6 05/20] tegra: fdt: Add Tegra2x " Simon Glass
2012-02-27 20:52   ` [U-Boot] " Simon Glass
2012-02-27 20:52 ` [PATCH v6 07/20] fdt: Add staging area for device tree binding documentation Simon Glass
2012-02-27 20:52   ` [U-Boot] " Simon Glass
2012-02-27 20:52 ` [PATCH v6 08/20] fdt: Add tegra-usb bindings file from linux Simon Glass
2012-02-27 20:52   ` [U-Boot] " Simon Glass
     [not found] ` <1330375973-10681-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-02-27 20:52   ` [PATCH v6 06/20] tegra: fdt: Add device tree file for Tegra2 Seaboard from kernel Simon Glass
2012-02-27 20:52     ` [U-Boot] " Simon Glass
2012-02-27 20:52   ` [PATCH v6 09/20] tegra: fdt: Add additional USB binding Simon Glass
2012-02-27 20:52     ` [U-Boot] " Simon Glass
     [not found]     ` <1330375973-10681-10-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-02-27 23:27       ` Stephen Warren
2012-02-27 23:27         ` [U-Boot] " Stephen Warren
2012-02-27 20:52   ` [PATCH v6 10/20] tegra: fdt: Add clock bindings Simon Glass
2012-02-27 20:52     ` [U-Boot] " Simon Glass
2012-02-27 20:52   ` [PATCH v6 11/20] tegra: fdt: Add clock bindings for Tegra2 Seaboard Simon Glass
2012-02-27 20:52     ` [U-Boot] " Simon Glass
     [not found]     ` <1330375973-10681-12-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-02-27 23:29       ` Stephen Warren
2012-02-27 23:29         ` [U-Boot] " Stephen Warren
     [not found]         ` <4F4C11E9.1050907-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-02-28 17:20           ` Simon Glass
2012-02-28 17:20             ` [U-Boot] " Simon Glass
     [not found]             ` <CAPnjgZ0_xzn0tvETt3C=pjyRX-MXNA-JXy4fuAs9L8OdHuvLhg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-02-28 17:32               ` Stephen Warren
2012-02-28 17:32                 ` [U-Boot] " Stephen Warren
     [not found]                 ` <74CDBE0F657A3D45AFBB94109FB122FF17BDDF1D6A-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2012-02-28 17:37                   ` Simon Glass
2012-02-28 17:37                     ` [U-Boot] " Simon Glass
2012-02-28 18:31                     ` Stephen Warren
2012-02-28 18:31                       ` [U-Boot] " Stephen Warren
2012-02-28 18:37                       ` Simon Glass
2012-02-28 18:37                         ` [U-Boot] " Simon Glass
2012-02-28 18:41                         ` Stephen Warren
2012-02-28 18:41                           ` [U-Boot] " Stephen Warren
2012-02-28 18:46                           ` Simon Glass
2012-02-28 18:46                             ` [U-Boot] " Simon Glass
     [not found]                             ` <CAPnjgZ0VGRSgb92u2UbNf+_HFF-EXhLZzC4XdYUvAjVKtz1XtQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-02-28 22:16                               ` Albert ARIBAUD
2012-02-28 22:16                                 ` Albert ARIBAUD
2012-03-03 16:26                                 ` Simon Glass
2012-03-03 16:26                                   ` [U-Boot] " Simon Glass
     [not found]                           ` <74CDBE0F657A3D45AFBB94109FB122FF17BDDF1DB8-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2012-03-05 20:46                             ` Tom Rini
2012-03-05 20:46                               ` Tom Rini
2012-03-07  2:48                               ` Simon Glass
2012-03-07  2:48                                 ` Simon Glass
2012-02-27 20:52   ` [PATCH v6 12/20] tegra: usb: fdt: Add additional device tree definitions for USB ports Simon Glass
2012-02-27 20:52     ` [U-Boot] " Simon Glass
2012-02-27 20:52   ` [PATCH v6 16/20] tegra: usb: Add support for Tegra USB peripheral Simon Glass
2012-02-27 20:52     ` [U-Boot] " Simon Glass
2012-02-27 20:52   ` [PATCH v6 17/20] tegra: usb: Add USB support to nvidia boards Simon Glass
2012-02-27 20:52     ` [U-Boot] " Simon Glass
2012-02-27 20:52   ` [PATCH v6 18/20] tegra: usb: Add common USB defines for tegra2 boards Simon Glass
2012-02-27 20:52     ` [U-Boot] " Simon Glass
2012-02-27 20:52   ` [PATCH v6 19/20] tegra: usb: Enable USB on Seaboard Simon Glass
2012-02-27 20:52     ` [U-Boot] " Simon Glass
2012-02-27 20:52 ` [PATCH v6 13/20] tegra: usb: fdt: Add USB definitions for Tegra2 Seaboard Simon Glass
2012-02-27 20:52   ` [U-Boot] " 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 ` [PATCH v6 15/20] tegra: fdt: Add function to return peripheral/clock ID Simon Glass
2012-02-27 20:52   ` [U-Boot] " Simon Glass
     [not found]   ` <1330375973-10681-16-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-02-27 23:41     ` Stephen Warren [this message]
2012-02-27 23:41       ` Stephen Warren
     [not found]       ` <4F4C149E.3070505-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-02-28 17:46         ` Simon Glass
2012-02-28 17:46           ` [U-Boot] " Simon Glass
     [not found]           ` <CAPnjgZ24vhy7NKj_Dt_dzn0qJ8=rj4nF04WSsY8u9MorAanzVA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-02-28 18:37             ` Stephen Warren
2012-02-28 18:37               ` [U-Boot] " Stephen Warren
     [not found]               ` <74CDBE0F657A3D45AFBB94109FB122FF17BDDF1DB4-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2012-02-28 18:44                 ` Simon Glass
2012-02-28 18:44                   ` [U-Boot] " Simon Glass
2012-02-28 18:51                   ` Stephen Warren
2012-02-28 18:51                     ` [U-Boot] " Stephen Warren
     [not found]                     ` <74CDBE0F657A3D45AFBB94109FB122FF17BDDF1DC8-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2012-02-28 23:50                       ` Simon Glass
2012-02-28 23:50                         ` [U-Boot] " Simon Glass
     [not found]                         ` <CAPnjgZ2vwck_u1HVbpz=B4QjiCVoLeX6TcvwMi-o71Fqt_m3NQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-02-29 17:08                           ` Stephen Warren
2012-02-29 17:08                             ` [U-Boot] " Stephen Warren
2012-02-27 20:52 ` [PATCH v6 20/20] tegra: fdt: Enable FDT support for Seaboard Simon Glass
2012-02-27 20:52   ` [U-Boot] " 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-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
    --cc=TWarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=u-boot-0aAXYlwwYIKGBzrmiIFOJg@public.gmane.org \
    --cc=vanbaren-He//nVnquyzQT0dZR+AlfA@public.gmane.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 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.