Index: soft_i2c.c =================================================================== RCS file: /cvsroot/u-boot/u-boot/common/soft_i2c.c,v retrieving revision 1.4 diff -u -r1.4 soft_i2c.c --- soft_i2c.c 27 Jun 2003 21:32:32 -0000 1.4 +++ soft_i2c.c 23 Apr 2004 13:45:49 -0000 @@ -30,9 +30,17 @@ #include #endif #include +#include #if defined(CONFIG_SOFT_I2C) +#ifdef CONFIG_MPC8260 + #define DECLARE_I2C_PORT volatile ioport_t *iop = ioport_addr((immap_t *)CFG_IMMR, I2C_PORT); +#endif +#ifdef CONFIG_8xx + #define DECLARE_I2C_PORT volatile immap_t *immr = (immap_t *)CFG_IMMR; +#endif + /* #define DEBUG_I2C */ @@ -75,12 +83,8 @@ */ static void send_reset(void) { -#ifdef CONFIG_MPC8260 - volatile ioport_t *iop = ioport_addr((immap_t *)CFG_IMMR, I2C_PORT); -#endif -#ifdef CONFIG_8xx - volatile immap_t *immr = (immap_t *)CFG_IMMR; -#endif + DECLARE_I2C_PORT + int j; I2C_SCL(1); @@ -106,12 +110,7 @@ */ static void send_start(void) { -#ifdef CONFIG_MPC8260 - volatile ioport_t *iop = ioport_addr((immap_t *)CFG_IMMR, I2C_PORT); -#endif -#ifdef CONFIG_8xx - volatile immap_t *immr = (immap_t *)CFG_IMMR; -#endif + DECLARE_I2C_PORT I2C_DELAY; I2C_SDA(1); @@ -128,12 +127,7 @@ */ static void send_stop(void) { -#ifdef CONFIG_MPC8260 - volatile ioport_t *iop = ioport_addr((immap_t *)CFG_IMMR, I2C_PORT); -#endif -#ifdef CONFIG_8xx - volatile immap_t *immr = (immap_t *)CFG_IMMR; -#endif + DECLARE_I2C_PORT I2C_SCL(0); I2C_DELAY; @@ -153,12 +147,7 @@ */ static void send_ack(int ack) { -#ifdef CONFIG_MPC8260 - volatile ioport_t *iop = ioport_addr((immap_t *)CFG_IMMR, I2C_PORT); -#endif -#ifdef CONFIG_8xx - volatile immap_t *immr = (immap_t *)CFG_IMMR; -#endif + DECLARE_I2C_PORT I2C_ACTIVE; I2C_SCL(0); @@ -181,12 +170,8 @@ */ static int write_byte(uchar data) { -#ifdef CONFIG_MPC8260 - volatile ioport_t *iop = ioport_addr((immap_t *)CFG_IMMR, I2C_PORT); -#endif -#ifdef CONFIG_8xx - volatile immap_t *immr = (immap_t *)CFG_IMMR; -#endif + DECLARE_I2C_PORT + int j; int nack; @@ -229,12 +214,8 @@ */ static uchar read_byte(int ack) { -#ifdef CONFIG_MPC8260 - volatile ioport_t *iop = ioport_addr((immap_t *)CFG_IMMR, I2C_PORT); -#endif -#ifdef CONFIG_8xx - volatile immap_t *immr = (immap_t *)CFG_IMMR; -#endif + DECLARE_I2C_PORT + int data; int j;