コード例 #1
0
ファイル: powerdomain.c プロジェクト: KunYi/omapconf
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		powerdm_init
 * @BRIEF		initialize internal data
 * @DESCRIPTION		initialize internal data (architecture dependent)
 *//*------------------------------------------------------------------------ */
void powerdm_init(void)
{
	#ifdef PWRDM_DEBUG
	int i, count;
	const genlist *pwrdm_list;
	powerdm_info pwrdm;
	#endif

	if (cpu_is_omap44xx()) {
		pwrdm44xx_init();
	} else if (cpu_is_omap54xx()) {
		pwrdm54xx_init();
	} else {
		fprintf(stderr,
			"omapconf: %s(): cpu not supported!!!\n", __func__);
	}

	#ifdef PWRDM_DEBUG
	pwrdm_list = powerdm_list_get();
	count = genlist_getcount((genlist *) pwrdm_list);
	printf("Power Domain List:\n");
	for (i = 0; i < count; i++) {
		genlist_get((genlist *) pwrdm_list, i, (powerdm_info *) &pwrdm);
		printf(" %s:\n", pwrdm.name);
		printf("  ID:%d\n", pwrdm.id);
		printf("  VoltDM: %s\n", pwrdm.voltdm);
		printf("  PWRSTCTRL REG: %s\n", (pwrdm.pwrstctrl)->name);
		printf("  PWRSTST REG: %s\n", (pwrdm.pwrstst)->name);
		printf("  Properties: %d\n", pwrdm.properties);
		printf("\n\n");
	}
	printf("Power Domain count: %d\n\n", count);
	#endif
}
コード例 #2
0
ファイル: interrupts.c プロジェクト: fturgis/omapconf
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		irq_occurred_list_sort
 * @BRIEF		sort list by irq occurrence decreasing order
 * @RETURNS		0 in case of success
 *			IRQ_ERR_ARG
 *			IRQ_ERR_INTERNAL
 * @param[in,out]	list: populated list of IRQ stats.
 * @DESCRIPTION		sort list by irq occurrence decreasing order.
 *			Use bubble sort algorithm.
 *//*------------------------------------------------------------------------ */
int irq_occurred_list_sort(genlist *list)
{
	unsigned int i, max, tmpmax;
	irq_info inf1, inf2;

	if (list == NULL) {
		fprintf(stderr, "%s(): list = NULL!\n", __func__);
		return IRQ_ERR_ARG;
	}
	max = genlist_getcount(list);

	while (max > 0) {
		tmpmax = 0;
		for (i = 0; i < max - 1; i++) {
			genlist_get(list, i, (irq_info *) &inf1);
			genlist_get(list, i + 1, (irq_info *) &inf2);
			if (inf1.count < inf2.count) {
				genlist_add(list, (void *) &inf2,
					sizeof(irq_info), i);
				genlist_remove(list, i + 2);
				tmpmax = i + 1;
			}
		}
		max = tmpmax;
	}

	return 0;
}
コード例 #3
0
ファイル: temperature.c プロジェクト: antonius24/omapconf
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		temp_sensor_count_get
 * @BRIEF		return the number of temperature sensor(s)
 * @RETURNS		> 0 number of temperature sensor(s)
 *			OMAPCONF_ERR_CPU
 * @DESCRIPTION		return the number of temperature sensor(s)
 *//*------------------------------------------------------------------------ */
int temp_sensor_count_get(void)
{
	int count;

	temp_sensor_init();

	if (cpu_is_omap44xx()) {
		count = genlist_getcount(&temp_sensor_list);
	} else if (cpu_is_omap54xx()) {
		count = genlist_getcount(&temp_sensor_list);
	} else {
		fprintf(stderr,
			"omapconf: %s(): cpu not supported!!!\n", __func__);
		count = OMAPCONF_ERR_CPU;
	}

	dprintf("%s() = %d\n", __func__, count);
	return count;
}
コード例 #4
0
ファイル: module_dra7xx.c プロジェクト: IngenicC/omapconf
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		mod_dra7xx_count_get
 * @BRIEF		return the number of modules
 * @RETURNS		number of modules (> 0) in case of success
 *			OMAPCONF_ERR_CPU
 *			OMAPCONF_ERR_ARG
 * @DESCRIPTION		return the number of modules
 *//*------------------------------------------------------------------------ */
