From 5998568e86490fca14fe8d60bdff151d5857f762 Mon Sep 17 00:00:00 2001 From: Kedareswara rao Appana Date: Wed, 29 Oct 2014 15:58:19 +0530 Subject: [PATCH] sw_apps: Fix echo server sfp phy programming issues This patch fixes the sfp phy clock programming issues on zynq. Signed-off-by: Kedareswara rao Appana --- lib/sw_apps/lwip_echo_server/src/i2c_access.c | 5 ++++- lib/sw_apps/lwip_echo_server/src/main.c | 8 ++++++-- lib/sw_apps/lwip_echo_server/src/sfp.c | 10 +++++++++- lib/sw_apps/lwip_echo_server/src/si5324.c | 5 ++++- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lib/sw_apps/lwip_echo_server/src/i2c_access.c b/lib/sw_apps/lwip_echo_server/src/i2c_access.c index a5f1fbb4..19fa832b 100755 --- a/lib/sw_apps/lwip_echo_server/src/i2c_access.c +++ b/lib/sw_apps/lwip_echo_server/src/i2c_access.c @@ -49,7 +49,9 @@ /***************************** Include Files *********************************/ #include "xparameters.h" -#if XPAR_GIGE_PCS_PMA_CORE_PRESENT == 1 +#ifdef __arm__ +#if XPAR_GIGE_PCS_PMA_SGMII_CORE_PRESENT == 1 || \ + XPAR_GIGE_PCS_PMA_1000BASEX_CORE_PRESENT == 1 #include "xil_exception.h" #include "xil_printf.h" #include "xiicps.h" @@ -419,3 +421,4 @@ static void StatusHandler(XIIC_LIB *I2cLibPtr, int Event) } } #endif +#endif diff --git a/lib/sw_apps/lwip_echo_server/src/main.c b/lib/sw_apps/lwip_echo_server/src/main.c index d7158347..db1ad49a 100755 --- a/lib/sw_apps/lwip_echo_server/src/main.c +++ b/lib/sw_apps/lwip_echo_server/src/main.c @@ -79,10 +79,12 @@ print_ip_settings(struct ip_addr *ip, struct ip_addr *mask, struct ip_addr *gw) print_ip("Gateway : ", gw); } -#if XPAR_GIGE_PCS_PMA_CORE_PRESENT == 1 +#ifdef __arm__ +#if XPAR_GIGE_PCS_PMA_SGMII_CORE_PRESENT == 1 || XPAR_GIGE_PCS_PMA_1000BASEX_CORE_PRESENT == 1 int ProgramSi5324(void); int ProgramSfpPhy(void); #endif +#endif int main() { struct ip_addr ipaddr, netmask, gw; @@ -92,9 +94,11 @@ int main() { 0x00, 0x0a, 0x35, 0x00, 0x01, 0x02 }; echo_netif = &server_netif; -#if XPAR_GIGE_PCS_PMA_CORE_PRESENT == 1 +#ifdef __arm__ +#if XPAR_GIGE_PCS_PMA_SGMII_CORE_PRESENT == 1 || XPAR_GIGE_PCS_PMA_1000BASEX_CORE_PRESENT == 1 ProgramSi5324(); ProgramSfpPhy(); +#endif #endif init_platform(); diff --git a/lib/sw_apps/lwip_echo_server/src/sfp.c b/lib/sw_apps/lwip_echo_server/src/sfp.c index 73156a43..f61aaaea 100755 --- a/lib/sw_apps/lwip_echo_server/src/sfp.c +++ b/lib/sw_apps/lwip_echo_server/src/sfp.c @@ -48,7 +48,9 @@ /***************************** Include Files *********************************/ #include "xparameters.h" -#if XPAR_GIGE_PCS_PMA_CORE_PRESENT == 1 +#ifdef __arm__ +#if XPAR_GIGE_PCS_PMA_SGMII_CORE_PRESENT == 1 || \ + XPAR_GIGE_PCS_PMA_1000BASEX_CORE_PRESENT == 1 #include "xil_printf.h" #include "xiicps.h" #include "sleep.h" @@ -136,8 +138,13 @@ int ProgramSfpPhy(void) return XST_FAILURE; } +#if XPAR_GIGE_PCS_PMA_1000BASEX_CORE_PRESENT == 1 + /* Enabling 1000BASEX */ + I2cPhyWrite(&I2cLibInstance, IIC_SLAVE_ADDR, 0x1B, 0x9088, IIC_SLAVE_ADDR); +#else /* Enabling SGMII */ I2cPhyWrite(&I2cLibInstance, IIC_SLAVE_ADDR, 0x1B, 0x9084, IIC_SLAVE_ADDR); +#endif /* Apply Soft Reset */ I2cPhyWrite(&I2cLibInstance, IIC_SLAVE_ADDR, 0x00, 0x9140, IIC_SLAVE_ADDR); @@ -186,3 +193,4 @@ int ProgramSfpPhy(void) return XST_SUCCESS; } #endif +#endif diff --git a/lib/sw_apps/lwip_echo_server/src/si5324.c b/lib/sw_apps/lwip_echo_server/src/si5324.c index 8d0d5d42..6a52c8b5 100755 --- a/lib/sw_apps/lwip_echo_server/src/si5324.c +++ b/lib/sw_apps/lwip_echo_server/src/si5324.c @@ -53,7 +53,9 @@ /***************************** Include Files *********************************/ #include "xparameters.h" -#if XPAR_GIGE_PCS_PMA_CORE_PRESENT == 1 +#ifdef __arm__ +#if XPAR_GIGE_PCS_PMA_SGMII_CORE_PRESENT == 1 || \ + XPAR_GIGE_PCS_PMA_1000BASEX_CORE_PRESENT == 1 #include "xil_printf.h" #include "xiicps.h" #include "sleep.h" @@ -186,3 +188,4 @@ int ProgramSi5324(void) return XST_SUCCESS; } #endif +#endif \ No newline at end of file