Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
[sfrench/cifs-2.6.git] / include / linux / tifm.h
index 82da028d8c077e2b536ba8b6d0266e5f7cbe8f5e..848c0f3925419a7743e5bc998d02a8893f91d36d 100644 (file)
 
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
-#include <linux/wait.h>
 #include <linux/delay.h>
 #include <linux/pci.h>
-#include <linux/kthread.h>
+#include <linux/workqueue.h>
 
 /* Host registers (relative to pci base address): */
 enum {
        FM_SET_INTERRUPT_ENABLE   = 0x008,
        FM_CLEAR_INTERRUPT_ENABLE = 0x00c,
-       FM_INTERRUPT_STATUS       = 0x014 };
+       FM_INTERRUPT_STATUS       = 0x014
+};
 
 /* Socket registers (relative to socket base address): */
 enum {
@@ -58,21 +58,26 @@ enum {
        SOCK_MS_DATA                   = 0x188,
        SOCK_MS_STATUS                 = 0x18c,
        SOCK_MS_SYSTEM                 = 0x190,
-       SOCK_FIFO_ACCESS               = 0x200 };
+       SOCK_FIFO_ACCESS               = 0x200
+};
 
 #define TIFM_CTRL_LED             0x00000040
 #define TIFM_CTRL_FAST_CLK        0x00000100
+#define TIFM_CTRL_POWER_MASK      0x00000007
 
 #define TIFM_SOCK_STATE_OCCUPIED  0x00000008
 #define TIFM_SOCK_STATE_POWERED   0x00000080
 
-#define TIFM_FIFO_ENABLE          0x00000001 /* Meaning of this constant is unverified */
+#define TIFM_FIFO_ENABLE          0x00000001
+#define TIFM_FIFO_READY           0x00000001
+#define TIFM_FIFO_MORE            0x00000008
 #define TIFM_FIFO_INT_SETALL      0x0000ffff
-#define TIFM_FIFO_INTMASK         0x00000005 /* Meaning of this constant is unverified */
+#define TIFM_FIFO_INTMASK         0x00000005
 
-#define TIFM_DMA_RESET            0x00000002 /* Meaning of this constant is unverified */
-#define TIFM_DMA_TX               0x00008000 /* Meaning of this constant is unverified */
-#define TIFM_DMA_EN               0x00000001 /* Meaning of this constant is unverified */
+#define TIFM_DMA_RESET            0x00000002
+#define TIFM_DMA_TX               0x00008000
+#define TIFM_DMA_EN               0x00000001
+#define TIFM_DMA_TSIZE            0x0000007f
 
 #define TIFM_TYPE_XD 1
 #define TIFM_TYPE_MS 2
@@ -84,44 +89,46 @@ struct tifm_device_id {
 
 struct tifm_driver;
 struct tifm_dev {
-       char __iomem            *addr;
-       spinlock_t              lock;
-       unsigned char           type;
-       unsigned int            socket_id;
+       char __iomem  *addr;
+       spinlock_t    lock;
+       unsigned char type;
+       unsigned int  socket_id;
 
        void          (*card_event)(struct tifm_dev *sock);
        void          (*data_event)(struct tifm_dev *sock);
 
-       struct device           dev;
+       struct device dev;
 };
 
 struct tifm_driver {
        struct tifm_device_id *id_table;
-       int                  (*probe)(struct tifm_dev *dev);
-       void                 (*remove)(struct tifm_dev *dev);
-       int                  (*suspend)(struct tifm_dev *dev,
-                                        pm_message_t state);
-       int                  (*resume)(struct tifm_dev *dev);
+       int                   (*probe)(struct tifm_dev *dev);
+       void                  (*remove)(struct tifm_dev *dev);
+       int                   (*suspend)(struct tifm_dev *dev,
+                                        pm_message_t state);
+       int                   (*resume)(struct tifm_dev *dev);
 
-       struct device_driver driver;
+       struct device_driver  driver;
 };
 
 struct tifm_adapter {
-       char __iomem            *addr;
-       spinlock_t              lock;
-       unsigned int            irq_status;
-       unsigned int            socket_change_set;
-       unsigned int            id;
-       unsigned int            num_sockets;
-       struct completion       *finish_me;
-
-       struct work_struct      media_switcher;
-       struct class_device     cdev;
-
-       void                    (*eject)(struct tifm_adapter *fm,
-                                        struct tifm_dev *sock);
-
-       struct tifm_dev         *sockets[0];
+       char __iomem        *addr;
+       spinlock_t          lock;
+       unsigned int        irq_status;
+       unsigned int        socket_change_set;
+       unsigned int        id;
+       unsigned int        num_sockets;
+       struct completion   *finish_me;
+
+       struct work_struct  media_switcher;
+       struct device       dev;
+
+       void                (*eject)(struct tifm_adapter *fm,
+                                    struct tifm_dev *sock);
+       int                 (*has_ms_pif)(struct tifm_adapter *fm,
+                                         struct tifm_dev *sock);
+
+       struct tifm_dev     *sockets[0];
 };
 
 struct tifm_adapter *tifm_alloc_adapter(unsigned int num_sockets,
@@ -137,6 +144,7 @@ struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm, unsigned int id,
 int tifm_register_driver(struct tifm_driver *drv);
 void tifm_unregister_driver(struct tifm_driver *drv);
 void tifm_eject(struct tifm_dev *sock);
+int tifm_has_ms_pif(struct tifm_dev *sock);
 int tifm_map_sg(struct tifm_dev *sock, struct scatterlist *sg, int nents,
                int direction);
 void tifm_unmap_sg(struct tifm_dev *sock, struct scatterlist *sg, int nents,
@@ -145,7 +153,7 @@ void tifm_queue_work(struct work_struct *work);
 
 static inline void *tifm_get_drvdata(struct tifm_dev *dev)
 {
-        return dev_get_drvdata(&dev->dev);
+       return dev_get_drvdata(&dev->dev);
 }
 
 static inline void tifm_set_drvdata(struct tifm_dev *dev, void *data)