Skip to content

Commit

Permalink
staging: rts5139: remove disabled SUPPORT_SD_LOCK code.
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksij Rempel <bug-track@fisher-privat.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Oleksij Rempel authored and Greg Kroah-Hartman committed May 9, 2012
1 parent 3d2b3aa commit a7f6251
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 434 deletions.
51 changes: 0 additions & 51 deletions drivers/staging/rts5139/rts51x_chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,33 +300,6 @@ static void rts51x_auto_delink(struct rts51x_chip *chip)

void rts51x_polling_func(struct rts51x_chip *chip)
{
#ifdef SUPPORT_SD_LOCK
struct sd_info *sd_card = &(chip->sd_card);

if (sd_card->sd_erase_status) {
if (chip->card_exist & SD_CARD) {
u8 val;
rts51x_read_register(chip, SD_BUS_STAT, &val);
if (val & SD_DAT0_STATUS) {
/* Erase completed */
sd_card->sd_erase_status = SD_NOT_ERASE;
sd_card->sd_lock_notify = 1;

/* SD card should be reinited,
* so we release it here. */
sd_cleanup_work(chip);
release_sd_card(chip);
chip->card_ready &= ~SD_CARD;
chip->card_exist &= ~SD_CARD;
chip->rw_card[chip->card2lun[SD_CARD]] = NULL;
clear_bit(chip->card2lun[SD_CARD],
&(chip->lun_mc));
}
} else {
sd_card->sd_erase_status = SD_NOT_ERASE;
}
}
#endif

rts51x_init_cards(chip);

Expand Down Expand Up @@ -923,24 +896,6 @@ void rts51x_pp_status(struct rts51x_chip *chip, unsigned int lun, u8 *status,
status[0x0F] = 0x00;
}
}
#ifdef SUPPORT_SD_LOCK
/* SD Lock/Unlock */
if (card == SD_CARD) {
status[0x17] = 0x80;
if (sd_card->sd_erase_status)
status[0x17] |= 0x01; /* Under erasing */
if (sd_card->sd_lock_status & SD_LOCKED) {
status[0x17] |= 0x02; /* Locked */
status[0x07] |= 0x40; /* Read protected */
}
if (sd_card->sd_lock_status & SD_PWD_EXIST)
status[0x17] |= 0x04; /* Contain PWD */
} else {
status[0x17] = 0x00;
}

RTS51X_DEBUGP("status[0x17] = 0x%x\n", status[0x17]);
#endif

/* Function 0
* Support Magic Gate, CPRM and PhyRegister R/W */
Expand All @@ -950,12 +905,6 @@ void rts51x_pp_status(struct rts51x_chip *chip, unsigned int lun, u8 *status,
* Support OC LUN status & WP LUN status */
status[0x1A] = 0x28;

/* Function 7 */
#ifdef SUPPORT_SD_LOCK
/* Support SD Lock/Unlock */
status[0x1F] = 0x01;
#endif

/* Function 2
* Support OC LUN status & WP LUN status */
status[0x1A] = 0x28;
Expand Down
13 changes: 0 additions & 13 deletions drivers/staging/rts5139/rts51x_chip.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
#define SUPPORT_CPRM
#define SUPPORT_MAGIC_GATE
#define SUPPORT_MSXC
/* { wwang, 2010-07-26
* Add support for SD lock/unlock */
/* #define SUPPORT_SD_LOCK */
/* } wwang, 2010-07-26 */

#ifdef SUPPORT_MAGIC_GA
/* Using NORMAL_WRITE instead of AUTO_WRITE to set ICVTE */
Expand Down Expand Up @@ -205,10 +201,6 @@ struct trace_msg_t {
/* WRITE ERROR */
#define SENSE_TYPE_MG_WRITE_ERR 0x0e
#endif
#ifdef SUPPORT_SD_LOCK
/* FOR Locked SD card */
#define SENSE_TYPE_MEDIA_READ_FORBIDDEN 0x10
#endif

/*---- sense key ----*/
#define ILI 0x20 /* ILI bit is on */
Expand Down Expand Up @@ -612,11 +604,6 @@ struct sd_info {
u8 sd_reset_fail; /* sangdy2010-07-01 */
u8 sd_send_status_en;

#ifdef SUPPORT_SD_LOCK
u8 sd_lock_status;
u8 sd_erase_status;
u8 sd_lock_notify;
#endif
};

#define MODE_512_SEQ 0x01
Expand Down
62 changes: 0 additions & 62 deletions drivers/staging/rts5139/rts51x_scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,12 +396,6 @@ void set_sense_type(struct rts51x_chip *chip, unsigned int lun, int sense_type)
break;
#endif

#ifdef SUPPORT_SD_LOCK
case SENSE_TYPE_MEDIA_READ_FORBIDDEN:
set_sense_data(chip, lun, CUR_ERR, 0x07, 0, 0x11, 0x13, 0, 0);
break;
#endif

case SENSE_TYPE_NO_SENSE:
default:
set_sense_data(chip, lun, CUR_ERR, 0, 0, 0, 0, 0, 0);
Expand Down Expand Up @@ -448,20 +442,6 @@ static int test_unit_ready(struct scsi_cmnd *srb, struct rts51x_chip *chip)
set_sense_type(chip, lun, SENSE_TYPE_MEDIA_CHANGE);
return TRANSPORT_FAILED;
}
#ifdef SUPPORT_SD_LOCK
if (get_lun_card(chip, SCSI_LUN(srb)) == SD_CARD) {
struct sd_info *sd_card = &(chip->sd_card);
if (sd_card->sd_lock_notify) {
sd_card->sd_lock_notify = 0;
set_sense_type(chip, lun, SENSE_TYPE_MEDIA_CHANGE);
return TRANSPORT_FAILED;
} else if (sd_card->sd_lock_status & SD_LOCKED) {
set_sense_type(chip, lun,
SENSE_TYPE_MEDIA_READ_FORBIDDEN);
return TRANSPORT_FAILED;
}
}
#endif

return TRANSPORT_GOOD;
}
Expand Down Expand Up @@ -797,9 +777,6 @@ static int request_sense(struct scsi_cmnd *srb, struct rts51x_chip *chip)

