From: Ingo Oeser <netdev@axxeo.de>
To: Andy Fleming <afleming@freescale.com>
Cc: Netdev <netdev@vger.kernel.org>, Jeff Garzik <jgarzik@pobox.com>,
Kumar Gala <galak@kernel.crashing.org>
Subject: Re: [PATCH] Add support for configuring the PHY connection interface
Date: Wed, 8 Nov 2006 10:37:23 +0100 [thread overview]
Message-ID: <200611081037.24039.netdev@axxeo.de> (raw)
In-Reply-To: <Pine.LNX.4.61.0611080009010.6936@ld0175-tx32.am.freescale.net>
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
next prev parent reply other threads:[~2006-11-08 9:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-08 6:10 [PATCH] Add support for configuring the PHY connection interface Andy Fleming
2006-11-08 6:16 ` Kumar Gala
2006-11-08 6:27 ` Andy Fleming
2006-11-08 9:37 ` Ingo Oeser [this message]
2006-11-14 15:30 ` Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200611081037.24039.netdev@axxeo.de \
--to=netdev@axxeo.de \
--cc=afleming@freescale.com \
--cc=galak@kernel.crashing.org \
--cc=jgarzik@pobox.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).