software/drivers/sd8887/src/wlan/mlan/mlan_sdio.c
/**
 *  @brief This function initialize the SDIO port
 *
 *  @param pmadapter    A pointer to mlan_adapter structure
 *  @return             MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 */
@brief This function initialize the SDIO port
@param pmadapter    A pointer to mlan_adapter structure
@return             MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
@brief This function initialize the SDIO port @param pmadapter A pointer to mlan_adapter structure @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
static mlan_status
wlan_sdio_init_ioport(mlan_adapter *pmadapter)
{
	t_u32 reg;
	pmlan_callbacks pcb = &pmadapter->callbacks;
	t_u8 host_int_rsr_reg = HOST_INT_RSR_REG;
	t_u8 host_int_rsr_mask = HOST_INT_RSR_MASK;
	t_u8 card_misc_cfg_reg = CARD_MISC_CFG_REG;
	t_u8 card_config_2_1_reg = CARD_CONFIG_2_1_REG;
	t_u8 cmd_config_0 = CMD_CONFIG_0;
	t_u8 cmd_config_1 = CMD_CONFIG_1;
	ENTER();
	pmadapter->ioport = 0;
	pmadapter->ioport = MEM_PORT;
	PRINTM(MINFO, "SDIO FUNC1 IO port: 0x%x\n", pmadapter->ioport);
	if (MLAN_STATUS_SUCCESS == pcb->moal_read_reg(pmadapter->pmoal_handle,
						      card_config_2_1_reg,
						      &reg)) {
		pcb->moal_write_reg(pmadapter->pmoal_handle,
				    card_config_2_1_reg, reg | CMD53_NEW_MODE);
	} else {
		LEAVE();
		return MLAN_STATUS_FAILURE;
	}
	if (MLAN_STATUS_SUCCESS == pcb->moal_read_reg(pmadapter->pmoal_handle,
						      cmd_config_0, &reg)) {
		pcb->moal_write_reg(pmadapter->pmoal_handle,
				    cmd_config_0, reg | CMD_PORT_RD_LEN_EN);
	} else {
		LEAVE();
		return MLAN_STATUS_FAILURE;
	}
	if (MLAN_STATUS_SUCCESS == pcb->moal_read_reg(pmadapter->pmoal_handle,
						      cmd_config_1, &reg)) {
		pcb->moal_write_reg(pmadapter->pmoal_handle,
				    cmd_config_1, reg | CMD_PORT_AUTO_EN);
	} else {
		LEAVE();
		return MLAN_STATUS_FAILURE;
	}
	if (MLAN_STATUS_SUCCESS ==
	    pcb->moal_read_reg(pmadapter->pmoal_handle, host_int_rsr_reg,
			       &reg)) {
		pcb->moal_write_reg(pmadapter->pmoal_handle, host_int_rsr_reg,
				    reg | host_int_rsr_mask);
	} else {
		LEAVE();
		return MLAN_STATUS_FAILURE;
	}
	if (MLAN_STATUS_SUCCESS ==
	    pcb->moal_read_reg(pmadapter->pmoal_handle, card_misc_cfg_reg,
			       &reg)) {
		pcb->moal_write_reg(pmadapter->pmoal_handle, card_misc_cfg_reg,
				    reg | AUTO_RE_ENABLE_INT);
	} else {
		LEAVE();
		return MLAN_STATUS_FAILURE;
	}
	LEAVE();
	return MLAN_STATUS_SUCCESS;
}
static mlan_status wlan_sdio_init_ioport ( mlan_adapter * pmadapter ) { t_u32 reg ; pmlan_callbacks pcb = & pmadapter -> callbacks ; t_u8 host_int_rsr_reg = HOST_INT_RSR_REG ; t_u8 host_int_rsr_mask = HOST_INT_RSR_MASK ; t_u8 card_misc_cfg_reg = CARD_MISC_CFG_REG ; t_u8 card_config_2_1_reg = CARD_CONFIG_2_1_REG ; t_u8 cmd_config_0 = CMD_CONFIG_0 ; t_u8 cmd_config_1 = CMD_CONFIG_1 ; ENTER ( ) ; pmadapter -> ioport = 0 ; pmadapter -> ioport = MEM_PORT ; PRINTM ( MINFO , " \n " , pmadapter -> ioport ) ; if ( MLAN_STATUS_SUCCESS == pcb -> moal_read_reg ( pmadapter -> pmoal_handle , card_config_2_1_reg , & reg ) ) { pcb -> moal_write_reg ( pmadapter -> pmoal_handle , card_config_2_1_reg , reg | CMD53_NEW_MODE ) ; } else { LEAVE ( ) ; return MLAN_STATUS_FAILURE ; } if ( MLAN_STATUS_SUCCESS == pcb -> moal_read_reg ( pmadapter -> pmoal_handle , cmd_config_0 , & reg ) ) { pcb -> moal_write_reg ( pmadapter -> pmoal_handle , cmd_config_0 , reg | CMD_PORT_RD_LEN_EN ) ; } else { LEAVE ( ) ; return MLAN_STATUS_FAILURE ; } if ( MLAN_STATUS_SUCCESS == pcb -> moal_read_reg ( pmadapter -> pmoal_handle , cmd_config_1 , & reg ) ) { pcb -> moal_write_reg ( pmadapter -> pmoal_handle , cmd_config_1 , reg | CMD_PORT_AUTO_EN ) ; } else { LEAVE ( ) ; return MLAN_STATUS_FAILURE ; } if ( MLAN_STATUS_SUCCESS == pcb -> moal_read_reg ( pmadapter -> pmoal_handle , host_int_rsr_reg , & reg ) ) { pcb -> moal_write_reg ( pmadapter -> pmoal_handle , host_int_rsr_reg , reg | host_int_rsr_mask ) ; } else { LEAVE ( ) ; return MLAN_STATUS_FAILURE ; } if ( MLAN_STATUS_SUCCESS == pcb -> moal_read_reg ( pmadapter -> pmoal_handle , card_misc_cfg_reg , & reg ) ) { pcb -> moal_write_reg ( pmadapter -> pmoal_handle , card_misc_cfg_reg , reg | AUTO_RE_ENABLE_INT ) ; } else { LEAVE ( ) ; return MLAN_STATUS_FAILURE ; } LEAVE ( ) ; return MLAN_STATUS_SUCCESS ; }
@brief This function initialize the SDIO port
  @param pmadapter    A pointer to mlan_adapter structure
  @return             MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
@brief This function initialize the SDIO port @param pmadapter A pointer to mlan_adapter structure @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
/* enable sdio cmd53 new mode */ /* configure cmd port  */ /* enable reading rx length from the register  */ /* enable Dnld/Upld ready auto reset for cmd port
	 * after cmd53 is completed */ /* Set Host interrupt reset to read to clear */ /* Dnld/Upld ready set to auto reset */