1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * include/linux/mfd/viperboard.h
5 * Nano River Technologies viperboard definitions
7 * (C) 2012 by Lemonage GmbH
8 * Author: Lars Poeschel <poeschel@lemonage.de>
12 #ifndef __MFD_VIPERBOARD_H__
13 #define __MFD_VIPERBOARD_H__
15 #include <linux/types.h>
16 #include <linux/usb.h>
18 #define VPRBRD_EP_OUT 0x02
19 #define VPRBRD_EP_IN 0x86
21 #define VPRBRD_I2C_MSG_LEN 512 /* max length of a msg on USB level */
23 #define VPRBRD_I2C_FREQ_6MHZ 1 /* 6 MBit/s */
24 #define VPRBRD_I2C_FREQ_3MHZ 2 /* 3 MBit/s */
25 #define VPRBRD_I2C_FREQ_1MHZ 3 /* 1 MBit/s */
26 #define VPRBRD_I2C_FREQ_FAST 4 /* 400 kbit/s */
27 #define VPRBRD_I2C_FREQ_400KHZ VPRBRD_I2C_FREQ_FAST
28 #define VPRBRD_I2C_FREQ_200KHZ 5 /* 200 kbit/s */
29 #define VPRBRD_I2C_FREQ_STD 6 /* 100 kbit/s */
30 #define VPRBRD_I2C_FREQ_100KHZ VPRBRD_I2C_FREQ_STD
31 #define VPRBRD_I2C_FREQ_10KHZ 7 /* 10 kbit/s */
33 #define VPRBRD_I2C_CMD_WRITE 0x00
34 #define VPRBRD_I2C_CMD_READ 0x01
35 #define VPRBRD_I2C_CMD_ADDR 0x02
37 #define VPRBRD_USB_TYPE_OUT 0x40
38 #define VPRBRD_USB_TYPE_IN 0xc0
39 #define VPRBRD_USB_TIMEOUT_MS 100
40 #define VPRBRD_USB_REQUEST_I2C_FREQ 0xe6
41 #define VPRBRD_USB_REQUEST_I2C 0xe9
42 #define VPRBRD_USB_REQUEST_MAJOR 0xea
43 #define VPRBRD_USB_REQUEST_MINOR 0xeb
44 #define VPRBRD_USB_REQUEST_ADC 0xec
45 #define VPRBRD_USB_REQUEST_GPIOA 0xed
46 #define VPRBRD_USB_REQUEST_GPIOB 0xdd
48 struct vprbrd_i2c_write_hdr {
58 struct vprbrd_i2c_read_hdr {
67 u16 tf1; /* transfer 1 length */
68 u16 tf2; /* transfer 2 length */
71 struct vprbrd_i2c_status {
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)];
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)];
88 struct vprbrd_i2c_addr_msg {
97 /* Structure to hold all device specific stuff */
99 struct usb_device *usb_dev; /* the usb device for this device */
101 u8 buf[sizeof(struct vprbrd_i2c_write_msg)];
102 struct platform_device pdev;
105 #endif /* __MFD_VIPERBOARD_H__ */