Re: [U-Boot] [PATCH 1/1] net: phy/realtek: Add support for RTL8211DN and RTL8211E phy modules

Hi York,
I guess with Andy no longer there as FSL u-boot maintainer, will the patch below go through you or Joe. If no one has an objection to this patch, can I get a Acked-by and can we queue it up for upstream.
Regards, Bhupesh
-----Original Message----- From: Sharma Bhupesh-B45370 Sent: Tuesday, July 23, 2013 2:00 PM To: u-boot@lists.denx.de; Fleming Andy-AFLEMING; joe.hershberger@gmail.com Cc: Sharma Bhupesh-B45370 Subject: RE: [PATCH 1/1] net: phy/realtek: Add support for RTL8211DN and RTL8211E phy modules
Hi Andy, Joe,
This patch adds support for Realtek PHY modules RTL8211DN and RTL8211E (variants: RTL8211E-VB-CG, RTL8211E-VL-CG, RTL8211EG-VB-CG), which can be found on Freescale's T1040RDB boards.
To make the driver more generic across 8211 family, a generic name 8211x is added for macros and function names.
Signed-off-by: Bhupesh Sharma bhupesh.sharma@freescale.com
Can you please review this patch and let me know if these changes seem suitable to you.
Thanks for your help. Regards, Bhupesh
drivers/net/phy/realtek.c | 77
+++++++++++++++++++++++++++++++----------
1 file changed, 51 insertions(+), 26 deletions(-)
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index b7e2753..b971456 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -26,18 +26,18 @@
#define PHY_AUTONEGOTIATE_TIMEOUT 5000
-/* RTL8211B PHY Status Register */ -#define MIIM_RTL8211B_PHY_STATUS 0x11 -#define MIIM_RTL8211B_PHYSTAT_SPEED 0xc000 -#define MIIM_RTL8211B_PHYSTAT_GBIT 0x8000 -#define MIIM_RTL8211B_PHYSTAT_100 0x4000 -#define MIIM_RTL8211B_PHYSTAT_DUPLEX 0x2000 -#define MIIM_RTL8211B_PHYSTAT_SPDDONE 0x0800 -#define MIIM_RTL8211B_PHYSTAT_LINK 0x0400
-/* RealTek RTL8211B */ -static int rtl8211b_config(struct phy_device *phydev) +/* RTL8211x PHY Status Register */ +#define MIIM_RTL8211x_PHY_STATUS 0x11 +#define MIIM_RTL8211x_PHYSTAT_SPEED 0xc000 +#define MIIM_RTL8211x_PHYSTAT_GBIT 0x8000 +#define MIIM_RTL8211x_PHYSTAT_100 0x4000 +#define MIIM_RTL8211x_PHYSTAT_DUPLEX 0x2000 +#define MIIM_RTL8211x_PHYSTAT_SPDDONE 0x0800 +#define MIIM_RTL8211x_PHYSTAT_LINK 0x0400
+/* RealTek RTL8211x */ +static int rtl8211x_config(struct phy_device *phydev) { phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
@@ -46,20 +46,20 @@ static int rtl8211b_config(struct phy_device
*phydev)
return 0; }
-static int rtl8211b_parse_status(struct phy_device *phydev) +static int rtl8211x_parse_status(struct phy_device *phydev) { unsigned int speed; unsigned int mii_reg;
- mii_reg = phy_read(phydev, MDIO_DEVAD_NONE,
MIIM_RTL8211B_PHY_STATUS);
- mii_reg = phy_read(phydev, MDIO_DEVAD_NONE,
MIIM_RTL8211x_PHY_STATUS);
- if (!(mii_reg & MIIM_RTL8211B_PHYSTAT_SPDDONE)) {
if (!(mii_reg & MIIM_RTL8211x_PHYSTAT_SPDDONE)) { int i = 0;
/* in case of timeout ->link is cleared */ phydev->link = 1; puts("Waiting for PHY realtime link");
while (!(mii_reg & MIIM_RTL8211B_PHYSTAT_SPDDONE)) {
while (!(mii_reg & MIIM_RTL8211x_PHYSTAT_SPDDONE)) { /* Timeout reached ? */ if (i > PHY_AUTONEGOTIATE_TIMEOUT) { puts(" TIMEOUT !\n");
@@ -71,29 +71,29 @@ static int rtl8211b_parse_status(struct phy_device *phydev) putc('.'); udelay(1000); /* 1 ms */ mii_reg = phy_read(phydev, MDIO_DEVAD_NONE,
MIIM_RTL8211B_PHY_STATUS);
} puts(" done\n"); udelay(500000); /* another 500 ms (results in fasterMIIM_RTL8211x_PHY_STATUS);
booting) */ } else {
if (mii_reg & MIIM_RTL8211B_PHYSTAT_LINK)
else phydev->link = 0; }if (mii_reg & MIIM_RTL8211x_PHYSTAT_LINK) phydev->link = 1;
- if (mii_reg & MIIM_RTL8211B_PHYSTAT_DUPLEX)
- if (mii_reg & MIIM_RTL8211x_PHYSTAT_DUPLEX) phydev->duplex = DUPLEX_FULL; else phydev->duplex = DUPLEX_HALF;
- speed = (mii_reg & MIIM_RTL8211B_PHYSTAT_SPEED);
speed = (mii_reg & MIIM_RTL8211x_PHYSTAT_SPEED);
switch (speed) {
- case MIIM_RTL8211B_PHYSTAT_GBIT:
- case MIIM_RTL8211x_PHYSTAT_GBIT: phydev->speed = SPEED_1000; break;
- case MIIM_RTL8211B_PHYSTAT_100:
- case MIIM_RTL8211x_PHYSTAT_100: phydev->speed = SPEED_100; break; default:
@@ -103,28 +103,53 @@ static int rtl8211b_parse_status(struct phy_device *phydev) return 0; }
-static int rtl8211b_startup(struct phy_device *phydev) +static int rtl8211x_startup(struct phy_device *phydev) { /* Read the Status (2x to make sure link is right) */ genphy_update_link(phydev);
- rtl8211b_parse_status(phydev);
rtl8211x_parse_status(phydev);
return 0;
}
+/* Support for RTL8211B PHY */ static struct phy_driver RTL8211B_driver = { .name = "RealTek RTL8211B", .uid = 0x1cc910, .mask = 0xfffff0, .features = PHY_GBIT_FEATURES,
- .config = &rtl8211b_config,
- .startup = &rtl8211b_startup,
- .config = &rtl8211x_config,
- .startup = &rtl8211x_startup,
- .shutdown = &genphy_shutdown,
+};
+/* Support for RTL8211E-VB-CG, RTL8211E-VL-CG and RTL8211EG-VB-CG +PHYs */ static struct phy_driver RTL8211E_driver = {
- .name = "RealTek RTL8211E",
- .uid = 0x1cc915,
- .mask = 0xfffff0,
- .features = PHY_GBIT_FEATURES,
- .config = &rtl8211x_config,
- .startup = &rtl8211x_startup,
- .shutdown = &genphy_shutdown,
+};
+/* Support for RTL8211DN PHY */ +static struct phy_driver RTL8211DN_driver = {
- .name = "RealTek RTL8211DN",
- .uid = 0x1cc914,
- .mask = 0xfffff0,
- .features = PHY_GBIT_FEATURES,
- .config = &rtl8211x_config,
- .startup = &rtl8211x_startup, .shutdown = &genphy_shutdown,
};
int phy_realtek_init(void) { phy_register(&RTL8211B_driver);
phy_register(&RTL8211E_driver);
phy_register(&RTL8211DN_driver);
return 0;
}
1.7.11.7

On 08/14/2013 01:30 PM, Sharma Bhupesh-B45370 wrote:
Hi York,
I guess with Andy no longer there as FSL u-boot maintainer, will the patch below go through you or Joe. If no one has an objection to this patch, can I get a Acked-by and can we queue it up for upstream.
Acked-by: York Sun yorksun@freescale.com
This patch doesn't involve mpc85xx or mpc86xx. I don't see why it should go into 85xx tree. Do you have other patch depending on it?
York

-----Original Message----- From: sun york-R58495 Sent: Thursday, August 15, 2013 2:29 AM To: Sharma Bhupesh-B45370 Cc: 'u-boot@lists.denx.de'; 'joe.hershberger@gmail.com' Subject: Re: [PATCH 1/1] net: phy/realtek: Add support for RTL8211DN and RTL8211E phy modules
On 08/14/2013 01:30 PM, Sharma Bhupesh-B45370 wrote:
Hi York,
I guess with Andy no longer there as FSL u-boot maintainer, will the patch below go through you or Joe. If no one has an objection to this patch, can I get a Acked-by and can we queue it up for upstream.
Acked-by: York Sun yorksun@freescale.com
This patch doesn't involve mpc85xx or mpc86xx. I don't see why it should go into 85xx tree. Do you have other patch depending on it?
I believe this patch is completely independent of the mpcxxxx series. As Andy was the original author of the RTL phy module(s) driver in u-boot, I was expecting that I needed a Acked-by from him before this patch can be taken up via Andy's/Joe's tree.
As far as I remember, Joe has already mentioned that this patch looks 'good' to him. Joe, if you have no objection to the patch, can you please pick the same in your tree (now that York has already Acked the same).
Thanks, Bhupesh
York

On Wed, Aug 14, 2013 at 4:08 PM, Sharma Bhupesh-B45370 B45370@freescale.com wrote:
-----Original Message----- From: sun york-R58495 Sent: Thursday, August 15, 2013 2:29 AM To: Sharma Bhupesh-B45370 Cc: 'u-boot@lists.denx.de'; 'joe.hershberger@gmail.com' Subject: Re: [PATCH 1/1] net: phy/realtek: Add support for RTL8211DN and RTL8211E phy modules
On 08/14/2013 01:30 PM, Sharma Bhupesh-B45370 wrote:
Hi York,
I guess with Andy no longer there as FSL u-boot maintainer, will the patch below go through you or Joe. If no one has an objection to this patch, can I get a Acked-by and can we queue it up for upstream.
Acked-by: York Sun yorksun@freescale.com
This patch doesn't involve mpc85xx or mpc86xx. I don't see why it should go into 85xx tree. Do you have other patch depending on it?
I believe this patch is completely independent of the mpcxxxx series. As Andy was the original author of the RTL phy module(s) driver in u-boot, I was expecting that I needed a Acked-by from him before this patch can be taken up via Andy's/Joe's tree.
As far as I remember, Joe has already mentioned that this patch looks 'good' to him. Joe, if you have no objection to the patch, can you please pick the same in your tree (now that York has already Acked the same).
OK... I'll pull it into net this week.
-Joe
participants (3)
-
Joe Hershberger
-
Sharma Bhupesh-B45370
-
York Sun