Changes between Initial Version and Version 1 of gscreboot


Ignore:
Timestamp:
10/22/2017 05:28:45 AM (7 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • gscreboot

    v1 v1  
     1[[PageOutline]]
     2
     3= The Reboot Command - History =
     4
     5The {{{reboot}}} command in Linux is a 'soft' reboot which means that the processor is restarted but not actually powered down and powered back on.
     6
     7Invariably there are situations which sometimes can cause a typical 'soft restart' via the Linux {{{reboot}}} command to hang or not properly restart. There are a variety of reasons for this occurring including:
     8 * Peripherals left in an unexpected state which don't have a reset line to them
     9 * Capacitive load issues where certain peripheral combinations can cause the primary power supply to drain slowly resulting in need for a minimum 'power off' time to clear
     10 * SoC errata
     11
     12Because of these situations with a soft reboot, Gateworks has provided reliable ways to reboot the single board computer.
     13
     14== Reboot Command ==
     15In order to have a high reliability Gateworks has designed most of its products with a GSC and a on-board primary power supply which the GSC has the ability to disable. This design provides the following capabilities:
     16 * Capability of powering the board off, and on again at a specific time (GSC Sleep mode)
     17 * Providing a sane alternative to soft reset which power-cycles the board (with a user specified 'off' time)
     18
     19Our latest BSP's have been updated to so that the reboot command will perform a 1 second GSC sleep essentially creating a 'hard' or 'machine' restart:
     20 - Yocto 1.8
     21  - Kernel (flsc-3.14 kernel) - [https://github.com/Gateworks/linux-imx6/commit/061ef9dff9c45a0a7941d3a3378367499f8fb9b8 commit 061ef9]
     22  - Yocto 1.8 OS [https://github.com/Gateworks/meta-gateworks/commit/22f181ed32b32c746b9b3a4640e85da26ba94bf9 commit 22f181]
     23 - Android L5 (3.14.28 kernel) - [https://github.com/Gateworks/linux-imx6/commit/7cb45f3718c5e5e1b384608fc5b9070fa753621f commit 7cb45f3]
     24 - OpenWrt 16.02 (4.4 kernel) -[https://github.com/Gateworks/openwrt/commit/3d57ef0c66e6a8ffa71ff79deb70929c8c9603ce commit 3d57ef0]
     25
     26== Manual Reboot via GSC Sleep ==
     27Older BSP's with the GSC driver (OpenWrt 14.08, Yocto 1.7, Android 4.4.3 (!KitKat)) that have an earlier version of the [wiki:gsc#driver GSC driver] can use use the drivers {{{powerdown}}} sysfs hook to request a 1 second powerdown and therefore perform a safe restart as:
     28 1. Stop any applications or services which may be writing files that you care about
     29 2. {{{sync}}} the filesystems
     30 3. Write the number of seconds to power the board down for to the gsc powerdown sysfs hook (recommend 2 seconds as this garuntees '1 to 2 seconds')
     31{{{#!bash
     32sync && echo 2 > /sys/bus/i2c/devices/i2c-0/0-0020/powerdown
     33}}}
     34
     35 * '''Note''' : If performing this reset without a coin cell battery, a maximum of 4 seconds should be used for resetting the board. Anything longer may put the board to 'sleep' and not allow it to wake up without pressing the pushbutton or unplugging and plugging in the main power supply.
     36
     37=== Older Manual Method ===
     38If for some reason you are using a BSP that does not have the GSC kernel drivers you can do this manually with {{{i2cget}}}/{{{i2cset}}}:
     39{{{#!bash
     40#!/bin/sh
     41#
     42# usage: gsc_sleep [seconds]
     43#
     44
     45# default 2 second sleep ensures between 1 and 2 seconds pass before powerup
     46SECS=${1:-2}
     47
     48# syncs the filesystem
     49echo "Syncing filesystems"
     50sync
     51
     52# perform i2c transactions in loop to retry on i2c timeouts
     53echo "Powering down for $SECS seconds"
     54while [ 1 ]; do
     55  # set R6-R9 with 32bit number of seconds to wake
     56  i2cset -f -y 0 0x20 6 $((SECS % 256)) || continue
     57  SECS=$((SECS >> 8))
     58  i2cset -f -y 0 0x20 7 $((SECS % 256)) || continue
     59  SECS=$((SECS >> 8))
     60  i2cset -f -y 0 0x20 8 $((SECS % 256)) || continue
     61  SECS=$((SECS >> 8))
     62  i2cset -f -y 0 0x20 9 $((SECS % 256)) || continue
     63
     64  # latch sleep time - taking care to not disturb other bits
     65  R1=$(i2cget -f -y 0 0x20 1) || continue
     66  R1=$((R1 | 0x04)) # set R1.2 LATCH_SLEEP
     67  i2cset -f -y 0 0x20 1 $R1 || continue
     68
     69  # set R1.0 SLEEP_ENABLE and R1.1 ACTIVATE_SLEEP - taking care not to disturb other bits
     70  R1=$(i2cget -f -y 0 0x20 1) || continue
     71  R1=$((R1 | 0x03)) # set R1.0 and R1.1
     72  i2cset -f -y 0 0x20 1 $R1 || continue
     73done
     74}}}
     75
     76See the complete GSC reference [wiki:gsc here]