Tom Rini | dec7ea0 | 2024-05-20 13:35:03 -0600 | [diff] [blame] | 1 | /* |
| 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 */ |
| 18 | imagefile=fitImage |
| 19 | ethaddr=02:80:ad:20:31:e8 |
| 20 | eth1addr=02:80:ad:20:31:e9 |
| 21 | uart_console=CONFIG_UART_CONSOLE |
| 22 | #ifdef CONFIG_SC59X_64 |
| 23 | fdt_high=0xffffffffffffffff |
| 24 | initrd_high=0xffffffffffffffff |
| 25 | #else |
| 26 | fdt_high=0xffffffff |
| 27 | initrd_high=0xffffffff |
| 28 | #endif |
| 29 | |
| 30 | /* Helper routines */ |
| 31 | init_ethernet=mii info; |
| 32 | dhcp; |
| 33 | setenv serverip ${tftpserverip} |
| 34 | |
| 35 | /* Args for each boot mode */ |
| 36 | adi_bootargs=EARLY_PRINTK console=ttySC0,CONFIG_BAUDRATE vmalloc=512M |
| 37 | ramargs=setenv bootargs ${adi_bootargs} |
| 38 | |
| 39 | addip=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 |
| 44 | nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}${rootpath},tcp,nfsvers=3 ${adi_bootargs} |
| 45 | nfsboot=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) |
| 53 | mmcargs=setenv bootargs root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait ${adi_bootargs} |
| 54 | mmcboot=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) |
| 61 | spiargs=setenv bootargs root=/dev/mtdblock4 rw rootfstype=jffs2 ${adi_bootargs} |
| 62 | spiboot=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) |
| 69 | ospiboot=run spiboot |
| 70 | #endif |
| 71 | |
| 72 | #if defined(USE_RAM) |
| 73 | ramboot=run init_ethernet; |
| 74 | tftp ${loadaddr} ${tfpt_dir_prefix}${imagefile}; |
| 75 | run ramargs; |
| 76 | bootm ${loadaddr} |
| 77 | #endif |
| 78 | |
| 79 | /* Update commands */ |
| 80 | stage1file=stage1-boot.ldr |
| 81 | stage2file=stage2-boot.ldr |
| 82 | |
| 83 | #if defined(USE_SPI) || defined(USE_OSPI) |
| 84 | update_spi_uboot_stage1=tftp ${loadaddr} ${tftp_dir_prefix}${stage1file}; |
| 85 | sf probe ${sfdev}; |
| 86 | sf update ${loadaddr} 0x0 ${filesize} |
| 87 | update_spi_uboot_stage2=tftp ${loadaddr} ${tftp_dir_prefix}${stage2file}; |
| 88 | sf probe ${sfdev}; |
| 89 | sf update ${loadaddr} ${adi_stage2_offset} ${filesize} |
| 90 | update_spi_uboot=run update_spi_uboot_stage1; |
| 91 | run update_spi_uboot_stage2; |
| 92 | update_spi_fit=tftp ${loadaddr} ${tftp_dir_prefix}${imagefile}; |
| 93 | sf probe ${sfdev}; |
| 94 | sf update ${loadaddr} ${adi_image_offset} ${filesize}; |
| 95 | setenv imagesize ${filesize} |
| 96 | update_spi_rfs=tftp ${loadaddr} ${tftp_dir_prefix}${jffs2file}; |
| 97 | sf probe ${sfdev}; |
| 98 | sf update ${loadaddr} ${adi_rfs_offset} ${filesize} |
| 99 | |
| 100 | start_update_spi=run init_ethernet; |
| 101 | run update_spi_uboot; |
| 102 | run update_spi_fit; |
| 103 | run update_spi_rfs; |
| 104 | start_update_spi_uboot_only=run init_ethernet; |
| 105 | run update_spi_uboot; |
| 106 | #endif |
| 107 | |
| 108 | #if defined(USE_SPI) |
| 109 | update_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) |
| 117 | update_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 |