1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-22 20:06:40 +00:00

fusee/sept: delegate SoC selection to individual components and keep common code SoC-agnostic

This commit is contained in:
hexkyz 2020-12-04 16:29:30 +00:00 committed by SciresM
parent 4ffdf8d525
commit 53c684a17a
20 changed files with 212 additions and 112 deletions

View file

@ -19,6 +19,7 @@
#include <string.h>
#include "di.h"
#include "fuse.h"
#include "timers.h"
#include "i2c.h"
#include "pmc.h"
@ -32,6 +33,11 @@
static uint32_t g_lcd_vendor = 0;
/* Determine the current SoC for Mariko specific code. */
static bool is_soc_mariko() {
return (fuse_get_soc_type() == 1);
}
static void do_dsi_sleep_or_register_writes(const dsi_sleep_or_register_write_t *writes, uint32_t num_writes) {
for (uint32_t i = 0; i < num_writes; i++) {
if (writes[i].kind == 1) {
@ -56,7 +62,7 @@ static void dsi_wait(uint32_t timeout, uint32_t offset, uint32_t mask, uint32_t
udelay(delay);
}
void display_init_erista(void) {
static void display_init_erista(void) {
volatile tegra_car_t *car = car_get_regs();
volatile tegra_pmc_t *pmc = pmc_get_regs();
volatile tegra_pinmux_t *pinmux = pinmux_get_regs();
@ -206,7 +212,7 @@ void display_init_erista(void) {
do_register_writes(DI_BASE, display_config_dc_02, 113);
}
void display_init_mariko(void) {
static void display_init_mariko(void) {
volatile tegra_car_t *car = car_get_regs();
volatile tegra_pmc_t *pmc = pmc_get_regs();
volatile tegra_pinmux_t *pinmux = pinmux_get_regs();
@ -366,7 +372,7 @@ void display_init_mariko(void) {
do_register_writes(DI_BASE, display_config_dc_02, 113);
}
void display_end_erista(void) {
static void display_end_erista(void) {
volatile tegra_car_t *car = car_get_regs();
volatile tegra_pinmux_t *pinmux = pinmux_get_regs();
@ -448,7 +454,7 @@ void display_end_erista(void) {
pinmux->lcd_bl_pwm = (((pinmux->lcd_bl_pwm >> 2) << 2) | 1);
}
void display_end_mariko(void) {
static void display_end_mariko(void) {
volatile tegra_car_t *car = car_get_regs();
volatile tegra_pinmux_t *pinmux = pinmux_get_regs();
@ -530,6 +536,22 @@ void display_end_mariko(void) {
pinmux->lcd_bl_pwm = (((pinmux->lcd_bl_pwm >> 2) << 2) | 1);
}
void display_init(void) {
if (is_soc_mariko()) {
display_init_mariko();
} else {
display_init_erista();
}
}
void display_end(void) {
if (is_soc_mariko()) {
display_end_mariko();
} else {
display_end_erista();
}
}
void display_backlight(bool enable) {
/* Enable Backlight PWM. */
gpio_write(GPIO_LCD_BL_PWM, enable ? GPIO_LEVEL_HIGH : GPIO_LEVEL_LOW);

View file

@ -382,10 +382,8 @@
#define MIPI_CAL_DSIC_MIPI_CAL_CONFIG_2 0x70
#define MIPI_CAL_DSID_MIPI_CAL_CONFIG_2 0x74
void display_init_erista(void);
void display_init_mariko(void);
void display_end_erista(void);
void display_end_mariko(void);
void display_init(void);
void display_end(void);
/* Switches screen backlight ON/OFF. */
void display_backlight(bool enable);

View file

@ -34,6 +34,11 @@
#include "timers.h"
#include "uart.h"
/* Determine the current SoC for Mariko specific code. */
static bool is_soc_mariko() {
return (fuse_get_soc_type() == 1);
}
static void config_oscillators(void) {
volatile tegra_car_t *car = car_get_regs();
volatile tegra_pmc_t *pmc = pmc_get_regs();
@ -209,7 +214,7 @@ static void config_se_brom(void) {
pmc->rst_status = 0;
}
void nx_hwinit_erista(bool enable_log) {
static void nx_hwinit_erista(bool enable_log) {
volatile tegra_pmc_t *pmc = pmc_get_regs();
volatile tegra_car_t *car = car_get_regs();
@ -320,13 +325,13 @@ void nx_hwinit_erista(bool enable_log) {
/* mc_config_carveout(); */
/* Save SDRAM parameters to scratch. */
sdram_save_params_erista(sdram_get_params_erista(fuse_get_dram_id()));
sdram_save_params(sdram_get_params(fuse_get_dram_id()));
/* Initialize SDRAM. */
sdram_init_erista();
sdram_init();
}
void nx_hwinit_mariko(bool enable_log) {
static void nx_hwinit_mariko(bool enable_log) {
volatile tegra_pmc_t *pmc = pmc_get_regs();
volatile tegra_car_t *car = car_get_regs();
@ -397,8 +402,16 @@ void nx_hwinit_mariko(bool enable_log) {
pmc->tzram_sec_disable = 0x3;
/* Save SDRAM parameters to scratch. */
sdram_save_params_mariko(sdram_get_params_mariko(fuse_get_dram_id()));
sdram_save_params(sdram_get_params(fuse_get_dram_id()));
/* Initialize SDRAM. */
sdram_init_mariko();
sdram_init();
}
void nx_hwinit(bool enable_log) {
if (is_soc_mariko()) {
nx_hwinit_mariko(enable_log);
} else {
nx_hwinit_erista(enable_log);
}
}

View file

@ -24,7 +24,6 @@
#define I2S_BASE 0x702D1000
#define MAKE_I2S_REG(n) MAKE_REG32(I2S_BASE + n)
void nx_hwinit_erista(bool enable_log);
void nx_hwinit_mariko(bool enable_log);
void nx_hwinit(bool enable_log);
#endif

View file

@ -99,11 +99,7 @@ static void setup_display(void) {
video_init(g_framebuffer);
/* Initialize the display. */
if (fuse_get_soc_type() == 1) {
display_init_mariko();
} else {
display_init_erista();
}
display_init();
/* Set the framebuffer. */
display_init_framebuffer(g_framebuffer);
@ -118,20 +114,12 @@ static void cleanup_display(void) {
display_backlight(false);
/* Terminate the display. */
if (fuse_get_soc_type() == 1) {
display_end_mariko();
} else {
display_end_erista();
}
display_end();
}
static void setup_env(void) {
/* Initialize hardware. */
if (fuse_get_soc_type() == 1) {
nx_hwinit_mariko(false);
} else {
nx_hwinit_erista(false);
}
nx_hwinit(false);
/* Set up the exception handlers. */
setup_exception_handlers();

View file

@ -125,11 +125,7 @@ static void _check_and_display_atmosphere_fatal_error(void) {
video_init((void *)0xC0000000);
/* Initialize the display. */
if (fuse_get_soc_type() == 1) {
display_init_mariko();
} else {
display_init_erista();
}
display_init();
/* Set the framebuffer. */
display_init_framebuffer((void *)0xC0000000);
@ -225,11 +221,7 @@ void check_and_display_panic(void) {
}
/* Initialize the display. */
if (fuse_get_soc_type() == 1) {
display_init_mariko();
} else {
display_init_erista();
}
display_init();
/* Fill the screen. */
display_color_screen(color);

View file

@ -35,6 +35,11 @@
#include "sdram.inl"
#endif
/* Determine the current SoC for Mariko specific code. */
static bool is_soc_mariko() {
return (fuse_get_soc_type() == 1);
}
static void sdram_config_erista(const sdram_params_erista_t *params) {
volatile tegra_car_t *car = car_get_regs();
volatile tegra_pmc_t *pmc = pmc_get_regs();
@ -1050,7 +1055,7 @@ static void sdram_config_mariko(const sdram_params_mariko_t *params) {
AHB_ARBITRATION_XBAR_CTRL_0 = ((AHB_ARBITRATION_XBAR_CTRL_0 & 0xFFFEFFFF) | ((params->AhbArbitrationXbarCtrlMemInitDone & 0xFFFF) << 16));
}
const void *sdram_get_params_erista(uint32_t dram_id) {
static const void *sdram_get_params_erista(uint32_t dram_id) {
uint32_t sdram_params_index = sdram_params_index_table_erista[dram_id];
#ifdef CONFIG_SDRAM_COMPRESS
uint8_t *buf = (uint8_t *)0x40030000;
@ -1061,7 +1066,7 @@ const void *sdram_get_params_erista(uint32_t dram_id) {
#endif
}
const void *sdram_get_params_mariko(uint32_t dram_id) {
static const void *sdram_get_params_mariko(uint32_t dram_id) {
uint32_t sdram_params_index = sdram_params_index_table_mariko[dram_id];
#ifdef CONFIG_SDRAM_COMPRESS
uint8_t *buf = (uint8_t *)0x40030000;
@ -1072,7 +1077,7 @@ const void *sdram_get_params_mariko(uint32_t dram_id) {
#endif
}
void sdram_init_erista(void) {
static void sdram_init_erista(void) {
volatile tegra_pmc_t *pmc = pmc_get_regs();
const sdram_params_erista_t *params = (const sdram_params_erista_t *)sdram_get_params_erista(fuse_get_dram_id());
@ -1096,7 +1101,7 @@ void sdram_init_erista(void) {
sdram_config_erista(params);
}
void sdram_init_mariko(void) {
static void sdram_init_mariko(void) {
volatile tegra_pmc_t *pmc = pmc_get_regs();
const sdram_params_mariko_t *params = (const sdram_params_mariko_t *)sdram_get_params_mariko(fuse_get_dram_id());
@ -1117,7 +1122,7 @@ void sdram_init_mariko(void) {
sdram_config_mariko(params);
}
void sdram_save_params_erista(const void *save_params) {
static void sdram_save_params_erista(const void *save_params) {
const sdram_params_erista_t *params = (const sdram_params_erista_t *)save_params;
volatile tegra_pmc_t *pmc = pmc_get_regs();
@ -2218,7 +2223,7 @@ void sdram_save_params_erista(const void *save_params) {
s(PllMStableTime, 9:0, scratch4, 9:0);
}
void sdram_save_params_mariko(const void *save_params) {
static void sdram_save_params_mariko(const void *save_params) {
const sdram_params_mariko_t *params = (const sdram_params_mariko_t *)save_params;
volatile tegra_pmc_t *pmc = pmc_get_regs();
@ -3333,4 +3338,28 @@ void sdram_save_params_mariko(const void *save_params) {
c32(0, scratch4);
s(PllMStableTime, 19:0, scratch4, 19:0);
}
void sdram_init(void) {
if (is_soc_mariko()) {
sdram_init_mariko();
} else {
sdram_init_erista();
}
}
const void *sdram_get_params(uint32_t dram_id) {
if (is_soc_mariko()) {
return sdram_get_params_mariko(dram_id);
} else {
return sdram_get_params_erista(dram_id);
}
}
void sdram_save_params(const void *save_params) {
if (is_soc_mariko()) {
sdram_save_params_mariko(save_params);
} else {
sdram_save_params_erista(save_params);
}
}

View file

@ -18,11 +18,8 @@
#ifndef FUSEE_SDRAM_H_
#define FUSEE_SDRAM_H_
void sdram_init_erista(void);
void sdram_init_mariko(void);
const void *sdram_get_params_erista(uint32_t dram_id);
const void *sdram_get_params_mariko(uint32_t dram_id);
void sdram_save_params_erista(const void *save_params);
void sdram_save_params_mariko(const void *save_params);
void sdram_init(void);
const void *sdram_get_params(uint32_t dram_id);
void sdram_save_params(const void *save_params);
#endif

View file

@ -130,11 +130,7 @@ __attribute__((noreturn)) void fatal_error(const char *fmt, ...) {
video_init((void *)0xC0000000);
/* Initialize the display. */
if (fuse_get_soc_type() == 1) {
display_init_mariko();
} else {
display_init_erista();
}
display_init();
/* Set the framebuffer. */
display_init_framebuffer((void *)0xC0000000);

View file

@ -98,11 +98,7 @@ static ssize_t decode_utf8(uint32_t *out, const uint8_t *in) {
static void console_init_display(void) {
/* Initialize the display. */
if (fuse_get_soc_type() == 1) {
display_init_mariko();
} else {
display_init_erista();
}
display_init();
/* Set the framebuffer. */
display_init_framebuffer(g_framebuffer);
@ -202,11 +198,7 @@ int console_end(void) {
display_backlight(false);
/* Terminate the display. */
if (fuse_get_soc_type() == 1) {
display_end_mariko();
} else {
display_end_erista();
}
display_end();
/* Display is terminated. */
g_display_initialized = false;

View file

@ -19,6 +19,7 @@
#include <string.h>
#include "di.h"
#include "fuse.h"
#include "timers.h"
#include "i2c.h"
#include "pmc.h"
@ -32,6 +33,11 @@
static uint32_t g_lcd_vendor = 0;
/* Determine the current SoC for Mariko specific code. */
static bool is_soc_mariko() {
return (fuse_get_soc_type() == 1);
}
static void do_dsi_sleep_or_register_writes(const dsi_sleep_or_register_write_t *writes, uint32_t num_writes) {
for (uint32_t i = 0; i < num_writes; i++) {
if (writes[i].kind == 1) {
@ -56,7 +62,7 @@ static void dsi_wait(uint32_t timeout, uint32_t offset, uint32_t mask, uint32_t
udelay(delay);
}
void display_init_erista(void) {
static void display_init_erista(void) {
volatile tegra_car_t *car = car_get_regs();
volatile tegra_pmc_t *pmc = pmc_get_regs();
volatile tegra_pinmux_t *pinmux = pinmux_get_regs();
@ -206,7 +212,7 @@ void display_init_erista(void) {
do_register_writes(DI_BASE, display_config_dc_02, 113);
}
void display_init_mariko(void) {
static void display_init_mariko(void) {
volatile tegra_car_t *car = car_get_regs();
volatile tegra_pmc_t *pmc = pmc_get_regs();
volatile tegra_pinmux_t *pinmux = pinmux_get_regs();
@ -366,7 +372,7 @@ void display_init_mariko(void) {
do_register_writes(DI_BASE, display_config_dc_02, 113);
}
void display_end_erista(void) {
static void display_end_erista(void) {
volatile tegra_car_t *car = car_get_regs();
volatile tegra_pinmux_t *pinmux = pinmux_get_regs();
@ -448,7 +454,7 @@ void display_end_erista(void) {
pinmux->lcd_bl_pwm = (((pinmux->lcd_bl_pwm >> 2) << 2) | 1);
}
void display_end_mariko(void) {
static void display_end_mariko(void) {
volatile tegra_car_t *car = car_get_regs();
volatile tegra_pinmux_t *pinmux = pinmux_get_regs();
@ -530,6 +536,22 @@ void display_end_mariko(void) {
pinmux->lcd_bl_pwm = (((pinmux->lcd_bl_pwm >> 2) << 2) | 1);
}
void display_init(void) {
if (is_soc_mariko()) {
display_init_mariko();
} else {
display_init_erista();
}
}
void display_end(void) {
if (is_soc_mariko()) {
display_end_mariko();
} else {
display_end_erista();
}
}
void display_backlight(bool enable) {
/* Enable Backlight PWM. */
gpio_write(GPIO_LCD_BL_PWM, enable ? GPIO_LEVEL_HIGH : GPIO_LEVEL_LOW);

View file

@ -382,10 +382,8 @@
#define MIPI_CAL_DSIC_MIPI_CAL_CONFIG_2 0x70
#define MIPI_CAL_DSID_MIPI_CAL_CONFIG_2 0x74
void display_init_erista(void);
void display_init_mariko(void);
void display_end_erista(void);
void display_end_mariko(void);
void display_init(void);
void display_end(void);
/* Switches screen backlight ON/OFF. */
void display_backlight(bool enable);

View file

@ -70,11 +70,7 @@ void check_and_display_panic(void) {
}
/* Initialize the display. */
if (fuse_get_soc_type() == 1) {
display_init_mariko();
} else {
display_init_erista();
}
display_init();
/* Fill the screen. */
display_color_screen(color);

View file

@ -19,6 +19,7 @@
#include <string.h>
#include "di.h"
#include "fuse.h"
#include "timers.h"
#include "i2c.h"
#include "pmc.h"
@ -32,6 +33,11 @@
static uint32_t g_lcd_vendor = 0;
/* Determine the current SoC for Mariko specific code. */
static bool is_soc_mariko() {
return (fuse_get_soc_type() == 1);
}
static void do_dsi_sleep_or_register_writes(const dsi_sleep_or_register_write_t *writes, uint32_t num_writes) {
for (uint32_t i = 0; i < num_writes; i++) {
if (writes[i].kind == 1) {
@ -56,7 +62,7 @@ static void dsi_wait(uint32_t timeout, uint32_t offset, uint32_t mask, uint32_t
udelay(delay);
}
void display_init_erista(void) {
static void display_init_erista(void) {
volatile tegra_car_t *car = car_get_regs();
volatile tegra_pmc_t *pmc = pmc_get_regs();
volatile tegra_pinmux_t *pinmux = pinmux_get_regs();
@ -206,7 +212,7 @@ void display_init_erista(void) {
do_register_writes(DI_BASE, display_config_dc_02, 113);
}
void display_init_mariko(void) {
static void display_init_mariko(void) {
volatile tegra_car_t *car = car_get_regs();
volatile tegra_pmc_t *pmc = pmc_get_regs();
volatile tegra_pinmux_t *pinmux = pinmux_get_regs();
@ -366,7 +372,7 @@ void display_init_mariko(void) {
do_register_writes(DI_BASE, display_config_dc_02, 113);
}
void display_end_erista(void) {
static void display_end_erista(void) {
volatile tegra_car_t *car = car_get_regs();
volatile tegra_pinmux_t *pinmux = pinmux_get_regs();
@ -448,7 +454,7 @@ void display_end_erista(void) {
pinmux->lcd_bl_pwm = (((pinmux->lcd_bl_pwm >> 2) << 2) | 1);
}
void display_end_mariko(void) {
static void display_end_mariko(void) {
volatile tegra_car_t *car = car_get_regs();
volatile tegra_pinmux_t *pinmux = pinmux_get_regs();
@ -530,6 +536,22 @@ void display_end_mariko(void) {
pinmux->lcd_bl_pwm = (((pinmux->lcd_bl_pwm >> 2) << 2) | 1);
}
void display_init(void) {
if (is_soc_mariko()) {
display_init_mariko();
} else {
display_init_erista();
}
}
void display_end(void) {
if (is_soc_mariko()) {
display_end_mariko();
} else {
display_end_erista();
}
}
void display_backlight(bool enable) {
/* Enable Backlight PWM. */
gpio_write(GPIO_LCD_BL_PWM, enable ? GPIO_LEVEL_HIGH : GPIO_LEVEL_LOW);

View file

@ -382,10 +382,8 @@
#define MIPI_CAL_DSIC_MIPI_CAL_CONFIG_2 0x70
#define MIPI_CAL_DSID_MIPI_CAL_CONFIG_2 0x74
void display_init_erista(void);
void display_init_mariko(void);
void display_end_erista(void);
void display_end_mariko(void);
void display_init(void);
void display_end(void);
/* Switches screen backlight ON/OFF. */
void display_backlight(bool enable);

View file

@ -34,6 +34,11 @@
#include "timers.h"
#include "uart.h"
/* Determine the current SoC for Mariko specific code. */
static bool is_soc_mariko() {
return (fuse_get_soc_type() == 1);
}
static void config_oscillators(void) {
volatile tegra_car_t *car = car_get_regs();
volatile tegra_pmc_t *pmc = pmc_get_regs();
@ -209,7 +214,7 @@ static void config_se_brom(void) {
pmc->rst_status = 0;
}
void nx_hwinit_erista(bool enable_log) {
static void nx_hwinit_erista(bool enable_log) {
volatile tegra_pmc_t *pmc = pmc_get_regs();
volatile tegra_car_t *car = car_get_regs();
@ -320,13 +325,13 @@ void nx_hwinit_erista(bool enable_log) {
/* mc_config_carveout(); */
/* Save SDRAM parameters to scratch. */
sdram_save_params_erista(sdram_get_params_erista(fuse_get_dram_id()));
sdram_save_params(sdram_get_params(fuse_get_dram_id()));
/* Initialize SDRAM. */
sdram_init_erista();
sdram_init();
}
void nx_hwinit_mariko(bool enable_log) {
static void nx_hwinit_mariko(bool enable_log) {
volatile tegra_pmc_t *pmc = pmc_get_regs();
volatile tegra_car_t *car = car_get_regs();
@ -397,8 +402,16 @@ void nx_hwinit_mariko(bool enable_log) {
pmc->tzram_sec_disable = 0x3;
/* Save SDRAM parameters to scratch. */
sdram_save_params_mariko(sdram_get_params_mariko(fuse_get_dram_id()));
sdram_save_params(sdram_get_params(fuse_get_dram_id()));
/* Initialize SDRAM. */
sdram_init_mariko();
sdram_init();
}
void nx_hwinit(bool enable_log) {
if (is_soc_mariko()) {
nx_hwinit_mariko(enable_log);
} else {
nx_hwinit_erista(enable_log);
}
}

View file

@ -24,7 +24,6 @@
#define I2S_BASE 0x702D1000
#define MAKE_I2S_REG(n) MAKE_REG32(I2S_BASE + n)
void nx_hwinit_erista(bool enable_log);
void nx_hwinit_mariko(bool enable_log);
void nx_hwinit(bool enable_log);
#endif

View file

@ -108,13 +108,13 @@ static void setup_env(void) {
g_framebuffer = (void *)0xC0000000;
/* Initialize hardware. */
nx_hwinit_erista(false);
nx_hwinit(false);
/* Zero-fill the framebuffer and register it as printk provider. */
video_init(g_framebuffer);
/* Initialize the display. */
display_init_erista();
display_init();
/* Set the framebuffer. */
display_init_framebuffer(g_framebuffer);
@ -131,7 +131,7 @@ static void cleanup_env(void) {
unmount_sd();
/* Terminate the display. */
display_end_erista();
display_end();
}
static void exit_callback(int rc) {

View file

@ -35,6 +35,11 @@
#include "sdram.inl"
#endif
/* Determine the current SoC for Mariko specific code. */
static bool is_soc_mariko() {
return (fuse_get_soc_type() == 1);
}
static void sdram_config_erista(const sdram_params_erista_t *params) {
volatile tegra_car_t *car = car_get_regs();
volatile tegra_pmc_t *pmc = pmc_get_regs();
@ -1050,7 +1055,7 @@ static void sdram_config_mariko(const sdram_params_mariko_t *params) {
AHB_ARBITRATION_XBAR_CTRL_0 = ((AHB_ARBITRATION_XBAR_CTRL_0 & 0xFFFEFFFF) | ((params->AhbArbitrationXbarCtrlMemInitDone & 0xFFFF) << 16));
}
const void *sdram_get_params_erista(uint32_t dram_id) {
static const void *sdram_get_params_erista(uint32_t dram_id) {
uint32_t sdram_params_index = sdram_params_index_table_erista[dram_id];
#ifdef CONFIG_SDRAM_COMPRESS
uint8_t *buf = (uint8_t *)0x40030000;
@ -1061,7 +1066,7 @@ const void *sdram_get_params_erista(uint32_t dram_id) {
#endif
}
const void *sdram_get_params_mariko(uint32_t dram_id) {
static const void *sdram_get_params_mariko(uint32_t dram_id) {
uint32_t sdram_params_index = sdram_params_index_table_mariko[dram_id];
#ifdef CONFIG_SDRAM_COMPRESS
uint8_t *buf = (uint8_t *)0x40030000;
@ -1072,7 +1077,7 @@ const void *sdram_get_params_mariko(uint32_t dram_id) {
#endif
}
void sdram_init_erista(void) {
static void sdram_init_erista(void) {
volatile tegra_pmc_t *pmc = pmc_get_regs();
const sdram_params_erista_t *params = (const sdram_params_erista_t *)sdram_get_params_erista(fuse_get_dram_id());
@ -1096,7 +1101,7 @@ void sdram_init_erista(void) {
sdram_config_erista(params);
}
void sdram_init_mariko(void) {
static void sdram_init_mariko(void) {
volatile tegra_pmc_t *pmc = pmc_get_regs();
const sdram_params_mariko_t *params = (const sdram_params_mariko_t *)sdram_get_params_mariko(fuse_get_dram_id());
@ -1117,7 +1122,7 @@ void sdram_init_mariko(void) {
sdram_config_mariko(params);
}
void sdram_save_params_erista(const void *save_params) {
static void sdram_save_params_erista(const void *save_params) {
const sdram_params_erista_t *params = (const sdram_params_erista_t *)save_params;
volatile tegra_pmc_t *pmc = pmc_get_regs();
@ -2218,7 +2223,7 @@ void sdram_save_params_erista(const void *save_params) {
s(PllMStableTime, 9:0, scratch4, 9:0);
}
void sdram_save_params_mariko(const void *save_params) {
static void sdram_save_params_mariko(const void *save_params) {
const sdram_params_mariko_t *params = (const sdram_params_mariko_t *)save_params;
volatile tegra_pmc_t *pmc = pmc_get_regs();
@ -3333,4 +3338,28 @@ void sdram_save_params_mariko(const void *save_params) {
c32(0, scratch4);
s(PllMStableTime, 19:0, scratch4, 19:0);
}
void sdram_init(void) {
if (is_soc_mariko()) {
sdram_init_mariko();
} else {
sdram_init_erista();
}
}
const void *sdram_get_params(uint32_t dram_id) {
if (is_soc_mariko()) {
return sdram_get_params_mariko(dram_id);
} else {
return sdram_get_params_erista(dram_id);
}
}
void sdram_save_params(const void *save_params) {
if (is_soc_mariko()) {
sdram_save_params_mariko(save_params);
} else {
sdram_save_params_erista(save_params);
}
}

View file

@ -18,11 +18,8 @@
#ifndef FUSEE_SDRAM_H_
#define FUSEE_SDRAM_H_
void sdram_init_erista(void);
void sdram_init_mariko(void);
const void *sdram_get_params_erista(uint32_t dram_id);
const void *sdram_get_params_mariko(uint32_t dram_id);
void sdram_save_params_erista(const void *save_params);
void sdram_save_params_mariko(const void *save_params);
void sdram_init(void);
const void *sdram_get_params(uint32_t dram_id);
void sdram_save_params(const void *save_params);
#endif