diff options
author | huajun li <huajun.li.lee@gmail.com> | 2011-03-04 10:56:18 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-03-07 13:40:59 -0800 |
commit | 41e568d14ec0aca1b2bb19563517aad3b06d6805 (patch) | |
tree | e1c9e5a384bb0ae1909ab373b13d127ef0f0b0de /drivers/staging/keucr/init.c | |
parent | 153775d94899503f5f66baaa9751a43c74d4f371 (diff) |
Staging: Merge ENE UB6250 SD card codes from keucr to drivers/usb/storage
The usb portion of this driver can now go into drivers/usb/storage.
This leaves the non-usb portion of the code still in staging.
Signed-off-by: Huajun Li <huajun.li.lee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/keucr/init.c')
-rw-r--r-- | drivers/staging/keucr/init.c | 122 |
1 files changed, 3 insertions, 119 deletions
diff --git a/drivers/staging/keucr/init.c b/drivers/staging/keucr/init.c index 515e448852a0..5c01f28f0734 100644 --- a/drivers/staging/keucr/init.c +++ b/drivers/staging/keucr/init.c @@ -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); @@ -73,69 +65,6 @@ int ENE_Read_BYTE(struct us_data *us, WORD index, void *buf) } /* - * 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(): */ int ENE_MSInit(struct us_data *us) @@ -242,38 +171,6 @@ int ENE_SMInit(struct us_data *us) } /* - * 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() */ int ENE_LoadBinCode(struct us_data *us, BYTE flag) @@ -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"); @@ -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) @@ -558,4 +443,3 @@ void usb_stor_print_cmd(struct scsi_cmnd *srb) blen = 0; } - |