charkear | ee5dd4a | 2023-05-17 15:53:43 -0500 | [diff] [blame] | 1 | #!/bin/sh |
Mike Garrett | c088ff2 | 2021-08-27 16:59:09 -0500 | [diff] [blame] | 2 | |
3 | findmtd() { | ||||
4 | m=$(grep -xl "$1" /sys/class/mtd/*/name) | ||||
5 | m=${m%/name} | ||||
6 | m=${m##*/} | ||||
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame] | 7 | echo "$m" |
Mike Garrett | c088ff2 | 2021-08-27 16:59:09 -0500 | [diff] [blame] | 8 | } |
9 | |||||
charkear | ee5dd4a | 2023-05-17 15:53:43 -0500 | [diff] [blame] | 10 | set -- host-prime host-second vrom-prime vrom-second |
Mike Garrett | c088ff2 | 2021-08-27 16:59:09 -0500 | [diff] [blame] | 11 | |
charkear | ee5dd4a | 2023-05-17 15:53:43 -0500 | [diff] [blame] | 12 | for f in "$@" |
Mike Garrett | c088ff2 | 2021-08-27 16:59:09 -0500 | [diff] [blame] | 13 | do |
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame] | 14 | image=$(findmtd "${f}") |
Mike Garrett | c088ff2 | 2021-08-27 16:59:09 -0500 | [diff] [blame] | 15 | if test -z "$image" |
16 | then | ||||
17 | echo "Unable to find mtd partition for ${f}" | ||||
18 | exit 1 | ||||
19 | fi | ||||
Mike Garrett | c088ff2 | 2021-08-27 16:59:09 -0500 | [diff] [blame] | 20 | done |
21 | |||||
22 | #enable vrom | ||||
23 | # host-prime to vrom-prime | ||||
charkear | ee5dd4a | 2023-05-17 15:53:43 -0500 | [diff] [blame] | 24 | dd if="/dev/$(findmtd host-prime)" of="/dev/$(findmtd vrom-prime)" |
Mike Garrett | c088ff2 | 2021-08-27 16:59:09 -0500 | [diff] [blame] | 25 | # host-second to vrom-second |
charkear | ee5dd4a | 2023-05-17 15:53:43 -0500 | [diff] [blame] | 26 | dd if="/dev/$(findmtd host-second)" of="/dev/$(findmtd vrom-second)" |
Mike Garrett | c088ff2 | 2021-08-27 16:59:09 -0500 | [diff] [blame] | 27 | |
28 | echo 0x1800008a > /sys/class/soc/srom/vromoff | ||||
29 | |||||
Patrick Williams | 8b86a41 | 2023-04-14 14:29:45 -0500 | [diff] [blame] | 30 | while true |
Mike Garrett | c088ff2 | 2021-08-27 16:59:09 -0500 | [diff] [blame] | 31 | do |
32 | devmem 0x8000005C 8 0 | ||||
33 | devmem 0xd1000306 8 5 | ||||
34 | devmem 0xd1000318 8 0x03 | ||||
35 | devmem 0xd100030f 8 0x04 | ||||
36 | sleep 1 | ||||
37 | done | ||||
38 | |||||
charkear | ee5dd4a | 2023-05-17 15:53:43 -0500 | [diff] [blame] | 39 |