Add support to detect link change.

The current Marvell link state update is dependent on the state machine
transition triggered by 802.3ah CTRL message. For P2P, this will cause
the link to be always in DOWN state after the fiber is flapped. This CL
added the link update detection based on the receiver's optical signal
detection. This is only tentative solution until the wavelength
selection feature is ready.

Change-Id: I65b49190bc4a6d2a21145d732b562cfc36da42be
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/epon/eponOnuAlrm.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/epon/eponOnuAlrm.c
index ff48289..3bf0dae 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/epon/eponOnuAlrm.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/epon/eponOnuAlrm.c
@@ -201,6 +201,7 @@
     }

     else /* ((onuEponChangeAlarm & onuEponCurrentAlarmState) == 0) */

     {

+      LINKSTATUSFUNC linkStatusCallback;

       if (onuEponChangeAlarm & ONU_EPON_XVR_SD_MASK)

       {

         mvPonPrint(PON_PRINT_INFO, PON_ALARM_MODULE, 

@@ -215,6 +216,18 @@
 

         onuEponLosAlarm |= 0x02<<8;

       }

+      /* TODO(kedong): There is no OAM message between ONU and OLT, thus the

+       * link will be always down if we don't explicitly bring up the interface.

+       * Here we hook the link status update code to the XVR alarm off code to

+       * always indicate the link up if the XVR signal is detected. Once the

+       * wavelength selection code is ready, we should remove the follow link

+       * status check code.

+       */

+      linkStatusCallback = onuEponDbLinkStatusCallbackGet();

+      if (linkStatusCallback != NULL)

+      {

+        linkStatusCallback(MV_TRUE);

+      }

     }

 

     onuEponPreviousAlarm = onuEponCurrentAlarmState;  

diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/epon/eponOnuIsr.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/epon/eponOnuIsr.c
index 523ef35..6242d8d 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/epon/eponOnuIsr.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/epon/eponOnuIsr.c
@@ -209,8 +209,10 @@
 
 		} else if (state == MV_TRUE) { /* alarm is ON */
 
-			/* set EPON mode */
-			onuEponDbModeSet(E_EPON_IOCTL_STD_MODE);
+			/* set EPON mode only if it is not P2P */
+			if (E_EPON_IOCTL_P2P_MODE != onuEponDbModeGet()) {
+				onuEponDbModeSet(E_EPON_IOCTL_STD_MODE);
+			}
 			/* config PCS synchronization configuration  - FEC disabled */
 			mvOnuEponMacPcsDelaySet(0x1C58);
 			/* clear Rx Ctrl message FIFO */