Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
via-sdmmc.c File Reference
#include <linux/pci.h>
#include <linux/module.h>
#include <linux/dma-mapping.h>
#include <linux/highmem.h>
#include <linux/delay.h>
#include <linux/mmc/host.h>

Go to the source code of this file.

Data Structures

struct  sdhcreg
 
struct  pcictrlreg
 
struct  via_crdr_mmc_host
 

Macros

#define DRV_NAME   "via_sdmmc"
 
#define PCI_DEVICE_ID_VIA_9530   0x9530
 
#define VIA_CRDR_SDC_OFF   0x200
 
#define VIA_CRDR_DDMA_OFF   0x400
 
#define VIA_CRDR_PCICTRL_OFF   0x600
 
#define VIA_CRDR_MIN_CLOCK   375000
 
#define VIA_CRDR_MAX_CLOCK   48000000
 
#define VIA_CRDR_PCI_WORK_MODE   0x40
 
#define VIA_CRDR_PCI_DBG_MODE   0x41
 
#define VIA_CRDR_SDCTRL   0x0
 
#define VIA_CRDR_SDCTRL_START   0x01
 
#define VIA_CRDR_SDCTRL_WRITE   0x04
 
#define VIA_CRDR_SDCTRL_SINGLE_WR   0x10
 
#define VIA_CRDR_SDCTRL_SINGLE_RD   0x20
 
#define VIA_CRDR_SDCTRL_MULTI_WR   0x30
 
#define VIA_CRDR_SDCTRL_MULTI_RD   0x40
 
#define VIA_CRDR_SDCTRL_STOP   0x70
 
#define VIA_CRDR_SDCTRL_RSP_NONE   0x0
 
#define VIA_CRDR_SDCTRL_RSP_R1   0x10000
 
#define VIA_CRDR_SDCTRL_RSP_R2   0x20000
 
#define VIA_CRDR_SDCTRL_RSP_R3   0x30000
 
#define VIA_CRDR_SDCTRL_RSP_R1B   0x90000
 
#define VIA_CRDR_SDCARG   0x4
 
#define VIA_CRDR_SDBUSMODE   0x8
 
#define VIA_CRDR_SDMODE_4BIT   0x02
 
#define VIA_CRDR_SDMODE_CLK_ON   0x40
 
#define VIA_CRDR_SDBLKLEN   0xc
 
#define VIA_CRDR_SDBLKLEN_GPIDET   0x2000
 
#define VIA_CRDR_SDBLKLEN_INTEN   0x8000
 
#define VIA_CRDR_MAX_BLOCK_COUNT   65536
 
#define VIA_CRDR_MAX_BLOCK_LENGTH   2048
 
#define VIA_CRDR_SDRESP0   0x10
 
#define VIA_CRDR_SDRESP1   0x14
 
#define VIA_CRDR_SDRESP2   0x18
 
#define VIA_CRDR_SDRESP3   0x1c
 
#define VIA_CRDR_SDCURBLKCNT   0x20
 
#define VIA_CRDR_SDINTMASK   0x24
 
#define VIA_CRDR_SDINTMASK_MBDIE   0x10
 
#define VIA_CRDR_SDINTMASK_BDDIE   0x20
 
#define VIA_CRDR_SDINTMASK_CIRIE   0x80
 
#define VIA_CRDR_SDINTMASK_CRDIE   0x200
 
#define VIA_CRDR_SDINTMASK_CRTOIE   0x400
 
#define VIA_CRDR_SDINTMASK_ASCRDIE   0x800
 
#define VIA_CRDR_SDINTMASK_DTIE   0x1000
 
#define VIA_CRDR_SDINTMASK_SCIE   0x2000
 
#define VIA_CRDR_SDINTMASK_RCIE   0x4000
 
#define VIA_CRDR_SDINTMASK_WCIE   0x8000
 
#define VIA_CRDR_SDACTIVE_INTMASK
 
#define VIA_CRDR_SDSTATUS   0x28
 
#define VIA_CRDR_SDSTS_CECC   0x01
 
#define VIA_CRDR_SDSTS_WP   0x02
 
#define VIA_CRDR_SDSTS_SLOTD   0x04
 
#define VIA_CRDR_SDSTS_SLOTG   0x08
 
#define VIA_CRDR_SDSTS_MBD   0x10
 
#define VIA_CRDR_SDSTS_BDD   0x20
 
#define VIA_CRDR_SDSTS_CD   0x40
 
#define VIA_CRDR_SDSTS_CIR   0x80
 
