Skip to content
Snippets Groups Projects
Commit ec48bb19 authored by Oleksii Kutuzov's avatar Oleksii Kutuzov
Browse files

[E58] Add setting ram and can oerlays via straps management

parent 964e5c35
No related branches found
No related tags found
No related merge requests found
......@@ -112,5 +112,8 @@ int board_late_init(void)
mtk_efuse_read_mac();
strap_show();
strap_dtbo_ram_setup();
strap_dtbo_can_setup();
return 0;
}
......@@ -112,5 +112,8 @@ int board_late_init(void)
mtk_efuse_read_mac();
strap_show();
strap_dtbo_ram_setup();
strap_dtbo_can_setup();
return 0;
}
......@@ -11,6 +11,9 @@
#include <log.h>
#include <dm.h>
#include <i2c.h>
#include <env.h>
#include <stdio.h>
#include <string.h>
#include "strap_cfg.h"
#define BUS_NUM 3
......@@ -267,3 +270,54 @@ void strap_show(void)
}
printf(")\n");
}
void strap_dtbo_ram_setup(void)
{
const char *ram_conf_val = "";
// Get the current RAM configuration
unsigned int ram_cfg = GET_E58_RAM_STRAPS;
// Determine the appropriate config string based on RAM configuration
switch (ram_cfg) {
case RAM_1GB:
ram_conf_val = "#conf-dram-1gb.dtbo";
break;
case RAM_2GB:
ram_conf_val = "#conf-dram-2gb.dtbo";
break;
case RAM_4GB:
ram_conf_val = "#conf-dram-4gb.dtbo";
break;
case RAM_8GB:
ram_conf_val = "#conf-dram-8gb.dtbo";
break;
default:
ram_conf_val = "";
break;
}
// Set the ram_conf environment variable
if (env_set("ram_conf", ram_conf_val)) {
printf("Error: Failed to set environment variable 'ram_conf'\n");
return;
}
debug("Set 'ram_conf' to '%s'\n", ram_conf_val);
}
void strap_dtbo_can_setup(void)
{
const char *can_conf_val = "";
if (E58_HAS_CAN)
can_conf_val = "#conf-peripheral-can.dtbo";
// Set the ram_conf environment variable
if (env_set("can_conf", can_conf_val)) {
printf("Error: Failed to set environment variable 'can_conf'\n");
return;
}
debug("Set 'can_conf' to '%s'\n", can_conf_val);
}
......@@ -10,6 +10,9 @@ int strap_get_can_cfg (void);
void strap_show (void);
void exp_strap_show (void);
void strap_dtbo_ram_setup (void);
void strap_dtbo_can_setup (void);
int read_stm32_register(int reg_addr, uint8_t *data);
typedef enum {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment