Example #1
0
static ssize_t type_show(struct device *dev, struct device_attribute *attr, char *buf)
{
	const char *type;

	if (cpu_is_rk3288())
		type = "rk3288";
	else if (cpu_is_rk319x())
		type = "rk319x";
	else if (cpu_is_rk3188())
		type = "rk3188";
	else if (cpu_is_rk3066b())
		type = "rk3066b";
	else if (cpu_is_rk3026())
		type = "rk3026";
	else if (cpu_is_rk30xx())
		type = "rk30xx";
	else if (cpu_is_rk2928())
		type = "rk2928";
	else if (cpu_is_rk312x())
		type = "rk312x";
	else
		type = "";

	if (rockchip_get_cpu_version())
		return sprintf(buf, "%sv%lu\n", type,
			       rockchip_get_cpu_version());

	return sprintf(buf, "%s\n", type);
}
static int __init rk3188_ddr_init(void)
{
	if (cpu_is_rk3188()) {

		ddr_change_freq = _ddr_change_freq;
		ddr_round_rate = _ddr_round_rate;
		ddr_set_auto_self_refresh = _ddr_set_auto_self_refresh;

		ddr_init(DDR3_DEFAULT, 300);
	}

	return 0;
}
static int __init rk3188_pie_init(void)
{
	int err;

	if (!cpu_is_rk3188())
		return 0;

	err = rockchip_pie_init();
	if (err)
		return err;

	rockchip_pie_chunk = pie_load_sections(rockchip_sram_pool, rk3188);
	if (IS_ERR(rockchip_pie_chunk)) {
		err = PTR_ERR(rockchip_pie_chunk);
		pr_err("%s: failed to load section %d\n", __func__, err);
		rockchip_pie_chunk = NULL;
		return err;
	}

	rockchip_sram_virt = kern_to_pie(rockchip_pie_chunk, &__pie_common_start[0]);
	rockchip_sram_stack = kern_to_pie(rockchip_pie_chunk, (char *) DATA(sram_stack) + sizeof(DATA(sram_stack)));

	return 0;
}