0001
0002
0003
0004
0005
0006
0007 #ifndef LINUX_CB710_MMC_H
0008 #define LINUX_CB710_MMC_H
0009
0010 #include <linux/cb710.h>
0011
0012
0013 struct cb710_mmc_reader {
0014 struct tasklet_struct finish_req_tasklet;
0015 struct mmc_request *mrq;
0016 spinlock_t irq_lock;
0017 unsigned char last_power_mode;
0018 };
0019
0020
0021
0022 static inline struct mmc_host *cb710_slot_to_mmc(struct cb710_slot *slot)
0023 {
0024 return platform_get_drvdata(&slot->pdev);
0025 }
0026
0027 static inline struct cb710_slot *cb710_mmc_to_slot(struct mmc_host *mmc)
0028 {
0029 struct platform_device *pdev = to_platform_device(mmc_dev(mmc));
0030 return cb710_pdev_to_slot(pdev);
0031 }
0032
0033
0034
0035 #define CB710_MMC_DATA_PORT 0x00
0036
0037 #define CB710_MMC_CONFIG_PORT 0x04
0038 #define CB710_MMC_CONFIG0_PORT 0x04
0039 #define CB710_MMC_CONFIG1_PORT 0x05
0040 #define CB710_MMC_C1_4BIT_DATA_BUS 0x40
0041 #define CB710_MMC_CONFIG2_PORT 0x06
0042 #define CB710_MMC_C2_READ_PIO_SIZE_MASK 0x0F
0043 #define CB710_MMC_CONFIG3_PORT 0x07
0044
0045 #define CB710_MMC_CONFIGB_PORT 0x08
0046
0047 #define CB710_MMC_IRQ_ENABLE_PORT 0x0C
0048 #define CB710_MMC_IE_TEST_MASK 0x00BF
0049 #define CB710_MMC_IE_CARD_INSERTION_STATUS 0x1000
0050 #define CB710_MMC_IE_IRQ_ENABLE 0x8000
0051 #define CB710_MMC_IE_CISTATUS_MASK \
0052 (CB710_MMC_IE_CARD_INSERTION_STATUS|CB710_MMC_IE_IRQ_ENABLE)
0053
0054 #define CB710_MMC_STATUS_PORT 0x10
0055 #define CB710_MMC_STATUS_ERROR_EVENTS 0x60FF
0056 #define CB710_MMC_STATUS0_PORT 0x10
0057 #define CB710_MMC_S0_FIFO_UNDERFLOW 0x40
0058 #define CB710_MMC_STATUS1_PORT 0x11
0059 #define CB710_MMC_S1_COMMAND_SENT 0x01
0060 #define CB710_MMC_S1_DATA_TRANSFER_DONE 0x02
0061 #define CB710_MMC_S1_PIO_TRANSFER_DONE 0x04
0062 #define CB710_MMC_S1_CARD_CHANGED 0x10
0063 #define CB710_MMC_S1_RESET 0x20
0064 #define CB710_MMC_STATUS2_PORT 0x12
0065 #define CB710_MMC_S2_FIFO_READY 0x01
0066 #define CB710_MMC_S2_FIFO_EMPTY 0x02
0067 #define CB710_MMC_S2_BUSY_10 0x10
0068 #define CB710_MMC_S2_BUSY_20 0x20
0069 #define CB710_MMC_STATUS3_PORT 0x13
0070 #define CB710_MMC_S3_CARD_DETECTED 0x02
0071 #define CB710_MMC_S3_WRITE_PROTECTED 0x04
0072
0073 #define CB710_MMC_CMD_TYPE_PORT 0x14
0074 #define CB710_MMC_RSP_TYPE_MASK 0x0007
0075 #define CB710_MMC_RSP_R1 (0)
0076 #define CB710_MMC_RSP_136 (5)
0077 #define CB710_MMC_RSP_NO_CRC (2)
0078 #define CB710_MMC_RSP_PRESENT_MASK 0x0018
0079 #define CB710_MMC_RSP_NONE (0 << 3)
0080 #define CB710_MMC_RSP_PRESENT (1 << 3)
0081 #define CB710_MMC_RSP_PRESENT_X (2 << 3)
0082 #define CB710_MMC_CMD_TYPE_MASK 0x0060
0083 #define CB710_MMC_CMD_BC (0 << 5)
0084 #define CB710_MMC_CMD_BCR (1 << 5)
0085 #define CB710_MMC_CMD_AC (2 << 5)
0086 #define CB710_MMC_CMD_ADTC (3 << 5)
0087 #define CB710_MMC_DATA_READ 0x0080
0088 #define CB710_MMC_CMD_CODE_MASK 0x3F00
0089 #define CB710_MMC_CMD_CODE_SHIFT 8
0090 #define CB710_MMC_IS_APP_CMD 0x4000
0091 #define CB710_MMC_RSP_BUSY 0x8000
0092
0093 #define CB710_MMC_CMD_PARAM_PORT 0x18
0094 #define CB710_MMC_TRANSFER_SIZE_PORT 0x1C
0095 #define CB710_MMC_RESPONSE0_PORT 0x20
0096 #define CB710_MMC_RESPONSE1_PORT 0x24
0097 #define CB710_MMC_RESPONSE2_PORT 0x28
0098 #define CB710_MMC_RESPONSE3_PORT 0x2C
0099
0100 #endif