Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
rtsx_chip.h File Reference
#include "rtsx.h"

Go to the source code of this file.

Data Structures

struct  sense_data_t
 
struct  zone_entry
 
struct  sd_info
 
struct  xd_delay_write_tag
 
struct  xd_info
 
struct  ms_delay_write_tag
 
struct  ms_info
 
struct  spi_info
 
struct  trace_msg_t
 
struct  rtsx_chip
 

Macros

#define SUPPORT_CPRM
 
#define SUPPORT_OCP
 
#define SUPPORT_SDIO_ASPM
 
#define SUPPORT_MAGIC_GATE
 
#define SUPPORT_MSXC
 
#define SUPPORT_SD_LOCK
 
#define HW_AUTO_SWITCH_SD_BUS
 
#define HW_INT_WRITE_CLR
 
#define MG_SET_ICV_SLOW
 
#define MS_SAMPLE_INT_ERR
 
#define READ_BYTES_WAIT_INT
 
#define XC_POWERCLASS
 
#define SUPPORT_PCGL_1P18
 
#define REGULAR_BLINK
 
#define LED_BLINK_SPEED   5
 
#define LED_TOGGLE_INTERVAL   6
 
#define GPIO_TOGGLE_THRESHOLD   1024
 
#define LED_GPIO   0
 
#define POLLING_INTERVAL   30
 
#define TRACE_ITEM_CNT   64
 
#define STATUS_SUCCESS   0
 
#define STATUS_FAIL   1
 
#define STATUS_TIMEDOUT   2
 
#define STATUS_NOMEM   3
 
#define STATUS_READ_FAIL   4
 
#define STATUS_WRITE_FAIL   5
 
#define STATUS_ERROR   10
 
#define PM_S1   1
 
#define PM_S3   3
 
#define TRANSPORT_GOOD   0 /* Transport good, command good */
 
#define TRANSPORT_FAILED   1 /* Transport good, command failed */
 
#define TRANSPORT_NO_SENSE   2 /* Command failed, no auto-sense */
 
#define TRANSPORT_ERROR   3 /* Transport bad (i.e. device dead) */
 
#define STOP_MEDIUM   0x00 /* access disable */
 
#define MAKE_MEDIUM_READY   0x01 /* access enable */
 
#define UNLOAD_MEDIUM   0x02 /* unload */
 
#define LOAD_MEDIUM   0x03 /* load */
 
#define QULIFIRE   0x00
 
#define AENC_FNC   0x00
 
#define TRML_IOP   0x00
 
#define REL_ADR   0x00
 
#define WBUS_32   0x00
 
#define WBUS_16   0x00
 
#define SYNC   0x00
 
#define LINKED   0x00
 
#define CMD_QUE   0x00
 
#define SFT_RE   0x00
 
#define VEN_ID_LEN   8 /* Vendor ID Length */
 
#define PRDCT_ID_LEN   16 /* Product ID Length */
 
#define PRDCT_REV_LEN   4 /* Product LOT Length */
 
#define RTSX_FLIDX_TRANS_ACTIVE   18 /* 0x00040000 transfer is active */
 
#define RTSX_FLIDX_ABORTING   20 /* 0x00100000 abort is in progress */
 
#define RTSX_FLIDX_DISCONNECTING   21 /* 0x00200000 disconnect in progress */
 
#define ABORTING_OR_DISCONNECTING
 
#define RTSX_FLIDX_RESETTING   22 /* 0x00400000 device reset in progress */
 
#define RTSX_FLIDX_TIMED_OUT   23 /* 0x00800000 SCSI midlayer timed out */
 
#define DRCT_ACCESS_DEV   0x00 /* Direct Access Device */
 
#define RMB_DISC   0x80 /* The Device is Removable */
 
#define ANSI_SCSI2   0x02 /* Based on ANSI-SCSI2 */
 
#define SCSI   0x00 /* Interface ID */
 
#define WRITE_PROTECTED_MEDIA   0x07
 
#define ILI   0x20 /* ILI bit is on */
 
#define NO_SENSE   0x00 /* not exist sense key */
 
#define RECOVER_ERR   0x01 /* Target/Logical unit is recoverd */
 
#define NOT_READY   0x02 /* Logical unit is not ready */
 
#define MEDIA_ERR   0x03 /* medium/data error */
 
#define HARDWARE_ERR   0x04 /* hardware error */
 
#define ILGAL_REQ   0x05 /* CDB/parameter/identify msg error */
 
#define UNIT_ATTENTION   0x06 /* unit attention condition occur */
 
#define DAT_PRTCT   0x07 /* read/write is desable */
 
#define BLNC_CHK   0x08 /* find blank/DOF in read */
 
#define CPY_ABRT   0x0a /* Copy/Compare/Copy&Verify illgal */
 
#define ABRT_CMD   0x0b /* Target make the command in error */
 
#define EQUAL   0x0c /* Search Data end with Equal */
 
#define VLM_OVRFLW   0x0d /* Some data are left in buffer */
 
#define MISCMP   0x0e /* find inequality */
 
#define READ_ERR   -1
 
#define WRITE_ERR   -2
 
#define FIRST_RESET   0x01
 
#define USED_EXIST   0x02
 
#define SENSE_VALID   0x80 /* Sense data is valid as SCSI2 */
 
#define SENSE_INVALID   0x00 /* Sense data is invalid as SCSI2 */
 
#define CUR_ERR   0x70 /* current error */
 
#define DEF_ERR   0x71 /* specific command error */
 
#define SNSKEYINFO_LEN   3 /* length of sense key information */
 
#define SKSV   0x80
 
#define CDB_ILLEGAL   0x40
 
#define DAT_ILLEGAL   0x00
 
#define BPV   0x08
 
#define BIT_ILLEGAL0   0 /* bit0 is illegal */
 
#define BIT_ILLEGAL1   1 /* bit1 is illegal */
 
#define BIT_ILLEGAL2   2 /* bit2 is illegal */
 
#define BIT_ILLEGAL3   3 /* bit3 is illegal */
 
#define BIT_ILLEGAL4   4 /* bit4 is illegal */
 
#define BIT_ILLEGAL5   5 /* bit5 is illegal */
 
#define BIT_ILLEGAL6   6 /* bit6 is illegal */
 
#define BIT_ILLEGAL7   7 /* bit7 is illegal */
 
#define ASC_NO_INFO   0x00
 
#define ASC_MISCMP   0x1d
 
#define ASC_INVLD_CDB   0x24
 
#define ASC_INVLD_PARA   0x26
 
#define ASC_LU_NOT_READY   0x04
 
#define ASC_WRITE_ERR   0x0c
 
#define ASC_READ_ERR   0x11
 
#define ASC_LOAD_EJCT_ERR   0x53
 
#define ASC_MEDIA_NOT_PRESENT   0x3A
 
#define ASC_MEDIA_CHANGED   0x28
 
#define ASC_MEDIA_IN_PROCESS   0x04
 
#define ASC_WRITE_PROTECT   0x27
 
#define ASC_LUN_NOT_SUPPORTED   0x25
 
#define ASCQ_NO_INFO   0x00
 
#define ASCQ_MEDIA_IN_PROCESS   0x01
 
#define ASCQ_MISCMP   0x00
 
#define ASCQ_INVLD_CDB   0x00
 
#define ASCQ_INVLD_PARA   0x02
 
#define ASCQ_LU_NOT_READY   0x02
 
#define ASCQ_WRITE_ERR   0x02
 
#define ASCQ_READ_ERR   0x00
 
#define ASCQ_LOAD_EJCT_ERR   0x00
 
#define ASCQ_WRITE_PROTECT   0x00
 
#define RTSX_HCBAR   0x00
 
#define RTSX_HCBCTLR   0x04
 
#define RTSX_HDBAR   0x08
 
#define RTSX_HDBCTLR   0x0C
 
#define RTSX_HAIMR   0x10
 
#define RTSX_BIPR   0x14
 
#define RTSX_BIER   0x18
 
#define STOP_CMD   (0x01 << 28)
 
#define SDMA_MODE   0x00
 
#define ADMA_MODE   (0x02 << 26)
 
#define STOP_DMA   (0x01 << 28)
 
#define TRIG_DMA   (0x01 << 31)
 
#define CMD_DONE_INT   (1 << 31)
 
#define DATA_DONE_INT   (1 << 30)
 
#define TRANS_OK_INT   (1 << 29)
 
#define TRANS_FAIL_INT   (1 << 28)
 
#define XD_INT   (1 << 27)
 
#define MS_INT   (1 << 26)
 
#define SD_INT   (1 << 25)
 
#define GPIO0_INT   (1 << 24)
 
#define OC_INT   (1 << 23)
 
#define SD_WRITE_PROTECT   (1 << 19)
 
#define XD_EXIST   (1 << 18)
 
#define MS_EXIST   (1 << 17)
 
#define SD_EXIST   (1 << 16)
 
#define DELINK_INT   GPIO0_INT
 
#define MS_OC_INT   (1 << 23)
 
