diff options
| author | Albert ARIBAUD <albert.u.boot@aribaud.net> | 2012-09-30 23:49:17 +0200 | 
|---|---|---|
| committer | Albert ARIBAUD <albert.u.boot@aribaud.net> | 2012-09-30 23:49:17 +0200 | 
| commit | 1c27059a2f7158a9c9a8778535b030935d75179d (patch) | |
| tree | bf577d5c9f0da21c5d57feed1091214e54c39dec /board/freescale/common/fman.c | |
| parent | 8f0732ac3dc3bdbbcada313dc4b4b38d5d2c376a (diff) | |
| parent | 4668a086bb0a769b741e3a4ffab85f1c41c7cdb8 (diff) | |
| download | olio-uboot-2014.01-1c27059a2f7158a9c9a8778535b030935d75179d.tar.xz olio-uboot-2014.01-1c27059a2f7158a9c9a8778535b030935d75179d.zip | |
Merge remote-tracking branch 'u-boot/master'
Diffstat (limited to 'board/freescale/common/fman.c')
| -rw-r--r-- | board/freescale/common/fman.c | 31 | 
1 files changed, 31 insertions, 0 deletions
| diff --git a/board/freescale/common/fman.c b/board/freescale/common/fman.c index 6ddf81620..3ef49369a 100644 --- a/board/freescale/common/fman.c +++ b/board/freescale/common/fman.c @@ -25,6 +25,9 @@  #include <libfdt_env.h>  #include <fdt_support.h> +#include <fm_eth.h> +#include <asm/fsl_serdes.h> +  /*   * Given the following ...   * @@ -67,3 +70,31 @@ int fdt_set_phy_handle(void *fdt, char *compat, phys_addr_t addr,  	return fdt_setprop(fdt, offset, "phy-handle", &ph, sizeof(ph));  } + +/* + * Return the SerDes device enum for a given Fman port + * + * This function just maps the fm_port namespace to the srds_prtcl namespace. + */ +enum srds_prtcl serdes_device_from_fm_port(enum fm_port port) +{ +	static const enum srds_prtcl srds_table[] = { +		[FM1_DTSEC1] = SGMII_FM1_DTSEC1, +		[FM1_DTSEC2] = SGMII_FM1_DTSEC2, +		[FM1_DTSEC3] = SGMII_FM1_DTSEC3, +		[FM1_DTSEC4] = SGMII_FM1_DTSEC4, +		[FM1_DTSEC5] = SGMII_FM1_DTSEC5, +		[FM1_10GEC1] = XAUI_FM1, +		[FM2_DTSEC1] = SGMII_FM2_DTSEC1, +		[FM2_DTSEC2] = SGMII_FM2_DTSEC2, +		[FM2_DTSEC3] = SGMII_FM2_DTSEC3, +		[FM2_DTSEC4] = SGMII_FM2_DTSEC4, +		[FM2_DTSEC5] = SGMII_FM2_DTSEC5, +		[FM2_10GEC1] = XAUI_FM2, +	}; + +	if ((port < FM1_DTSEC1) || (port > FM2_10GEC1)) +		return NONE; +	else +		return srds_table[port]; +} |