/* Retrieve the system clock frequency from eNVM spare page if available. Returns the frequency defined through SMARTFUSION_FCLK_FREQ if FCLK cannot be retrieved from eNVM spare pages. The FCLK frequency value selected in the MSS Configurator software tool is stored in eNVM spare pages as part of the Actel system boot configuration data.  */
static unsigned int a2f_get_system_clock(void)
/* Retrieve the system clock frequency from eNVM spare page if available. Returns the frequency defined through SMARTFUSION_FCLK_FREQ if FCLK cannot be retrieved from eNVM spare pages. The FCLK frequency value selected in the MSS Configurator software tool is stored in eNVM spare pages as part of the Actel system boot configuration data.  */
static unsigned int a2f_get_system_clock(void)
{
	unsigned int fclk = 0;
	unsigned int sysboot_version;
	if (SYSBOOT_KEY_VALUE == readl(SYSBOOT_KEY_ADDR)) {
		sysboot_version = readl(SYSBOOT_VERSION_ADDR);
		sysboot_version &= SYSBOOT_VERSION_MASK;
		if (sysboot_version >= MIN_SYSBOOT_VERSION) {
			if (sysboot_version < SYSBOOT_VERSION_2_X) {
				fclk = readl(SYSBOOT_1_3_FCLK_ADDR);
			} else if (sysboot_version < MAX_SYSBOOT_VERSION) {
				fclk = readl(SYSBOOT_2_x_FCLK_ADDR);
			}
		}
	}
	if (0 == fclk) {
		fclk = A2F_DEF_SYSCLCK_FREQ;
	}
	return fclk;
}