Use a 10s timeout in uart_read() in FW download mode.

This provides a path to flush RX, necessary when we enter FW download mode
with bogus data already in RX. This fixes a problem where NFC was dead on several
HSPA and LTE devices.

Also decrease FW timeout completition from 120s to 60s. Typically FW download
takes 30s, and 120 is unnecessarily large and causes a long delay to bring up
NFC when we need to retry FW.

Bug: 5468674
Change-Id: I0fd40c199daac861fe5acda4f2d214bdcff8e869
diff --git a/Linux_x86/phDal4Nfc_uart.c b/Linux_x86/phDal4Nfc_uart.c
index 7ff9c4c..a2f6db3 100644
--- a/Linux_x86/phDal4Nfc_uart.c
+++ b/Linux_x86/phDal4Nfc_uart.c
@@ -342,7 +342,7 @@
     read_property();
 
     // Read timeout:
-    // FW mode: no timeout
+    // FW mode: 10s timeout
     // 1 byte read: steady-state LLC length read, allowed to block forever
     // >1 byte read: LLC payload, 100ms timeout (before pn544 re-transmit)
     if (nNbBytesToRead > 1 && !libnfc_firmware_mode) {
@@ -353,6 +353,10 @@
             timeout.tv_nsec -= 1000000000;
         }
         ptv = &tv;
+    } else if (libnfc_firmware_mode) {
+        clock_gettime(CLOCK_MONOTONIC, &timeout);
+        timeout.tv_sec += 10;
+        ptv = &tv;
     } else {
         ptv = NULL;
     }
diff --git a/inc/phNfcConfig.h b/inc/phNfcConfig.h
index bcefaec..cced2ca 100644
--- a/inc/phNfcConfig.h
+++ b/inc/phNfcConfig.h
@@ -235,7 +235,7 @@
 
 
 #ifndef NXP_DNLD_COMPLETE_TIMEOUT
-#define NXP_DNLD_COMPLETE_TIMEOUT         120000U
+#define NXP_DNLD_COMPLETE_TIMEOUT         60000U
 #endif