Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
rts51x_chip.h File Reference
#include <linux/usb.h>
#include <linux/usb_usual.h>
#include <linux/blkdev.h>
#include <linux/completion.h>
#include <linux/mutex.h>
#include <scsi/scsi_host.h>
#include "trace.h"

Go to the source code of this file.

Data Structures

struct  trace_msg_t
 
struct  sense_data_t
 
struct  rts51x_option
 
struct  zone_entry
 
struct  xd_delay_write_tag
 
struct  xd_info
 
struct  sd_info
 
struct  ms_delay_write_tag
 
struct  ms_info
 
struct  rts51x_chip
 

Macros

#define SUPPORT_CPRM
 
#define SUPPORT_MAGIC_GATE
 
#define SUPPORT_MSXC
 
#define USING_POLLING_CYCLE_DELINK
 
#define XC_POWERCLASS
 
#define SUPPORT_PCGL_1P18
 
#define GET_CARD_STATUS_USING_EPC
 
#define CLOSE_SSC_POWER
 
#define SUPPORT_OCP
 
#define MS_SPEEDUP
 
#define SD_XD_IO_FOLLOW_PWR
 
#define SD_NR   2
 
#define MS_NR   3
 
#define XD_NR   4
 
#define SD_CARD   (1 << SD_NR)
 
#define MS_CARD   (1 << MS_NR)
 
#define XD_CARD   (1 << XD_NR)
 
#define SD_CD   0x01
 
#define MS_CD   0x02
 
#define XD_CD   0x04
 
#define SD_WP   0x08
 
#define MAX_ALLOWED_LUN_CNT   8
 
#define CMD_BUF_LEN   1024
 
#define POLLING_INTERVAL   50 /* 50ms */
 
#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 READ_REG_CMD   0
 
#define WRITE_REG_CMD   1
 
#define CHECK_REG_CMD   2
 
#define PACKET_TYPE   4
 
#define CNT_H   5
 
#define CNT_L   6
 
#define STAGE_FLAG   7
 
#define CMD_OFFSET   8
 
#define BATCH_CMD   0
 
#define SEQ_READ   1
 
#define SEQ_WRITE   2
 
#define STAGE_R   0x01
 
#define STAGE_DI   0x02
 
#define STAGE_DO   0x04
 
#define STAGE_MS_STATUS   0x08
 
#define STAGE_XD_STATUS   0x10
 
#define MODE_C   0x00
 
#define MODE_CR   (STAGE_R)
 
#define MODE_CDIR   (STAGE_R | STAGE_DI)
 
#define MODE_CDOR   (STAGE_R | STAGE_DO)
 
#define STATUS_SUCCESS   0
 
#define STATUS_FAIL   1
 
#define STATUS_TIMEDOUT   4
 
#define STATUS_NOMEM   5
 
#define STATUS_TRANS_SHORT   6
 
#define STATUS_TRANS_LONG   7
 
#define STATUS_STALLED   8
 
#define STATUS_ERROR   10
 
#define IDLE_MAX_COUNT   10
 
#define POLLING_WAIT_CNT   1
 
#define LED_GPIO   0
 
#define QFN24   0
 
#define LQFP48   1
 
#define USB_11   0
 
#define USB_20   1
 
#define TRANSPORT_GOOD   0
 
#define TRANSPORT_FAILED   1
 
#define TRANSPORT_ERROR   3
 
#define TRACE_ITEM_CNT   64
 
#define MSG_FUNC_LEN   64
 
#define MSG_FILE_LEN   32
 
#define TIME_VAL_LEN   16
 
#define SENSE_SIZE   18
 
#define SENSE_TYPE_NO_SENSE   0
 
#define SENSE_TYPE_MEDIA_CHANGE   1
 
#define SENSE_TYPE_MEDIA_NOT_PRESENT   2
 
#define SENSE_TYPE_MEDIA_LBA_OVER_RANGE   3
 
#define SENSE_TYPE_MEDIA_LUN_NOT_SUPPORT   4
 
#define SENSE_TYPE_MEDIA_WRITE_PROTECT   5
 
#define SENSE_TYPE_MEDIA_INVALID_CMD_FIELD   6
 
#define SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR   7
 
#define SENSE_TYPE_MEDIA_WRITE_ERR   8
 
