lib/sw_apps/zynqmp_fsbl/src/xfsbl_tpm_util.c
u32 XFsbl_SpiInit(void)
{
	u32 Status = XFSBL_FAILURE;
	XSpiPs_Config *SpiConfig;

	/*
	 * Initialize the SPI driver so that it's ready to use
	 */
	SpiConfig = XSpiPs_LookupConfig(XFSBL_SPI_DEVICE_ID);
	if (NULL == SpiConfig) {
		goto END;
	}

	Status = XSpiPs_CfgInitialize(&SpiInstance, SpiConfig,
		SpiConfig->BaseAddress);
	if (Status != XST_SUCCESS) {
		goto END;
	}

	/*
	 * Perform a self-test to check hardware build
	 */
	Status = XSpiPs_SelfTest(&SpiInstance);
	if (Status != XST_SUCCESS) {
		goto END;
	}

	/*
	 * Set the Spi device as a master. External loopback is required
	 */
	XSpiPs_SetOptions(&SpiInstance, XSPIPS_MANUAL_START_OPTION |
		XSPIPS_MASTER_OPTION | XSPIPS_FORCE_SSELECT_OPTION);

	XSpiPs_SetClkPrescaler(&SpiInstance, XSPIPS_CLK_PRESCALE_16);

	/*
	 * Assert the TPM chip select
	 */
	Status = XSpiPs_SetSlaveSelect(&SpiInstance, XFSBL_TPM_SPI_SELECT);

END:
	return Status;
}
/*****************************************************************************/
/**
*
* This function initializes SPI interface required to communicate with TPM.
*
* @return	XFSBL_SUCCESS if successful, else error code
*
******************************************************************************/
This function initializes SPI interface required to communicate with TPM.
This function initializes SPI interface required to communicate with TPM .
u32 XFsbl_SpiInit(void)
{
	u32 Status = XFSBL_FAILURE;
	XSpiPs_Config *SpiConfig;
	SpiConfig = XSpiPs_LookupConfig(XFSBL_SPI_DEVICE_ID);
	if (NULL == SpiConfig) {
		goto END;
	}
	Status = XSpiPs_CfgInitialize(&SpiInstance, SpiConfig,
		SpiConfig->BaseAddress);
	if (Status != XST_SUCCESS) {
		goto END;
	}
	Status = XSpiPs_SelfTest(&SpiInstance);
	if (Status != XST_SUCCESS) {
		goto END;
	}
	XSpiPs_SetOptions(&SpiInstance, XSPIPS_MANUAL_START_OPTION |
		XSPIPS_MASTER_OPTION | XSPIPS_FORCE_SSELECT_OPTION);
	XSpiPs_SetClkPrescaler(&SpiInstance, XSPIPS_CLK_PRESCALE_16);
	Status = XSpiPs_SetSlaveSelect(&SpiInstance, XFSBL_TPM_SPI_SELECT);
END:
	return Status;
}
u32 XFsbl_SpiInit ( void ) { u32 Status = XFSBL_FAILURE ; XSpiPs_Config * SpiConfig ; SpiConfig = XSpiPs_LookupConfig ( XFSBL_SPI_DEVICE_ID ) ; if ( NULL == SpiConfig ) { goto END ; } Status = XSpiPs_CfgInitialize ( & SpiInstance , SpiConfig , SpiConfig -> BaseAddress ) ; if ( Status != XST_SUCCESS ) { goto END ; } Status = XSpiPs_SelfTest ( & SpiInstance ) ; if ( Status != XST_SUCCESS ) { goto END ; } XSpiPs_SetOptions ( & SpiInstance , XSPIPS_MANUAL_START_OPTION | XSPIPS_MASTER_OPTION | XSPIPS_FORCE_SSELECT_OPTION ) ; XSpiPs_SetClkPrescaler ( & SpiInstance , XSPIPS_CLK_PRESCALE_16 ) ; Status = XSpiPs_SetSlaveSelect ( & SpiInstance , XFSBL_TPM_SPI_SELECT ) ; END : return Status ; }
This function initializes SPI interface required to communicate with TPM.
This function initializes SPI interface required to communicate with TPM .
/*
	 * Initialize the SPI driver so that it's ready to use
	 */ /*
	 * Perform a self-test to check hardware build
	 */ /*
	 * Set the Spi device as a master. External loopback is required
	 */ /*
	 * Assert the TPM chip select
	 */