From 1f5b1539e423410d70975118754e5dfe25b97b15 Mon Sep 17 00:00:00 2001 From: Aditya Prayoga Date: Tue, 27 Oct 2020 18:07:35 +0700 Subject: [PATCH] Helios64: Update GPIO usage and SATA --- docs/helios64/gpio.md | 80 +++++++++++++++++++++++++++++++++++++++++++ docs/helios64/sata.md | 2 ++ 2 files changed, 82 insertions(+) diff --git a/docs/helios64/gpio.md b/docs/helios64/gpio.md index 37516d9..3e6632f 100644 --- a/docs/helios64/gpio.md +++ b/docs/helios64/gpio.md @@ -28,3 +28,83 @@ Helios64 provides 16 GPIOs via a 20-Pin header (P5). Those GPIOs are provided vi | 18 | EXP_P1_6 | | | 19 | EXP_P1_7 | | | 20 | - | GND | + +## Accessing GPIOs under Linux + +If the kernel supports debugfs (*CONFIG_DEBUG_FS=y*), list of GPIOs can be retrieved with the following command + +```bash +sudo cat /sys/kernel/debug/gpio +``` + +Look for the **gpiochip5: GPIOs XXX-YYY** section, whereas **XXX** is first GPIO number and **YYY** is last GPIO number of IO expander. + +``` +gpiochip5: GPIOs 496-511, parent: i2c/2-0020, 2-0020, can sleep: +``` + +Another way to get first GPIO number of the IO expander + +``` +cat /sys/bus/i2c/devices/2-0020/gpio/gpiochip*/base +``` + +Therefore the mapping between header P5 Pins and Sysfs GPIO numbers will be as described in the following table + +### GPIO Table + +| PIN | Sysfs GPIO number | Remarks | +|-----|------|-------------| +| 1 | - | 3.3V Supply | +| 2 | - | 5V Supply | +| 3 | - | GND | +| 4 | 496 | | +| 5 | 497 | | +| 6 | 498 | | +| 7 | 499 | | +| 8 | 500 | | +| 9 | 501 | | +| 10 | 502 | | +| 11 | 503 | | +| 12 | 504 | | +| 13 | 505 | | +| 14 | 506 | | +| 15 | 507 | | +| 16 | 508 | | +| 17 | 509 | | +| 18 | 510 | | +| 19 | 511 | | +| 20 | - | GND | + +### GPIO Control + +**1.** Export the GPIO number you want to use + +``` +echo N | sudo tee -a /sys/class/gpio/export +``` + +**2.** Set the direction, "out" for Output or "in" for Input + +``` +echo DIRECTION | sudo tee -a /sys/class/gpio/gpioN/direction +``` + +**3.** Now you can read or change the GPIO value + +To read GPIO value + +``` +cat /sys/class/gpio/gpioN/value +``` + +To change GPIO value (only if GPIO set as Output) + +``` +echo VALUE | sudo tee -a /sys/class/gpio/gpioN/value +``` + +!!! notes + Pay attention to the path, /sys/class/gpio/gpio**N**/ where **N** is the GPIO number. + + diff --git a/docs/helios64/sata.md b/docs/helios64/sata.md index 3782f1f..6c6a865 100644 --- a/docs/helios64/sata.md +++ b/docs/helios64/sata.md @@ -37,6 +37,8 @@ The power delivery of the HDDs is devided into two group: Helios64 implements a power staggering approach where *HDD Rail A* will be powered up first, then few seconds later *HDD Rail B* will be powered up. This power control scenario is performed to reduce the inrush current during disk spin-up. +The power staggering mechanism is not user configurable. It is done by bootloader. + ### J8 Pinout ![J8 Location](/helios64/img/sata/j8_pinout.jpg)