nrhw24: adjust memory layout for boot

This commit is contained in:
Rene Straub 2019-11-28 12:10:47 +01:00
parent 5125214491
commit b7eaf1a458
2 changed files with 71 additions and 44 deletions

View File

@ -348,7 +348,7 @@ struct reset_registers {
uint32_t value_crc;
};
#ifdef CONFIG_NRSW
#ifdef CONFIG_NRSW_BUILD
/* TODO: Move ethernet crc to dedicated file */
static uint32_t ether_crc(size_t len, uint8_t const *p)
@ -420,7 +420,7 @@ void am33xx_spl_board_init(void)
/* Set MPU Frequency to what we detected now that voltages are set */
do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
#ifdef CONFIG_NRSW
#ifdef CONFIG_NRSW_BUILD
/* TODO: Move to board_late_init? It is not urgent to have this in SPL. */
check_pmic_reset_reason(RESET_REASON_SHM_LOCATION);
#endif
@ -715,7 +715,7 @@ static void get_variant_name(void)
static void get_hw_version(void)
{
#ifdef CONFIG_NRSW
#ifdef CONFIG_NRSW_BUILD
char hw_versions[16];
char new_env[256]; /* current bootargs = 84 bytes */
#endif
@ -725,7 +725,7 @@ static void get_hw_version(void)
printf("HW24: V%d.%d\n", hw_ver, hw_rev);
#ifdef CONFIG_NRSW
#ifdef CONFIG_NRSW_BUILD
/* add hardware versions to environment */
snprintf(hw_versions, sizeof(hw_versions), "CP=%d.%d", hw_ver, hw_rev);
snprintf(new_env, sizeof(new_env), "setenv bootargs $bootargs %s", hw_versions);
@ -1240,6 +1240,36 @@ static void ft_hw_info(void *blob)
}
}
static void ft_override_thermal(void *blob)
{
const char* temp_alert0 = getenv("temp_alert0");
if (temp_alert0 != NULL) {
int node_ofs = -1;
int temp_in_degs = 0;
temp_in_degs = simple_strtoul(temp_alert0, NULL, 10);
if (temp_in_degs == 0) {
temp_in_degs = 95;
} else if (temp_in_degs < 20) {
temp_in_degs = 20;
} else if (temp_in_degs > 120) {
temp_in_degs = 120;
}
printf("WARNING: Overriding CPU thermal alert to %d°C, critical to 125°C\n", temp_in_degs);
node_ofs = fdt_path_offset(blob, "/thermal-zones/cpu-thermal/trips/cpu-alert0");
if (node_ofs >= 0) {
fdt_setprop_inplace_u32(blob, node_ofs, "temperature", temp_in_degs*1000);
}
node_ofs = fdt_path_offset(blob, "/thermal-zones/cpu-thermal/trips/cpu-crit");
if (node_ofs >= 0) {
fdt_setprop_inplace_u32(blob, node_ofs, "temperature", 125*1000);
}
}
}
int ft_board_setup(void *blob, bd_t *bd)
{
ft_bootloader_version(blob);
@ -1256,6 +1286,8 @@ int ft_board_setup(void *blob, bd_t *bd)
*/
/* ft_enable_node(blob, "/ocp/serial@44e09000"); */
ft_override_thermal(blob);
return 0;
}

View File

