aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/bcm7xxx.c
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2014-03-24 19:36:47 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-26 16:19:23 -0400
commita3622f2c824135a7ce235a61bf9ff5688e8f576b (patch)
tree0b9a755f55e90c62df23a53c974224c4cf196fa1 /drivers/net/phy/bcm7xxx.c
parent61b905da33ae25edb6b9d2a5de21e34c3a77efe3 (diff)
net: phy: bcm7xxx: define constants for our registers
Define constants for the various registers used in bcm7xxx_28nm_afe_config_init() to help clarify what this workaround is about. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/bcm7xxx.c')
-rw-r--r--drivers/net/phy/bcm7xxx.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/drivers/net/phy/bcm7xxx.c b/drivers/net/phy/bcm7xxx.c
index 697337220016..314194179168 100644
--- a/drivers/net/phy/bcm7xxx.c
+++ b/drivers/net/phy/bcm7xxx.c
@@ -28,6 +28,22 @@
28#define MII_BCM7XXX_TEST 0x1f 28#define MII_BCM7XXX_TEST 0x1f
29#define MII_BCM7XXX_SHD_MODE_2 BIT(2) 29#define MII_BCM7XXX_SHD_MODE_2 BIT(2)
30 30
31/* 28nm only register definitions */
32#define MISC_ADDR(base, channel) base, channel
33
34#define DSP_TAP10 MISC_ADDR(0x0a, 0)
35#define PLL_PLLCTRL_1 MISC_ADDR(0x32, 1)
36#define PLL_PLLCTRL_2 MISC_ADDR(0x32, 2)
37#define PLL_PLLCTRL_4 MISC_ADDR(0x33, 0)
38
39#define AFE_RXCONFIG_0 MISC_ADDR(0x38, 0)
40#define AFE_RXCONFIG_1 MISC_ADDR(0x38, 1)
41#define AFE_RX_LP_COUNTER MISC_ADDR(0x38, 3)
42#define AFE_TX_CONFIG MISC_ADDR(0x39, 0)
43#define AFE_HPF_TRIM_OTHERS MISC_ADDR(0x3a, 0)
44
45#define CORE_EXPB0 0xb0
46
31static int bcm7445_config_init(struct phy_device *phydev) 47static int bcm7445_config_init(struct phy_device *phydev)
32{ 48{
33 int ret; 49 int ret;
@@ -88,44 +104,44 @@ static void phy_write_misc(struct phy_device *phydev,
88static int bcm7xxx_28nm_afe_config_init(struct phy_device *phydev) 104static int bcm7xxx_28nm_afe_config_init(struct phy_device *phydev)
89{ 105{
90 /* write AFE_RXCONFIG_0 */ 106 /* write AFE_RXCONFIG_0 */
91 phy_write_misc(phydev, 0x38, 0x0000, 0xeb19); 107 phy_write_misc(phydev, AFE_RXCONFIG_0, 0xeb19);
92 108
93 /* write AFE_RXCONFIG_1 */ 109 /* write AFE_RXCONFIG_1 */
94 phy_write_misc(phydev, 0x38, 0x0001, 0x9a3f); 110 phy_write_misc(phydev, AFE_RXCONFIG_1, 0x9a3f);
95 111
96 /* write AFE_RX_LP_COUNTER */ 112 /* write AFE_RX_LP_COUNTER */
97 phy_write_misc(phydev, 0x38, 0x0003, 0x7fc7); 113 phy_write_misc(phydev, AFE_RX_LP_COUNTER, 0x7fc7);
98 114
99 /* write AFE_HPF_TRIM_OTHERS */ 115 /* write AFE_HPF_TRIM_OTHERS */
100 phy_write_misc(phydev, 0x3A, 0x0000, 0x000b); 116 phy_write_misc(phydev, AFE_HPF_TRIM_OTHERS, 0x000b);
101 117
102 /* write AFTE_TX_CONFIG */ 118 /* write AFTE_TX_CONFIG */
103 phy_write_misc(phydev, 0x39, 0x0000, 0x0800); 119 phy_write_misc(phydev, AFE_TX_CONFIG, 0x0800);
104 120
105 /* Increase VCO range to prevent unlocking problem of PLL at low 121 /* Increase VCO range to prevent unlocking problem of PLL at low
106 * temp 122 * temp
107 */ 123 */
108 phy_write_misc(phydev, 0x0032, 0x0001, 0x0048); 124 phy_write_misc(phydev, PLL_PLLCTRL_1, 0x0048);
109 125
110 /* Change Ki to 011 */ 126 /* Change Ki to 011 */
111 phy_write_misc(phydev, 0x0032, 0x0002, 0x021b); 127 phy_write_misc(phydev, PLL_PLLCTRL_2, 0x021b);
112 128
113 /* Disable loading of TVCO buffer to bandgap, set bandgap trim 129 /* Disable loading of TVCO buffer to bandgap, set bandgap trim
114 * to 111 130 * to 111
115 */ 131 */
116 phy_write_misc(phydev, 0x0033, 0x0000, 0x0e20); 132 phy_write_misc(phydev, PLL_PLLCTRL_4, 0x0e20);
117 133
118 /* Adjust bias current trim by -3 */ 134 /* Adjust bias current trim by -3 */
119 phy_write_misc(phydev, 0x000a, 0x0000, 0x690b); 135 phy_write_misc(phydev, DSP_TAP10, 0x690b);
120 136
121 /* Switch to CORE_BASE1E */ 137 /* Switch to CORE_BASE1E */
122 phy_write(phydev, MII_BCM7XXX_CORE_BASE1E, 0xd); 138 phy_write(phydev, MII_BCM7XXX_CORE_BASE1E, 0xd);
123 139
124 /* Reset R_CAL/RC_CAL Engine */ 140 /* Reset R_CAL/RC_CAL Engine */
125 phy_write_exp(phydev, 0x00b0, 0x0010); 141 phy_write_exp(phydev, CORE_EXPB0, 0x0010);
126 142
127 /* Disable Reset R_CAL/RC_CAL Engine */ 143 /* Disable Reset R_CAL/RC_CAL Engine */
128 phy_write_exp(phydev, 0x00b0, 0x0000); 144 phy_write_exp(phydev, CORE_EXPB0, 0x0000);
129 145
130 return 0; 146 return 0;
131} 147}