of: separate out "generic" memory bank adding
This patch separates out the "generic" memory segment registration function (of_add_memory_bank()) from of_add_memory(). The MIPS architecture has different view on memory resources than the ARM and PPC architectures so the "generic" of_add_memory_bank() is unusable for the MIPS architecture. We can add MIPS-specific of_add_memory_bank() into arch/mips code. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
8b35646356
commit
74c4acea0d
|
@ -1,6 +1,11 @@
|
||||||
config OFTREE
|
config OFTREE
|
||||||
bool
|
bool
|
||||||
|
|
||||||
|
config OFTREE_MEM_GENERIC
|
||||||
|
depends on OFTREE
|
||||||
|
depends on PPC || ARM
|
||||||
|
def_bool y
|
||||||
|
|
||||||
config DTC
|
config DTC
|
||||||
bool
|
bool
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
obj-y += base.o fdt.o
|
obj-y += base.o fdt.o
|
||||||
|
obj-$(CONFIG_OFTREE_MEM_GENERIC) += mem_generic.o
|
||||||
obj-$(CONFIG_GPIOLIB) += gpio.o
|
obj-$(CONFIG_GPIOLIB) += gpio.o
|
||||||
obj-y += partition.o
|
obj-y += partition.o
|
||||||
obj-y += of_net.o
|
obj-y += of_net.o
|
||||||
|
|
|
@ -873,7 +873,6 @@ int of_add_memory(struct device_node *node, bool dump)
|
||||||
int na, nc;
|
int na, nc;
|
||||||
const __be32 *reg, *endp;
|
const __be32 *reg, *endp;
|
||||||
int len, r = 0, ret;
|
int len, r = 0, ret;
|
||||||
static char str[6];
|
|
||||||
const char *device_type;
|
const char *device_type;
|
||||||
|
|
||||||
ret = of_property_read_string(node, "device_type", &device_type);
|
ret = of_property_read_string(node, "device_type", &device_type);
|
||||||
|
@ -900,12 +899,7 @@ int of_add_memory(struct device_node *node, bool dump)
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sprintf(str, "ram%d", r);
|
of_add_memory_bank(node, dump, r, base, size);
|
||||||
|
|
||||||
barebox_add_memory_bank(str, base, size);
|
|
||||||
|
|
||||||
if (dump)
|
|
||||||
pr_info("%s: %s: 0x%llx@0x%llx\n", node->name, str, size, base);
|
|
||||||
|
|
||||||
r++;
|
r++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#include <common.h>
|
||||||
|
#include <of.h>
|
||||||
|
#include <memory.h>
|
||||||
|
|
||||||
|
void of_add_memory_bank(struct device_node *node, bool dump, int r,
|
||||||
|
u64 base, u64 size)
|
||||||
|
{
|
||||||
|
static char str[6];
|
||||||
|
|
||||||
|
sprintf(str, "ram%d", r);
|
||||||
|
barebox_add_memory_bank(str, base, size);
|
||||||
|
|
||||||
|
if (dump)
|
||||||
|
pr_info("%s: %s: 0x%llx@0x%llx\n", node->name, str, size, base);
|
||||||
|
}
|
|
@ -180,6 +180,8 @@ int of_device_is_stdout_path(struct device_d *dev);
|
||||||
const char *of_get_model(void);
|
const char *of_get_model(void);
|
||||||
void *of_flatten_dtb(struct device_node *node);
|
void *of_flatten_dtb(struct device_node *node);
|
||||||
int of_add_memory(struct device_node *node, bool dump);
|
int of_add_memory(struct device_node *node, bool dump);
|
||||||
|
void of_add_memory_bank(struct device_node *node, bool dump, int r,
|
||||||
|
u64 base, u64 size);
|
||||||
#else
|
#else
|
||||||
static inline int of_parse_partitions(struct cdev *cdev,
|
static inline int of_parse_partitions(struct cdev *cdev,
|
||||||
struct device_node *node)
|
struct device_node *node)
|
||||||
|
|
Loading…
Reference in New Issue