#define SD_OC_INT   (1 << 22)
 
#define CARD_INT   (XD_INT | MS_INT | SD_INT)
 
#define NEED_COMPLETE_INT   (DATA_DONE_INT | TRANS_OK_INT | TRANS_FAIL_INT)
 
#define RTSX_INT   (CMD_DONE_INT | NEED_COMPLETE_INT | CARD_INT | GPIO0_INT | OC_INT)
 
#define CARD_EXIST   (XD_EXIST | MS_EXIST | SD_EXIST)
 
#define CMD_DONE_INT_EN   (1 << 31)
 
#define DATA_DONE_INT_EN   (1 << 30)
 
#define TRANS_OK_INT_EN   (1 << 29)
 
#define TRANS_FAIL_INT_EN   (1 << 28)
 
#define XD_INT_EN   (1 << 27)
 
#define MS_INT_EN   (1 << 26)
 
#define SD_INT_EN   (1 << 25)
 
#define GPIO0_INT_EN   (1 << 24)
 
#define OC_INT_EN   (1 << 23)
 
#define DELINK_INT_EN   GPIO0_INT_EN
 
#define MS_OC_INT_EN   (1 << 23)
 
#define SD_OC_INT_EN   (1 << 22)
 
#define READ_REG_CMD   0
 
#define WRITE_REG_CMD   1
 
#define CHECK_REG_CMD   2
 
#define HOST_TO_DEVICE   0
 
#define DEVICE_TO_HOST   1
 
#define RTSX_RESV_BUF_LEN   4096
 
#define HOST_CMDS_BUF_LEN   1024
 
#define HOST_SG_TBL_BUF_LEN   (RTSX_RESV_BUF_LEN - HOST_CMDS_BUF_LEN)
 
#define SD_NR   2
 
#define MS_NR   3
 
#define XD_NR   4
 
#define SPI_NR   7
 
#define SD_CARD   (1 << SD_NR)
 
#define MS_CARD   (1 << MS_NR)
 
#define XD_CARD   (1 << XD_NR)
 
#define SPI_CARD   (1 << SPI_NR)
 
#define MAX_ALLOWED_LUN_CNT   8
 
#define XD_FREE_TABLE_CNT   1200
 
#define MS_FREE_TABLE_CNT   512
 
#define SET_BIT(data, idx)   ((data) |= 1 << (idx))
 
#define CLR_BIT(data, idx)   ((data) &= ~(1 << (idx)))
 
#define CHK_BIT(data, idx)   ((data) & (1 << (idx)))
 
#define SG_INT   0x04
 
#define SG_END   0x02
 
#define SG_VALID   0x01
 
#define SG_NO_OP   0x00
 
#define SG_TRANS_DATA   (0x02 << 4)
 
#define SG_LINK_DESC   (0x03 << 4)
 
#define MAX_RESET_CNT   3
 
#define MAX_DEFECTIVE_BLOCK   10
 
#define TYPE_SD   0x0000
 
#define TYPE_MMC   0x0001
 
#define SD_HS   0x0100
 
#define SD_SDR50   0x0200
 
#define SD_DDR50   0x0400
 
#define SD_SDR104   0x0800
 
#define SD_HCXC   0x1000
 
#define MMC_26M   0x0100
 
#define MMC_52M   0x0200
 
#define MMC_4BIT   0x0400
 
#define MMC_8BIT   0x0800
 
#define MMC_SECTOR_MODE   0x1000
 
#define MMC_DDR52   0x2000
 
#define CHK_SD(sd_card)   (((sd_card)->sd_type & 0xFF) == TYPE_SD)
 
#define CHK_SD_HS(sd_card)   (CHK_SD(sd_card) && ((sd_card)->sd_type & SD_HS))
 
#define CHK_SD_SDR50(sd_card)   (CHK_SD(sd_card) && ((sd_card)->sd_type & SD_SDR50))
 
#define CHK_SD_DDR50(sd_card)   (CHK_SD(sd_card) && ((sd_card)->sd_type & SD_DDR50))
 
#define CHK_SD_SDR104(sd_card)   (CHK_SD(sd_card) && ((sd_card)->sd_type & SD_SDR104))
 
#define CHK_SD_HCXC(sd_card)   (CHK_SD(sd_card) && ((sd_card)->sd_type & SD_HCXC))
 
#define CHK_SD_HC(sd_card)   (CHK_SD_HCXC(sd_card) && ((sd_card)->capacity <= 0x4000000))
 
#define CHK_SD_XC(sd_card)   (CHK_SD_HCXC(sd_card) && ((sd_card)->capacity > 0x4000000))
 
#define CHK_SD30_SPEED(sd_card)   (CHK_SD_SDR50(sd_card) || CHK_SD_DDR50(sd_card) || CHK_SD_SDR104(sd_card))
 
#define SET_SD(sd_card)   ((sd_card)->sd_type = TYPE_SD)
 
#define SET_SD_HS(sd_card)   ((sd_card)->sd_type |= SD_HS)
 
#define SET_SD_SDR50(sd_card)   ((sd_card)->sd_type |= SD_SDR50)
 
#define SET_SD_DDR50(sd_card)   ((sd_card)->sd_type |= SD_DDR50)
 
#define SET_SD_SDR104(sd_card)   ((sd_card)->sd_type |= SD_SDR104)
 
#define SET_SD_HCXC(sd_card)   ((sd_card)->sd_type |= SD_HCXC)
 
#define CLR_SD_HS(sd_card)   ((sd_card)->sd_type &= ~SD_HS)
 
#define CLR_SD_SDR50(sd_card)   ((sd_card)->sd_type &= ~SD_SDR50)
 
#define CLR_SD_DDR50(sd_card)   ((sd_card)->sd_type &= ~SD_DDR50)
 
#define CLR_SD_SDR104(sd_card)   ((sd_card)->sd_type &= ~SD_SDR104)
 
#define CLR_SD_HCXC(sd_card)   ((sd_card)->sd_type &= ~SD_HCXC)
 
#define CHK_MMC(sd_card)   (((sd_card)->sd_type & 0xFF) == TYPE_MMC)
 
#define CHK_MMC_26M(sd_card)   (CHK_MMC(sd_card) && ((sd_card)->sd_type & MMC_26M))
 
#define CHK_MMC_52M(sd_card)   (CHK_MMC(sd_card) && ((sd_card)->sd_type & MMC_52M))
 
#define CHK_MMC_4BIT(sd_card)   (CHK_MMC(sd_card) && ((sd_card)->sd_type & MMC_4BIT))
 
#define CHK_MMC_8BIT(sd_card)   (CHK_MMC(sd_card) && ((sd_card)->sd_type & MMC_8BIT))
 
#define CHK_MMC_SECTOR_MODE(sd_card)   (CHK_MMC(sd_card) && ((sd_card)->sd_type & MMC_SECTOR_MODE))
 
#define CHK_MMC_DDR52(sd_card)   (CHK_MMC(sd_card) && ((sd_card)->sd_type & MMC_DDR52))
 
#define SET_MMC(sd_card)   ((sd_card)->sd_type = TYPE_MMC)
 
#define SET_MMC_26M(sd_card)   ((sd_card)->sd_type |= MMC_26M)
 
#define SET_MMC_52M(sd_card)   ((sd_card)->sd_type |= MMC_52M)
 
#define SET_MMC_4BIT(sd_card)   ((sd_card)->sd_type |= MMC_4BIT)
 
#define SET_MMC_8BIT(sd_card)   ((sd_card)->sd_type |= MMC_8BIT)
 
#define SET_MMC_SECTOR_MODE(sd_card)   ((sd_card)->sd_type |= MMC_SECTOR_MODE)
 
#define SET_MMC_DDR52(sd_card)   ((sd_card)->sd_type |= MMC_DDR52)
 
#define CLR_MMC_26M(sd_card)   ((sd_card)->sd_type &= ~MMC_26M)
 
#define CLR_MMC_52M(sd_card)   ((sd_card)->sd_type &= ~MMC_52M)
 
#define CLR_MMC_4BIT(sd_card)   ((sd_card)->sd_type &= ~MMC_4BIT)
 
#define CLR_MMC_8BIT(sd_card)   ((sd_card)->sd_type &= ~MMC_8BIT)
 
#define CLR_MMC_SECTOR_MODE(sd_card)   ((sd_card)->sd_type &= ~MMC_SECTOR_MODE)
 
#define CLR_MMC_DDR52(sd_card)   ((sd_card)->sd_type &= ~MMC_DDR52)
 
#define CHK_MMC_HS(sd_card)   (CHK_MMC_52M(sd_card) && CHK_MMC_26M(sd_card))
 
#define CLR_MMC_HS(sd_card)
 
#define SD_SUPPORT_CLASS_TEN   0x01
 
#define SD_SUPPORT_1V8   0x02
 
#define SD_SET_CLASS_TEN(sd_card)   ((sd_card)->sd_setting |= SD_SUPPORT_CLASS_TEN)
 
