tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Adding SMBus block transfers to iic(4)



Just an update here.

In order to enable requesting block-mode transfers using the I2C_IOCTL_EXEC method from userland, I'm now proposing to add two new "high-level operations" to the i2c_op_t enum, along with a new macro predicate:

typedef enum {
        I2C_OP_READ_WITH_STOP   = 1,
        I2C_OP_WRITE            = 2,
        I2C_OP_WRITE_WITH_STOP  = 3,
+       I2C_OP_READ_BLOCK       = 5,    /* All block operations imply STOP */
+       I2C_OP_WRITE_BLOCK      = 7
 } i2c_op_t;

 #define        I2C_OP_READ_P(x)        (((int)(x) & 2) == 0)
 #define        I2C_OP_WRITE_P(x)       (! I2C_OP_READ_P(x))
 #define        I2C_OP_STOP_P(x)        (((int)(x) & 1) != 0)
+#define        I2C_OP_BLKMODE_P(x)     (((int)(x) & 4) != 0)



On Sun, 11 Mar 2012, Paul Goyette wrote:

There are apparently some devices out there that really need to have i2c block-mode transfers, and it appears that none of our current drivers (at least, none of the "mainstream" pci drivers) supports this.

At first glance, it might appear that we could simply check the transfer
requested byte-count, and automatically operate in block mode if the count is greater than 2; the implication is that we could fall back to byte or word transfers for smaller byte counts. But it looks like at least one device out there [1] doesn't support this.

So I propose adding a new flag bit that can be passed to iic_exec() to request block-transfer protocols. In src/sys/dev/i2c/i2c_io.h

        #define I2C_F_BLOCK     0x20

Comments?  Suggestions?  Alternatives?



[1] http://eeepc-linux.googlecode.com/files/9LPR426A.pdf

-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |
-------------------------------------------------------------------------

!DSPAM:4f5d2d7a1985496917264!




-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |
-------------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index