From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [POWERPC v3] mgsuvd: fix compiler warning when using soft_i2c driver
Date: Fri, 17 Oct 2008 12:16:47 +0200 [thread overview]
Message-ID: <48F8660F.3050801@denx.de> (raw)
Signed-off-by: Heiko Schocher <hs@denx.de>
---
board/keymile/common/common.c | 3 ++-
drivers/i2c/soft_i2c.c | 4 ++++
include/configs/mgsuvd.h | 24 +++++++++++++++---------
3 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 61276d2..e47928d 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -34,6 +34,7 @@
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
#include <i2c.h>
#endif
+#include <asm/io.h>
extern int i2c_soft_read_pin (void);
@@ -400,7 +401,7 @@ static void set_scl (int state)
static int get_sda (void)
{
- return i2c_soft_read_pin ();
+ return I2C_READ;
}
static int get_scl (void)
diff --git a/drivers/i2c/soft_i2c.c b/drivers/i2c/soft_i2c.c
index 508d3d7..ebe60e2 100644
--- a/drivers/i2c/soft_i2c.c
+++ b/drivers/i2c/soft_i2c.c
@@ -28,6 +28,7 @@
#include <common.h>
#ifdef CONFIG_MPC8260 /* only valid for MPC8260 */
#include <ioports.h>
+#include <asm/io.h>
#endif
#ifdef CONFIG_AT91RM9200 /* need this for the at91rm9200 */
#include <asm/io.h>
@@ -39,6 +40,9 @@
#ifdef CONFIG_LPC2292
#include <asm/arch/hardware.h>
#endif
+#ifdef CONFIG_MPC866 /* only valid for MPC866 */
+#include <asm/io.h>
+#endif
#include <i2c.h>
/* #define DEBUG_I2C */
diff --git a/include/configs/mgsuvd.h b/include/configs/mgsuvd.h
index 416e4db..c4a0ed0 100644
--- a/include/configs/mgsuvd.h
+++ b/include/configs/mgsuvd.h
@@ -346,8 +346,8 @@
/*
* Software (bit-bang) I2C driver configuration
*/
-#define I2C_BASE_DIR (CONFIG_SYS_PIGGY_BASE + 0x04)
-#define I2C_BASE_PORT (CONFIG_SYS_PIGGY_BASE + 0x09)
+#define I2C_BASE_DIR ((u16 *)(CONFIG_SYS_PIGGY_BASE + 0x04))
+#define I2C_BASE_PORT ((u8 *)(CONFIG_SYS_PIGGY_BASE + 0x09))
#define SDA_BIT 0x40
#define SCL_BIT 0x80
@@ -356,18 +356,24 @@
#define I2C_ACTIVE do {} while (0)
#define I2C_TRISTATE do {} while (0)
-#define I2C_READ i2c_soft_read_pin ()
+#define I2C_READ ((in_8(I2C_BASE_PORT) & SDA_BIT) == SDA_BIT)
#define I2C_SDA(bit) if(bit) { \
- *(unsigned short *)(I2C_BASE_DIR) &= ~SDA_CONF; \
+ out_be16(I2C_BASE_DIR, \
+ in_be16(I2C_BASE_DIR) & ~SDA_CONF); \
} else { \
- *(unsigned char *)(I2C_BASE_PORT) &= ~SDA_BIT; \
- *(unsigned short *)(I2C_BASE_DIR) |= SDA_CONF; \
+ out_8(I2C_BASE_PORT, \
+ in_8(I2C_BASE_PORT) & ~SDA_BIT); \
+ out_be16(I2C_BASE_DIR, \
+ in_be16(I2C_BASE_DIR) | SDA_CONF); \
}
#define I2C_SCL(bit) if(bit) { \
- *(unsigned short *)(I2C_BASE_DIR) &= ~SCL_CONF; \
+ out_be16(I2C_BASE_DIR, \
+ in_be16(I2C_BASE_DIR) & ~SCL_CONF); \
} else { \
- *(unsigned char *)(I2C_BASE_PORT) &= ~SCL_BIT; \
- *(unsigned short *)(I2C_BASE_DIR) |= SCL_CONF; \
+ out_8(I2C_BASE_PORT, \
+ in_8(I2C_BASE_PORT) & ~SCL_BIT); \
+ out_be16(I2C_BASE_DIR, \
+ in_be16(I2C_BASE_DIR) | SCL_CONF); \
}
#define I2C_DELAY udelay(50) /* 1/4 I2C clock duration */
--
1.5.6.1
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
reply other threads:[~2008-10-17 10:16 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=48F8660F.3050801@denx.de \
--to=hs@denx.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 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.