Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
jz4740_mmc.c File Reference
#include <linux/mmc/host.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/scatterlist.h>
#include <linux/clk.h>
#include <linux/bitops.h>
#include <linux/gpio.h>
#include <asm/mach-jz4740/gpio.h>
#include <asm/cacheflush.h>
#include <linux/dma-mapping.h>
#include <asm/mach-jz4740/jz4740_mmc.h>

Go to the source code of this file.

Data Structures

struct  jz4740_mmc_host
 

Macros

#define JZ_REG_MMC_STRPCL   0x00
 
#define JZ_REG_MMC_STATUS   0x04
 
#define JZ_REG_MMC_CLKRT   0x08
 
#define JZ_REG_MMC_CMDAT   0x0C
 
#define JZ_REG_MMC_RESTO   0x10
 
#define JZ_REG_MMC_RDTO   0x14
 
#define JZ_REG_MMC_BLKLEN   0x18
 
#define JZ_REG_MMC_NOB   0x1C
 
#define JZ_REG_MMC_SNOB   0x20
 
#define JZ_REG_MMC_IMASK   0x24
 
#define JZ_REG_MMC_IREG   0x28
 
#define JZ_REG_MMC_CMD   0x2C
 
#define JZ_REG_MMC_ARG   0x30
 
#define JZ_REG_MMC_RESP_FIFO   0x34
 
#define JZ_REG_MMC_RXFIFO   0x38
 
#define JZ_REG_MMC_TXFIFO   0x3C
 
#define JZ_MMC_STRPCL_EXIT_MULTIPLE   BIT(7)
 
#define JZ_MMC_STRPCL_EXIT_TRANSFER   BIT(6)
 
#define JZ_MMC_STRPCL_START_READWAIT   BIT(5)
 
#define JZ_MMC_STRPCL_STOP_READWAIT   BIT(4)
 
#define JZ_MMC_STRPCL_RESET   BIT(3)
 
#define JZ_MMC_STRPCL_START_OP   BIT(2)
 
#define JZ_MMC_STRPCL_CLOCK_CONTROL   (BIT(1) | BIT(0))
 
#define JZ_MMC_STRPCL_CLOCK_STOP   BIT(0)
 
#define JZ_MMC_STRPCL_CLOCK_START   BIT(1)
 
#define JZ_MMC_STATUS_IS_RESETTING   BIT(15)
 
#define JZ_MMC_STATUS_SDIO_INT_ACTIVE   BIT(14)
 
#define JZ_MMC_STATUS_PRG_DONE   BIT(13)
 
#define JZ_MMC_STATUS_DATA_TRAN_DONE   BIT(12)
 
#define JZ_MMC_STATUS_END_CMD_RES   BIT(11)
 
#define JZ_MMC_STATUS_DATA_FIFO_AFULL   BIT(10)
 
#define JZ_MMC_STATUS_IS_READWAIT   BIT(9)
 
#define JZ_MMC_STATUS_CLK_EN   BIT(8)
 
#define JZ_MMC_STATUS_DATA_FIFO_FULL   BIT(7)
 
#define JZ_MMC_STATUS_DATA_FIFO_EMPTY   BIT(6)
 
#define JZ_MMC_STATUS_CRC_RES_ERR   BIT(5)
 
#define JZ_MMC_STATUS_CRC_READ_ERROR   BIT(4)
 
#define JZ_MMC_STATUS_TIMEOUT_WRITE   BIT(3)
 
#define JZ_MMC_STATUS_CRC_WRITE_ERROR   BIT(2)
 
#define JZ_MMC_STATUS_TIMEOUT_RES   BIT(1)
 
#define JZ_MMC_STATUS_TIMEOUT_READ   BIT(0)
 
#define JZ_MMC_STATUS_READ_ERROR_MASK   (BIT(4) | BIT(0))
 
#define JZ_MMC_STATUS_WRITE_ERROR_MASK   (BIT(3) | BIT(2))
 
#define JZ_MMC_CMDAT_IO_ABORT   BIT(11)
 
#define JZ_MMC_CMDAT_BUS_WIDTH_4BIT   BIT(10)
 
#define JZ_MMC_CMDAT_DMA_EN   BIT(8)
 
#define JZ_MMC_CMDAT_INIT   BIT(7)
 
#define JZ_MMC_CMDAT_BUSY   BIT(6)
 
#define JZ_MMC_CMDAT_STREAM   BIT(5)
 
#define JZ_MMC_CMDAT_WRITE   BIT(4)
 
#define JZ_MMC_CMDAT_DATA_EN   BIT(3)
 
