openwrtv4/target/linux/pistachio/base-files/lib/upgrade/platform.sh
Ian Pozella 0d271cef80 target: add pistachio
The Pistachio target is a MIPS interaptiv based SoC developed by
Imagination Technologies. It includes blocks for i2c, spi, audio,
usb and WiFi.

This also adds the base support for the 'Creator Ci40 (marduk)'
device which uses the Pistachio SoC to create an IoT hub by
including Bluetooth, WiFi and 6lowpan on one board. Additionally 2x
Mikrobus ports are available to expand with further RF technologies
or add sensors. You can find out more here http://creatordev.io.

Note, this commit is just the initial board support hence the
following are not expected to work yet:
 * WiFi
 * Bluetooth
 * 6lowpan
 * Audio
 * Mikrobus uarts, user leds (clock dependency of 6lowpan chip)

The aim of this commit is to essentially have the same level of
support that currently exists in the mainline kernel.

Signed-off-by: Abhijit Mahajani <Abhijit.Mahajani@imgtec.com>
Signed-off-by: Francois Berder <francois.berder@imgtec.com>
Signed-off-by: Ian Pozella <Ian.Pozella@imgtec.com>
Signed-off-by: Mayank Sirotiya <Mayank.Sirotiya@imgtec.com>
Signed-off-by: Sean Kelly <Sean.Kelly@imgtec.com>
2017-03-22 11:43:22 +01:00

58 lines
1.5 KiB
Bash
Executable file

#!/bin/sh
#
# Copyright (C) 2017 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
. /lib/pistachio.sh
RAMFS_COPY_BIN="/usr/sbin/fw_printenv /usr/sbin/fw_setenv /bin/mkdir /bin/dmesg /bin/sed /bin/grep"
RAMFS_COPY_DATA="/etc/fw_env.config"
REQUIRE_IMAGE_METADATA=0
platform_check_image()
{
local board=$(pistachio_board_name)
nand_do_platform_check $board $1
return $?
}
platform_pre_upgrade() {
# TODO no need to switch to ramfs with dual partitions in
# fact we don't even want to reboot as part of seamless
# upgrades. Instead just upgrade opposite partition and mark
# the next reboot to boot from that partition. Could just call
# stage2 directly but need to refactor nand_upgrade_success
# for this to work.
# Also the nand functions don't allow url to be used
nand_do_upgrade $1
}
platform_nand_pre_upgrade() {
local board=$(pistachio_board_name)
case "$board" in
marduk)
local boot_partition=$(dmesg | grep "ubi0: attached.*" | sed "s/^.*\(firmware[0-1]\).*/\1/g")
echo "Current boot partiton $boot_partition (/dev/mtd$(find_mtd_index $boot_partition))"
mkdir -p /var/lock
if [ "$boot_partition" == "firmware0" ]; then
CI_UBIPART="firmware1"
fw_setenv boot_partition 1 || exit 1
else
CI_UBIPART="firmware0"
fw_setenv boot_partition 0 || exit 1
fi
echo "Upgrading partition $CI_UBIPART (/dev/mtd$(find_mtd_index $CI_UBIPART))"
;;
esac
}
blink_led() {
. /etc/diag.sh; set_state upgrade
}
append sysupgrade_pre_upgrade blink_led