diff options
| author | Lars Poeschel <poeschel@lemonage.de> | 2012-11-05 09:48:23 -0500 |
|---|---|---|
| committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-11-20 06:21:12 -0500 |
| commit | f01312d846016dbd38cc9865e580298fb61f2aa7 (patch) | |
| tree | de82be5e80055f91363e218d099002e72b5bc7d6 /include/linux/mfd | |
| parent | b9fbb62eb61452d728c39b2e5020739c575aac53 (diff) | |
mfd: Add viperboard driver
Add mfd driver for Nano River Technologies viperboard.
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include/linux/mfd')
| -rw-r--r-- | include/linux/mfd/viperboard.h | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/include/linux/mfd/viperboard.h b/include/linux/mfd/viperboard.h new file mode 100644 index 000000000000..0d1342466db5 --- /dev/null +++ b/include/linux/mfd/viperboard.h | |||
| @@ -0,0 +1,105 @@ | |||
| 1 | /* | ||
| 2 | * include/linux/mfd/viperboard.h | ||
| 3 | * | ||
| 4 | * Nano River Technologies viperboard definitions | ||
| 5 | * | ||
| 6 | * (C) 2012 by Lemonage GmbH | ||
| 7 | * Author: Lars Poeschel <poeschel@lemonage.de> | ||
| 8 | * All rights reserved. | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify it | ||
| 11 | * under the terms of the GNU General Public License as published by the | ||
| 12 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 13 | * option) any later version. | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef __MFD_VIPERBOARD_H__ | ||
| 18 | #define __MFD_VIPERBOARD_H__ | ||
| 19 | |||
| 20 | #include <linux/types.h> | ||
| 21 | #include <linux/usb.h> | ||
| 22 | |||
| 23 | #define VPRBRD_EP_OUT 0x02 | ||
| 24 | #define VPRBRD_EP_IN 0x86 | ||
| 25 | |||
| 26 | #define VPRBRD_I2C_MSG_LEN 512 /* max length of a msg on USB level */ | ||
| 27 | |||
| 28 | #define VPRBRD_I2C_FREQ_6MHZ 1 /* 6 MBit/s */ | ||
| 29 | #define VPRBRD_I2C_FREQ_3MHZ 2 /* 3 MBit/s */ | ||
| 30 | #define VPRBRD_I2C_FREQ_1MHZ 3 /* 1 MBit/s */ | ||
| 31 | #define VPRBRD_I2C_FREQ_FAST 4 /* 400 kbit/s */ | ||
| 32 | #define VPRBRD_I2C_FREQ_400KHZ VPRBRD_I2C_FREQ_FAST | ||
| 33 | #define VPRBRD_I2C_FREQ_200KHZ 5 /* 200 kbit/s */ | ||
| 34 | #define VPRBRD_I2C_FREQ_STD 6 /* 100 kbit/s */ | ||
| 35 | #define VPRBRD_I2C_FREQ_100KHZ VPRBRD_I2C_FREQ_STD | ||
| 36 | #define VPRBRD_I2C_FREQ_10KHZ 7 /* 10 kbit/s */ | ||
| 37 | |||
| 38 | #define VPRBRD_I2C_CMD_WRITE 0x00 | ||
| 39 | #define VPRBRD_I2C_CMD_READ 0x01 | ||
| 40 | #define VPRBRD_I2C_CMD_ADDR 0x02 | ||
| 41 | |||
| 42 | #define VPRBRD_USB_TYPE_OUT 0x40 | ||
| 43 | #define VPRBRD_USB_TYPE_IN 0xc0 | ||
| 44 | #define VPRBRD_USB_TIMEOUT_MS 100 | ||
| 45 | #define VPRBRD_USB_REQUEST_MAJOR 0xea | ||
| 46 | #define VPRBRD_USB_REQUEST_MINOR 0xeb | ||
| 47 | |||
| 48 | struct vprbrd_i2c_write_hdr { | ||
| 49 | u8 cmd; | ||
| 50 | u16 addr; | ||
| 51 | u8 len1; | ||
| 52 | u8 len2; | ||
| 53 | u8 last; | ||
| 54 | u8 chan; | ||
| 55 | u16 spi; | ||
| 56 | } __packed; | ||
| 57 | |||
| 58 | struct vprbrd_i2c_read_hdr { | ||
| 59 | u8 cmd; | ||
| 60 | u16 addr; | ||
| 61 | u8 len0; | ||
| 62 | u8 len1; | ||
| 63 | u8 len2; | ||
| 64 | u8 len3; | ||
| 65 | u8 len4; | ||
| 66 | u8 len5; | ||
| 67 | u16 tf1; /* transfer 1 length */ | ||
| 68 | u16 tf2; /* transfer 2 length */ | ||
| 69 | } __packed; | ||
| 70 | |||
| 71 | struct vprbrd_i2c_status { | ||
| 72 | u8 unknown[11]; | ||
| 73 | u8 status; | ||
| 74 | } __packed; | ||
| 75 | |||
| 76 | struct vprbrd_i2c_write_msg { | ||
| 77 | struct vprbrd_i2c_write_hdr header; | ||
| 78 | u8 data[VPRBRD_I2C_MSG_LEN | ||
| 79 | - sizeof(struct vprbrd_i2c_write_hdr)]; | ||
| 80 | } __packed; | ||
| 81 | |||
| 82 | struct vprbrd_i2c_read_msg { | ||
| 83 | struct vprbrd_i2c_read_hdr header; | ||
| 84 | u8 data[VPRBRD_I2C_MSG_LEN | ||
| 85 | - sizeof(struct vprbrd_i2c_read_hdr)]; | ||
| 86 | } __packed; | ||
| 87 | |||
| 88 | struct vprbrd_i2c_addr_msg { | ||
| 89 | u8 cmd; | ||
| 90 | u8 addr; | ||
| 91 | u8 unknown1; | ||
| 92 | u16 len; | ||
| 93 | u8 unknown2; | ||
| 94 | u8 unknown3; | ||
| 95 | } __packed; | ||
| 96 | |||
| 97 | /* Structure to hold all device specific stuff */ | ||
| 98 | struct vprbrd { | ||
| 99 | struct usb_device *usb_dev; /* the usb device for this device */ | ||
| 100 | struct mutex lock; | ||
| 101 | u8 buf[sizeof(struct vprbrd_i2c_write_msg)]; | ||
| 102 | struct platform_device pdev; | ||
| 103 | }; | ||
| 104 | |||
| 105 | #endif /* __MFD_VIPERBOARD_H__ */ | ||