#define SD_CHK_CLASS_TEN(sd_card)   ((sd_card)->sd_setting & SD_SUPPORT_CLASS_TEN)
 
#define SD_CLR_CLASS_TEN(sd_card)   ((sd_card)->sd_setting &= ~SD_SUPPORT_CLASS_TEN)
 
#define SD_SET_1V8(sd_card)   ((sd_card)->sd_setting |= SD_SUPPORT_1V8)
 
#define SD_CHK_1V8(sd_card)   ((sd_card)->sd_setting & SD_SUPPORT_1V8)
 
#define SD_CLR_1V8(sd_card)   ((sd_card)->sd_setting &= ~SD_SUPPORT_1V8)
 
#define MODE_512_SEQ   0x01
 
#define MODE_2K_SEQ   0x02
 
#define TYPE_MS   0x0000
 
#define TYPE_MSPRO   0x0001
 
#define MS_4BIT   0x0100
 
#define MS_8BIT   0x0200
 
#define MS_HG   0x0400
 
#define MS_XC   0x0800
 
#define HG8BIT   (MS_HG | MS_8BIT)
 
#define CHK_MSPRO(ms_card)   (((ms_card)->ms_type & 0xFF) == TYPE_MSPRO)
 
#define CHK_HG8BIT(ms_card)   (CHK_MSPRO(ms_card) && (((ms_card)->ms_type & HG8BIT) == HG8BIT))
 
#define CHK_MSXC(ms_card)   (CHK_MSPRO(ms_card) && ((ms_card)->ms_type & MS_XC))
 
#define CHK_MSHG(ms_card)   (CHK_MSPRO(ms_card) && ((ms_card)->ms_type & MS_HG))
 
#define CHK_MS8BIT(ms_card)   (((ms_card)->ms_type & MS_8BIT))
 
#define CHK_MS4BIT(ms_card)   (((ms_card)->ms_type & MS_4BIT))
 
#define MSG_FUNC_LEN   64
 
#define MSG_FILE_LEN   32
 
#define TIME_VAL_LEN   16
 
#define DEFAULT_SINGLE   0
 
#define SD_MS_2LUN   1
 
#define SD_MS_1LUN   2
 
#define LAST_LUN_MODE   2
 
#define QFN   0
 
#define LQFP   1
 
#define SD_PUSH_POINT_CTL_MASK   0x03
 
#define SD_PUSH_POINT_DELAY   0x01
 
#define SD_PUSH_POINT_AUTO   0x02
 
#define SD_SAMPLE_POINT_CTL_MASK   0x0C
 
#define SD_SAMPLE_POINT_DELAY   0x04
 
#define SD_SAMPLE_POINT_AUTO   0x08
 
#define SD_DDR_TX_PHASE_SET_BY_USER   0x10
 
#define MMC_DDR_TX_PHASE_SET_BY_USER   0x20
 
#define SUPPORT_MMC_DDR_MODE   0x40
 
#define RESET_MMC_FIRST   0x80
 
#define SEQ_START_CRITERIA   0x20
 
#define POWER_CLASS_2_EN   0x02
 
#define POWER_CLASS_1_EN   0x01
 
#define MAX_SHOW_CNT   10
 
#define MAX_RESET_CNT   3
 
#define SDIO_EXIST   0x01
 
#define SDIO_IGNORED   0x02
 
#define CHK_SDIO_EXIST(chip)   ((chip)->sdio_func_exist & SDIO_EXIST)
 
#define SET_SDIO_EXIST(chip)   ((chip)->sdio_func_exist |= SDIO_EXIST)
 
#define CLR_SDIO_EXIST(chip)   ((chip)->sdio_func_exist &= ~SDIO_EXIST)
 
#define CHK_SDIO_IGNORED(chip)   ((chip)->sdio_func_exist & SDIO_IGNORED)
 
#define SET_SDIO_IGNORED(chip)   ((chip)->sdio_func_exist |= SDIO_IGNORED)
 
#define CLR_SDIO_IGNORED(chip)   ((chip)->sdio_func_exist &= ~SDIO_IGNORED)
 
#define rtsx_set_stat(chip, stat)
 
#define rtsx_get_stat(chip)   ((chip)->rtsx_stat)
 
#define rtsx_chk_stat(chip, stat)   ((chip)->rtsx_stat == (stat))
 
#define RTSX_SET_DELINK(chip)   ((chip)->rtsx_flag |= 0x01)
 
#define RTSX_CLR_DELINK(chip)   ((chip)->rtsx_flag &= 0xFE)
 
#define RTSX_TST_DELINK(chip)   ((chip)->rtsx_flag & 0x01)
 
#define CHECK_PID(chip, pid)   ((chip)->product_id == (pid))
 
#define CHECK_BARO_PKG(chip, pkg)   ((chip)->baro_pkg == (pkg))
 
#define CHECK_LUN_MODE(chip, mode)   ((chip)->lun_mode == (mode))
 
#define SSC_PDCTL   0x01
 
#define OC_PDCTL   0x02
 
#define RTSX_WRITE_REG(chip, addr, mask, data)
 
#define RTSX_READ_REG(chip, addr, data)
 

Typedefs

typedef int(* card_rw_func )(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32 sec_addr, u16 sec_cnt)
 

Enumerations

enum  card_clock {
  CLK_20 = 1, CLK_30, CLK_40, CLK_50,
  CLK_60, CLK_80, CLK_100, CLK_20 = 1,
  CLK_30, CLK_40, CLK_50, CLK_60,
  CLK_80, CLK_100, CLK_120, CLK_150,
  CLK_200
}
 
enum  RTSX_STAT {
  RTSX_STAT_INIT, RTSX_STAT_IDLE, RTSX_STAT_RUN, RTSX_STAT_SS,
  RTSX_STAT_DELINK, RTSX_STAT_SUSPEND, RTSX_STAT_ABORT, RTSX_STAT_DISCONNECT
}
 
enum  IC_VER { IC_VER_AB, IC_VER_C = 2, IC_VER_D = 3 }
 

Functions

int rtsx_force_power_on (struct rtsx_chip *chip, u8 ctl)
 
int rtsx_force_power_down (struct rtsx_chip *chip, u8 ctl)
 
void rtsx_disable_card_int (struct rtsx_chip *chip)
 
void rtsx_enable_card_int (struct rtsx_chip *chip)
 
void rtsx_enable_bus_int (struct rtsx_chip *chip)
 
void rtsx_disable_bus_int (struct rtsx_chip *chip)
 
int rtsx_reset_chip (struct rtsx_chip *chip)
 
int rtsx_init_chip (struct rtsx_chip *chip)
 
void rtsx_release_chip (struct rtsx_chip *chip)
 
void rtsx_polling_func (struct rtsx_chip *chip)
 
void rtsx_undo_delink (struct rtsx_chip *chip)
 
void rtsx_stop_cmd (struct rtsx_chip *chip, int card)
 
int rtsx_write_register (struct rtsx_chip *chip, u16 addr, u8 mask, u8 data)
 
int rtsx_read_register (struct rtsx_chip *chip, u16 addr, u8 *data)
 
int rtsx_write_cfg_dw (struct rtsx_chip *chip, u8 func_no, u16 addr, u32 mask, u32 val)
 
int rtsx_read_cfg_dw (struct rtsx_chip *chip, u8 func_no, u16 addr, u32 *val)
 
int rtsx_write_cfg_seq (struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf, int len)
 
int rtsx_read_cfg_seq (struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf, int len)
 
int rtsx_write_phy_register (struct rtsx_chip *chip, u8 addr, u16 val)
 
int rtsx_read_phy_register (struct rtsx_chip *chip, u8 addr, u16 *val)
 
int rtsx_read_efuse (struct rtsx_chip *chip, u8 addr, u8 *val)
 
int rtsx_write_efuse (struct rtsx_chip *chip, u8 addr, u8 val)
 
int rtsx_clr_phy_reg_bit (struct rtsx_chip *chip, u8 reg, u8 bit)
 
int rtsx_set_phy_reg_bit (struct rtsx_chip *chip, u8 reg, u8 bit)
 
int rtsx_check_link_ready (struct rtsx_chip *chip)
 
void rtsx_enter_ss (struct rtsx_chip *chip)
 
void rtsx_exit_ss (struct rtsx_chip *chip)
 
int rtsx_pre_handle_interrupt (struct rtsx_chip *chip)
 
void rtsx_enter_L1 (struct rtsx_chip *chip)
 
void rtsx_exit_L1 (struct rtsx_chip *chip)
 
void rtsx_do_before_power_down (struct rtsx_chip *chip, int pm_stat)
 
void rtsx_enable_aspm (struct rtsx_chip *chip)
 
void rtsx_disable_aspm (struct rtsx_chip *chip)
 
int rtsx_read_ppbuf (struct rtsx_chip *chip, u8 *buf, int buf_len)
 
int rtsx_write_ppbuf (struct rtsx_chip *chip, u8 *buf, int buf_len)
 
int rtsx_check_chip_exist (struct rtsx_chip *chip)
 

Macro Definition Documentation

