summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2021-06-02 15:57:05 +0200
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2021-06-02 16:02:23 +0200
commit4292ac8e7f6ab0f84f97ad86cf59a82b7fea2cee (patch)
tree53a6cb18804f55b8bca4fb2efacef9cdc7d8c639
parentb008055711bb4c330de2ee5c21d4b7eb4e0ec7ab (diff)
downloadexynos-gpio-tool-4292ac8e7f6ab0f84f97ad86cf59a82b7fea2cee.tar.gz
exynos-gpio-tool-4292ac8e7f6ab0f84f97ad86cf59a82b7fea2cee.tar.bz2
exynos-gpio-tool-4292ac8e7f6ab0f84f97ad86cf59a82b7fea2cee.zip
Document devmem2 tests better
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r--tests.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/tests.c b/tests.c
index 32fef82..3d89b67 100644
--- a/tests.c
+++ b/tests.c
@@ -111,17 +111,20 @@ static int test_flash_with_devmem2(int debug, char *devmem, int fd,
{
int rc;
- /* On Parabola with the nonfree u-boot and the Replicant 11 kernel,
- * the gpio value register is 0x0 after boot, so I hope that it is safe
- * to set it to 0x0 too on Replicant 6, even if after boot, its value
- * is 0x1.
- * We also used the default values after booting Parabola for the gpio
- * direction register.
+ /* Default values at boot:
+ * +--------------+------------+----------+
+ * | Distribution | Address | Value[1] |
+ * +--------------+------------+----------+
+ * | Parabola | 0x11400260 | 0x2000 |
+ * | Parabola | 0x11400264 | 0x0000 |
+ * +--------------+------------+----------+
+ * [1]obtained with devmem2 <address> w
*/
/* Set the GPIO to input */
if (debug)
printf(" Starting devmem2 GPIO input test\n");
+ /* GPJ1CON[4:7] with bit 4 to 7 at 0 => 0xnn0n (n == don't care) */
rc = run_command(debug, "devmem2 0x11400260 w 0x2000");
assert(rc == 0);
rc = gpio_get_direction(devmem, fd, page_size, "gpj1", 1);
@@ -131,13 +134,15 @@ static int test_flash_with_devmem2(int debug, char *devmem, int fd,
/* Set the GPIO to output */
if (debug)
printf(" Starting devmem2 GPIO output test\n");
- rc = run_command(debug, "devmem2 0x11400260 w 0x2002");
+ /* GPJ1CON[4:7] with bit 1 @ 1 and the rest at 0 => 1<<5 == 0x20 */
+ rc = run_command(debug, "devmem2 0x11400260 w 0x2020");
assert(rc == 0);
rc = gpio_get_direction(devmem, fd, page_size, "gpj1", 1);
assert (rc == GPIO_OUTPUT);
printf("[ OK ] devmem2 GPIO output test\n");
/* Set the pin LOW */
+ /* GPJ1DAT[1] == 0 */
if (debug)
printf(" Starting devmem2 GPIO output low test\n");
rc = run_command(debug, "devmem2 0x11400264 w 0");
@@ -147,6 +152,7 @@ static int test_flash_with_devmem2(int debug, char *devmem, int fd,
printf("[ OK ] devmem2 GPIO output low test\n");
/* Set the pin HIGH */
+ /* GPJ1DAT[1] == 1 => 1<<1 == 2 */
if (debug)
printf(" Starting devmem2 GPIO output high test\n");
rc = run_command(debug, "devmem2 0x11400264 w 2");
@@ -156,6 +162,7 @@ static int test_flash_with_devmem2(int debug, char *devmem, int fd,
printf("[ OK ] devmem2 GPIO output high test\n");
/* Set it to low again */
+ /* GPJ1DAT[1] == 0 */
if (debug)
printf(" Starting devmem2 GPIO output low test\n");
rc = run_command(debug, "devmem2 0x11400264 w 0");