summaryrefslogtreecommitdiff
path: root/recipes-support
diff options
context:
space:
mode:
authorPhilippe Schenker <philippe.schenker@toradex.com>2019-08-07 12:50:40 +0200
committerPhilippe Schenker <philippe.schenker@toradex.com>2019-08-07 18:42:39 +0200
commit0b276fdab9515ca8e4989cfb5291d22ccccb7b81 (patch)
tree8b00fbca6ae13c58cf09b4597f8ae03872290eb2 /recipes-support
parent5290186d19f81540cfcb92ab4424951909885223 (diff)
bmode-usb: expand recipe to support imx6ull
Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Diffstat (limited to 'recipes-support')
-rw-r--r--recipes-support/bmode-usb/bmode-usb/bmode_usb.c27
-rw-r--r--recipes-support/bmode-usb/bmode-usb_1.0.bb5
2 files changed, 24 insertions, 8 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;
}
diff --git a/recipes-support/bmode-usb/bmode-usb_1.0.bb b/recipes-support/bmode-usb/bmode-usb_1.0.bb
index f33f531..a6c14e0 100644
--- a/recipes-support/bmode-usb/bmode-usb_1.0.bb
+++ b/recipes-support/bmode-usb/bmode-usb_1.0.bb
@@ -4,9 +4,12 @@ LIC_FILES_CHKSUM = "file://bmode_usb.c;endline=5;md5=4c9010cb42fb7648a460c35e6b5
SRC_URI = "file://bmode_usb.c"
S = "${WORKDIR}"
+DEFINE = "NO_MACHINE"
+DEFINE_mx6 = "MX6"
+DEFINE_mx6ull = "MX6ULL"
do_compile() {
- ${CC} -o bmode_usb bmode_usb.c ${CFLAGS} ${LDFLAGS}
+ ${CC} -o bmode_usb bmode_usb.c ${CFLAGS} ${LDFLAGS} -D ${DEFINE}
}
do_install() {