#define SENSE_TYPE_FORMAT_CMD_FAILED   10
 
#define SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB   0x0b
 
#define SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN   0x0c
 
#define SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM   0x0d
 
#define SENSE_TYPE_MG_WRITE_ERR   0x0e
 
#define ILGAL_REQ   0x05 /* CDB/parameter/identify msg error */
 
#define CUR_ERR   0x70 /* current error */
 
#define SKSV   0x80
 
#define CDB_ILLEGAL   0x40
 
#define ASC_INVLD_CDB   0x24
 
#define ASCQ_INVLD_CDB   0x00
 
#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_UHS50_MMC44   0x40
 
#define MS_FORMATTER_ENABLED(chip)   ((chip)->option.mspro_formatter_enable)
 
#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_SD30_SPEED(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 CLR_SD30_SPEED(sd_card)   ((sd_card)->sd_type &= ~(SD_SDR50|SD_DDR50|SD_SDR104))
 
#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 CLR_RETRY_SD20_MODE(sd_card)   ((sd_card)->retry_SD20_mode = 0)
 
#define SET_RETRY_SD20_MODE(sd_card)   ((sd_card)->retry_SD20_mode = 1)
 
#define CHK_RETRY_SD20_MODE(sd_card)   ((sd_card)->retry_SD20_mode == 1)
 
#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 PRO_UNDER_FORMATTING(ms_card)   ((ms_card)->pro_under_formatting)
 
#define SET_FORMAT_STATUS(ms_card, status)   ((ms_card)->format_status = (status))
 
#define CHK_FORMAT_STATUS(ms_card, status)   ((ms_card)->format_status == (status))
 
#define UHS50_EN   0x0001
 
#define UHS50_DIS   0x0000
 
#define SET_UHS50(chip)   ((chip)->uhs50_mmc44_en = UHS50_EN)
 
#define CLEAR_UHS50(chip)   ((chip)->uhs50_mmc44_en = UHS50_DIS)
 
#define CHECK_UHS50(chip)   (((chip)->uhs50_mmc44_en&0xff) == UHS50_EN)
 
#define RTS51X_GET_VID(chip)   ((chip)->vendor_id)
 
#define RTS51X_GET_PID(chip)   ((chip)->product_id)
 
#define RTS51X_SET_STAT(chip, stat)
 
#define RTS51X_CHK_STAT(chip, stat)   ((chip)->chip_stat == (stat))
 
#define RTS51X_GET_STAT(chip)   ((chip)->chip_stat)
 
#define CHECK_PID(chip, pid)   (RTS51X_GET_PID(chip) == (pid))
 
#define CHECK_PKG(chip, pkg)   ((chip)->package == (pkg))
 
#define CHECK_USB(chip, speed)   ((chip)->usb_speed == (speed))
 
#define RTS51X_WRITE_REG(chip, addr, mask, data)
 
#define RTS51X_READ_REG(chip, addr, data)
 

Typedefs

