flashing scripts

Change-Id: I1aacfa0d6b34f6c556e79af84d74c13dd7994ed5
diff --git a/kernel/dev/uart/nxp-imx/uart.c b/kernel/dev/uart/nxp-imx/uart.c
index 6c75184..0c03576 100644
--- a/kernel/dev/uart/nxp-imx/uart.c
+++ b/kernel/dev/uart/nxp-imx/uart.c
@@ -55,7 +55,7 @@
 
 static bool uart_tx_irq_enabled = false;
 static event_t uart_dputc_event = EVENT_INITIAL_VALUE(uart_dputc_event, true, 0);
-static spin_lock_t uart_spinlock = SPIN_LOCK_INITIAL_VALUE;
+//static spin_lock_t uart_spinlock = SPIN_LOCK_INITIAL_VALUE;
 
 
 static void imx_uart_init(mdi_node_ref_t* node, uint level)
@@ -63,7 +63,7 @@
 
     // create circular buffer to hold received data
     cbuf_initialize(&uart_rx_buf, RXBUF_SIZE);
-
+#if 0
     // assumes interrupts are contiguous
     //zx_status_t status = register_int_handler(uart_irq, &imx_uart_irq, NULL);
     //DEBUG_ASSERT(status == ZX_OK);
@@ -91,6 +91,7 @@
     printf("UART: started IRQ driven TX\n");
     uart_tx_irq_enabled = true;
 #endif
+#endif
 }
 
 static int imx_uart_getc(bool wait)
@@ -108,9 +109,9 @@
 static int imx_uart_pputc(char c)
 {
     /* spin while fifo is full */
-    //while (UARTREG(uart_base, UART_FR) & (1<<5))
-    //    ;
-    //UARTREG(uart_base, UART_DR) = c;
+    while (UARTREG(UART_UTS) & (1<<4))
+        ;
+    UARTREG(UART_UTXD) = c;
 
     return 1;
 }
@@ -135,7 +136,12 @@
     if (!uart_tx_irq_enabled)
         block = false;
     spin_lock_irqsave(&uart_spinlock, state);
+#endif
     while (len > 0) {
+        imx_uart_pputc(*str++);
+        len--;
+    }
+#if 0
         // Is FIFO Full ?
         while (UARTREG(uart_base, UART_FR) & (1<<5)) {
             if (block) {
@@ -206,5 +212,5 @@
     pdev_register_uart(&uart_ops);
 }
 
-LK_PDEV_INIT(imx_uart_init_early, MDI_ARM_IMX_UART, imx_uart_init_early, LK_INIT_LEVEL_PLATFORM_EARLY);
-LK_PDEV_INIT(imx_uart_init, MDI_ARM_IMX_UART, imx_uart_init, LK_INIT_LEVEL_PLATFORM);
+LK_PDEV_INIT(imx_uart_init_early, MDI_ARM_NXP_IMX_UART, imx_uart_init_early, LK_INIT_LEVEL_PLATFORM_EARLY);
+LK_PDEV_INIT(imx_uart_init, MDI_ARM_NXP_IMX_UART, imx_uart_init, LK_INIT_LEVEL_PLATFORM);
diff --git a/kernel/platform/generic-arm/rules.mk b/kernel/platform/generic-arm/rules.mk
index 5a44b9e..4fc2a2c 100644
--- a/kernel/platform/generic-arm/rules.mk
+++ b/kernel/platform/generic-arm/rules.mk
@@ -30,6 +30,7 @@
 	kernel/dev/power/hisi \
 	kernel/dev/psci \
 	kernel/dev/uart/amlogic_s905 \
+	kernel/dev/uart/nxp-imx \
 	kernel/dev/uart/pl011 \
 	kernel/dev/hdcp/amlogic_s912 \
 
diff --git a/kernel/target/all-boards.list b/kernel/target/all-boards.list
index 9db8d02..cebe770 100644
--- a/kernel/target/all-boards.list
+++ b/kernel/target/all-boards.list
@@ -3,5 +3,6 @@
 hikey960
 qemu
 vim2
+imx8edk
 [x64]
 pc
diff --git a/scripts/fastboot-flash b/scripts/fastboot-flash
index 8ac5f03..523dcdd 100755
--- a/scripts/fastboot-flash
+++ b/scripts/fastboot-flash
@@ -11,7 +11,7 @@
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 MKBOOTIMG="${DIR}/../third_party/tools/android/mkbootimg"
 
-MEMBASE=0x00000000
+MEMBASE=0x50000000
 KERNEL_OFFSET=0x1080000
 
 CMDLINE="TERM=uart"
@@ -57,5 +57,7 @@
 --cmdline "${CMDLINE}" \
 -o "${OUT_IMAGE}"
 
-fastboot flash boot "${OUT_IMAGE}"
+fastboot flash boot_a "${OUT_IMAGE}"
+fastboot flash boot_b "${OUT_IMAGE}"
+
 fastboot reboot
diff --git a/scripts/flash-nxp b/scripts/flash-nxp
new file mode 100755
index 0000000..24fa114
--- /dev/null
+++ b/scripts/flash-nxp
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+# Copyright 2017 The Fuchsia Authors
+#
+# Use of this source code is governed by a MIT-style
+# license that can be found in the LICENSE file or at
+# https://opensource.org/licenses/MIT
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+exec $DIR/fastboot-flash -b imx8edk "$@"