Introduce firmware download fail recovery mechanism
Let NFC IRQ stay enabled even in download mode to avoid NFC
from not recovering.
Issue: FP3-A11#230
Change-Id: Icbd45691e6b1aeebe2f694c04ae1573837913c3b
diff --git a/drivers/nfc/nq-nci.c b/drivers/nfc/nq-nci.c
old mode 100644
new mode 100755
index bae7f5b..15a6c53
--- a/drivers/nfc/nq-nci.c
+++ b/drivers/nfc/nq-nci.c
@@ -29,6 +29,10 @@
#include <linux/compat.h>
#endif
+#define PFX "[NFC][NQ]"
+/* To avoid from recovery fail and then NFC always in download mode */
+#define NFC_FW_DOWNLOAD_MODE
+
struct nqx_platform_data {
unsigned int irq_gpio;
unsigned int en_gpio;
@@ -476,7 +480,9 @@
* interrupts to avoid spurious notifications to upper
* layers.
*/
+ #if !defined( NFC_FW_DOWNLOAD_MODE )
nqx_disable_irq(nqx_dev);
+ #endif /* ( NFC_FW_DOWNLOAD_MODE ) */
dev_dbg(&nqx_dev->client->dev,
"gpio_set_value disable: %s: info: %p\n",
__func__, nqx_dev);
@@ -533,6 +539,11 @@
return -EBUSY; /* Device or resource busy */
}
}
+ #if defined( NFC_FW_DOWNLOAD_MODE )
+ /* Enable IRQ while upgrade FW. To avoid from recovery fail and then NFC
+ * always in download mode */
+ nqx_enable_irq( nqx_dev );
+ #endif /* ( NFC_FW_DOWNLOAD_MODE ) */
gpio_set_value(nqx_dev->en_gpio, 1);
usleep_range(10000, 10100);
if (gpio_is_valid(nqx_dev->firm_gpio)) {
@@ -1187,8 +1198,12 @@
if (r) {
/* make sure NFCC is not enabled */
gpio_set_value(platform_data->en_gpio, 0);
+ #if !defined( NFC_FW_DOWNLOAD_MODE ) /* Qualcomm default */
/* We don't think there is hardware switch NFC OFF */
goto err_request_hw_check_failed;
+ #else
+ dev_err(&client->dev, "[%s]nfcc_hw_check() error !!\n", __func__ );
+ #endif /* ( NFC_FW_DOWNLOAD_MODE ) */
}
/* Register reboot notifier here */