typedef int(* card_rw_func )(struct scsi_cmnd *srb, struct rts51x_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  CHIP_STAT {
  STAT_INIT, STAT_IDLE, STAT_RUN, STAT_SS_PRE,
  STAT_SS, STAT_SUSPEND
}
 

Functions

int rts51x_reset_chip (struct rts51x_chip *chip)
 
int rts51x_init_chip (struct rts51x_chip *chip)
 
int rts51x_release_chip (struct rts51x_chip *chip)
 
void rts51x_polling_func (struct rts51x_chip *chip)
 
void rts51x_add_cmd (struct rts51x_chip *chip, u8 cmd_type, u16 reg_addr, u8 mask, u8 data)
 
int rts51x_send_cmd (struct rts51x_chip *chip, u8 flag, int timeout)
 
int rts51x_get_rsp (struct rts51x_chip *chip, int rsp_len, int timeout)
 
int rts51x_get_card_status (struct rts51x_chip *chip, u16 *status)
 
int rts51x_write_register (struct rts51x_chip *chip, u16 addr, u8 mask, u8 data)
 
int rts51x_read_register (struct rts51x_chip *chip, u16 addr, u8 *data)
 
int rts51x_ep0_write_register (struct rts51x_chip *chip, u16 addr, u8 mask, u8 data)
 
int rts51x_ep0_read_register (struct rts51x_chip *chip, u16 addr, u8 *data)
 
int rts51x_seq_write_register (struct rts51x_chip *chip, u16 addr, u16 len, u8 *data)
 
int rts51x_seq_read_register (struct rts51x_chip *chip, u16 addr, u16 len, u8 *data)
 
int rts51x_read_ppbuf (struct rts51x_chip *chip, u8 *buf, int buf_len)
 
int rts51x_write_ppbuf (struct rts51x_chip *chip, u8 *buf, int buf_len)
 
int rts51x_write_phy_register (struct rts51x_chip *chip, u8 addr, u8 val)
 
int rts51x_read_phy_register (struct rts51x_chip *chip, u8 addr, u8 *val)
 
void rts51x_do_before_power_down (struct rts51x_chip *chip)
 
void rts51x_clear_hw_error (struct rts51x_chip *chip)
 
void rts51x_prepare_run (struct rts51x_chip *chip)
 
void rts51x_trace_msg (struct rts51x_chip *chip, unsigned char *buf, int clear)
 
void rts51x_pp_status (struct rts51x_chip *chip, unsigned int lun, u8 *status, u8 status_len)
 
void rts51x_read_status (struct rts51x_chip *chip, unsigned int lun, u8 *rts51x_status, u8 status_len)
 
int rts51x_transfer_data_rcc (struct rts51x_chip *chip, unsigned int pipe, void *buf, unsigned int len, int use_sg, unsigned int *act_len, int timeout, u8 stage_flag)
 

Macro Definition Documentation

#define ASC_INVLD_CDB   0x24

Definition at line 213 of file rts51x_chip.h.

#define ASCQ_INVLD_CDB   0x00

Definition at line 216 of file rts51x_chip.h.

#define BATCH_CMD   0

Definition at line 100 of file rts51x_chip.h.

#define CDB_ILLEGAL   0x40

Definition at line 210 of file rts51x_chip.h.

#define CHECK_PID (   chip,
  pid 
)    (RTS51X_GET_PID(chip) == (pid))

Definition at line 742 of file rts51x_chip.h.

#define CHECK_PKG (   chip,
  pkg 
)    ((chip)->package == (pkg))

Definition at line 743 of file rts51x_chip.h.

#define CHECK_REG_CMD   2

Definition at line 91 of file rts51x_chip.h.

#define CHECK_UHS50 (   chip)    (((chip)->uhs50_mmc44_en&0xff) == UHS50_EN)

Definition at line 727 of file rts51x_chip.h.

#define CHECK_USB (   chip,
  speed 
)    ((chip)->usb_speed == (speed))

Definition at line 744 of file rts51x_chip.h.

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

Definition at line 86 of file rts51x_chip.h.

#define CHK_FORMAT_STATUS (   ms_card,
  status 
)    ((ms_card)->format_status == (status))

Definition at line 625 of file rts51x_chip.h.

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

Definition at line 557 of file rts51x_chip.h.

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

Definition at line 441 of file rts51x_chip.h.

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

Definition at line 443 of file rts51x_chip.h.

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

Definition at line 447 of file rts51x_chip.h.

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

Definition at line 445 of file rts51x_chip.h.

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

Definition at line 449 of file rts51x_chip.h.

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

Definition at line 453 of file rts51x_chip.h.

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

Definition at line 471 of file rts51x_chip.h.

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

Definition at line 451 of file rts51x_chip.h.

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

Definition at line 565 of file rts51x_chip.h.

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

Definition at line 564 of file rts51x_chip.h.

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

Definition at line 561 of file rts51x_chip.h.

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

Definition at line 555 of file rts51x_chip.h.

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

Definition at line 559 of file rts51x_chip.h.

#define CHK_RETRY_SD20_MODE (   sd_card)    ((sd_card)->retry_SD20_mode == 1)

Definition at line 499 of file rts51x_chip.h.

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

Definition at line 410 of file rts51x_chip.h.

#define CHK_SD30_SPEED (   sd_card)
Value:
(CHK_SD_SDR50(sd_card) || CHK_SD_DDR50(sd_card) ||\
CHK_SD_SDR104(sd_card))

