Пример #1
0
static void uart0_init(void)
{
	const char *compatible = "arm,pl011";
	struct dt_pbus_reg base;
	int ret;

	ret = dt_get_default_console_node();
	assert(ret >= 0 || ret == -FDT_ERR_NOTFOUND);

	if (ret == -FDT_ERR_NOTFOUND) {

		ret = dt_pbus_get_base_compatible(compatible, &base);
		assert(ret == 0 || ret == -FDT_ERR_NOTFOUND);

		if (ret) {
			printf("%s: %s not found in the device tree, "
				"aborting...\n",
				__func__, compatible);
			abort();
		}

	} else {
		ret = dt_pbus_translate_node(ret, 0, &base);
		assert(ret == 0);
	}

	uart0_base = ioremap(base.addr, base.size);

	if (uart0_base != (u8 *)UART_EARLY_BASE) {
		printf("WARNING: early print support may not work. "
		       "Found uart at %p, but early base is %p.\n",
			uart0_base, (u8 *)UART_EARLY_BASE);
	}
}
Пример #2
0
static void uart0_init(void)
{
	const char *compatible = "arm,pl011";
	struct dt_pbus_reg base;
	int ret;

	ret = dt_pbus_get_base_compatible(compatible, &base);
	assert(ret == 0 || ret == -FDT_ERR_NOTFOUND);

	if (ret) {
		printf("%s: %s not found in the device tree, aborting...\n",
			__func__, compatible);
		abort();
	}

	uart0_base = ioremap(base.addr, base.size);
}