int fdt_decode_uart_console(const void *blob, struct fdt_uart *uart, int default_baudrate) { int node; node = find_alias_node(blob, "console"); if (node < 0) return node; uart->reg = get_addr(blob, node, "reg"); uart->id = get_int(blob, node, "id", 0); uart->reg_shift = get_int(blob, node, "reg_shift", 2); uart->baudrate = get_int(blob, node, "baudrate", default_baudrate); uart->clock_freq = get_int(blob, node, "clock-frequency", -1); uart->multiplier = get_int(blob, node, "multiplier", 16); uart->divisor = get_int(blob, node, "divisor", -1); uart->enabled = get_is_enabled(blob, node, 1); uart->interrupt = get_int(blob, node, "interrupts", -1); uart->silent = get_config_int(blob, "silent_console", 0); uart->compat = fdt_decode_lookup(blob, node); #if !defined(CONFIG_SYS_PLLP_BASE_IS_408MHZ) uart->clock_freq = 216000000; #endif /* Calculate divisor if required */ if (uart->divisor == -1) fdt_decode_uart_calc_divisor(uart); return 0; }
int fdt_decode_next_alias(const void *blob, const char *name, enum fdt_compat_id id, int *upto) { #define MAX_STR_LEN 20 char str[MAX_STR_LEN + 20]; int node, err; sprintf(str, "%.*s%d", MAX_STR_LEN, name, *upto); (*upto)++; node = find_alias_node(blob, str); if (node < 0) return node; err = fdt_node_check_compatible(blob, node, compat_names[id]); if (err < 0) return err; return err ? -FDT_ERR_MISSING : node; }
int fdtdec_next_alias(const void *blob, const char *name, enum fdt_compat_id id, int *upto) { #define MAX_STR_LEN 20 char str[MAX_STR_LEN + 20]; int node, err; /* snprintf() is not available */ assert(strlen(name) < MAX_STR_LEN); sprintf(str, "%.*s%d", MAX_STR_LEN, name, *upto); (*upto)++; node = find_alias_node(blob, str); if (node < 0) return node; err = fdt_node_check_compatible(blob, node, compat_names[id]); if (err < 0) return err; return err ? -FDT_ERR_NOTFOUND : node; }