int mod_dra7xx_count_get(void)
{
	int count;

	mod_dra7xx_init();

	count = genlist_getcount(&mod_dra7xx_list);

	dprintf("%s() = %d\n", __func__, count);
	return count;
}
コード例 #5
0
ファイル: voltdm_am335x.c プロジェクト: IngenicC/omapconf
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		voltdm_am335x_count_get
 * @BRIEF		return the number of voltage domains
 * @RETURNS		number of voltage domains (> 0) in case of success
 *			OMAPCONF_ERR_CPU
 *			OMAPCONF_ERR_ARG
 * @DESCRIPTION		return the number of voltage domains
 *//*------------------------------------------------------------------------ */
int voltdm_am335x_count_get(void)
{
	int count;

	voltdm_am335x_init();

	count = genlist_getcount(&voltdm_am335x_list);

	dprintf("%s() = %d\n", __func__, count);
	return count;
}
コード例 #6
0
ファイル: pwrdm44xx.c プロジェクト: IngenicC/omapconf
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		pwrdm44xx_count_get
 * @BRIEF		return the number of power domains
 * @RETURNS		number of power domains (> 0) in case of success
 *			OMAPCONF_ERR_CPU
 *			OMAPCONF_ERR_ARG
 * @DESCRIPTION		return the number of power domains
 *//*------------------------------------------------------------------------ */
int pwrdm44xx_count_get(void)
{
	int count;

	pwrdm44xx_init();

	count = genlist_getcount(&pwrdm44xx_list);

	dprintf("%s() = %d\n", __func__, count);
	return count;
}
コード例 #7
0
ファイル: opp_dra7xx.c プロジェクト: IngenicC/omapconf
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		opp_dra7xx_count_get
 * @BRIEF		return the number of OPP(s) of a given voltage domain
 * @RETURNS		number of OPP(s) (> 0) in case of success
 *			OMAPCONF_ERR_CPU
 *			OMAPCONF_ERR_ARG
 * @param[in]		vdd_id: voltage domain ID
 * @DESCRIPTION		return the number of OPP(s) of a given voltage domain
 *//*------------------------------------------------------------------------ */
int opp_dra7xx_count_get(voltdm_dra7xx_id vdd_id)
{
	int count;

	CHECK_ARG_LESS_THAN(vdd_id, VDD_DRA7XX_ID_MAX, OMAPCONF_ERR_ARG);

	opp_dra7xx_init();

	count = genlist_getcount(opp_dra7xx_list_table[vdd_id]);

	dprintf("%s(%d) = %d\n", __func__, vdd_id, count);
	return count;
}
コード例 #8
0
ファイル: opp54xx.c プロジェクト: mvduin/omapconf
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		opp54xx_count_get
 * @BRIEF		return the number of OPP(s) of a given voltage domain
 * @RETURNS		number of OPP(s) (> 0) in case of success
 *			OMAPCONF_ERR_CPU
 *			OMAPCONF_ERR_ARG
 * @param[in]		vdd_id: voltage domain ID
 * @DESCRIPTION		return the number of OPP(s) of a given voltage domain
 *//*------------------------------------------------------------------------ */
int opp54xx_count_get(voltdm54xx_id vdd_id)
{
	int count;

	CHECK_CPU(54xx, OMAPCONF_ERR_CPU);
	CHECK_ARG_LESS_THAN(vdd_id, VDD54XX_ID_MAX, OMAPCONF_ERR_ARG);

	opp54xx_init();

	count = genlist_getcount(opp54xx_list_table_es1[vdd_id]);

	dprintf("%s(%d) = %d\n", __func__, vdd_id, count);
	return count;
}
コード例 #9
0
ファイル: module_dra7xx.c プロジェクト: IngenicC/omapconf
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		mod_dra7xx_deinit
 * @BRIEF		free dynamically allocated internal data.
 * @DESCRIPTION		free dynamically allocated internal data.
 *			MUST BE CALLED AT END OF EXECUTION.
 *//*------------------------------------------------------------------------ */
void mod_dra7xx_deinit(void)
{
	int i, count;
	mod_info mod;

	if (mod_dra7xx_init_done) {
		count = genlist_getcount(&mod_dra7xx_list);
		for (i = 0; i < count; i++) {
			genlist_get(&mod_dra7xx_list, i, (mod_info *) &mod);
			genlist_free(&(mod.mod_opp_list));
		}
		genlist_free(&mod_dra7xx_list);
		mod_dra7xx_init_done = 0;
	}
	dprintf("%s(): deinit done.\n", __func__);
}
コード例 #10
0
ファイル: powerdomain.c プロジェクト: IngenicC/omapconf
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		_powerdm_info_get
 * @BRIEF		return the saved informations of a given power domain.
 * @RETURNS		0 in case of success
 *			-1 in case of error
 * @param[in]		powerdm: power domain name
 * @param[in,out]	data: power domain details
 * @DESCRIPTION		return the saved informations of a given power domain.
 *//*------------------------------------------------------------------------ */