#define VIA_CRDR_SDSTS_IO   0x100
 
#define VIA_CRDR_SDSTS_CRD   0x200
 
#define VIA_CRDR_SDSTS_CRTO   0x400
 
#define VIA_CRDR_SDSTS_ASCRDIE   0x800
 
#define VIA_CRDR_SDSTS_DT   0x1000
 
#define VIA_CRDR_SDSTS_SC   0x2000
 
#define VIA_CRDR_SDSTS_RC   0x4000
 
#define VIA_CRDR_SDSTS_WC   0x8000
 
#define VIA_CRDR_SDSTS_IGN_MASK   (VIA_CRDR_SDSTS_BDD | VIA_CRDR_SDSTS_ASCRDIE | VIA_CRDR_SDSTS_IO)
 
#define VIA_CRDR_SDSTS_INT_MASK
 
#define VIA_CRDR_SDSTS_W1C_MASK
 
#define VIA_CRDR_SDSTS_CMD_MASK   (VIA_CRDR_SDSTS_CRD | VIA_CRDR_SDSTS_CRTO | VIA_CRDR_SDSTS_SC)
 
#define VIA_CRDR_SDSTS_DATA_MASK
 
#define VIA_CRDR_SDSTATUS2   0x2a
 
#define VIA_CRDR_SDSTS_CFE   0x80
 
#define VIA_CRDR_SDRSPTMO   0x2C
 
#define VIA_CRDR_SDCLKSEL   0x30
 
#define VIA_CRDR_SDEXTCTRL   0x34
 
#define VIS_CRDR_SDEXTCTRL_AUTOSTOP_SD   0x01
 
#define VIS_CRDR_SDEXTCTRL_SHIFT_9   0x02
 
#define VIS_CRDR_SDEXTCTRL_MMC_8BIT   0x04
 
#define VIS_CRDR_SDEXTCTRL_RELD_BLK   0x08
 
#define VIS_CRDR_SDEXTCTRL_BAD_CMDA   0x10
 
#define VIS_CRDR_SDEXTCTRL_BAD_DATA   0x20
 
#define VIS_CRDR_SDEXTCTRL_AUTOSTOP_SPI   0x40
 
#define VIA_CRDR_SDEXTCTRL_HISPD   0x80
 
#define VIA_CRDR_DMABASEADD   0x0
 
#define VIA_CRDR_DMACOUNTER   0x4
 
#define VIA_CRDR_DMACTRL   0x8
 
#define VIA_CRDR_DMACTRL_DIR   0x100
 
#define VIA_CRDR_DMACTRL_ENIRQ   0x10000
 
#define VIA_CRDR_DMACTRL_SFTRST   0x1000000
 
#define VIA_CRDR_DMASTS   0xc
 
#define VIA_CRDR_DMASTART   0x10
 
#define VIA_CRDR_PCICLKGATT   0x2
 
#define VIA_CRDR_PCICLKGATT_SFTRST   0x01
 
#define VIA_CRDR_PCICLKGATT_3V3   0x10
 
#define VIA_CRDR_PCICLKGATT_PAD_PWRON   0x20
 
#define VIA_CRDR_PCISDCCLK   0x5
 
#define VIA_CRDR_PCIDMACLK   0x7
 
#define VIA_CRDR_PCIDMACLK_SDC   0x2
 
#define VIA_CRDR_PCIINTCTRL   0x8
 
#define VIA_CRDR_PCIINTCTRL_SDCIRQEN   0x04
 
#define VIA_CRDR_PCIINTSTATUS   0x9
 
#define VIA_CRDR_PCIINTSTATUS_SDC   0x04
 
#define VIA_CRDR_PCITMOCTRL   0xa
 
#define VIA_CRDR_PCITMOCTRL_NO   0x0
 
#define VIA_CRDR_PCITMOCTRL_32US   0x1
 
#define VIA_CRDR_PCITMOCTRL_256US   0x2
 
#define VIA_CRDR_PCITMOCTRL_1024US   0x3
 
#define VIA_CRDR_PCITMOCTRL_256MS   0x4
 
#define VIA_CRDR_PCITMOCTRL_512MS   0x5
 
#define VIA_CRDR_PCITMOCTRL_1024MS   0x6
 
#define VIA_CRDR_QUIRK_300MS_PWRDELAY   0x0001
 
#define via_sd_suspend   NULL
 
#define via_sd_resume   NULL
 

Enumerations