Definition at line 421 of file rts51x_chip.h.

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

Definition at line 415 of file rts51x_chip.h.

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

Definition at line 419 of file rts51x_chip.h.

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

Definition at line 411 of file rts51x_chip.h.

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

Definition at line 417 of file rts51x_chip.h.

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

Definition at line 413 of file rts51x_chip.h.

#define CLEAR_UHS50 (   chip)    ((chip)->uhs50_mmc44_en = UHS50_DIS)

Definition at line 726 of file rts51x_chip.h.

#define CLOSE_SSC_POWER

Definition at line 56 of file rts51x_chip.h.

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

Definition at line 85 of file rts51x_chip.h.

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

Definition at line 464 of file rts51x_chip.h.

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

Definition at line 466 of file rts51x_chip.h.

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

Definition at line 465 of file rts51x_chip.h.

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

Definition at line 467 of file rts51x_chip.h.

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

Definition at line 469 of file rts51x_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 473 of file rts51x_chip.h.

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

Definition at line 468 of file rts51x_chip.h.

#define CLR_RETRY_SD20_MODE (   sd_card)    ((sd_card)->retry_SD20_mode = 0)

Definition at line 495 of file rts51x_chip.h.

#define CLR_SD30_SPEED (   sd_card)    ((sd_card)->sd_type &= ~(SD_SDR50|SD_DDR50|SD_SDR104))

Definition at line 437 of file rts51x_chip.h.

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

Definition at line 434 of file rts51x_chip.h.

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

Definition at line 436 of file rts51x_chip.h.

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

Definition at line 432 of file rts51x_chip.h.

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

Definition at line 435 of file rts51x_chip.h.

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

Definition at line 433 of file rts51x_chip.h.

#define CMD_BUF_LEN   1024

Definition at line 77 of file rts51x_chip.h.

#define CMD_OFFSET   8

Definition at line 97 of file rts51x_chip.h.

#define CNT_H   5

Definition at line 94 of file rts51x_chip.h.

#define CNT_L   6

Definition at line 95 of file rts51x_chip.h.

#define CUR_ERR   0x70 /* current error */

Definition at line 205 of file rts51x_chip.h.

#define GET_CARD_STATUS_USING_EPC

Definition at line 54 of file rts51x_chip.h.

#define HG8BIT   (MS_HG | MS_8BIT)

Definition at line 553 of file rts51x_chip.h.

#define IDLE_MAX_COUNT   10

Definition at line 131 of file rts51x_chip.h.

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

Definition at line 198 of file rts51x_chip.h.

#define LED_GPIO   0

Definition at line 133 of file rts51x_chip.h.

#define LQFP48   1

Definition at line 137 of file rts51x_chip.h.

#define MAX_ALLOWED_LUN_CNT   8

Definition at line 76 of file rts51x_chip.h.

#define MAX_DEFECTIVE_BLOCK   10

Definition at line 348 of file rts51x_chip.h.

#define MMC_26M   0x0100

Definition at line 402 of file rts51x_chip.h.

#define MMC_4BIT   0x0400

Definition at line 404 of file rts51x_chip.h.

#define MMC_52M   0x0200

Definition at line 403 of file rts51x_chip.h.

#define MMC_8BIT   0x0800

Definition at line 405 of file rts51x_chip.h.

#define MMC_DDR52   0x2000

Definition at line 407 of file rts51x_chip.h.

#define MMC_DDR_TX_PHASE_SET_BY_USER   0x20

Definition at line 250 of file rts51x_chip.h.

#define MMC_SECTOR_MODE   0x1000

Definition at line 406 of file rts51x_chip.h.

#define MODE_2K_SEQ   0x02

Definition at line 543 of file rts51x_chip.h.

#define MODE_512_SEQ   0x01

Definition at line 542 of file rts51x_chip.h.

#define MODE_C   0x00

Definition at line 113 of file rts51x_chip.h.

#define MODE_CDIR   (STAGE_R | STAGE_DI)

Definition at line 115 of file rts51x_chip.h.

#define MODE_CDOR   (STAGE_R | STAGE_DO)

Definition at line 116 of file rts51x_chip.h.

#define MODE_CR   (STAGE_R)

Definition at line 114 of file rts51x_chip.h.

#define MS_4BIT   0x0100

