intel: Modify mailbox's get_config_status

Move the get_config_status out of sip_svc driver.
Modify the function so that it can return either
CONFIG_STATUS or RECONFIG_STATUS

Signed-off-by: Hadi Asyrafi <muhammad.hadi.asyrafi.abdul.halim@intel.com>
Change-Id: I642d5900339e67f98be61380edc2b838e0dd47af
This commit is contained in:
Hadi Asyrafi 2019-10-21 16:25:07 +08:00
parent d25041bf1e
commit ec7d0055c9
3 changed files with 32 additions and 28 deletions

View File

@ -85,6 +85,7 @@
#define MBOX_CFGSTAT_STATE_CONFIG 0x10000000
/* Mailbox reconfiguration commands */
#define MBOX_CONFIG_STATUS 4
#define MBOX_RECONFIG 6
#define MBOX_RECONFIG_DATA 8
#define MBOX_RECONFIG_STATUS 9
@ -102,5 +103,6 @@ void mailbox_send_cmd_async(int job_id, unsigned int cmd, uint32_t *args,
int mailbox_read_response(int job_id, uint32_t *response);
int mailbox_get_qspi_clock(void);
void mailbox_reset_cold(void);
uint32_t intel_mailbox_get_config_status(uint32_t cmd);
#endif /* SOCFPGA_MBOX_H */

View File

@ -8,6 +8,7 @@
#include <common/debug.h>
#include "socfpga_mailbox.h"
#include "socfpga_sip_svc.h"
static int fill_mailbox_circular_buffer(uint32_t header_cmd, uint32_t *args,
int len)
@ -278,3 +279,31 @@ int mailbox_init(void)
return 0;
}
uint32_t intel_mailbox_get_config_status(uint32_t cmd)
{
uint32_t status, res;
uint32_t response[6];
status = mailbox_send_cmd(1, cmd, NULL, 0, 0, response);
if (status < 0)
return INTEL_SIP_SMC_STATUS_ERROR;
res = response[RECONFIG_STATUS_STATE];
if (res && res != MBOX_CFGSTAT_STATE_CONFIG)
return INTEL_SIP_SMC_STATUS_ERROR;
res = response[RECONFIG_STATUS_PIN_STATUS];
if (!(res & PIN_STATUS_NSTATUS))
return INTEL_SIP_SMC_STATUS_ERROR;
res = response[RECONFIG_STATUS_SOFTFUNC_STATUS];
if (res & SOFTFUNC_STATUS_SEU_ERROR)
return INTEL_SIP_SMC_STATUS_ERROR;
if ((res & SOFTFUNC_STATUS_CONF_DONE) &&
(res & SOFTFUNC_STATUS_INIT_DONE))
return INTEL_SIP_SMC_STATUS_OK;
return MBOX_CFGSTAT_STATE_CONFIG;
}

View File

@ -100,34 +100,7 @@ static int intel_fpga_sdm_write_all(void)
uint32_t intel_mailbox_fpga_config_isdone(void)
{
uint32_t args[2];
uint32_t response[6];
int status;
status = mailbox_send_cmd(1, MBOX_RECONFIG_STATUS, args, 0, 0,
response);
if (status < 0)
return INTEL_SIP_SMC_STATUS_ERROR;
if (response[RECONFIG_STATUS_STATE] &&
response[RECONFIG_STATUS_STATE] != MBOX_CFGSTAT_STATE_CONFIG)
return INTEL_SIP_SMC_STATUS_ERROR;
if (!(response[RECONFIG_STATUS_PIN_STATUS] & PIN_STATUS_NSTATUS))
return INTEL_SIP_SMC_STATUS_ERROR;
if (response[RECONFIG_STATUS_SOFTFUNC_STATUS] &
SOFTFUNC_STATUS_SEU_ERROR)
return INTEL_SIP_SMC_STATUS_ERROR;
if ((response[RECONFIG_STATUS_SOFTFUNC_STATUS] &
SOFTFUNC_STATUS_CONF_DONE) &&
(response[RECONFIG_STATUS_SOFTFUNC_STATUS] &
SOFTFUNC_STATUS_INIT_DONE))
return INTEL_SIP_SMC_STATUS_OK;
return INTEL_SIP_SMC_STATUS_ERROR;
return intel_mailbox_get_config_status(MBOX_RECONFIG_STATUS);
}
static int mark_last_buffer_xfer_completed(uint32_t *buffer_addr_completed)