linux-mips
[Top] [All Lists]

Re: [PATCH 1/5] i2c: Convert i2c-octeon.c to use device tree.

To: Rob Herring <robherring2@gmail.com>
Subject: Re: [PATCH 1/5] i2c: Convert i2c-octeon.c to use device tree.
From: David Daney <david.daney@cavium.com>
Date: Mon, 26 Mar 2012 18:29:33 -0700
Cc: David Daney <ddaney.cavm@gmail.com>, "linux-mips@linux-mips.org" <linux-mips@linux-mips.org>, "ralf@linux-mips.org" <ralf@linux-mips.org>, "devicetree-discuss@lists.ozlabs.org" <devicetree-discuss@lists.ozlabs.org>, Grant Likely <grant.likely@secretlab.ca>, Rob Herring <rob.herring@calxeda.com>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>, "Ben Dooks (embedded platforms)" <ben-linux@fluff.org>, "Jean Delvare (PC drivers, core)" <khali@linux-fr.org>
In-reply-to: <4F7115FA.6080507@gmail.com>
References: <1332808075-8333-1-git-send-email-ddaney.cavm@gmail.com> <1332808075-8333-2-git-send-email-ddaney.cavm@gmail.com> <4F7115FA.6080507@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Fedora/3.0.10-1.fc12 Thunderbird/3.0.10
On 03/26/2012 06:20 PM, Rob Herring wrote:
[...]
---

Should probably go via Ralf's linux-mips.org tree.

  arch/mips/cavium-octeon/octeon-irq.c      |    2 -
  arch/mips/cavium-octeon/octeon-platform.c |   84 -------------------------
  arch/mips/include/asm/octeon/octeon.h     |    5 --
  drivers/i2c/busses/i2c-octeon.c           |   94 ++++++++++++++++-------------
  4 files changed, 52 insertions(+), 133 deletions(-)

snip


-       if (i2c_data == NULL) {
-               dev_err(i2c->dev, "no I2C frequency data\n");
+       /*
+        * "clock-rate" is a legacy binding, the official binding is
+        * "clock-frequency".  Try the official one first and then
+        * fall back if it doesn't exist.
+        */
+       data = of_get_property(pdev->dev.of_node, "clock-frequency",&len);
+       if (!data || len != sizeof(*data))
+               data = of_get_property(pdev->dev.of_node, "clock-rate",&len);
+       if (data&&  len == sizeof(*data)) {
+               i2c->twsi_freq = be32_to_cpup(data);

Can't you use of_property_read_u32?

I will investigate, and use it if possible.


Does the legacy binding really exist as DT support is new?


Yes, unfortunately some bootloaders escaped into the wild with the "clock-rate" binding.

Otherwise,

Acked-by: Rob Herring<rob.herring@calxeda.com>


Thanks,


<Prev in Thread] Current Thread [Next in Thread>