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