Linux I2C development
 help / color / mirror / Atom feed
From: "Jon Smirl" <jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
Cc: Kevin Hilman
	<khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>,
	i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
Subject: Re: Fwd: [PATCH 2/3] I2C: at24: add kernel interface for reading/writing EEPROM
Date: Wed, 27 Aug 2008 09:40:22 -0400	[thread overview]
Message-ID: <9e4733910808270640h2e5fb88fn46548d3630b7f45d@mail.gmail.com> (raw)
In-Reply-To: <200808270019.12987.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>

On 8/27/08, David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org> wrote:
> On Tuesday 26 August 2008, Trent Piepho wrote:
>  > Lots of tv cards have eeproms with configuration information.  They use an
>  > I2C driver called tveeprom that exports this:
>  >
>  > int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len)
>
>
> That presumes the driver somehow has access to that I2C client.

How about using bus_find_device? PowerPC uses it to locate the i2c
device using pointers in the device tree.

+static int of_dev_node_match(struct device *dev, void *data)
+{
+        return dev->archdata.of_node == data;
+}
+
+struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
+{
+	struct device *dev;
+	
+	dev = bus_find_device(&i2c_bus_type, NULL, node,
+					 of_dev_node_match);
+	if (!dev)
+		return NULL;
+		
+	return to_i2c_client(dev);
+}
+EXPORT_SYMBOL(of_find_i2c_device_by_node);
+




>
>  (Also, that it's an I2C EEPROM.  I keep wanting to have something
>  usable for SPI EEPROMs and NVRAM too.  But maybe nobody else cares.)
>
>
>
>  > > Last I heard, the U-Boot policy was not to touch controllers that are
>  > > not required during boot.  Despite relatively common cases like needing
>  > > to set up MAC addresses ... maybe this patch of Kevin's can make it a
>  > > bunch easier to cope with that U-Boot policy.  :)
>  >
>  > U-boot can put the MAC address into a property of the MAC's device node in
>  > the OF device tree (which u-boot passes to the kernel).
>
>
> Maybe with PowerPC it does.  Not on ARM.  ;)
>
>
>


-- 
Jon Smirl
jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

  parent reply	other threads:[~2008-08-27 13:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-26  2:41 Fwd: [PATCH 2/3] I2C: at24: add kernel interface for reading/writing EEPROM David Brownell
     [not found] ` <200808251941.54964.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-08-26  3:40   ` Jon Smirl
     [not found]     ` <9e4733910808252040j69b10ea8n1e3e40d16e86a3ae-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-26 19:37       ` David Brownell
     [not found]         ` <200808261237.29870.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-08-26 19:55           ` Jon Smirl
     [not found]             ` <9e4733910808261255v23b41f4dha3e345dc54529ca6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-26 20:35               ` David Brownell
     [not found]                 ` <200808261335.36103.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-08-27  2:04                   ` Trent Piepho
     [not found]                     ` <Pine.LNX.4.58.0808261852580.2423-nuiHJn5p267P3RPoUHIrnuTW4wlIGRCZ@public.gmane.org>
2008-08-27  7:19                       ` David Brownell
     [not found]                         ` <200808270019.12987.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-08-27 13:40                           ` Jon Smirl [this message]
     [not found]                             ` <9e4733910808270640h2e5fb88fn46548d3630b7f45d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-28 21:19                               ` David Brownell
     [not found]                                 ` <200808281419.47519.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-08-28 22:53                                   ` Jon Smirl

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=9e4733910808270640h2e5fb88fn46548d3630b7f45d@mail.gmail.com \
    --to=jonsmirl-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org \
    --cc=i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org \
    --cc=khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox