/* 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 long clock_get_fclk(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 long clock_get_fclk(void)
{
	unsigned long fclk = 0;
	unsigned long 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 = DEFAULT_FCLK_FREQ;
	}
	return fclk;
}