blob: c43ed34d62f927695837e52768db061add355bab [file] [log] [blame]
Patrick Williams8b86a412023-04-14 14:29:45 -05001#!/bin/bash
Mike Garrettc088ff22021-08-27 16:59:09 -05002
3findmtd() {
4 m=$(grep -xl "$1" /sys/class/mtd/*/name)
5 m=${m%/name}
6 m=${m##*/}
Patrick Williams8b86a412023-04-14 14:29:45 -05007 echo "$m"
Mike Garrettc088ff22021-08-27 16:59:09 -05008}
9
10rom_lists=(host-prime host-second vrom-prime vrom-second)
11rom_mtd_list=()
12
13for f in "${rom_lists[@]}"
14do
Patrick Williams8b86a412023-04-14 14:29:45 -050015 image=$(findmtd "${f}")
Mike Garrettc088ff22021-08-27 16:59:09 -050016 if test -z "$image"
17 then
18 echo "Unable to find mtd partition for ${f}"
19 exit 1
20 fi
Patrick Williams8b86a412023-04-14 14:29:45 -050021 rom_mtd_list+=("$image")
Mike Garrettc088ff22021-08-27 16:59:09 -050022done
23
24#enable vrom
25# host-prime to vrom-prime
Patrick Williams8b86a412023-04-14 14:29:45 -050026dd if="/dev/${rom_mtd_list[0]}" of="/dev/${rom_mtd_list[2]}"
Mike Garrettc088ff22021-08-27 16:59:09 -050027# host-second to vrom-second
Patrick Williams8b86a412023-04-14 14:29:45 -050028dd if="/dev/${rom_mtd_list[1]}" of="/dev/${rom_mtd_list[3]}"
Mike Garrettc088ff22021-08-27 16:59:09 -050029
30echo 0x1800008a > /sys/class/soc/srom/vromoff
31
32val=$(( ("$(devmem 0xd1000006 8)" && 0xff) | 0x04 ))
33devmem 0xd1000006 8 $val
34devmem 0xd1000018 8 0xff
Patrick Williams8b86a412023-04-14 14:29:45 -050035while true
Mike Garrettc088ff22021-08-27 16:59:09 -050036do
37 devmem 0xd100000f 8 0x14
38 sleep 1
39done
40