aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMatt Porter <mporter@kernel.crashing.org>2005-09-03 18:55:35 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 03:05:56 -0400
commit2698ebcb4338f09206b5accd75bc5cf2ed3dc641 (patch)
tree36d594ab86d57a558edc143de2ece41597c8a13b /arch
parent8e8fff09756bdb799154d034c63033192d6f8f89 (diff)
[PATCH] ppc32: add phy excluded features to ocp_func_emac_data
This patch adds a field to struct ocp_func_emac_data that allows platform-specific unsupported PHY features to be passed in to the ibm_emac ethernet driver. This patch also adds some logic for the Bamboo eval board to populate this field based on the dip switches on the board. This is a workaround for the improperly biased RJ-45 sockets on the Rev. 0 Bamboo. Signed-off-by: Wade Farnsworth <wfarnsworth@mvista.com> Signed-off-by: Matt Porter <mporter@kernel.crashing.org> Cc: Jeff Garzik <jgarzik@pobox.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/ppc/platforms/4xx/bamboo.c52
1 files changed, 44 insertions, 8 deletions
diff --git a/arch/ppc/platforms/4xx/bamboo.c b/arch/ppc/platforms/4xx/bamboo.c
index f116787b0b76..05e2824db71c 100644
--- a/arch/ppc/platforms/4xx/bamboo.c
+++ b/arch/ppc/platforms/4xx/bamboo.c
@@ -123,33 +123,69 @@ bamboo_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
123 123
124static void __init bamboo_set_emacdata(void) 124static void __init bamboo_set_emacdata(void)
125{ 125{
126 unsigned char * selection1_base; 126 u8 * base_addr;
127 struct ocp_def *def; 127 struct ocp_def *def;
128 struct ocp_func_emac_data *emacdata; 128 struct ocp_func_emac_data *emacdata;
129 u8 selection1_val; 129 u8 val;
130 int mode; 130 int mode;
131 u32 excluded = 0;
131 132
132 selection1_base = ioremap64(BAMBOO_FPGA_SELECTION1_REG_ADDR, 16); 133 base_addr = ioremap64(BAMBOO_FPGA_SELECTION1_REG_ADDR, 16);
133 selection1_val = readb(selection1_base); 134 val = readb(base_addr);
134 iounmap((void *) selection1_base); 135 iounmap((void *) base_addr);
135 if (BAMBOO_SEL_MII(selection1_val)) 136 if (BAMBOO_SEL_MII(val))
136 mode = PHY_MODE_MII; 137 mode = PHY_MODE_MII;
137 else if (BAMBOO_SEL_RMII(selection1_val)) 138 else if (BAMBOO_SEL_RMII(val))
138 mode = PHY_MODE_RMII; 139 mode = PHY_MODE_RMII;
139 else 140 else
140 mode = PHY_MODE_SMII; 141 mode = PHY_MODE_SMII;
141 142
142 /* Set mac_addr and phy mode for each EMAC */ 143 /*
144 * SW2 on the Bamboo is used for ethernet configuration and is accessed
145 * via the CONFIG2 register in the FPGA. If the ANEG pin is set,
146 * overwrite the supported features with the settings in SW2.
147 *
148 * This is used as a workaround for the improperly biased RJ-45 sockets
149 * on the Rev. 0 Bamboo. By default only 10baseT is functional.
150 * Removing inductors L17 and L18 from the board allows 100baseT, but
151 * disables 10baseT. The Rev. 1 has no such limitations.
152 */
153
154 base_addr = ioremap64(BAMBOO_FPGA_CONFIG2_REG_ADDR, 8);
155 val = readb(base_addr);
156 iounmap((void *) base_addr);
157 if (!BAMBOO_AUTONEGOTIATE(val)) {
158 excluded |= SUPPORTED_Autoneg;
159 if (BAMBOO_FORCE_100Mbps(val)) {
160 excluded |= SUPPORTED_10baseT_Full;
161 excluded |= SUPPORTED_10baseT_Half;
162 if (BAMBOO_FULL_DUPLEX_EN(val))
163 excluded |= SUPPORTED_100baseT_Half;
164 else
165 excluded |= SUPPORTED_100baseT_Full;
166 } else {
167 excluded |= SUPPORTED_100baseT_Full;
168 excluded |= SUPPORTED_100baseT_Half;
169 if (BAMBOO_FULL_DUPLEX_EN(val))
170 excluded |= SUPPORTED_10baseT_Half;
171 else
172 excluded |= SUPPORTED_10baseT_Full;
173 }
174 }
175
176 /* Set mac_addr, phy mode and unsupported phy features for each EMAC */
143 177
144 def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 0); 178 def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 0);
145 emacdata = def->additions; 179 emacdata = def->additions;
146 memcpy(emacdata->mac_addr, __res.bi_enetaddr, 6); 180 memcpy(emacdata->mac_addr, __res.bi_enetaddr, 6);
147 emacdata->phy_mode = mode; 181 emacdata->phy_mode = mode;
182 emacdata->phy_feat_exc = excluded;
148 183
149 def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 1); 184 def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 1);
150 emacdata = def->additions; 185 emacdata = def->additions;
151 memcpy(emacdata->mac_addr, __res.bi_enet1addr, 6); 186 memcpy(emacdata->mac_addr, __res.bi_enet1addr, 6);
152 emacdata->phy_mode = mode; 187 emacdata->phy_mode = mode;
188 emacdata->phy_feat_exc = excluded;
153} 189}
154 190
155static int 191static int