Definition at line 548 of file rts51x_chip.h.

#define MS_8BIT   0x0200

Definition at line 549 of file rts51x_chip.h.

#define MS_CARD   (1 << MS_NR)

Definition at line 68 of file rts51x_chip.h.

#define MS_CD   0x02

Definition at line 72 of file rts51x_chip.h.

#define MS_FORMATTER_ENABLED (   chip)    ((chip)->option.mspro_formatter_enable)

Definition at line 340 of file rts51x_chip.h.

#define MS_FREE_TABLE_CNT   512

Definition at line 81 of file rts51x_chip.h.

#define MS_HG   0x0400

Definition at line 550 of file rts51x_chip.h.

#define MS_NR   3

Definition at line 65 of file rts51x_chip.h.

#define MS_SPEEDUP

Definition at line 60 of file rts51x_chip.h.

#define MS_XC   0x0800

Definition at line 551 of file rts51x_chip.h.

#define MSG_FILE_LEN   32

Definition at line 163 of file rts51x_chip.h.

#define MSG_FUNC_LEN   64

Definition at line 161 of file rts51x_chip.h.

#define PACKET_TYPE   4

Definition at line 93 of file rts51x_chip.h.

#define POLLING_INTERVAL   50 /* 50ms */

Definition at line 78 of file rts51x_chip.h.

#define POLLING_WAIT_CNT   1

Definition at line 132 of file rts51x_chip.h.

#define PRO_UNDER_FORMATTING (   ms_card)    ((ms_card)->pro_under_formatting)

Definition at line 621 of file rts51x_chip.h.

#define QFN24   0

Definition at line 136 of file rts51x_chip.h.

#define READ_REG_CMD   0

Definition at line 89 of file rts51x_chip.h.

#define RTS51X_CHK_STAT (   chip,
  stat 
)    ((chip)->chip_stat == (stat))

Definition at line 739 of file rts51x_chip.h.

#define RTS51X_GET_PID (   chip)    ((chip)->product_id)

Definition at line 730 of file rts51x_chip.h.

#define RTS51X_GET_STAT (   chip)    ((chip)->chip_stat)

Definition at line 740 of file rts51x_chip.h.

#define RTS51X_GET_VID (   chip)    ((chip)->vendor_id)

Definition at line 729 of file rts51x_chip.h.

#define RTS51X_READ_REG (   chip,
  addr,
  data 
)
Value:
do { \
int _retval = rts51x_read_register((chip), \
(addr), (data)); \
if (_retval != STATUS_SUCCESS) { \
TRACE_RET((chip), _retval); \
} \
} while (0)

Definition at line 812 of file rts51x_chip.h.

#define RTS51X_SET_STAT (   chip,
  stat 
)
Value:
do { \
if ((stat) != STAT_IDLE) { \
(chip)->idle_counter = 0; \
} \
(chip)->chip_stat = (enum CHIP_STAT)(stat); \
} while (0)

Definition at line 732 of file rts51x_chip.h.

#define RTS51X_WRITE_REG (   chip,
  addr,
  mask,
  data 
)
Value:
do { \
int _retval = rts51x_write_register((chip), \
(addr), (mask), (data)); \
if (_retval != STATUS_SUCCESS) { \
TRACE_RET((chip), _retval); \
} \
} while (0)

Definition at line 803 of file rts51x_chip.h.

#define SD_CARD   (1 << SD_NR)

Definition at line 67 of file rts51x_chip.h.

#define SD_CD   0x01

Definition at line 71 of file rts51x_chip.h.

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

Definition at line 491 of file rts51x_chip.h.

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

Definition at line 485 of file rts51x_chip.h.

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

Definition at line 493 of file rts51x_chip.h.

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

Definition at line 487 of file rts51x_chip.h.

#define SD_DDR50   0x0400

Definition at line 397 of file rts51x_chip.h.

#define SD_DDR_TX_PHASE_SET_BY_USER   0x10

Definition at line 248 of file rts51x_chip.h.

#define SD_HCXC   0x1000

Definition at line 399 of file rts51x_chip.h.

#define SD_HS   0x0100

Definition at line 395 of file rts51x_chip.h.

#define SD_NR   2

Definition at line 64 of file rts51x_chip.h.

