8455dd00257b168ab5ba78f760063264a667e7e4
[openwrt/svn-archive/archive.git] / utils / ucmb / driver / ucmb.h
1 #ifndef LINUX_UCMB_H_
2 #define LINUX_UCMB_H_
3
4 #include <linux/types.h>
5 #include <linux/ioctl.h>
6
7
8 /* IOCTLs */
9 #define __UCMB_IOCTL ('U'|'C'|'M'|'B')
10
11 /** UCMB_IOCTL_RESETUC - Reset the microcontroller. */
12 #define UCMB_IOCTL_RESETUC _IO(__UCMB_IOCTL, 0)
13
14
15 #ifdef __KERNEL__
16
17 /**
18 * struct ucmb_platform_data - UCMB device descriptor
19 *
20 * @name: The name of the device. This will also be the name of
21 * the misc char device.
22 *
23 * @gpio_cs: The chipselect GPIO pin. Can be SPI_GPIO_NO_CHIPSELECT,
24 * if chipselect is not used.
25 * @gpio_sck: The clock GPIO pin.
26 * @gpio_miso: The master-in slave-out GPIO pin.
27 * @gpio_mosi: The master-out slave-in GPIO pin.
28 *
29 * @gpio_reset: The GPIO pin to the microcontroller reset line.
30 * Can be UCMB_NO_RESET, if reset GPIO is not used.
31 * @reset_activelow: If true, @gpio_reset is considered to be active
32 * on logical 0 (inverted).
33 *
34 * @mode: The SPI bus mode. SPI_MODE_*
35 * @max_speed_hz: The bus speed, in Hz. If zero the speed is not limited.
36 * @msg_delay_ms: The message delay time, in milliseconds.
37 * This is the time the microcontroller takes to process
38 * one message.
39 */
40 struct ucmb_platform_data {
41 const char *name;
42
43 unsigned long gpio_cs;
44 unsigned int gpio_sck;
45 unsigned int gpio_miso;
46 unsigned int gpio_mosi;
47
48 unsigned int gpio_reset;
49 bool reset_activelow;
50
51 u8 mode;
52 u32 max_speed_hz;
53 unsigned int msg_delay_ms;
54
55 struct platform_device *pdev; /* internal */
56 };
57
58 #define UCMB_NO_RESET ((unsigned int)-1)
59
60
61 #endif /* __KERNEL__ */
62 #endif /* LINUX_UCMB_H_ */