@ -19,11 +19,6 @@
#include <configs/ti_am335x_common.h>
/* TODO: Inject via build system */
#define CONFIG_NRSW
/* Disable U-Boot load from filesystems, to save around 10 kB SPL image size */
#ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
# undef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
@ -75,48 +70,45 @@ int eth_phy_timeout(void);
#ifndef CONFIG_SPL_BUILD
/*
* Memory map for booting Linux
*
* 0x80000000 63MB KERNEL_ADDR (kernel_addr), kernel execution address
* 0x83F00000 1MB FDT_ADDR_R (fdt_addr_r), device tree loading address if not included in kernel
* 126MB INIT_RD_HIGH (initrd_high), ramdisc top address for relocation
* 0x8BE00000 2MB PXE_ADDR (pxefile_addr_r), pxe configuration file (pxe get command)
* 0x8C000000 1MB LOAD_ADDR (load_addr), loading address for generic files
* 0x8C100000 31MB KERNEL_ADDR_R (kernel_addr_r), kernel loading address (will be relocated to kernel_addr)
* 0x80000000 32MB KERNEL_ADDR (kernel_addr), kernel execution address
* 0x82000000 190MB KERNEL_ADDR_R (kernel_addr_r), FIT image/kernel loading address
* kernel will be relocated kernel_addr
* for FIT images, ramdisc and dtb will be relocated to
* top of bootmemory (0x8e000000 downwards)
* 0x8BE00000 1MB FDT_ADDR_R (fdt_addr_r), device tree if separate from kernel/FIT
* 0x8BF00000 1MB PXE_ADDR (pxefile_addr_r), pxe configuration file (pxe get command)
* 0x8C000000 32MB LOAD_ADDR (load_addr), loading address for generic files
* <end of boot memory>
* 0x8E000000 4B NRSW reset reason
* 0x90000000 256MB <>, Free space 512MB systems
* 32MB <>, Free space
* 0x90000000 256MB <>, Free space, 512MB systems
* 0xA0000000 512MB <>, Free space, 1GB systems only
* 0xC0000000 End of RAM
*
* ((0x84000000 126MB RD_ADDR (ramdisk_addr_r), ramdisc loading address))
*/
#define KERNEL_ADDR "0x80000000"
/*#define FDT_ADDR "0x82000000" */ /* NRSW, trying to use FDT_ADDR_R = 0x83F00000 instead */
#define FDT_ADDR_R "0x83F00000"
#define PXE_ADDR "0x8BE00000"
#define KERNEL_ADDR_R "0x82000000"
#define FDT_ADDR_R "0x8BE00000"
#define PXE_ADDR "0x8BF00000"
#define LOAD_ADDR "0x8C000000"
#define KERNEL_ADDR_R "0x8C100000"
/* TODO: Check this with 1 GByte system */
/* Most likely ramdisk and FDT will be loaded to too high adresses and boot will fail */
#if 0
/*
* Avoid copying ramdisc and dtb above 512MB, as it breaks Linux boot.
* -1 means "do not copy" to high address, use in place.
* Limit boot memory to 256 MBytes to comply with kernel initial memory layout
* This is the official way to restrict image load addresses.
* Don't use xx_high_addr variables.
*/
#define INITRD_HIGH_ADDR "0x8BE0000"
#define RD_ADDR "0x84000000"
#define FDT_HIGH_ADDR "0x87000000"
#define FDT_HIGH_ADDR "0xffffffff"
"fdt_high=" FDT_HIGH_ADDR "\0" /* Breaks NRSW, required by Yocto ! */ \
"fdt_addr=" FDT_ADDR "\0" /* NRSW only, breaks yocto, can we move that to fdt_addr_r ? */ \
"initrd_high=" INITRD_HIGH_ADDR "\0" /* (0x84000000) -> INIT_RD_ADDR (0x88000000) */ \
"ramdisk_addr_r=" RD_ADDR "\0" \
#define BOOTM_SIZE "0x0E000000"
/* Set boot command depending of software environment */
#ifndef CONFIG_NRSW_BUILD
/* Yocto/OSTree boot command */
#define MAIN_BOOTCMD "boot_ostree"
#else
/* NRSW boot command */
#define MAIN_BOOTCMD "run sdboot"
#endif
#define CONFIG_EXTRA_ENV_SETTINGS \
@ -126,6 +118,7 @@ int eth_phy_timeout(void);
"kernel_addr_r=" KERNEL_ADDR_R "\0" \
"load_addr=" LOAD_ADDR "\0" \
"pxefile_addr_r=" PXE_ADDR "\0" \
"bootm_size=" BOOTM_SIZE "\0" \
\
/* Misc */ \
"defaultconsole=ttyS1\0" \
@ -149,7 +142,7 @@ int eth_phy_timeout(void);
"$ethopts rw ostree_root=/dev/mmcblk1p1\0" \
"bootcmd_rd_in_mmc=ext4load mmc 1:1 $kernel_addr_r /boot$kernel_image; " \
"bootm $kernel_addr_r\0" \
"bootcmd=run shieldcmd; run bootcmd_otenv; run bootcmd_rd_in_mmc\0" \
"boot_ostree=run shieldcmd; run bootcmd_otenv; run bootcmd_rd_in_mmc\0" \
\
/* NRSW boot */ \
"root_part=1\0" /* from NRSW, required here? set from board.c */ \
@ -170,13 +163,15 @@ int eth_phy_timeout(void);
"fdt addr $fdt_addr;if fdt get value mmc_dev /nm_env nm,mmc-dev;then;else setenv mmc_dev mmcblk0;fi;" \
"run add_sd_bootargs; run add_version_bootargs; run shieldcmd; " \
"bootz $kernel_addr - $fdt_addr; fi\0" \
/* "bootcmd=run sdboot\0" */ \
\
/* Recovery boot */ \
/* Boot command */ \
"bootcmd=" MAIN_BOOTCMD "\0" \
\
/* Recovery boot (same for OSTree and NRSW) */ \
"recovery=run pxe_recovery || setenv ipaddr $ipaddr; setenv serverip $serverip; run tftp_recovery\0" \
/* setenv ipaddr and serverip is necessary, because dhclient can destroy the IPs internally */ \
/* setenv ipaddr and serverip is necessary, because dhclient destroys the IPs internally */ \
"pxe_recovery=mdio up $ethprime && dhcp && pxe get && pxe boot\0" \
"tftp_recovery=tftpboot $kernel_addr_r recovery-image; tftpboot $fdt_addr_r recovery-dtb; " /* kernel_addr_r ? */ \
"tftp_recovery=tftpboot $kernel_addr_r recovery-image; tftpboot $fdt_addr_r recovery-dtb; " \
"setenv bootargs rdinit=/etc/preinit console=$defaultconsole,115200 " \
"debug $ethopts; " \
"bootz $kernel_addr_r - $fdt_addr_r\0" /* kernel_addr_r */
@ -280,7 +275,7 @@ int eth_phy_timeout(void);
#define CONFIG_SYS_MEMTEST_END 0x87900000
#ifdef CONFIG_NRSW
#ifdef CONFIG_NRSW_BUILD
/* support for NM packed bootloader */
#define CONFIG_NM_BOOTLOADER_FORMAT
@ -299,7 +294,7 @@ int eth_phy_timeout(void);
#define CONFIG_JTAG_MARKER_UBOOT 0x807FFF00
/* NRSW PMIC Reset Reason */
#ifdef CONFIG_NRSW
#ifdef CONFIG_NRSW_BUILD
#define RESET_REASON_SHM_LOCATION 0x8e000000
#define EXTERNAL_WATCHDOG_PATTERN 0x781f9ce2
#endif