4 #include <linux/types.h>
5 #include <linux/ioctl.h>
9 #define __UCMB_IOCTL ('U'|'C'|'M'|'B')
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)
21 #include <linux/device.h>
22 #include <linux/spi/spi.h>
23 #include <linux/spi/spi_gpio.h>
26 * struct ucmb_platform_data - UCMB device descriptor
28 * @name: The name of the device. This will also be the name of
29 * the misc char device.
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.
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).
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
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.
52 struct ucmb_platform_data
{
55 unsigned long gpio_cs
;
56 unsigned int gpio_sck
;
57 unsigned int gpio_miso
;
58 unsigned int gpio_mosi
;
60 unsigned int gpio_reset
;
65 unsigned int chunk_size
;
67 struct platform_device
*pdev
; /* internal */
70 #define UCMB_NO_RESET ((unsigned int)-1)
72 int ucmb_device_register(struct ucmb_platform_data
*pdata
);
73 void ucmb_device_unregister(struct ucmb_platform_data
*pdata
);
76 #endif /* __KERNEL__ */
77 #endif /* LINUX_UCMB_H_ */