fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / mmc / wbsd.h
index 51652c3..6072993 100644 (file)
@@ -1,20 +1,14 @@
 /*
- *  linux/drivers/mmc/wbsd.h
+ *  linux/drivers/mmc/wbsd.h - Winbond W83L51xD SD/MMC driver
  *
- *  Copyright (C) 2004 Pierre Ossman, All Rights Reserved.
+ *  Copyright (C) 2004-2005 Pierre Ossman, All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
  */
 
-const int config_ports[] = { 0x2E, 0x4E };
-const int unlock_codes[] = { 0x83, 0x87 };
-
-const int valid_ids[] = {
-       0x7112,
-       };
-
 #define LOCK_CODE              0xAA
 
 #define WBSD_CONF_SWRST                0x02
@@ -35,6 +29,12 @@ const int valid_ids[] = {
 
 #define DEVICE_SD              0x03
 
+#define WBSD_PINS_DAT3_HI      0x20
+#define WBSD_PINS_DAT3_OUT     0x10
+#define WBSD_PINS_GP11_HI      0x04
+#define WBSD_PINS_DETECT_GP11  0x02
+#define WBSD_PINS_DETECT_DAT3  0x01
+
 #define WBSD_CMDR              0x00
 #define WBSD_DFR               0x01
 #define WBSD_EIR               0x02
@@ -107,6 +107,8 @@ const int valid_ids[] = {
 #define WBSD_CLK_16M           0x02
 #define WBSD_CLK_24M           0x03
 
+#define WBSD_DATA_WIDTH                0x01
+
 #define WBSD_DAT3_H            0x08
 #define WBSD_FIFO_RESET                0x04
 #define WBSD_SOFT_RESET                0x02
@@ -119,6 +121,8 @@ const int valid_ids[] = {
 #define WBSD_FIFOEN_FULL       0x10
 #define WBSD_FIFO_THREMASK     0x0F
 
+#define WBSD_BLOCK_READ                0x80
+#define WBSD_BLOCK_WRITE       0x40
 #define WBSD_BUSY              0x20
 #define WBSD_CARDTRAFFIC       0x04
 #define WBSD_SENDCMD           0x02
@@ -131,47 +135,55 @@ const int valid_ids[] = {
 #define WBSD_CRC_OK            0x05 /* S010E (00101) */
 #define WBSD_CRC_FAIL          0x0B /* S101E (01011) */
 
-
-/* 64kB / 512 */
-#define NR_SG                  128
+#define WBSD_DMA_SIZE          65536
 
 struct wbsd_host
 {
        struct mmc_host*        mmc;            /* MMC structure */
-       
+
        spinlock_t              lock;           /* Mutex */
 
+       int                     flags;          /* Driver states */
+
+#define WBSD_FCARD_PRESENT     (1<<0)          /* Card is present */
+#define WBSD_FIGNORE_DETECT    (1<<1)          /* Ignore card detection */
+
        struct mmc_request*     mrq;            /* Current request */
-       
-       struct scatterlist      sg[NR_SG];      /* SG list */
+
+       u8                      isr;            /* Accumulated ISR */
+
        struct scatterlist*     cur_sg;         /* Current SG entry */
        unsigned int            num_sg;         /* Number of entries left */
-       
+       void*                   mapped_sg;      /* vaddr of mapped sg */
+
        unsigned int            offset;         /* Offset into current entry */
        unsigned int            remain;         /* Data left in curren entry */
 
        int                     size;           /* Total size of transfer */
-       
+
        char*                   dma_buffer;     /* ISA DMA buffer */
        dma_addr_t              dma_addr;       /* Physical address for same */
 
        int                     firsterr;       /* See fifo functions */
-       
+
        u8                      clk;            /* Current clock speed */
-       
+       unsigned char           bus_width;      /* Current bus width */
+
        int                     config;         /* Config port */
        u8                      unlock_code;    /* Code to unlock config */
 
        int                     chip_id;        /* ID of controller */
-       
+
        int                     base;           /* I/O port base */
        int                     irq;            /* Interrupt */
        int                     dma;            /* DMA channel */
-       
+
        struct tasklet_struct   card_tasklet;   /* Tasklet structures */
        struct tasklet_struct   fifo_tasklet;
        struct tasklet_struct   crc_tasklet;
        struct tasklet_struct   timeout_tasklet;
        struct tasklet_struct   finish_tasklet;
        struct tasklet_struct   block_tasklet;
+
+       struct timer_list       ignore_timer;   /* Ignore detection timer */
 };