1# SPDX-License-Identifier: GPL-2.0+
2#
3# Copyright (C) 2013 Imagination Technologies
4#
5# Programs a MIPS Malta boot flash with a flat binary image.
6
7proc flash-boot { binfile } {
8  puts "flash monitor binary $binfile"
9  config Coherent on
10  config CoherencyDuringLoad on
11
12  if {[endian]=="big"} {
13    puts "CPU in BE mode"
14    flash device sharp_16x32_be;
15  } else {
16    puts "CPU in LE mode"
17    flash device sharp_16x32;
18  }
19
20  flash clear all;
21  flash set 0xBE000000..0xBE0FFFFF
22  flash erase sector 0xbe000000;
23  flash erase sector 0xbe020000;
24  flash erase sector 0xbe040000;
25  flash erase sector 0xbe060000;
26  flash erase sector 0xbe080000;
27  flash erase sector 0xbe0a0000;
28  flash erase sector 0xbe0c0000;
29  flash erase sector 0xbe0e0000;
30  puts "finished erasing boot flash";
31
32  puts "programming flash, please be patient"
33  load bin 0xbe000000 $binfile size4
34
35  flash clear all
36  config CoherencyDuringLoad off
37  puts "finished programming boot flash";
38}
39