diff --git a/drivers/staging/keucr/smilmain.c b/drivers/staging/keucr/smilmain.c index ede7e1f2c24bddf65cd054cf5c59732610da0862..c7792c2a42b4be96ebc61182b9fcff33416aaf83 100644 --- a/drivers/staging/keucr/smilmain.c +++ b/drivers/staging/keucr/smilmain.c @@ -47,11 +47,9 @@ int MarkFail_D_PhyOneBlock(struct us_data *); DWORD ErrXDCode; DWORD ErrCode; -//BYTE SectBuf[SECTSIZE]; static BYTE WorkBuf[SECTSIZE]; static BYTE Redundant[REDTSIZE]; static BYTE WorkRedund[REDTSIZE]; -//WORD Log2Phy[MAX_ZONENUM][MAX_LOGBLOCK]; static WORD *Log2Phy[MAX_ZONENUM]; // 128 x 1000, Log2Phy[MAX_ZONENUM][MAX_LOGBLOCK]; static BYTE Assign[MAX_ZONENUM][MAX_BLOCKNUM / 8]; static WORD AssignStart[MAX_ZONENUM]; @@ -66,33 +64,10 @@ static BYTE BitData[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; #define Clr_D_Bit(a, b) (a[(BYTE)((b) / 8)] &= ~BitData[(b) % 8]) #define Chk_D_Bit(a, b) (a[(BYTE)((b) / 8)] & BitData[(b) % 8]) -//extern PBYTE SMHostAddr; BYTE IsSSFDCCompliance; BYTE IsXDCompliance; -// -////Power Control & Media Exist Check Function -////----- Init_D_SmartMedia() -------------------------------------------- -//int Init_D_SmartMedia(void) -//{ -// int i; -// -// EMCR_Print("Init_D_SmartMedia start\n"); -// for (i=0; i len) - bn = len; - else - bn = count; - //for(i=0;iDrive_IsSWLED) -// { -// if (enable) -// Led_D_TernOn(); -// else -// Led_D_TernOff(); -// } -//} -// -////----- Led_D_TernOn() ------------------------------------------------- -//void Led_D_TernOn(void) -//{ -// if (Check_D_CardStsChg()) -// MediaChange=ERROR; -// -// Cnt_D_LedOn(); -//} -// -////----- Led_D_TernOff() ------------------------------------------------ -//void Led_D_TernOff(void) -//{ -// if (Check_D_CardStsChg()) -// MediaChange=ERROR; -// -// Cnt_D_LedOff(); -//} -// -////SmartMedia Logical Format Subroutine -////----- Check_D_LogCHS() ----------------------------------------------- -//int Check_D_LogCHS(WORD *c,BYTE *h,BYTE *s) -//{ -// switch(Ssfdc.Model) { -// case SSFDC1MB: *c=125; *h= 4; *s= 4; break; -// case SSFDC2MB: *c=125; *h= 4; *s= 8; break; -// case SSFDC4MB: *c=250; *h= 4; *s= 8; break; -// case SSFDC8MB: *c=250; *h= 4; *s=16; break; -// case SSFDC16MB: *c=500; *h= 4; *s=16; break; -// case SSFDC32MB: *c=500; *h= 8; *s=16; break; -// case SSFDC64MB: *c=500; *h= 8; *s=32; break; -// case SSFDC128MB: *c=500; *h=16; *s=32; break; -// default: *c= 0; *h= 0; *s= 0; ErrCode = ERR_NoSmartMedia; return ERROR; -// } -// -// return SMSUCCESS; -//} -// -////Power Control & Media Exist Check Subroutine -////----- Initialize_D_Media() ------------------------------------------- -//void Initialize_D_Media(void) -//{ -// ErrCode = NO_ERROR; -// MediaChange = ERROR; -// SectCopyMode = COMPLETED; -// Cnt_D_Reset(); -//} -// -////----- PowerOff_D_Media() --------------------------------------------- -//void PowerOff_D_Media(void) -//{ -// Cnt_D_PowerOff(); -//} -// -////----- Check_D_MediaPower() ------------------------------------------- -//int Check_D_MediaPower(void) -//{ -// //usleep(56*1024); -// if (Check_D_CardStsChg()) -// MediaChange = ERROR; -// //usleep(56*1024); -// if ((!Check_D_CntPower())&&(!MediaChange)) // ¦³ power & Media ¨S³Q change, «h return success -// return SMSUCCESS; -// //usleep(56*1024); -// -// if (Check_D_CardExist()) // Check if card is not exist, return err -// { -// ErrCode = ERR_NoSmartMedia; -// MediaChange = ERROR; -// return ERROR; -// } -// //usleep(56*1024); -// if (Cnt_D_PowerOn()) -// { -// ErrCode = ERR_NoSmartMedia; -// MediaChange = ERROR; -// return ERROR; -// } -// //usleep(56*1024); -// Ssfdc_D_Reset(fdoExt); -// //usleep(56*1024); -// return SMSUCCESS; -//} -// -////-----Check_D_MediaExist() -------------------------------------------- -//int Check_D_MediaExist(void) -//{ -// if (Check_D_CardStsChg()) -// MediaChange = ERROR; -// -// if (!Check_D_CardExist()) -// { -// if (!MediaChange) -// return SMSUCCESS; -// -// ErrCode = ERR_ChangedMedia; -// return ERROR; -// } -// -// ErrCode = ERR_NoSmartMedia; -// -// return ERROR; -//} -// -////----- Check_D_MediaWP() ---------------------------------------------- -//int Check_D_MediaWP(void) -//{ -// if (Ssfdc.Attribute &MWP) -// { -// ErrCode = ERR_WrtProtect; -// return ERROR; -// } -// -// return SMSUCCESS; -//} -*/ //SmartMedia Physical Format Test Subroutine //----- Check_D_MediaFmt() --------------------------------------------- int Check_D_MediaFmt(struct us_data *us) { pr_info("Check_D_MediaFmt\n"); - //ULONG i,j, result=FALSE, zone,block; - //usleep(56*1024); if (!MediaChange) return SMSUCCESS; MediaChange = ERROR; SectCopyMode = COMPLETED; - //usleep(56*1024); if (Set_D_PhyFmtValue(us)) { ErrCode = ERR_UnknownMedia; return ERROR; } - //usleep(56*1024); if (Search_D_CIS(us)) { ErrCode = ERR_IllegalFmt; return ERROR; } - MediaChange = SMSUCCESS; return SMSUCCESS; } -/* -////----- Check_D_BlockIsFull() ---------------------------------- -//void Check_D_BlockIsFull() -//{ -// ULONG i, block; -// -// if (IsXDCompliance || IsSSFDCCompliance) -// { -// // If the blocks are full then return write-protect. -// block = Ssfdc.MaxBlocks/8; -// for (Media.Zone=0; Media.ZoneChildDeviceObject) return ERROR; -// //pdoExt = fdoExt->ChildDeviceObject->DeviceExtension; -// -// Ssfdc_D_ReadID(idcode, READ_ID_1); -// - //if (Set_D_SsfdcModel(idcode[1])) if (Set_D_SsfdcModel(us->SM_DeviceID)) return ERROR; -// //Use Multi-function pin to differentiate SM and xD. -// UserDefData_1 = ReadPCIReg(fdoExt->BusID, fdoExt->DevID, fdoExt->FuncID, PCI_REG_USER_DEF) & 0x80; -// if (UserDefData_1) -// { -// if ( READ_PORT_BYTE(SM_REG_INT_STATUS) & 0x80 ) fdoExt->DiskType = DISKTYPE_XD; -// if ( READ_PORT_BYTE(SM_REG_INT_STATUS) & 0x40 ) fdoExt->DiskType = DISKTYPE_SM; -// -// if ( IsXDCompliance && (fdoExt->DiskType == DISKTYPE_XD) ) -// { -// Ssfdc_D_ReadID(idcode, READ_ID_3); -// if (idcode[2] != 0xB5) -// return ERROR; -// } -// } -// -// //Use GPIO to differentiate SM and xD. -// UserDefData_2 = ReadPCIReg(fdoExt->BusID, fdoExt->DevID, fdoExt->FuncID, PCI_REG_USER_DEF) >> 8; -// if ( UserDefData_2 ) -// { -// Data = ReadPCIReg(fdoExt->BusID, fdoExt->DevID, 0, 0xAC); -// -// mask = 1 << (UserDefData_2-1); -// // 1 : xD , 0 : SM -// if ( Data & mask) -// fdoExt->DiskType = DISKTYPE_XD; -// else -// fdoExt->DiskType = DISKTYPE_SM; -// -// if ( IsXDCompliance && (fdoExt->DiskType == DISKTYPE_XD) ) -// { -// Ssfdc_D_ReadID(idcode, READ_ID_3); -// if (idcode[2] != 0xB5) -// return ERROR; -// } -// } -// -// if ( !(UserDefData_1 | UserDefData_2) ) -// { -// // Use UserDefine Register to differentiate SM and xD. -// Ssfdc_D_ReadID(idcode, READ_ID_3); -// -// if (idcode[2] == 0xB5) -// fdoExt->DiskType = DISKTYPE_XD; -// else -// { -// if (!IsXDCompliance) -// fdoExt->DiskType = DISKTYPE_SM; -// else -// return ERROR; -// } -// -// if (fdoExt->UserDef_DiskType == 0x04) fdoExt->DiskType = DISKTYPE_XD; -// if (fdoExt->UserDef_DiskType == 0x08) fdoExt->DiskType = DISKTYPE_SM; -// } -// -// if (!fdoExt->UserDef_DisableWP) -// { -// if (fdoExt->DiskType == DISKTYPE_SM) -// { -// if (Check_D_SsfdcWP()) -// Ssfdc.Attribute|=WP; -// } -// } - return SMSUCCESS; } //----- Search_D_CIS() ------------------------------------------------- int Search_D_CIS(struct us_data *us) { - //SSFDCTYPE_T aa = (SSFDCTYPE_T ) &Ssfdc; - //ADDRESS_T bb = (ADDRESS_T) &Media; - Media.Zone = 0; Media.Sector = 0; @@ -1600,8 +655,6 @@ int Search_D_CIS(struct us_data *us) int Make_D_LogTable(struct us_data *us) { WORD phyblock, logblock; - //SSFDCTYPE_T aa = (SSFDCTYPE_T ) &Ssfdc; - //ADDRESS_T bb = (ADDRESS_T) &Media; if (Log2Phy[Media.Zone] == NULL) { Log2Phy[Media.Zone] = kmalloc(MAX_LOGBLOCK * sizeof(WORD), GFP_KERNEL); @@ -1613,8 +666,6 @@ int Make_D_LogTable(struct us_data *us) Media.Sector = 0; - //for(Media.Zone=0; Media.ZoneErrCode = STATUS_CMD_FAIL; -// -// Init_D_SmartMedia(); -// -// if (Check_D_MediaPower()) -// return (ErrCode==ERR_NoSmartMedia) ? STATUS_CMD_NO_MEDIA : STATUS_CMD_FAIL; -// -// if (Set_D_PhyFmtValue(fdoExt)) -// return STATUS_CMD_FAIL; -// -// //usleep(56*1024); -// if (Search_D_CIS(fdoExt)) -// return STATUS_CMD_FAIL; -// -// if (Check_D_MediaWP()) -// return STATUS_CMD_MEDIA_WP; -// -// pParamOut->PageSize = Ssfdc.MaxSectors; -// pParamOut->BlockSize = Ssfdc.MaxBlocks; -// pParamOut->ZoneSize = Ssfdc.MaxZones; -// -// return STATUS_CMD_SUCCESS; -//}*/