summaryrefslogtreecommitdiffstats
path: root/exynos4412_gpios.c
diff options
context:
space:
mode:
Diffstat (limited to 'exynos4412_gpios.c')
-rw-r--r--exynos4412_gpios.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/exynos4412_gpios.c b/exynos4412_gpios.c
index 1c6474e..b478794 100644
--- a/exynos4412_gpios.c
+++ b/exynos4412_gpios.c
@@ -28,21 +28,23 @@
void *mmap_gpio_hardware_blocks(int debug, char *devmem, int fd,
size_t page_size)
{
- /* TODO: also map GPIO_right
- * GPIO_right: base_addr: 0x11000000 len: 0x400000
- * GPIO_left: base_addr: 0x11400000 len: 0x400000
- */
- uint32_t base_addr = 0x11000000;
- size_t len = 0x800000;
-
- void *map_base_addr;
+ uint32_t base_addr;
uint32_t *virt_addr;
-
+ off_t len;
int rc;
- map_base_addr = mmap(0, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd,
- base_addr & ~(page_size -1));
- if (map_base_addr == MAP_FAILED) {
+ /* GPIO_right: base_addr: 0x11000000 len: 0x400000
+ * GPIO_left: base_addr: 0x11400000 len: 0x400000
+ */
+ base_addr = 0x11000000u;
+ len = 0x800000;
+
+ /* virt_addr points to the beining of the file, so to the physical
+ * address 0
+ */
+ virt_addr = mmap(0, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd,
+ base_addr);
+ if (virt_addr == MAP_FAILED) {
rc = errno;
printf("mmap on %s failed with error %d: %s\n",
devmem, rc, strerror(rc));
@@ -50,14 +52,8 @@ void *mmap_gpio_hardware_blocks(int debug, char *devmem, int fd,
return NULL;
}
- virt_addr = map_base_addr + (base_addr & 4095);
-
- if (debug) {
- printf("%s: mapped address 0x%x @ %p\n", __func__, 0,
- map_base_addr);
- printf("%s: mapped 0x%x bytes of address 0x%x @ %p\n", __func__,
- len, base_addr, virt_addr);
- }
+ if (debug)
+ printf("%s: mapped address 0 @ %p\n", __func__, virt_addr);
return virt_addr;
}