* [U-Boot] [PATCH 1/2] powerpc/fsl: Introduce common enum for PHY types
@ 2010-09-30 14:18 Kumar Gala
2010-09-30 14:18 ` [U-Boot] [PATCH 2/2] powerpc/8xxx: Add fdt_fixup_phy_connection helper Kumar Gala
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Kumar Gala @ 2010-09-30 14:18 UTC (permalink / raw)
To: u-boot
Have a common enum for phy types that we use in the UCC driver. We will
also use this enum for dealing with phy connection fixup in the device
tree.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
arch/powerpc/include/asm/fsl_enet.h | 31 +++++++++++++++++++++++++++++++
drivers/qe/uec.c | 10 +++++-----
drivers/qe/uec.h | 20 +++-----------------
drivers/qe/uec_phy.c | 8 ++++----
4 files changed, 43 insertions(+), 26 deletions(-)
create mode 100644 arch/powerpc/include/asm/fsl_enet.h
diff --git a/arch/powerpc/include/asm/fsl_enet.h b/arch/powerpc/include/asm/fsl_enet.h
new file mode 100644
index 0000000..8596157
--- /dev/null
+++ b/arch/powerpc/include/asm/fsl_enet.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2010 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+#ifndef __ASM_PPC_FSL_ENET_H
+#define __ASM_PPC_FSL_ENET_H
+
+enum fsl_phy_enet_if {
+ MII,
+ RMII,
+ GMII,
+ RGMII,
+ RGMII_ID,
+ RGMII_RXID,
+ RGMII_TXID,
+ SGMII,
+ TBI,
+ RTBI,
+ XAUI,
+ FSL_ETH_IF_NONE,
+};
+
+#endif /* __ASM_PPC_FSL_ENET_H */
diff --git a/drivers/qe/uec.c b/drivers/qe/uec.c
index e10c0f3..a2ef33b 100644
--- a/drivers/qe/uec.c
+++ b/drivers/qe/uec.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2009 Freescale Semiconductor, Inc.
+ * Copyright (C) 2006-2010 Freescale Semiconductor, Inc.
*
* Dave Liu <daveliu@freescale.com>
*
@@ -324,9 +324,9 @@ static int uec_set_mac_duplex(uec_private_t *uec, int duplex)
}
static int uec_set_mac_if_mode(uec_private_t *uec,
- enet_interface_type_e if_mode, int speed)
+ enum fsl_phy_enet_if if_mode, int speed)
{
- enet_interface_type_e enet_if_mode;
+ enum fsl_phy_enet_if enet_if_mode;
uec_info_t *uec_info;
uec_t *uec_regs;
u32 upsmr;
@@ -521,7 +521,7 @@ static void adjust_link(struct eth_device *dev)
struct uec_mii_info *mii_info = uec->mii_info;
extern void change_phy_interface_mode(struct eth_device *dev,
- enet_interface_type_e mode, int speed);
+ enum fsl_phy_enet_if mode, int speed);
uec_regs = uec->uec_regs;
if (mii_info->link) {
@@ -539,7 +539,7 @@ static void adjust_link(struct eth_device *dev)
}
if (mii_info->speed != uec->oldspeed) {
- enet_interface_type_e mode = \
+ enum fsl_phy_enet_if mode = \
uec->uec_info->enet_interface_type;
if (uec->uec_info->uf_info.eth_type == GIGA_ETH) {
switch (mii_info->speed) {
diff --git a/drivers/qe/uec.h b/drivers/qe/uec.h
index 2a9e2dc..94eb9a2 100644
--- a/drivers/qe/uec.h
+++ b/drivers/qe/uec.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2009 Freescale Semiconductor, Inc.
+ * Copyright (C) 2006-2010 Freescale Semiconductor, Inc.
*
* Dave Liu <daveliu@freescale.com>
* based on source code of Shlomi Gridish
@@ -25,6 +25,7 @@
#include "qe.h"
#include "uccf.h"
+#include <asm/fsl_enet.h>
#define MAX_TX_THREADS 8
#define MAX_RX_THREADS 8
@@ -660,21 +661,6 @@ typedef enum uec_num_of_threads {
UEC_NUM_OF_THREADS_8 = 0x4 /* 8 */
} uec_num_of_threads_e;
-/* UEC ethernet interface type
-*/
-typedef enum enet_interface_type {
- MII,
- RMII,
- RGMII,
- GMII,
- RGMII_ID,
- RGMII_RXID,
- RGMII_TXID,
- TBI,
- RTBI,
- SGMII
-} enet_interface_type_e;
-
/* UEC initialization info struct
*/
#define STD_UEC_INFO(num) \
@@ -705,7 +691,7 @@ typedef struct uec_info {
u16 rx_bd_ring_len;
u16 tx_bd_ring_len;
u8 phy_address;
- enet_interface_type_e enet_interface_type;
+ enum fsl_phy_enet_if enet_interface_type;
int speed;
} uec_info_t;
diff --git a/drivers/qe/uec_phy.c b/drivers/qe/uec_phy.c
index 2d3a896..8b19624 100644
--- a/drivers/qe/uec_phy.c
+++ b/drivers/qe/uec_phy.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 Freescale Semiconductor, Inc.
+ * Copyright (C) 2005,2010 Freescale Semiconductor, Inc.
*
* Author: Shlomi Gridish
*
@@ -477,7 +477,7 @@ static int marvell_init(struct uec_mii_info *mii_info)
{
struct eth_device *edev = mii_info->dev;
uec_private_t *uec = edev->priv;
- enum enet_interface_type iface = uec->uec_info->enet_interface_type;
+ enum fsl_phy_enet_if iface = uec->uec_info->enet_interface_type;
int speed = uec->uec_info->speed;
if ((speed == 1000) &&
@@ -845,7 +845,7 @@ struct phy_info *uec_get_phy_info (struct uec_mii_info *mii_info)
}
void marvell_phy_interface_mode (struct eth_device *dev,
- enet_interface_type_e type,
+ enum fsl_phy_enet_if type,
int speed
)
{
@@ -899,7 +899,7 @@ void marvell_phy_interface_mode (struct eth_device *dev,
}
void change_phy_interface_mode (struct eth_device *dev,
- enet_interface_type_e type, int speed)
+ enum fsl_phy_enet_if type, int speed)
{
#ifdef CONFIG_PHY_MODE_NEED_CHANGE
marvell_phy_interface_mode (dev, type, speed);
--
1.7.2.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [U-Boot] [PATCH 2/2] powerpc/8xxx: Add fdt_fixup_phy_connection helper 2010-09-30 14:18 [U-Boot] [PATCH 1/2] powerpc/fsl: Introduce common enum for PHY types Kumar Gala @ 2010-09-30 14:18 ` Kumar Gala 2010-10-20 5:26 ` Kumar Gala 2010-10-13 13:46 ` [U-Boot] [PATCH 1/2] powerpc/fsl: Introduce common enum for PHY types Kumar Gala 2010-10-20 5:26 ` Kumar Gala 2 siblings, 1 reply; 5+ messages in thread From: Kumar Gala @ 2010-09-30 14:18 UTC (permalink / raw) To: u-boot Add a common helper that will set the PHY connection type based on enum. We use this on eTSEC, UCC, and will with Fman in the future. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> --- arch/powerpc/cpu/mpc8xxx/fdt.c | 24 ++++++++++++++++++++++++ arch/powerpc/include/asm/fsl_enet.h | 2 ++ board/freescale/mpc8360emds/mpc8360emds.c | 15 ++++++--------- board/freescale/mpc837xemds/mpc837xemds.c | 8 ++++---- board/freescale/mpc8569mds/mpc8569mds.c | 4 ++-- 5 files changed, 38 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/cpu/mpc8xxx/fdt.c b/arch/powerpc/cpu/mpc8xxx/fdt.c index 88c47d1..54e60bb 100644 --- a/arch/powerpc/cpu/mpc8xxx/fdt.c +++ b/arch/powerpc/cpu/mpc8xxx/fdt.c @@ -27,6 +27,7 @@ #include <libfdt.h> #include <fdt_support.h> #include <asm/mp.h> +#include <asm/fsl_enet.h> #if defined(CONFIG_MP) && (defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)) static int ft_del_cpuhandle(void *blob, int cpuhandle) @@ -215,3 +216,26 @@ void fdt_fixup_crypto_node(void *blob, int sec_rev) fdt_del_node_and_alias(blob, "crypto"); } #endif + +int fdt_fixup_phy_connection(void *blob, int offset, enum fsl_phy_enet_if phyc) +{ + static const char *fsl_phy_enet_if_str[] = { + [MII] = "mii", + [RMII] = "rmii", + [GMII] = "gmii", + [RGMII] = "rgmii", + [RGMII_ID] = "rgmii-id", + [RGMII_RXID] = "rgmii-rxid", + [SGMII] = "sgmii", + [TBI] = "tbi", + [RTBI] = "rtbi", + [XAUI] = "xgmii", + [FSL_ETH_IF_NONE] = "", + }; + + if (phyc > ARRAY_SIZE(fsl_phy_enet_if_str)) + return fdt_setprop_string(blob, offset, "phy-connection-type", ""); + + return fdt_setprop_string(blob, offset, "phy-connection-type", + fsl_phy_enet_if_str[phyc]); +} diff --git a/arch/powerpc/include/asm/fsl_enet.h b/arch/powerpc/include/asm/fsl_enet.h index 8596157..4fb2857 100644 --- a/arch/powerpc/include/asm/fsl_enet.h +++ b/arch/powerpc/include/asm/fsl_enet.h @@ -28,4 +28,6 @@ enum fsl_phy_enet_if { FSL_ETH_IF_NONE, }; +int fdt_fixup_phy_connection(void *blob, int offset, enum fsl_phy_enet_if phyc); + #endif /* __ASM_PPC_FSL_ENET_H */ diff --git a/board/freescale/mpc8360emds/mpc8360emds.c b/board/freescale/mpc8360emds/mpc8360emds.c index 59ada9c..0babd26 100644 --- a/board/freescale/mpc8360emds/mpc8360emds.c +++ b/board/freescale/mpc8360emds/mpc8360emds.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Freescale Semiconductor, Inc. + * Copyright (C) 2006,2010 Freescale Semiconductor, Inc. * Dave Liu <daveliu@freescale.com> * * See file CREDITS for list of people who contributed to this @@ -22,6 +22,7 @@ #include <spd_sdram.h> #include <asm/mmu.h> #include <asm/io.h> +#include <asm/fsl_enet.h> #if defined(CONFIG_OF_LIBFDT) #include <libfdt.h> #endif @@ -396,10 +397,8 @@ void ft_board_setup(void *blob, bd_t *bd) prop = fdt_getprop(blob, path, "phy-connection-type", 0); if (prop && (strcmp(prop, "rgmii-id") == 0)) - fdt_setprop(blob, path, - "phy-connection-type", - "rgmii-rxid", - sizeof("rgmii-rxid")); + fdt_fixup_phy_connection(blob, path, + RGMII_RXID); } #endif #if defined(CONFIG_HAS_ETH1) @@ -410,10 +409,8 @@ void ft_board_setup(void *blob, bd_t *bd) prop = fdt_getprop(blob, path, "phy-connection-type", 0); if (prop && (strcmp(prop, "rgmii-id") == 0)) - fdt_setprop(blob, path, - "phy-connection-type", - "rgmii-rxid", - sizeof("rgmii-rxid")); + fdt_fixup_phy_connection(blob, path, + RGMII_RXID); } #endif } diff --git a/board/freescale/mpc837xemds/mpc837xemds.c b/board/freescale/mpc837xemds/mpc837xemds.c index 32a87ad..51dd692 100644 --- a/board/freescale/mpc837xemds/mpc837xemds.c +++ b/board/freescale/mpc837xemds/mpc837xemds.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Freescale Semiconductor, Inc. + * Copyright (C) 2007,2010 Freescale Semiconductor, Inc. * Dave Liu <daveliu@freescale.com> * * CREDITS: Kim Phillips contribute to LIBFDT code @@ -15,6 +15,7 @@ #include <i2c.h> #include <asm/io.h> #include <asm/fsl_mpc83xx_serdes.h> +#include <asm/fsl_enet.h> #include <spd_sdram.h> #include <tsec.h> #include <libfdt.h> @@ -136,7 +137,6 @@ int board_eth_init(bd_t *bd) static void __ft_tsec_fixup(void *blob, bd_t *bd, const char *alias, int phy_addr) { - const char *phy_type = "sgmii"; const u32 *ph; int off; int err; @@ -148,8 +148,8 @@ static void __ft_tsec_fixup(void *blob, bd_t *bd, const char *alias, return; } - err = fdt_setprop(blob, off, "phy-connection-type", phy_type, - strlen(phy_type) + 1); + err = fdt_fixup_phy_connection(blob, off, SGMII); + if (err) { printf("WARNING: could not set phy-connection-type for %s: " "%s.\n", alias, fdt_strerror(err)); diff --git a/board/freescale/mpc8569mds/mpc8569mds.c b/board/freescale/mpc8569mds/mpc8569mds.c index 795e565..743e712 100644 --- a/board/freescale/mpc8569mds/mpc8569mds.c +++ b/board/freescale/mpc8569mds/mpc8569mds.c @@ -622,8 +622,8 @@ void ft_board_setup(void *blob, bd_t *bd) break; } - err = fdt_setprop_string(blob, nodeoff, "phy-connection-type", - "rmii"); + err = fdt_fixup_phy_connection(blob, nodeoff, RMII); + if (err < 0) { printf("WARNING: could not set phy-connection-type " "%s.\n", fdt_strerror(err)); -- 1.7.2.3 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 2/2] powerpc/8xxx: Add fdt_fixup_phy_connection helper 2010-09-30 14:18 ` [U-Boot] [PATCH 2/2] powerpc/8xxx: Add fdt_fixup_phy_connection helper Kumar Gala @ 2010-10-20 5:26 ` Kumar Gala 0 siblings, 0 replies; 5+ messages in thread From: Kumar Gala @ 2010-10-20 5:26 UTC (permalink / raw) To: u-boot On Sep 30, 2010, at 9:18 AM, Kumar Gala wrote: > Add a common helper that will set the PHY connection type based on enum. > We use this on eTSEC, UCC, and will with Fman in the future. > > Signed-off-by: Kumar Gala <galak@kernel.crashing.org> > --- > arch/powerpc/cpu/mpc8xxx/fdt.c | 24 ++++++++++++++++++++++++ > arch/powerpc/include/asm/fsl_enet.h | 2 ++ > board/freescale/mpc8360emds/mpc8360emds.c | 15 ++++++--------- > board/freescale/mpc837xemds/mpc837xemds.c | 8 ++++---- > board/freescale/mpc8569mds/mpc8569mds.c | 4 ++-- > 5 files changed, 38 insertions(+), 15 deletions(-) applied to 85xx, hopes that's not an issue Ben. - k ^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 1/2] powerpc/fsl: Introduce common enum for PHY types 2010-09-30 14:18 [U-Boot] [PATCH 1/2] powerpc/fsl: Introduce common enum for PHY types Kumar Gala 2010-09-30 14:18 ` [U-Boot] [PATCH 2/2] powerpc/8xxx: Add fdt_fixup_phy_connection helper Kumar Gala @ 2010-10-13 13:46 ` Kumar Gala 2010-10-20 5:26 ` Kumar Gala 2 siblings, 0 replies; 5+ messages in thread From: Kumar Gala @ 2010-10-13 13:46 UTC (permalink / raw) To: u-boot On Sep 30, 2010, at 9:18 AM, Kumar Gala wrote: > Have a common enum for phy types that we use in the UCC driver. We will > also use this enum for dealing with phy connection fixup in the device > tree. > > Signed-off-by: Kumar Gala <galak@kernel.crashing.org> > --- > arch/powerpc/include/asm/fsl_enet.h | 31 +++++++++++++++++++++++++++++++ > drivers/qe/uec.c | 10 +++++----- > drivers/qe/uec.h | 20 +++----------------- > drivers/qe/uec_phy.c | 8 ++++---- > 4 files changed, 43 insertions(+), 26 deletions(-) > create mode 100644 arch/powerpc/include/asm/fsl_enet.h Ben, Do you plan on picking this up via net or should I handle via 85xx tree? - k ^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 1/2] powerpc/fsl: Introduce common enum for PHY types 2010-09-30 14:18 [U-Boot] [PATCH 1/2] powerpc/fsl: Introduce common enum for PHY types Kumar Gala 2010-09-30 14:18 ` [U-Boot] [PATCH 2/2] powerpc/8xxx: Add fdt_fixup_phy_connection helper Kumar Gala 2010-10-13 13:46 ` [U-Boot] [PATCH 1/2] powerpc/fsl: Introduce common enum for PHY types Kumar Gala @ 2010-10-20 5:26 ` Kumar Gala 2 siblings, 0 replies; 5+ messages in thread From: Kumar Gala @ 2010-10-20 5:26 UTC (permalink / raw) To: u-boot On Sep 30, 2010, at 9:18 AM, Kumar Gala wrote: > Have a common enum for phy types that we use in the UCC driver. We will > also use this enum for dealing with phy connection fixup in the device > tree. > > Signed-off-by: Kumar Gala <galak@kernel.crashing.org> > --- > arch/powerpc/include/asm/fsl_enet.h | 31 +++++++++++++++++++++++++++++++ > drivers/qe/uec.c | 10 +++++----- > drivers/qe/uec.h | 20 +++----------------- > drivers/qe/uec_phy.c | 8 ++++---- > 4 files changed, 43 insertions(+), 26 deletions(-) > create mode 100644 arch/powerpc/include/asm/fsl_enet.h applied to 85xx, hopes that's not an issue Ben. - k ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-10-20 5:26 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-09-30 14:18 [U-Boot] [PATCH 1/2] powerpc/fsl: Introduce common enum for PHY types Kumar Gala 2010-09-30 14:18 ` [U-Boot] [PATCH 2/2] powerpc/8xxx: Add fdt_fixup_phy_connection helper Kumar Gala 2010-10-20 5:26 ` Kumar Gala 2010-10-13 13:46 ` [U-Boot] [PATCH 1/2] powerpc/fsl: Introduce common enum for PHY types Kumar Gala 2010-10-20 5:26 ` Kumar Gala
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.