Esempio n. 1
0
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		cpu_force
 * @BRIEF		Force cpu detection.
 * @RETURNS		0 on success
 *			OMAPCONF_ERR_ARG
 * @param[in]		forced_cpu: name of the force cpu
 * @DESCRIPTION		Force cpu detection.
 *//*------------------------------------------------------------------------ */
int cpu_force(char *forced_cpu)
{
	if (forced_cpu == NULL) {
		fprintf(stderr,
			"%s(): forced_cpu == NULL!\n", __func__);
		return OMAPCONF_ERR_ARG;
	}

	cpu_init();
	if (strcmp(forced_cpu, "omap5430") == 0) {
		cpu_forced_set(1);
		cpu_set(OMAP_5430);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES1_0);
		cpu_silicon_type_set(STANDARD_PERF_SI);
		cpu_full_name_set();
	} else if (strcmp(forced_cpu, "omap5432") == 0) {
		cpu_forced_set(1);
		cpu_set(OMAP_5432);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES1_0);
		cpu_silicon_type_set(STANDARD_PERF_SI);
		cpu_full_name_set();
	} else if (strcmp(forced_cpu, "omap4430") == 0) {
		cpu_forced_set(1);
		cpu_set(OMAP_4430);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES2_2);
		cpu_silicon_type_set(STANDARD_PERF_SI);
		cpu_full_name_set();
	} else if (strcmp(forced_cpu, "omap4460") == 0) {
		cpu_forced_set(1);
		cpu_set(OMAP_4460);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES1_1);
		cpu_silicon_type_set(STANDARD_PERF_SI);
		cpu_full_name_set();
	} else if (strcmp(forced_cpu, "omap4470") == 0) {
		cpu_forced_set(1);
		cpu_set(OMAP_4470);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES1_0);
		cpu_silicon_type_set(STANDARD_PERF_SI);
		cpu_full_name_set();
	} else {
		return OMAPCONF_ERR_ARG;
	}

	cpu_forced_set(1);
	return 0;
}
Esempio n. 2
0
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		cpu_init
 * @BRIEF		init local cpuinfo variables
 * @RETURNS		0 on success
 *			OMAPCONF_ERR_ARG
 * @param[in]		none
 * @DESCRIPTION		init local cpuinfo variables
 *//*------------------------------------------------------------------------ */
void cpu_init(void)
{
	cpu_forced_set(0);
	cpu_set(OMAP_MAX);
	cpu_revision_set(REV_ES_MAX);
	cpu_device_type_set(DEV_TYPE_MAX);
	cpu_silicon_type_set(SILICON_TYPE_MAX);
	cpu_full_name_set();
}
Esempio n. 3
0
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		cpu_force
 * @BRIEF		Force cpu detection.
 * @RETURNS		0 on success
 *			OMAPCONF_ERR_ARG
 * @param[in]		forced_cpu: name of the force cpu
 * @DESCRIPTION		Force cpu detection.
 *//*------------------------------------------------------------------------ */
