jtag/drivers/bcm2835gpio: extend peripheral_base to off_t 85/7685/2
authorTomas Vanek <vanekt@fbl.cz>
Fri, 12 May 2023 10:04:22 +0000 (12:04 +0200)
committerTomas Vanek <vanekt@fbl.cz>
Wed, 24 May 2023 05:25:54 +0000 (05:25 +0000)
Raspberry Pi 4 with 64-bit kernel and arm_peri_high=1 config.txt
parameter needs peripheral_base 0x47e000000, uint32_t is not enough.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Icedd084e2916657fa4478d452a5eb1e84a45c281
Reviewed-on: https://review.openocd.org/c/openocd/+/7685
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/jtag/drivers/bcm2835gpio.c

index 16c76cdb83e549b9feef7ed4a25afe8ff13e924a..c72386024fd9bdeaacf1f777f6e9a311a27ca385 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <sys/mman.h>
 
-static uint32_t bcm2835_peri_base = 0x20000000;
+static off_t bcm2835_peri_base = 0x20000000;
 #define BCM2835_GPIO_BASE      (bcm2835_peri_base + 0x200000) /* GPIO controller */
 
 #define BCM2835_PADS_GPIO_0_27         (bcm2835_peri_base + 0x100000)
@@ -302,11 +302,15 @@ COMMAND_HANDLER(bcm2835gpio_handle_speed_coeffs)
 
 COMMAND_HANDLER(bcm2835gpio_handle_peripheral_base)
 {
-       if (CMD_ARGC == 1)
-               COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], bcm2835_peri_base);
+       uint64_t tmp_base;
+       if (CMD_ARGC == 1) {
+               COMMAND_PARSE_NUMBER(u64, CMD_ARGV[0], tmp_base);
+               bcm2835_peri_base = (off_t)tmp_base;
+       }
 
-       command_print(CMD, "BCM2835 GPIO: peripheral_base = 0x%08x",
-                                 bcm2835_peri_base);
+       tmp_base = bcm2835_peri_base;
+       command_print(CMD, "BCM2835 GPIO: peripheral_base = 0x%08" PRIu64,
+                                 tmp_base);
        return ERROR_OK;
 }
 
@@ -322,7 +326,7 @@ static const struct command_registration bcm2835gpio_subcommand_handlers[] = {
                .name = "peripheral_base",
                .handler = &bcm2835gpio_handle_peripheral_base,
                .mode = COMMAND_CONFIG,
-               .help = "peripheral base to access GPIOs (RPi1 0x20000000, RPi2 0x3F000000).",
+               .help = "peripheral base to access GPIOs, not needed with /dev/gpiomem.",
                .usage = "[base]",
        },
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)