introduce barebox_set_model
Instead of calling of_get_model() in barebox_get_model() add a barebox_set_model() and use it to set the boardinfo once it's available from the devicetree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
b986f4f1ee
commit
775ba3c093
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
|
||||||
int errno;
|
int errno;
|
||||||
EXPORT_SYMBOL(errno);
|
EXPORT_SYMBOL(errno);
|
||||||
|
@ -126,19 +127,25 @@ EXPORT_SYMBOL(perror);
|
||||||
void (*do_execute)(void *func, int argc, char *argv[]);
|
void (*do_execute)(void *func, int argc, char *argv[]);
|
||||||
EXPORT_SYMBOL(do_execute);
|
EXPORT_SYMBOL(do_execute);
|
||||||
|
|
||||||
static const char *model;
|
static char *model;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The model is the verbose name of a board. It can contain
|
||||||
|
* whitespaces, uppercase/lowcer letters, digits, ',', '.'
|
||||||
|
* '-', '_'
|
||||||
|
*/
|
||||||
|
void barebox_set_model(const char *__model)
|
||||||
|
{
|
||||||
|
free(model);
|
||||||
|
model = xstrdup(__model);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(barebox_set_model);
|
||||||
|
|
||||||
const char *barebox_get_model(void)
|
const char *barebox_get_model(void)
|
||||||
{
|
{
|
||||||
if (model)
|
if (model)
|
||||||
return model;
|
return model;
|
||||||
|
|
||||||
model = of_get_model();
|
return CONFIG_BOARDINFO;
|
||||||
if (model)
|
|
||||||
model = xstrdup(model);
|
|
||||||
else
|
|
||||||
model = CONFIG_BOARDINFO;
|
|
||||||
|
|
||||||
return model;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(barebox_get_model);
|
EXPORT_SYMBOL(barebox_get_model);
|
||||||
|
|
|
@ -1610,6 +1610,9 @@ int of_probe(void)
|
||||||
of_chosen = of_find_node_by_path("/chosen");
|
of_chosen = of_find_node_by_path("/chosen");
|
||||||
of_property_read_string(root_node, "model", &of_model);
|
of_property_read_string(root_node, "model", &of_model);
|
||||||
|
|
||||||
|
if (of_model)
|
||||||
|
barebox_set_model(of_model);
|
||||||
|
|
||||||
__of_parse_phandles(root_node);
|
__of_parse_phandles(root_node);
|
||||||
|
|
||||||
memory = of_find_node_by_path("/memory");
|
memory = of_find_node_by_path("/memory");
|
||||||
|
|
|
@ -235,6 +235,7 @@ static inline void barebox_banner(void) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *barebox_get_model(void);
|
const char *barebox_get_model(void);
|
||||||
|
void barebox_set_model(const char *);
|
||||||
|
|
||||||
#define IOMEM(addr) ((void __force __iomem *)(addr))
|
#define IOMEM(addr) ((void __force __iomem *)(addr))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue