Hi Andy,

Andy Fleming wrote:
> diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
> index b4b5b4a..b053370 100644
> --- a/arch/powerpc/sysdev/fsl_soc.c
> +++ b/arch/powerpc/sysdev/fsl_soc.c
> @@ -211,6 +211,36 @@ static int __init gfar_set_flags(struct 
>       return device_flags;
>  }
>  
> +/* Return the Linux interface mode type based on the
> + * specification in the device-tree */
> +static int __init gfar_get_interface(struct device_node *np)
> +{
> +     const char *istr;
> +     int interface = 0;
> +
> +     istr = get_property(np, "interface", NULL);
> +
> +     if (istr == NULL)
> +             istr = "GMII";
> +
> +     if (!strcasecmp(istr, "GMII"))
> +             interface = PHY_INTERFACE_MODE_GMII;
> +     else if (!strcasecmp(istr, "MII"))
> +             interface = PHY_INTERFACE_MODE_MII;
> +     else if (!strcasecmp(istr, "RGMII"))
> +             interface = PHY_INTERFACE_MODE_RGMII;
> +     else if (!strcasecmp(istr, "SGMII"))
> +             interface = PHY_INTERFACE_MODE_SGMII;
> +     else if (!strcasecmp(istr, "TBI"))
> +             interface = PHY_INTERFACE_MODE_TBI;
> +     else if (!strcasecmp(istr, "RMII"))
> +             interface = PHY_INTERFACE_MODE_RMII;
> +     else if (!strcasecmp(istr, "RTBI"))
> +             interface = PHY_INTERFACE_MODE_RTBI;
> +
> +     return interface;
> +}

If you change the modes into an enum (as suggested by Kumar), 
you can make a nice static lookup table indexed by mode with a for loop here.


Regards

Ingo Oeser
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to