#define JZ_MMC_CMDAT_RESPONSE_FORMAT   (BIT(2) | BIT(1) | BIT(0))
 
#define JZ_MMC_CMDAT_RSP_R1   1
 
#define JZ_MMC_CMDAT_RSP_R2   2
 
#define JZ_MMC_CMDAT_RSP_R3   3
 
#define JZ_MMC_IRQ_SDIO   BIT(7)
 
#define JZ_MMC_IRQ_TXFIFO_WR_REQ   BIT(6)
 
#define JZ_MMC_IRQ_RXFIFO_RD_REQ   BIT(5)
 
#define JZ_MMC_IRQ_END_CMD_RES   BIT(2)
 
#define JZ_MMC_IRQ_PRG_DONE   BIT(1)
 
#define JZ_MMC_IRQ_DATA_TRAN_DONE   BIT(0)
 
#define JZ_MMC_CLK_RATE   24000000
 
#define JZ4740_MMC_PM_OPS   NULL
 

Enumerations

enum  jz4740_mmc_state { JZ4740_MMC_STATE_READ_RESPONSE, JZ4740_MMC_STATE_TRANSFER_DATA, JZ4740_MMC_STATE_SEND_STOP, JZ4740_MMC_STATE_DONE }
 

Functions

 module_platform_driver (jz4740_mmc_driver)
 
 MODULE_DESCRIPTION ("JZ4740 SD/MMC controller driver")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_AUTHOR ("Lars-Peter Clausen <[email protected]>")
 

Macro Definition Documentation

#define JZ4740_MMC_PM_OPS   NULL

Definition at line 1002 of file jz4740_mmc.c.

#define JZ_MMC_CLK_RATE   24000000

Definition at line 105 of file jz4740_mmc.c.

#define JZ_MMC_CMDAT_BUS_WIDTH_4BIT   BIT(10)

Definition at line 85 of file jz4740_mmc.c.

#define JZ_MMC_CMDAT_BUSY   BIT(6)

Definition at line 88 of file jz4740_mmc.c.

#define JZ_MMC_CMDAT_DATA_EN   BIT(3)

Definition at line 91 of file jz4740_mmc.c.

#define JZ_MMC_CMDAT_DMA_EN   BIT(8)

Definition at line 86 of file jz4740_mmc.c.

#define JZ_MMC_CMDAT_INIT   BIT(7)

Definition at line 87 of file jz4740_mmc.c.

#define JZ_MMC_CMDAT_IO_ABORT   BIT(11)

Definition at line 84 of file jz4740_mmc.c.

#define JZ_MMC_CMDAT_RESPONSE_FORMAT   (BIT(2) | BIT(1) | BIT(0))

Definition at line 92 of file jz4740_mmc.c.

#define JZ_MMC_CMDAT_RSP_R1   1

Definition at line 93 of file jz4740_mmc.c.

#define JZ_MMC_CMDAT_RSP_R2   2

Definition at line 94 of file jz4740_mmc.c.

#define JZ_MMC_CMDAT_RSP_R3   3

Definition at line 95 of file jz4740_mmc.c.

#define JZ_MMC_CMDAT_STREAM   BIT(5)

Definition at line 89 of file jz4740_mmc.c.

#define JZ_MMC_CMDAT_WRITE   BIT(4)

Definition at line 90 of file jz4740_mmc.c.

#define JZ_MMC_IRQ_DATA_TRAN_DONE   BIT(0)

Definition at line 102 of file jz4740_mmc.c.

#define JZ_MMC_IRQ_END_CMD_RES   BIT(2)

Definition at line 100 of file jz4740_mmc.c.

#define JZ_MMC_IRQ_PRG_DONE   BIT(1)

Definition at line 101 of file jz4740_mmc.c.

#define JZ_MMC_IRQ_RXFIFO_RD_REQ   BIT(5)

Definition at line 99 of file jz4740_mmc.c.

#define JZ_MMC_IRQ_SDIO   BIT(7)

Definition at line 97 of file jz4740_mmc.c.

#define JZ_MMC_IRQ_TXFIFO_WR_REQ   BIT(6)

Definition at line 98 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_CLK_EN   BIT(8)

Definition at line 70 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_CRC_READ_ERROR   BIT(4)

Definition at line 74 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_CRC_RES_ERR   BIT(5)

Definition at line 73 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_CRC_WRITE_ERROR   BIT(2)

Definition at line 76 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_DATA_FIFO_AFULL   BIT(10)

Definition at line 68 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_DATA_FIFO_EMPTY   BIT(6)

Definition at line 72 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_DATA_FIFO_FULL   BIT(7)

