[PATCH rtems-libbsd] freebsd/cgem: Use SGMII when necessary

Chris Johns chrisj at rtems.org
Tue Nov 1 21:13:54 UTC 2022


On 2/11/2022 5:51 am, Kinsey Moore wrote:
> Certain hardware configurations will always use SGMII instead of RGMII.
> Apply the appropriate flags for the relevant BSPs.
> ---
>  freebsd/sys/dev/cadence/if_cgem.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/freebsd/sys/dev/cadence/if_cgem.c b/freebsd/sys/dev/cadence/if_cgem.c
> index 3eaaf6b2..9b4cf693 100644
> --- a/freebsd/sys/dev/cadence/if_cgem.c
> +++ b/freebsd/sys/dev/cadence/if_cgem.c
> @@ -1296,6 +1296,16 @@ cgem_config(struct cgem_softc *sc)
>  		CGEM_NET_CFG_FULL_DUPLEX |
>  		CGEM_NET_CFG_SPEED100;
>  
> +#ifdef __rtems__
> +#define STRINGIFY(to_str) #to_str
> +#define BSP_STR(to_str) STRINGIFY(to_str)
> +	/* Configure the PHYs to use SGMII for particular BSPs */
> +	if ( 0 == strcmp( BSP_STR(RTEMS_BSP), "xilinx_zynqmp_lp64_cfc400x" ) ) {
> +		net_cfg |= CGEM_NET_CFG_SGMII_EN;
> +		net_cfg |= CGEM_NET_CFG_PCS_SEL;
> +	}

This makes it a precedent a cgem device has to be an RTEMS BSP to support SGMII.
I do not think that is a good idea.

Is the simplest solution adding a weak function call asks which mode and the
default call returns RGMII?

Chris


More information about the devel mailing list