int cpu_force(char *forced_cpu)
{
	if (forced_cpu == NULL) {
		fprintf(stderr,
			"%s(): forced_cpu == NULL!\n", __func__);
		return OMAPCONF_ERR_ARG;
	}

	cpu_init();

	if (strcmp(forced_cpu, "dra72x") == 0) {
		cpu_forced_set(1);
		cpu_set(DRA_72X);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES1_1);
		cpu_silicon_type_set(STANDARD_PERF_SI);
		cpu_full_name_set();
	} else if (strcmp(forced_cpu, "dra75x") == 0) {
		cpu_forced_set(1);
		cpu_set(DRA_75X);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES1_1);
		cpu_silicon_type_set(STANDARD_PERF_SI);
		cpu_full_name_set();
	} else if (strcmp (forced_cpu, "am3352") == 0) {
		cpu_forced_set(1);
		cpu_set(AM_3352);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES2_1);
		cpu_package_type_set(ZCZ);
		cpu_full_name_set();
	} else if (strcmp (forced_cpu, "am3354") == 0) {
		cpu_forced_set(1);
		cpu_set(AM_3354);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES2_1);
		cpu_package_type_set(ZCZ);
		cpu_full_name_set();
	} else if (strcmp (forced_cpu, "am3356") == 0) {
		cpu_forced_set(1);
		cpu_set(AM_3356);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES2_1);
		cpu_package_type_set(ZCZ);
		cpu_full_name_set();
	} else if (strcmp (forced_cpu, "am3357") == 0) {
		cpu_forced_set(1);
		cpu_set(AM_3357);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES2_1);
		cpu_package_type_set(ZCZ);
		cpu_full_name_set();
	} else if (strcmp (forced_cpu, "am3358") == 0) {
		cpu_forced_set(1);
		cpu_set(AM_3358);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES2_1);
		cpu_package_type_set(ZCZ);
		cpu_full_name_set();
	} else if (strcmp (forced_cpu, "am3359") == 0) {
		cpu_forced_set(1);
		cpu_set(AM_3359);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES2_1);
		cpu_package_type_set(ZCZ);
		cpu_full_name_set();
	} else if (strcmp (forced_cpu, "am335x") == 0) {
		cpu_forced_set(1);
		cpu_set(AM_335X);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES2_1);
		cpu_package_type_set(ZCZ);
		cpu_full_name_set();
	} else if (strcmp (forced_cpu, "am437x") == 0) {
		cpu_forced_set(1);
		cpu_set(AM_437X);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES1_2);
		cpu_full_name_set();
	} else if (strcmp(forced_cpu, "omap5430") == 0) {
		cpu_forced_set(1);
		cpu_set(OMAP_5430);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES2_0);
		cpu_silicon_type_set(STANDARD_PERF_SI);
		cpu_full_name_set();
	} else if (strcmp(forced_cpu, "omap5430es1") == 0) {
		cpu_forced_set(1);
		cpu_set(OMAP_5430);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES1_0);
		cpu_silicon_type_set(STANDARD_PERF_SI);
		cpu_full_name_set();
	} else if (strcmp(forced_cpu, "omap5432") == 0) {
		cpu_forced_set(1);
		cpu_set(OMAP_5432);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES2_0);
		cpu_silicon_type_set(STANDARD_PERF_SI);
		cpu_full_name_set();
	} else if (strcmp(forced_cpu, "omap5432es1") == 0) {
		cpu_forced_set(1);
		cpu_set(OMAP_5432);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES1_0);
		cpu_silicon_type_set(STANDARD_PERF_SI);
		cpu_full_name_set();
	} else if (strcmp(forced_cpu, "omap4430") == 0) {
		cpu_forced_set(1);
		cpu_set(OMAP_4430);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES2_2);
		cpu_silicon_type_set(STANDARD_PERF_SI);
		cpu_full_name_set();
	} else if (strcmp(forced_cpu, "omap4460") == 0) {
		cpu_forced_set(1);
		cpu_set(OMAP_4460);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES1_1);
		cpu_silicon_type_set(STANDARD_PERF_SI);
		cpu_full_name_set();
	} else if (strcmp(forced_cpu, "omap4470") == 0) {
		cpu_forced_set(1);
		cpu_set(OMAP_4470);
		cpu_device_type_set(DEV_GP);
		cpu_revision_set(REV_ES1_0);
		cpu_silicon_type_set(STANDARD_PERF_SI);
		cpu_full_name_set();
	} else {
		return OMAPCONF_ERR_ARG;
	}

	cpu_forced_set(1);
	return 0;
}
Esempio n. 4
0
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		cpu_detect
 * @BRIEF		Detect cpu and set internal global variables accordingly
 * @RETURNS		0 on success
 *			OMAPCONF_ERR_UNEXPECTED
 *			OMAPCONF_ERR_CPU if cpu not recognized
 *			OMAPCONF_ERR_REG_ACCESS
 * @param[in]		none
 * @DESCRIPTION		Detect cpu and set internal global variables accordingly
 *//*------------------------------------------------------------------------ */
