aboutsummaryrefslogtreecommitdiffstats
path: root/include/env/adi/adi_boot.env
blob: d56b14f517264da97fa4ff588ca3361a3dc24a2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
 * A target board needs to set these variables for the commands below to work:
 *
 * - adi_stage2_offset, the location of stage2-boot.ldr on the SPI flash
 * - adi_image_offset, location of the fitImage on the SPI flash
 * - adi_rfs_offset, location of the RFS on the SPI flash
 * - loadaddr, where you want to load things
 * - jffs2file, name of the jffs2 file for update, ex adsp-sc5xx-tiny-adsp-sc573.jffs2
 */

#ifdef CONFIG_SC59X_64
#define EARLY_PRINTK earlycon=adi_uart,0x31003000
#else
#define EARLY_PRINTK earlyprintk=serial,uart0,CONFIG_BAUDRATE
#endif

/* Config options */
imagefile=fitImage
ethaddr=02:80:ad:20:31:e8
eth1addr=02:80:ad:20:31:e9
uart_console=CONFIG_UART_CONSOLE
#ifdef CONFIG_SC59X_64
fdt_high=0xffffffffffffffff
initrd_high=0xffffffffffffffff
#else
fdt_high=0xffffffff
initrd_high=0xffffffff
#endif

/* Helper routines */
init_ethernet=mii info;
	dhcp;
	setenv serverip ${tftpserverip}

/* Args for each boot mode */
adi_bootargs=EARLY_PRINTK console=ttySC0,CONFIG_BAUDRATE vmalloc=512M
ramargs=setenv bootargs ${adi_bootargs}

addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off

/* Boot modes are selectable and should be defined in the board env before including */
#if defined(USE_NFS)
// rootpath is set by CONFIG_ROOTPATH
nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}${rootpath},tcp,nfsvers=3 ${adi_bootargs}
nfsboot=run init_ethernet;
	tftp ${loadaddr} ${tftp_dir_prefix}${imagefile};
	run nfsargs;
	run addip;
	bootm ${loadaddr}
#endif

#if defined(USE_MMC)
mmcargs=setenv bootargs root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait ${adi_bootargs}
mmcboot=mmc rescan;
	ext4load mmc 0:1 ${loadaddr} /boot/${imagefile};
	run mmcargs;
	bootm ${loadaddr}
#endif

#if defined(USE_SPI) || defined(USE_OSPI)
spiargs=setenv bootargs root=/dev/mtdblock4 rw rootfstype=jffs2 ${adi_bootargs}
spiboot=run spiargs;
	sf probe ${sfdev};
	sf read ${loadaddr} ${adi_image_offset} ${imagesize};
	bootm ${loadaddr}
#endif

#if defined(USE_OSPI)
ospiboot=run spiboot
#endif

#if defined(USE_RAM)
ramboot=run init_ethernet;
	tftp ${loadaddr} ${tfpt_dir_prefix}${imagefile};
	run ramargs;
	bootm ${loadaddr}
#endif

/* Update commands */
stage1file=stage1-boot.ldr
stage2file=stage2-boot.ldr

#if defined(USE_SPI) || defined(USE_OSPI)
update_spi_uboot_stage1=tftp ${loadaddr} ${tftp_dir_prefix}${stage1file};
	sf probe ${sfdev};
	sf update ${loadaddr} 0x0 ${filesize}
update_spi_uboot_stage2=tftp ${loadaddr} ${tftp_dir_prefix}${stage2file};
	sf probe ${sfdev};
	sf update ${loadaddr} ${adi_stage2_offset} ${filesize}
update_spi_uboot=run update_spi_uboot_stage1;
	run update_spi_uboot_stage2;
update_spi_fit=tftp ${loadaddr} ${tftp_dir_prefix}${imagefile};
	sf probe ${sfdev};
	sf update ${loadaddr} ${adi_image_offset} ${filesize};
	setenv imagesize ${filesize}
update_spi_rfs=tftp ${loadaddr} ${tftp_dir_prefix}${jffs2file};
	sf probe ${sfdev};
	sf update ${loadaddr} ${adi_rfs_offset} ${filesize}

start_update_spi=run init_ethernet;
	run update_spi_uboot;
	run update_spi_fit;
	run update_spi_rfs;
start_update_spi_uboot_only=run init_ethernet;
	run update_spi_uboot;
#endif

#if defined(USE_SPI)
update_spi=setenv sfdev CONFIG_SC_BOOT_SPI_BUS:CONFIG_SC_BOOT_SPI_SSEL;
	setenv bootcmd run spiboot;
	setenv argscmd spiargs;
	run start_update_spi;
	saveenv
#endif

#if defined(USE_OSPI)
update_ospi=setenv sfdev CONFIG_SC_BOOT_OSPI_BUS:CONFIG_SC_BOOT_OSPI_SSEL;
	setenv bootcmd run ospiboot;
	setenv argscmd spiargs;
	run start_update_spi;
	saveenv
#endif