public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] MPC8xx I2C
Date: Wed, 30 Jan 2008 11:33:56 -0500	[thread overview]
Message-ID: <47A0A6F4.4010402@gmail.com> (raw)

Hi,

I'm trying to rationalize some very common I2C code and came across the 
following:

Every controller except cpu/mpc8xx implements functions like this:

---

uchar i2c_reg_read(uchar i2c_addr, uchar reg)
{
	uchar buf;

	i2c_read(i2c_addr, reg, 1, &buf, 1);
	return buf;
}

void i2c_reg_write(uchar i2c_addr, uchar reg, uchar val)
{
	i2c_write(i2c_addr, reg, 1, &val, 1);
}


---

cpu/mpc8xx, however, adds i2c_init() calls:

---

uchar i2c_reg_read(uchar i2c_addr, uchar reg)
{
	uchar buf;

	i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE);
	i2c_read(i2c_addr, reg, 1, &buf, 1);
	return (buf);
}

void i2c_reg_write(uchar i2c_addr, uchar reg, uchar val)
{
	i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE);
	i2c_write(i2c_addr, reg, 1, &val, 1);
}

---

Can somebody lend historical perspective as to why these i2c_init() 
calls are needed?

thanks,
Ben

                 reply	other threads:[~2008-01-30 16:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=47A0A6F4.4010402@gmail.com \
    --to=biggerbadderben@gmail.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