static int _powerdm_info_get(const char *powerdm, powerdm_info *data)
{
	const genlist *pwrdm_list;
	int i, count;

	CHECK_NULL_ARG(powerdm, -1);
	CHECK_NULL_ARG(data, -1);

	pwrdm_list = powerdm_list_get();
	count = genlist_getcount((genlist *) pwrdm_list);
	for (i = 0; i < count; i++) {
		genlist_get((genlist *) pwrdm_list, i, (void *) data);
		if (strcmp(data->name, powerdm) == 0) {
			dprintf("%s(%s): found.\n", __func__, powerdm);
			return 0;
		}
	}

	dprintf("%s(%s): not found!\n", __func__, powerdm);
	return -1;
}
コード例 #11
0
ファイル: voltdomain.c プロジェクト: antonius24/omapconf
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		voltdm_init
 * @BRIEF		initialize internal data
 * @DESCRIPTION		initialize internal data (architecture dependent)
 *//*------------------------------------------------------------------------ */
void voltdm_init(void)
{
	#ifdef VOLTDM_DEBUG
	int i, count;
	const genlist *voltdm_list;
	voltdm_info voltdm;
	#endif

	if (cpu_is_omap44xx()) {
		voltdm44xx_init();
	} else if (cpu_is_omap54xx()) {
		voltdm54xx_init();
	} else {
		fprintf(stderr,
			"omapconf: %s(): cpu not supported!!!\n", __func__);
	}

	#ifdef VOLTDM_DEBUG
	voltdm_list = voltdm_list_get();
	count = genlist_getcount((genlist *) voltdm_list);
	printf("Voltage Domain List:\n");
	for (i = 0; i < count; i++) {
		genlist_get((genlist *) voltdm_list, i,
			(voltdm_info *) &voltdm);
		printf(" %s:\n", voltdm.name);
		printf("  ID:%d\n", voltdm.id);
		if (voltdm.voltst == NULL)
			printf("  Status Register: does not exist\n");
		else
			printf("  Status Register: %s\n",
				reg_name_get(voltdm.voltst));
		printf("\n\n");
	}
	printf("Voltage Domain count: %d\n\n", count);
	#endif
}
コード例 #12
0
ファイル: opp54xx.c プロジェクト: mvduin/omapconf
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		opp54xx_init
 * @BRIEF		initialize internal data
 * @DESCRIPTION		initialize internal data (architecture dependent)
 *//*------------------------------------------------------------------------ */
