* [U-Boot] [PATCH] drivers/qe/uec_phy.c: Added PHY-less (fixed PHY) driver.
@ 2008-10-23 13:08 Richard Retanubun
2008-10-23 13:50 ` Richard Retanubun
2008-11-04 7:26 ` Ben Warren
0 siblings, 2 replies; 5+ messages in thread
From: Richard Retanubun @ 2008-10-23 13:08 UTC (permalink / raw)
To: u-boot
Copied over the fixed PHY driver as used in pp4xx/4xx_enet.c.
This adds support for PHY-less MAC connections to the UEC.
Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com>
---
drivers/qe/uec_phy.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 79 insertions(+), 0 deletions(-)
diff --git a/drivers/qe/uec_phy.c b/drivers/qe/uec_phy.c
index 2243d3b..829f082 100644
--- a/drivers/qe/uec_phy.c
+++ b/drivers/qe/uec_phy.c
@@ -44,6 +44,54 @@
#define ugphy_vdbg(ugeth, fmt, args...) do { } while (0)
#endif /* UEC_VERBOSE_DEBUG */
+/*--------------------------------------------------------------------+
+ * Fixed PHY (PHY-less) support for Ethernet Ports.
+ *
+ * Copied from cpu/ppc4xx/4xx_enet.c
+ *--------------------------------------------------------------------*/
+
+/*
+ * Some boards do not have a PHY for each ethernet port. These ports
+ * are known as Fixed PHY (or PHY-less) ports. For such ports, set
+ * the appropriate CONFIG_PHY_ADDR equal to CONFIG_FIXED_PHY and
+ * then define CONFIG_SYS_FIXED_PHY_PORTS to define what the speed and
+ * duplex should be for these ports in the board configuration
+ * file.
+ *
+ * For Example:
+ * #define CONFIG_FIXED_PHY 0xFFFFFFFF
+ *
+ * #define CONFIG_PHY_ADDR CONFIG_FIXED_PHY
+ * #define CONFIG_PHY1_ADDR 1
+ * #define CONFIG_PHY2_ADDR CONFIG_FIXED_PHY
+ * #define CONFIG_PHY3_ADDR 3
+ *
+ * #define CONFIG_SYS_FIXED_PHY_PORT(devnum,speed,duplex) \
+ * {devnum, speed, duplex},
+ *
+ * #define CONFIG_SYS_FIXED_PHY_PORTS \
+ * CONFIG_SYS_FIXED_PHY_PORT(0,SPEED_100,DUPLEX_FULL) \
+ * CONFIG_SYS_FIXED_PHY_PORT(2,SPEED_100,DUPLEX_HALF)
+ */
+
+#ifndef CONFIG_FIXED_PHY
+#define CONFIG_FIXED_PHY 0xFFFFFFFF /* Fixed PHY (PHY-less) */
+#endif
+
+#ifndef CONFIG_SYS_FIXED_PHY_PORTS
+#define CONFIG_SYS_FIXED_PHY_PORTS /* default is an empty array */
+#endif
+
+struct fixed_phy_port {
+ unsigned int devnum; /* ethernet port */
+ unsigned int speed; /* specified speed 10,100 or 1000 */
+ unsigned int duplex; /* specified duplex FULL or HALF */
+};
+
+static const struct fixed_phy_port fixed_phy_port[] = {
+ CONFIG_SYS_FIXED_PHY_PORTS /* defined in board configuration file */
+};
+
static void config_genmii_advert (struct uec_mii_info *mii_info);
static void genmii_setup_forced (struct uec_mii_info *mii_info);
static void genmii_restart_aneg (struct uec_mii_info *mii_info);
@@ -533,6 +581,28 @@ static void dm9161_close (struct uec_mii_info *mii_info)
{
}
+static int fixed_phy_aneg (struct uec_mii_info *mii_info)
+{
+ mii_info->autoneg = 0; /* Turn off auto negotiation for fixed phy */
+ return 0;
+}
+
+static int fixed_phy_read_status (struct uec_mii_info *mii_info)
+{
+ int i = 0;
+
+ for (i = 0; i < ARRAY_SIZE(fixed_phy_port); i++) {
+ if (mii_info->mii_id == fixed_phy_port[i].devnum) {
+ mii_info->speed = fixed_phy_port[i].speed;
+ mii_info->duplex = fixed_phy_port[i].duplex;
+ mii_info->link = 1; /* Link is always UP */
+ mii_info->pause = 0;
+ break;
+ }
+ }
+ return 0;
+}
+
static struct phy_info phy_info_dm9161 = {
.phy_id = 0x0181b880,
.phy_id_mask = 0x0ffffff0,
@@ -577,6 +647,14 @@ static struct phy_info phy_info_bcm5481 = {
.init = bcm_init,
};
+static struct phy_info phy_info_fixedphy = {
+ .phy_id = CONFIG_FIXED_PHY,
+ .phy_id_mask = CONFIG_FIXED_PHY,
+ .name = "Fixed PHY",
+ .config_aneg = fixed_phy_aneg,
+ .read_status = fixed_phy_read_status,
+};
+
static struct phy_info phy_info_genmii = {
.phy_id = 0x00000000,
.phy_id_mask = 0x00000000,
@@ -591,6 +669,7 @@ static struct phy_info *phy_info[] = {
&phy_info_dm9161a,
&phy_info_marvell,
&phy_info_bcm5481,
+ &phy_info_fixedphy,
&phy_info_genmii,
NULL
};
--
1.5.5.GIT
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] drivers/qe/uec_phy.c: Added PHY-less (fixed PHY) driver.
2008-10-23 13:08 [U-Boot] [PATCH] drivers/qe/uec_phy.c: Added PHY-less (fixed PHY) driver Richard Retanubun
@ 2008-10-23 13:50 ` Richard Retanubun
2008-10-30 12:32 ` Richard Retanubun
2008-11-04 7:26 ` Ben Warren
1 sibling, 1 reply; 5+ messages in thread
From: Richard Retanubun @ 2008-10-23 13:50 UTC (permalink / raw)
To: u-boot
Copied over the fixed PHY driver as used in pp4xx/4xx_enet.c.
This adds support for PHY-less MAC connections to the UEC.
Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com>
---
Documentation change only:
Same patch as before, now with a board configuration file example that
actually applies to UEC based boards :)
drivers/qe/uec_phy.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 78 insertions(+), 0 deletions(-)
diff --git a/drivers/qe/uec_phy.c b/drivers/qe/uec_phy.c
index 2243d3b..b64748b 100644
--- a/drivers/qe/uec_phy.c
+++ b/drivers/qe/uec_phy.c
@@ -44,6 +44,53 @@
#define ugphy_vdbg(ugeth, fmt, args...) do { } while (0)
#endif /* UEC_VERBOSE_DEBUG */
+/*--------------------------------------------------------------------+
+ * Fixed PHY (PHY-less) support for Ethernet Ports.
+ *
+ * Adapted from cpu/ppc4xx/4xx_enet.c
+ *--------------------------------------------------------------------*/
+
+/*
+ * Some boards do not have a PHY for each ethernet port. These ports
+ * are known as Fixed PHY (or PHY-less) ports. For such ports,
+ * define CONFIG_SYS_FIXED_PHY_PORTS to define what the speed and
+ * duplex should be for these ports in the board configuration file.
+ *
+ * Example board configuration file:
+ *
+ * #define CONFIG_FIXED_PHY 0xFFFFFFFF
+ *
+ * #define CONFIG_SYS_UEC1_PHY_ADDR 0 <- PHY-less port
+ * #define CONFIG_SYS_UEC2_PHY_ADDR 1
+ * #define CONFIG_SYS_UEC3_PHY_ADDR 2 <- PHY-less port
+ * #define CONFIG_SYS_UEC4_PHY_ADDR 3
+ *
+ * #define CONFIG_SYS_FIXED_PHY_PORT(devnum,speed,duplex) \
+ * {devnum, speed, duplex},
+ *
+ * #define CONFIG_SYS_FIXED_PHY_PORTS \
+ * CONFIG_SYS_FIXED_PHY_PORT(0, SPEED_1000, DUPLEX_FULL) \
+ * CONFIG_SYS_FIXED_PHY_PORT(2, SPEED_100, DUPLEX_HALF)
+ */
+
+#ifndef CONFIG_FIXED_PHY
+#define CONFIG_FIXED_PHY 0xFFFFFFFF /* Fixed PHY (PHY-less) */
+#endif
+
+#ifndef CONFIG_SYS_FIXED_PHY_PORTS
+#define CONFIG_SYS_FIXED_PHY_PORTS /* default is an empty array */
+#endif
+
+struct fixed_phy_port {
+ unsigned int devnum; /* ethernet port */
+ unsigned int speed; /* specified speed 10,100 or 1000 */
+ unsigned int duplex; /* specified duplex FULL or HALF */
+};
+
+static const struct fixed_phy_port fixed_phy_port[] = {
+ CONFIG_SYS_FIXED_PHY_PORTS /* defined in board configuration file */
+};
+
static void config_genmii_advert (struct uec_mii_info *mii_info);
static void genmii_setup_forced (struct uec_mii_info *mii_info);
static void genmii_restart_aneg (struct uec_mii_info *mii_info);
@@ -533,6 +580,28 @@ static void dm9161_close (struct uec_mii_info *mii_info)
{
}
+static int fixed_phy_aneg (struct uec_mii_info *mii_info)
+{
+ mii_info->autoneg = 0; /* Turn off auto negotiation for fixed phy */
+ return 0;
+}
+
+static int fixed_phy_read_status (struct uec_mii_info *mii_info)
+{
+ int i = 0;
+
+ for (i = 0; i < ARRAY_SIZE(fixed_phy_port); i++) {
+ if (mii_info->mii_id == fixed_phy_port[i].devnum) {
+ mii_info->speed = fixed_phy_port[i].speed;
+ mii_info->duplex = fixed_phy_port[i].duplex;
+ mii_info->link = 1; /* Link is always UP */
+ mii_info->pause = 0;
+ break;
+ }
+ }
+ return 0;
+}
+
static struct phy_info phy_info_dm9161 = {
.phy_id = 0x0181b880,
.phy_id_mask = 0x0ffffff0,
@@ -577,6 +646,14 @@ static struct phy_info phy_info_bcm5481 = {
.init = bcm_init,
};
+static struct phy_info phy_info_fixedphy = {
+ .phy_id = CONFIG_FIXED_PHY,
+ .phy_id_mask = CONFIG_FIXED_PHY,
+ .name = "Fixed PHY",
+ .config_aneg = fixed_phy_aneg,
+ .read_status = fixed_phy_read_status,
+};
+
static struct phy_info phy_info_genmii = {
.phy_id = 0x00000000,
.phy_id_mask = 0x00000000,
@@ -591,6 +668,7 @@ static struct phy_info *phy_info[] = {
&phy_info_dm9161a,
&phy_info_marvell,
&phy_info_bcm5481,
+ &phy_info_fixedphy,
&phy_info_genmii,
NULL
};
--
1.5.5.GIT
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] drivers/qe/uec_phy.c: Added PHY-less (fixed PHY) driver.
2008-10-23 13:50 ` Richard Retanubun
@ 2008-10-30 12:32 ` Richard Retanubun
2008-10-31 23:32 ` Ben Warren
0 siblings, 1 reply; 5+ messages in thread
From: Richard Retanubun @ 2008-10-30 12:32 UTC (permalink / raw)
To: u-boot
Richard Retanubun wrote:
Hi Ben,
I forgot to cc you on the patch e-mail, when you got a chance, do you mind looking at this patch.
Thanks,
- Richard
> Copied over the fixed PHY driver as used in pp4xx/4xx_enet.c.
> This adds support for PHY-less MAC connections to the UEC.
>
> Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com>
> ---
> Documentation change only:
> Same patch as before, now with a board configuration file example that
> actually applies to UEC based boards :)
>
> drivers/qe/uec_phy.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 78 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/qe/uec_phy.c b/drivers/qe/uec_phy.c
> index 2243d3b..b64748b 100644
> --- a/drivers/qe/uec_phy.c
> +++ b/drivers/qe/uec_phy.c
> @@ -44,6 +44,53 @@
> #define ugphy_vdbg(ugeth, fmt, args...) do { } while (0)
> #endif /* UEC_VERBOSE_DEBUG */
>
> +/*--------------------------------------------------------------------+
> + * Fixed PHY (PHY-less) support for Ethernet Ports.
> + *
> + * Adapted from cpu/ppc4xx/4xx_enet.c
> + *--------------------------------------------------------------------*/
> +
> +/*
> + * Some boards do not have a PHY for each ethernet port. These ports
> + * are known as Fixed PHY (or PHY-less) ports. For such ports,
> + * define CONFIG_SYS_FIXED_PHY_PORTS to define what the speed and
> + * duplex should be for these ports in the board configuration file.
> + *
> + * Example board configuration file:
> + *
> + * #define CONFIG_FIXED_PHY 0xFFFFFFFF
> + *
> + * #define CONFIG_SYS_UEC1_PHY_ADDR 0 <- PHY-less port
> + * #define CONFIG_SYS_UEC2_PHY_ADDR 1
> + * #define CONFIG_SYS_UEC3_PHY_ADDR 2 <- PHY-less port
> + * #define CONFIG_SYS_UEC4_PHY_ADDR 3
> + *
> + * #define CONFIG_SYS_FIXED_PHY_PORT(devnum,speed,duplex) \
> + * {devnum, speed, duplex},
> + *
> + * #define CONFIG_SYS_FIXED_PHY_PORTS \
> + * CONFIG_SYS_FIXED_PHY_PORT(0, SPEED_1000, DUPLEX_FULL) \
> + * CONFIG_SYS_FIXED_PHY_PORT(2, SPEED_100, DUPLEX_HALF)
> + */
> +
> +#ifndef CONFIG_FIXED_PHY
> +#define CONFIG_FIXED_PHY 0xFFFFFFFF /* Fixed PHY (PHY-less) */
> +#endif
> +
> +#ifndef CONFIG_SYS_FIXED_PHY_PORTS
> +#define CONFIG_SYS_FIXED_PHY_PORTS /* default is an empty array */
> +#endif
> +
> +struct fixed_phy_port {
> + unsigned int devnum; /* ethernet port */
> + unsigned int speed; /* specified speed 10,100 or 1000 */
> + unsigned int duplex; /* specified duplex FULL or HALF */
> +};
> +
> +static const struct fixed_phy_port fixed_phy_port[] = {
> + CONFIG_SYS_FIXED_PHY_PORTS /* defined in board configuration file */
> +};
> +
> static void config_genmii_advert (struct uec_mii_info *mii_info);
> static void genmii_setup_forced (struct uec_mii_info *mii_info);
> static void genmii_restart_aneg (struct uec_mii_info *mii_info);
> @@ -533,6 +580,28 @@ static void dm9161_close (struct uec_mii_info *mii_info)
> {
> }
>
> +static int fixed_phy_aneg (struct uec_mii_info *mii_info)
> +{
> + mii_info->autoneg = 0; /* Turn off auto negotiation for fixed phy */
> + return 0;
> +}
> +
> +static int fixed_phy_read_status (struct uec_mii_info *mii_info)
> +{
> + int i = 0;
> +
> + for (i = 0; i < ARRAY_SIZE(fixed_phy_port); i++) {
> + if (mii_info->mii_id == fixed_phy_port[i].devnum) {
> + mii_info->speed = fixed_phy_port[i].speed;
> + mii_info->duplex = fixed_phy_port[i].duplex;
> + mii_info->link = 1; /* Link is always UP */
> + mii_info->pause = 0;
> + break;
> + }
> + }
> + return 0;
> +}
> +
> static struct phy_info phy_info_dm9161 = {
> .phy_id = 0x0181b880,
> .phy_id_mask = 0x0ffffff0,
> @@ -577,6 +646,14 @@ static struct phy_info phy_info_bcm5481 = {
> .init = bcm_init,
> };
>
> +static struct phy_info phy_info_fixedphy = {
> + .phy_id = CONFIG_FIXED_PHY,
> + .phy_id_mask = CONFIG_FIXED_PHY,
> + .name = "Fixed PHY",
> + .config_aneg = fixed_phy_aneg,
> + .read_status = fixed_phy_read_status,
> +};
> +
> static struct phy_info phy_info_genmii = {
> .phy_id = 0x00000000,
> .phy_id_mask = 0x00000000,
> @@ -591,6 +668,7 @@ static struct phy_info *phy_info[] = {
> &phy_info_dm9161a,
> &phy_info_marvell,
> &phy_info_bcm5481,
> + &phy_info_fixedphy,
> &phy_info_genmii,
> NULL
> };
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] drivers/qe/uec_phy.c: Added PHY-less (fixed PHY) driver.
2008-10-30 12:32 ` Richard Retanubun
@ 2008-10-31 23:32 ` Ben Warren
0 siblings, 0 replies; 5+ messages in thread
From: Ben Warren @ 2008-10-31 23:32 UTC (permalink / raw)
To: u-boot
Hi Richard,
Richard Retanubun wrote:
> Richard Retanubun wrote:
>
> Hi Ben,
>
> I forgot to cc you on the patch e-mail, when you got a chance, do you
> mind looking at this patch.
>
I'll have a look this weekend. If it applies cleanly I'll pull it in.
As mentioned during the 4xx discussion, keep in mind that this is
temporary and will be gutted when we bring in a PHY library.
regards,
Ben
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] drivers/qe/uec_phy.c: Added PHY-less (fixed PHY) driver.
2008-10-23 13:08 [U-Boot] [PATCH] drivers/qe/uec_phy.c: Added PHY-less (fixed PHY) driver Richard Retanubun
2008-10-23 13:50 ` Richard Retanubun
@ 2008-11-04 7:26 ` Ben Warren
1 sibling, 0 replies; 5+ messages in thread
From: Ben Warren @ 2008-11-04 7:26 UTC (permalink / raw)
To: u-boot
Richard Retanubun wrote:
> Copied over the fixed PHY driver as used in pp4xx/4xx_enet.c.
> This adds support for PHY-less MAC connections to the UEC.
>
> Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com>
> ---
> drivers/qe/uec_phy.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 79 insertions(+), 0 deletions(-)
>
>
<snip>
Applied to net repo.
thanks,
Ben
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-11-04 7:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-23 13:08 [U-Boot] [PATCH] drivers/qe/uec_phy.c: Added PHY-less (fixed PHY) driver Richard Retanubun
2008-10-23 13:50 ` Richard Retanubun
2008-10-30 12:32 ` Richard Retanubun
2008-10-31 23:32 ` Ben Warren
2008-11-04 7:26 ` Ben Warren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox