[WCNCR00144638] sdio: modify driver get own flow

[Description]
Refactor halSetDriverOwn() api.
Origin:
  Driver programs CLR_LP_OWN regsiter again if polling own fails.
New:
  Driver only programs CLR_LP_OWN once and polling until timeout.
  In normal case, the first time request should be successful.
  If driver tries lots of times then gets the own,
  it implies something wrong in firmware.

Change-Id: I299f2758404a5ff0fb6fc9531ace061ad3f4d3ce
Feature: sdio
Signed-off-by: Chiahsuan Chuang <chiahsuan.chuang@mediatek.com>
CR-Id: WCNCR00144638
diff --git a/os/linux/hif/sdio/hal_api.c b/os/linux/hif/sdio/hal_api.c
index 07c6977..94ccafd 100644
--- a/os/linux/hif/sdio/hal_api.c
+++ b/os/linux/hif/sdio/hal_api.c
@@ -396,11 +396,20 @@
 			break;
 		}
 
+#if 1
+		if (i == 0) {
+			/* Software get LP ownership - only one time.
+			 * Suppose one CLR_LP_OWN will trigger firmware to return the hif_own.
+			 * If not, there is something wrong in chipset.
+			 */
+			HAL_LP_OWN_CLR(prAdapter, &fgResult);
+		}
+#else
 		if ((i & (LP_OWN_BACK_CLR_OWN_ITERATION - 1)) == 0) {
 			/* Software get LP ownership - per 256 iterations */
 			HAL_LP_OWN_CLR(prAdapter, &fgResult);
 		}
-
+#endif
 		/* Delay for LP engine to complete its operation. */
 		kalMsleep(LP_OWN_BACK_LOOP_DELAY_MS);
 		i++;