[drivers][ofw] Update OFW #11004

Fixup fdt address reg and cells parse.
Support only option name way for earlycon.
Find the console device when using "stdout-path".
This commit is contained in:
GUI
2025-12-11 11:05:47 +08:00
committed by GitHub
parent d9ca9c449b
commit f39a86266a
6 changed files with 39 additions and 4 deletions
-1
View File
@@ -1763,7 +1763,6 @@ const char *rt_ofw_get_prop_fuzzy_name(const struct rt_ofw_node *np, const char
return propname;
}
struct rt_ofw_prop *rt_ofw_get_prop(const struct rt_ofw_node *np, const char *name, rt_ssize_t *out_length)
{
struct rt_ofw_prop *prop = RT_NULL;
+8
View File
@@ -692,7 +692,11 @@ rt_err_t rt_fdt_scan_chosen_stdout(void)
if (*options)
{
int type_len_no_option;
type_len = strchrnul(options, ',') - options;
type_len_no_option = strchrnul(options, ' ') - options;
type_len = rt_min(type_len, type_len_no_option);
}
}
@@ -795,6 +799,10 @@ rt_err_t rt_fdt_scan_chosen_stdout(void)
LOG_I("Earlycon: %s at MMIO/PIO %p (options '%s')",
con_type, fdt_earlycon.mmio, fdt_earlycon.options);
}
else if (con_type)
{
LOG_I("Earlycon: %s (options '%s')", con_type, fdt_earlycon.options);
}
return err;
}
-1
View File
@@ -155,7 +155,6 @@ rt_err_t rt_ofw_get_address(struct rt_ofw_node *np, int index, rt_uint64_t *out_
static rt_err_t ofw_get_address_by_name(struct rt_ofw_node *np, const char *name,
rt_uint64_t *out_address, rt_uint64_t *out_size)
{
int index = 0;
rt_err_t err = -RT_EEMPTY;
+9 -1
View File
@@ -14,6 +14,7 @@
#include <drivers/ofw.h>
#include <drivers/ofw_io.h>
#include <drivers/ofw_irq.h>
#include <drivers/platform.h>
#define DBG_TAG "rtdm.ofw"
#define DBG_LVL DBG_INFO
@@ -525,8 +526,15 @@ struct rt_ofw_node *rt_ofw_find_irq_parent(struct rt_ofw_node *np, int *out_inte
static int ofw_map_irq(struct rt_ofw_cell_args *irq_args)
{
int irq;
struct rt_pic *pic;
struct rt_ofw_node *ic_np = irq_args->data;
struct rt_pic *pic = rt_pic_dynamic_cast(rt_ofw_data(ic_np));
if (!rt_ofw_data(ic_np))
{
rt_platform_ofw_request(ic_np);
}
pic = rt_pic_dynamic_cast(rt_ofw_data(ic_np));
/* args.data is "interrupt-controller" */
if (pic)
+20 -1
View File
@@ -307,7 +307,26 @@ rt_err_t rt_ofw_console_setup(void)
if (err == -RT_ENOSYS && !rt_ofw_prop_read_string(ofw_node_chosen, "stdout-path", &stdout_path))
{
struct rt_ofw_node *stdout_np = rt_ofw_find_node_by_path(stdout_path);
struct rt_ofw_node *stdout_np;
if (*stdout_path != '/' && ofw_node_aliases)
{
int alias_len;
struct rt_ofw_prop *prop;
alias_len = strchrnul(stdout_path, ':') - stdout_path;
rt_ofw_foreach_prop(ofw_node_aliases, prop)
{
if (!rt_strncmp(prop->name, stdout_path, alias_len))
{
stdout_path = prop->value;
break;
}
}
}
stdout_np = rt_ofw_find_node_by_path(stdout_path);
if (stdout_np && (ofw_name = ofw_console_serial_find(con_name, stdout_np)))
{
+2
View File
@@ -93,6 +93,7 @@ int fdt_io_addr_cells(void *fdt, int nodeoffset)
if (cells_tmp)
{
cells = fdt32_to_cpu(*cells_tmp);
break;
}
}
@@ -116,6 +117,7 @@ int fdt_io_size_cells(void *fdt, int nodeoffset)
if (cells_tmp)
{
cells = fdt32_to_cpu(*cells_tmp);
break;
}
}