#define ABORTING_OR_DISCONNECTING
Value:

Definition at line 134 of file rtsx_chip.h.

#define ABRT_CMD   0x0b /* Target make the command in error */

Definition at line 161 of file rtsx_chip.h.

#define ADMA_MODE   (0x02 << 26)

Definition at line 261 of file rtsx_chip.h.

#define AENC_FNC   0x00

Definition at line 116 of file rtsx_chip.h.

#define ANSI_SCSI2   0x02 /* Based on ANSI-SCSI2 */

Definition at line 141 of file rtsx_chip.h.

#define ASC_INVLD_CDB   0x24

Definition at line 202 of file rtsx_chip.h.

#define ASC_INVLD_PARA   0x26

Definition at line 203 of file rtsx_chip.h.

#define ASC_LOAD_EJCT_ERR   0x53

Definition at line 207 of file rtsx_chip.h.

#define ASC_LU_NOT_READY   0x04

Definition at line 204 of file rtsx_chip.h.

#define ASC_LUN_NOT_SUPPORTED   0x25

Definition at line 212 of file rtsx_chip.h.

#define ASC_MEDIA_CHANGED   0x28

Definition at line 209 of file rtsx_chip.h.

#define ASC_MEDIA_IN_PROCESS   0x04

Definition at line 210 of file rtsx_chip.h.

#define ASC_MEDIA_NOT_PRESENT   0x3A

Definition at line 208 of file rtsx_chip.h.

#define ASC_MISCMP   0x1d

Definition at line 201 of file rtsx_chip.h.

#define ASC_NO_INFO   0x00

Definition at line 200 of file rtsx_chip.h.

#define ASC_READ_ERR   0x11

Definition at line 206 of file rtsx_chip.h.

#define ASC_WRITE_ERR   0x0c

Definition at line 205 of file rtsx_chip.h.

#define ASC_WRITE_PROTECT   0x27

Definition at line 211 of file rtsx_chip.h.

#define ASCQ_INVLD_CDB   0x00

Definition at line 218 of file rtsx_chip.h.

#define ASCQ_INVLD_PARA   0x02

Definition at line 219 of file rtsx_chip.h.

#define ASCQ_LOAD_EJCT_ERR   0x00

Definition at line 223 of file rtsx_chip.h.

#define ASCQ_LU_NOT_READY   0x02

Definition at line 220 of file rtsx_chip.h.

#define ASCQ_MEDIA_IN_PROCESS   0x01

Definition at line 216 of file rtsx_chip.h.

#define ASCQ_MISCMP   0x00

Definition at line 217 of file rtsx_chip.h.

#define ASCQ_NO_INFO   0x00

Definition at line 215 of file rtsx_chip.h.

#define ASCQ_READ_ERR   0x00

Definition at line 222 of file rtsx_chip.h.

#define ASCQ_WRITE_ERR   0x02

Definition at line 221 of file rtsx_chip.h.

#define ASCQ_WRITE_PROTECT   0x00

Definition at line 224 of file rtsx_chip.h.

#define BIT_ILLEGAL0   0 /* bit0 is illegal */

Definition at line 190 of file rtsx_chip.h.

#define BIT_ILLEGAL1   1 /* bit1 is illegal */

Definition at line 191 of file rtsx_chip.h.

#define BIT_ILLEGAL2   2 /* bit2 is illegal */

Definition at line 192 of file rtsx_chip.h.

#define BIT_ILLEGAL3   3 /* bit3 is illegal */

Definition at line 193 of file rtsx_chip.h.

#define BIT_ILLEGAL4   4 /* bit4 is illegal */

Definition at line 194 of file rtsx_chip.h.

#define BIT_ILLEGAL5   5 /* bit5 is illegal */

Definition at line 195 of file rtsx_chip.h.

#define BIT_ILLEGAL6   6 /* bit6 is illegal */

Definition at line 196 of file rtsx_chip.h.

#define BIT_ILLEGAL7   7 /* bit7 is illegal */

Definition at line 197 of file rtsx_chip.h.

#define BLNC_CHK   0x08 /* find blank/DOF in read */

Definition at line 158 of file rtsx_chip.h.

#define BPV   0x08

Definition at line 189 of file rtsx_chip.h.

#define CARD_EXIST   (XD_EXIST | MS_EXIST | SD_EXIST)

Definition at line 287 of file rtsx_chip.h.

#define CARD_INT   (XD_INT | MS_INT | SD_INT)

Definition at line 283 of file rtsx_chip.h.

#define CDB_ILLEGAL   0x40

Definition at line 187 of file rtsx_chip.h.

#define CHECK_BARO_PKG (   chip,
  pkg 
)    ((chip)->baro_pkg == (pkg))

Definition at line 928 of file rtsx_chip.h.

#define CHECK_LUN_MODE (   chip,
  mode 
)    ((chip)->lun_mode == (mode))

Definition at line 929 of file rtsx_chip.h.

#define CHECK_PID (   chip,
  pid 
)    ((chip)->product_id == (pid))

Definition at line 927 of file rtsx_chip.h.

#define CHECK_REG_CMD   2

Definition at line 306 of file rtsx_chip.h.

#define CHK_BIT (   data,
  idx 
)    ((data) & (1 << (idx)))

Definition at line 334 of file rtsx_chip.h.

#define CHK_HG8BIT (   ms_card)    (CHK_MSPRO(ms_card) && (((ms_card)->ms_type & HG8BIT) == HG8BIT))

Definition at line 544 of file rtsx_chip.h.

#define CHK_MMC (   sd_card)    (((sd_card)->sd_type & 0xFF) == TYPE_MMC)

Definition at line 416 of file rtsx_chip.h.

#define CHK_MMC_26M (   sd_card)    (CHK_MMC(sd_card) && ((sd_card)->sd_type & MMC_26M))

Definition at line 417 of file rtsx_chip.h.

#define CHK_MMC_4BIT (   sd_card)    (CHK_MMC(sd_card) && ((sd_card)->sd_type & MMC_4BIT))

Definition at line 419 of file rtsx_chip.h.

#define CHK_MMC_52M (   sd_card)    (CHK_MMC(sd_card) && ((sd_card)->sd_type & MMC_52M))

Definition at line 418 of file rtsx_chip.h.

#define CHK_MMC_8BIT (   sd_card)    (CHK_MMC(sd_card) && ((sd_card)->sd_type & MMC_8BIT))

Definition at line 420 of file rtsx_chip.h.

#define CHK_MMC_DDR52 (   sd_card)    (CHK_MMC(sd_card) && ((sd_card)->sd_type & MMC_DDR52))

Definition at line 422 of file rtsx_chip.h.

#define CHK_MMC_HS (   sd_card)    (CHK_MMC_52M(sd_card) && CHK_MMC_26M(sd_card))

Definition at line 439 of file rtsx_chip.h.

#define CHK_MMC_SECTOR_MODE (   sd_card)    (CHK_MMC(sd_card) && ((sd_card)->sd_type & MMC_SECTOR_MODE))

Definition at line 421 of file rtsx_chip.h.

#define CHK_MS4BIT (   ms_card)    (((ms_card)->ms_type & MS_4BIT))

Definition at line 549 of file rtsx_chip.h.

#define CHK_MS8BIT (   ms_card)    (((ms_card)->ms_type & MS_8BIT))

Definition at line 548 of file rtsx_chip.h.

#define CHK_MSHG (   ms_card)    (CHK_MSPRO(ms_card) && ((ms_card)->ms_type & MS_HG))

Definition at line 546 of file rtsx_chip.h.

#define CHK_MSPRO (   ms_card)    (((ms_card)->ms_type & 0xFF) == TYPE_MSPRO)

Definition at line 543 of file rtsx_chip.h.

#define CHK_MSXC (   ms_card)    (CHK_MSPRO(ms_card) && ((ms_card)->ms_type & MS_XC))

Definition at line 545 of file rtsx_chip.h.

#define CHK_SD (   sd_card)    (((sd_card)->sd_type & 0xFF) == TYPE_SD)

Definition at line 392 of file rtsx_chip.h.

#define CHK_SD30_SPEED (   sd_card)    (CHK_SD_SDR50(sd_card) || CHK_SD_DDR50(sd_card) || CHK_SD_SDR104(sd_card))

Definition at line 400 of file rtsx_chip.h.

#define CHK_SD_DDR50 (   sd_card)    (CHK_SD(sd_card) && ((sd_card)->sd_type & SD_DDR50))

Definition at line 395 of file rtsx_chip.h.

#define CHK_SD_HC (   sd_card)    (CHK_SD_HCXC(sd_card) && ((sd_card)->capacity <= 0x4000000))

Definition at line 398 of file rtsx_chip.h.

#define CHK_SD_HCXC (   sd_card)    (CHK_SD(sd_card) && ((sd_card)->sd_type & SD_HCXC))

Definition at line 397 of file rtsx_chip.h.

#define CHK_SD_HS (   sd_card)    (CHK_SD(sd_card) && ((sd_card)->sd_type & SD_HS))

