nmhw21: add NRSW support for NG800
- NRSW board features - memory layout update - boot configuration update
This commit is contained in:
parent
cac1b16a16
commit
ac31507a71
|
|
@ -433,6 +433,62 @@ static void init_pmic_spl(void)
|
||||||
da9063_release_i2c_bus(bus);
|
da9063_release_i2c_bus(bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct reset_registers {
|
||||||
|
uint32_t value;
|
||||||
|
uint32_t value_crc;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef CONFIG_NRSW_BUILD
|
||||||
|
|
||||||
|
/* TODO: Move ethernet crc to dedicated file */
|
||||||
|
static uint32_t ether_crc(size_t len, uint8_t const *p)
|
||||||
|
{
|
||||||
|
uint32_t crc;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
crc = ~0;
|
||||||
|
while (len--) {
|
||||||
|
crc ^= *p++;
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
crc = (crc >> 1) ^ ((crc & 1) ? 0xedb88320 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* an reverse the bits, cuz of way they arrive -- last-first */
|
||||||
|
crc = (crc >> 16) | (crc << 16);
|
||||||
|
crc = (crc >> 8 & 0x00ff00ff) | (crc << 8 & 0xff00ff00);
|
||||||
|
crc = (crc >> 4 & 0x0f0f0f0f) | (crc << 4 & 0xf0f0f0f0);
|
||||||
|
crc = (crc >> 2 & 0x33333333) | (crc << 2 & 0xcccccccc);
|
||||||
|
crc = (crc >> 1 & 0x55555555) | (crc << 1 & 0xaaaaaaaa);
|
||||||
|
|
||||||
|
return crc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void check_pmic_reset_reason(unsigned int reset_reason_shm_location)
|
||||||
|
{
|
||||||
|
volatile struct reset_registers* reset_regs = (struct reset_registers*)reset_reason_shm_location;
|
||||||
|
uint8_t state = 0x00;
|
||||||
|
int bus;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
bus = da9063_claim_i2c_bus();
|
||||||
|
|
||||||
|
ret = da9063_get_reg(PMIC_REG_FAULT_LOG, &state);
|
||||||
|
if ((ret == 0) && (state != 0)) {
|
||||||
|
if (state & PMIC_FAULT_TWD_ERROR_MASK) {
|
||||||
|
reset_regs->value = EXTERNAL_WATCHDOG_PATTERN;
|
||||||
|
reset_regs->value_crc = ether_crc(sizeof(reset_regs->value),
|
||||||
|
(const uint8_t*)&(reset_regs->value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* clear pmic fault log by writing back all bits currently set */
|
||||||
|
da9063_set_reg(PMIC_REG_FAULT_LOG, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
da9063_release_i2c_bus(bus);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void am33xx_spl_board_init(void)
|
void am33xx_spl_board_init(void)
|
||||||
{
|
{
|
||||||
/* Set CPU speed to 600 MHz (fix) */
|
/* Set CPU speed to 600 MHz (fix) */
|
||||||
|
|
@ -454,6 +510,11 @@ void am33xx_spl_board_init(void)
|
||||||
/* Set MPU Frequency to what we detected now that voltages are set */
|
/* Set MPU Frequency to what we detected now that voltages are set */
|
||||||
do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
|
do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
/* Debugger can place marker at end of SRAM to stop boot here */
|
/* Debugger can place marker at end of SRAM to stop boot here */
|
||||||
if (is_jtag_boot(CONFIG_JTAG_MARKER_SPL))
|
if (is_jtag_boot(CONFIG_JTAG_MARKER_SPL))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -63,70 +63,112 @@ int eth_phy_timeout(void);
|
||||||
|
|
||||||
#ifndef CONFIG_SPL_BUILD
|
#ifndef CONFIG_SPL_BUILD
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Memory map for booting Linux
|
* Memory map for booting Linux
|
||||||
*
|
*
|
||||||
* 0x80000000 63MB KERNEL_ADDR (kernel_addr), kernel execution address
|
* 0x80000000 32MB KERNEL_ADDR (kernel_addr), kernel execution address
|
||||||
* 0x83F00000 1MB FDT_ADDR (fdt_addr_r), device tree loading address if not included in kernel
|
* 0x82000000 190MB KERNEL_ADDR_R (kernel_addr_r), FIT image/kernel loading address
|
||||||
* 0x84000000 126MB RD_ADDR (ramdisk_addr_r), ramdisc loading address
|
* kernel will be relocated kernel_addr
|
||||||
* 0x8BE00000 2MB PXE_ADDR (pxefile_addr_r), pxe configuration file (pxe get command)
|
* for FIT images, ramdisc and dtb will be relocated to
|
||||||
* 0x8C000000 1MB LOAD_ADDR (load_addr), loading address for generic files
|
* top of bootmemory (0x8e000000 downwards)
|
||||||
* 0x8C100000 63MB KERNEL_ADDR_R (kernel_addr_r), kernel loading address (will be relocated to kernel_addr)
|
* 0x8BE00000 1MB FDT_ADDR_R (fdt_addr_r), device tree if separate from kernel/FIT
|
||||||
* 0x90000000 256MB <>, Free space 512MB systems
|
* 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
|
||||||
|
* 32MB <>, Free space
|
||||||
|
* 0x90000000 256MB <>, Free space, 512MB systems
|
||||||
* 0xA0000000 512MB <>, Free space, 1GB systems only
|
* 0xA0000000 512MB <>, Free space, 1GB systems only
|
||||||
* 0xC0000000 End of RAM
|
* 0xC0000000 End of RAM
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define KERNEL_ADDR "0x80000000"
|
#define KERNEL_ADDR "0x80000000"
|
||||||
#define FDT_ADDR "0x83F00000"
|
#define KERNEL_ADDR_R "0x82000000"
|
||||||
#define RD_ADDR "0x84000000"
|
#define FDT_ADDR_R "0x8BE00000"
|
||||||
#define PXE_ADDR "0x8BE00000"
|
#define PXE_ADDR "0x8BF00000"
|
||||||
#define LOAD_ADDR "0x8C000000"
|
#define LOAD_ADDR "0x8C000000"
|
||||||
#define KERNEL_ADDR_R "0x8C100000"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Avoid copying ramdisc and dtb above 512MB, as it breaks Linux boot.
|
* Limit boot memory to 256 MBytes to comply with kernel initial memory layout
|
||||||
* -1 means "do not copy" to high address, use in place.
|
* This is the official way to restrict image load addresses.
|
||||||
|
* Don't use xx_high_addr variables.
|
||||||
*/
|
*/
|
||||||
#define INITRD_HIGH_ADDR "0x84000000"
|
#define BOOTM_SIZE "0x0E000000"
|
||||||
#define FDT_HIGH_ADDR "0xffffffff"
|
|
||||||
|
/* 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 \
|
#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||||
"fdt_image=am335x-nmhw21-prod1.dtb\0" \
|
/* Memory Adresses */ \
|
||||||
"fdt_addr_r=" FDT_ADDR "\0" \
|
"fdt_addr_r=" FDT_ADDR_R "\0" \
|
||||||
"fdt_high=" FDT_HIGH_ADDR "\0" \
|
"kernel_addr=" KERNEL_ADDR "\0" /* NRSW only */ \
|
||||||
"initrd_high=" INITRD_HIGH_ADDR "\0" \
|
|
||||||
"kernel_addr=" KERNEL_ADDR "\0" \
|
|
||||||
"kernel_addr_r=" KERNEL_ADDR_R "\0" \
|
"kernel_addr_r=" KERNEL_ADDR_R "\0" \
|
||||||
"load_addr=" LOAD_ADDR "\0" \
|
"load_addr=" LOAD_ADDR "\0" \
|
||||||
"pxefile_addr_r=" PXE_ADDR "\0" \
|
"pxefile_addr_r=" PXE_ADDR "\0" \
|
||||||
"ramdisk_addr_r=" RD_ADDR "\0" \
|
"bootm_size=" BOOTM_SIZE "\0" \
|
||||||
|
\
|
||||||
|
/* Misc */ \
|
||||||
"defaultconsole=ttyS2\0" \
|
"defaultconsole=ttyS2\0" \
|
||||||
"fdt_skip_update=yes\0" \
|
"fdt_skip_update=yes\0" \
|
||||||
|
"bootdelay=0\0" \
|
||||||
|
\
|
||||||
|
/* Networking */ \
|
||||||
"ethprime=cpsw\0" \
|
"ethprime=cpsw\0" \
|
||||||
"ethopts=ti_cpsw.rx_packet_max=1526\0" \
|
"ethopts=ti_cpsw.rx_packet_max=1526\0" \
|
||||||
|
"ipaddr=192.168.1.1\0" \
|
||||||
|
"serverip=192.168.1.254\0" \
|
||||||
|
"tftptimeout=2000\0" \
|
||||||
|
"tftptimeoutcountmax=5\0" \
|
||||||
|
"bootpretryperiod=10000\0" /* 2000 */ \
|
||||||
|
"autoload=false\0" \
|
||||||
|
\
|
||||||
|
/* OSTree boot */ \
|
||||||
"bootcmd_otenv=ext4load mmc 1:1 $load_addr /boot/loader/uEnv.txt; " \
|
"bootcmd_otenv=ext4load mmc 1:1 $load_addr /boot/loader/uEnv.txt; " \
|
||||||
"setenv bootargs_prev $bootargs; " \
|
"setenv bootargs_prev $bootargs; " \
|
||||||
"env import -t $load_addr $filesize; setenv bootargs $bootargs_prev $bootargs root=/dev/ram0 console=$defaultconsole,115200 " \
|
"env import -t $load_addr $filesize; setenv bootargs $bootargs_prev $bootargs root=/dev/ram0 console=$defaultconsole,115200 " \
|
||||||
"$ethopts rw ostree_root=/dev/mmcblk1p1\0" \
|
"$ethopts rw ostree_root=/dev/mmcblk1p1\0" \
|
||||||
"bootcmd_rd_in_mmc=ext4load mmc 1:1 $kernel_addr_r /boot$kernel_image; " \
|
"bootcmd_rd_in_mmc=ext4load mmc 1:1 $kernel_addr_r /boot$kernel_image; " \
|
||||||
"bootm $kernel_addr_r\0" \
|
"bootm $kernel_addr_r\0" \
|
||||||
"bootcmd=run bootcmd_otenv; run bootcmd_rd_in_mmc\0" \
|
"boot_ostree=run bootcmd_otenv; run bootcmd_rd_in_mmc\0" \
|
||||||
"bootdelay=0\0" \
|
\
|
||||||
"ipaddr=192.168.1.1\0" \
|
/* NRSW boot */ \
|
||||||
"serverip=192.168.1.254\0" \
|
"root_part=1\0" /* from NRSW, required here? set from board.c */ \
|
||||||
"tftptimeout=2000\0" \
|
"kernel_image=kernel.bin\0" \
|
||||||
"tftptimeoutcountmax=5\0" \
|
"fdt_image=am335x-nmhw24-prod1.dtb\0" /* diff, openwrt-nrhw24-nb801.dtb, not relevant as it will be overwritten */ \
|
||||||
"bootpretryperiod=10000\0" \
|
"add_sd_bootargs=setenv bootargs $bootargs root=/dev/${mmc_dev}p$root_part rootfstype=ext4 " \
|
||||||
"autoload=false\0" \
|
"console=$defaultconsole,115200 rootwait loglevel=4 ti_cpsw.rx_packet_max=1526\0" \
|
||||||
"tftp_recovery=tftpboot $kernel_addr recovery-image; tftpboot $fdt_addr_r recovery-dtb; " \
|
"add_version_bootargs=setenv bootargs $bootargs\0" \
|
||||||
"setenv bootargs rdinit=/etc/preinit console=$defaultconsole,115200 " \
|
"sdbringup=echo Try bringup boot && ext4load mmc 1:$root_part $kernel_addr /boot/zImage && " \
|
||||||
"debug ethopts; " \
|
"ext4load mmc 1:$root_part $fdt_addr /boot/$fdt_image && setenv bootargs $bootargs rw;\0" \
|
||||||
"bootz $kernel_addr - $fdt_addr_r\0" \
|
"sdprod=ext4load mmc 1:$root_part $kernel_addr /boot/$kernel_image && " \
|
||||||
"pxe_recovery=mdio up $ethprime && dhcp && pxe get && pxe boot\0" \
|
"ext4load mmc 1:$root_part $fdt_addr /boot/$fdt_image && setenv bootargs $bootargs ro;\0" \
|
||||||
|
"sdboot=env set fdt_addr " FDT_ADDR_R "; "\
|
||||||
|
"if mmc dev 1; then echo Copying Linux from SD to RAM...; "\
|
||||||
|
"if test -e mmc 1:$root_part /boot/$kernel_image; then run sdprod; " \
|
||||||
|
"else run sdbringup; fi; " \
|
||||||
|
/* For v4.19 kernel $mmc_dev should be "mmcblk1" (read from DT), for v3.18 kernel: "mmcblk0" */ \
|
||||||
|
"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; " \
|
||||||
|
"bootz $kernel_addr - $fdt_addr; fi\0" \
|
||||||
|
\
|
||||||
|
/* 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" \
|
"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; " \
|
||||||
|
"setenv bootargs rdinit=/etc/preinit console=$defaultconsole,115200 " \
|
||||||
|
"debug $ethopts; " \
|
||||||
|
"bootz $kernel_addr_r - $fdt_addr_r\0" /* kernel_addr_r */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CONFIG_ZERO_BOOTDELAY_CHECK
|
#define CONFIG_ZERO_BOOTDELAY_CHECK
|
||||||
|
|
@ -234,6 +276,18 @@ int eth_phy_timeout(void);
|
||||||
#define CONFIG_SYS_MEMTEST_START 0x84000000
|
#define CONFIG_SYS_MEMTEST_START 0x84000000
|
||||||
#define CONFIG_SYS_MEMTEST_END 0x87900000
|
#define CONFIG_SYS_MEMTEST_END 0x87900000
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_NRSW_BUILD
|
||||||
|
/* support for NM packed bootloader */
|
||||||
|
#define CONFIG_NM_BOOTLOADER_FORMAT
|
||||||
|
|
||||||
|
/* password protected login */
|
||||||
|
#define CONFIG_CRYPT
|
||||||
|
#define CONFIG_NM_LOGIN
|
||||||
|
#define CONFIG_NM_LOGIN_PART "1:3" /* TODO: Define location of file for OSTree/Yocto */
|
||||||
|
#define CONFIG_NM_LOGIN_PASSWD "/root/boot/bootpass"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CONFIG_CMD_PXE
|
#define CONFIG_CMD_PXE
|
||||||
|
|
||||||
#define CONFIG_OF_BOARD_SETUP
|
#define CONFIG_OF_BOARD_SETUP
|
||||||
|
|
@ -241,6 +295,13 @@ int eth_phy_timeout(void);
|
||||||
#define CONFIG_JTAG_MARKER_SPL 0x402FFF00
|
#define CONFIG_JTAG_MARKER_SPL 0x402FFF00
|
||||||
#define CONFIG_JTAG_MARKER_UBOOT 0x807FFF00
|
#define CONFIG_JTAG_MARKER_UBOOT 0x807FFF00
|
||||||
|
|
||||||
|
/* NRSW PMIC Reset Reason */
|
||||||
|
#ifdef CONFIG_NRSW_BUILD
|
||||||
|
#define RESET_REASON_SHM_LOCATION 0x8e000000
|
||||||
|
#define EXTERNAL_WATCHDOG_PATTERN 0x781f9ce2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* SPL command is not needed */
|
/* SPL command is not needed */
|
||||||
#undef CONFIG_CMD_SPL
|
#undef CONFIG_CMD_SPL
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue