mpc83xx: UEC: add support for Broadcom BCM5481 Gigabit PHY
PATCH 1/1 mpc83xx: UEC: add support for Broadcom BCM5481 Gigabit PHY
This patch adds basic support for Broadcom BCM5481 PHY, with the quirk needed for at least MPC8360E-RDK.
Quirk comes from MPC8360E-RDK BSP source, I think author is Peter Barada <[email protected]>, but I'm not sure.
There are no openly available specifications for that PHY.
--- drivers/qe/uec_phy.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/qe/uec_phy.h | 5 +++ 2 files changed, 82 insertions(+), 0 deletions(-)
drivers/qe/uec_phy.c +77 -0
@@ -237,6 +237,44 @@ static int gbit_config_aneg (struct uec_mii_info *mii_info)return 0 ; } +static int gbit_read_status (struct uec_mii_info *mii_info) +{ +u16 status; +int err; + + err =genmii_update_link (mii_info); +if (err) +return err; + +if (mii_info->autoneg) { + mii_info->pause =0 ; + status =phy_read (mii_info,MII_1000BASETSTATUS ); +if (status & (LPA_1000FULL |LPA_1000HALF )) { + mii_info->speed =SPEED_1000 ; +if (status &LPA_1000FULL ) + mii_info->duplex =DUPLEX_FULL ; +else + mii_info->duplex =DUPLEX_HALF ; + }else { + status =phy_read (mii_info,PHY_ANLPAR ); + +if (status & (PHY_ANLPAR_10FD |PHY_ANLPAR_TXFD )) + mii_info->duplex =DUPLEX_FULL ; +else + mii_info->duplex =DUPLEX_HALF ; +if (status & (PHY_ANLPAR_TXFD |PHY_ANLPAR_TX )) + mii_info->speed =SPEED_100 ; +else + mii_info->speed =SPEED_10 ; + } + } +/* +* On non-aneg, we assume what we put in BMCR is the speed, +* though magic-aneg shouldn't prevent this case from occurring. +*/ +return 0 ; +} +static int marvell_config_aneg (struct uec_mii_info *mii_info) {/* The Marvell PHY has an errata which requires
@@ -319,6 +357,35 @@ static int genmii_read_status (struct uec_mii_info *mii_info)return 0 ; } +static int bcm_init (struct uec_mii_info *mii_info) +{ +gbit_config_aneg (mii_info); + +#ifdef CONFIG_MPC8360ERDK + { +u16 val; +int cnt =50 ; + +/* Wait for aneg to complete. */ +do + val =phy_read (mii_info,PHY_BMSR ); +while (--cnt && !(val &PHY_BMSR_AUTN_COMP )); + +/* Set RDX clk delay. */ +phy_write (mii_info,0x18 ,0x7 | (7 <<12 )); + + val =phy_read (mii_info,0x18 ); +/* Set RDX-RXC skew. */ + val |= (1 <<8 ); + val |= (7 | (7 <<12 )); +/* Write bits 14:0. */ + val |= (1 <<15 ); +phy_write (mii_info,0x18 , val); + } +#endif +return 0 ; +} +static int marvell_read_status (struct uec_mii_info *mii_info) {u16 status;
@@ -491,6 +558,15 @@ static struct phy_info phy_info_marvell = { .config_intr = &marvell_config_intr, }; +static struct phy_info phy_info_bcm5481 = { + .phy_id =0x0143bca0 , + .phy_id_mask =0xffffff0 , + .name ="Broadcom 5481" , + .features =MII_GBIT_FEATURES , + .read_status = gbit_read_status, + .init = bcm_init, +}; +static struct phy_info phy_info_genmii = { .phy_id =0x00000000 , .phy_id_mask =0x00000000 ,
@@ -504,6 +580,7 @@ static struct phy_info *phy_info[] = { &phy_info_dm9161, &phy_info_dm9161a, &phy_info_marvell, + &phy_info_bcm5481, &phy_info_genmii, NULL };
drivers/qe/uec_phy.h +5 -0
@@ -29,6 +29,11 @@#define MII_1000BASETCONTROL_FULLDUPLEXCAP 0x0200#define MII_1000BASETCONTROL_HALFDUPLEXCAP 0x0100 +/* 1000BT status */ +#define MII_1000BASETSTATUS 0x0a +#define LPA_1000FULL 0x0400 +#define LPA_1000HALF 0x0200 +/* Cicada Extended Control Register 1 */ #define MII_CIS8201_EXT_CON1 0x17#define MII_CIS8201_EXTCON1_INIT 0x0000
Signature · 1 line
1.5.2.2
PATCH 1/1 mpc83xx: UEC: add support for Broadcom BCM5481 Gigabit PHY
Quoted 2 lines · On Tue, 25 Dec 2007 20:01:26 +0300 Anton Vorontsov <[email protected]>…
This patch adds basic support for Broadcom BCM5481 PHY, with the quirk needed for at least MPC8360E-RDK.
? the MPC8360E-RDK doesn't exist in the mainline tree.
Quoted 2 lines
Quirk comes from MPC8360E-RDK BSP source, I think author is Peter Barada <[email protected]>, but I'm not sure.
solicit his signoff then?
Quoted 3 lines
There are no openly available specifications for that PHY.
Signed-off-by Anton Vorontsov <[email protected]>
Also, shouldn't networking patches go through Ben Warren?
Kim
PATCH 1/1 mpc83xx: UEC: add support for Broadcom BCM5481 Gigabit PHY
Quoted 18 lines · Kim Phillips
Quoted 3 lines · On Tue, 25 Dec 2007 20:01:26 +0300 Anton Vorontsov <[email protected]>…
This patch adds basic support for Broadcom BCM5481 PHY, with the quirk needed for at least MPC8360E-RDK.
? the MPC8360E-RDK doesn't exist in the mainline tree.
Quoted 3 lines
Quirk comes from MPC8360E-RDK BSP source, I think author is Peter Barada <[email protected]>, but I'm not sure.
solicit his signoff then?
Quoted 7 lines
Quoted 4 lines
There are no openly available specifications for that PHY.
Signed-off-by Anton Vorontsov <[email protected]>Also, shouldn't networking patches go through Ben Warren?
Sorry Kim, but I didn't take it because it was in 83xx code. These multi-jurisdictional patches are pretty common, and there doesn't seem to be a well-defined way of handling them. In this case, it's pretty clearly network code, but I'd like to at least have your 'acked-by' in the paper trail. Does this sound like the right way to do it, or am I making things too bureaucratic?
regards,
Ben
PATCH 1/1 mpc83xx: UEC: add support for Broadcom BCM5481 Gigabit PHY
Quoted 3 lines · On Tue, 08 Jan 2008 13:04:50 -0500 Ben Warren <[email protected]> wrote:
Quoted 2 lines · Kim Phillips
On Tue, 25 Dec 2007 20:01:26 +0300
Anton Vorontsov <[email protected]> wrote:
<snip>
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
There are no openly available specifications for that PHY.
Signed-off-by Anton Vorontsov <[email protected]>
Quoted 8 lines
Quoted 2 lines
Also, shouldn't networking patches go through Ben Warren?
Sorry Kim, but I didn't take it because it was in 83xx code. These multi-jurisdictional patches are pretty common, and there doesn't seem to be a well-defined way of handling them. In this case, it's pretty clearly network code, but I'd like to at least have your 'acked-by' in the paper trail. Does this sound like the right way to do it, or am I making things too bureaucratic?
I could easily be accused of that myself ;)
I could be wrong, but I thought gbit_read_status() could have been merged with genmii_read_status(), and the aneg wait code go into genmii_update_link() (J.Tjerlund and I were working on such a patch before the holidays) and the CONFIG_MPC8360ERDK ifdef be eliminated.
Kim
PATCH 1/1 mpc83xx: UEC: add support for Broadcom BCM5481 Gigabit PHY
In reply to Kim PhillipsQuoted 7 lines · Kim Phillips
Quoted 2 lines · On Tue, 25 Dec 2007 20:01:26 +0300 Anton Vorontsov <[email protected]>…
This patch adds basic support for Broadcom BCM5481 PHY, with the quirk needed for at least MPC8360E-RDK.
? the MPC8360E-RDK doesn't exist in the mainline tree.
Patch for the board support was sent at the same time. Though, I'll resend it with few improvements.
Quoted 4 lines
Quoted 2 lines
Quirk comes from MPC8360E-RDK BSP source, I think author is Peter Barada <[email protected]>, but I'm not sure.
solicit his signoff then?
Not an absolute necessity.
Signed-off-by means:
- - - Documentation/SubmittingPatches
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or
(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.
then you just add a line saying
- - -
Here is (b).
To the best of my knowledge, code is covered under an appropriate open source license (that is, GPL) and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (GPL).
Though, I'm adding Peter Barada <[email protected]> to the Cc and copying the patch.
Peter, could you please add your Signed-off-by line on the bcm phy quirk?
- - -
mpc83xx: UEC: add support for Broadcom BCM5481 Gigabit PHY
This patch adds basic support for Broadcom BCM5481 PHY, with the quirk needed for at least MPC8360E-RDK.
Quirk comes from MPC8360E-RDK BSP source, I think author is Peter Barada <[email protected]>, but I'm not sure.
There are no openly available specifications for that PHY.
drivers/qe/uec_phy.c +77 -0
@@ -237,6 +237,44 @@ static int gbit_config_aneg (struct uec_mii_info22 *mii_info)return 0 ; } +static int gbit_read_status (struct uec_mii_info *mii_info) +{ +u16 status; +int err; + + err =genmii_update_link (mii_info); +if (err) +return err; + +if (mii_info->autoneg) { + mii_info->pause =0 ; + status =phy_read (mii_info,MII_1000BASETSTATUS ); +if (status & (LPA_1000FULL |LPA_1000HALF )) { + mii_info->speed =SPEED_1000 ; +if (status &LPA_1000FULL ) + mii_info->duplex =DUPLEX_FULL ; +else + mii_info->duplex =DUPLEX_HALF ; + }else { + status =phy_read (mii_info,PHY_ANLPAR ); + +if (status & (PHY_ANLPAR_10FD |PHY_ANLPAR_TXFD )) + mii_info->duplex =DUPLEX_FULL ; +else + mii_info->duplex =DUPLEX_HALF ; +if (status & (PHY_ANLPAR_TXFD |PHY_ANLPAR_TX )) + mii_info->speed =SPEED_100 ; +else + mii_info->speed =SPEED_10 ; + } + } +/* +* On non-aneg, we assume what we put in BMCR is the speed, +* though magic-aneg shouldn't prevent this case from occurring. +*/ +return 0 ; +} +static int marvell_config_aneg (struct uec_mii_info *mii_info) {/* The Marvell PHY has an errata which requires
@@ -319,6 +357,35 @@ static int genmii_read_status (struct uec_mii_info *mii_info)return 0 ; } +static int bcm_init (struct uec_mii_info *mii_info) +{ +gbit_config_aneg (mii_info); + +#ifdef CONFIG_MPC8360ERDK + { +u16 val; +int cnt =50 ; + +/* Wait for aneg to complete. */ +do + val =phy_read (mii_info,PHY_BMSR ); +while (--cnt && !(val &PHY_BMSR_AUTN_COMP )); + +/* Set RDX clk delay. */ +phy_write (mii_info,0x18 ,0x7 | (7 <<12 )); + + val =phy_read (mii_info,0x18 ); +/* Set RDX-RXC skew. */ + val |= (1 <<8 ); + val |= (7 | (7 <<12 )); +/* Write bits 14:0. */ + val |= (1 <<15 ); +phy_write (mii_info,0x18 , val); + } +#endif +return 0 ; +} +static int marvell_read_status (struct uec_mii_info *mii_info) {u16 status;
@@ -491,6 +558,15 @@ static struct phy_info phy_info_marvell = { .config_intr = &marvell_config_intr, }; +static struct phy_info phy_info_bcm5481 = { + .phy_id =0x0143bca0 , + .phy_id_mask =0xffffff0 , + .name ="Broadcom 5481" , + .features =MII_GBIT_FEATURES , + .read_status = gbit_read_status, + .init = bcm_init, +}; +static struct phy_info phy_info_genmii = { .phy_id =0x00000000 , .phy_id_mask =0x00000000 ,
@@ -504,6 +580,7 @@ static struct phy_info *phy_info[] = { &phy_info_dm9161, &phy_info_dm9161a, &phy_info_marvell, + &phy_info_bcm5481, &phy_info_genmii, NULL };
drivers/qe/uec_phy.h +5 -0
@@ -29,6 +29,11 @@#define MII_1000BASETCONTROL_FULLDUPLEXCAP 0x0200#define MII_1000BASETCONTROL_HALFDUPLEXCAP 0x0100 +/* 1000BT status */ +#define MII_1000BASETSTATUS 0x0a +#define LPA_1000FULL 0x0400 +#define LPA_1000HALF 0x0200 +/* Cicada Extended Control Register 1 */ #define MII_CIS8201_EXT_CON1 0x17#define MII_CIS8201_EXTCON1_INIT 0x0000
- - -
Thanks in advance.
Quoted 5 lines
Quoted 3 lines
There are no openly available specifications for that PHY.
Signed-off-by Anton Vorontsov <[email protected]>Also, shouldn't networking patches go through Ben Warren?
Ok, I'll expand Cc list on respin.
Thanks,
Signature · 4 lines
Anton Vorontsov email: cbou at mail.ru backup email: ya-cbou at yandex.ru irc://irc.freenode.net/bd2
PATCH 1/1 mpc83xx: UEC: add support for Broadcom BCM5481 Gigabit PHY
Quoted 11 lines · On Tue, 8 Jan 2008 21:41:09 +0300 Anton Vorontsov <[email protected]>…
Quoted 7 lines · Kim Phillips
Quoted 2 lines · On Tue, 25 Dec 2007 20:01:26 +0300 Anton Vorontsov <[email protected]>…
This patch adds basic support for Broadcom BCM5481 PHY, with the quirk needed for at least MPC8360E-RDK.
? the MPC8360E-RDK doesn't exist in the mainline tree.
Patch for the board support was sent at the same time. Though, I'll resend it with few improvements.
ok, yes, I'm a bit behind in my emails still :(.
I took a brief look at it; while modding, can you please:
a. reorder your Makefile entry in alpha order (per WD), and add MAINTAINERS and MAKEALL entries.
b. move the non-board specific nand code out of the board directory and merge with drivers/mtd/nand (this should go through Stefan Roese).
c. turn off CONFIG_OF_HAS_BD_T and CONFIG_OF_HAS_UBOOT_ENV (unless you have a really good reason to keep them on).
d. remove references to OF_CPU, OF_SOC, OF_QE, OF_TBCLK, OF_STDOUT_PATH and use the new libfdt glue code.
thanks in advance.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Quirk comes from MPC8360E-RDK BSP source, I think author is Peter Barada <[email protected]>, but I'm not sure.
solicit his signoff then?
Not an absolute necessity.
ok, we'll see if Peter replies anyway. Thanks for paying attention to this matter.
Kim
PATCH 1/1 mpc83xx: UEC: add support for Broadcom BCM5481 Gigabit PHY
Quoted 36 lines · Kim Phillips
Quoted 11 lines · On Tue, 8 Jan 2008 21:41:09 +0300 Anton Vorontsov <[email protected]>…
Quoted 7 lines · Kim Phillips
Quoted 2 lines · On Tue, 25 Dec 2007 20:01:26 +0300 Anton Vorontsov <[email protected]>…
This patch adds basic support for Broadcom BCM5481 PHY, with the quirk needed for at least MPC8360E-RDK.
? the MPC8360E-RDK doesn't exist in the mainline tree.
Patch for the board support was sent at the same time. Though, I'll resend it with few improvements.
ok, yes, I'm a bit behind in my emails still :(.
I took a brief look at it; while modding, can you please:
a. reorder your
Makefileentry in alpha order (per WD), and addMAINTAINERSand MAKEALL entries.b. move the non-board specific nand code out of the board directory and merge with
drivers/mtd/nand(this should go through Stefan Roese).c. turn off
CONFIG_OF_HAS_BD_TandCONFIG_OF_HAS_UBOOT_ENV(unless you have a really good reason to keep them on).d. remove references to
OF_CPU,OF_SOC,OF_QE,OF_TBCLK,OF_STDOUT_PATHand use the new libfdt glue code.thanks in advance.
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quirk comes from MPC8360E-RDK BSP source, I think author is Peter Barada <[email protected]>, but I'm not sure.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
solicit his signoff then?
Not an absolute necessity.
ok, we'll see if Peter replies anyway. Thanks for paying attention to this matter.
I the code to the Freescale BSP u-boot-1.1.3 code that added support for the 8360EPB board. Where is the patch you put together so I can look it over?
Quoted 2 lines
Kim
Signature · 1 line
Peter Barada <[email protected]>