#include <dm/device.h>
#include <dm/uclass.h>
#include <i2c.h>
+#include <linux/ctype.h>
#include <linux/delay.h>
#include <log.h>
#include <power/regulator.h>
binman_sym_declare(ulong, ddr_fw, image_pos);
binman_sym_declare(ulong, ddr_fw, size);
+char product_name[I2C_BUF_SIZE] = "k1";
+
static void i2c_early_init(void)
{
struct udevice *bus;
udelay(10);
}
-void *board_spl_fit_buffer_addr(ulong fit_size, int sectors, int bl_len)
-{
- return (void *)CONFIG_SPL_LOAD_FIT_ADDRESS;
-}
-
void board_init_f(ulong dummy)
{
- u8 i2c_buf[I2C_BUF_SIZE] = { 0 };
int ret;
ret = spl_early_init();
preloader_console_init();
i2c_early_init();
- ret = read_product_name(i2c_buf, I2C_BUF_SIZE);
+ ret = read_product_name(product_name, I2C_BUF_SIZE);
if (ret)
log_info("Fail to detect board:%d\n", ret);
else
- log_info("Get board name:%s\n", (char *)i2c_buf);
+ log_info("Get board name:%s\n", product_name);
pmic_init();
ddr_early_init();
void spl_board_init(void)
{
}
+
+int board_fit_config_name_match(const char *name)
+{
+ char fdt_name[I2C_BUF_SIZE];
+ int i;
+
+ memset(fdt_name, 0, I2C_BUF_SIZE);
+ if (!strncmp(product_name, "k1-x_", 5)) {
+ snprintf(fdt_name, I2C_BUF_SIZE, "%s-%s", "k1",
+ &product_name[5]);
+ }
+ if (fdt_name[0] == '\0') {
+ /* set default board name */
+ sprintf(fdt_name, "k1-musepi-pro");
+ }
+ for (i = 0; i < I2C_BUF_SIZE; i++) {
+ if (fdt_name[i] == '\0')
+ break;
+ fdt_name[i] = tolower(fdt_name[i]);
+ }
+ if (!strcmp(name, fdt_name))
+ return 0;
+ return -ENOENT;
+}
+
+void *board_spl_fit_buffer_addr(ulong fit_size, int sectors, int bl_len)
+{
+ return (void *)CONFIG_SPL_LOAD_FIT_ADDRESS;
+}
CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000000
CONFIG_DEFAULT_DEVICE_TREE="spacemit/k1-musepi-pro"
+CONFIG_OF_LIST="spacemit/k1-bananapi-f3 spacemit/k1-musepi-pro"
CONFIG_SPL_SYS_MALLOC_F_LEN=0x4000
CONFIG_SPL_STACK=0xc083fb00
CONFIG_SPL_TEXT_BASE=0xc0801000
# CONFIG_SPL_SMP is not set
CONFIG_STACK_SIZE=0x100000
CONFIG_FIT=y
+CONFIG_MULTI_DTB_FIT=y
CONFIG_SPL_HAS_LOAD_FIT_ADDRESS=y
CONFIG_SPL_LOAD_FIT_ADDRESS=0x08000000
CONFIG_SUPPORT_RAW_INITRD=y