void opp54xx_init(void)
{
	opp_t opp;

	/* ES1.0 */
	static const opp_t mpu_opp_low_es1  = {OPP_LOW,	 950000,  400000};
	static const opp_t mpu_opp_nom_es1  = {OPP_NOM,	 1040000, 800000};
	static const opp_t mpu_opp_high_es1 = {OPP_HIGH, 1220000, 1100000};

	static const opp_t mm_opp_low_es1 =  {OPP_LOW,	950000,  177333};
	static const opp_t mm_opp_nom_es1 =  {OPP_NOM,	1040000, 354667};
	static const opp_t mm_opp_high_es1 = {OPP_HIGH,	1220000, 532000};

	static const opp_t core_opp_low_es1 = {OPP_LOW,	950000,  133000};
	static const opp_t core_opp_nom_es1 = {OPP_NOM,	1040000, 2660000};

	/* ES2.0 */
	static const opp_t mpu_opp_low  = {OPP_LOW,	880000,  500000};
	static const opp_t mpu_opp_nom  = {OPP_NOM,	1060000, 1000000};
	static const opp_t mpu_opp_high = {OPP_HIGH,	1250000, 1500000};
	static const opp_t mpu_opp_sb =   {OPP_SB,	1290000, 1700000};

	static const opp_t mm_opp_low =  {OPP_LOW,	880000,  195000};
	static const opp_t mm_opp_nom =  {OPP_NOM,	1030000, 389000};
	static const opp_t mm_opp_high = {OPP_HIGH,	1120000, 532000};

	static const opp_t core_opp_low = {OPP_LOW,	880000,  133000};
	static const opp_t core_opp_nom = {OPP_NOM,	1040000, 2660000};

	#ifdef OPP54XX_DEBUG
	int i, count;
	voltdm54xx_id vdd;
	#endif

	if (!opp54xx_init_done) {
		genlist_init(&vdd54xx_wkup_opp_list);
		opp.name = OPP_NOM;
		opp.voltage = 1.0;
		opp.rate = clk54xx_sysclk_rate_get();
		genlist_addtail(&vdd54xx_wkup_opp_list,
			(void *) &opp, sizeof(opp_t));

		genlist_init(&vdd54xx_mpu_opp_list);
		if (cpu_revision_get() == REV_ES1_0) {
			genlist_addtail(&vdd54xx_mpu_opp_list,
				(void *) &mpu_opp_low_es1, sizeof(opp_t));
			genlist_addtail(&vdd54xx_mpu_opp_list,
				(void *) &mpu_opp_nom_es1, sizeof(opp_t));
			genlist_addtail(&vdd54xx_mpu_opp_list,
				(void *) &mpu_opp_high_es1, sizeof(opp_t));

			genlist_init(&vdd54xx_mm_opp_list);
			genlist_addtail(&vdd54xx_mm_opp_list,
				(void *) &mm_opp_low_es1, sizeof(opp_t));
			genlist_addtail(&vdd54xx_mm_opp_list,
				(void *) &mm_opp_nom_es1, sizeof(opp_t));
			genlist_addtail(&vdd54xx_mm_opp_list,
				(void *) &mm_opp_high_es1, sizeof(opp_t));

			genlist_init(&vdd54xx_core_opp_list);
			genlist_addtail(&vdd54xx_core_opp_list,
				(void *) &core_opp_low_es1, sizeof(opp_t));
			genlist_addtail(&vdd54xx_core_opp_list,
				(void *) &core_opp_nom_es1, sizeof(opp_t));
		} else {
			genlist_addtail(&vdd54xx_mpu_opp_list,
				(void *) &mpu_opp_low, sizeof(opp_t));
			genlist_addtail(&vdd54xx_mpu_opp_list,
				(void *) &mpu_opp_nom, sizeof(opp_t));
			genlist_addtail(&vdd54xx_mpu_opp_list,
				(void *) &mpu_opp_high, sizeof(opp_t));
			genlist_addtail(&vdd54xx_mpu_opp_list,
				(void *) &mpu_opp_sb, sizeof(opp_t));

			genlist_init(&vdd54xx_mm_opp_list);
			genlist_addtail(&vdd54xx_mm_opp_list,
				(void *) &mm_opp_low, sizeof(opp_t));
			genlist_addtail(&vdd54xx_mm_opp_list,
				(void *) &mm_opp_nom, sizeof(opp_t));
			genlist_addtail(&vdd54xx_mm_opp_list,
				(void *) &mm_opp_high, sizeof(opp_t));

			genlist_init(&vdd54xx_core_opp_list);
			genlist_addtail(&vdd54xx_core_opp_list,
				(void *) &core_opp_low, sizeof(opp_t));
			genlist_addtail(&vdd54xx_core_opp_list,
				(void *) &core_opp_nom, sizeof(opp_t));
		}

		opp54xx_init_done = 1;
		#ifdef OPP54XX_DEBUG
		printf("%s(): init done.\n", __func__);
		printf("OPP List:\n");
		for (vdd = VDD54XX_WKUP; vdd <= VDD54XX_CORE; vdd++) {
			count = genlist_getcount(
				(genlist *) opp54xx_list_table_es1[vdd]);
			printf("  %s (%d): ", voltdm54xx_name_get(vdd), count);
			for (i = 0; i < count; i++) {
				genlist_get(
					(genlist *) opp54xx_list_table_es1[vdd],
					i, (void *) &opp);
				printf("%s (%.1lfMHz, %.3lfV)",
					opp.name, khz2mhz(opp.rate),
					uv2v(opp.voltage));
				if (i != count - 1)
					printf(", ");
			}
			printf(".\n");
		}
		#endif
	}
}
コード例 #13
0
ファイル: opp_dra7xx.c プロジェクト: IngenicC/omapconf
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		opp_dra7xx_init
 * @BRIEF		initialize internal data
 * @DESCRIPTION		initialize internal data (architecture dependent)
 *//*------------------------------------------------------------------------ */
