On Wed, May 14, 2008 at 04:14:45PM -0700, [EMAIL PROTECTED] wrote:

I just managed to test the latest version of this driver.

> +static int cpm_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int 
> num)
> +{
> +     struct cpm_i2c *cpm = i2c_get_adapdata(adap);
> +     struct i2c_reg __iomem *i2c_reg = cpm->i2c_reg;
> +     struct i2c_ram __iomem *i2c_ram = cpm->i2c_ram;
> +     struct i2c_msg *pmsg;
> +     int ret, i;
> +     int tptr;
> +     int rptr;
> +     cbd_t __iomem *tbdf;
> +     cbd_t __iomem *rbdf;
> +
> +     if (num > CPM_MAXBD)
> +             return -EINVAL;
> +
> +     /* Check if we have any oversized READ requests */
> +     for (i = 0; i < num; i++) {
> +             pmsg = &msgs[i];
> +             if (pmsg->len >= CPM_MAX_READ)
> +                     return -EINVAL;
> +     }
> +
> +     /* Reset to use first buffer */
> +     out_be16(&i2c_ram->rbptr, in_be16(&i2c_ram->rbase));
> +     out_be16(&i2c_ram->tbptr, in_be16(&i2c_ram->tbase));
> +
> +     tbdf = cpm->tbase;
> +     rbdf = cpm->rbase;
> +
> +     tptr = 0;
> +     rptr = 0;
> +
> +     while (tptr < num) {
> +             pmsg = &msgs[tptr];
> +             dev_dbg(&adap->dev, "R: %d T: %d\n", rptr, tptr);
> +
> +             cpm_i2c_parse_message(adap, pmsg, num, tptr, rptr);
> +             if (pmsg->flags & I2C_M_RD)
> +                     rptr++;
> +             tptr++;
> +     }
> +     /* Start transfer now */
> +     /* Enable RX/TX/Error interupts */
> +     out_8(&i2c_reg->i2cmr, I2CER_BUSY | I2CER_TXB | I2CER_RXB);
> +     out_8(&i2c_reg->i2cer, 0xff);   /* Clear interrupt status */
> +     /* Chip bug, set enable here */
> +     setbits8(&i2c_reg->i2mod, I2MOD_EN);    /* Enable */
> +     /* Begin transmission */
> +     setbits8(&i2c_reg->i2com, I2COM_MASTER);
Bummer! This should not be I2COM_MASTER but I2COM_START! Otherwise no
I2C communication will happen.

After applying this change, the driver works fine on an MPC8260 (like
the previous version did).

All the best,

   Wolfram

-- 
  Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry

Attachment: signature.asc
Description: Digital signature

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

Reply via email to