kernel/eka/drivers/pbus/mmc/stack.cpp
branchGCC_SURGE
changeset 221 39b39e1a406e
parent 167 b41fc9c39ca7
parent 152 657f875b013e
equal deleted inserted replaced
219:0ff03867bdb6 221:39b39e1a406e
  3515 	SMF_STATE(EStWritePowerClass)
  3515 	SMF_STATE(EStWritePowerClass)
  3516 
  3516 
  3517 		OstTrace0( TRACE_INTERNALS, DMMCSTACK_DETERMINEBUSWIDTHANDCLOCKSM3, "EStWritePowerClass" );
  3517 		OstTrace0( TRACE_INTERNALS, DMMCSTACK_DETERMINEBUSWIDTHANDCLOCKSM3, "EStWritePowerClass" );
  3518 	
  3518 	
  3519 		// Check the card type is valid
  3519 		// Check the card type is valid
  3520 		// The only currently valid values for this field are 0x01 or 0x03
  3520 		if (!(cardP->iExtendedCSD.IsSupportedCardType()))
  3521 		TUint cardType = cardP->iExtendedCSD.CardType();
  3521 			{            
  3522 		if (cardType != (TExtendedCSD::EHighSpeedCard26Mhz) && 
  3522 			__KTRACE_OPT(KPBUS1, Kern::Printf("Unsupported card type %u", cardP->iExtendedCSD.CardType()));
  3523 			cardType != (TExtendedCSD::EHighSpeedCard26Mhz | TExtendedCSD::EHighSpeedCard52Mhz))
  3523 			OstTrace1( TRACE_INTERNALS, DMMCSTACK_DETERMINEBUSWIDTHANDCLOCKSM4, "Unsupported card type=%u", cardP->iExtendedCSD.CardType() );
  3524 			{
       
  3525 			__KTRACE_OPT(KPBUS1, Kern::Printf("Unsupported card type %u", cardType));
       
  3526 			OstTrace1( TRACE_INTERNALS, DMMCSTACK_DETERMINEBUSWIDTHANDCLOCKSM4, "Unsupported card type=%u", cardType );
       
  3527 			
  3524 			
  3528 			SMF_GOTOS(EStExit);
  3525 			SMF_GOTOS(EStExit);
  3529 			}
  3526 			}
  3530 
  3527 
  3531 		// determine the optimum bus width & clock speed which match the power constraints
  3528 		// determine the optimum bus width & clock speed which match the power constraints
  3616 		OstTrace1( TRACE_INTERNALS, DMMCSTACK_CONFIGUREHIGHSPEEDSM3, "iCxCardCount=%d", iCxCardCount );
  3613 		OstTrace1( TRACE_INTERNALS, DMMCSTACK_CONFIGUREHIGHSPEEDSM3, "iCxCardCount=%d", iCxCardCount );
  3617 
  3614 
  3618 		cardP->SetHighSpeedClock(0);
  3615 		cardP->SetHighSpeedClock(0);
  3619 
  3616 
  3620 		// Check the card type is valid
  3617 		// Check the card type is valid
  3621 		// The only currently valid values for this field are 0x01 or 0x03
  3618         if (!(cardP->iExtendedCSD.IsSupportedCardType()))
  3622 		TUint cardType = cardP->iExtendedCSD.CardType();
  3619             {            
  3623 		if (cardType != (TExtendedCSD::EHighSpeedCard26Mhz) && 
  3620 			__KTRACE_OPT(KPBUS1, Kern::Printf("Unsupported card type %u", cardP->iExtendedCSD.CardType()));
  3624 			cardType != (TExtendedCSD::EHighSpeedCard26Mhz | TExtendedCSD::EHighSpeedCard52Mhz))
  3621 			OstTrace1( TRACE_INTERNALS, DMMCSTACK_CONFIGUREHIGHSPEEDSM4, "Unsupported card type=%u", cardP->iExtendedCSD.CardType() );
  3625 			{
       
  3626 			__KTRACE_OPT(KPBUS1, Kern::Printf("Unsupported card type %u", cardType));
       
  3627 			OstTrace1( TRACE_INTERNALS, DMMCSTACK_CONFIGUREHIGHSPEEDSM4, "Unsupported card type=%u", cardType );
       
  3628 			SMF_GOTOS(EStExit);
  3622 			SMF_GOTOS(EStExit);
  3629 			}
  3623 			}
  3630 
  3624 
  3631 		// If the bus width is 4 or 8, send SWITCH cmd and write the BUS_WIDTH byte of the EXT_CSD register
  3625 		// If the bus width is 4 or 8, send SWITCH cmd and write the BUS_WIDTH byte of the EXT_CSD register
  3632 
  3626 
  6412 	{
  6406 	{
  6413 		enum states
  6407 		enum states
  6414 			{
  6408 			{
  6415 			EStBegin=0,
  6409 			EStBegin=0,
  6416 			EStNextIndex,
  6410 			EStNextIndex,
       
  6411 			EStSendStatus,
       
  6412 			EStGetStatus,
       
  6413 			EStUnlock,
  6417 			EStInitStackAfterUnlock,
  6414 			EStInitStackAfterUnlock,
  6418 			EStIssuedLockUnlock,
  6415 			EStIssuedLockUnlock,
  6419 			EStDone,
  6416 			EStDone,
  6420 			EStEnd
  6417 			EStEnd
  6421 			};
  6418 			};
  6474 		// We've found a locked card with a password in the password store,
  6471 		// We've found a locked card with a password in the password store,
  6475 		// so attempt to unlock using the CIMLockUnlockSMST state machine.
  6472 		// so attempt to unlock using the CIMLockUnlockSMST state machine.
  6476 		//
  6473 		//
  6477 		// Upon completion, test the next card before performing further initialisation.
  6474 		// Upon completion, test the next card before performing further initialisation.
  6478 		//
  6475 		//
       
  6476 		
       
  6477 		SMF_STATE(EStSendStatus)
       
  6478 		        
       
  6479 		s.FillCommandDesc(ECmdSendStatus, 0);
       
  6480 		                        
       
  6481 		SMF_INVOKES(ExecCommandSMST,EStGetStatus)
       
  6482 		                        
       
  6483 		SMF_STATE(EStGetStatus)
       
  6484 		                        
       
  6485 		const TMMCStatus st = s.LastStatus();
       
  6486 		if((st & KMMCStatCardIsLocked) == 0)
       
  6487 			{
       
  6488 		    SMF_RETURN(err)
       
  6489 		    }
       
  6490 		                        
       
  6491 		SMF_STATE(EStUnlock)
       
  6492 		                        
       
  6493 		const TMapping *mp = NULL;
       
  6494 		mp = iSocket->iPasswordStore->FindMappingInStore(iCardArray->CardP(iAutoUnlockIndex)->CID());
  6479 
  6495 
  6480 		TMMCard &cd = *(iCardArray->CardP(iAutoUnlockIndex++));
  6496 		TMMCard &cd = *(iCardArray->CardP(iAutoUnlockIndex++));
  6481 		OstTrace1( TRACE_INTERNALS, DMMCSTACK_CIMAUTOUNLOCKSM4, "Attempting to unlock card %d", cd.Number() );
  6497 		OstTrace1( TRACE_INTERNALS, DMMCSTACK_CIMAUTOUNLOCKSM4, "Attempting to unlock card %d", cd.Number() );
  6482 		
  6498 		
  6483 		s.SetCard(&cd);
  6499 		s.SetCard(&cd);