Definition at line 71 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_DATA_TRAN_DONE   BIT(12)

Definition at line 66 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_END_CMD_RES   BIT(11)

Definition at line 67 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_IS_READWAIT   BIT(9)

Definition at line 69 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_IS_RESETTING   BIT(15)

Definition at line 63 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_PRG_DONE   BIT(13)

Definition at line 65 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_READ_ERROR_MASK   (BIT(4) | BIT(0))

Definition at line 80 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_SDIO_INT_ACTIVE   BIT(14)

Definition at line 64 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_TIMEOUT_READ   BIT(0)

Definition at line 78 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_TIMEOUT_RES   BIT(1)

Definition at line 77 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_TIMEOUT_WRITE   BIT(3)

Definition at line 75 of file jz4740_mmc.c.

#define JZ_MMC_STATUS_WRITE_ERROR_MASK   (BIT(3) | BIT(2))

Definition at line 81 of file jz4740_mmc.c.

#define JZ_MMC_STRPCL_CLOCK_CONTROL   (BIT(1) | BIT(0))

Definition at line 58 of file jz4740_mmc.c.

#define JZ_MMC_STRPCL_CLOCK_START   BIT(1)

Definition at line 60 of file jz4740_mmc.c.

#define JZ_MMC_STRPCL_CLOCK_STOP   BIT(0)

Definition at line 59 of file jz4740_mmc.c.

#define JZ_MMC_STRPCL_EXIT_MULTIPLE   BIT(7)

Definition at line 52 of file jz4740_mmc.c.

#define JZ_MMC_STRPCL_EXIT_TRANSFER   BIT(6)

Definition at line 53 of file jz4740_mmc.c.

#define JZ_MMC_STRPCL_RESET   BIT(3)

Definition at line 56 of file jz4740_mmc.c.

#define JZ_MMC_STRPCL_START_OP   BIT(2)

Definition at line 57 of file jz4740_mmc.c.

#define JZ_MMC_STRPCL_START_READWAIT   BIT(5)

Definition at line 54 of file jz4740_mmc.c.

#define JZ_MMC_STRPCL_STOP_READWAIT   BIT(4)

Definition at line 55 of file jz4740_mmc.c.

#define JZ_REG_MMC_ARG   0x30

Definition at line 47 of file jz4740_mmc.c.

#define JZ_REG_MMC_BLKLEN   0x18

Definition at line 41 of file jz4740_mmc.c.

#define JZ_REG_MMC_CLKRT   0x08

Definition at line 37 of file jz4740_mmc.c.

#define JZ_REG_MMC_CMD   0x2C

Definition at line 46 of file jz4740_mmc.c.

#define JZ_REG_MMC_CMDAT   0x0C

Definition at line 38 of file jz4740_mmc.c.

#define JZ_REG_MMC_IMASK   0x24

Definition at line 44 of file jz4740_mmc.c.

#define JZ_REG_MMC_IREG   0x28

Definition at line 45 of file jz4740_mmc.c.

#define JZ_REG_MMC_NOB   0x1C

Definition at line 42 of file jz4740_mmc.c.

#define JZ_REG_MMC_RDTO   0x14

Definition at line 40 of file jz4740_mmc.c.

#define JZ_REG_MMC_RESP_FIFO   0x34

Definition at line 48 of file jz4740_mmc.c.

#define JZ_REG_MMC_RESTO   0x10

Definition at line 39 of file jz4740_mmc.c.

#define JZ_REG_MMC_RXFIFO   0x38

Definition at line 49 of file jz4740_mmc.c.

#define JZ_REG_MMC_SNOB   0x20

Definition at line 43 of file jz4740_mmc.c.

#define JZ_REG_MMC_STATUS   0x04

Definition at line 36 of file jz4740_mmc.c.

#define JZ_REG_MMC_STRPCL   0x00

Definition at line 35 of file jz4740_mmc.c.

#define JZ_REG_MMC_TXFIFO   0x3C

Definition at line 50 of file jz4740_mmc.c.

Enumeration Type Documentation

Enumerator:
JZ4740_MMC_STATE_READ_RESPONSE 
JZ4740_MMC_STATE_TRANSFER_DATA 
JZ4740_MMC_STATE_SEND_STOP 
JZ4740_MMC_STATE_DONE 

Definition at line 107 of file jz4740_mmc.c.

Function Documentation

MODULE_AUTHOR ( "Lars-Peter Clausen <[email protected]>"  )
MODULE_DESCRIPTION ( "JZ4740 SD/MMC controller driver )
MODULE_LICENSE ( "GPL"  )
module_platform_driver ( jz4740_mmc_driver  )