Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 236297
b: refs/heads/master
c: 41e568d
h: refs/heads/master
i:
  236295: 64ab605
v: v3
  • Loading branch information
huajun li authored and Greg Kroah-Hartman committed Mar 7, 2011
1 parent 9afe6fc commit 72a26b5
Show file tree
Hide file tree
Showing 14 changed files with 877 additions and 1,113 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 153775d94899503f5f66baaa9751a43c74d4f371
refs/heads/master: 41e568d14ec0aca1b2bb19563517aad3b06d6805
5 changes: 3 additions & 2 deletions trunk/drivers/staging/keucr/Kconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
config USB_ENESTORAGE
tristate "USB ENE card reader support"
tristate "USB ENE SM/MS card reader support"
depends on USB && SCSI && m
---help---
Say Y here if you wish to control a ENE Card reader.
Say Y here if you wish to control a ENE SM/MS Card reader.
To use SD card, please build driver/usb/storage/ums-eneub6250.ko

This option depends on 'SCSI' support being enabled, but you
probably also need 'SCSI device support: SCSI disk support'
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/staging/keucr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ keucr-y := \
scsiglue.o \
transport.o \
init.o \
sdscsi.o \
msscsi.o \
ms.o \
smscsi.o \
Expand Down
122 changes: 3 additions & 119 deletions trunk/drivers/staging/keucr/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ int ENE_InitMedia(struct us_data *us)
}
printk(KERN_INFO "MiscReg03 = %x\n", MiscReg03);

if (MiscReg03 & 0x01) {
if (!us->SD_Status.Ready) {
result = ENE_SDInit(us);
if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR;
}
}

if (MiscReg03 & 0x02) {
if (!us->SM_Status.Ready && !us->MS_Status.Ready) {
result = ENE_SMInit(us);
Expand Down Expand Up @@ -72,69 +64,6 @@ int ENE_Read_BYTE(struct us_data *us, WORD index, void *buf)
return result;
}

/*
* ENE_SDInit():
*/
int ENE_SDInit(struct us_data *us)
{
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
int result;
BYTE buf[0x200];

printk(KERN_INFO "transport --- ENE_SDInit\n");
/* SD Init Part-1 */
result = ENE_LoadBinCode(us, SD_INIT1_PATTERN);
if (result != USB_STOR_XFER_GOOD) {
printk(KERN_ERR "Load SD Init Code Part-1 Fail !!\n");
return USB_STOR_TRANSPORT_ERROR;
}

memset(bcb, 0, sizeof(struct bulk_cb_wrap));
bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
bcb->Flags = 0x80;
bcb->CDB[0] = 0xF2;

result = ENE_SendScsiCmd(us, FDIR_READ, NULL, 0);
if (result != USB_STOR_XFER_GOOD) {
printk(KERN_ERR "Exection SD Init Code Fail !!\n");
return USB_STOR_TRANSPORT_ERROR;
}

/* SD Init Part-2 */
result = ENE_LoadBinCode(us, SD_INIT2_PATTERN);
if (result != USB_STOR_XFER_GOOD) {
printk(KERN_ERR "Load SD Init Code Part-2 Fail !!\n");
return USB_STOR_TRANSPORT_ERROR;
}

memset(bcb, 0, sizeof(struct bulk_cb_wrap));
bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
bcb->DataTransferLength = 0x200;
bcb->Flags = 0x80;
bcb->CDB[0] = 0xF1;

result = ENE_SendScsiCmd(us, FDIR_READ, &buf, 0);
if (result != USB_STOR_XFER_GOOD) {
printk(KERN_ERR "Exection SD Init Code Fail !!\n");
return USB_STOR_TRANSPORT_ERROR;
}

us->SD_Status = *(PSD_STATUS)&buf[0];
if (us->SD_Status.Insert && us->SD_Status.Ready) {
ENE_ReadSDReg(us, (PBYTE)&buf);
printk(KERN_INFO "Insert = %x\n", us->SD_Status.Insert);
printk(KERN_INFO "Ready = %x\n", us->SD_Status.Ready);
printk(KERN_INFO "IsMMC = %x\n", us->SD_Status.IsMMC);
printk(KERN_INFO "HiCapacity = %x\n", us->SD_Status.HiCapacity);
printk(KERN_INFO "HiSpeed = %x\n", us->SD_Status.HiSpeed);
printk(KERN_INFO "WtP = %x\n", us->SD_Status.WtP);
} else {
printk(KERN_ERR "SD Card Not Ready --- %x\n", buf[0]);
return USB_STOR_TRANSPORT_ERROR;
}
return USB_STOR_TRANSPORT_GOOD;
}

/*
* ENE_MSInit():
*/
Expand Down Expand Up @@ -241,38 +170,6 @@ int ENE_SMInit(struct us_data *us)
return USB_STOR_TRANSPORT_GOOD;
}