enum  PCI_HOST_CLK_CONTROL {
  PCI_CLK_375K = 0x03, PCI_CLK_8M = 0x04, PCI_CLK_12M = 0x00, PCI_CLK_16M = 0x05,
  PCI_CLK_24M = 0x01, PCI_CLK_33M = 0x06, PCI_CLK_48M = 0x02
}
 

Functions

 MODULE_DEVICE_TABLE (pci, via_ids)
 
 module_pci_driver (via_sd_driver)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_AUTHOR ("VIA Technologies Inc.")
 
 MODULE_DESCRIPTION ("VIA SD/MMC Card Interface driver")
 

Macro Definition Documentation

#define DRV_NAME   "via_sdmmc"

Definition at line 19 of file via-sdmmc.c.

#define PCI_DEVICE_ID_VIA_9530   0x9530

Definition at line 21 of file via-sdmmc.c.

#define VIA_CRDR_DDMA_OFF   0x400

Definition at line 24 of file via-sdmmc.c.

#define VIA_CRDR_DMABASEADD   0x0

Definition at line 191 of file via-sdmmc.c.

#define VIA_CRDR_DMACOUNTER   0x4

Definition at line 192 of file via-sdmmc.c.

#define VIA_CRDR_DMACTRL   0x8

Definition at line 194 of file via-sdmmc.c.

#define VIA_CRDR_DMACTRL_DIR   0x100

Definition at line 200 of file via-sdmmc.c.

#define VIA_CRDR_DMACTRL_ENIRQ   0x10000

Definition at line 201 of file via-sdmmc.c.

#define VIA_CRDR_DMACTRL_SFTRST   0x1000000

Definition at line 202 of file via-sdmmc.c.

#define VIA_CRDR_DMASTART   0x10

Definition at line 206 of file via-sdmmc.c.

#define VIA_CRDR_DMASTS   0xc

Definition at line 204 of file via-sdmmc.c.

#define VIA_CRDR_MAX_BLOCK_COUNT   65536

Definition at line 72 of file via-sdmmc.c.

#define VIA_CRDR_MAX_BLOCK_LENGTH   2048

Definition at line 73 of file via-sdmmc.c.

#define VIA_CRDR_MAX_CLOCK   48000000

Definition at line 28 of file via-sdmmc.c.

#define VIA_CRDR_MIN_CLOCK   375000

Definition at line 27 of file via-sdmmc.c.

#define VIA_CRDR_PCI_DBG_MODE   0x41

Definition at line 35 of file via-sdmmc.c.

#define VIA_CRDR_PCI_WORK_MODE   0x40

Definition at line 34 of file via-sdmmc.c.

#define VIA_CRDR_PCICLKGATT   0x2

Definition at line 214 of file via-sdmmc.c.

#define VIA_CRDR_PCICLKGATT_3V3   0x10

Definition at line 228 of file via-sdmmc.c.

#define VIA_CRDR_PCICLKGATT_PAD_PWRON   0x20

Definition at line 236 of file via-sdmmc.c.

#define VIA_CRDR_PCICLKGATT_SFTRST   0x01

Definition at line 220 of file via-sdmmc.c.

#define VIA_CRDR_PCICTRL_OFF   0x600

Definition at line 25 of file via-sdmmc.c.

#define VIA_CRDR_PCIDMACLK   0x7

Definition at line 240 of file via-sdmmc.c.

#define VIA_CRDR_PCIDMACLK_SDC   0x2

Definition at line 241 of file via-sdmmc.c.

#define VIA_CRDR_PCIINTCTRL   0x8

Definition at line 243 of file via-sdmmc.c.

#define VIA_CRDR_PCIINTCTRL_SDCIRQEN   0x04

Definition at line 244 of file via-sdmmc.c.

#define VIA_CRDR_PCIINTSTATUS   0x9

Definition at line 246 of file via-sdmmc.c.

#define VIA_CRDR_PCIINTSTATUS_SDC   0x04

Definition at line 247 of file via-sdmmc.c.

#define VIA_CRDR_PCISDCCLK   0x5

Definition at line 238 of file via-sdmmc.c.

#define VIA_CRDR_PCITMOCTRL   0xa

Definition at line 249 of file via-sdmmc.c.

#define VIA_CRDR_PCITMOCTRL_1024MS   0x6

Definition at line 256 of file via-sdmmc.c.

#define VIA_CRDR_PCITMOCTRL_1024US   0x3

Definition at line 253 of file via-sdmmc.c.

#define VIA_CRDR_PCITMOCTRL_256MS   0x4

Definition at line 254 of file via-sdmmc.c.

#define VIA_CRDR_PCITMOCTRL_256US   0x2