int cpu_detect(void)
{
	unsigned int status;
	unsigned int efuse;
	unsigned int prod_id_1;
	int ret;
	unsigned char status_bit_start;

	#ifdef CPUID_DEBUG
	char s[CPU_FULL_NAME_MAX_LENGTH];
	char rev_s[CPU_REVISION_MAX_NAME_LENGTH];
	char dev_type_s[CPU_DEVICE_TYPE_MAX_NAME_LENGTH];
	#endif

	/* Init variables */
	cpu_init();

	/* Retrieve OMAP chip & ES */
	/* Determine if device is of the AM or OMAP family */
	if (cpu_is_omap())
		ret = identify_omap();
	else
		ret = identify_sitara();

	if (ret)
		return ret;

	dprintf("%s(): Chip is %s ES%s\n", __func__,
		cpu_gets(s), cpu_revision_gets(rev_s));


	/* Retrieve device type */
	if (cpu_is_omap44xx()) {
		ret = mem_read(OMAP44XX_STATUS, &status);
		status_bit_start = 8;
	} else if (cpu_is_omap54xx() || cpu_is_dra7xx()) {
		ret = mem_read(OMAP54XX_STATUS, &status);
		status_bit_start = 6;
	} else if (cpu_is_am335x() || cpu_is_am437x()) {
		ret = mem_read(AM335X_STATUS, &status);
		status_bit_start = 8;
	} else {
		ret = -1;
	}

	if (ret)
		return OMAPCONF_ERR_REG_ACCESS;
	dprintf("%s(): OMAP44XX_STATUS = 0x%08X\n", __func__, status);
	switch (extract_bitfield(status, status_bit_start, 2)) {
	case 3:
		cpu_device_type_set(DEV_GP);
		break;
	case 2:
		cpu_device_type_set(DEV_HS);
		break;
	case 1:
		cpu_device_type_set(DEV_EMU);
		break;
	default:
		cpu_device_type_set(DEV_TEST);
	}
	dprintf("%s(): Device Type is %s\n", __func__,
		cpu_device_type_gets(dev_type_s));

	/* Retrieve silicon performance type from EFuse */
	if (cpu_is_omap44xx()) {
		if (mem_read(CONTROL_STD_FUSE_PROD_ID_1, &prod_id_1) != 0) {
			fprintf(stderr,
				"omapconf (%s()): could not read CONTROL_STD_FUSE_PROD_ID_1 register!\n",
				__func__);
			return OMAPCONF_ERR_REG_ACCESS;
		}
		dprintf("%s(): CONTROL_STD_FUSE_PROD_ID_1 = 0x%08X\n",
			__func__, prod_id_1);
		si_type = (silicon_type) extract_bitfield(prod_id_1, 16, 2);
	} else if (cpu_is_omap54xx()) {
		if (cpu_revision_get() == REV_ES1_0) {
			if (cpu_silicon_max_speed_get() != 1200)
				cpu_silicon_type_set(STANDARD_PERF_SI);
			else
				cpu_silicon_type_set(SPEEDBIN_SI);
		} else {
			if (cpu_silicon_max_speed_get() != 1700)
				cpu_silicon_type_set(STANDARD_PERF_SI);
			else
				cpu_silicon_type_set(SPEEDBIN_SI);
		}
	} else if (cpu_is_dra7xx()) {
		/* TBD: implement true detection when ID data is available */
		cpu_silicon_type_set(STANDARD_PERF_SI);

	} else if (cpu_is_am335x()){
		if (mem_read(EFUSE_SMA_REG, &efuse) != 0) {
			fprintf(stderr,
				"omapconf: (%s()): could not read EFUSE_SMA register!\n",
				__func__);
			return OMAPCONF_ERR_REG_ACCESS;
		}
		switch (extract_bitfield(efuse, 16, 2)) {
		case 0:
			/*
			 * Silicon revision 1.0 does not support EFUSE SMA REG
			 * (returns all 0's if read)
			 * Setting as unknown until there is an alternate method
			 */
			cpu_package_type_set(PACKAGE_TYPE_MAX);
			break;
		case 1:
			cpu_package_type_set(ZCZ);
			break;
		case 2:
			cpu_package_type_set(ZCE);
			break;
		default:
			fprintf(stderr,
				"omapconf: (%s()): could not identify package type!\n",
				__func__);
			return OMAPCONF_ERR_UNEXPECTED;
		}
	}
	dprintf("%s(): Silicon performance type is %s (%uMHz)\n",
		__func__, cpu_silicon_type_gets(s),
		cpu_silicon_max_speed_get());

	/* Set CPU full name */
	cpu_full_name_set();
	dprintf("%s(): CPU full name is %s\n", __func__, cpu_full_name);

	return 0;
}