]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - arch/cris/include/asm/etraxi2c.h
UBUNTU: Ubuntu-4.15.0-96.97
[mirror_ubuntu-bionic-kernel.git] / arch / cris / include / asm / etraxi2c.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* $Id: etraxi2c.h,v 1.1 2001/01/18 15:49:57 bjornw Exp $ */
3
4 #ifndef _LINUX_ETRAXI2C_H
5 #define _LINUX_ETRAXI2C_H
6
7 /* etraxi2c _IOC_TYPE, bits 8 to 15 in ioctl cmd */
8
9 #define ETRAXI2C_IOCTYPE 44
10
11 /* supported ioctl _IOC_NR's */
12
13 /* in write operations, the argument contains both i2c
14 * slave, register and value.
15 */
16
17 #define I2C_WRITEARG(slave, reg, value) (((slave) << 16) | ((reg) << 8) | (value))
18 #define I2C_READARG(slave, reg) (((slave) << 16) | ((reg) << 8))
19
20 #define I2C_ARGSLAVE(arg) ((arg) >> 16)
21 #define I2C_ARGREG(arg) (((arg) >> 8) & 0xff)
22 #define I2C_ARGVALUE(arg) ((arg) & 0xff)
23
24 #define I2C_WRITEREG 0x1 /* write to an i2c register */
25 #define I2C_READREG 0x2 /* read from an i2c register */
26
27 /*
28 EXAMPLE usage:
29
30 i2c_arg = I2C_WRITEARG(STA013_WRITE_ADDR, reg, val);
31 ioctl(fd, _IO(ETRAXI2C_IOCTYPE, I2C_WRITEREG), i2c_arg);
32
33 i2c_arg = I2C_READARG(STA013_READ_ADDR, reg);
34 val = ioctl(fd, _IO(ETRAXI2C_IOCTYPE, I2C_READREG), i2c_arg);
35
36 */
37 #endif