Definition at line 393 of file rtsx_chip.h.

#define CHK_SD_SDR104 (   sd_card)    (CHK_SD(sd_card) && ((sd_card)->sd_type & SD_SDR104))

Definition at line 396 of file rtsx_chip.h.

#define CHK_SD_SDR50 (   sd_card)    (CHK_SD(sd_card) && ((sd_card)->sd_type & SD_SDR50))

Definition at line 394 of file rtsx_chip.h.

#define CHK_SD_XC (   sd_card)    (CHK_SD_HCXC(sd_card) && ((sd_card)->capacity > 0x4000000))

Definition at line 399 of file rtsx_chip.h.

#define CHK_SDIO_EXIST (   chip)    ((chip)->sdio_func_exist & SDIO_EXIST)

Definition at line 675 of file rtsx_chip.h.

#define CHK_SDIO_IGNORED (   chip)    ((chip)->sdio_func_exist & SDIO_IGNORED)

Definition at line 679 of file rtsx_chip.h.

#define CLR_BIT (   data,
  idx 
)    ((data) &= ~(1 << (idx)))

Definition at line 333 of file rtsx_chip.h.

#define CLR_MMC_26M (   sd_card)    ((sd_card)->sd_type &= ~MMC_26M)

Definition at line 432 of file rtsx_chip.h.

#define CLR_MMC_4BIT (   sd_card)    ((sd_card)->sd_type &= ~MMC_4BIT)

Definition at line 434 of file rtsx_chip.h.

#define CLR_MMC_52M (   sd_card)    ((sd_card)->sd_type &= ~MMC_52M)

Definition at line 433 of file rtsx_chip.h.

#define CLR_MMC_8BIT (   sd_card)    ((sd_card)->sd_type &= ~MMC_8BIT)

Definition at line 435 of file rtsx_chip.h.

#define CLR_MMC_DDR52 (   sd_card)    ((sd_card)->sd_type &= ~MMC_DDR52)

Definition at line 437 of file rtsx_chip.h.

#define CLR_MMC_HS (   sd_card)
Value:
do { \
CLR_MMC_DDR52(sd_card); \
CLR_MMC_52M(sd_card); \
CLR_MMC_26M(sd_card); \
} while (0)

Definition at line 440 of file rtsx_chip.h.

#define CLR_MMC_SECTOR_MODE (   sd_card)    ((sd_card)->sd_type &= ~MMC_SECTOR_MODE)

Definition at line 436 of file rtsx_chip.h.

#define CLR_SD_DDR50 (   sd_card)    ((sd_card)->sd_type &= ~SD_DDR50)

Definition at line 411 of file rtsx_chip.h.

#define CLR_SD_HCXC (   sd_card)    ((sd_card)->sd_type &= ~SD_HCXC)

Definition at line 413 of file rtsx_chip.h.

#define CLR_SD_HS (   sd_card)    ((sd_card)->sd_type &= ~SD_HS)

Definition at line 409 of file rtsx_chip.h.

#define CLR_SD_SDR104 (   sd_card)    ((sd_card)->sd_type &= ~SD_SDR104)

Definition at line 412 of file rtsx_chip.h.

#define CLR_SD_SDR50 (   sd_card)    ((sd_card)->sd_type &= ~SD_SDR50)

Definition at line 410 of file rtsx_chip.h.

#define CLR_SDIO_EXIST (   chip)    ((chip)->sdio_func_exist &= ~SDIO_EXIST)

Definition at line 677 of file rtsx_chip.h.

#define CLR_SDIO_IGNORED (   chip)    ((chip)->sdio_func_exist &= ~SDIO_IGNORED)

Definition at line 681 of file rtsx_chip.h.

#define CMD_DONE_INT   (1 << 31)

Definition at line 266 of file rtsx_chip.h.

#define CMD_DONE_INT_EN   (1 << 31)

Definition at line 290 of file rtsx_chip.h.

#define CMD_QUE   0x00

Definition at line 123 of file rtsx_chip.h.

#define CPY_ABRT   0x0a /* Copy/Compare/Copy&Verify illgal */

Definition at line 160 of file rtsx_chip.h.

#define CUR_ERR   0x70 /* current error */

Definition at line 180 of file rtsx_chip.h.

#define DAT_ILLEGAL   0x00

Definition at line 188 of file rtsx_chip.h.

#define DAT_PRTCT   0x07 /* read/write is desable */

Definition at line 157 of file rtsx_chip.h.

#define DATA_DONE_INT   (1 << 30)

Definition at line 267 of file rtsx_chip.h.

#define DATA_DONE_INT_EN   (1 << 30)

Definition at line 291 of file rtsx_chip.h.

#define DEF_ERR   0x71 /* specific command error */

Definition at line 181 of file rtsx_chip.h.

#define DEFAULT_SINGLE   0

Definition at line 631 of file rtsx_chip.h.

#define DELINK_INT   GPIO0_INT

Definition at line 279 of file rtsx_chip.h.

#define DELINK_INT_EN   GPIO0_INT_EN

Definition at line 299 of file rtsx_chip.h.

#define DEVICE_TO_HOST   1

Definition at line 309 of file rtsx_chip.h.

#define DRCT_ACCESS_DEV   0x00 /* Direct Access Device */

Definition at line 139 of file rtsx_chip.h.

#define EQUAL   0x0c /* Search Data end with Equal */

Definition at line 162 of file rtsx_chip.h.

#define FIRST_RESET   0x01

Definition at line 169 of file rtsx_chip.h.

#define GPIO0_INT   (1 << 24)

Definition at line 273 of file rtsx_chip.h.

#define GPIO0_INT_EN   (1 << 24)

Definition at line 297 of file rtsx_chip.h.

#define GPIO_TOGGLE_THRESHOLD   1024

Definition at line 62 of file rtsx_chip.h.

#define HARDWARE_ERR   0x04 /* hardware error */

Definition at line 154 of file rtsx_chip.h.

#define HG8BIT   (MS_HG | MS_8BIT)

Definition at line 541 of file rtsx_chip.h.

#define HOST_CMDS_BUF_LEN   1024

Definition at line 313 of file rtsx_chip.h.

#define HOST_SG_TBL_BUF_LEN   (RTSX_RESV_BUF_LEN - HOST_CMDS_BUF_LEN)

Definition at line 314 of file rtsx_chip.h.

#define HOST_TO_DEVICE   0

Definition at line 308 of file rtsx_chip.h.

#define HW_AUTO_SWITCH_SD_BUS

Definition at line 36 of file rtsx_chip.h.

#define HW_INT_WRITE_CLR

Definition at line 38 of file rtsx_chip.h.

#define ILGAL_REQ   0x05 /* CDB/parameter/identify msg error */

Definition at line 155 of file rtsx_chip.h.

#define ILI   0x20 /* ILI bit is on */

Definition at line 148 of file rtsx_chip.h.

#define LAST_LUN_MODE   2

Definition at line 637 of file rtsx_chip.h.

#define LED_BLINK_SPEED   5

Definition at line 60 of file rtsx_chip.h.

#define LED_GPIO   0

Definition at line 63 of file rtsx_chip.h.

#define LED_TOGGLE_INTERVAL   6

Definition at line 61 of file rtsx_chip.h.

#define LINKED   0x00

Definition at line 122 of file rtsx_chip.h.

#define LOAD_MEDIUM   0x03 /* load */

Definition at line 110 of file rtsx_chip.h.

#define LQFP   1

Definition at line 641 of file rtsx_chip.h.

#define MAKE_MEDIUM_READY   0x01 /* access enable */

Definition at line 108 of file rtsx_chip.h.

#define MAX_ALLOWED_LUN_CNT   8

Definition at line 325 of file rtsx_chip.h.

#define MAX_DEFECTIVE_BLOCK   10

Definition at line 359 of file rtsx_chip.h.

#define MAX_RESET_CNT   3

Definition at line 670 of file rtsx_chip.h.

#define MAX_RESET_CNT   3

Definition at line 670 of file rtsx_chip.h.

#define MAX_SHOW_CNT   10

Definition at line 669 of file rtsx_chip.h.

#define MEDIA_ERR   0x03 /* medium/data error */

Definition at line 153 of file rtsx_chip.h.

#define MG_SET_ICV_SLOW

Definition at line 44 of file rtsx_chip.h.

#define MISCMP   0x0e /* find inequality */

Definition at line 164 of file rtsx_chip.h.

#define MMC_26M   0x0100

Definition at line 384 of file rtsx_chip.h.

#define MMC_4BIT   0x0400

Definition at line 386 of file rtsx_chip.h.

#define MMC_52M   0x0200

Definition at line 385 of file rtsx_chip.h.

#define MMC_8BIT   0x0800

Definition at line 387 of file rtsx_chip.h.

#define MMC_DDR52   0x2000

Definition at line 389 of file rtsx_chip.h.

#define MMC_DDR_TX_PHASE_SET_BY_USER   0x20

Definition at line 657 of file rtsx_chip.h.

