Ejemplo n.º 1
0
int board_get_revision(void)
{
	struct fdt_gpio_state gpios[CONFIG_BOARD_REV_GPIO_COUNT];
	unsigned gpio_list[CONFIG_BOARD_REV_GPIO_COUNT];
	int board_rev = -1;
	int count = 0;
	int node;

	node = fdtdec_next_compatible(gd->fdt_blob, 0,
				      COMPAT_GOOGLE_BOARD_REV);
	if (node >= 0) {
		count = fdtdec_decode_gpios(gd->fdt_blob, node,
				"google,board-rev-gpios", gpios,
				CONFIG_BOARD_REV_GPIO_COUNT);
	}
	if (count > 0) {
		int i;

		for (i = 0; i < count; i++)
			gpio_list[i] = gpios[i].gpio;
		board_rev = gpio_decode_number(gpio_list, count);
	} else {
		debug("%s: No board revision information in fdt\n", __func__);
	}

	return board_rev;
}
Ejemplo n.º 2
0
int board_get_revision(void)
{
	struct spl_machine_param *params = spl_get_machine_params();
	unsigned gpio[CONFIG_BOARD_REV_GPIO_COUNT];

	gpio[0] = params->board_rev_gpios & 0xffff;
	gpio[1] = params->board_rev_gpios >> 16;
	return gpio_decode_number(gpio, CONFIG_BOARD_REV_GPIO_COUNT);
}