static int read_write(struct scsi_cmnd *srb, struct rts51x_chip *chip)
{
#ifdef SUPPORT_SD_LOCK
struct sd_info *sd_card = &(chip->sd_card);
#endif
unsigned int lun = SCSI_LUN(srb);
int retval;
u32 start_sec;
Expand All @@ -819,25 +796,6 @@ static int read_write(struct scsi_cmnd *srb, struct rts51x_chip *chip)
rts51x_prepare_run(chip);
RTS51X_SET_STAT(chip, STAT_RUN);

#ifdef SUPPORT_SD_LOCK
if (sd_card->sd_erase_status) {
/* Accessing to any card is forbidden
* until the erase procedure of SD is completed */
RTS51X_DEBUGP("SD card being erased!\n");
set_sense_type(chip, lun, SENSE_TYPE_MEDIA_READ_FORBIDDEN);
TRACE_RET(chip, TRANSPORT_FAILED);
}

if (get_lun_card(chip, lun) == SD_CARD) {
if (sd_card->sd_lock_status & SD_LOCKED) {
RTS51X_DEBUGP("SD card locked!\n");
set_sense_type(chip, lun,
SENSE_TYPE_MEDIA_READ_FORBIDDEN);
TRACE_RET(chip, TRANSPORT_FAILED);
}
}
#endif

if ((srb->cmnd[0] == READ_10) || (srb->cmnd[0] == WRITE_10)) {
start_sec =
((u32) srb->cmnd[2] << 24) |
Expand Down Expand Up @@ -1863,30 +1821,10 @@ int mg_send_key(struct scsi_cmnd *srb, struct rts51x_chip *chip)

int rts51x_scsi_handler(struct scsi_cmnd *srb, struct rts51x_chip *chip)
{
#ifdef SUPPORT_SD_LOCK
struct sd_info *sd_card = &(chip->sd_card);
#endif
struct ms_info *ms_card = &(chip->ms_card);
unsigned int lun = SCSI_LUN(srb);
int result = TRANSPORT_GOOD;

#ifdef SUPPORT_SD_LOCK
if (sd_card->sd_erase_status) {
/* Block all SCSI command except for REQUEST_SENSE
* and rs_ppstatus */
if (!
((srb->cmnd[0] == VENDOR_CMND)
&& (srb->cmnd[1] == SCSI_APP_CMD)
&& (srb->cmnd[2] == GET_DEV_STATUS))
&& (srb->cmnd[0] != REQUEST_SENSE)) {
/* Logical Unit Not Ready Format in Progress */
set_sense_data(chip, lun, CUR_ERR, 0x02, 0, 0x04, 0x04,
0, 0);
TRACE_RET(chip, TRANSPORT_FAILED);
}
}
#endif

if ((get_lun_card(chip, lun) == MS_CARD) &&
(ms_card->format_status == FORMAT_IN_PROGRESS)) {
if ((srb->cmnd[0] != REQUEST_SENSE)
Expand Down
Loading

0 comments on commit a7f6251

Please sign in to comment.