#define MMC_SECTOR_MODE   0x1000

Definition at line 388 of file rtsx_chip.h.

#define MODE_2K_SEQ   0x02

Definition at line 531 of file rtsx_chip.h.

#define MODE_512_SEQ   0x01

Definition at line 530 of file rtsx_chip.h.

#define MS_4BIT   0x0100

Definition at line 536 of file rtsx_chip.h.

#define MS_8BIT   0x0200

Definition at line 537 of file rtsx_chip.h.

#define MS_CARD   (1 << MS_NR)

Definition at line 321 of file rtsx_chip.h.

#define MS_EXIST   (1 << 17)

Definition at line 277 of file rtsx_chip.h.

#define MS_FREE_TABLE_CNT   512

Definition at line 328 of file rtsx_chip.h.

#define MS_HG   0x0400

Definition at line 538 of file rtsx_chip.h.

#define MS_INT   (1 << 26)

Definition at line 271 of file rtsx_chip.h.

#define MS_INT_EN   (1 << 26)

Definition at line 295 of file rtsx_chip.h.

#define MS_NR   3

Definition at line 317 of file rtsx_chip.h.

#define MS_OC_INT   (1 << 23)

Definition at line 280 of file rtsx_chip.h.

#define MS_OC_INT_EN   (1 << 23)

Definition at line 300 of file rtsx_chip.h.

#define MS_SAMPLE_INT_ERR

Definition at line 46 of file rtsx_chip.h.

#define MS_XC   0x0800

Definition at line 539 of file rtsx_chip.h.

#define MSG_FILE_LEN   32

Definition at line 619 of file rtsx_chip.h.

#define MSG_FUNC_LEN   64

Definition at line 617 of file rtsx_chip.h.

#define NEED_COMPLETE_INT   (DATA_DONE_INT | TRANS_OK_INT | TRANS_FAIL_INT)

Definition at line 284 of file rtsx_chip.h.

#define NO_SENSE   0x00 /* not exist sense key */

Definition at line 150 of file rtsx_chip.h.

#define NOT_READY   0x02 /* Logical unit is not ready */

Definition at line 152 of file rtsx_chip.h.

#define OC_INT   (1 << 23)

Definition at line 274 of file rtsx_chip.h.

#define OC_INT_EN   (1 << 23)

Definition at line 298 of file rtsx_chip.h.

#define OC_PDCTL   0x02

Definition at line 933 of file rtsx_chip.h.

#define PM_S1   1

Definition at line 91 of file rtsx_chip.h.

#define PM_S3   3

Definition at line 92 of file rtsx_chip.h.

#define POLLING_INTERVAL   30

Definition at line 65 of file rtsx_chip.h.

#define POWER_CLASS_1_EN   0x01

Definition at line 667 of file rtsx_chip.h.

#define POWER_CLASS_2_EN   0x02

Definition at line 666 of file rtsx_chip.h.

#define PRDCT_ID_LEN   16 /* Product ID Length */

Definition at line 127 of file rtsx_chip.h.

#define PRDCT_REV_LEN   4 /* Product LOT Length */

Definition at line 128 of file rtsx_chip.h.

#define QFN   0

Definition at line 640 of file rtsx_chip.h.

#define QULIFIRE   0x00

Definition at line 115 of file rtsx_chip.h.

#define READ_BYTES_WAIT_INT

Definition at line 48 of file rtsx_chip.h.

#define READ_ERR   -1

Definition at line 166 of file rtsx_chip.h.

#define READ_REG_CMD   0

Definition at line 304 of file rtsx_chip.h.

#define RECOVER_ERR   0x01 /* Target/Logical unit is recoverd */

Definition at line 151 of file rtsx_chip.h.

#define REGULAR_BLINK

Definition at line 57 of file rtsx_chip.h.

#define REL_ADR   0x00

Definition at line 118 of file rtsx_chip.h.

#define RESET_MMC_FIRST   0x80

Definition at line 661 of file rtsx_chip.h.

#define RMB_DISC   0x80 /* The Device is Removable */

Definition at line 140 of file rtsx_chip.h.

#define RTSX_BIER   0x18

Definition at line 254 of file rtsx_chip.h.

#define RTSX_BIPR   0x14

Definition at line 253 of file rtsx_chip.h.

#define rtsx_chk_stat (   chip,
  stat 
)    ((chip)->rtsx_stat == (stat))

Definition at line 921 of file rtsx_chip.h.

#define RTSX_CLR_DELINK (   chip)    ((chip)->rtsx_flag &= 0xFE)

Definition at line 924 of file rtsx_chip.h.

#define RTSX_FLIDX_ABORTING   20 /* 0x00100000 abort is in progress */

Definition at line 132 of file rtsx_chip.h.

#define RTSX_FLIDX_DISCONNECTING   21 /* 0x00200000 disconnect in progress */

Definition at line 133 of file rtsx_chip.h.

#define RTSX_FLIDX_RESETTING   22 /* 0x00400000 device reset in progress */

Definition at line 136 of file rtsx_chip.h.

#define RTSX_FLIDX_TIMED_OUT   23 /* 0x00800000 SCSI midlayer timed out */

Definition at line 137 of file rtsx_chip.h.

#define RTSX_FLIDX_TRANS_ACTIVE   18 /* 0x00040000 transfer is active */

Definition at line 131 of file rtsx_chip.h.

#define rtsx_get_stat (   chip)    ((chip)->rtsx_stat)

Definition at line 920 of file rtsx_chip.h.

#define RTSX_HAIMR   0x10

Definition at line 252 of file rtsx_chip.h.

#define RTSX_HCBAR   0x00

Definition at line 248 of file rtsx_chip.h.

#define RTSX_HCBCTLR   0x04

Definition at line 249 of file rtsx_chip.h.

#define RTSX_HDBAR   0x08

Definition at line 250 of file rtsx_chip.h.

#define RTSX_HDBCTLR   0x0C

Definition at line 251 of file rtsx_chip.h.

#define RTSX_INT   (CMD_DONE_INT | NEED_COMPLETE_INT | CARD_INT | GPIO0_INT | OC_INT)

Definition at line 285 of file rtsx_chip.h.

#define RTSX_READ_REG (   chip,
  addr,
  data 
)
Value:
do { \
if (retval != STATUS_SUCCESS) { \
TRACE_RET((chip), retval); \
} \
} while (0)

Definition at line 981 of file rtsx_chip.h.

#define RTSX_RESV_BUF_LEN   4096

Definition at line 312 of file rtsx_chip.h.

#define RTSX_SET_DELINK (   chip)    ((chip)->rtsx_flag |= 0x01)

Definition at line 923 of file rtsx_chip.h.

#define rtsx_set_stat (   chip,
  stat 
)
Value:
do { \
if ((stat) != RTSX_STAT_IDLE) { \
(chip)->idle_counter = 0; \
} \
(chip)->rtsx_stat = (enum RTSX_STAT)(stat); \
} while (0)

Definition at line 913 of file rtsx_chip.h.

#define RTSX_TST_DELINK (   chip)    ((chip)->rtsx_flag & 0x01)

Definition at line 925 of file rtsx_chip.h.

#define RTSX_WRITE_REG (   chip,
  addr,
  mask,
  data 
)
Value:
do { \
if (retval != STATUS_SUCCESS) { \
TRACE_RET((chip), retval); \
} \
} while (0)

Definition at line 973 of file rtsx_chip.h.

#define SCSI   0x00 /* Interface ID */

Definition at line 143 of file rtsx_chip.h.

#define SD_CARD   (1 << SD_NR)

Definition at line 320 of file rtsx_chip.h.

#define SD_CHK_1V8 (   sd_card)    ((sd_card)->sd_setting & SD_SUPPORT_1V8)

Definition at line 454 of file rtsx_chip.h.

#define SD_CHK_CLASS_TEN (   sd_card)    ((sd_card)->sd_setting & SD_SUPPORT_CLASS_TEN)

Definition at line 451 of file rtsx_chip.h.

#define SD_CLR_1V8 (   sd_card)    ((sd_card)->sd_setting &= ~SD_SUPPORT_1V8)

Definition at line 455 of file rtsx_chip.h.

#define SD_CLR_CLASS_TEN (   sd_card)    ((sd_card)->sd_setting &= ~SD_SUPPORT_CLASS_TEN)

Definition at line 452 of file rtsx_chip.h.

#define SD_DDR50   0x0400

Definition at line 379 of file rtsx_chip.h.

#define SD_DDR_TX_PHASE_SET_BY_USER   0x10

Definition at line 655 of file rtsx_chip.h.

#define SD_EXIST   (1 << 16)

Definition at line 278 of file rtsx_chip.h.

#define SD_HCXC   0x1000

Definition at line 381 of file rtsx_chip.h.

#define SD_HS   0x0100

Definition at line 377 of file rtsx_chip.h.

#define SD_INT   (1 << 25)

Definition at line 272 of file rtsx_chip.h.

#define SD_INT_EN   (1 << 25)

Definition at line 296 of file rtsx_chip.h.

