Loading drivers/of/fdt.c +26 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,32 @@ void of_fdt_limit_memory(int limit) } } /** * of_fdt_get_ddrtype - Return the type of ddr (4/5) on the current device * * On match, returns a non-zero positive value which matches the ddr type. * Otherwise returns -ENOENT. */ int of_fdt_get_ddrtype(void) { int memory; int len; int ret; fdt32_t *prop = NULL; memory = fdt_path_offset(initial_boot_params, "/memory"); if (memory > 0) prop = fdt_getprop_w(initial_boot_params, memory, "ddr_device_type", &len); if (!prop || len != sizeof(u32)) return -ENOENT; ret = fdt32_to_cpu(*prop); return ret; } /** * of_fdt_is_compatible - Return true if given node from the given blob has * compat in its compatible list Loading include/linux/of_fdt.h +3 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,9 @@ extern void *initial_boot_params; extern char __dtb_start[]; extern char __dtb_end[]; /* Other Prototypes */ extern int of_fdt_get_ddrtype(void); /* For scanning the flat device-tree at boot time */ extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname, int depth, void *data), Loading Loading
drivers/of/fdt.c +26 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,32 @@ void of_fdt_limit_memory(int limit) } } /** * of_fdt_get_ddrtype - Return the type of ddr (4/5) on the current device * * On match, returns a non-zero positive value which matches the ddr type. * Otherwise returns -ENOENT. */ int of_fdt_get_ddrtype(void) { int memory; int len; int ret; fdt32_t *prop = NULL; memory = fdt_path_offset(initial_boot_params, "/memory"); if (memory > 0) prop = fdt_getprop_w(initial_boot_params, memory, "ddr_device_type", &len); if (!prop || len != sizeof(u32)) return -ENOENT; ret = fdt32_to_cpu(*prop); return ret; } /** * of_fdt_is_compatible - Return true if given node from the given blob has * compat in its compatible list Loading
include/linux/of_fdt.h +3 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,9 @@ extern void *initial_boot_params; extern char __dtb_start[]; extern char __dtb_end[]; /* Other Prototypes */ extern int of_fdt_get_ddrtype(void); /* For scanning the flat device-tree at boot time */ extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname, int depth, void *data), Loading