#define SD_PUSH_POINT_AUTO   0x02

Definition at line 242 of file rts51x_chip.h.

#define SD_PUSH_POINT_CTL_MASK   0x03

Definition at line 240 of file rts51x_chip.h.

#define SD_PUSH_POINT_DELAY   0x01

Definition at line 241 of file rts51x_chip.h.

#define SD_SAMPLE_POINT_AUTO   0x08

Definition at line 246 of file rts51x_chip.h.

#define SD_SAMPLE_POINT_CTL_MASK   0x0C

Definition at line 244 of file rts51x_chip.h.

#define SD_SAMPLE_POINT_DELAY   0x04

Definition at line 245 of file rts51x_chip.h.

#define SD_SDR104   0x0800

Definition at line 398 of file rts51x_chip.h.

#define SD_SDR50   0x0200

Definition at line 396 of file rts51x_chip.h.

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

Definition at line 489 of file rts51x_chip.h.

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

Definition at line 483 of file rts51x_chip.h.

#define SD_SUPPORT_1V8   0x02

Definition at line 481 of file rts51x_chip.h.

#define SD_SUPPORT_CLASS_TEN   0x01

Definition at line 480 of file rts51x_chip.h.

#define SD_WP   0x08

Definition at line 74 of file rts51x_chip.h.

#define SD_XD_IO_FOLLOW_PWR

Definition at line 62 of file rts51x_chip.h.

#define SENSE_SIZE   18

Definition at line 173 of file rts51x_chip.h.

#define SENSE_TYPE_FORMAT_CMD_FAILED   10

Definition at line 185 of file rts51x_chip.h.

#define SENSE_TYPE_MEDIA_CHANGE   1

Definition at line 177 of file rts51x_chip.h.

#define SENSE_TYPE_MEDIA_INVALID_CMD_FIELD   6

Definition at line 182 of file rts51x_chip.h.

#define SENSE_TYPE_MEDIA_LBA_OVER_RANGE   3

Definition at line 179 of file rts51x_chip.h.

#define SENSE_TYPE_MEDIA_LUN_NOT_SUPPORT   4

Definition at line 180 of file rts51x_chip.h.

#define SENSE_TYPE_MEDIA_NOT_PRESENT   2

Definition at line 178 of file rts51x_chip.h.

#define SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR   7

Definition at line 183 of file rts51x_chip.h.

#define SENSE_TYPE_MEDIA_WRITE_ERR   8

Definition at line 184 of file rts51x_chip.h.

#define SENSE_TYPE_MEDIA_WRITE_PROTECT   5

Definition at line 181 of file rts51x_chip.h.

#define SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM   0x0d

Definition at line 192 of file rts51x_chip.h.

#define SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN   0x0c

Definition at line 190 of file rts51x_chip.h.

#define SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB   0x0b

Definition at line 188 of file rts51x_chip.h.

#define SENSE_TYPE_MG_WRITE_ERR   0x0e

Definition at line 194 of file rts51x_chip.h.

#define SENSE_TYPE_NO_SENSE   0

Definition at line 176 of file rts51x_chip.h.

#define SEQ_READ   1

Definition at line 101 of file rts51x_chip.h.

#define SEQ_WRITE   2

Definition at line 102 of file rts51x_chip.h.

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

Definition at line 84 of file rts51x_chip.h.

#define SET_FORMAT_STATUS (   ms_card,
  status 
)    ((ms_card)->format_status = (status))

Definition at line 623 of file rts51x_chip.h.

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

Definition at line 456 of file rts51x_chip.h.

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

Definition at line 457 of file rts51x_chip.h.

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

Definition at line 459 of file rts51x_chip.h.

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

Definition at line 458 of file rts51x_chip.h.

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

Definition at line 460 of file rts51x_chip.h.

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

Definition at line 462 of file rts51x_chip.h.

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

Definition at line 461 of file rts51x_chip.h.

#define SET_RETRY_SD20_MODE (   sd_card)    ((sd_card)->retry_SD20_mode = 1)

Definition at line 497 of file rts51x_chip.h.

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

Definition at line 425 of file rts51x_chip.h.

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

Definition at line 428 of file rts51x_chip.h.

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

Definition at line 430 of file rts51x_chip.h.

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