#define SD_MS_1LUN   2

Definition at line 635 of file rtsx_chip.h.

#define SD_MS_2LUN   1

Definition at line 633 of file rtsx_chip.h.

#define SD_NR   2

Definition at line 316 of file rtsx_chip.h.

#define SD_OC_INT   (1 << 22)

Definition at line 281 of file rtsx_chip.h.

#define SD_OC_INT_EN   (1 << 22)

Definition at line 301 of file rtsx_chip.h.

#define SD_PUSH_POINT_AUTO   0x02

Definition at line 649 of file rtsx_chip.h.

#define SD_PUSH_POINT_CTL_MASK   0x03

Definition at line 647 of file rtsx_chip.h.

#define SD_PUSH_POINT_DELAY   0x01

Definition at line 648 of file rtsx_chip.h.

#define SD_SAMPLE_POINT_AUTO   0x08

Definition at line 653 of file rtsx_chip.h.

#define SD_SAMPLE_POINT_CTL_MASK   0x0C

Definition at line 651 of file rtsx_chip.h.

#define SD_SAMPLE_POINT_DELAY   0x04

Definition at line 652 of file rtsx_chip.h.

#define SD_SDR104   0x0800

Definition at line 380 of file rtsx_chip.h.

#define SD_SDR50   0x0200

Definition at line 378 of file rtsx_chip.h.

#define SD_SET_1V8 (   sd_card)    ((sd_card)->sd_setting |= SD_SUPPORT_1V8)

Definition at line 453 of file rtsx_chip.h.

#define SD_SET_CLASS_TEN (   sd_card)    ((sd_card)->sd_setting |= SD_SUPPORT_CLASS_TEN)

Definition at line 450 of file rtsx_chip.h.

#define SD_SUPPORT_1V8   0x02

Definition at line 448 of file rtsx_chip.h.

#define SD_SUPPORT_CLASS_TEN   0x01

Definition at line 447 of file rtsx_chip.h.

#define SD_WRITE_PROTECT   (1 << 19)

Definition at line 275 of file rtsx_chip.h.

#define SDIO_EXIST   0x01

Definition at line 672 of file rtsx_chip.h.

#define SDIO_IGNORED   0x02

Definition at line 673 of file rtsx_chip.h.

#define SDMA_MODE   0x00

Definition at line 260 of file rtsx_chip.h.

#define SENSE_INVALID   0x00 /* Sense data is invalid as SCSI2 */

Definition at line 177 of file rtsx_chip.h.

#define SENSE_VALID   0x80 /* Sense data is valid as SCSI2 */

Definition at line 176 of file rtsx_chip.h.

#define SEQ_START_CRITERIA   0x20

Definition at line 663 of file rtsx_chip.h.

#define SET_BIT (   data,
  idx 
)    ((data) |= 1 << (idx))

Definition at line 332 of file rtsx_chip.h.

#define SET_MMC (   sd_card)    ((sd_card)->sd_type = TYPE_MMC)

Definition at line 424 of file rtsx_chip.h.

#define SET_MMC_26M (   sd_card)    ((sd_card)->sd_type |= MMC_26M)

Definition at line 425 of file rtsx_chip.h.

#define SET_MMC_4BIT (   sd_card)    ((sd_card)->sd_type |= MMC_4BIT)

Definition at line 427 of file rtsx_chip.h.

#define SET_MMC_52M (   sd_card)    ((sd_card)->sd_type |= MMC_52M)

Definition at line 426 of file rtsx_chip.h.

#define SET_MMC_8BIT (   sd_card)    ((sd_card)->sd_type |= MMC_8BIT)

Definition at line 428 of file rtsx_chip.h.

#define SET_MMC_DDR52 (   sd_card)    ((sd_card)->sd_type |= MMC_DDR52)

Definition at line 430 of file rtsx_chip.h.

#define SET_MMC_SECTOR_MODE (   sd_card)    ((sd_card)->sd_type |= MMC_SECTOR_MODE)

Definition at line 429 of file rtsx_chip.h.

#define SET_SD (   sd_card)    ((sd_card)->sd_type = TYPE_SD)

Definition at line 402 of file rtsx_chip.h.

#define SET_SD_DDR50 (   sd_card)    ((sd_card)->sd_type |= SD_DDR50)

Definition at line 405 of file rtsx_chip.h.

#define SET_SD_HCXC (   sd_card)    ((sd_card)->sd_type |= SD_HCXC)

Definition at line 407 of file rtsx_chip.h.

#define SET_SD_HS (   sd_card)    ((sd_card)->sd_type |= SD_HS)

Definition at line 403 of file rtsx_chip.h.

#define SET_SD_SDR104 (   sd_card)    ((sd_card)->sd_type |= SD_SDR104)

Definition at line 406 of file rtsx_chip.h.

#define SET_SD_SDR50 (   sd_card)    ((sd_card)->sd_type |= SD_SDR50)

Definition at line 404 of file rtsx_chip.h.

#define SET_SDIO_EXIST (   chip)    ((chip)->sdio_func_exist |= SDIO_EXIST)

Definition at line 676 of file rtsx_chip.h.

#define SET_SDIO_IGNORED (   chip)    ((chip)->sdio_func_exist |= SDIO_IGNORED)

Definition at line 680 of file rtsx_chip.h.

#define SFT_RE   0x00

Definition at line 124 of file rtsx_chip.h.

#define SG_END   0x02

Definition at line 338 of file rtsx_chip.h.

#define SG_INT   0x04

Definition at line 337 of file rtsx_chip.h.

#define SG_LINK_DESC   (0x03 << 4)

Definition at line 343 of file rtsx_chip.h.

#define SG_NO_OP   0x00

Definition at line 341 of file rtsx_chip.h.

#define SG_TRANS_DATA   (0x02 << 4)

Definition at line 342 of file rtsx_chip.h.

#define SG_VALID   0x01

Definition at line 339 of file rtsx_chip.h.

#define SKSV   0x80

Definition at line 186 of file rtsx_chip.h.

#define SNSKEYINFO_LEN   3 /* length of sense key information */

Definition at line 184 of file rtsx_chip.h.

#define SPI_CARD   (1 << SPI_NR)

Definition at line 323 of file rtsx_chip.h.

#define SPI_NR   7

Definition at line 319 of file rtsx_chip.h.

#define SSC_PDCTL   0x01

Definition at line 932 of file rtsx_chip.h.

#define STATUS_ERROR   10

Definition at line 88 of file rtsx_chip.h.

#define STATUS_FAIL   1

Definition at line 73 of file rtsx_chip.h.

#define STATUS_NOMEM   3

Definition at line 79 of file rtsx_chip.h.

#define STATUS_READ_FAIL   4

Definition at line 82 of file rtsx_chip.h.

#define STATUS_SUCCESS   0

Definition at line 70 of file rtsx_chip.h.

#define STATUS_TIMEDOUT   2

Definition at line 76 of file rtsx_chip.h.

#define STATUS_WRITE_FAIL   5

Definition at line 85 of file rtsx_chip.h.

#define STOP_CMD   (0x01 << 28)

Definition at line 257 of file rtsx_chip.h.

#define STOP_DMA   (0x01 << 28)

Definition at line 262 of file rtsx_chip.h.

#define STOP_MEDIUM   0x00 /* access disable */

Definition at line 107 of file rtsx_chip.h.

#define SUPPORT_CPRM

Definition at line 29 of file rtsx_chip.h.

#define SUPPORT_MAGIC_GATE

Definition at line 32 of file rtsx_chip.h.

#define SUPPORT_MMC_DDR_MODE   0x40

Definition at line 659 of file rtsx_chip.h.

#define SUPPORT_MSXC

Definition at line 33 of file rtsx_chip.h.

#define SUPPORT_OCP

Definition at line 30 of file rtsx_chip.h.

#define SUPPORT_PCGL_1P18

Definition at line 53 of file rtsx_chip.h.

#define SUPPORT_SD_LOCK

Definition at line 34 of file rtsx_chip.h.

#define SUPPORT_SDIO_ASPM

Definition at line 31 of file rtsx_chip.h.

#define SYNC   0x00

Definition at line 121 of file rtsx_chip.h.

#define TIME_VAL_LEN   16

Definition at line 621 of file rtsx_chip.h.

#define TRACE_ITEM_CNT   64

Definition at line 67 of file rtsx_chip.h.

#define TRANS_FAIL_INT   (1 << 28)

Definition at line 269 of file rtsx_chip.h.

#define TRANS_FAIL_INT_EN   (1 << 28)

Definition at line 293 of file rtsx_chip.h.

#define TRANS_OK_INT   (1 << 29)

Definition at line 268 of file rtsx_chip.h.

#define TRANS_OK_INT_EN   (1 << 29)

Definition at line 292 of file rtsx_chip.h.

#define TRANSPORT_ERROR   3 /* Transport bad (i.e. device dead) */

Definition at line 101 of file rtsx_chip.h.

#define TRANSPORT_FAILED   1 /* Transport good, command failed */