Definition at line 252 of file via-sdmmc.c.

#define VIA_CRDR_PCITMOCTRL_32US   0x1

Definition at line 251 of file via-sdmmc.c.

#define VIA_CRDR_PCITMOCTRL_512MS   0x5

Definition at line 255 of file via-sdmmc.c.

#define VIA_CRDR_PCITMOCTRL_NO   0x0

Definition at line 250 of file via-sdmmc.c.

#define VIA_CRDR_QUIRK_300MS_PWRDELAY   0x0001

Definition at line 323 of file via-sdmmc.c.

#define VIA_CRDR_SDACTIVE_INTMASK
#define VIA_CRDR_SDBLKLEN   0xc

Definition at line 62 of file via-sdmmc.c.

#define VIA_CRDR_SDBLKLEN_GPIDET   0x2000

Definition at line 70 of file via-sdmmc.c.

#define VIA_CRDR_SDBLKLEN_INTEN   0x8000

Definition at line 71 of file via-sdmmc.c.

#define VIA_CRDR_SDBUSMODE   0x8

Definition at line 58 of file via-sdmmc.c.

#define VIA_CRDR_SDC_OFF   0x200

Definition at line 23 of file via-sdmmc.c.

#define VIA_CRDR_SDCARG   0x4

Definition at line 56 of file via-sdmmc.c.

#define VIA_CRDR_SDCLKSEL   0x30

Definition at line 174 of file via-sdmmc.c.

#define VIA_CRDR_SDCTRL   0x0

Definition at line 41 of file via-sdmmc.c.

#define VIA_CRDR_SDCTRL_MULTI_RD   0x40

Definition at line 47 of file via-sdmmc.c.

#define VIA_CRDR_SDCTRL_MULTI_WR   0x30

Definition at line 46 of file via-sdmmc.c.

#define VIA_CRDR_SDCTRL_RSP_NONE   0x0

Definition at line 50 of file via-sdmmc.c.

#define VIA_CRDR_SDCTRL_RSP_R1   0x10000

Definition at line 51 of file via-sdmmc.c.

#define VIA_CRDR_SDCTRL_RSP_R1B   0x90000

Definition at line 54 of file via-sdmmc.c.

#define VIA_CRDR_SDCTRL_RSP_R2   0x20000

Definition at line 52 of file via-sdmmc.c.

#define VIA_CRDR_SDCTRL_RSP_R3   0x30000

Definition at line 53 of file via-sdmmc.c.

#define VIA_CRDR_SDCTRL_SINGLE_RD   0x20

Definition at line 45 of file via-sdmmc.c.

#define VIA_CRDR_SDCTRL_SINGLE_WR   0x10

Definition at line 44 of file via-sdmmc.c.

#define VIA_CRDR_SDCTRL_START   0x01

Definition at line 42 of file via-sdmmc.c.

#define VIA_CRDR_SDCTRL_STOP   0x70

Definition at line 48 of file via-sdmmc.c.

#define VIA_CRDR_SDCTRL_WRITE   0x04

Definition at line 43 of file via-sdmmc.c.

#define VIA_CRDR_SDCURBLKCNT   0x20

Definition at line 80 of file via-sdmmc.c.

#define VIA_CRDR_SDEXTCTRL   0x34

Definition at line 176 of file via-sdmmc.c.

#define VIA_CRDR_SDEXTCTRL_HISPD   0x80

Definition at line 184 of file via-sdmmc.c.

#define VIA_CRDR_SDINTMASK   0x24

Definition at line 82 of file via-sdmmc.c.

#define VIA_CRDR_SDINTMASK_ASCRDIE   0x800

Definition at line 100 of file via-sdmmc.c.

#define VIA_CRDR_SDINTMASK_BDDIE   0x20

Definition at line 96 of file via-sdmmc.c.

#define VIA_CRDR_SDINTMASK_CIRIE   0x80

Definition at line 97 of file via-sdmmc.c.

#define VIA_CRDR_SDINTMASK_CRDIE   0x200

Definition at line 98 of file via-sdmmc.c.

#define VIA_CRDR_SDINTMASK_CRTOIE   0x400

Definition at line 99 of file via-sdmmc.c.

#define VIA_CRDR_SDINTMASK_DTIE   0x1000

Definition at line 101 of file via-sdmmc.c.

#define VIA_CRDR_SDINTMASK_MBDIE   0x10

Definition at line 95 of file via-sdmmc.c.

#define VIA_CRDR_SDINTMASK_RCIE   0x4000

Definition at line 103 of file via-sdmmc.c.

