utils/picocom: update picocom to version 1.6 (closes #7873)
[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 /** UCMB_IOCTL_GMSGDELAY - Get the delay to wait before fetching the status. */
14 #define UCMB_IOCTL_GMSGDELAY _IOR(__UCMB_IOCTL, 1, unsigned int)
15 /** UCMB_IOCTL_SMSGDELAY - Set the delay to wait before fetching the status. */
16 #define UCMB_IOCTL_SMSGDELAY _IOW(__UCMB_IOCTL, 2, unsigned int)
17
18
19 #ifdef __KERNEL__
20
21 #include <linux/device.h>
22 #include <linux/spi/spi.h>
23 #include <linux/spi/spi_gpio.h>
24
25 /**
26 * struct ucmb_platform_data - UCMB device descriptor
27 *
28 * @name: The name of the device. This will also be the name of
29 * the misc char device.
30 *
31 * @gpio_cs: The chipselect GPIO pin. Can be SPI_GPIO_NO_CHIPSELECT,
32 * if chipselect is not used.
33 * @gpio_sck: The clock GPIO pin.
34 * @gpio_miso: The master-in slave-out GPIO pin.
35 * @gpio_mosi: The master-out slave-in GPIO pin.
36 *
37 * @gpio_reset: The GPIO pin to the microcontroller reset line.
38 * Can be UCMB_NO_RESET, if reset GPIO is not used.
39 * @reset_activelow: If true, @gpio_reset is considered to be active
40 * on logical 0 (inverted).
41 *
42 * @mode: The SPI bus mode. SPI_MODE_*
43 * @max_speed_hz: The bus speed, in Hz. If zero the speed is not limited.
44 * @chunk_size: The maximum chunk size to transmit/receive in one go
45 * without sleeping. The kernel will be allowed to sleep
46 * after each chunk.
47 * If set to 0, the whole data will be transmitted/received
48 * in one big rush without sleeping. Note that this might hurt
49 * system responsiveness, if the kernel is not preemptible.
50 * If CONFIG_PREEMPT is enabled, chunk_size will be forced to 0.
51 */
52 struct ucmb_platform_data {
53 const char *name;
54
55 unsigned long gpio_cs;
56 unsigned int gpio_sck;
57 unsigned int gpio_miso;
58 unsigned int gpio_mosi;
59
60 unsigned int gpio_reset;
61 bool reset_activelow;
62
63 u8 mode;
64 u32 max_speed_hz;
65 unsigned int chunk_size;
66
67 struct platform_device *pdev; /* internal */
68 };
69
70 #define UCMB_NO_RESET ((unsigned int)-1)
71
72 int ucmb_device_register(struct ucmb_platform_data *pdata);
73 void ucmb_device_unregister(struct ucmb_platform_data *pdata);
74
75
76 #endif /* __KERNEL__ */
77 #endif /* LINUX_UCMB_H_ */