void opp_dra7xx_init(void)
{
	static const opp_t core_opp_nom = {OPP_NOM,	1030000, 266000};

	static const opp_t mpu_opp_nom  = {OPP_NOM,	1060000, 1000000};
	static const opp_t mpu_opp_od =   {OPP_OD,	1160000, 1176000};
	static const opp_t mpu_opp_high = {OPP_HIGH,	1250000, 1500000};

	/*
	 * opp_dra7xx_list is just a reference of how many opp that a
	 * voltage manager has, so only need to add either dsp or eve,
	 * to indicating there are opp_nom, and opp_od for VDD_DSPEVE.
	 */
	static const opp_t dsp_opp_nom =  {OPP_NOM,	1060000, 600000};
	static const opp_t dsp_opp_od =   {OPP_OD,	1150000, 700000};

	static const opp_t iva_opp_nom  = {OPP_NOM,	1060000, 388300};
	static const opp_t iva_opp_od =   {OPP_OD,	1160000, 430000};
	static const opp_t iva_opp_high = {OPP_HIGH,	1250000, 532000};

	static const opp_t gpu_opp_nom  = {OPP_NOM,	1060000, 425600};
	static const opp_t gpu_opp_od =   {OPP_OD,	1160000, 500000};
	static const opp_t gpu_opp_high = {OPP_HIGH,	1250000, 532000};

	static const opp_t rtc_opp_nom = {OPP_NOM,	1030000, 34000};

	#ifdef OPP_DRA7XX_DEBUG
	int i, count;
	voltdm_dra7xx_id vdd;
	#endif

	if (!opp_dra7xx_init_done) {
		genlist_init(&vdd_dra7xx_core_opp_list);
		genlist_addtail(&vdd_dra7xx_core_opp_list,
			(void *) &core_opp_nom, sizeof(opp_t));

		genlist_init(&vdd_dra7xx_mpu_opp_list);
		genlist_addtail(&vdd_dra7xx_mpu_opp_list,
			(void *) &mpu_opp_nom, sizeof(opp_t));
		genlist_addtail(&vdd_dra7xx_mpu_opp_list,
			(void *) &mpu_opp_od, sizeof(opp_t));
		genlist_addtail(&vdd_dra7xx_mpu_opp_list,
			(void *) &mpu_opp_high, sizeof(opp_t));

		genlist_init(&vdd_dra7xx_dspeve_opp_list);
		genlist_addtail(&vdd_dra7xx_dspeve_opp_list,
			(void *) &dsp_opp_nom, sizeof(opp_t));
		genlist_addtail(&vdd_dra7xx_dspeve_opp_list,
			(void *) &dsp_opp_od, sizeof(opp_t));

		genlist_init(&vdd_dra7xx_iva_opp_list);
		genlist_addtail(&vdd_dra7xx_iva_opp_list,
			(void *) &iva_opp_nom, sizeof(opp_t));
		genlist_addtail(&vdd_dra7xx_iva_opp_list,
			(void *) &iva_opp_od, sizeof(opp_t));
		genlist_addtail(&vdd_dra7xx_iva_opp_list,
			(void *) &iva_opp_high, sizeof(opp_t));

		genlist_init(&vdd_dra7xx_gpu_opp_list);
		genlist_addtail(&vdd_dra7xx_gpu_opp_list,
			(void *) &gpu_opp_nom, sizeof(opp_t));
		genlist_addtail(&vdd_dra7xx_gpu_opp_list,
			(void *) &gpu_opp_od, sizeof(opp_t));
		genlist_addtail(&vdd_dra7xx_gpu_opp_list,
			(void *) &gpu_opp_high, sizeof(opp_t));

		genlist_init(&vdd_dra7xx_rtc_opp_list);
		genlist_addtail(&vdd_dra7xx_rtc_opp_list,
			(void *) &rtc_opp_nom, sizeof(opp_t));

		opp_dra7xx_init_done = 1;
		#ifdef OPP_DRA7XX_DEBUG
		printf("%s(): init done.\n", __func__);
		printf("OPP List:\n");
		for (vdd = VDD_DRA7XX_WKUP; vdd < VDD_DRA7XX_ID_MAX; vdd++) {
			count = genlist_getcount(
				(genlist *) opp_dra7xx_list_table[vdd]);
			printf("  %s (%d): ", voltdm_dra7xx_name_get(vdd), count);
			for (i = 0; i < count; i++) {
				genlist_get(
					(genlist *) opp_dra7xx_list_table[vdd],
					i, (void *) &opp);
				printf("%s (%.1lfMHz, %.3lfV)",
					opp.name, khz2mhz(opp.rate),
					uv2v(opp.voltage));
				if (i != count - 1)
					printf(", ");
			}
			printf(".\n");
		}
		#endif
	}
}