blob: d56b14f517264da97fa4ff588ca3361a3dc24a2f [file] [log] [blame]
Tom Rinidec7ea02024-05-20 13:35:03 -06001/*
2 * A target board needs to set these variables for the commands below to work:
3 *
4 * - adi_stage2_offset, the location of stage2-boot.ldr on the SPI flash
5 * - adi_image_offset, location of the fitImage on the SPI flash
6 * - adi_rfs_offset, location of the RFS on the SPI flash
7 * - loadaddr, where you want to load things
8 * - jffs2file, name of the jffs2 file for update, ex adsp-sc5xx-tiny-adsp-sc573.jffs2
9 */
10
11#ifdef CONFIG_SC59X_64
12#define EARLY_PRINTK earlycon=adi_uart,0x31003000
13#else
14#define EARLY_PRINTK earlyprintk=serial,uart0,CONFIG_BAUDRATE
15#endif
16
17/* Config options */
18imagefile=fitImage
19ethaddr=02:80:ad:20:31:e8
20eth1addr=02:80:ad:20:31:e9
21uart_console=CONFIG_UART_CONSOLE
22#ifdef CONFIG_SC59X_64
23fdt_high=0xffffffffffffffff
24initrd_high=0xffffffffffffffff
25#else
26fdt_high=0xffffffff
27initrd_high=0xffffffff
28#endif
29
30/* Helper routines */
31init_ethernet=mii info;
32 dhcp;
33 setenv serverip ${tftpserverip}
34
35/* Args for each boot mode */
36adi_bootargs=EARLY_PRINTK console=ttySC0,CONFIG_BAUDRATE vmalloc=512M
37ramargs=setenv bootargs ${adi_bootargs}
38
39addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off
40
41/* Boot modes are selectable and should be defined in the board env before including */
42#if defined(USE_NFS)
43// rootpath is set by CONFIG_ROOTPATH
44nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}${rootpath},tcp,nfsvers=3 ${adi_bootargs}
45nfsboot=run init_ethernet;
46 tftp ${loadaddr} ${tftp_dir_prefix}${imagefile};
47 run nfsargs;
48 run addip;
49 bootm ${loadaddr}
50#endif
51
52#if defined(USE_MMC)
53mmcargs=setenv bootargs root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait ${adi_bootargs}
54mmcboot=mmc rescan;
55 ext4load mmc 0:1 ${loadaddr} /boot/${imagefile};
56 run mmcargs;
57 bootm ${loadaddr}
58#endif
59
60#if defined(USE_SPI) || defined(USE_OSPI)
61spiargs=setenv bootargs root=/dev/mtdblock4 rw rootfstype=jffs2 ${adi_bootargs}
62spiboot=run spiargs;
63 sf probe ${sfdev};
64 sf read ${loadaddr} ${adi_image_offset} ${imagesize};
65 bootm ${loadaddr}
66#endif
67
68#if defined(USE_OSPI)
69ospiboot=run spiboot
70#endif
71
72#if defined(USE_RAM)
73ramboot=run init_ethernet;
74 tftp ${loadaddr} ${tfpt_dir_prefix}${imagefile};
75 run ramargs;
76 bootm ${loadaddr}
77#endif
78
79/* Update commands */
80stage1file=stage1-boot.ldr
81stage2file=stage2-boot.ldr
82
83#if defined(USE_SPI) || defined(USE_OSPI)
84update_spi_uboot_stage1=tftp ${loadaddr} ${tftp_dir_prefix}${stage1file};
85 sf probe ${sfdev};
86 sf update ${loadaddr} 0x0 ${filesize}
87update_spi_uboot_stage2=tftp ${loadaddr} ${tftp_dir_prefix}${stage2file};
88 sf probe ${sfdev};
89 sf update ${loadaddr} ${adi_stage2_offset} ${filesize}
90update_spi_uboot=run update_spi_uboot_stage1;
91 run update_spi_uboot_stage2;
92update_spi_fit=tftp ${loadaddr} ${tftp_dir_prefix}${imagefile};
93 sf probe ${sfdev};
94 sf update ${loadaddr} ${adi_image_offset} ${filesize};
95 setenv imagesize ${filesize}
96update_spi_rfs=tftp ${loadaddr} ${tftp_dir_prefix}${jffs2file};
97 sf probe ${sfdev};
98 sf update ${loadaddr} ${adi_rfs_offset} ${filesize}
99
100start_update_spi=run init_ethernet;
101 run update_spi_uboot;
102 run update_spi_fit;
103 run update_spi_rfs;
104start_update_spi_uboot_only=run init_ethernet;
105 run update_spi_uboot;
106#endif
107
108#if defined(USE_SPI)
109update_spi=setenv sfdev CONFIG_SC_BOOT_SPI_BUS:CONFIG_SC_BOOT_SPI_SSEL;
110 setenv bootcmd run spiboot;
111 setenv argscmd spiargs;
112 run start_update_spi;
113 saveenv
114#endif
115
116#if defined(USE_OSPI)
117update_ospi=setenv sfdev CONFIG_SC_BOOT_OSPI_BUS:CONFIG_SC_BOOT_OSPI_SSEL;
118 setenv bootcmd run ospiboot;
119 setenv argscmd spiargs;
120 run start_update_spi;
121 saveenv
122#endif