Definition at line 426 of file rts51x_chip.h.

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

Definition at line 429 of file rts51x_chip.h.

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

Definition at line 427 of file rts51x_chip.h.

#define SET_UHS50 (   chip)    ((chip)->uhs50_mmc44_en = UHS50_EN)

Definition at line 725 of file rts51x_chip.h.

#define SKSV   0x80

Definition at line 209 of file rts51x_chip.h.

#define STAGE_DI   0x02

Definition at line 106 of file rts51x_chip.h.

#define STAGE_DO   0x04

Definition at line 107 of file rts51x_chip.h.

#define STAGE_FLAG   7

Definition at line 96 of file rts51x_chip.h.

#define STAGE_MS_STATUS   0x08

Definition at line 109 of file rts51x_chip.h.

#define STAGE_R   0x01

Definition at line 105 of file rts51x_chip.h.

#define STAGE_XD_STATUS   0x10

Definition at line 111 of file rts51x_chip.h.

#define STATUS_ERROR   10

Definition at line 129 of file rts51x_chip.h.

#define STATUS_FAIL   1

Definition at line 123 of file rts51x_chip.h.

#define STATUS_NOMEM   5

Definition at line 125 of file rts51x_chip.h.

#define STATUS_STALLED   8

Definition at line 128 of file rts51x_chip.h.

#define STATUS_SUCCESS   0

Definition at line 120 of file rts51x_chip.h.

#define STATUS_TIMEDOUT   4

Definition at line 124 of file rts51x_chip.h.

#define STATUS_TRANS_LONG   7

Definition at line 127 of file rts51x_chip.h.

#define STATUS_TRANS_SHORT   6

Definition at line 126 of file rts51x_chip.h.

#define SUPPORT_CPRM

Definition at line 39 of file rts51x_chip.h.

#define SUPPORT_MAGIC_GATE

Definition at line 40 of file rts51x_chip.h.

#define SUPPORT_MSXC

Definition at line 41 of file rts51x_chip.h.

#define SUPPORT_OCP

Definition at line 58 of file rts51x_chip.h.

#define SUPPORT_PCGL_1P18

Definition at line 51 of file rts51x_chip.h.

#define SUPPORT_UHS50_MMC44   0x40

Definition at line 253 of file rts51x_chip.h.

#define TIME_VAL_LEN   16

Definition at line 165 of file rts51x_chip.h.

#define TRACE_ITEM_CNT   64

Definition at line 157 of file rts51x_chip.h.

#define TRANSPORT_ERROR   3

Definition at line 150 of file rts51x_chip.h.

#define TRANSPORT_FAILED   1

Definition at line 148 of file rts51x_chip.h.

#define TRANSPORT_GOOD   0

Definition at line 146 of file rts51x_chip.h.

#define TYPE_MMC   0x0001

Definition at line 392 of file rts51x_chip.h.

#define TYPE_MS   0x0000

Definition at line 545 of file rts51x_chip.h.

#define TYPE_MSPRO   0x0001

Definition at line 546 of file rts51x_chip.h.

#define TYPE_SD   0x0000

Definition at line 391 of file rts51x_chip.h.

#define UHS50_DIS   0x0000

Definition at line 724 of file rts51x_chip.h.

#define UHS50_EN   0x0001

Definition at line 723 of file rts51x_chip.h.

#define USB_11   0

Definition at line 139 of file rts51x_chip.h.

#define USB_20   1

Definition at line 140 of file rts51x_chip.h.

#define USING_POLLING_CYCLE_DELINK

Definition at line 42 of file rts51x_chip.h.

#define WRITE_REG_CMD   1

Definition at line 90 of file rts51x_chip.h.

#define XC_POWERCLASS

Definition at line 50 of file rts51x_chip.h.

#define XD_CARD   (1 << XD_NR)

Definition at line 69 of file rts51x_chip.h.

#define XD_CD   0x04

Definition at line 73 of file rts51x_chip.h.

#define XD_FREE_TABLE_CNT   1200

Definition at line 80 of file rts51x_chip.h.

#define XD_NR   4

Definition at line 66 of file rts51x_chip.h.

Typedef Documentation

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

Definition at line 344 of file rts51x_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 153 of file rts51x_chip.h.