/*
* ENE_ReadSDReg()
*/
int ENE_ReadSDReg(struct us_data *us, u8 *RdBuf)
{
WORD tmpreg;
DWORD reg4b;

/* printk(KERN_INFO "transport --- ENE_ReadSDReg\n"); */
reg4b = *(PDWORD)&RdBuf[0x18];
us->SD_READ_BL_LEN = (BYTE)((reg4b >> 8) & 0x0f);

tmpreg = (WORD) reg4b;
reg4b = *(PDWORD)(&RdBuf[0x14]);
if (us->SD_Status.HiCapacity && !us->SD_Status.IsMMC)
us->HC_C_SIZE = (reg4b >> 8) & 0x3fffff;

us->SD_C_SIZE = ((tmpreg & 0x03) << 10) | (WORD)(reg4b >> 22);
us->SD_C_SIZE_MULT = (BYTE)(reg4b >> 7) & 0x07;
if (us->SD_Status.HiCapacity && us->SD_Status.IsMMC)
us->HC_C_SIZE = *(PDWORD)(&RdBuf[0x100]);

if (us->SD_READ_BL_LEN > SD_BLOCK_LEN) {
us->SD_Block_Mult =
1 << (us->SD_READ_BL_LEN - SD_BLOCK_LEN);
us->SD_READ_BL_LEN = SD_BLOCK_LEN;
} else {
us->SD_Block_Mult = 1;
}
return USB_STOR_TRANSPORT_GOOD;
}

/*
* ENE_LoadBinCode()
*/
Expand All @@ -291,19 +188,6 @@ int ENE_LoadBinCode(struct us_data *us, BYTE flag)
if (buf == NULL)
return USB_STOR_TRANSPORT_ERROR;
switch (flag) {
/* For SD */
case SD_INIT1_PATTERN:
printk(KERN_INFO "SD_INIT1_PATTERN\n");
memcpy(buf, SD_Init1, 0x800);
break;
case SD_INIT2_PATTERN:
printk(KERN_INFO "SD_INIT2_PATTERN\n");
memcpy(buf, SD_Init2, 0x800);
break;
case SD_RW_PATTERN:
printk(KERN_INFO "SD_RW_PATTERN\n");
memcpy(buf, SD_Rdwr, 0x800);
break;
/* For MS */
case MS_INIT_PATTERN:
printk(KERN_INFO "MS_INIT_PATTERN\n");
Expand Down Expand Up @@ -412,8 +296,9 @@ int ENE_SendScsiCmd(struct us_data *us, BYTE fDir, void *buf, int use_sg)
*/
if (residue && !(us->fflags & US_FL_IGNORE_RESIDUE)) {
residue = min(residue, transfer_length);
scsi_set_resid(us->srb, max(scsi_get_resid(us->srb),
(int) residue));
if (us->srb)
scsi_set_resid(us->srb, max(scsi_get_resid(us->srb),
(int) residue));
}

if (bcs->Status != US_BULK_STAT_OK)
Expand Down Expand Up @@ -558,4 +443,3 @@ void usb_stor_print_cmd(struct scsi_cmnd *srb)
blen = 0;
}


Loading

0 comments on commit 72a26b5

Please sign in to comment.