ucmb: Add support for a reset line to the microcontroller.
[openwrt/svn-archive/archive.git] / utils / ucmb / driver / ucmb.h
index 94fdc6420e75abaf42a0ac38d95814ff5e49377e..8455dd00257b168ab5ba78f760063264a667e7e4 100644 (file)
@@ -2,6 +2,17 @@
 #define LINUX_UCMB_H_
 
 #include <linux/types.h>
+#include <linux/ioctl.h>
+
+
+/* IOCTLs */
+#define __UCMB_IOCTL           ('U'|'C'|'M'|'B')
+
+/** UCMB_IOCTL_RESETUC - Reset the microcontroller. */
+#define UCMB_IOCTL_RESETUC     _IO(__UCMB_IOCTL, 0)
+
+
+#ifdef __KERNEL__
 
 /**
  * struct ucmb_platform_data - UCMB device descriptor
  * @name:              The name of the device. This will also be the name of
  *                     the misc char device.
  *
- * @gpio_cs:           The chipselect GPIO pin. Can be SPI_GPIO_NO_CHIPSELECT.
+ * @gpio_cs:           The chipselect GPIO pin. Can be SPI_GPIO_NO_CHIPSELECT,
+ *                     if chipselect is not used.
  * @gpio_sck:          The clock GPIO pin.
  * @gpio_miso:         The master-in slave-out GPIO pin.
  * @gpio_mosi:         The master-out slave-in GPIO pin.
  *
+ * @gpio_reset:                The GPIO pin to the microcontroller reset line.
+ *                     Can be UCMB_NO_RESET, if reset GPIO is not used.
+ * @reset_activelow:   If true, @gpio_reset is considered to be active
+ *                     on logical 0 (inverted).
+ *
  * @mode:              The SPI bus mode. SPI_MODE_*
  * @max_speed_hz:      The bus speed, in Hz. If zero the speed is not limited.
  * @msg_delay_ms:      The message delay time, in milliseconds.
@@ -28,6 +45,9 @@ struct ucmb_platform_data {
        unsigned int gpio_miso;
        unsigned int gpio_mosi;
 
+       unsigned int gpio_reset;
+       bool reset_activelow;
+
        u8 mode;
        u32 max_speed_hz;
        unsigned int msg_delay_ms;
@@ -35,4 +55,8 @@ struct ucmb_platform_data {
        struct platform_device *pdev; /* internal */
 };
 
+#define UCMB_NO_RESET          ((unsigned int)-1)
+
+
+#endif /* __KERNEL__ */
 #endif /* LINUX_UCMB_H_ */