Changeset 35573
- Timestamp:
- 2013-02-12T21:09:15+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/target/linux/brcm47xx/patches-3.6/700-ssb-gigabit-ethernet-driver.patch
r34988 r35573 105 105 /* Wait up to 20ms for init done. */ 106 106 for (i = 0; i < 200; i++) { 107 @@ -3310,6 +3332,8 @@ static int tg3_nvram_write_block(struct 108 { 109 int ret; 110 111 + if (tg3_flag(tp, IS_SSB_CORE)) 112 + return -ENODEV; 113 if (tg3_flag(tp, EEPROM_WRITE_PROT)) { 114 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl & 115 ~GRC_LCLCTRL_GPIO_OUTPUT1); 116 @@ -3385,6 +3409,11 @@ static int tg3_halt_cpu(struct tg3 *tp, 107 @@ -3385,6 +3407,13 @@ static int tg3_halt_cpu(struct tg3 *tp, 117 108 tw32_f(offset + CPU_MODE, CPU_MODE_HALT); 118 109 udelay(10); 119 110 } else { 120 + /* There is only an Rx CPU for the 5750 derivative in the 121 + * BCM4785. */ 111 + /* 112 + * There is only an Rx CPU for the 5750 derivative in the 113 + * BCM4785. 114 + */ 122 115 + if (tg3_flag(tp, IS_SSB_CORE)) 123 116 + return 0; … … 126 119 tw32(offset + CPU_STATE, 0xffffffff); 127 120 tw32(offset + CPU_MODE, CPU_MODE_HALT); 128 @@ -3399,9 +3428,12 @@ static int tg3_halt_cpu(struct tg3 *tp, 129 return -ENODEV; 130 } 131 132 - /* Clear firmware's nvram arbitration. */ 133 - if (tg3_flag(tp, NVRAM)) 134 - tw32(NVRAM_SWARB, SWARB_REQ_CLR0); 135 + if (!tg3_flag(tp, IS_SSB_CORE)) { 136 + /* Clear firmware's nvram arbitration. */ 137 + if (tg3_flag(tp, NVRAM)) 138 + tw32(NVRAM_SWARB, SWARB_REQ_CLR0); 139 + } 140 + 141 return 0; 142 } 143 144 @@ -3464,6 +3496,11 @@ static int tg3_load_5701_a0_firmware_fix 145 const __be32 *fw_data; 146 int err, i; 147 148 + if (tg3_flag(tp, IS_SSB_CORE)) { 149 + /* We don't use firmware. */ 150 + return 0; 151 + } 152 + 153 fw_data = (void *)tp->fw->data; 154 155 /* Firmware blob starts with version numbers, followed by 156 @@ -3520,6 +3557,11 @@ static int tg3_load_tso_firmware(struct 157 unsigned long cpu_base, cpu_scratch_base, cpu_scratch_size; 158 int err, i; 159 160 + if (tg3_flag(tp, IS_SSB_CORE)) { 161 + /* We don't use firmware. */ 162 + return 0; 163 + } 164 + 165 if (tg3_flag(tp, HW_TSO_1) || 166 tg3_flag(tp, HW_TSO_2) || 167 tg3_flag(tp, HW_TSO_3)) 168 @@ -3860,8 +3902,9 @@ static int tg3_power_down_prepare(struct 121 @@ -3860,8 +3889,9 @@ static int tg3_power_down_prepare(struct 169 122 tg3_frob_aux_power(tp, true); 170 123 … … 178 131 179 132 val &= ~((1 << 16) | (1 << 4) | (1 << 2) | (1 << 1) | 1); 180 @@ -4363,6 +4 406,14@@ relink:133 @@ -4363,6 +4393,15 @@ relink: 181 134 if (current_link_up == 0 || (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)) { 182 135 tg3_phy_copper_begin(tp); … … 184 137 + if (tg3_flag(tp, ROBOSWITCH)) { 185 138 + current_link_up = 1; 186 + current_speed = SPEED_1000; /* FIXME */ 139 + /* FIXME: when BCM5325 switch is used use 100 MBit/s */ 140 + current_speed = SPEED_1000; 187 141 + current_duplex = DUPLEX_FULL; 188 142 + tp->link_config.active_speed = current_speed; … … 193 147 if ((!tg3_readphy(tp, MII_BMSR, &bmsr) && (bmsr & BMSR_LSTATUS)) || 194 148 (tp->mac_mode & MAC_MODE_PORT_INT_LPBACK)) 195 @@ -4381,6 +44 32,26 @@ relink:149 @@ -4381,6 +4420,26 @@ relink: 196 150 else 197 151 tp->mac_mode |= MAC_MODE_PORT_MODE_GMII; … … 220 174 if (tp->link_config.active_duplex == DUPLEX_HALF) 221 175 tp->mac_mode |= MAC_MODE_HALF_DUPLEX; 222 @@ -8108,6 +81 79,14@@ static int tg3_chip_reset(struct tg3 *tp176 @@ -8108,6 +8167,16 @@ static int tg3_chip_reset(struct tg3 *tp 223 177 tw32(0x5000, 0x400); 224 178 } 225 179 226 180 + if (tg3_flag(tp, IS_SSB_CORE)) { 227 + /* BCM4785: In order to avoid repercussions from using 181 + /* 182 + * BCM4785: In order to avoid repercussions from using 228 183 + * potentially defective internal ROM, stop the Rx RISC CPU, 229 + * which is not required. */ 184 + * which is not required. 185 + */ 230 186 + tg3_stop_fw(tp); 231 187 + tg3_halt_cpu(tp, RX_CPU_BASE); … … 235 191 236 192 if (tp->pci_chip_rev_id == CHIPREV_ID_5705_A0) { 237 @@ -9720,6 +97 99,11 @@ static void tg3_timer(unsigned long __op193 @@ -9720,6 +9789,11 @@ static void tg3_timer(unsigned long __op 238 194 tg3_flag(tp, 57765_CLASS)) 239 195 tg3_chk_missed_msi(tp); … … 247 203 /* All of this garbage is because when using non-tagged 248 204 * IRQ status the mailbox/status_block protocol the chip 249 @@ -11415,6 +11499,11 @@ static int tg3_test_nvram(struct tg3 *tp 250 if (tg3_flag(tp, NO_NVRAM)) 251 return 0; 252 253 + if (tg3_flag(tp, IS_SSB_CORE)) { 254 + /* We don't have NVRAM. */ 255 + return 0; 256 + } 257 + 258 if (tg3_nvram_read(tp, 0, &magic) != 0) 259 return -EIO; 260 261 @@ -12383,11 +12472,12 @@ static int tg3_ioctl(struct net_device * 262 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) 263 break; /* We have no PHY */ 264 265 - if (!netif_running(dev)) 266 + if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) 205 @@ -12387,7 +12461,8 @@ static int tg3_ioctl(struct net_device * 267 206 return -EAGAIN; 268 207 … … 274 213 275 214 data->val_out = mii_regval; 276 @@ -12399,11 +12489,12 @@ static int tg3_ioctl(struct net_device * 277 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) 278 break; /* We have no PHY */ 279 280 - if (!netif_running(dev)) 281 + if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) 215 @@ -12403,7 +12478,8 @@ static int tg3_ioctl(struct net_device * 282 216 return -EAGAIN; 283 217 … … 289 223 290 224 return err; 291 @@ -13251,6 +133 42,13@@ static void __devinit tg3_get_5720_nvram225 @@ -13251,6 +13327,14 @@ static void __devinit tg3_get_5720_nvram 292 226 /* Chips other than 5700/5701 use the NVRAM for fetching info. */ 293 227 static void __devinit tg3_nvram_init(struct tg3 *tp) … … 297 231 + tg3_flag_clear(tp, NVRAM); 298 232 + tg3_flag_clear(tp, NVRAM_BUFFERED); 233 + tg3_flag_set(tp, NO_NVRAM); 299 234 + return; 300 235 + } … … 303 238 (EEPROM_ADDR_FSM_RESET | 304 239 (EEPROM_DEFAULT_CLOCK_PERIOD << 305 @@ -13743,10 +138 41,19 @@ static int __devinit tg3_phy_probe(struc240 @@ -13743,10 +13827,19 @@ static int __devinit tg3_phy_probe(struc 306 241 * subsys device table. 307 242 */ … … 325 260 tp->phy_id == TG3_PHY_ID_BCM8002) 326 261 tp->phy_flags |= TG3_PHYFLG_PHY_SERDES; 327 @@ -14756,6 +148 63,11 @@ static int __devinit tg3_get_invariants(262 @@ -14756,6 +14849,11 @@ static int __devinit tg3_get_invariants( 328 263 } 329 264 } … … 337 272 * In particular, the TG3_FLAG_IS_NIC flag must be 338 273 * determined before calling tg3_set_power_state() so that 339 @@ -15165,6 +15277,10 @@ static int __devinit tg3_get_device_addr 274 @@ -15104,12 +15202,19 @@ static int __devinit tg3_get_device_addr 275 struct net_device *dev = tp->dev; 276 u32 hi, lo, mac_offset; 277 int addr_ok = 0; 278 + int err; 279 280 #ifdef CONFIG_SPARC 281 if (!tg3_get_macaddr_sparc(tp)) 282 return 0; 283 #endif 284 285 + if (tg3_flag(tp, IS_SSB_CORE)) { 286 + err = ssb_gige_get_macaddr(tp->pdev, &dev->dev_addr[0]); 287 + if (!err && is_valid_ether_addr(&dev->dev_addr[0])) 288 + return 0; 289 + } 290 + 291 mac_offset = 0x7c; 292 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 || 293 tg3_flag(tp, 5780_CLASS)) { 294 @@ -15469,6 +15574,8 @@ static int __devinit tg3_test_dma(struct 295 tp->dma_rwctrl |= 0x001b000f; 296 } 340 297 } 341 342 if (!is_valid_ether_addr(&dev->dev_addr[0])) { 343 + if (tg3_flag(tp, IS_SSB_CORE)) 344 + ssb_gige_get_macaddr(tp->pdev, &dev->dev_addr[0]); 345 + } 346 + if (!is_valid_ether_addr(&dev->dev_addr[0])) { 347 #ifdef CONFIG_SPARC 348 if (!tg3_get_default_macaddr_sparc(tp)) 349 return 0; 350 @@ -15449,7 +15565,8 @@ static int __devinit tg3_test_dma(struct 351 if (tg3_flag(tp, 40BIT_DMA_BUG) && 352 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) 353 tp->dma_rwctrl |= 0x8000; 354 - else if (ccval == 0x6 || ccval == 0x7) 355 + else if ((ccval == 0x6 || ccval == 0x7) || 356 + tg3_flag(tp, ONE_DMA_AT_ONCE)) 357 tp->dma_rwctrl |= DMA_RWCTRL_ONE_DMA; 358 359 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) 360 @@ -15811,6 +15928,17 @@ static int __devinit tg3_init_one(struct 361 tp->msg_enable = tg3_debug; 298 + if (tg3_flag(tp, ONE_DMA_AT_ONCE)) 299 + tp->dma_rwctrl |= DMA_RWCTRL_ONE_DMA; 300 301 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 || 302 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) 303 @@ -15812,6 +15919,18 @@ static int __devinit tg3_init_one(struct 362 304 else 363 305 tp->msg_enable = TG3_DEF_MSG_ENABLE; 306 364 307 + if (pdev_is_ssb_gige_core(pdev)) { 365 308 + tg3_flag_set(tp, IS_SSB_CORE); … … 373 316 + tg3_flag_set(tp, RGMII_MODE); 374 317 + } 375 318 + 376 319 /* The word/byte swap controls here control register access byte 377 320 * swapping. DMA data byte swapping is controlled in the GRC_MODE 321 * setting below. 378 322 --- a/drivers/net/ethernet/broadcom/tg3.h 379 323 +++ b/drivers/net/ethernet/broadcom/tg3.h … … 402 346 --- a/include/linux/ssb/ssb_driver_gige.h 403 347 +++ b/include/linux/ssb/ssb_driver_gige.h 404 @@ -97,21 +97,1 2@@ static inline bool ssb_gige_must_flush_p348 @@ -97,21 +97,16 @@ static inline bool ssb_gige_must_flush_p 405 349 return 0; 406 350 } … … 408 352 -#ifdef CONFIG_BCM47XX 409 353 -#include <bcm47xx_nvram.h> 410 -/* Get the device MAC address */354 /* Get the device MAC address */ 411 355 -static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) 412 356 -{ … … 417 361 -} 418 362 -#else 419 static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) 363 -static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) 364 +static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) 420 365 { 421 366 + struct ssb_gige *dev = pdev_to_ssb_gige(pdev); 367 + if (!dev) 368 + return -ENODEV; 422 369 + 423 370 + memcpy(macaddr, dev->dev->bus->sprom.et0mac, 6); 371 + return 0; 424 372 } 425 373 -#endif … … 427 375 extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev, 428 376 struct pci_dev *pdev); 429 @@ -175,6 +1 66,9@@ static inline bool ssb_gige_must_flush_p377 @@ -175,6 +170,10 @@ static inline bool ssb_gige_must_flush_p 430 378 { 431 379 return 0; 432 380 } 433 +static inline voidssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)381 +static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) 434 382 +{ 383 + return -ENODEV; 435 384 +} 436 385
Note: See TracChangeset
for help on using the changeset viewer.