Re: [PATCH rtems-lwip] zynqmp: Add support for the CFC-400X BSP
Looks great. It only affects the Zynqmp. Thanks. On Thu, Nov 10, 2022 at 2:23 PM Kinsey Moore wrote: > > This adds support for the CFC-400X BSP including an option to select > SGMII instead of the default RGMII PHY interface and adds a way for > ZynqMP BSPs to provide additional configuration via lwipbspopts.h. > --- > .../aarch64/xilinx_zynqmp_lp64_cfc400x.json | 11 > .../contrib/ports/xilinx/netif/xemacpsif_hw.c | 6 ++ > rtemslwip/zynqmp/lwipopts.h | 2 + > rtemslwip/zynqmp_cfc400x/lwipbspopts.h| 33 ++ > rtemslwip/zynqmp_cfc400x/netstart.c | 66 +++ > rtemslwip/zynqmp_hardware/lwipbspopts.h | 1 + > rtemslwip/zynqmp_qemu/lwipbspopts.h | 1 + > 7 files changed, 120 insertions(+) > create mode 100644 defs/bsps/aarch64/xilinx_zynqmp_lp64_cfc400x.json > create mode 100644 rtemslwip/zynqmp_cfc400x/lwipbspopts.h > create mode 100644 rtemslwip/zynqmp_cfc400x/netstart.c > create mode 100644 rtemslwip/zynqmp_hardware/lwipbspopts.h > create mode 100644 rtemslwip/zynqmp_qemu/lwipbspopts.h > > diff --git a/defs/bsps/aarch64/xilinx_zynqmp_lp64_cfc400x.json > b/defs/bsps/aarch64/xilinx_zynqmp_lp64_cfc400x.json > new file mode 100644 > index 000..5fe676c > --- /dev/null > +++ b/defs/bsps/aarch64/xilinx_zynqmp_lp64_cfc400x.json > @@ -0,0 +1,11 @@ > +{ > + "includes": [ > + "xilinx_zynqmp_base" > + ], > + "header-paths-to-import": [ > + "rtemslwip/zynqmp_cfc400x" > + ], > + "source-paths-to-import": [ > + "rtemslwip/zynqmp_cfc400x" > + ] > +} > diff --git > a/embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif_hw.c > > b/embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif_hw.c > index a1fdeda..f0ddf84 100644 > --- > a/embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif_hw.c > +++ > b/embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif_hw.c > @@ -74,6 +74,12 @@ void init_emacps(xemacpsif_s *xemacps, struct netif *netif) > > xemacpsp = >emacps; > > +#ifdef __rtems__ > +#ifdef ZYNQMP_USE_SGMII > + XEmacPs_SetOptions(xemacpsp, XEMACPS_SGMII_ENABLE_OPTION); > +#endif > +#endif > + > #ifdef ZYNQMP_USE_JUMBO > XEmacPs_SetOptions(xemacpsp, XEMACPS_JUMBO_ENABLE_OPTION); > #endif > diff --git a/rtemslwip/zynqmp/lwipopts.h b/rtemslwip/zynqmp/lwipopts.h > index b9fe277..feabe73 100644 > --- a/rtemslwip/zynqmp/lwipopts.h > +++ b/rtemslwip/zynqmp/lwipopts.h > @@ -123,4 +123,6 @@ > #define portTICK_RATE_MS ( rtems_clock_get_ticks_per_second() * 1000 ) > #define vTaskDelay( x ) sys_arch_delay( x ) > > +#include > + > #endif /* __LWIPOPTS_H__ */ > diff --git a/rtemslwip/zynqmp_cfc400x/lwipbspopts.h > b/rtemslwip/zynqmp_cfc400x/lwipbspopts.h > new file mode 100644 > index 000..27eb6a9 > --- /dev/null > +++ b/rtemslwip/zynqmp_cfc400x/lwipbspopts.h > @@ -0,0 +1,33 @@ > +/* > + * Copyright (C) 2022 On-Line Applications Research Corporation (OAR) > + * Written by Kinsey Moore > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + *notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + *notice, this list of conditions and the following disclaimer in the > + *documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS > IS" > + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE > + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF > + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) > + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > + * POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#ifndef RTEMSLWIP_LWIPBSPOPTS_H > +#define RTEMSLWIP_LWIPBSPOPTS_H > + > +/* Use SGMII mode for all interfaces on the CFC-400X */ > +#define ZYNQMP_USE_SGMII > + > +#endif /* RTEMSLWIP_LWIPBSPOPTS_H */ > diff --git a/rtemslwip/zynqmp_cfc400x/netstart.c > b/rtemslwip/zynqmp_cfc400x/netstart.c > new file mode 100644 > index 000..d19b36c > --- /dev/null > +++ b/rtemslwip/zynqmp_cfc400x/netstart.c > @@ -0,0 +1,66 @@ > +/* > + * Copyright (C) 2022 On-Line Applications
[PATCH rtems-lwip] zynqmp: Add support for the CFC-400X BSP
This adds support for the CFC-400X BSP including an option to select SGMII instead of the default RGMII PHY interface and adds a way for ZynqMP BSPs to provide additional configuration via lwipbspopts.h. --- .../aarch64/xilinx_zynqmp_lp64_cfc400x.json | 11 .../contrib/ports/xilinx/netif/xemacpsif_hw.c | 6 ++ rtemslwip/zynqmp/lwipopts.h | 2 + rtemslwip/zynqmp_cfc400x/lwipbspopts.h| 33 ++ rtemslwip/zynqmp_cfc400x/netstart.c | 66 +++ rtemslwip/zynqmp_hardware/lwipbspopts.h | 1 + rtemslwip/zynqmp_qemu/lwipbspopts.h | 1 + 7 files changed, 120 insertions(+) create mode 100644 defs/bsps/aarch64/xilinx_zynqmp_lp64_cfc400x.json create mode 100644 rtemslwip/zynqmp_cfc400x/lwipbspopts.h create mode 100644 rtemslwip/zynqmp_cfc400x/netstart.c create mode 100644 rtemslwip/zynqmp_hardware/lwipbspopts.h create mode 100644 rtemslwip/zynqmp_qemu/lwipbspopts.h diff --git a/defs/bsps/aarch64/xilinx_zynqmp_lp64_cfc400x.json b/defs/bsps/aarch64/xilinx_zynqmp_lp64_cfc400x.json new file mode 100644 index 000..5fe676c --- /dev/null +++ b/defs/bsps/aarch64/xilinx_zynqmp_lp64_cfc400x.json @@ -0,0 +1,11 @@ +{ + "includes": [ + "xilinx_zynqmp_base" + ], + "header-paths-to-import": [ + "rtemslwip/zynqmp_cfc400x" + ], + "source-paths-to-import": [ + "rtemslwip/zynqmp_cfc400x" + ] +} diff --git a/embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif_hw.c b/embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif_hw.c index a1fdeda..f0ddf84 100644 --- a/embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif_hw.c +++ b/embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif_hw.c @@ -74,6 +74,12 @@ void init_emacps(xemacpsif_s *xemacps, struct netif *netif) xemacpsp = >emacps; +#ifdef __rtems__ +#ifdef ZYNQMP_USE_SGMII + XEmacPs_SetOptions(xemacpsp, XEMACPS_SGMII_ENABLE_OPTION); +#endif +#endif + #ifdef ZYNQMP_USE_JUMBO XEmacPs_SetOptions(xemacpsp, XEMACPS_JUMBO_ENABLE_OPTION); #endif diff --git a/rtemslwip/zynqmp/lwipopts.h b/rtemslwip/zynqmp/lwipopts.h index b9fe277..feabe73 100644 --- a/rtemslwip/zynqmp/lwipopts.h +++ b/rtemslwip/zynqmp/lwipopts.h @@ -123,4 +123,6 @@ #define portTICK_RATE_MS ( rtems_clock_get_ticks_per_second() * 1000 ) #define vTaskDelay( x ) sys_arch_delay( x ) +#include + #endif /* __LWIPOPTS_H__ */ diff --git a/rtemslwip/zynqmp_cfc400x/lwipbspopts.h b/rtemslwip/zynqmp_cfc400x/lwipbspopts.h new file mode 100644 index 000..27eb6a9 --- /dev/null +++ b/rtemslwip/zynqmp_cfc400x/lwipbspopts.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022 On-Line Applications Research Corporation (OAR) + * Written by Kinsey Moore + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RTEMSLWIP_LWIPBSPOPTS_H +#define RTEMSLWIP_LWIPBSPOPTS_H + +/* Use SGMII mode for all interfaces on the CFC-400X */ +#define ZYNQMP_USE_SGMII + +#endif /* RTEMSLWIP_LWIPBSPOPTS_H */ diff --git a/rtemslwip/zynqmp_cfc400x/netstart.c b/rtemslwip/zynqmp_cfc400x/netstart.c new file mode 100644 index 000..d19b36c --- /dev/null +++ b/rtemslwip/zynqmp_cfc400x/netstart.c @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2022 On-Line Applications Research Corporation (OAR) + * Written by Kinsey Moore + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following