diff options
Diffstat (limited to 'arch/ppc')
-rw-r--r-- | arch/ppc/platforms/4xx/bamboo.c | 52 |
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 | ||
124 | static void __init bamboo_set_emacdata(void) | 124 | static 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 | ||
155 | static int | 191 | static int |