#include <linux/blkdev.h>
#include <linux/kthread.h>
#include <linux/sched.h>
#include <linux/workqueue.h>
#include <linux/kernel.h>
#include "rtsx.h"
#include "sd.h"
#include "xd.h"
#include "ms.h"
void do_remaining_work(struct rtsx_chip *chip)
{ … }
void try_to_switch_sdio_ctrl(struct rtsx_chip *chip)
{ … }
#ifdef SUPPORT_SDIO_ASPM
void dynamic_configure_sdio_aspm(struct rtsx_chip *chip)
{ … }
#endif
void do_reset_sd_card(struct rtsx_chip *chip)
{ … }
void do_reset_xd_card(struct rtsx_chip *chip)
{ … }
void do_reset_ms_card(struct rtsx_chip *chip)
{ … }
static void release_sdio(struct rtsx_chip *chip)
{ … }
void rtsx_power_off_card(struct rtsx_chip *chip)
{ … }
void rtsx_release_cards(struct rtsx_chip *chip)
{ … }
void rtsx_reset_cards(struct rtsx_chip *chip)
{ … }
void rtsx_reinit_cards(struct rtsx_chip *chip, int reset_chip)
{ … }
#ifdef DISABLE_CARD_INT
void card_cd_debounce(struct rtsx_chip *chip, unsigned long *need_reset,
unsigned long *need_release)
{
u8 release_map = 0, reset_map = 0;
chip->int_reg = rtsx_readl(chip, RTSX_BIPR);
if (chip->card_exist) {
if (chip->card_exist & XD_CARD) {
if (!(chip->int_reg & XD_EXIST))
release_map |= XD_CARD;
} else if (chip->card_exist & SD_CARD) {
if (!(chip->int_reg & SD_EXIST))
release_map |= SD_CARD;
} else if (chip->card_exist & MS_CARD) {
if (!(chip->int_reg & MS_EXIST))
release_map |= MS_CARD;
}
} else {
if (chip->int_reg & XD_EXIST)
reset_map |= XD_CARD;
else if (chip->int_reg & SD_EXIST)
reset_map |= SD_CARD;
else if (chip->int_reg & MS_EXIST)
reset_map |= MS_CARD;
}
if (reset_map) {
int xd_cnt = 0, sd_cnt = 0, ms_cnt = 0;
int i;
for (i = 0; i < (DEBOUNCE_CNT); i++) {
chip->int_reg = rtsx_readl(chip, RTSX_BIPR);
if (chip->int_reg & XD_EXIST)
xd_cnt++;
else
xd_cnt = 0;
if (chip->int_reg & SD_EXIST)
sd_cnt++;
else
sd_cnt = 0;
if (chip->int_reg & MS_EXIST)
ms_cnt++;
else
ms_cnt = 0;
wait_timeout(30);
}
reset_map = 0;
if (!(chip->card_exist & XD_CARD) &&
(xd_cnt > (DEBOUNCE_CNT - 1)))
reset_map |= XD_CARD;
if (!(chip->card_exist & SD_CARD) &&
(sd_cnt > (DEBOUNCE_CNT - 1)))
reset_map |= SD_CARD;
if (!(chip->card_exist & MS_CARD) &&
(ms_cnt > (DEBOUNCE_CNT - 1)))
reset_map |= MS_CARD;
}
if (CHECK_PID(chip, 0x5288) && CHECK_BARO_PKG(chip, QFN))
rtsx_write_register(chip, HOST_SLEEP_STATE, 0xC0, 0x00);
if (need_reset)
*need_reset = reset_map;
if (need_release)
*need_release = release_map;
}
#endif
void rtsx_init_cards(struct rtsx_chip *chip)
{ … }
int switch_ssc_clock(struct rtsx_chip *chip, int clk)
{ … }
int switch_normal_clock(struct rtsx_chip *chip, int clk)
{ … }
void trans_dma_enable(enum dma_data_direction dir, struct rtsx_chip *chip,
u32 byte_cnt, u8 pack_size)
{ … }
int enable_card_clock(struct rtsx_chip *chip, u8 card)
{ … }
int disable_card_clock(struct rtsx_chip *chip, u8 card)
{ … }
int card_power_on(struct rtsx_chip *chip, u8 card)
{ … }
int card_power_off(struct rtsx_chip *chip, u8 card)
{ … }
int card_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip,
u32 sec_addr, u16 sec_cnt)
{ … }
int card_share_mode(struct rtsx_chip *chip, int card)
{ … }
int select_card(struct rtsx_chip *chip, int card)
{ … }
void toggle_gpio(struct rtsx_chip *chip, u8 gpio)
{ … }
void turn_on_led(struct rtsx_chip *chip, u8 gpio)
{ … }
void turn_off_led(struct rtsx_chip *chip, u8 gpio)
{ … }
int detect_card_cd(struct rtsx_chip *chip, int card)
{ … }
int check_card_exist(struct rtsx_chip *chip, unsigned int lun)
{ … }
int check_card_ready(struct rtsx_chip *chip, unsigned int lun)
{ … }
int check_card_wp(struct rtsx_chip *chip, unsigned int lun)
{ … }
u8 get_lun_card(struct rtsx_chip *chip, unsigned int lun)
{ … }
void eject_card(struct rtsx_chip *chip, unsigned int lun)
{ … }