diff options
author | Paul Fertser <fercerpav@gmail.com> | 2013-09-18 23:42:50 +0400 |
---|---|---|
committer | Spencer Oliver <spen@spen-soft.co.uk> | 2013-10-15 20:38:21 +0000 |
commit | d4993beec4bcb4f667f2d6120d238a70d07489b4 (patch) | |
tree | 9bcf01b7071a2448e83ac60a13e53748cbf979c6 | |
parent | 1c975fe30b8fb380907133462cc38a0b2e9de565 (diff) | |
download | riscv-openocd-d4993beec4bcb4f667f2d6120d238a70d07489b4.zip riscv-openocd-d4993beec4bcb4f667f2d6120d238a70d07489b4.tar.gz riscv-openocd-d4993beec4bcb4f667f2d6120d238a70d07489b4.tar.bz2 |
bcm2835gpio: use maximum drive strength
According to the docs, the default drive strength for the GPIO pads is
8mA but they're capable of 16mA. Configure GPIO 0-27 to use the maximum
(as they might be used on high enough frequency with JTAG).
Change-Id: I621737a1b0a855bb97b56ce2cc46c0e385b74f5d
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1633
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
-rw-r--r-- | src/jtag/drivers/bcm2835gpio.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/jtag/drivers/bcm2835gpio.c b/src/jtag/drivers/bcm2835gpio.c index 5af92c3..a2ba8e6 100644 --- a/src/jtag/drivers/bcm2835gpio.c +++ b/src/jtag/drivers/bcm2835gpio.c @@ -33,6 +33,9 @@ #define BCM2835_PERI_BASE 0x20000000 #define BCM2835_GPIO_BASE (BCM2835_PERI_BASE + 0x200000) /* GPIO controller */ +#define BCM2835_PADS_GPIO_0_27 (BCM2835_PERI_BASE + 0x100000) +#define BCM2835_PADS_GPIO_0_27_OFFSET (0x2c / 4) + /* GPIO setup macros */ #define MODE_GPIO(g) (*(pio_base+((g)/10))>>(((g)%10)*3) & 7) #define INP_GPIO(g) do { *(pio_base+((g)/10)) &= ~(7<<(((g)%10)*3)); } while (0) @@ -319,6 +322,19 @@ static int bcm2835gpio_init(void) return ERROR_JTAG_INIT_FAILED; } + static volatile uint32_t *pads_base; + pads_base = mmap(NULL, sysconf(_SC_PAGE_SIZE), PROT_READ | PROT_WRITE, + MAP_SHARED, dev_mem_fd, BCM2835_PADS_GPIO_0_27); + + if (pads_base == MAP_FAILED) { + perror("mmap"); + close(dev_mem_fd); + return ERROR_JTAG_INIT_FAILED; + } + + /* set 16mA drive strength */ + pads_base[BCM2835_PADS_GPIO_0_27_OFFSET] = 0x5a000018 + 7; + tdo_gpio_mode = MODE_GPIO(tdo_gpio); tdi_gpio_mode = MODE_GPIO(tdi_gpio); tck_gpio_mode = MODE_GPIO(tck_gpio); |