Definition at line 99 of file rtsx_chip.h.

#define TRANSPORT_GOOD   0 /* Transport good, command good */

Definition at line 98 of file rtsx_chip.h.

#define TRANSPORT_NO_SENSE   2 /* Command failed, no auto-sense */

Definition at line 100 of file rtsx_chip.h.

#define TRIG_DMA   (0x01 << 31)

Definition at line 263 of file rtsx_chip.h.

#define TRML_IOP   0x00

Definition at line 117 of file rtsx_chip.h.

#define TYPE_MMC   0x0001

Definition at line 374 of file rtsx_chip.h.

#define TYPE_MS   0x0000

Definition at line 533 of file rtsx_chip.h.

#define TYPE_MSPRO   0x0001

Definition at line 534 of file rtsx_chip.h.

#define TYPE_SD   0x0000

Definition at line 373 of file rtsx_chip.h.

#define UNIT_ATTENTION   0x06 /* unit attention condition occur */

Definition at line 156 of file rtsx_chip.h.

#define UNLOAD_MEDIUM   0x02 /* unload */

Definition at line 109 of file rtsx_chip.h.

#define USED_EXIST   0x02

Definition at line 170 of file rtsx_chip.h.

#define VEN_ID_LEN   8 /* Vendor ID Length */

Definition at line 126 of file rtsx_chip.h.

#define VLM_OVRFLW   0x0d /* Some data are left in buffer */

Definition at line 163 of file rtsx_chip.h.

#define WBUS_16   0x00

Definition at line 120 of file rtsx_chip.h.

#define WBUS_32   0x00

Definition at line 119 of file rtsx_chip.h.

#define WRITE_ERR   -2

Definition at line 167 of file rtsx_chip.h.

#define WRITE_PROTECTED_MEDIA   0x07

Definition at line 145 of file rtsx_chip.h.

#define WRITE_REG_CMD   1

Definition at line 305 of file rtsx_chip.h.

#define XC_POWERCLASS

Definition at line 52 of file rtsx_chip.h.

#define XD_CARD   (1 << XD_NR)

Definition at line 322 of file rtsx_chip.h.

#define XD_EXIST   (1 << 18)

Definition at line 276 of file rtsx_chip.h.

#define XD_FREE_TABLE_CNT   1200

Definition at line 327 of file rtsx_chip.h.

#define XD_INT   (1 << 27)

Definition at line 270 of file rtsx_chip.h.

#define XD_INT_EN   (1 << 27)

Definition at line 294 of file rtsx_chip.h.

#define XD_NR   4

Definition at line 318 of file rtsx_chip.h.

Typedef Documentation

typedef int(* card_rw_func)(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32 sec_addr, u16 sec_cnt)

Definition at line 347 of file rtsx_chip.h.

Enumeration Type Documentation

enum card_clock
Enumerator:
CLK_20 
CLK_30 
CLK_40 
CLK_50 
CLK_60 
CLK_80 
CLK_100 
CLK_20 
CLK_30 
CLK_40 
CLK_50 
CLK_60 
CLK_80 
CLK_100 
CLK_120 
CLK_150 
CLK_200 

Definition at line 350 of file rtsx_chip.h.

enum IC_VER
Enumerator:
IC_VER_AB 
IC_VER_C 
IC_VER_D 

Definition at line 354 of file rtsx_chip.h.

enum RTSX_STAT
Enumerator:
RTSX_STAT_INIT 
RTSX_STAT_IDLE 
RTSX_STAT_RUN 
RTSX_STAT_SS 
RTSX_STAT_DELINK 
RTSX_STAT_SUSPEND 
RTSX_STAT_ABORT 
RTSX_STAT_DISCONNECT 

Definition at line 352 of file rtsx_chip.h.

Function Documentation

int rtsx_check_chip_exist ( struct rtsx_chip chip)

Definition at line 2204 of file rtsx_chip.c.

int rtsx_check_link_ready ( struct rtsx_chip chip)

Definition at line 1783 of file rtsx_chip.c.

int rtsx_clr_phy_reg_bit ( struct rtsx_chip chip,
u8  reg,
u8  bit 
)

Definition at line 1745 of file rtsx_chip.c.

void rtsx_disable_aspm ( struct rtsx_chip chip)

Definition at line 2097 of file rtsx_chip.c.

void rtsx_disable_bus_int ( struct rtsx_chip chip)

Definition at line 125 of file rtsx_chip.c.

void rtsx_disable_card_int ( struct rtsx_chip chip)

Definition at line 53 of file rtsx_chip.c.

void rtsx_do_before_power_down ( struct rtsx_chip chip,
int  pm_stat 
)

Definition at line 2004 of file rtsx_chip.c.

void rtsx_enable_aspm ( struct rtsx_chip chip)

Definition at line 2068 of file rtsx_chip.c.

void rtsx_enable_bus_int ( struct rtsx_chip chip)

Definition at line 80 of file rtsx_chip.c.

void rtsx_enable_card_int ( struct rtsx_chip chip)

Definition at line 61 of file rtsx_chip.c.

void rtsx_enter_L1 ( struct rtsx_chip chip)

Definition at line 1822 of file rtsx_chip.c.

void rtsx_enter_ss ( struct rtsx_chip chip)

Definition at line 1833 of file rtsx_chip.c.

void rtsx_exit_L1 ( struct rtsx_chip chip)

Definition at line 1827 of file rtsx_chip.c.

void rtsx_exit_ss ( struct rtsx_chip chip)

Definition at line 1870 of file rtsx_chip.c.

int rtsx_force_power_down ( struct rtsx_chip chip,
u8  ctl 
)

Definition at line 2240 of file rtsx_chip.c.

int rtsx_force_power_on ( struct rtsx_chip chip,
u8  ctl 
)

Definition at line 2212 of file rtsx_chip.c.

int rtsx_init_chip ( struct rtsx_chip chip)

Definition at line 910 of file rtsx_chip.c.

void rtsx_polling_func ( struct rtsx_chip chip)

Definition at line 1111 of file rtsx_chip.c.

int rtsx_pre_handle_interrupt ( struct rtsx_chip chip)

Definition at line 1891 of file rtsx_chip.c.

int rtsx_read_cfg_dw ( struct rtsx_chip chip,
u8  func_no,
u16  addr,
u32 val 
)

Definition at line 1504 of file rtsx_chip.c.

int rtsx_read_cfg_seq ( struct rtsx_chip chip,
u8  func,
u16  addr,
u8 buf,
int  len 
)

Definition at line 1589 of file rtsx_chip.c.

int rtsx_read_efuse ( struct rtsx_chip chip,
u8  addr,
u8 val 
)

Definition at line 1690 of file rtsx_chip.c.

int rtsx_read_phy_register ( struct rtsx_chip chip,
u8  addr,
u16 val 
)

Definition at line 1659 of file rtsx_chip.c.

int rtsx_read_ppbuf ( struct rtsx_chip chip,
u8 buf,
int  buf_len 
)

Definition at line 2121 of file rtsx_chip.c.

int rtsx_read_register ( struct rtsx_chip chip,
u16  addr,
u8 data 
)

Definition at line 1445 of file rtsx_chip.c.

void rtsx_release_chip ( struct rtsx_chip chip)

Definition at line 1041 of file rtsx_chip.c.

int rtsx_reset_chip ( struct rtsx_chip chip)

Definition at line 244 of file rtsx_chip.c.

int rtsx_set_phy_reg_bit ( struct rtsx_chip chip,
u8  reg,
u8  bit 
)

Definition at line 1764 of file rtsx_chip.c.

void rtsx_stop_cmd ( struct rtsx_chip chip,
int  card 
)

rtsx_stop_cmd - stop command transfer and DMA transfer : Realtek's card reader chip : flash card type

Stop command transfer and DMA transfer. This function is called in error handler.

Definition at line 1395 of file rtsx_chip.c.

void rtsx_undo_delink ( struct rtsx_chip chip)

Definition at line 1381 of file rtsx_chip.c.

int rtsx_write_cfg_dw ( struct rtsx_chip chip,
u8  func_no,
u16  addr,
u32  mask,
u32  val 
)

Definition at line 1472 of file rtsx_chip.c.

int rtsx_write_cfg_seq ( struct rtsx_chip chip,
u8  func,
u16  addr,
u8 buf,
int  len 
)

Definition at line 1531 of file rtsx_chip.c.

int rtsx_write_efuse ( struct rtsx_chip chip,
u8  addr,
u8  val 
)

Definition at line 1714 of file rtsx_chip.c.

int rtsx_write_phy_register ( struct rtsx_chip chip,
u8  addr,
u16  val 
)

Definition at line 1635 of file rtsx_chip.c.

int rtsx_write_ppbuf ( struct rtsx_chip chip,
u8 buf,
int  buf_len 
)

Definition at line 2163 of file rtsx_chip.c.

int rtsx_write_register ( struct rtsx_chip chip,
u16  addr,
u8  mask,
u8  data 
)

Definition at line 1421 of file rtsx_chip.c.