From: Sascha Hauer <s.hauer@pengutronix.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [Patch 5/9]U-boot-V2:cmd: add I2C commands
Date: Fri, 20 Jun 2008 17:16:49 +0200 [thread overview]
Message-ID: <20080620151649.GA28397@pengutronix.de> (raw)
In-Reply-To: <7A436F7769CA33409C6B44B358BFFF0CD32122AE@dlee02.ent.ti.com>
On Fri, Jun 20, 2008 at 08:35:46AM -0500, Menon, Nishanth wrote:
> Sascha,
> > -----Original Message-----
> > From: Sascha Hauer [mailto:s.hauer at pengutronix.de]
> > Sent: Friday, June 20, 2008 5:29 AM
> > To: Menon, Nishanth
> > Cc: u-boot-users at lists.sourceforge.net
> > Subject: Re: [Patch 5/9]U-boot-V2:cmd: add I2C commands
> >
> > Some overall comments first.
> >
> > You seem to register a device for each bus and do all access to slave
> > devices through the bus. It would be better if we register a new device
> > for each slave device.
> No. that is not a good strategy. Many reasons why not to do it as the cmds
> are a debug tool:
Just like md/mm are
> a) I am not interested in registering camera and all devices I may have in
> code. Yet, the handy little tool is good to do some basic debug of the device.
> b) Every client behaves in a different way. Camera for example may follow CCI
> specification, in which case, they would have 8, 16 ,32 bit regs all in the same
> device. In fact it may be near impossible to write a generic driver for them all.
> We cannot predict what we want to do for every device out there.
Lets see:
+int read_i2c(int file, uchar daddr, u16 addr, u8 reg_width, char *buffer,
+ size_t count)
+int write_i2c(int file, uchar daddr, u16 addr, u8 reg_width, char
*buffer,
+ size_t count)
These arguments map nicely to md/mm
> c) Devices wanting to expose their own app may choose to do so. Yes, I get the
> comment:
> > Please resist to introduce a new command for each type of device.
> d) It is wasteful to generate multiple device nodes when someone smart enough to
> understand I2C specification will also know that the common denominator for all
> devices is the I2C bus.
I do not understand why this is wasteful. It may be wasteful in terms of
malloc space, but all boards I know have more than enough memory for the
bootloader.
> e) Creating device node for each client node requires extensive client mechanism
> in I2C which has no "use case" for me.
> f) 7 bit addressing allows 127 devices, and I have 3 busses. 127*3 device nodes as
> a theoretical max is outrageous. When just 3 device nodes could have done the same job.
I did not mean for every possible device but for each device that is
actually present, or even from the present ones only the ones which are
of use for u-boot.
If you want to access a device which you know is present but U-Boot does
not know about it, then add a command like
i2c add /dev/i2cbus0 0x50
which would create the device node that you need to access device 0x50
on i2cbus0.
> In short, the common access mechanism of exposing the bus and allowing users to
> Do i2c accesses to the devices in the manner of choosing would be the most generic
> Method to do it. In fact U-Boot v1 also does something similar.
>
>
> > Slave devices could either be hardwired by a
> > board setup or, if the board maintainer or user is brave, through an
> > autodetect mechanism.
> > Once we have a device for each slave most of this patch can be removed
> > since you can use the generic md/mm commands for reading registers. In
> > the device tree this could look like this:
> >
> > /dev/i2cbus0 # bus 0
> > /dev/i2cbus0_50 # device 0x50 on bus 0...
> > /dev/eeprom0 # which happens to be an eeprom
> A) who would decide this would be a eeprom?
The board setup code in this case as eeproms are not probable.
> B) why should /dev/i2cbus0_50 be any different from /dev/eeprom?
issuing md on /dev/i2cbus0_50 would let you read the registers of the
chip, which of course happen to be the contents of the eeprom, so this
might be a bad example. Consider an A/D converter; reading
/dev/i2cbus0_xy would give you the register space while /dev/adxy would
give you the digital values (provided a client driver is present). Thus
/dev/adxy would require a driver whereas /dev/i2cbus0_xy does not.
> C) you are looking at 3 different device nodes when a single one would suffice.
>
> Note that complex development platforms like mine may have upto 30-40 devices on the bus.
> I have power monitoring ADC chips on buses which I really don???t care about during boot, yet
> May want to debug intermittently.
>
> What do we achieve by introducing i2c device based nodes?
- An overview over the system for those who are not familiar with it.
You may know the devices that are connected to the bus on your board,
I don't. One of the benefits in U-Boot-V2 for me is that many different
systems behave similarly although they have a very different hardware.
- when md/mm are usable on a device it also means that cp/memcmp/cat or
any other file command is usable.
- reduction in code size since you can reuse what's already there (like
file commands instead of new commands). That's one of the points that
make U-Boot-V1 bigger than it has to be.
>
> Will look at comments if we are aligned on this basic infrastructure. (overall I think the
> Rest of the comments are valid, even though I'd wish you'd stop putting the entire patch
> In the mail.. lots of scrolling down to reach your comment ;) )..
You are lucky, I already had to remove some lines as I hit the list
limit ;)
Regards,
Sascha
--
Pengutronix e.K. - Linux Solutions for Science and Industry
-----------------------------------------------------------
Kontakt-Informationen finden Sie im Header dieser Mail oder
auf der Webseite -> http://www.pengutronix.de/impressum/ <-
next prev parent reply other threads:[~2008-06-20 15:16 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-18 12:33 [U-Boot-Users] [Patch 0/9] U-boot-V2: Introduce I2C support for SDP3430 Menon, Nishanth
2008-06-18 14:55 ` Timur Tabi
2008-06-18 15:15 ` Menon, Nishanth
2008-06-18 15:28 ` Sascha Hauer
2008-06-18 15:40 ` Menon, Nishanth
2008-06-18 15:39 ` Timur Tabi
2008-06-18 15:52 ` Menon, Nishanth
2008-06-18 15:58 ` Sascha Hauer
2008-06-18 16:04 ` Menon, Nishanth
2008-06-18 18:38 ` Robert Schwebel
2008-06-18 18:48 ` Menon, Nishanth
2008-06-18 19:11 ` Robert Schwebel
2008-06-18 20:21 ` Menon, Nishanth
2008-06-18 20:44 ` Robert Schwebel
2008-06-18 20:52 ` Menon, Nishanth
2008-06-19 15:10 ` Menon, Nishanth
2008-06-19 15:11 ` [U-Boot-Users] [Patch 1/9]U-boot-V2:ID: Add i2c_device_id Menon, Nishanth
2008-06-19 15:11 ` [U-Boot-Users] [Patch 2/9]U-boot-V2:ID: Introduce idr Menon, Nishanth
2008-06-19 15:11 ` [U-Boot-Users] [Patch 3/9]U-boot-V2:I2C: Introduce core Menon, Nishanth
2008-06-19 15:12 ` [U-Boot-Users] [Patch 4/9]U-boot-V2:I2C: Introduce i2c-dev Menon, Nishanth
2008-06-19 15:12 ` [U-Boot-Users] [Patch 5/9]U-boot-V2:cmd: add I2C commands Menon, Nishanth
2008-06-19 20:33 ` Wolfgang Denk
2008-06-20 2:10 ` Menon, Nishanth
2008-06-20 7:28 ` Wolfgang Denk
2008-06-20 10:28 ` Sascha Hauer
2008-06-20 13:35 ` Menon, Nishanth
2008-06-20 15:16 ` Sascha Hauer [this message]
2008-06-20 16:28 ` Menon, Nishanth
2008-06-23 7:39 ` Sascha Hauer
2008-06-23 13:29 ` Menon, Nishanth
2008-06-21 2:34 ` [U-Boot-Users] [Patch 4/9 Try 2]U-boot-V2:I2C: Introduce i2c-dev Menon, Nishanth
2008-06-24 8:05 ` Sascha Hauer
2008-06-25 1:48 ` [U-Boot-Users] [Patch 4/9 Try 3]U-boot-V2:I2C: " Menon, Nishanth
2008-06-21 2:34 ` [U-Boot-Users] [Patch 5/9 Try2]U-boot-V2:cmd: add I2C commands Menon, Nishanth
2008-06-21 7:23 ` Wolfgang Denk
2008-06-22 18:56 ` [U-Boot-Users] [Patch 5/9 Try 3]U-boot-V2:cmd: " Menon, Nishanth
2008-06-24 6:18 ` Sascha Hauer
2008-06-25 1:46 ` [U-Boot-Users] [Patch 5/9 Try 4]U-boot-V2:cmd: " Menon, Nishanth
2008-06-19 15:12 ` [U-Boot-Users] [Patch 6/9]U-boot-V2:cmd: I2C commands support Menon, Nishanth
2008-06-19 15:13 ` [U-Boot-Users] [Patch 7/9]U-boot-V2:ARM:OMAP: OMAP classes Menon, Nishanth
2008-06-19 15:13 ` [U-Boot-Users] [Patch 8/9]U-boot-V2:I2C:Busses: OMAP I2C Adapter Menon, Nishanth
2008-06-19 15:13 ` [U-Boot-Users] [Patch 9/9]U-boot-V2:Boards:SDP3430 I2C bus1 Menon, Nishanth
2008-06-18 18:41 ` [U-Boot-Users] [Patch 0/9] U-boot-V2: Introduce I2C support for SDP3430 Robert Schwebel
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=20080620151649.GA28397@pengutronix.de \
--to=s.hauer@pengutronix.de \
--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