summaryrefslogtreecommitdiff
path: root/recipes-support/bmode-usb/bmode-usb
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-support/bmode-usb/bmode-usb')
-rw-r--r--recipes-support/bmode-usb/bmode-usb/bmode_usb.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/recipes-support/bmode-usb/bmode-usb/bmode_usb.c b/recipes-support/bmode-usb/bmode-usb/bmode_usb.c
index c8ca7e2..3ac6ddc 100644
--- a/recipes-support/bmode-usb/bmode-usb/bmode_usb.c
+++ b/recipes-support/bmode-usb/bmode-usb/bmode_usb.c
@@ -18,28 +18,41 @@
#include <sys/mman.h>
#include <unistd.h>
-/* valid for i.MX6DL/i.MX6Q */
-#define SRC_BASE_ADDR 0x020D8000
-#define SRC_GPR9_OFF (0x40/4)
-#define SRC_GPR10_OFF (0x44/4)
+#ifdef MX6
+#define SRC_BASE_ADDR 0x020D8000
+#define SRC_GPR9_OFF (0x40/4)
+#define SRC_GPR10_OFF (0x44/4)
+#define SRC_GPR9_OFF_VALUE 0x10
+#define SRC_GPR10_OFF_VALUE 0x10000000
+#elif defined(MX6ULL)
+#define SRC_BASE_ADDR 0x020D8000
+#define SRC_GPR9_OFF (0x40/4)
+#define SRC_GPR10_OFF (0x44/4)
+#define SRC_GPR9_OFF_VALUE 0x20
+#define SRC_GPR10_OFF_VALUE 0x10000000
+#endif
int main(void)
{
+#if ( defined(MX6) | defined(MX6ULL) )
int fd;
unsigned reg;
unsigned *src;
fd = open("/dev/mem", O_RDWR);
src = (unsigned *)mmap(0, SRC_GPR10_OFF + 4, PROT_READ|PROT_WRITE,
- MAP_SHARED, fd, 0x020D8000);
+ MAP_SHARED, fd, SRC_BASE_ADDR);
if(src == NULL) {
printf("Failed to mmap register\n");
return -1;
}
- src[SRC_GPR9_OFF] = 0x10;
- src[SRC_GPR10_OFF] |= 0x10000000;
+ src[SRC_GPR9_OFF] = SRC_GPR9_OFF_VALUE;
+ src[SRC_GPR10_OFF] |= SRC_GPR10_OFF_VALUE;
printf("Next reboot (not powercycle!) will boot to recovery mode\n");
+#else
+ printf("Not supported on this platform\n");
+#endif
return 0;
}