enum CHIP_STAT
Enumerator:
STAT_INIT 
STAT_IDLE 
STAT_RUN 
STAT_SS_PRE 
STAT_SS 
STAT_SUSPEND 

Definition at line 630 of file rts51x_chip.h.

Function Documentation

void rts51x_add_cmd ( struct rts51x_chip chip,
u8  cmd_type,
u16  reg_addr,
u8  mask,
u8  data 
)

Definition at line 372 of file rts51x_chip.c.

void rts51x_clear_hw_error ( struct rts51x_chip chip)

Definition at line 730 of file rts51x_chip.c.

void rts51x_do_before_power_down ( struct rts51x_chip chip)

Definition at line 700 of file rts51x_chip.c.

int rts51x_ep0_read_register ( struct rts51x_chip chip,
u16  addr,
u8 data 
)

Definition at line 504 of file rts51x_chip.c.

int rts51x_ep0_write_register ( struct rts51x_chip chip,
u16  addr,
u8  mask,
u8  data 
)

Definition at line 484 of file rts51x_chip.c.

int rts51x_get_card_status ( struct rts51x_chip chip,
u16 status 
)

Definition at line 425 of file rts51x_chip.c.

int rts51x_get_rsp ( struct rts51x_chip chip,
int  rsp_len,
int  timeout 
)

Definition at line 406 of file rts51x_chip.c.

int rts51x_init_chip ( struct rts51x_chip chip)

Definition at line 142 of file rts51x_chip.c.

void rts51x_polling_func ( struct rts51x_chip chip)

Definition at line 294 of file rts51x_chip.c.

void rts51x_pp_status ( struct rts51x_chip chip,
unsigned int  lun,
u8 status,
u8  status_len 
)

Definition at line 795 of file rts51x_chip.c.

void rts51x_prepare_run ( struct rts51x_chip chip)

Definition at line 735 of file rts51x_chip.c.

int rts51x_read_phy_register ( struct rts51x_chip chip,
u8  addr,
u8 val 
)

Definition at line 660 of file rts51x_chip.c.

int rts51x_read_ppbuf ( struct rts51x_chip chip,
u8 buf,
int  buf_len 
)

Definition at line 604 of file rts51x_chip.c.

int rts51x_read_register ( struct rts51x_chip chip,
u16  addr,
u8 data 
)

Definition at line 461 of file rts51x_chip.c.

void rts51x_read_status ( struct rts51x_chip chip,
unsigned int  lun,
u8 rts51x_status,
u8  status_len 
)

Definition at line 905 of file rts51x_chip.c.

int rts51x_release_chip ( struct rts51x_chip chip)

Definition at line 213 of file rts51x_chip.c.

int rts51x_reset_chip ( struct rts51x_chip chip)

Definition at line 57 of file rts51x_chip.c.

int rts51x_send_cmd ( struct rts51x_chip chip,
u8  flag,
int  timeout 
)

Definition at line 388 of file rts51x_chip.c.

int rts51x_seq_read_register ( struct rts51x_chip chip,
u16  addr,
u16  len,
u8 data 
)

Definition at line 564 of file rts51x_chip.c.

int rts51x_seq_write_register ( struct rts51x_chip chip,
u16  addr,
u16  len,
u8 data 
)

Definition at line 527 of file rts51x_chip.c.

void rts51x_trace_msg ( struct rts51x_chip chip,
unsigned char buf,
int  clear 
)

Definition at line 750 of file rts51x_chip.c.

int rts51x_transfer_data_rcc ( struct rts51x_chip chip,
unsigned int  pipe,
void buf,
unsigned int  len,
int  use_sg,
unsigned int act_len,
int  timeout,
u8  stage_flag 
)

Definition at line 1002 of file rts51x_chip.c.

int rts51x_write_phy_register ( struct rts51x_chip chip,
u8  addr,
u8  val 
)

Definition at line 634 of file rts51x_chip.c.

int rts51x_write_ppbuf ( struct rts51x_chip chip,
u8 buf,
int  buf_len 
)

Definition at line 619 of file rts51x_chip.c.

int rts51x_write_register ( struct rts51x_chip chip,
u16  addr,
u8  mask,
u8  data 
)

Definition at line 448 of file rts51x_chip.c.