#define VIA_CRDR_SDINTMASK_SCIE   0x2000

Definition at line 102 of file via-sdmmc.c.

#define VIA_CRDR_SDINTMASK_WCIE   0x8000

Definition at line 104 of file via-sdmmc.c.

#define VIA_CRDR_SDMODE_4BIT   0x02

Definition at line 59 of file via-sdmmc.c.

#define VIA_CRDR_SDMODE_CLK_ON   0x40

Definition at line 60 of file via-sdmmc.c.

#define VIA_CRDR_SDRESP0   0x10

Definition at line 75 of file via-sdmmc.c.

#define VIA_CRDR_SDRESP1   0x14

Definition at line 76 of file via-sdmmc.c.

#define VIA_CRDR_SDRESP2   0x18

Definition at line 77 of file via-sdmmc.c.

#define VIA_CRDR_SDRESP3   0x1c

Definition at line 78 of file via-sdmmc.c.

#define VIA_CRDR_SDRSPTMO   0x2C

Definition at line 172 of file via-sdmmc.c.

#define VIA_CRDR_SDSTATUS   0x28

Definition at line 112 of file via-sdmmc.c.

#define VIA_CRDR_SDSTATUS2   0x2a

Definition at line 166 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_ASCRDIE   0x800

Definition at line 142 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_BDD   0x20

Definition at line 136 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_CD   0x40

Definition at line 137 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_CECC   0x01

Definition at line 131 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_CFE   0x80

Definition at line 170 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_CIR   0x80

Definition at line 138 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_CMD_MASK   (VIA_CRDR_SDSTS_CRD | VIA_CRDR_SDSTS_CRTO | VIA_CRDR_SDSTS_SC)

Definition at line 160 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_CRD   0x200

Definition at line 140 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_CRTO   0x400

Definition at line 141 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_DATA_MASK
#define VIA_CRDR_SDSTS_DT   0x1000

Definition at line 143 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_IGN_MASK   (VIA_CRDR_SDSTS_BDD | VIA_CRDR_SDSTS_ASCRDIE | VIA_CRDR_SDSTS_IO)

Definition at line 148 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_INT_MASK
#define VIA_CRDR_SDSTS_IO   0x100

Definition at line 139 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_MBD   0x10

Definition at line 135 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_RC   0x4000

Definition at line 145 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_SC   0x2000

Definition at line 144 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_SLOTD   0x04

Definition at line 133 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_SLOTG   0x08

Definition at line 134 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_W1C_MASK
#define VIA_CRDR_SDSTS_WC   0x8000

Definition at line 146 of file via-sdmmc.c.

#define VIA_CRDR_SDSTS_WP   0x02

Definition at line 132 of file via-sdmmc.c.

#define via_sd_resume   NULL

Definition at line 1327 of file via-sdmmc.c.

#define via_sd_suspend   NULL

Definition at line 1326 of file via-sdmmc.c.

#define VIS_CRDR_SDEXTCTRL_AUTOSTOP_SD   0x01

Definition at line 177 of file via-sdmmc.c.

#define VIS_CRDR_SDEXTCTRL_AUTOSTOP_SPI   0x40

Definition at line 183 of file via-sdmmc.c.

#define VIS_CRDR_SDEXTCTRL_BAD_CMDA   0x10

Definition at line 181 of file via-sdmmc.c.

#define VIS_CRDR_SDEXTCTRL_BAD_DATA   0x20

Definition at line 182 of file via-sdmmc.c.

#define VIS_CRDR_SDEXTCTRL_MMC_8BIT   0x04

Definition at line 179 of file via-sdmmc.c.

#define VIS_CRDR_SDEXTCTRL_RELD_BLK   0x08

Definition at line 180 of file via-sdmmc.c.

#define VIS_CRDR_SDEXTCTRL_SHIFT_9   0x02

Definition at line 178 of file via-sdmmc.c.

Enumeration Type Documentation

Enumerator:
PCI_CLK_375K 
PCI_CLK_8M 
PCI_CLK_12M 
PCI_CLK_16M 
PCI_CLK_24M 
PCI_CLK_33M 
PCI_CLK_48M 

Definition at line 260 of file via-sdmmc.c.

Function Documentation

MODULE_AUTHOR ( "VIA Technologies Inc."  )
MODULE_DESCRIPTION ( "VIA SD/MMC Card Interface driver )
MODULE_DEVICE_TABLE ( pci  ,
via_ids   
)
MODULE_LICENSE ( "GPL"  )
module_pci_driver ( via_sd_driver  )