Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[BNX2X]: Correct Link management

Properly protect PHY access between two devices on the same board with
a HW lock.

Use GPIO to clear all previous configurations before changing link
parameters.

Shut down the external PHY in case of fan failure.

Reducing the MDC/MDIO clock to 2.5MHz due to problems with some
devices.

Resolve the flow control response according to autoneg with external
PHY.

Unmasking all PHY interrupts in single write to prevent a race in the
interrupts order.

LASI indication fixes to work with peculiarities of PHYs.

Disable MAC RX to avoid a HW bug when closing the MAC under traffic.

Disable parallel detection on HiGig due to HW limitation.

Updating the shared memory structure to work with the current
bootcode.

Signed-off-by: Eliezer Tamir <eliezert@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eliezer Tamir and committed by
David S. Miller
f1410647 25047950

+1736 -651
+1275 -436
drivers/net/bnx2x.c
··· 1 1 /* bnx2x.c: Broadcom Everest network driver. 2 2 * 3 - * Copyright (c) 2007 Broadcom Corporation 3 + * Copyright (c) 2007-2008 Broadcom Corporation 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify 6 6 * it under the terms of the GNU General Public License as published by ··· 65 65 66 66 #define DRV_MODULE_VERSION "0.40.15" 67 67 #define DRV_MODULE_RELDATE "$DateTime: 2007/11/15 07:28:37 $" 68 - #define BNX2X_BC_VER 0x040009 68 + #define BNX2X_BC_VER 0x040200 69 69 70 70 /* Time in jiffies before concluding the transmitter is hung. */ 71 71 #define TX_TIMEOUT (5*HZ) ··· 78 78 MODULE_DESCRIPTION("Broadcom NetXtreme II BCM57710 Driver"); 79 79 MODULE_LICENSE("GPL"); 80 80 MODULE_VERSION(DRV_MODULE_VERSION); 81 - MODULE_INFO(cvs_version, "$Revision: #356 $"); 81 + MODULE_INFO(cvs_version, "$Revision: #404 $"); 82 82 83 83 static int use_inta; 84 84 static int poll; ··· 1181 1181 return val; 1182 1182 } 1183 1183 1184 + static int bnx2x_hw_lock(struct bnx2x *bp, u32 resource) 1185 + { 1186 + u32 cnt; 1187 + u32 lock_status; 1188 + u32 resource_bit = (1 << resource); 1189 + u8 func = bp->port; 1190 + 1191 + /* Validating that the resource is within range */ 1192 + if (resource > HW_LOCK_MAX_RESOURCE_VALUE) { 1193 + DP(NETIF_MSG_HW, 1194 + "resource(0x%x) > HW_LOCK_MAX_RESOURCE_VALUE(0x%x)\n", 1195 + resource, HW_LOCK_MAX_RESOURCE_VALUE); 1196 + return -EINVAL; 1197 + } 1198 + 1199 + /* Validating that the resource is not already taken */ 1200 + lock_status = REG_RD(bp, MISC_REG_DRIVER_CONTROL_1 + func*8); 1201 + if (lock_status & resource_bit) { 1202 + DP(NETIF_MSG_HW, "lock_status 0x%x resource_bit 0x%x\n", 1203 + lock_status, resource_bit); 1204 + return -EEXIST; 1205 + } 1206 + 1207 + /* Try for 1 second every 5ms */ 1208 + for (cnt = 0; cnt < 200; cnt++) { 1209 + /* Try to acquire the lock */ 1210 + REG_WR(bp, MISC_REG_DRIVER_CONTROL_1 + func*8 + 4, 1211 + resource_bit); 1212 + lock_status = REG_RD(bp, MISC_REG_DRIVER_CONTROL_1 + func*8); 1213 + if (lock_status & resource_bit) 1214 + return 0; 1215 + 1216 + msleep(5); 1217 + } 1218 + DP(NETIF_MSG_HW, "Timeout\n"); 1219 + return -EAGAIN; 1220 + } 1221 + 1222 + static int bnx2x_hw_unlock(struct bnx2x *bp, u32 resource) 1223 + { 1224 + u32 lock_status; 1225 + u32 resource_bit = (1 << resource); 1226 + u8 func = bp->port; 1227 + 1228 + /* Validating that the resource is within range */ 1229 + if (resource > HW_LOCK_MAX_RESOURCE_VALUE) { 1230 + DP(NETIF_MSG_HW, 1231 + "resource(0x%x) > HW_LOCK_MAX_RESOURCE_VALUE(0x%x)\n", 1232 + resource, HW_LOCK_MAX_RESOURCE_VALUE); 1233 + return -EINVAL; 1234 + } 1235 + 1236 + /* Validating that the resource is currently taken */ 1237 + lock_status = REG_RD(bp, MISC_REG_DRIVER_CONTROL_1 + func*8); 1238 + if (!(lock_status & resource_bit)) { 1239 + DP(NETIF_MSG_HW, "lock_status 0x%x resource_bit 0x%x\n", 1240 + lock_status, resource_bit); 1241 + return -EFAULT; 1242 + } 1243 + 1244 + REG_WR(bp, MISC_REG_DRIVER_CONTROL_1 + func*8, resource_bit); 1245 + return 0; 1246 + } 1247 + 1248 + static int bnx2x_set_gpio(struct bnx2x *bp, int gpio_num, u32 mode) 1249 + { 1250 + /* The GPIO should be swapped if swap register is set and active */ 1251 + int gpio_port = (REG_RD(bp, NIG_REG_PORT_SWAP) && 1252 + REG_RD(bp, NIG_REG_STRAP_OVERRIDE)) ^ bp->port; 1253 + int gpio_shift = gpio_num + 1254 + (gpio_port ? MISC_REGISTERS_GPIO_PORT_SHIFT : 0); 1255 + u32 gpio_mask = (1 << gpio_shift); 1256 + u32 gpio_reg; 1257 + 1258 + if (gpio_num > MISC_REGISTERS_GPIO_3) { 1259 + BNX2X_ERR("Invalid GPIO %d\n", gpio_num); 1260 + return -EINVAL; 1261 + } 1262 + 1263 + bnx2x_hw_lock(bp, HW_LOCK_RESOURCE_GPIO); 1264 + /* read GPIO and mask except the float bits */ 1265 + gpio_reg = (REG_RD(bp, MISC_REG_GPIO) & MISC_REGISTERS_GPIO_FLOAT); 1266 + 1267 + switch (mode) { 1268 + case MISC_REGISTERS_GPIO_OUTPUT_LOW: 1269 + DP(NETIF_MSG_LINK, "Set GPIO %d (shift %d) -> output low\n", 1270 + gpio_num, gpio_shift); 1271 + /* clear FLOAT and set CLR */ 1272 + gpio_reg &= ~(gpio_mask << MISC_REGISTERS_GPIO_FLOAT_POS); 1273 + gpio_reg |= (gpio_mask << MISC_REGISTERS_GPIO_CLR_POS); 1274 + break; 1275 + 1276 + case MISC_REGISTERS_GPIO_OUTPUT_HIGH: 1277 + DP(NETIF_MSG_LINK, "Set GPIO %d (shift %d) -> output high\n", 1278 + gpio_num, gpio_shift); 1279 + /* clear FLOAT and set SET */ 1280 + gpio_reg &= ~(gpio_mask << MISC_REGISTERS_GPIO_FLOAT_POS); 1281 + gpio_reg |= (gpio_mask << MISC_REGISTERS_GPIO_SET_POS); 1282 + break; 1283 + 1284 + case MISC_REGISTERS_GPIO_INPUT_HI_Z : 1285 + DP(NETIF_MSG_LINK, "Set GPIO %d (shift %d) -> input\n", 1286 + gpio_num, gpio_shift); 1287 + /* set FLOAT */ 1288 + gpio_reg |= (gpio_mask << MISC_REGISTERS_GPIO_FLOAT_POS); 1289 + break; 1290 + 1291 + default: 1292 + break; 1293 + } 1294 + 1295 + REG_WR(bp, MISC_REG_GPIO, gpio_reg); 1296 + bnx2x_hw_unlock(bp, HW_LOCK_RESOURCE_GPIO); 1297 + 1298 + return 0; 1299 + } 1300 + 1301 + static int bnx2x_set_spio(struct bnx2x *bp, int spio_num, u32 mode) 1302 + { 1303 + u32 spio_mask = (1 << spio_num); 1304 + u32 spio_reg; 1305 + 1306 + if ((spio_num < MISC_REGISTERS_SPIO_4) || 1307 + (spio_num > MISC_REGISTERS_SPIO_7)) { 1308 + BNX2X_ERR("Invalid SPIO %d\n", spio_num); 1309 + return -EINVAL; 1310 + } 1311 + 1312 + bnx2x_hw_lock(bp, HW_LOCK_RESOURCE_SPIO); 1313 + /* read SPIO and mask except the float bits */ 1314 + spio_reg = (REG_RD(bp, MISC_REG_SPIO) & MISC_REGISTERS_SPIO_FLOAT); 1315 + 1316 + switch (mode) { 1317 + case MISC_REGISTERS_SPIO_OUTPUT_LOW : 1318 + DP(NETIF_MSG_LINK, "Set SPIO %d -> output low\n", spio_num); 1319 + /* clear FLOAT and set CLR */ 1320 + spio_reg &= ~(spio_mask << MISC_REGISTERS_SPIO_FLOAT_POS); 1321 + spio_reg |= (spio_mask << MISC_REGISTERS_SPIO_CLR_POS); 1322 + break; 1323 + 1324 + case MISC_REGISTERS_SPIO_OUTPUT_HIGH : 1325 + DP(NETIF_MSG_LINK, "Set SPIO %d -> output high\n", spio_num); 1326 + /* clear FLOAT and set SET */ 1327 + spio_reg &= ~(spio_mask << MISC_REGISTERS_SPIO_FLOAT_POS); 1328 + spio_reg |= (spio_mask << MISC_REGISTERS_SPIO_SET_POS); 1329 + break; 1330 + 1331 + case MISC_REGISTERS_SPIO_INPUT_HI_Z: 1332 + DP(NETIF_MSG_LINK, "Set SPIO %d -> input\n", spio_num); 1333 + /* set FLOAT */ 1334 + spio_reg |= (spio_mask << MISC_REGISTERS_SPIO_FLOAT_POS); 1335 + break; 1336 + 1337 + default: 1338 + break; 1339 + } 1340 + 1341 + REG_WR(bp, MISC_REG_SPIO, spio_reg); 1342 + bnx2x_hw_unlock(bp, HW_LOCK_RESOURCE_SPIO); 1343 + 1344 + return 0; 1345 + } 1346 + 1184 1347 static int bnx2x_mdio22_write(struct bnx2x *bp, u32 reg, u32 val) 1185 1348 { 1186 - int rc; 1187 - u32 tmp, i; 1188 1349 int port = bp->port; 1189 1350 u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; 1351 + u32 tmp; 1352 + int i, rc; 1190 1353 1191 1354 /* DP(NETIF_MSG_HW, "phy_addr 0x%x reg 0x%x val 0x%08x\n", 1192 1355 bp->phy_addr, reg, val); */ ··· 1401 1238 { 1402 1239 int port = bp->port; 1403 1240 u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; 1404 - u32 val, i; 1405 - int rc; 1241 + u32 val; 1242 + int i, rc; 1406 1243 1407 1244 if (bp->phy_flags & PHY_INT_MODE_AUTO_POLLING_FLAG) { 1408 1245 ··· 1451 1288 return rc; 1452 1289 } 1453 1290 1454 - static int bnx2x_mdio45_write(struct bnx2x *bp, u32 reg, u32 addr, u32 val) 1291 + static int bnx2x_mdio45_ctrl_write(struct bnx2x *bp, u32 mdio_ctrl, 1292 + u32 phy_addr, u32 reg, u32 addr, u32 val) 1455 1293 { 1456 - int rc = 0; 1457 - u32 tmp, i; 1458 - int port = bp->port; 1459 - u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; 1294 + u32 tmp; 1295 + int i, rc = 0; 1460 1296 1461 - if (bp->phy_flags & PHY_INT_MODE_AUTO_POLLING_FLAG) { 1462 - 1463 - tmp = REG_RD(bp, emac_base + EMAC_REG_EMAC_MDIO_MODE); 1464 - tmp &= ~EMAC_MDIO_MODE_AUTO_POLL; 1465 - EMAC_WR(EMAC_REG_EMAC_MDIO_MODE, tmp); 1466 - REG_RD(bp, emac_base + EMAC_REG_EMAC_MDIO_MODE); 1467 - udelay(40); 1468 - } 1469 - 1470 - /* set clause 45 mode */ 1471 - tmp = REG_RD(bp, emac_base + EMAC_REG_EMAC_MDIO_MODE); 1472 - tmp |= EMAC_MDIO_MODE_CLAUSE_45; 1473 - EMAC_WR(EMAC_REG_EMAC_MDIO_MODE, tmp); 1297 + /* set clause 45 mode, slow down the MDIO clock to 2.5MHz 1298 + * (a value of 49==0x31) and make sure that the AUTO poll is off 1299 + */ 1300 + tmp = REG_RD(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE); 1301 + tmp &= ~(EMAC_MDIO_MODE_AUTO_POLL | EMAC_MDIO_MODE_CLOCK_CNT); 1302 + tmp |= (EMAC_MDIO_MODE_CLAUSE_45 | 1303 + (49 << EMAC_MDIO_MODE_CLOCK_CNT_BITSHIFT)); 1304 + REG_WR(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE, tmp); 1305 + REG_RD(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE); 1306 + udelay(40); 1474 1307 1475 1308 /* address */ 1476 - tmp = ((bp->phy_addr << 21) | (reg << 16) | addr | 1309 + tmp = ((phy_addr << 21) | (reg << 16) | addr | 1477 1310 EMAC_MDIO_COMM_COMMAND_ADDRESS | 1478 1311 EMAC_MDIO_COMM_START_BUSY); 1479 - EMAC_WR(EMAC_REG_EMAC_MDIO_COMM, tmp); 1312 + REG_WR(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM, tmp); 1480 1313 1481 1314 for (i = 0; i < 50; i++) { 1482 1315 udelay(10); 1483 1316 1484 - tmp = REG_RD(bp, emac_base + EMAC_REG_EMAC_MDIO_COMM); 1317 + tmp = REG_RD(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM); 1485 1318 if (!(tmp & EMAC_MDIO_COMM_START_BUSY)) { 1486 1319 udelay(5); 1487 1320 break; 1488 1321 } 1489 1322 } 1490 - 1491 1323 if (tmp & EMAC_MDIO_COMM_START_BUSY) { 1492 1324 BNX2X_ERR("write phy register failed\n"); 1493 1325 1494 1326 rc = -EBUSY; 1327 + 1495 1328 } else { 1496 1329 /* data */ 1497 - tmp = ((bp->phy_addr << 21) | (reg << 16) | val | 1330 + tmp = ((phy_addr << 21) | (reg << 16) | val | 1498 1331 EMAC_MDIO_COMM_COMMAND_WRITE_45 | 1499 1332 EMAC_MDIO_COMM_START_BUSY); 1500 - EMAC_WR(EMAC_REG_EMAC_MDIO_COMM, tmp); 1333 + REG_WR(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM, tmp); 1501 1334 1502 1335 for (i = 0; i < 50; i++) { 1503 1336 udelay(10); 1504 1337 1505 - tmp = REG_RD(bp, emac_base + EMAC_REG_EMAC_MDIO_COMM); 1338 + tmp = REG_RD(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM); 1506 1339 if (!(tmp & EMAC_MDIO_COMM_START_BUSY)) { 1507 1340 udelay(5); 1508 1341 break; ··· 1512 1353 } 1513 1354 } 1514 1355 1515 - /* unset clause 45 mode */ 1516 - tmp = REG_RD(bp, emac_base + EMAC_REG_EMAC_MDIO_MODE); 1517 - tmp &= ~EMAC_MDIO_MODE_CLAUSE_45; 1518 - EMAC_WR(EMAC_REG_EMAC_MDIO_MODE, tmp); 1519 - 1520 - if (bp->phy_flags & PHY_INT_MODE_AUTO_POLLING_FLAG) { 1521 - 1522 - tmp = REG_RD(bp, emac_base + EMAC_REG_EMAC_MDIO_MODE); 1356 + /* unset clause 45 mode, set the MDIO clock to a faster value 1357 + * (0x13 => 6.25Mhz) and restore the AUTO poll if needed 1358 + */ 1359 + tmp = REG_RD(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE); 1360 + tmp &= ~(EMAC_MDIO_MODE_CLAUSE_45 | EMAC_MDIO_MODE_CLOCK_CNT); 1361 + tmp |= (0x13 << EMAC_MDIO_MODE_CLOCK_CNT_BITSHIFT); 1362 + if (bp->phy_flags & PHY_INT_MODE_AUTO_POLLING_FLAG) 1523 1363 tmp |= EMAC_MDIO_MODE_AUTO_POLL; 1524 - EMAC_WR(EMAC_REG_EMAC_MDIO_MODE, tmp); 1525 - } 1364 + REG_WR(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE, tmp); 1526 1365 1527 1366 return rc; 1528 1367 } 1529 1368 1530 - static int bnx2x_mdio45_read(struct bnx2x *bp, u32 reg, u32 addr, 1531 - u32 *ret_val) 1369 + static int bnx2x_mdio45_write(struct bnx2x *bp, u32 phy_addr, u32 reg, 1370 + u32 addr, u32 val) 1532 1371 { 1533 - int port = bp->port; 1534 - u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; 1535 - u32 val, i; 1536 - int rc = 0; 1372 + u32 emac_base = bp->port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; 1537 1373 1538 - if (bp->phy_flags & PHY_INT_MODE_AUTO_POLLING_FLAG) { 1374 + return bnx2x_mdio45_ctrl_write(bp, emac_base, phy_addr, 1375 + reg, addr, val); 1376 + } 1539 1377 1540 - val = REG_RD(bp, emac_base + EMAC_REG_EMAC_MDIO_MODE); 1541 - val &= ~EMAC_MDIO_MODE_AUTO_POLL; 1542 - EMAC_WR(EMAC_REG_EMAC_MDIO_MODE, val); 1543 - REG_RD(bp, emac_base + EMAC_REG_EMAC_MDIO_MODE); 1544 - udelay(40); 1545 - } 1378 + static int bnx2x_mdio45_ctrl_read(struct bnx2x *bp, u32 mdio_ctrl, 1379 + u32 phy_addr, u32 reg, u32 addr, 1380 + u32 *ret_val) 1381 + { 1382 + u32 val; 1383 + int i, rc = 0; 1546 1384 1547 - /* set clause 45 mode */ 1548 - val = REG_RD(bp, emac_base + EMAC_REG_EMAC_MDIO_MODE); 1549 - val |= EMAC_MDIO_MODE_CLAUSE_45; 1550 - EMAC_WR(EMAC_REG_EMAC_MDIO_MODE, val); 1385 + /* set clause 45 mode, slow down the MDIO clock to 2.5MHz 1386 + * (a value of 49==0x31) and make sure that the AUTO poll is off 1387 + */ 1388 + val = REG_RD(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE); 1389 + val &= ~(EMAC_MDIO_MODE_AUTO_POLL | EMAC_MDIO_MODE_CLOCK_CNT); 1390 + val |= (EMAC_MDIO_MODE_CLAUSE_45 | 1391 + (49 << EMAC_MDIO_MODE_CLOCK_CNT_BITSHIFT)); 1392 + REG_WR(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE, val); 1393 + REG_RD(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE); 1394 + udelay(40); 1551 1395 1552 1396 /* address */ 1553 - val = ((bp->phy_addr << 21) | (reg << 16) | addr | 1397 + val = ((phy_addr << 21) | (reg << 16) | addr | 1554 1398 EMAC_MDIO_COMM_COMMAND_ADDRESS | 1555 1399 EMAC_MDIO_COMM_START_BUSY); 1556 - EMAC_WR(EMAC_REG_EMAC_MDIO_COMM, val); 1400 + REG_WR(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM, val); 1557 1401 1558 1402 for (i = 0; i < 50; i++) { 1559 1403 udelay(10); 1560 1404 1561 - val = REG_RD(bp, emac_base + EMAC_REG_EMAC_MDIO_COMM); 1405 + val = REG_RD(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM); 1562 1406 if (!(val & EMAC_MDIO_COMM_START_BUSY)) { 1563 1407 udelay(5); 1564 1408 break; 1565 1409 } 1566 1410 } 1567 - 1568 1411 if (val & EMAC_MDIO_COMM_START_BUSY) { 1569 1412 BNX2X_ERR("read phy register failed\n"); 1570 1413 1571 1414 *ret_val = 0; 1572 1415 rc = -EBUSY; 1416 + 1573 1417 } else { 1574 1418 /* data */ 1575 - val = ((bp->phy_addr << 21) | (reg << 16) | 1419 + val = ((phy_addr << 21) | (reg << 16) | 1576 1420 EMAC_MDIO_COMM_COMMAND_READ_45 | 1577 1421 EMAC_MDIO_COMM_START_BUSY); 1578 - EMAC_WR(EMAC_REG_EMAC_MDIO_COMM, val); 1422 + REG_WR(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM, val); 1579 1423 1580 1424 for (i = 0; i < 50; i++) { 1581 1425 udelay(10); 1582 1426 1583 - val = REG_RD(bp, emac_base + EMAC_REG_EMAC_MDIO_COMM); 1427 + val = REG_RD(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM); 1584 1428 if (!(val & EMAC_MDIO_COMM_START_BUSY)) { 1585 1429 val &= EMAC_MDIO_COMM_DATA; 1586 1430 break; ··· 1600 1438 *ret_val = val; 1601 1439 } 1602 1440 1603 - /* unset clause 45 mode */ 1604 - val = REG_RD(bp, emac_base + EMAC_REG_EMAC_MDIO_MODE); 1605 - val &= ~EMAC_MDIO_MODE_CLAUSE_45; 1606 - EMAC_WR(EMAC_REG_EMAC_MDIO_MODE, val); 1607 - 1608 - if (bp->phy_flags & PHY_INT_MODE_AUTO_POLLING_FLAG) { 1609 - 1610 - val = REG_RD(bp, emac_base + EMAC_REG_EMAC_MDIO_MODE); 1441 + /* unset clause 45 mode, set the MDIO clock to a faster value 1442 + * (0x13 => 6.25Mhz) and restore the AUTO poll if needed 1443 + */ 1444 + val = REG_RD(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE); 1445 + val &= ~(EMAC_MDIO_MODE_CLAUSE_45 | EMAC_MDIO_MODE_CLOCK_CNT); 1446 + val |= (0x13 << EMAC_MDIO_MODE_CLOCK_CNT_BITSHIFT); 1447 + if (bp->phy_flags & PHY_INT_MODE_AUTO_POLLING_FLAG) 1611 1448 val |= EMAC_MDIO_MODE_AUTO_POLL; 1612 - EMAC_WR(EMAC_REG_EMAC_MDIO_MODE, val); 1613 - } 1449 + REG_WR(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE, val); 1614 1450 1615 1451 return rc; 1616 1452 } 1617 1453 1618 - static int bnx2x_mdio45_vwrite(struct bnx2x *bp, u32 reg, u32 addr, u32 val) 1454 + static int bnx2x_mdio45_read(struct bnx2x *bp, u32 phy_addr, u32 reg, 1455 + u32 addr, u32 *ret_val) 1456 + { 1457 + u32 emac_base = bp->port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; 1458 + 1459 + return bnx2x_mdio45_ctrl_read(bp, emac_base, phy_addr, 1460 + reg, addr, ret_val); 1461 + } 1462 + 1463 + static int bnx2x_mdio45_vwrite(struct bnx2x *bp, u32 phy_addr, u32 reg, 1464 + u32 addr, u32 val) 1619 1465 { 1620 1466 int i; 1621 1467 u32 rd_val; 1622 1468 1623 1469 might_sleep(); 1624 1470 for (i = 0; i < 10; i++) { 1625 - bnx2x_mdio45_write(bp, reg, addr, val); 1471 + bnx2x_mdio45_write(bp, phy_addr, reg, addr, val); 1626 1472 msleep(5); 1627 - bnx2x_mdio45_read(bp, reg, addr, &rd_val); 1473 + bnx2x_mdio45_read(bp, phy_addr, reg, addr, &rd_val); 1628 1474 /* if the read value is not the same as the value we wrote, 1629 1475 we should write it again */ 1630 1476 if (rd_val == val) ··· 1646 1476 * link management 1647 1477 */ 1648 1478 1479 + static void bnx2x_pause_resolve(struct bnx2x *bp, u32 pause_result) 1480 + { 1481 + switch (pause_result) { /* ASYM P ASYM P */ 1482 + case 0xb: /* 1 0 1 1 */ 1483 + bp->flow_ctrl = FLOW_CTRL_TX; 1484 + break; 1485 + 1486 + case 0xe: /* 1 1 1 0 */ 1487 + bp->flow_ctrl = FLOW_CTRL_RX; 1488 + break; 1489 + 1490 + case 0x5: /* 0 1 0 1 */ 1491 + case 0x7: /* 0 1 1 1 */ 1492 + case 0xd: /* 1 1 0 1 */ 1493 + case 0xf: /* 1 1 1 1 */ 1494 + bp->flow_ctrl = FLOW_CTRL_BOTH; 1495 + break; 1496 + 1497 + default: 1498 + break; 1499 + } 1500 + } 1501 + 1502 + static u8 bnx2x_ext_phy_resove_fc(struct bnx2x *bp) 1503 + { 1504 + u32 ext_phy_addr; 1505 + u32 ld_pause; /* local */ 1506 + u32 lp_pause; /* link partner */ 1507 + u32 an_complete; /* AN complete */ 1508 + u32 pause_result; 1509 + u8 ret = 0; 1510 + 1511 + ext_phy_addr = ((bp->ext_phy_config & 1512 + PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >> 1513 + PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT); 1514 + 1515 + /* read twice */ 1516 + bnx2x_mdio45_read(bp, ext_phy_addr, 1517 + EXT_PHY_KR_AUTO_NEG_DEVAD, 1518 + EXT_PHY_KR_STATUS, &an_complete); 1519 + bnx2x_mdio45_read(bp, ext_phy_addr, 1520 + EXT_PHY_KR_AUTO_NEG_DEVAD, 1521 + EXT_PHY_KR_STATUS, &an_complete); 1522 + 1523 + if (an_complete & EXT_PHY_KR_AUTO_NEG_COMPLETE) { 1524 + ret = 1; 1525 + bnx2x_mdio45_read(bp, ext_phy_addr, 1526 + EXT_PHY_KR_AUTO_NEG_DEVAD, 1527 + EXT_PHY_KR_AUTO_NEG_ADVERT, &ld_pause); 1528 + bnx2x_mdio45_read(bp, ext_phy_addr, 1529 + EXT_PHY_KR_AUTO_NEG_DEVAD, 1530 + EXT_PHY_KR_LP_AUTO_NEG, &lp_pause); 1531 + pause_result = (ld_pause & 1532 + EXT_PHY_KR_AUTO_NEG_ADVERT_PAUSE_MASK) >> 8; 1533 + pause_result |= (lp_pause & 1534 + EXT_PHY_KR_AUTO_NEG_ADVERT_PAUSE_MASK) >> 10; 1535 + DP(NETIF_MSG_LINK, "Ext PHY pause result 0x%x \n", 1536 + pause_result); 1537 + bnx2x_pause_resolve(bp, pause_result); 1538 + } 1539 + return ret; 1540 + } 1541 + 1649 1542 static void bnx2x_flow_ctrl_resolve(struct bnx2x *bp, u32 gp_status) 1650 1543 { 1651 - u32 ld_pause; /* local driver */ 1652 - u32 lp_pause; /* link partner */ 1544 + u32 ld_pause; /* local driver */ 1545 + u32 lp_pause; /* link partner */ 1653 1546 u32 pause_result; 1654 1547 1655 1548 bp->flow_ctrl = 0; ··· 1734 1501 pause_result |= (lp_pause & 1735 1502 MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_MASK)>>7; 1736 1503 DP(NETIF_MSG_LINK, "pause_result 0x%x\n", pause_result); 1504 + bnx2x_pause_resolve(bp, pause_result); 1505 + } else if (!(bp->req_autoneg & AUTONEG_FLOW_CTRL) || 1506 + !(bnx2x_ext_phy_resove_fc(bp))) { 1507 + /* forced speed */ 1508 + if (bp->req_autoneg & AUTONEG_FLOW_CTRL) { 1509 + switch (bp->req_flow_ctrl) { 1510 + case FLOW_CTRL_AUTO: 1511 + if (bp->dev->mtu <= 4500) 1512 + bp->flow_ctrl = FLOW_CTRL_BOTH; 1513 + else 1514 + bp->flow_ctrl = FLOW_CTRL_TX; 1515 + break; 1737 1516 1738 - switch (pause_result) { /* ASYM P ASYM P */ 1739 - case 0xb: /* 1 0 1 1 */ 1740 - bp->flow_ctrl = FLOW_CTRL_TX; 1741 - break; 1742 - 1743 - case 0xe: /* 1 1 1 0 */ 1744 - bp->flow_ctrl = FLOW_CTRL_RX; 1745 - break; 1746 - 1747 - case 0x5: /* 0 1 0 1 */ 1748 - case 0x7: /* 0 1 1 1 */ 1749 - case 0xd: /* 1 1 0 1 */ 1750 - case 0xf: /* 1 1 1 1 */ 1751 - bp->flow_ctrl = FLOW_CTRL_BOTH; 1752 - break; 1753 - 1754 - default: 1755 - break; 1756 - } 1757 - 1758 - } else { /* forced mode */ 1759 - switch (bp->req_flow_ctrl) { 1760 - case FLOW_CTRL_AUTO: 1761 - if (bp->dev->mtu <= 4500) 1762 - bp->flow_ctrl = FLOW_CTRL_BOTH; 1763 - else 1517 + case FLOW_CTRL_TX: 1764 1518 bp->flow_ctrl = FLOW_CTRL_TX; 1765 - break; 1519 + break; 1766 1520 1767 - case FLOW_CTRL_TX: 1768 - case FLOW_CTRL_RX: 1769 - case FLOW_CTRL_BOTH: 1770 - bp->flow_ctrl = bp->req_flow_ctrl; 1771 - break; 1521 + case FLOW_CTRL_RX: 1522 + if (bp->dev->mtu <= 4500) 1523 + bp->flow_ctrl = FLOW_CTRL_RX; 1524 + break; 1772 1525 1773 - case FLOW_CTRL_NONE: 1774 - default: 1775 - break; 1526 + case FLOW_CTRL_BOTH: 1527 + if (bp->dev->mtu <= 4500) 1528 + bp->flow_ctrl = FLOW_CTRL_BOTH; 1529 + else 1530 + bp->flow_ctrl = FLOW_CTRL_TX; 1531 + break; 1532 + 1533 + case FLOW_CTRL_NONE: 1534 + default: 1535 + break; 1536 + } 1537 + } else { /* forced mode */ 1538 + switch (bp->req_flow_ctrl) { 1539 + case FLOW_CTRL_AUTO: 1540 + DP(NETIF_MSG_LINK, "req_flow_ctrl 0x%x while" 1541 + " req_autoneg 0x%x\n", 1542 + bp->req_flow_ctrl, bp->req_autoneg); 1543 + break; 1544 + 1545 + case FLOW_CTRL_TX: 1546 + case FLOW_CTRL_RX: 1547 + case FLOW_CTRL_BOTH: 1548 + bp->flow_ctrl = bp->req_flow_ctrl; 1549 + break; 1550 + 1551 + case FLOW_CTRL_NONE: 1552 + default: 1553 + break; 1554 + } 1776 1555 } 1777 1556 } 1778 1557 DP(NETIF_MSG_LINK, "flow_ctrl 0x%x\n", bp->flow_ctrl); ··· 1795 1550 bp->link_status = 0; 1796 1551 1797 1552 if (gp_status & MDIO_GP_STATUS_TOP_AN_STATUS1_LINK_STATUS) { 1798 - DP(NETIF_MSG_LINK, "link up\n"); 1553 + DP(NETIF_MSG_LINK, "phy link up\n"); 1799 1554 1800 - bp->link_up = 1; 1555 + bp->phy_link_up = 1; 1801 1556 bp->link_status |= LINK_STATUS_LINK_UP; 1802 1557 1803 1558 if (gp_status & MDIO_GP_STATUS_TOP_AN_STATUS1_DUPLEX_STATUS) ··· 1906 1661 bp->link_status |= LINK_STATUS_RX_FLOW_CONTROL_ENABLED; 1907 1662 1908 1663 } else { /* link_down */ 1909 - DP(NETIF_MSG_LINK, "link down\n"); 1664 + DP(NETIF_MSG_LINK, "phy link down\n"); 1910 1665 1911 - bp->link_up = 0; 1666 + bp->phy_link_up = 0; 1912 1667 1913 1668 bp->line_speed = 0; 1914 1669 bp->duplex = DUPLEX_FULL; 1915 1670 bp->flow_ctrl = 0; 1916 1671 } 1917 1672 1918 - DP(NETIF_MSG_LINK, "gp_status 0x%x link_up %d\n" 1673 + DP(NETIF_MSG_LINK, "gp_status 0x%x phy_link_up %d\n" 1919 1674 DP_LEVEL " line_speed %d duplex %d flow_ctrl 0x%x" 1920 1675 " link_status 0x%x\n", 1921 - gp_status, bp->link_up, bp->line_speed, bp->duplex, bp->flow_ctrl, 1922 - bp->link_status); 1676 + gp_status, bp->phy_link_up, bp->line_speed, bp->duplex, 1677 + bp->flow_ctrl, bp->link_status); 1923 1678 } 1924 1679 1925 1680 static void bnx2x_link_int_ack(struct bnx2x *bp, int is_10g) ··· 1929 1684 /* first reset all status 1930 1685 * we assume only one line will be change at a time */ 1931 1686 bnx2x_bits_dis(bp, NIG_REG_STATUS_INTERRUPT_PORT0 + port*4, 1932 - (NIG_XGXS0_LINK_STATUS | 1933 - NIG_SERDES0_LINK_STATUS | 1934 - NIG_STATUS_INTERRUPT_XGXS0_LINK10G)); 1935 - if (bp->link_up) { 1687 + (NIG_STATUS_XGXS0_LINK10G | 1688 + NIG_STATUS_XGXS0_LINK_STATUS | 1689 + NIG_STATUS_SERDES0_LINK_STATUS)); 1690 + if (bp->phy_link_up) { 1936 1691 if (is_10g) { 1937 1692 /* Disable the 10G link interrupt 1938 1693 * by writing 1 to the status register 1939 1694 */ 1940 - DP(NETIF_MSG_LINK, "10G XGXS link up\n"); 1695 + DP(NETIF_MSG_LINK, "10G XGXS phy link up\n"); 1941 1696 bnx2x_bits_en(bp, 1942 1697 NIG_REG_STATUS_INTERRUPT_PORT0 + port*4, 1943 - NIG_STATUS_INTERRUPT_XGXS0_LINK10G); 1698 + NIG_STATUS_XGXS0_LINK10G); 1944 1699 1945 1700 } else if (bp->phy_flags & PHY_XGXS_FLAG) { 1946 1701 /* Disable the link interrupt 1947 1702 * by writing 1 to the relevant lane 1948 1703 * in the status register 1949 1704 */ 1950 - DP(NETIF_MSG_LINK, "1G XGXS link up\n"); 1705 + DP(NETIF_MSG_LINK, "1G XGXS phy link up\n"); 1951 1706 bnx2x_bits_en(bp, 1952 1707 NIG_REG_STATUS_INTERRUPT_PORT0 + port*4, 1953 1708 ((1 << bp->ser_lane) << 1954 - NIG_XGXS0_LINK_STATUS_SIZE)); 1709 + NIG_STATUS_XGXS0_LINK_STATUS_SIZE)); 1955 1710 1956 1711 } else { /* SerDes */ 1957 - DP(NETIF_MSG_LINK, "SerDes link up\n"); 1712 + DP(NETIF_MSG_LINK, "SerDes phy link up\n"); 1958 1713 /* Disable the link interrupt 1959 1714 * by writing 1 to the status register 1960 1715 */ 1961 1716 bnx2x_bits_en(bp, 1962 1717 NIG_REG_STATUS_INTERRUPT_PORT0 + port*4, 1963 - NIG_SERDES0_LINK_STATUS); 1718 + NIG_STATUS_SERDES0_LINK_STATUS); 1964 1719 } 1965 1720 1966 1721 } else { /* link_down */ ··· 1971 1726 { 1972 1727 u32 ext_phy_type; 1973 1728 u32 ext_phy_addr; 1974 - u32 local_phy; 1975 - u32 val = 0; 1729 + u32 val1 = 0, val2; 1976 1730 u32 rx_sd, pcs_status; 1977 1731 1978 1732 if (bp->phy_flags & PHY_XGXS_FLAG) { 1979 - local_phy = bp->phy_addr; 1980 1733 ext_phy_addr = ((bp->ext_phy_config & 1981 1734 PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >> 1982 1735 PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT); 1983 - bp->phy_addr = (u8)ext_phy_addr; 1984 1736 1985 1737 ext_phy_type = XGXS_EXT_PHY_TYPE(bp); 1986 1738 switch (ext_phy_type) { 1987 1739 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT: 1988 1740 DP(NETIF_MSG_LINK, "XGXS Direct\n"); 1989 - val = 1; 1741 + val1 = 1; 1990 1742 break; 1991 1743 1992 1744 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705: 1993 1745 DP(NETIF_MSG_LINK, "XGXS 8705\n"); 1994 - bnx2x_mdio45_read(bp, EXT_PHY_OPT_WIS_DEVAD, 1995 - EXT_PHY_OPT_LASI_STATUS, &val); 1996 - DP(NETIF_MSG_LINK, "8705 LASI status is %d\n", val); 1746 + bnx2x_mdio45_read(bp, ext_phy_addr, 1747 + EXT_PHY_OPT_WIS_DEVAD, 1748 + EXT_PHY_OPT_LASI_STATUS, &val1); 1749 + DP(NETIF_MSG_LINK, "8705 LASI status 0x%x\n", val1); 1997 1750 1998 - bnx2x_mdio45_read(bp, EXT_PHY_OPT_WIS_DEVAD, 1999 - EXT_PHY_OPT_LASI_STATUS, &val); 2000 - DP(NETIF_MSG_LINK, "8705 LASI status is %d\n", val); 1751 + bnx2x_mdio45_read(bp, ext_phy_addr, 1752 + EXT_PHY_OPT_WIS_DEVAD, 1753 + EXT_PHY_OPT_LASI_STATUS, &val1); 1754 + DP(NETIF_MSG_LINK, "8705 LASI status 0x%x\n", val1); 2001 1755 2002 - bnx2x_mdio45_read(bp, EXT_PHY_OPT_PMA_PMD_DEVAD, 1756 + bnx2x_mdio45_read(bp, ext_phy_addr, 1757 + EXT_PHY_OPT_PMA_PMD_DEVAD, 2003 1758 EXT_PHY_OPT_PMD_RX_SD, &rx_sd); 2004 - val = (rx_sd & 0x1); 1759 + DP(NETIF_MSG_LINK, "8705 rx_sd 0x%x\n", rx_sd); 1760 + val1 = (rx_sd & 0x1); 2005 1761 break; 2006 1762 2007 1763 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706: 2008 1764 DP(NETIF_MSG_LINK, "XGXS 8706\n"); 2009 - bnx2x_mdio45_read(bp, EXT_PHY_OPT_PMA_PMD_DEVAD, 2010 - EXT_PHY_OPT_LASI_STATUS, &val); 2011 - DP(NETIF_MSG_LINK, "8706 LASI status is %d\n", val); 1765 + bnx2x_mdio45_read(bp, ext_phy_addr, 1766 + EXT_PHY_OPT_PMA_PMD_DEVAD, 1767 + EXT_PHY_OPT_LASI_STATUS, &val1); 1768 + DP(NETIF_MSG_LINK, "8706 LASI status 0x%x\n", val1); 2012 1769 2013 - bnx2x_mdio45_read(bp, EXT_PHY_OPT_PMA_PMD_DEVAD, 2014 - EXT_PHY_OPT_LASI_STATUS, &val); 2015 - DP(NETIF_MSG_LINK, "8706 LASI status is %d\n", val); 1770 + bnx2x_mdio45_read(bp, ext_phy_addr, 1771 + EXT_PHY_OPT_PMA_PMD_DEVAD, 1772 + EXT_PHY_OPT_LASI_STATUS, &val1); 1773 + DP(NETIF_MSG_LINK, "8706 LASI status 0x%x\n", val1); 2016 1774 2017 - bnx2x_mdio45_read(bp, EXT_PHY_OPT_PMA_PMD_DEVAD, 1775 + bnx2x_mdio45_read(bp, ext_phy_addr, 1776 + EXT_PHY_OPT_PMA_PMD_DEVAD, 2018 1777 EXT_PHY_OPT_PMD_RX_SD, &rx_sd); 2019 - bnx2x_mdio45_read(bp, EXT_PHY_OPT_PCS_DEVAD, 2020 - EXT_PHY_OPT_PCS_STATUS, &pcs_status); 1778 + bnx2x_mdio45_read(bp, ext_phy_addr, 1779 + EXT_PHY_OPT_PCS_DEVAD, 1780 + EXT_PHY_OPT_PCS_STATUS, &pcs_status); 1781 + bnx2x_mdio45_read(bp, ext_phy_addr, 1782 + EXT_PHY_AUTO_NEG_DEVAD, 1783 + EXT_PHY_OPT_AN_LINK_STATUS, &val2); 1784 + 2021 1785 DP(NETIF_MSG_LINK, "8706 rx_sd 0x%x" 2022 - " pcs_status 0x%x\n", rx_sd, pcs_status); 2023 - /* link is up if both bit 0 of pmd_rx and 2024 - * bit 0 of pcs_status are set 1786 + " pcs_status 0x%x 1Gbps link_status 0x%x 0x%x\n", 1787 + rx_sd, pcs_status, val2, (val2 & (1<<1))); 1788 + /* link is up if both bit 0 of pmd_rx_sd and 1789 + * bit 0 of pcs_status are set, or if the autoneg bit 1790 + 1 is set 2025 1791 */ 2026 - val = (rx_sd & pcs_status); 1792 + val1 = ((rx_sd & pcs_status & 0x1) || (val2 & (1<<1))); 1793 + break; 1794 + 1795 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072: 1796 + bnx2x_hw_lock(bp, HW_LOCK_RESOURCE_8072_MDIO); 1797 + 1798 + /* clear the interrupt LASI status register */ 1799 + bnx2x_mdio45_ctrl_read(bp, GRCBASE_EMAC0, 1800 + ext_phy_addr, 1801 + EXT_PHY_KR_PCS_DEVAD, 1802 + EXT_PHY_KR_LASI_STATUS, &val2); 1803 + bnx2x_mdio45_ctrl_read(bp, GRCBASE_EMAC0, 1804 + ext_phy_addr, 1805 + EXT_PHY_KR_PCS_DEVAD, 1806 + EXT_PHY_KR_LASI_STATUS, &val1); 1807 + DP(NETIF_MSG_LINK, "KR LASI status 0x%x->0x%x\n", 1808 + val2, val1); 1809 + /* Check the LASI */ 1810 + bnx2x_mdio45_ctrl_read(bp, GRCBASE_EMAC0, 1811 + ext_phy_addr, 1812 + EXT_PHY_KR_PMA_PMD_DEVAD, 1813 + 0x9003, &val2); 1814 + bnx2x_mdio45_ctrl_read(bp, GRCBASE_EMAC0, 1815 + ext_phy_addr, 1816 + EXT_PHY_KR_PMA_PMD_DEVAD, 1817 + 0x9003, &val1); 1818 + DP(NETIF_MSG_LINK, "KR 0x9003 0x%x->0x%x\n", 1819 + val2, val1); 1820 + /* Check the link status */ 1821 + bnx2x_mdio45_ctrl_read(bp, GRCBASE_EMAC0, 1822 + ext_phy_addr, 1823 + EXT_PHY_KR_PCS_DEVAD, 1824 + EXT_PHY_KR_PCS_STATUS, &val2); 1825 + DP(NETIF_MSG_LINK, "KR PCS status 0x%x\n", val2); 1826 + /* Check the link status on 1.1.2 */ 1827 + bnx2x_mdio45_ctrl_read(bp, GRCBASE_EMAC0, 1828 + ext_phy_addr, 1829 + EXT_PHY_OPT_PMA_PMD_DEVAD, 1830 + EXT_PHY_KR_STATUS, &val2); 1831 + bnx2x_mdio45_ctrl_read(bp, GRCBASE_EMAC0, 1832 + ext_phy_addr, 1833 + EXT_PHY_OPT_PMA_PMD_DEVAD, 1834 + EXT_PHY_KR_STATUS, &val1); 1835 + DP(NETIF_MSG_LINK, 1836 + "KR PMA status 0x%x->0x%x\n", val2, val1); 1837 + val1 = ((val1 & 4) == 4); 1838 + /* If 1G was requested assume the link is up */ 1839 + if (!(bp->req_autoneg & AUTONEG_SPEED) && 1840 + (bp->req_line_speed == SPEED_1000)) 1841 + val1 = 1; 1842 + bnx2x_hw_unlock(bp, HW_LOCK_RESOURCE_8072_MDIO); 1843 + break; 1844 + 1845 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101: 1846 + bnx2x_mdio45_read(bp, ext_phy_addr, 1847 + EXT_PHY_OPT_PMA_PMD_DEVAD, 1848 + EXT_PHY_OPT_LASI_STATUS, &val2); 1849 + bnx2x_mdio45_read(bp, ext_phy_addr, 1850 + EXT_PHY_OPT_PMA_PMD_DEVAD, 1851 + EXT_PHY_OPT_LASI_STATUS, &val1); 1852 + DP(NETIF_MSG_LINK, 1853 + "10G-base-T LASI status 0x%x->0x%x\n", val2, val1); 1854 + bnx2x_mdio45_read(bp, ext_phy_addr, 1855 + EXT_PHY_OPT_PMA_PMD_DEVAD, 1856 + EXT_PHY_KR_STATUS, &val2); 1857 + bnx2x_mdio45_read(bp, ext_phy_addr, 1858 + EXT_PHY_OPT_PMA_PMD_DEVAD, 1859 + EXT_PHY_KR_STATUS, &val1); 1860 + DP(NETIF_MSG_LINK, 1861 + "10G-base-T PMA status 0x%x->0x%x\n", val2, val1); 1862 + val1 = ((val1 & 4) == 4); 1863 + /* if link is up 1864 + * print the AN outcome of the SFX7101 PHY 1865 + */ 1866 + if (val1) { 1867 + bnx2x_mdio45_read(bp, ext_phy_addr, 1868 + EXT_PHY_KR_AUTO_NEG_DEVAD, 1869 + 0x21, &val2); 1870 + DP(NETIF_MSG_LINK, 1871 + "SFX7101 AN status 0x%x->%s\n", val2, 1872 + (val2 & (1<<14)) ? "Master" : "Slave"); 1873 + } 2027 1874 break; 2028 1875 2029 1876 default: 2030 1877 DP(NETIF_MSG_LINK, "BAD XGXS ext_phy_config 0x%x\n", 2031 1878 bp->ext_phy_config); 2032 - val = 0; 1879 + val1 = 0; 2033 1880 break; 2034 1881 } 2035 - bp->phy_addr = local_phy; 2036 1882 2037 1883 } else { /* SerDes */ 2038 1884 ext_phy_type = SERDES_EXT_PHY_TYPE(bp); 2039 1885 switch (ext_phy_type) { 2040 1886 case PORT_HW_CFG_SERDES_EXT_PHY_TYPE_DIRECT: 2041 1887 DP(NETIF_MSG_LINK, "SerDes Direct\n"); 2042 - val = 1; 1888 + val1 = 1; 2043 1889 break; 2044 1890 2045 1891 case PORT_HW_CFG_SERDES_EXT_PHY_TYPE_BCM5482: 2046 1892 DP(NETIF_MSG_LINK, "SerDes 5482\n"); 2047 - val = 1; 1893 + val1 = 1; 2048 1894 break; 2049 1895 2050 1896 default: 2051 1897 DP(NETIF_MSG_LINK, "BAD SerDes ext_phy_config 0x%x\n", 2052 1898 bp->ext_phy_config); 2053 - val = 0; 1899 + val1 = 0; 2054 1900 break; 2055 1901 } 2056 1902 } 2057 1903 2058 - return val; 1904 + return val1; 2059 1905 } 2060 1906 2061 1907 static void bnx2x_bmac_enable(struct bnx2x *bp, int is_lb) ··· 2269 1933 bp->phy_flags |= PHY_BMAC_FLAG; 2270 1934 2271 1935 bp->stats_state = STATS_STATE_ENABLE; 1936 + } 1937 + 1938 + static void bnx2x_bmac_rx_disable(struct bnx2x *bp) 1939 + { 1940 + int port = bp->port; 1941 + u32 bmac_addr = port ? NIG_REG_INGRESS_BMAC1_MEM : 1942 + NIG_REG_INGRESS_BMAC0_MEM; 1943 + u32 wb_write[2]; 1944 + 1945 + /* Only if the bmac is out of reset */ 1946 + if (REG_RD(bp, MISC_REG_RESET_REG_2) & 1947 + (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)) { 1948 + /* Clear Rx Enable bit in BMAC_CONTROL register */ 1949 + #ifdef BNX2X_DMAE_RD 1950 + bnx2x_read_dmae(bp, bmac_addr + 1951 + BIGMAC_REGISTER_BMAC_CONTROL, 2); 1952 + wb_write[0] = *bnx2x_sp(bp, wb_data[0]); 1953 + wb_write[1] = *bnx2x_sp(bp, wb_data[1]); 1954 + #else 1955 + wb_write[0] = REG_RD(bp, 1956 + bmac_addr + BIGMAC_REGISTER_BMAC_CONTROL); 1957 + wb_write[1] = REG_RD(bp, 1958 + bmac_addr + BIGMAC_REGISTER_BMAC_CONTROL + 4); 1959 + #endif 1960 + wb_write[0] &= ~BMAC_CONTROL_RX_ENABLE; 1961 + REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_BMAC_CONTROL, 1962 + wb_write, 2); 1963 + msleep(1); 1964 + } 2272 1965 } 2273 1966 2274 1967 static void bnx2x_emac_enable(struct bnx2x *bp) ··· 2598 2233 static void bnx2x_update_mng(struct bnx2x *bp) 2599 2234 { 2600 2235 if (!nomcp) 2601 - SHMEM_WR(bp, drv_fw_mb[bp->port].link_status, 2236 + SHMEM_WR(bp, port_mb[bp->port].link_status, 2602 2237 bp->link_status); 2603 2238 } 2604 2239 ··· 2660 2295 DP(BNX2X_MSG_STATS, "stats_state - STOP\n"); 2661 2296 } 2662 2297 2663 - /* indicate link down */ 2298 + /* indicate no mac active */ 2664 2299 bp->phy_flags &= ~(PHY_BMAC_FLAG | PHY_EMAC_FLAG); 2665 - 2666 - /* reset BigMac */ 2667 - REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, 2668 - (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)); 2669 - 2670 - /* ignore drain flag interrupt */ 2671 - /* activate nig drain */ 2672 - NIG_WR(NIG_REG_EGRESS_DRAIN0_MODE + port*4, 1); 2673 2300 2674 2301 /* update shared memory */ 2675 2302 bnx2x_update_mng(bp); 2303 + 2304 + /* activate nig drain */ 2305 + NIG_WR(NIG_REG_EGRESS_DRAIN0_MODE + port*4, 1); 2306 + 2307 + /* reset BigMac */ 2308 + bnx2x_bmac_rx_disable(bp); 2309 + REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, 2310 + (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)); 2676 2311 2677 2312 /* indicate link down */ 2678 2313 bnx2x_link_report(bp); ··· 2683 2318 /* This function is called upon link interrupt */ 2684 2319 static void bnx2x_link_update(struct bnx2x *bp) 2685 2320 { 2686 - u32 gp_status; 2687 2321 int port = bp->port; 2688 2322 int i; 2323 + u32 gp_status; 2689 2324 int link_10g; 2690 2325 2691 - DP(NETIF_MSG_LINK, "port %x, is xgxs %x, stat_mask 0x%x," 2326 + DP(NETIF_MSG_LINK, "port %x, %s, int_status 0x%x," 2692 2327 " int_mask 0x%x, saved_mask 0x%x, MI_INT %x, SERDES_LINK %x," 2693 - " 10G %x, XGXS_LINK %x\n", port, (bp->phy_flags & PHY_XGXS_FLAG), 2328 + " 10G %x, XGXS_LINK %x\n", port, 2329 + (bp->phy_flags & PHY_XGXS_FLAG)? "XGXS":"SerDes", 2694 2330 REG_RD(bp, NIG_REG_STATUS_INTERRUPT_PORT0 + port*4), 2695 2331 REG_RD(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4), bp->nig_mask, 2696 2332 REG_RD(bp, NIG_REG_EMAC0_STATUS_MISC_MI_INT + port*0x18), ··· 2703 2337 might_sleep(); 2704 2338 MDIO_SET_REG_BANK(bp, MDIO_REG_BANK_GP_STATUS); 2705 2339 /* avoid fast toggling */ 2706 - for (i = 0 ; i < 10 ; i++) { 2340 + for (i = 0; i < 10; i++) { 2707 2341 msleep(10); 2708 2342 bnx2x_mdio22_read(bp, MDIO_GP_STATUS_TOP_AN_STATUS1, 2709 2343 &gp_status); ··· 2718 2352 bnx2x_link_int_ack(bp, link_10g); 2719 2353 2720 2354 /* link is up only if both local phy and external phy are up */ 2721 - if (bp->link_up && bnx2x_ext_phy_is_link_up(bp)) { 2355 + bp->link_up = (bp->phy_link_up && bnx2x_ext_phy_is_link_up(bp)); 2356 + if (bp->link_up) { 2722 2357 if (link_10g) { 2723 2358 bnx2x_bmac_enable(bp, 0); 2724 2359 bnx2x_leds_set(bp, SPEED_10000); ··· 2795 2428 } 2796 2429 } 2797 2430 2798 - BNX2X_ERR("BUG! unicore is still in reset!\n"); 2431 + BNX2X_ERR("BUG! %s (0x%x) is still in reset!\n", 2432 + (bp->phy_flags & PHY_XGXS_FLAG)? "XGXS":"SerDes", 2433 + bp->phy_addr); 2799 2434 } 2800 2435 2801 2436 static void bnx2x_set_swap_lanes(struct bnx2x *bp) ··· 2845 2476 MDIO_SET_REG_BANK(bp, MDIO_REG_BANK_10G_PARALLEL_DETECT); 2846 2477 2847 2478 bnx2x_mdio22_write(bp, 2848 - MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_LINK, 2479 + MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_LINK, 2849 2480 MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_LINK_CNT); 2850 2481 2851 2482 bnx2x_mdio22_read(bp, 2852 - MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_CONTROL, 2853 - &control2); 2483 + MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_CONTROL, 2484 + &control2); 2854 2485 2855 2486 if (bp->autoneg & AUTONEG_PARALLEL) { 2856 2487 control2 |= ··· 2860 2491 ~MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_CONTROL_PARDET10G_EN; 2861 2492 } 2862 2493 bnx2x_mdio22_write(bp, 2863 - MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_CONTROL, 2864 - control2); 2494 + MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_CONTROL, 2495 + control2); 2496 + 2497 + /* Disable parallel detection of HiG */ 2498 + MDIO_SET_REG_BANK(bp, MDIO_REG_BANK_XGXS_BLOCK2); 2499 + bnx2x_mdio22_write(bp, MDIO_XGXS_BLOCK2_UNICORE_MODE_10G, 2500 + MDIO_XGXS_BLOCK2_UNICORE_MODE_10G_CX4_XGXS | 2501 + MDIO_XGXS_BLOCK2_UNICORE_MODE_10G_HIGIG_XGXS); 2865 2502 } 2866 2503 } 2867 2504 ··· 3001 2626 MDIO_SET_REG_BANK(bp, MDIO_REG_BANK_OVER_1G); 3002 2627 3003 2628 /* set extended capabilities */ 3004 - if (bp->advertising & ADVERTISED_2500baseT_Full) 2629 + if (bp->advertising & ADVERTISED_2500baseX_Full) 3005 2630 val |= MDIO_OVER_1G_UP1_2_5G; 3006 2631 if (bp->advertising & ADVERTISED_10000baseT_Full) 3007 2632 val |= MDIO_OVER_1G_UP1_10G; ··· 3017 2642 /* for AN, we are always publishing full duplex */ 3018 2643 an_adv = MDIO_COMBO_IEEE0_AUTO_NEG_ADV_FULL_DUPLEX; 3019 2644 3020 - /* set pause */ 3021 - switch (bp->pause_mode) { 3022 - case PAUSE_SYMMETRIC: 3023 - an_adv |= MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_SYMMETRIC; 3024 - break; 3025 - case PAUSE_ASYMMETRIC: 3026 - an_adv |= MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC; 3027 - break; 3028 - case PAUSE_BOTH: 3029 - an_adv |= MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH; 3030 - break; 3031 - case PAUSE_NONE: 3032 - an_adv |= MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_NONE; 3033 - break; 2645 + /* resolve pause mode and advertisement 2646 + * Please refer to Table 28B-3 of the 802.3ab-1999 spec */ 2647 + if (bp->req_autoneg & AUTONEG_FLOW_CTRL) { 2648 + switch (bp->req_flow_ctrl) { 2649 + case FLOW_CTRL_AUTO: 2650 + if (bp->dev->mtu <= 4500) { 2651 + an_adv |= 2652 + MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH; 2653 + bp->advertising |= (ADVERTISED_Pause | 2654 + ADVERTISED_Asym_Pause); 2655 + } else { 2656 + an_adv |= 2657 + MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC; 2658 + bp->advertising |= ADVERTISED_Asym_Pause; 2659 + } 2660 + break; 2661 + 2662 + case FLOW_CTRL_TX: 2663 + an_adv |= 2664 + MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC; 2665 + bp->advertising |= ADVERTISED_Asym_Pause; 2666 + break; 2667 + 2668 + case FLOW_CTRL_RX: 2669 + if (bp->dev->mtu <= 4500) { 2670 + an_adv |= 2671 + MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH; 2672 + bp->advertising |= (ADVERTISED_Pause | 2673 + ADVERTISED_Asym_Pause); 2674 + } else { 2675 + an_adv |= 2676 + MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_NONE; 2677 + bp->advertising &= ~(ADVERTISED_Pause | 2678 + ADVERTISED_Asym_Pause); 2679 + } 2680 + break; 2681 + 2682 + case FLOW_CTRL_BOTH: 2683 + if (bp->dev->mtu <= 4500) { 2684 + an_adv |= 2685 + MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH; 2686 + bp->advertising |= (ADVERTISED_Pause | 2687 + ADVERTISED_Asym_Pause); 2688 + } else { 2689 + an_adv |= 2690 + MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC; 2691 + bp->advertising |= ADVERTISED_Asym_Pause; 2692 + } 2693 + break; 2694 + 2695 + case FLOW_CTRL_NONE: 2696 + default: 2697 + an_adv |= MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_NONE; 2698 + bp->advertising &= ~(ADVERTISED_Pause | 2699 + ADVERTISED_Asym_Pause); 2700 + break; 2701 + } 2702 + } else { /* forced mode */ 2703 + switch (bp->req_flow_ctrl) { 2704 + case FLOW_CTRL_AUTO: 2705 + DP(NETIF_MSG_LINK, "req_flow_ctrl 0x%x while" 2706 + " req_autoneg 0x%x\n", 2707 + bp->req_flow_ctrl, bp->req_autoneg); 2708 + break; 2709 + 2710 + case FLOW_CTRL_TX: 2711 + an_adv |= 2712 + MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC; 2713 + bp->advertising |= ADVERTISED_Asym_Pause; 2714 + break; 2715 + 2716 + case FLOW_CTRL_RX: 2717 + case FLOW_CTRL_BOTH: 2718 + an_adv |= MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH; 2719 + bp->advertising |= (ADVERTISED_Pause | 2720 + ADVERTISED_Asym_Pause); 2721 + break; 2722 + 2723 + case FLOW_CTRL_NONE: 2724 + default: 2725 + an_adv |= MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_NONE; 2726 + bp->advertising &= ~(ADVERTISED_Pause | 2727 + ADVERTISED_Asym_Pause); 2728 + break; 2729 + } 3034 2730 } 3035 2731 3036 2732 MDIO_SET_REG_BANK(bp, MDIO_REG_BANK_COMBO_IEEE0); ··· 3199 2753 static void bnx2x_link_int_enable(struct bnx2x *bp) 3200 2754 { 3201 2755 int port = bp->port; 2756 + u32 ext_phy_type; 2757 + u32 mask; 3202 2758 3203 2759 /* setting the status to report on link up 3204 2760 for either XGXS or SerDes */ 3205 2761 bnx2x_bits_dis(bp, NIG_REG_STATUS_INTERRUPT_PORT0 + port*4, 3206 - (NIG_XGXS0_LINK_STATUS | 3207 - NIG_STATUS_INTERRUPT_XGXS0_LINK10G | 3208 - NIG_SERDES0_LINK_STATUS)); 2762 + (NIG_STATUS_XGXS0_LINK10G | 2763 + NIG_STATUS_XGXS0_LINK_STATUS | 2764 + NIG_STATUS_SERDES0_LINK_STATUS)); 3209 2765 3210 2766 if (bp->phy_flags & PHY_XGXS_FLAG) { 3211 - /* TBD - 3212 - * in force mode (not AN) we can enable just the relevant 3213 - * interrupt 3214 - * Even in AN we might enable only one according to the AN 3215 - * speed mask 3216 - */ 3217 - bnx2x_bits_en(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4, 3218 - (NIG_MASK_XGXS0_LINK_STATUS | 3219 - NIG_MASK_XGXS0_LINK10G)); 3220 - DP(NETIF_MSG_LINK, "enable XGXS interrupt\n"); 2767 + mask = (NIG_MASK_XGXS0_LINK10G | 2768 + NIG_MASK_XGXS0_LINK_STATUS); 2769 + DP(NETIF_MSG_LINK, "enabled XGXS interrupt\n"); 2770 + ext_phy_type = XGXS_EXT_PHY_TYPE(bp); 2771 + if ((ext_phy_type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) && 2772 + (ext_phy_type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE) && 2773 + (ext_phy_type != 2774 + PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN)) { 2775 + mask |= NIG_MASK_MI_INT; 2776 + DP(NETIF_MSG_LINK, "enabled external phy int\n"); 2777 + } 3221 2778 3222 2779 } else { /* SerDes */ 3223 - bnx2x_bits_en(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4, 3224 - NIG_MASK_SERDES0_LINK_STATUS); 3225 - DP(NETIF_MSG_LINK, "enable SerDes interrupt\n"); 2780 + mask = NIG_MASK_SERDES0_LINK_STATUS; 2781 + DP(NETIF_MSG_LINK, "enabled SerDes interrupt\n"); 2782 + ext_phy_type = SERDES_EXT_PHY_TYPE(bp); 2783 + if ((ext_phy_type != 2784 + PORT_HW_CFG_SERDES_EXT_PHY_TYPE_DIRECT) && 2785 + (ext_phy_type != 2786 + PORT_HW_CFG_SERDES_EXT_PHY_TYPE_NOT_CONN)) { 2787 + mask |= NIG_MASK_MI_INT; 2788 + DP(NETIF_MSG_LINK, "enabled external phy int\n"); 2789 + } 3226 2790 } 2791 + bnx2x_bits_en(bp, 2792 + NIG_REG_MASK_INTERRUPT_PORT0 + port*4, 2793 + mask); 2794 + DP(NETIF_MSG_LINK, "port %x, %s, int_status 0x%x," 2795 + " int_mask 0x%x, MI_INT %x, SERDES_LINK %x," 2796 + " 10G %x, XGXS_LINK %x\n", port, 2797 + (bp->phy_flags & PHY_XGXS_FLAG)? "XGXS":"SerDes", 2798 + REG_RD(bp, NIG_REG_STATUS_INTERRUPT_PORT0 + port*4), 2799 + REG_RD(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4), 2800 + REG_RD(bp, NIG_REG_EMAC0_STATUS_MISC_MI_INT + port*0x18), 2801 + REG_RD(bp, NIG_REG_SERDES0_STATUS_LINK_STATUS + port*0x3c), 2802 + REG_RD(bp, NIG_REG_XGXS0_STATUS_LINK10G + port*0x68), 2803 + REG_RD(bp, NIG_REG_XGXS0_STATUS_LINK_STATUS + port*0x68) 2804 + ); 2805 + } 2806 + 2807 + static void bnx2x_bcm8072_external_rom_boot(struct bnx2x *bp) 2808 + { 2809 + u32 ext_phy_addr = ((bp->ext_phy_config & 2810 + PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >> 2811 + PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT); 2812 + u32 fw_ver1, fw_ver2; 2813 + 2814 + /* Need to wait 200ms after reset */ 2815 + msleep(200); 2816 + /* Boot port from external ROM 2817 + * Set ser_boot_ctl bit in the MISC_CTRL1 register 2818 + */ 2819 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, ext_phy_addr, 2820 + EXT_PHY_KR_PMA_PMD_DEVAD, 2821 + EXT_PHY_KR_MISC_CTRL1, 0x0001); 2822 + 2823 + /* Reset internal microprocessor */ 2824 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, ext_phy_addr, 2825 + EXT_PHY_KR_PMA_PMD_DEVAD, EXT_PHY_KR_GEN_CTRL, 2826 + EXT_PHY_KR_ROM_RESET_INTERNAL_MP); 2827 + /* set micro reset = 0 */ 2828 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, ext_phy_addr, 2829 + EXT_PHY_KR_PMA_PMD_DEVAD, EXT_PHY_KR_GEN_CTRL, 2830 + EXT_PHY_KR_ROM_MICRO_RESET); 2831 + /* Reset internal microprocessor */ 2832 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, ext_phy_addr, 2833 + EXT_PHY_KR_PMA_PMD_DEVAD, EXT_PHY_KR_GEN_CTRL, 2834 + EXT_PHY_KR_ROM_RESET_INTERNAL_MP); 2835 + /* wait for 100ms for code download via SPI port */ 2836 + msleep(100); 2837 + 2838 + /* Clear ser_boot_ctl bit */ 2839 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, ext_phy_addr, 2840 + EXT_PHY_KR_PMA_PMD_DEVAD, 2841 + EXT_PHY_KR_MISC_CTRL1, 0x0000); 2842 + /* Wait 100ms */ 2843 + msleep(100); 2844 + 2845 + /* Print the PHY FW version */ 2846 + bnx2x_mdio45_ctrl_read(bp, GRCBASE_EMAC0, ext_phy_addr, 2847 + EXT_PHY_KR_PMA_PMD_DEVAD, 2848 + 0xca19, &fw_ver1); 2849 + bnx2x_mdio45_ctrl_read(bp, GRCBASE_EMAC0, ext_phy_addr, 2850 + EXT_PHY_KR_PMA_PMD_DEVAD, 2851 + 0xca1a, &fw_ver2); 2852 + DP(NETIF_MSG_LINK, 2853 + "8072 FW version 0x%x:0x%x\n", fw_ver1, fw_ver2); 2854 + } 2855 + 2856 + static void bnx2x_bcm8072_force_10G(struct bnx2x *bp) 2857 + { 2858 + u32 ext_phy_addr = ((bp->ext_phy_config & 2859 + PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >> 2860 + PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT); 2861 + 2862 + /* Force KR or KX */ 2863 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, ext_phy_addr, 2864 + EXT_PHY_KR_PMA_PMD_DEVAD, EXT_PHY_KR_CTRL, 2865 + 0x2040); 2866 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, ext_phy_addr, 2867 + EXT_PHY_KR_PMA_PMD_DEVAD, EXT_PHY_KR_CTRL2, 2868 + 0x000b); 2869 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, ext_phy_addr, 2870 + EXT_PHY_KR_PMA_PMD_DEVAD, EXT_PHY_KR_PMD_CTRL, 2871 + 0x0000); 2872 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, ext_phy_addr, 2873 + EXT_PHY_KR_AUTO_NEG_DEVAD, EXT_PHY_KR_CTRL, 2874 + 0x0000); 3227 2875 } 3228 2876 3229 2877 static void bnx2x_ext_phy_init(struct bnx2x *bp) 3230 2878 { 3231 - int port = bp->port; 3232 2879 u32 ext_phy_type; 3233 2880 u32 ext_phy_addr; 3234 - u32 local_phy; 2881 + u32 cnt; 2882 + u32 ctrl; 2883 + u32 val = 0; 3235 2884 3236 2885 if (bp->phy_flags & PHY_XGXS_FLAG) { 3237 - local_phy = bp->phy_addr; 3238 2886 ext_phy_addr = ((bp->ext_phy_config & 3239 2887 PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >> 3240 2888 PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT); 3241 2889 3242 2890 ext_phy_type = XGXS_EXT_PHY_TYPE(bp); 2891 + /* Make sure that the soft reset is off (expect for the 8072: 2892 + * due to the lock, it will be done inside the specific 2893 + * handling) 2894 + */ 2895 + if ((ext_phy_type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) && 2896 + (ext_phy_type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE) && 2897 + (ext_phy_type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN) && 2898 + (ext_phy_type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072)) { 2899 + /* Wait for soft reset to get cleared upto 1 sec */ 2900 + for (cnt = 0; cnt < 1000; cnt++) { 2901 + bnx2x_mdio45_read(bp, ext_phy_addr, 2902 + EXT_PHY_OPT_PMA_PMD_DEVAD, 2903 + EXT_PHY_OPT_CNTL, &ctrl); 2904 + if (!(ctrl & (1<<15))) 2905 + break; 2906 + msleep(1); 2907 + } 2908 + DP(NETIF_MSG_LINK, 2909 + "control reg 0x%x (after %d ms)\n", ctrl, cnt); 2910 + } 2911 + 3243 2912 switch (ext_phy_type) { 3244 2913 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT: 3245 2914 DP(NETIF_MSG_LINK, "XGXS Direct\n"); ··· 3362 2801 3363 2802 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705: 3364 2803 DP(NETIF_MSG_LINK, "XGXS 8705\n"); 3365 - bnx2x_bits_en(bp, 3366 - NIG_REG_MASK_INTERRUPT_PORT0 + port*4, 3367 - NIG_MASK_MI_INT); 3368 - DP(NETIF_MSG_LINK, "enabled external phy int\n"); 3369 2804 3370 - bp->phy_addr = ext_phy_type; 3371 - bnx2x_mdio45_vwrite(bp, EXT_PHY_OPT_PMA_PMD_DEVAD, 2805 + bnx2x_mdio45_vwrite(bp, ext_phy_addr, 2806 + EXT_PHY_OPT_PMA_PMD_DEVAD, 3372 2807 EXT_PHY_OPT_PMD_MISC_CNTL, 3373 2808 0x8288); 3374 - bnx2x_mdio45_vwrite(bp, EXT_PHY_OPT_PMA_PMD_DEVAD, 2809 + bnx2x_mdio45_vwrite(bp, ext_phy_addr, 2810 + EXT_PHY_OPT_PMA_PMD_DEVAD, 3375 2811 EXT_PHY_OPT_PHY_IDENTIFIER, 3376 2812 0x7fbf); 3377 - bnx2x_mdio45_vwrite(bp, EXT_PHY_OPT_PMA_PMD_DEVAD, 2813 + bnx2x_mdio45_vwrite(bp, ext_phy_addr, 2814 + EXT_PHY_OPT_PMA_PMD_DEVAD, 3378 2815 EXT_PHY_OPT_CMU_PLL_BYPASS, 3379 2816 0x0100); 3380 - bnx2x_mdio45_vwrite(bp, EXT_PHY_OPT_WIS_DEVAD, 2817 + bnx2x_mdio45_vwrite(bp, ext_phy_addr, 2818 + EXT_PHY_OPT_WIS_DEVAD, 3381 2819 EXT_PHY_OPT_LASI_CNTL, 0x1); 3382 2820 break; 3383 2821 3384 2822 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706: 3385 2823 DP(NETIF_MSG_LINK, "XGXS 8706\n"); 3386 - bnx2x_bits_en(bp, 3387 - NIG_REG_MASK_INTERRUPT_PORT0 + port*4, 3388 - NIG_MASK_MI_INT); 3389 - DP(NETIF_MSG_LINK, "enabled external phy int\n"); 3390 2824 3391 - bp->phy_addr = ext_phy_type; 3392 - bnx2x_mdio45_vwrite(bp, EXT_PHY_OPT_PMA_PMD_DEVAD, 3393 - EXT_PHY_OPT_PMD_DIGITAL_CNT, 3394 - 0x400); 3395 - bnx2x_mdio45_vwrite(bp, EXT_PHY_OPT_PMA_PMD_DEVAD, 2825 + if (!(bp->req_autoneg & AUTONEG_SPEED)) { 2826 + /* Force speed */ 2827 + if (bp->req_line_speed == SPEED_10000) { 2828 + DP(NETIF_MSG_LINK, 2829 + "XGXS 8706 force 10Gbps\n"); 2830 + bnx2x_mdio45_vwrite(bp, ext_phy_addr, 2831 + EXT_PHY_OPT_PMA_PMD_DEVAD, 2832 + EXT_PHY_OPT_PMD_DIGITAL_CNT, 2833 + 0x400); 2834 + } else { 2835 + /* Force 1Gbps */ 2836 + DP(NETIF_MSG_LINK, 2837 + "XGXS 8706 force 1Gbps\n"); 2838 + 2839 + bnx2x_mdio45_vwrite(bp, ext_phy_addr, 2840 + EXT_PHY_OPT_PMA_PMD_DEVAD, 2841 + EXT_PHY_OPT_CNTL, 2842 + 0x0040); 2843 + 2844 + bnx2x_mdio45_vwrite(bp, ext_phy_addr, 2845 + EXT_PHY_OPT_PMA_PMD_DEVAD, 2846 + EXT_PHY_OPT_CNTL2, 2847 + 0x000D); 2848 + } 2849 + 2850 + /* Enable LASI */ 2851 + bnx2x_mdio45_vwrite(bp, ext_phy_addr, 2852 + EXT_PHY_OPT_PMA_PMD_DEVAD, 2853 + EXT_PHY_OPT_LASI_CNTL, 2854 + 0x1); 2855 + } else { 2856 + /* AUTONEG */ 2857 + /* Allow CL37 through CL73 */ 2858 + DP(NETIF_MSG_LINK, "XGXS 8706 AutoNeg\n"); 2859 + bnx2x_mdio45_vwrite(bp, ext_phy_addr, 2860 + EXT_PHY_AUTO_NEG_DEVAD, 2861 + EXT_PHY_OPT_AN_CL37_CL73, 2862 + 0x040c); 2863 + 2864 + /* Enable Full-Duplex advertisment on CL37 */ 2865 + bnx2x_mdio45_vwrite(bp, ext_phy_addr, 2866 + EXT_PHY_AUTO_NEG_DEVAD, 2867 + EXT_PHY_OPT_AN_CL37_FD, 2868 + 0x0020); 2869 + /* Enable CL37 AN */ 2870 + bnx2x_mdio45_vwrite(bp, ext_phy_addr, 2871 + EXT_PHY_AUTO_NEG_DEVAD, 2872 + EXT_PHY_OPT_AN_CL37_AN, 2873 + 0x1000); 2874 + /* Advertise 10G/1G support */ 2875 + if (bp->advertising & 2876 + ADVERTISED_1000baseT_Full) 2877 + val = (1<<5); 2878 + if (bp->advertising & 2879 + ADVERTISED_10000baseT_Full) 2880 + val |= (1<<7); 2881 + 2882 + bnx2x_mdio45_vwrite(bp, ext_phy_addr, 2883 + EXT_PHY_AUTO_NEG_DEVAD, 2884 + EXT_PHY_OPT_AN_ADV, val); 2885 + /* Enable LASI */ 2886 + bnx2x_mdio45_vwrite(bp, ext_phy_addr, 2887 + EXT_PHY_OPT_PMA_PMD_DEVAD, 2888 + EXT_PHY_OPT_LASI_CNTL, 2889 + 0x1); 2890 + 2891 + /* Enable clause 73 AN */ 2892 + bnx2x_mdio45_write(bp, ext_phy_addr, 2893 + EXT_PHY_AUTO_NEG_DEVAD, 2894 + EXT_PHY_OPT_CNTL, 2895 + 0x1200); 2896 + } 2897 + break; 2898 + 2899 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072: 2900 + bnx2x_hw_lock(bp, HW_LOCK_RESOURCE_8072_MDIO); 2901 + /* Wait for soft reset to get cleared upto 1 sec */ 2902 + for (cnt = 0; cnt < 1000; cnt++) { 2903 + bnx2x_mdio45_ctrl_read(bp, GRCBASE_EMAC0, 2904 + ext_phy_addr, 2905 + EXT_PHY_OPT_PMA_PMD_DEVAD, 2906 + EXT_PHY_OPT_CNTL, &ctrl); 2907 + if (!(ctrl & (1<<15))) 2908 + break; 2909 + msleep(1); 2910 + } 2911 + DP(NETIF_MSG_LINK, 2912 + "8072 control reg 0x%x (after %d ms)\n", 2913 + ctrl, cnt); 2914 + 2915 + bnx2x_bcm8072_external_rom_boot(bp); 2916 + DP(NETIF_MSG_LINK, "Finshed loading 8072 KR ROM\n"); 2917 + 2918 + /* enable LASI */ 2919 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, 2920 + ext_phy_addr, 2921 + EXT_PHY_KR_PMA_PMD_DEVAD, 2922 + 0x9000, 0x0400); 2923 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, 2924 + ext_phy_addr, 2925 + EXT_PHY_KR_PMA_PMD_DEVAD, 2926 + EXT_PHY_KR_LASI_CNTL, 0x0004); 2927 + 2928 + /* If this is forced speed, set to KR or KX 2929 + * (all other are not supported) 2930 + */ 2931 + if (!(bp->req_autoneg & AUTONEG_SPEED)) { 2932 + if (bp->req_line_speed == SPEED_10000) { 2933 + bnx2x_bcm8072_force_10G(bp); 2934 + DP(NETIF_MSG_LINK, 2935 + "Forced speed 10G on 8072\n"); 2936 + /* unlock */ 2937 + bnx2x_hw_unlock(bp, 2938 + HW_LOCK_RESOURCE_8072_MDIO); 2939 + break; 2940 + } else 2941 + val = (1<<5); 2942 + } else { 2943 + 2944 + /* Advertise 10G/1G support */ 2945 + if (bp->advertising & 2946 + ADVERTISED_1000baseT_Full) 2947 + val = (1<<5); 2948 + if (bp->advertising & 2949 + ADVERTISED_10000baseT_Full) 2950 + val |= (1<<7); 2951 + } 2952 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, 2953 + ext_phy_addr, 2954 + EXT_PHY_KR_AUTO_NEG_DEVAD, 2955 + 0x11, val); 2956 + /* Add support for CL37 ( passive mode ) I */ 2957 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, 2958 + ext_phy_addr, 2959 + EXT_PHY_KR_AUTO_NEG_DEVAD, 2960 + 0x8370, 0x040c); 2961 + /* Add support for CL37 ( passive mode ) II */ 2962 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, 2963 + ext_phy_addr, 2964 + EXT_PHY_KR_AUTO_NEG_DEVAD, 2965 + 0xffe4, 0x20); 2966 + /* Add support for CL37 ( passive mode ) III */ 2967 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, 2968 + ext_phy_addr, 2969 + EXT_PHY_KR_AUTO_NEG_DEVAD, 2970 + 0xffe0, 0x1000); 2971 + /* Restart autoneg */ 2972 + msleep(500); 2973 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, 2974 + ext_phy_addr, 2975 + EXT_PHY_KR_AUTO_NEG_DEVAD, 2976 + EXT_PHY_KR_CTRL, 0x1200); 2977 + DP(NETIF_MSG_LINK, "8072 Autoneg Restart: " 2978 + "1G %ssupported 10G %ssupported\n", 2979 + (val & (1<<5)) ? "" : "not ", 2980 + (val & (1<<7)) ? "" : "not "); 2981 + 2982 + /* unlock */ 2983 + bnx2x_hw_unlock(bp, HW_LOCK_RESOURCE_8072_MDIO); 2984 + break; 2985 + 2986 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101: 2987 + DP(NETIF_MSG_LINK, 2988 + "Setting the SFX7101 LASI indication\n"); 2989 + bnx2x_mdio45_vwrite(bp, ext_phy_addr, 2990 + EXT_PHY_OPT_PMA_PMD_DEVAD, 3396 2991 EXT_PHY_OPT_LASI_CNTL, 0x1); 2992 + DP(NETIF_MSG_LINK, 2993 + "Setting the SFX7101 LED to blink on traffic\n"); 2994 + bnx2x_mdio45_vwrite(bp, ext_phy_addr, 2995 + EXT_PHY_OPT_PMA_PMD_DEVAD, 2996 + 0xC007, (1<<3)); 2997 + 2998 + /* read modify write pause advertizing */ 2999 + bnx2x_mdio45_read(bp, ext_phy_addr, 3000 + EXT_PHY_KR_AUTO_NEG_DEVAD, 3001 + EXT_PHY_KR_AUTO_NEG_ADVERT, &val); 3002 + val &= ~EXT_PHY_KR_AUTO_NEG_ADVERT_PAUSE_BOTH; 3003 + /* Please refer to Table 28B-3 of 802.3ab-1999 spec. */ 3004 + if (bp->advertising & ADVERTISED_Pause) 3005 + val |= EXT_PHY_KR_AUTO_NEG_ADVERT_PAUSE; 3006 + 3007 + if (bp->advertising & ADVERTISED_Asym_Pause) { 3008 + val |= 3009 + EXT_PHY_KR_AUTO_NEG_ADVERT_PAUSE_ASYMMETRIC; 3010 + } 3011 + DP(NETIF_MSG_LINK, "SFX7101 AN advertize 0x%x\n", val); 3012 + bnx2x_mdio45_vwrite(bp, ext_phy_addr, 3013 + EXT_PHY_KR_AUTO_NEG_DEVAD, 3014 + EXT_PHY_KR_AUTO_NEG_ADVERT, val); 3015 + /* Restart autoneg */ 3016 + bnx2x_mdio45_read(bp, ext_phy_addr, 3017 + EXT_PHY_KR_AUTO_NEG_DEVAD, 3018 + EXT_PHY_KR_CTRL, &val); 3019 + val |= 0x200; 3020 + bnx2x_mdio45_write(bp, ext_phy_addr, 3021 + EXT_PHY_KR_AUTO_NEG_DEVAD, 3022 + EXT_PHY_KR_CTRL, val); 3397 3023 break; 3398 3024 3399 3025 default: 3400 - DP(NETIF_MSG_LINK, "BAD XGXS ext_phy_config 0x%x\n", 3401 - bp->ext_phy_config); 3026 + BNX2X_ERR("BAD XGXS ext_phy_config 0x%x\n", 3027 + bp->ext_phy_config); 3402 3028 break; 3403 3029 } 3404 - bp->phy_addr = local_phy; 3405 3030 3406 3031 } else { /* SerDes */ 3407 - /* ext_phy_addr = ((bp->ext_phy_config & 3032 + /* ext_phy_addr = ((bp->ext_phy_config & 3408 3033 PORT_HW_CFG_SERDES_EXT_PHY_ADDR_MASK) >> 3409 3034 PORT_HW_CFG_SERDES_EXT_PHY_ADDR_SHIFT); 3410 3035 */ ··· 3602 2855 3603 2856 case PORT_HW_CFG_SERDES_EXT_PHY_TYPE_BCM5482: 3604 2857 DP(NETIF_MSG_LINK, "SerDes 5482\n"); 3605 - bnx2x_bits_en(bp, 3606 - NIG_REG_MASK_INTERRUPT_PORT0 + port*4, 3607 - NIG_MASK_MI_INT); 3608 - DP(NETIF_MSG_LINK, "enabled external phy int\n"); 3609 2858 break; 3610 2859 3611 2860 default: ··· 3615 2872 static void bnx2x_ext_phy_reset(struct bnx2x *bp) 3616 2873 { 3617 2874 u32 ext_phy_type; 3618 - u32 ext_phy_addr; 3619 - u32 local_phy; 2875 + u32 ext_phy_addr = ((bp->ext_phy_config & 2876 + PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >> 2877 + PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT); 2878 + u32 board = (bp->board & SHARED_HW_CFG_BOARD_TYPE_MASK); 2879 + 2880 + /* The PHY reset is controled by GPIO 1 2881 + * Give it 1ms of reset pulse 2882 + */ 2883 + if ((board != SHARED_HW_CFG_BOARD_TYPE_BCM957710T1002G) && 2884 + (board != SHARED_HW_CFG_BOARD_TYPE_BCM957710T1003G)) { 2885 + bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, 2886 + MISC_REGISTERS_GPIO_OUTPUT_LOW); 2887 + msleep(1); 2888 + bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, 2889 + MISC_REGISTERS_GPIO_OUTPUT_HIGH); 2890 + } 3620 2891 3621 2892 if (bp->phy_flags & PHY_XGXS_FLAG) { 3622 2893 ext_phy_type = XGXS_EXT_PHY_TYPE(bp); ··· 3641 2884 3642 2885 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705: 3643 2886 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706: 3644 - DP(NETIF_MSG_LINK, "XGXS 8705/6\n"); 3645 - local_phy = bp->phy_addr; 3646 - ext_phy_addr = ((bp->ext_phy_config & 3647 - PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >> 3648 - PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT); 3649 - bp->phy_addr = (u8)ext_phy_addr; 3650 - bnx2x_mdio45_write(bp, EXT_PHY_OPT_PMA_PMD_DEVAD, 2887 + DP(NETIF_MSG_LINK, "XGXS 8705/8706\n"); 2888 + bnx2x_mdio45_write(bp, ext_phy_addr, 2889 + EXT_PHY_OPT_PMA_PMD_DEVAD, 3651 2890 EXT_PHY_OPT_CNTL, 0xa040); 3652 - bp->phy_addr = local_phy; 2891 + break; 2892 + 2893 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072: 2894 + DP(NETIF_MSG_LINK, "XGXS 8072\n"); 2895 + bnx2x_hw_lock(bp, HW_LOCK_RESOURCE_8072_MDIO); 2896 + bnx2x_mdio45_ctrl_write(bp, GRCBASE_EMAC0, 2897 + ext_phy_addr, 2898 + EXT_PHY_KR_PMA_PMD_DEVAD, 2899 + 0, 1<<15); 2900 + bnx2x_hw_unlock(bp, HW_LOCK_RESOURCE_8072_MDIO); 2901 + break; 2902 + 2903 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101: 2904 + DP(NETIF_MSG_LINK, "XGXS SFX7101\n"); 3653 2905 break; 3654 2906 3655 2907 default: ··· 3697 2931 NIG_MASK_SERDES0_LINK_STATUS | 3698 2932 NIG_MASK_MI_INT)); 3699 2933 2934 + /* Activate the external PHY */ 3700 2935 bnx2x_ext_phy_reset(bp); 3701 2936 3702 2937 bnx2x_set_aer_mmd(bp); ··· 3778 3011 bnx2x_initialize_sgmii_process(bp); 3779 3012 } 3780 3013 3781 - /* enable the interrupt */ 3782 - bnx2x_link_int_enable(bp); 3783 - 3784 3014 /* init ext phy and enable link state int */ 3785 3015 bnx2x_ext_phy_init(bp); 3016 + 3017 + /* enable the interrupt */ 3018 + bnx2x_link_int_enable(bp); 3786 3019 } 3787 3020 3788 3021 static void bnx2x_phy_deassert(struct bnx2x *bp) ··· 3841 3074 static void bnx2x_link_reset(struct bnx2x *bp) 3842 3075 { 3843 3076 int port = bp->port; 3077 + u32 board = (bp->board & SHARED_HW_CFG_BOARD_TYPE_MASK); 3078 + 3079 + /* update shared memory */ 3080 + bp->link_status = 0; 3081 + bnx2x_update_mng(bp); 3844 3082 3845 3083 /* disable attentions */ 3846 3084 bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4, ··· 3854 3082 NIG_MASK_SERDES0_LINK_STATUS | 3855 3083 NIG_MASK_MI_INT)); 3856 3084 3857 - bnx2x_ext_phy_reset(bp); 3085 + /* activate nig drain */ 3086 + NIG_WR(NIG_REG_EGRESS_DRAIN0_MODE + port*4, 1); 3087 + 3088 + /* disable nig egress interface */ 3089 + NIG_WR(NIG_REG_BMAC0_OUT_EN + port*4, 0); 3090 + NIG_WR(NIG_REG_EGRESS_EMAC0_OUT_EN + port*4, 0); 3091 + 3092 + /* Stop BigMac rx */ 3093 + bnx2x_bmac_rx_disable(bp); 3094 + 3095 + /* disable emac */ 3096 + NIG_WR(NIG_REG_NIG_EMAC0_EN + port*4, 0); 3097 + 3098 + msleep(10); 3099 + 3100 + /* The PHY reset is controled by GPIO 1 3101 + * Hold it as output low 3102 + */ 3103 + if ((board != SHARED_HW_CFG_BOARD_TYPE_BCM957710T1002G) && 3104 + (board != SHARED_HW_CFG_BOARD_TYPE_BCM957710T1003G)) { 3105 + bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, 3106 + MISC_REGISTERS_GPIO_OUTPUT_LOW); 3107 + DP(NETIF_MSG_LINK, "reset external PHY\n"); 3108 + } 3858 3109 3859 3110 /* reset the SerDes/XGXS */ 3860 3111 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_CLEAR, 3861 3112 (0x1ff << (port*16))); 3862 3113 3863 - /* reset EMAC / BMAC and disable NIG interfaces */ 3114 + /* reset BigMac */ 3115 + REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, 3116 + (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)); 3117 + 3118 + /* disable nig ingress interface */ 3864 3119 NIG_WR(NIG_REG_BMAC0_IN_EN + port*4, 0); 3865 - NIG_WR(NIG_REG_BMAC0_OUT_EN + port*4, 0); 3866 - 3867 - NIG_WR(NIG_REG_NIG_EMAC0_EN + port*4, 0); 3868 3120 NIG_WR(NIG_REG_EMAC0_IN_EN + port*4, 0); 3869 - NIG_WR(NIG_REG_EGRESS_EMAC0_OUT_EN + port*4, 0); 3870 3121 3871 - NIG_WR(NIG_REG_EGRESS_DRAIN0_MODE + port*4, 1); 3122 + /* set link down */ 3123 + bp->link_up = 0; 3872 3124 } 3873 3125 3874 3126 #ifdef BNX2X_XGXS_LB ··· 3973 3177 bnx2x_panic(); 3974 3178 return -EBUSY; 3975 3179 } 3180 + 3976 3181 /* CID needs port number to be encoded int it */ 3977 3182 bp->spq_prod_bd->hdr.conn_and_cmd_data = 3978 3183 cpu_to_le32(((command << SPE_HDR_CMD_ID_SHIFT) | ··· 5132 4335 return; 5133 4336 5134 4337 if (atomic_read(&bp->intr_sem) != 0) 5135 - goto bnx2x_restart_timer; 4338 + goto timer_restart; 5136 4339 5137 4340 if (poll) { 5138 4341 struct bnx2x_fastpath *fp = &bp->fp[0]; ··· 5142 4345 rc = bnx2x_rx_int(fp, 1000); 5143 4346 } 5144 4347 5145 - if (!nomcp && (bp->bc_ver >= 0x040003)) { 4348 + if (!nomcp) { 5146 4349 int port = bp->port; 5147 4350 u32 drv_pulse; 5148 4351 u32 mcp_pulse; ··· 5151 4354 bp->fw_drv_pulse_wr_seq &= DRV_PULSE_SEQ_MASK; 5152 4355 /* TBD - add SYSTEM_TIME */ 5153 4356 drv_pulse = bp->fw_drv_pulse_wr_seq; 5154 - SHMEM_WR(bp, drv_fw_mb[port].drv_pulse_mb, drv_pulse); 4357 + SHMEM_WR(bp, func_mb[port].drv_pulse_mb, drv_pulse); 5155 4358 5156 - mcp_pulse = (SHMEM_RD(bp, drv_fw_mb[port].mcp_pulse_mb) & 4359 + mcp_pulse = (SHMEM_RD(bp, func_mb[port].mcp_pulse_mb) & 5157 4360 MCP_PULSE_SEQ_MASK); 5158 4361 /* The delta between driver pulse and mcp response 5159 4362 * should be 1 (before mcp response) or 0 (after mcp response) ··· 5167 4370 } 5168 4371 5169 4372 if (bp->stats_state == STATS_STATE_DISABLE) 5170 - goto bnx2x_restart_timer; 4373 + goto timer_restart; 5171 4374 5172 4375 bnx2x_update_stats(bp); 5173 4376 5174 - bnx2x_restart_timer: 4377 + timer_restart: 5175 4378 mod_timer(&bp->timer, jiffies + bp->current_interval); 5176 4379 } 5177 4380 ··· 6063 5266 if (mode & 0x1) { /* init common */ 6064 5267 DP(BNX2X_MSG_MCP, "starting common init func %d mode %x\n", 6065 5268 func, mode); 6066 - REG_WR(bp, MISC_REG_RESET_REG_1, 0xffffffff); 6067 - REG_WR(bp, MISC_REG_RESET_REG_2, 0xfffc); 5269 + REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 5270 + 0xffffffff); 5271 + REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 5272 + 0xfffc); 6068 5273 bnx2x_init_block(bp, MISC_COMMON_START, MISC_COMMON_END); 6069 5274 6070 5275 REG_WR(bp, MISC_REG_LCPLL_CTRL_REG_2, 0x100); ··· 6286 5487 enable_blocks_attention(bp); 6287 5488 /* enable_blocks_parity(bp); */ 6288 5489 5490 + switch (bp->board & SHARED_HW_CFG_BOARD_TYPE_MASK) { 5491 + case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G: 5492 + /* Fan failure is indicated by SPIO 5 */ 5493 + bnx2x_set_spio(bp, MISC_REGISTERS_SPIO_5, 5494 + MISC_REGISTERS_SPIO_INPUT_HI_Z); 5495 + 5496 + /* set to active low mode */ 5497 + val = REG_RD(bp, MISC_REG_SPIO_INT); 5498 + val |= ((1 << MISC_REGISTERS_SPIO_5) << 5499 + MISC_REGISTERS_SPIO_INT_OLD_SET_POS); 5500 + REG_WR(bp, MISC_REG_SPIO_INT, val); 5501 + 5502 + /* enable interrupt to signal the IGU */ 5503 + val = REG_RD(bp, MISC_REG_SPIO_EVENT_EN); 5504 + val |= (1 << MISC_REGISTERS_SPIO_5); 5505 + REG_WR(bp, MISC_REG_SPIO_EVENT_EN, val); 5506 + break; 5507 + 5508 + default: 5509 + break; 5510 + } 5511 + 6289 5512 } /* end of common init */ 6290 5513 6291 5514 /* per port init */ ··· 6467 5646 /* Port MCP comes here */ 6468 5647 /* Port DMAE comes here */ 6469 5648 5649 + switch (bp->board & SHARED_HW_CFG_BOARD_TYPE_MASK) { 5650 + case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G: 5651 + /* add SPIO 5 to group 0 */ 5652 + val = REG_RD(bp, MISC_REG_AEU_ENABLE1_FUNC_0_OUT_0); 5653 + val |= AEU_INPUTS_ATTN_BITS_SPIO5; 5654 + REG_WR(bp, MISC_REG_AEU_ENABLE1_FUNC_0_OUT_0, val); 5655 + break; 5656 + 5657 + default: 5658 + break; 5659 + } 5660 + 6470 5661 bnx2x_link_reset(bp); 6471 5662 6472 5663 /* Reset PCIE errors for debug */ ··· 6503 5670 port = bp->port; 6504 5671 6505 5672 bp->fw_drv_pulse_wr_seq = 6506 - (SHMEM_RD(bp, drv_fw_mb[port].drv_pulse_mb) & 5673 + (SHMEM_RD(bp, func_mb[port].drv_pulse_mb) & 6507 5674 DRV_PULSE_SEQ_MASK); 6508 - bp->fw_mb = SHMEM_RD(bp, drv_fw_mb[port].fw_mb_param); 5675 + bp->fw_mb = SHMEM_RD(bp, func_mb[port].fw_mb_param); 6509 5676 DP(BNX2X_MSG_MCP, "drv_pulse 0x%x fw_mb 0x%x\n", 6510 5677 bp->fw_drv_pulse_wr_seq, bp->fw_mb); 6511 5678 } else { ··· 6518 5685 /* send the MCP a request, block until there is a reply */ 6519 5686 static u32 bnx2x_fw_command(struct bnx2x *bp, u32 command) 6520 5687 { 6521 - u32 rc = 0; 6522 - u32 seq = ++bp->fw_seq; 6523 5688 int port = bp->port; 5689 + u32 seq = ++bp->fw_seq; 5690 + u32 rc = 0; 6524 5691 6525 - SHMEM_WR(bp, drv_fw_mb[port].drv_mb_header, command|seq); 6526 - DP(BNX2X_MSG_MCP, "wrote command (%x) to FW MB\n", command|seq); 5692 + SHMEM_WR(bp, func_mb[port].drv_mb_header, (command | seq)); 5693 + DP(BNX2X_MSG_MCP, "wrote command (%x) to FW MB\n", (command | seq)); 6527 5694 6528 5695 /* let the FW do it's magic ... */ 6529 5696 msleep(100); /* TBD */ ··· 6531 5698 if (CHIP_REV_IS_SLOW(bp)) 6532 5699 msleep(900); 6533 5700 6534 - rc = SHMEM_RD(bp, drv_fw_mb[port].fw_mb_header); 6535 - 5701 + rc = SHMEM_RD(bp, func_mb[port].fw_mb_header); 6536 5702 DP(BNX2X_MSG_MCP, "read (%x) seq is (%x) from FW MB\n", rc, seq); 6537 5703 6538 5704 /* is this a reply to our command? */ 6539 5705 if (seq == (rc & FW_MSG_SEQ_NUMBER_MASK)) { 6540 5706 rc &= FW_MSG_CODE_MASK; 5707 + 6541 5708 } else { 6542 5709 /* FW BUG! */ 6543 5710 BNX2X_ERR("FW failed to respond!\n"); 6544 5711 bnx2x_fw_dump(bp); 6545 5712 rc = 0; 6546 5713 } 5714 + 6547 5715 return rc; 6548 5716 } 6549 5717 ··· 7393 6559 SUPPORTED_100baseT_Half | 7394 6560 SUPPORTED_100baseT_Full | 7395 6561 SUPPORTED_1000baseT_Full | 7396 - SUPPORTED_2500baseT_Full | 6562 + SUPPORTED_2500baseX_Full | 7397 6563 SUPPORTED_TP | SUPPORTED_FIBRE | 7398 6564 SUPPORTED_Autoneg | 7399 6565 SUPPORTED_Pause | ··· 7406 6572 7407 6573 bp->phy_flags |= PHY_SGMII_FLAG; 7408 6574 7409 - bp->supported |= (/* SUPPORTED_10baseT_Half | 7410 - SUPPORTED_10baseT_Full | 7411 - SUPPORTED_100baseT_Half | 7412 - SUPPORTED_100baseT_Full |*/ 6575 + bp->supported |= (SUPPORTED_10baseT_Half | 6576 + SUPPORTED_10baseT_Full | 6577 + SUPPORTED_100baseT_Half | 6578 + SUPPORTED_100baseT_Full | 7413 6579 SUPPORTED_1000baseT_Full | 7414 6580 SUPPORTED_TP | SUPPORTED_FIBRE | 7415 6581 SUPPORTED_Autoneg | ··· 7445 6611 SUPPORTED_100baseT_Half | 7446 6612 SUPPORTED_100baseT_Full | 7447 6613 SUPPORTED_1000baseT_Full | 7448 - SUPPORTED_2500baseT_Full | 6614 + SUPPORTED_2500baseX_Full | 7449 6615 SUPPORTED_10000baseT_Full | 7450 6616 SUPPORTED_TP | SUPPORTED_FIBRE | 7451 6617 SUPPORTED_Autoneg | ··· 7454 6620 break; 7455 6621 7456 6622 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705: 7457 - case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706: 7458 - BNX2X_DEV_INFO("ext_phy_type 0x%x (8705/6)\n", 7459 - ext_phy_type); 6623 + BNX2X_DEV_INFO("ext_phy_type 0x%x (8705)\n", 6624 + ext_phy_type); 7460 6625 7461 6626 bp->supported |= (SUPPORTED_10000baseT_Full | 7462 6627 SUPPORTED_FIBRE | 6628 + SUPPORTED_Pause | 6629 + SUPPORTED_Asym_Pause); 6630 + break; 6631 + 6632 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706: 6633 + BNX2X_DEV_INFO("ext_phy_type 0x%x (8706)\n", 6634 + ext_phy_type); 6635 + 6636 + bp->supported |= (SUPPORTED_10000baseT_Full | 6637 + SUPPORTED_1000baseT_Full | 6638 + SUPPORTED_Autoneg | 6639 + SUPPORTED_FIBRE | 6640 + SUPPORTED_Pause | 6641 + SUPPORTED_Asym_Pause); 6642 + break; 6643 + 6644 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072: 6645 + BNX2X_DEV_INFO("ext_phy_type 0x%x (8072)\n", 6646 + ext_phy_type); 6647 + 6648 + bp->supported |= (SUPPORTED_10000baseT_Full | 6649 + SUPPORTED_1000baseT_Full | 6650 + SUPPORTED_FIBRE | 6651 + SUPPORTED_Autoneg | 6652 + SUPPORTED_Pause | 6653 + SUPPORTED_Asym_Pause); 6654 + break; 6655 + 6656 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101: 6657 + BNX2X_DEV_INFO("ext_phy_type 0x%x (SFX7101)\n", 6658 + ext_phy_type); 6659 + 6660 + bp->supported |= (SUPPORTED_10000baseT_Full | 6661 + SUPPORTED_TP | 6662 + SUPPORTED_Autoneg | 7463 6663 SUPPORTED_Pause | 7464 6664 SUPPORTED_Asym_Pause); 7465 6665 break; ··· 7550 6682 SUPPORTED_1000baseT_Full); 7551 6683 7552 6684 if (!(bp->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G)) 7553 - bp->supported &= ~SUPPORTED_2500baseT_Full; 6685 + bp->supported &= ~SUPPORTED_2500baseX_Full; 7554 6686 7555 6687 if (!(bp->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)) 7556 6688 bp->supported &= ~SUPPORTED_10000baseT_Full; ··· 7570 6702 bp->req_line_speed = 0; 7571 6703 bp->advertising = bp->supported; 7572 6704 } else { 7573 - u32 ext_phy_type; 7574 - 7575 - ext_phy_type = XGXS_EXT_PHY_TYPE(bp); 7576 - if ((ext_phy_type == 7577 - PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705) || 7578 - (ext_phy_type == 7579 - PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706)) { 6705 + if (XGXS_EXT_PHY_TYPE(bp) == 6706 + PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705) { 7580 6707 /* force 10G, no AN */ 7581 6708 bp->req_line_speed = SPEED_10000; 7582 6709 bp->advertising = ··· 7588 6725 break; 7589 6726 7590 6727 case PORT_FEATURE_LINK_SPEED_10M_FULL: 7591 - if (bp->speed_cap_mask & 7592 - PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_FULL) { 6728 + if (bp->supported & SUPPORTED_10baseT_Full) { 7593 6729 bp->req_line_speed = SPEED_10; 7594 6730 bp->advertising = (ADVERTISED_10baseT_Full | 7595 6731 ADVERTISED_TP); ··· 7602 6740 break; 7603 6741 7604 6742 case PORT_FEATURE_LINK_SPEED_10M_HALF: 7605 - if (bp->speed_cap_mask & 7606 - PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_HALF) { 6743 + if (bp->supported & SUPPORTED_10baseT_Half) { 7607 6744 bp->req_line_speed = SPEED_10; 7608 6745 bp->req_duplex = DUPLEX_HALF; 7609 6746 bp->advertising = (ADVERTISED_10baseT_Half | ··· 7617 6756 break; 7618 6757 7619 6758 case PORT_FEATURE_LINK_SPEED_100M_FULL: 7620 - if (bp->speed_cap_mask & 7621 - PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_FULL) { 6759 + if (bp->supported & SUPPORTED_100baseT_Full) { 7622 6760 bp->req_line_speed = SPEED_100; 7623 6761 bp->advertising = (ADVERTISED_100baseT_Full | 7624 6762 ADVERTISED_TP); ··· 7631 6771 break; 7632 6772 7633 6773 case PORT_FEATURE_LINK_SPEED_100M_HALF: 7634 - if (bp->speed_cap_mask & 7635 - PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_HALF) { 6774 + if (bp->supported & SUPPORTED_100baseT_Half) { 7636 6775 bp->req_line_speed = SPEED_100; 7637 6776 bp->req_duplex = DUPLEX_HALF; 7638 6777 bp->advertising = (ADVERTISED_100baseT_Half | ··· 7646 6787 break; 7647 6788 7648 6789 case PORT_FEATURE_LINK_SPEED_1G: 7649 - if (bp->speed_cap_mask & 7650 - PORT_HW_CFG_SPEED_CAPABILITY_D0_1G) { 6790 + if (bp->supported & SUPPORTED_1000baseT_Full) { 7651 6791 bp->req_line_speed = SPEED_1000; 7652 6792 bp->advertising = (ADVERTISED_1000baseT_Full | 7653 6793 ADVERTISED_TP); ··· 7660 6802 break; 7661 6803 7662 6804 case PORT_FEATURE_LINK_SPEED_2_5G: 7663 - if (bp->speed_cap_mask & 7664 - PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G) { 6805 + if (bp->supported & SUPPORTED_2500baseX_Full) { 7665 6806 bp->req_line_speed = SPEED_2500; 7666 - bp->advertising = (ADVERTISED_2500baseT_Full | 6807 + bp->advertising = (ADVERTISED_2500baseX_Full | 7667 6808 ADVERTISED_TP); 7668 6809 } else { 7669 6810 BNX2X_ERR("NVRAM config error. " ··· 7676 6819 case PORT_FEATURE_LINK_SPEED_10G_CX4: 7677 6820 case PORT_FEATURE_LINK_SPEED_10G_KX4: 7678 6821 case PORT_FEATURE_LINK_SPEED_10G_KR: 7679 - if (!(bp->phy_flags & PHY_XGXS_FLAG)) { 7680 - BNX2X_ERR("NVRAM config error. " 7681 - "Invalid link_config 0x%x" 7682 - " phy_flags 0x%x\n", 7683 - bp->link_config, bp->phy_flags); 7684 - return; 7685 - } 7686 - if (bp->speed_cap_mask & 7687 - PORT_HW_CFG_SPEED_CAPABILITY_D0_10G) { 6822 + if (bp->supported & SUPPORTED_10000baseT_Full) { 7688 6823 bp->req_line_speed = SPEED_10000; 7689 6824 bp->advertising = (ADVERTISED_10000baseT_Full | 7690 6825 ADVERTISED_FIBRE); ··· 7703 6854 7704 6855 bp->req_flow_ctrl = (bp->link_config & 7705 6856 PORT_FEATURE_FLOW_CONTROL_MASK); 7706 - /* Please refer to Table 28B-3 of the 802.3ab-1999 spec */ 7707 - switch (bp->req_flow_ctrl) { 7708 - case FLOW_CTRL_AUTO: 6857 + if ((bp->req_flow_ctrl == FLOW_CTRL_AUTO) && 6858 + (bp->supported & SUPPORTED_Autoneg)) 7709 6859 bp->req_autoneg |= AUTONEG_FLOW_CTRL; 7710 - if (bp->dev->mtu <= 4500) { 7711 - bp->pause_mode = PAUSE_BOTH; 7712 - bp->advertising |= (ADVERTISED_Pause | 7713 - ADVERTISED_Asym_Pause); 7714 - } else { 7715 - bp->pause_mode = PAUSE_ASYMMETRIC; 7716 - bp->advertising |= ADVERTISED_Asym_Pause; 7717 - } 7718 - break; 7719 6860 7720 - case FLOW_CTRL_TX: 7721 - bp->pause_mode = PAUSE_ASYMMETRIC; 7722 - bp->advertising |= ADVERTISED_Asym_Pause; 7723 - break; 7724 - 7725 - case FLOW_CTRL_RX: 7726 - case FLOW_CTRL_BOTH: 7727 - bp->pause_mode = PAUSE_BOTH; 7728 - bp->advertising |= (ADVERTISED_Pause | 7729 - ADVERTISED_Asym_Pause); 7730 - break; 7731 - 7732 - case FLOW_CTRL_NONE: 7733 - default: 7734 - bp->pause_mode = PAUSE_NONE; 7735 - bp->advertising &= ~(ADVERTISED_Pause | 7736 - ADVERTISED_Asym_Pause); 7737 - break; 7738 - } 7739 - BNX2X_DEV_INFO("req_autoneg 0x%x req_flow_ctrl 0x%x\n" 7740 - KERN_INFO " pause_mode %d advertising 0x%x\n", 7741 - bp->req_autoneg, bp->req_flow_ctrl, 7742 - bp->pause_mode, bp->advertising); 6861 + BNX2X_DEV_INFO("req_autoneg 0x%x req_flow_ctrl 0x%x" 6862 + " advertising 0x%x\n", 6863 + bp->req_autoneg, bp->req_flow_ctrl, bp->advertising); 7743 6864 } 7744 6865 7745 6866 static void bnx2x_get_hwinfo(struct bnx2x *bp) ··· 7742 6923 7743 6924 val = SHMEM_RD(bp, validity_map[port]); 7744 6925 if ((val & (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB)) 7745 - != (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB)) 7746 - BNX2X_ERR("MCP validity signature bad\n"); 6926 + != (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB)) 6927 + BNX2X_ERR("BAD MCP validity signature\n"); 7747 6928 7748 - bp->fw_seq = (SHMEM_RD(bp, drv_fw_mb[port].drv_mb_header) & 6929 + bp->fw_seq = (SHMEM_RD(bp, func_mb[port].drv_mb_header) & 7749 6930 DRV_MSG_SEQ_NUMBER_MASK); 7750 6931 7751 6932 bp->hw_config = SHMEM_RD(bp, dev_info.shared_hw_config.config); 7752 - 6933 + bp->board = SHMEM_RD(bp, dev_info.shared_hw_config.board); 7753 6934 bp->serdes_config = 7754 - SHMEM_RD(bp, dev_info.port_hw_config[bp->port].serdes_config); 6935 + SHMEM_RD(bp, dev_info.port_hw_config[port].serdes_config); 7755 6936 bp->lane_config = 7756 6937 SHMEM_RD(bp, dev_info.port_hw_config[port].lane_config); 7757 6938 bp->ext_phy_config = ··· 7764 6945 bp->link_config = 7765 6946 SHMEM_RD(bp, dev_info.port_feature_config[port].link_config); 7766 6947 7767 - BNX2X_DEV_INFO("hw_config (%08x) serdes_config (%08x)\n" 6948 + BNX2X_DEV_INFO("hw_config (%08x) board (%08x) serdes_config (%08x)\n" 7768 6949 KERN_INFO " lane_config (%08x) ext_phy_config (%08x)\n" 7769 6950 KERN_INFO " speed_cap_mask (%08x) link_config (%08x)" 7770 6951 " fw_seq (%08x)\n", 7771 - bp->hw_config, bp->serdes_config, bp->lane_config, 7772 - bp->ext_phy_config, bp->speed_cap_mask, 7773 - bp->link_config, bp->fw_seq); 6952 + bp->hw_config, bp->board, bp->serdes_config, 6953 + bp->lane_config, bp->ext_phy_config, 6954 + bp->speed_cap_mask, bp->link_config, bp->fw_seq); 7774 6955 7775 6956 switch_cfg = (bp->link_config & PORT_FEATURE_CONNECTED_SWITCH_MASK); 7776 6957 bnx2x_link_settings_supported(bp, switch_cfg); ··· 7824 7005 return; 7825 7006 7826 7007 set_mac: /* only supposed to happen on emulation/FPGA */ 7827 - BNX2X_ERR("warning constant MAC workaround active\n"); 7828 - bp->dev->dev_addr[0] = 0; 7829 - bp->dev->dev_addr[1] = 0x50; 7830 - bp->dev->dev_addr[2] = 0xc2; 7831 - bp->dev->dev_addr[3] = 0x2c; 7832 - bp->dev->dev_addr[4] = 0x71; 7833 - bp->dev->dev_addr[5] = port ? 0x0d : 0x0e; 7834 - 7008 + BNX2X_ERR("warning rendom MAC workaround active\n"); 7009 + random_ether_addr(bp->dev->dev_addr); 7835 7010 memcpy(bp->dev->perm_addr, bp->dev->dev_addr, 6); 7836 7011 7837 7012 } ··· 7852 7039 } 7853 7040 7854 7041 if (bp->phy_flags & PHY_XGXS_FLAG) { 7855 - cmd->port = PORT_FIBRE; 7856 - } else { 7042 + u32 ext_phy_type = XGXS_EXT_PHY_TYPE(bp); 7043 + 7044 + switch (ext_phy_type) { 7045 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT: 7046 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705: 7047 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706: 7048 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072: 7049 + cmd->port = PORT_FIBRE; 7050 + break; 7051 + 7052 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101: 7053 + cmd->port = PORT_TP; 7054 + break; 7055 + 7056 + default: 7057 + DP(NETIF_MSG_LINK, "BAD XGXS ext_phy_config 0x%x\n", 7058 + bp->ext_phy_config); 7059 + } 7060 + } else 7857 7061 cmd->port = PORT_TP; 7858 - } 7859 7062 7860 7063 cmd->phy_address = bp->phy_addr; 7861 7064 cmd->transceiver = XCVR_INTERNAL; 7862 7065 7863 - if (bp->req_autoneg & AUTONEG_SPEED) { 7066 + if (bp->req_autoneg & AUTONEG_SPEED) 7864 7067 cmd->autoneg = AUTONEG_ENABLE; 7865 - } else { 7068 + else 7866 7069 cmd->autoneg = AUTONEG_DISABLE; 7867 - } 7868 7070 7869 7071 cmd->maxtxpkt = 0; 7870 7072 cmd->maxrxpkt = 0; ··· 7910 7082 7911 7083 switch (cmd->port) { 7912 7084 case PORT_TP: 7913 - if (!(bp->supported & SUPPORTED_TP)) 7085 + if (!(bp->supported & SUPPORTED_TP)) { 7086 + DP(NETIF_MSG_LINK, "TP not supported\n"); 7914 7087 return -EINVAL; 7088 + } 7915 7089 7916 7090 if (bp->phy_flags & PHY_XGXS_FLAG) { 7917 7091 bnx2x_link_reset(bp); ··· 7923 7093 break; 7924 7094 7925 7095 case PORT_FIBRE: 7926 - if (!(bp->supported & SUPPORTED_FIBRE)) 7096 + if (!(bp->supported & SUPPORTED_FIBRE)) { 7097 + DP(NETIF_MSG_LINK, "FIBRE not supported\n"); 7927 7098 return -EINVAL; 7099 + } 7928 7100 7929 7101 if (!(bp->phy_flags & PHY_XGXS_FLAG)) { 7930 7102 bnx2x_link_reset(bp); ··· 7936 7104 break; 7937 7105 7938 7106 default: 7107 + DP(NETIF_MSG_LINK, "Unknown port type\n"); 7939 7108 return -EINVAL; 7940 7109 } 7941 7110 7942 7111 if (cmd->autoneg == AUTONEG_ENABLE) { 7943 - if (!(bp->supported & SUPPORTED_Autoneg)) 7112 + if (!(bp->supported & SUPPORTED_Autoneg)) { 7113 + DP(NETIF_MSG_LINK, "Aotoneg not supported\n"); 7944 7114 return -EINVAL; 7115 + } 7945 7116 7946 7117 /* advertise the requested speed and duplex if supported */ 7947 7118 cmd->advertising &= bp->supported; ··· 7959 7124 switch (cmd->speed) { 7960 7125 case SPEED_10: 7961 7126 if (cmd->duplex == DUPLEX_FULL) { 7962 - if (!(bp->supported & SUPPORTED_10baseT_Full)) 7127 + if (!(bp->supported & 7128 + SUPPORTED_10baseT_Full)) { 7129 + DP(NETIF_MSG_LINK, 7130 + "10M full not supported\n"); 7963 7131 return -EINVAL; 7132 + } 7964 7133 7965 7134 advertising = (ADVERTISED_10baseT_Full | 7966 7135 ADVERTISED_TP); 7967 7136 } else { 7968 - if (!(bp->supported & SUPPORTED_10baseT_Half)) 7137 + if (!(bp->supported & 7138 + SUPPORTED_10baseT_Half)) { 7139 + DP(NETIF_MSG_LINK, 7140 + "10M half not supported\n"); 7969 7141 return -EINVAL; 7142 + } 7970 7143 7971 7144 advertising = (ADVERTISED_10baseT_Half | 7972 7145 ADVERTISED_TP); ··· 7984 7141 case SPEED_100: 7985 7142 if (cmd->duplex == DUPLEX_FULL) { 7986 7143 if (!(bp->supported & 7987 - SUPPORTED_100baseT_Full)) 7144 + SUPPORTED_100baseT_Full)) { 7145 + DP(NETIF_MSG_LINK, 7146 + "100M full not supported\n"); 7988 7147 return -EINVAL; 7148 + } 7989 7149 7990 7150 advertising = (ADVERTISED_100baseT_Full | 7991 7151 ADVERTISED_TP); 7992 7152 } else { 7993 7153 if (!(bp->supported & 7994 - SUPPORTED_100baseT_Half)) 7154 + SUPPORTED_100baseT_Half)) { 7155 + DP(NETIF_MSG_LINK, 7156 + "100M half not supported\n"); 7995 7157 return -EINVAL; 7158 + } 7996 7159 7997 7160 advertising = (ADVERTISED_100baseT_Half | 7998 7161 ADVERTISED_TP); ··· 8006 7157 break; 8007 7158 8008 7159 case SPEED_1000: 8009 - if (cmd->duplex != DUPLEX_FULL) 7160 + if (cmd->duplex != DUPLEX_FULL) { 7161 + DP(NETIF_MSG_LINK, "1G half not supported\n"); 8010 7162 return -EINVAL; 7163 + } 8011 7164 8012 - if (!(bp->supported & SUPPORTED_1000baseT_Full)) 7165 + if (!(bp->supported & SUPPORTED_1000baseT_Full)) { 7166 + DP(NETIF_MSG_LINK, "1G full not supported\n"); 8013 7167 return -EINVAL; 7168 + } 8014 7169 8015 7170 advertising = (ADVERTISED_1000baseT_Full | 8016 7171 ADVERTISED_TP); 8017 7172 break; 8018 7173 8019 7174 case SPEED_2500: 8020 - if (cmd->duplex != DUPLEX_FULL) 7175 + if (cmd->duplex != DUPLEX_FULL) { 7176 + DP(NETIF_MSG_LINK, 7177 + "2.5G half not supported\n"); 8021 7178 return -EINVAL; 7179 + } 8022 7180 8023 - if (!(bp->supported & SUPPORTED_2500baseT_Full)) 7181 + if (!(bp->supported & SUPPORTED_2500baseX_Full)) { 7182 + DP(NETIF_MSG_LINK, 7183 + "2.5G full not supported\n"); 8024 7184 return -EINVAL; 7185 + } 8025 7186 8026 - advertising = (ADVERTISED_2500baseT_Full | 7187 + advertising = (ADVERTISED_2500baseX_Full | 8027 7188 ADVERTISED_TP); 8028 7189 break; 8029 7190 8030 7191 case SPEED_10000: 8031 - if (cmd->duplex != DUPLEX_FULL) 7192 + if (cmd->duplex != DUPLEX_FULL) { 7193 + DP(NETIF_MSG_LINK, "10G half not supported\n"); 8032 7194 return -EINVAL; 7195 + } 8033 7196 8034 - if (!(bp->supported & SUPPORTED_10000baseT_Full)) 7197 + if (!(bp->supported & SUPPORTED_10000baseT_Full)) { 7198 + DP(NETIF_MSG_LINK, "10G full not supported\n"); 8035 7199 return -EINVAL; 7200 + } 8036 7201 8037 7202 advertising = (ADVERTISED_10000baseT_Full | 8038 7203 ADVERTISED_FIBRE); 8039 7204 break; 8040 7205 8041 7206 default: 7207 + DP(NETIF_MSG_LINK, "Unsupported speed\n"); 8042 7208 return -EINVAL; 8043 7209 } 8044 7210 ··· 8253 7389 static int bnx2x_nvram_read_dword(struct bnx2x *bp, u32 offset, u32 *ret_val, 8254 7390 u32 cmd_flags) 8255 7391 { 8256 - int rc; 8257 - int count, i; 7392 + int count, i, rc; 8258 7393 u32 val; 8259 7394 8260 7395 /* build the command word */ ··· 8373 7510 static int bnx2x_nvram_write_dword(struct bnx2x *bp, u32 offset, u32 val, 8374 7511 u32 cmd_flags) 8375 7512 { 8376 - int rc; 8377 - int count, i; 7513 + int count, i, rc; 8378 7514 8379 7515 /* build the command word */ 8380 7516 cmd_flags |= MCPR_NVM_COMMAND_DOIT | MCPR_NVM_COMMAND_WR; ··· 8410 7548 return rc; 8411 7549 } 8412 7550 8413 - #define BYTE_OFFSET(offset) (8 * (offset & 0x03)) 7551 + #define BYTE_OFFSET(offset) (8 * (offset & 0x03)) 8414 7552 8415 7553 static int bnx2x_nvram_write1(struct bnx2x *bp, u32 offset, u8 *data_buf, 8416 7554 int buf_size) ··· 8641 7779 DP_LEVEL " autoneg %d rx_pause %d tx_pause %d\n", 8642 7780 epause->cmd, epause->autoneg, epause->rx_pause, epause->tx_pause); 8643 7781 8644 - bp->req_flow_ctrl = FLOW_CTRL_AUTO; 8645 7782 if (epause->autoneg) { 8646 - bp->req_autoneg |= AUTONEG_FLOW_CTRL; 8647 - if (bp->dev->mtu <= 4500) { 8648 - bp->pause_mode = PAUSE_BOTH; 8649 - bp->advertising |= (ADVERTISED_Pause | 8650 - ADVERTISED_Asym_Pause); 8651 - } else { 8652 - bp->pause_mode = PAUSE_ASYMMETRIC; 8653 - bp->advertising |= ADVERTISED_Asym_Pause; 7783 + if (!(bp->supported & SUPPORTED_Autoneg)) { 7784 + DP(NETIF_MSG_LINK, "Aotoneg not supported\n"); 7785 + return -EINVAL; 8654 7786 } 8655 7787 8656 - } else { 7788 + bp->req_autoneg |= AUTONEG_FLOW_CTRL; 7789 + } else 8657 7790 bp->req_autoneg &= ~AUTONEG_FLOW_CTRL; 8658 7791 8659 - if (epause->rx_pause) 8660 - bp->req_flow_ctrl |= FLOW_CTRL_RX; 8661 - if (epause->tx_pause) 8662 - bp->req_flow_ctrl |= FLOW_CTRL_TX; 7792 + bp->req_flow_ctrl = FLOW_CTRL_AUTO; 8663 7793 8664 - switch (bp->req_flow_ctrl) { 8665 - case FLOW_CTRL_AUTO: 8666 - bp->req_flow_ctrl = FLOW_CTRL_NONE; 8667 - bp->pause_mode = PAUSE_NONE; 8668 - bp->advertising &= ~(ADVERTISED_Pause | 8669 - ADVERTISED_Asym_Pause); 8670 - break; 7794 + if (epause->rx_pause) 7795 + bp->req_flow_ctrl |= FLOW_CTRL_RX; 7796 + if (epause->tx_pause) 7797 + bp->req_flow_ctrl |= FLOW_CTRL_TX; 8671 7798 8672 - case FLOW_CTRL_TX: 8673 - bp->pause_mode = PAUSE_ASYMMETRIC; 8674 - bp->advertising |= ADVERTISED_Asym_Pause; 8675 - break; 7799 + if (!(bp->req_autoneg & AUTONEG_FLOW_CTRL) && 7800 + (bp->req_flow_ctrl == FLOW_CTRL_AUTO)) 7801 + bp->req_flow_ctrl = FLOW_CTRL_NONE; 8676 7802 8677 - case FLOW_CTRL_RX: 8678 - case FLOW_CTRL_BOTH: 8679 - bp->pause_mode = PAUSE_BOTH; 8680 - bp->advertising |= (ADVERTISED_Pause | 8681 - ADVERTISED_Asym_Pause); 8682 - break; 8683 - } 8684 - } 8685 - 8686 - DP(NETIF_MSG_LINK, "req_autoneg 0x%x req_flow_ctrl 0x%x\n" 8687 - DP_LEVEL " pause_mode %d advertising 0x%x\n", 8688 - bp->req_autoneg, bp->req_flow_ctrl, bp->pause_mode, 8689 - bp->advertising); 7803 + DP(NETIF_MSG_LINK, "req_autoneg 0x%x req_flow_ctrl 0x%x\n", 7804 + bp->req_autoneg, bp->req_flow_ctrl); 8690 7805 8691 7806 bnx2x_stop_stats(bp); 8692 7807 bnx2x_link_initialize(bp);
+18 -16
drivers/net/bnx2x.h
··· 24 24 #define BNX2X_MSG_STATS 0x20000 /* was: NETIF_MSG_TIMER */ 25 25 #define NETIF_MSG_NVM 0x40000 /* was: NETIF_MSG_HW */ 26 26 #define NETIF_MSG_DMAE 0x80000 /* was: NETIF_MSG_HW */ 27 + #define BNX2X_MSG_SP 0x100000 /* was: NETIF_MSG_INTR */ 28 + #define BNX2X_MSG_FP 0x200000 /* was: NETIF_MSG_INTR */ 27 29 28 30 #define DP_LEVEL KERN_NOTICE /* was: KERN_DEBUG */ 29 31 ··· 39 37 /* for errors (never masked) */ 40 38 #define BNX2X_ERR(__fmt, __args...) do { \ 41 39 printk(KERN_ERR "[%s:%d(%s)]" __fmt, __FUNCTION__, \ 40 + __LINE__, bp->dev?(bp->dev->name):"?", ##__args); \ 41 + } while (0) 42 + 43 + /* for logging (never masked) */ 44 + #define BNX2X_LOG(__fmt, __args...) do { \ 45 + printk(KERN_NOTICE "[%s:%d(%s)]" __fmt, __FUNCTION__, \ 42 46 __LINE__, bp->dev?(bp->dev->name):"?", ##__args); \ 43 47 } while (0) 44 48 ··· 582 574 u32 fw_mb; 583 575 584 576 u32 hw_config; 585 - u32 serdes_config; 577 + u32 board; 578 + u32 serdes_config; 586 579 u32 lane_config; 587 580 u32 ext_phy_config; 588 581 #define XGXS_EXT_PHY_TYPE(bp) (bp->ext_phy_config & \ ··· 604 595 u8 tx_lane_swap; 605 596 606 597 u8 link_up; 598 + u8 phy_link_up; 607 599 608 600 u32 supported; 609 601 /* link settings - missing defines */ 610 602 #define SUPPORTED_2500baseT_Full (1 << 15) 611 - #define SUPPORTED_CX4 (1 << 16) 612 603 613 604 u32 phy_flags; 614 605 /*#define PHY_SERDES_FLAG 0x1*/ ··· 653 644 #define FLOW_CTRL_BOTH PORT_FEATURE_FLOW_CONTROL_BOTH 654 645 #define FLOW_CTRL_NONE PORT_FEATURE_FLOW_CONTROL_NONE 655 646 656 - u32 pause_mode; 657 - #define PAUSE_NONE 0 658 - #define PAUSE_SYMMETRIC 1 659 - #define PAUSE_ASYMMETRIC 2 660 - #define PAUSE_BOTH 3 661 - 662 647 u32 advertising; 663 648 /* link settings - missing defines */ 664 649 #define ADVERTISED_2500baseT_Full (1 << 15) 665 - #define ADVERTISED_CX4 (1 << 16) 666 650 667 651 u32 link_status; 668 652 u32 line_speed; ··· 668 666 #define NVRAM_1MB_SIZE 0x20000 /* 1M bit in bytes */ 669 667 #define NVRAM_TIMEOUT_COUNT 30000 670 668 #define NVRAM_PAGE_SIZE 256 669 + 670 + u8 wol; 671 671 672 672 int rx_ring_size; 673 673 ··· 722 718 #endif 723 719 724 720 char *name; 725 - u16 bus_speed_mhz; 726 - u8 wol; 727 - u8 pad; 728 721 729 722 /* used to synchronize stats collecting */ 730 723 int stats_state; ··· 874 873 #define PCICFG_LINK_SPEED 0xf0000 875 874 #define PCICFG_LINK_SPEED_SHIFT 16 876 875 876 + #define BMAC_CONTROL_RX_ENABLE 2 877 877 /* stuff added to make the code fit 80Col */ 878 878 879 879 #define TPA_TYPE_START ETH_FAST_PATH_RX_CQE_START_FLG ··· 946 944 #define LINK_16GTFD LINK_STATUS_SPEED_AND_DUPLEX_16GTFD 947 945 #define LINK_16GXFD LINK_STATUS_SPEED_AND_DUPLEX_16GXFD 948 946 949 - #define NIG_STATUS_INTERRUPT_XGXS0_LINK10G \ 947 + #define NIG_STATUS_XGXS0_LINK10G \ 950 948 NIG_STATUS_INTERRUPT_PORT0_REG_STATUS_XGXS0_LINK10G 951 - #define NIG_XGXS0_LINK_STATUS \ 949 + #define NIG_STATUS_XGXS0_LINK_STATUS \ 952 950 NIG_STATUS_INTERRUPT_PORT0_REG_STATUS_XGXS0_LINK_STATUS 953 - #define NIG_XGXS0_LINK_STATUS_SIZE \ 951 + #define NIG_STATUS_XGXS0_LINK_STATUS_SIZE \ 954 952 NIG_STATUS_INTERRUPT_PORT0_REG_STATUS_XGXS0_LINK_STATUS_SIZE 955 - #define NIG_SERDES0_LINK_STATUS \ 953 + #define NIG_STATUS_SERDES0_LINK_STATUS \ 956 954 NIG_STATUS_INTERRUPT_PORT0_REG_STATUS_SERDES0_LINK_STATUS 957 955 #define NIG_MASK_MI_INT \ 958 956 NIG_MASK_INTERRUPT_PORT0_REG_MASK_EMAC0_MISC_MI_INT
+1 -1
drivers/net/bnx2x_fw_defs.h
··· 1 1 /* bnx2x_fw_defs.h: Broadcom Everest network driver. 2 2 * 3 - * Copyright (c) 2007 Broadcom Corporation 3 + * Copyright (c) 2007-2008 Broadcom Corporation 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify 6 6 * it under the terms of the GNU General Public License as published by
+231 -197
drivers/net/bnx2x_hsi.h
··· 1 1 /* bnx2x_hsi.h: Broadcom Everest network driver. 2 2 * 3 - * Copyright (c) 2007 Broadcom Corporation 3 + * Copyright (c) 2007-2008 Broadcom Corporation 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify 6 6 * it under the terms of the GNU General Public License as published by ··· 8 8 */ 9 9 10 10 11 - #define FUNC_0 0 12 - #define FUNC_1 1 13 - #define FUNC_MAX 2 14 - 15 - 16 - /* This value (in milliseconds) determines the frequency of the driver 17 - * issuing the PULSE message code. The firmware monitors this periodic 18 - * pulse to determine when to switch to an OS-absent mode. */ 19 - #define DRV_PULSE_PERIOD_MS 250 20 - 21 - /* This value (in milliseconds) determines how long the driver should 22 - * wait for an acknowledgement from the firmware before timing out. Once 23 - * the firmware has timed out, the driver will assume there is no firmware 24 - * running and there won't be any firmware-driver synchronization during a 25 - * driver reset. */ 26 - #define FW_ACK_TIME_OUT_MS 5000 27 - 28 - #define FW_ACK_POLL_TIME_MS 1 29 - 30 - #define FW_ACK_NUM_OF_POLL (FW_ACK_TIME_OUT_MS/FW_ACK_POLL_TIME_MS) 31 - 32 - /* LED Blink rate that will achieve ~15.9Hz */ 33 - #define LED_BLINK_RATE_VAL 480 34 - 35 - /**************************************************************************** 36 - * Driver <-> FW Mailbox * 37 - ****************************************************************************/ 38 - struct drv_fw_mb { 39 - u32 drv_mb_header; 40 - #define DRV_MSG_CODE_MASK 0xffff0000 41 - #define DRV_MSG_CODE_LOAD_REQ 0x10000000 42 - #define DRV_MSG_CODE_LOAD_DONE 0x11000000 43 - #define DRV_MSG_CODE_UNLOAD_REQ_WOL_EN 0x20000000 44 - #define DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS 0x20010000 45 - #define DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP 0x20020000 46 - #define DRV_MSG_CODE_UNLOAD_DONE 0x21000000 47 - #define DRV_MSG_CODE_DIAG_ENTER_REQ 0x50000000 48 - #define DRV_MSG_CODE_DIAG_EXIT_REQ 0x60000000 49 - #define DRV_MSG_CODE_VALIDATE_KEY 0x70000000 50 - #define DRV_MSG_CODE_GET_CURR_KEY 0x80000000 51 - #define DRV_MSG_CODE_GET_UPGRADE_KEY 0x81000000 52 - #define DRV_MSG_CODE_GET_MANUF_KEY 0x82000000 53 - #define DRV_MSG_CODE_LOAD_L2B_PRAM 0x90000000 54 - 55 - #define DRV_MSG_SEQ_NUMBER_MASK 0x0000ffff 56 - 57 - u32 drv_mb_param; 58 - 59 - u32 fw_mb_header; 60 - #define FW_MSG_CODE_MASK 0xffff0000 61 - #define FW_MSG_CODE_DRV_LOAD_COMMON 0x11000000 62 - #define FW_MSG_CODE_DRV_LOAD_PORT 0x12000000 63 - #define FW_MSG_CODE_DRV_LOAD_REFUSED 0x13000000 64 - #define FW_MSG_CODE_DRV_LOAD_DONE 0x14000000 65 - #define FW_MSG_CODE_DRV_UNLOAD_COMMON 0x21000000 66 - #define FW_MSG_CODE_DRV_UNLOAD_PORT 0x22000000 67 - #define FW_MSG_CODE_DRV_UNLOAD_DONE 0x23000000 68 - #define FW_MSG_CODE_DIAG_ENTER_DONE 0x50000000 69 - #define FW_MSG_CODE_DIAG_REFUSE 0x51000000 70 - #define FW_MSG_CODE_VALIDATE_KEY_SUCCESS 0x70000000 71 - #define FW_MSG_CODE_VALIDATE_KEY_FAILURE 0x71000000 72 - #define FW_MSG_CODE_GET_KEY_DONE 0x80000000 73 - #define FW_MSG_CODE_NO_KEY 0x8f000000 74 - #define FW_MSG_CODE_LIC_INFO_NOT_READY 0x8f800000 75 - #define FW_MSG_CODE_L2B_PRAM_LOADED 0x90000000 76 - #define FW_MSG_CODE_L2B_PRAM_T_LOAD_FAILURE 0x91000000 77 - #define FW_MSG_CODE_L2B_PRAM_C_LOAD_FAILURE 0x92000000 78 - #define FW_MSG_CODE_L2B_PRAM_X_LOAD_FAILURE 0x93000000 79 - #define FW_MSG_CODE_L2B_PRAM_U_LOAD_FAILURE 0x94000000 80 - 81 - #define FW_MSG_SEQ_NUMBER_MASK 0x0000ffff 82 - 83 - u32 fw_mb_param; 84 - 85 - u32 link_status; 86 - /* Driver should update this field on any link change event */ 87 - 88 - #define LINK_STATUS_LINK_FLAG_MASK 0x00000001 89 - #define LINK_STATUS_LINK_UP 0x00000001 90 - #define LINK_STATUS_SPEED_AND_DUPLEX_MASK 0x0000001E 91 - #define LINK_STATUS_SPEED_AND_DUPLEX_AN_NOT_COMPLETE (0<<1) 92 - #define LINK_STATUS_SPEED_AND_DUPLEX_10THD (1<<1) 93 - #define LINK_STATUS_SPEED_AND_DUPLEX_10TFD (2<<1) 94 - #define LINK_STATUS_SPEED_AND_DUPLEX_100TXHD (3<<1) 95 - #define LINK_STATUS_SPEED_AND_DUPLEX_100T4 (4<<1) 96 - #define LINK_STATUS_SPEED_AND_DUPLEX_100TXFD (5<<1) 97 - #define LINK_STATUS_SPEED_AND_DUPLEX_1000THD (6<<1) 98 - #define LINK_STATUS_SPEED_AND_DUPLEX_1000TFD (7<<1) 99 - #define LINK_STATUS_SPEED_AND_DUPLEX_1000XFD (7<<1) 100 - #define LINK_STATUS_SPEED_AND_DUPLEX_2500THD (8<<1) 101 - #define LINK_STATUS_SPEED_AND_DUPLEX_2500TFD (9<<1) 102 - #define LINK_STATUS_SPEED_AND_DUPLEX_2500XFD (9<<1) 103 - #define LINK_STATUS_SPEED_AND_DUPLEX_10GTFD (10<<1) 104 - #define LINK_STATUS_SPEED_AND_DUPLEX_10GXFD (10<<1) 105 - #define LINK_STATUS_SPEED_AND_DUPLEX_12GTFD (11<<1) 106 - #define LINK_STATUS_SPEED_AND_DUPLEX_12GXFD (11<<1) 107 - #define LINK_STATUS_SPEED_AND_DUPLEX_12_5GTFD (12<<1) 108 - #define LINK_STATUS_SPEED_AND_DUPLEX_12_5GXFD (12<<1) 109 - #define LINK_STATUS_SPEED_AND_DUPLEX_13GTFD (13<<1) 110 - #define LINK_STATUS_SPEED_AND_DUPLEX_13GXFD (13<<1) 111 - #define LINK_STATUS_SPEED_AND_DUPLEX_15GTFD (14<<1) 112 - #define LINK_STATUS_SPEED_AND_DUPLEX_15GXFD (14<<1) 113 - #define LINK_STATUS_SPEED_AND_DUPLEX_16GTFD (15<<1) 114 - #define LINK_STATUS_SPEED_AND_DUPLEX_16GXFD (15<<1) 115 - 116 - #define LINK_STATUS_AUTO_NEGOTIATE_FLAG_MASK 0x00000020 117 - #define LINK_STATUS_AUTO_NEGOTIATE_ENABLED 0x00000020 118 - 119 - #define LINK_STATUS_AUTO_NEGOTIATE_COMPLETE 0x00000040 120 - #define LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK 0x00000080 121 - #define LINK_STATUS_PARALLEL_DETECTION_USED 0x00000080 122 - 123 - #define LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE 0x00000200 124 - #define LINK_STATUS_LINK_PARTNER_1000THD_CAPABLE 0x00000400 125 - #define LINK_STATUS_LINK_PARTNER_100T4_CAPABLE 0x00000800 126 - #define LINK_STATUS_LINK_PARTNER_100TXFD_CAPABLE 0x00001000 127 - #define LINK_STATUS_LINK_PARTNER_100TXHD_CAPABLE 0x00002000 128 - #define LINK_STATUS_LINK_PARTNER_10TFD_CAPABLE 0x00004000 129 - #define LINK_STATUS_LINK_PARTNER_10THD_CAPABLE 0x00008000 130 - 131 - #define LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK 0x00010000 132 - #define LINK_STATUS_TX_FLOW_CONTROL_ENABLED 0x00010000 133 - 134 - #define LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK 0x00020000 135 - #define LINK_STATUS_RX_FLOW_CONTROL_ENABLED 0x00020000 136 - 137 - #define LINK_STATUS_LINK_PARTNER_FLOW_CONTROL_MASK 0x000C0000 138 - #define LINK_STATUS_LINK_PARTNER_NOT_PAUSE_CAPABLE (0<<18) 139 - #define LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE (1<<18) 140 - #define LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE (2<<18) 141 - #define LINK_STATUS_LINK_PARTNER_BOTH_PAUSE (3<<18) 142 - 143 - #define LINK_STATUS_SERDES_LINK 0x00100000 144 - 145 - #define LINK_STATUS_LINK_PARTNER_2500XFD_CAPABLE 0x00200000 146 - #define LINK_STATUS_LINK_PARTNER_2500XHD_CAPABLE 0x00400000 147 - #define LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE 0x00800000 148 - #define LINK_STATUS_LINK_PARTNER_12GXFD_CAPABLE 0x01000000 149 - #define LINK_STATUS_LINK_PARTNER_12_5GXFD_CAPABLE 0x02000000 150 - #define LINK_STATUS_LINK_PARTNER_13GXFD_CAPABLE 0x04000000 151 - #define LINK_STATUS_LINK_PARTNER_15GXFD_CAPABLE 0x08000000 152 - #define LINK_STATUS_LINK_PARTNER_16GXFD_CAPABLE 0x10000000 153 - 154 - u32 drv_pulse_mb; 155 - #define DRV_PULSE_SEQ_MASK 0x00007fff 156 - #define DRV_PULSE_SYSTEM_TIME_MASK 0xffff0000 157 - /* The system time is in the format of 158 - * (year-2001)*12*32 + month*32 + day. */ 159 - #define DRV_PULSE_ALWAYS_ALIVE 0x00008000 160 - /* Indicate to the firmware not to go into the 161 - * OS-absent when it is not getting driver pulse. 162 - * This is used for debugging as well for PXE(MBA). */ 163 - 164 - u32 mcp_pulse_mb; 165 - #define MCP_PULSE_SEQ_MASK 0x00007fff 166 - #define MCP_PULSE_ALWAYS_ALIVE 0x00008000 167 - /* Indicates to the driver not to assert due to lack 168 - * of MCP response */ 169 - #define MCP_EVENT_MASK 0xffff0000 170 - #define MCP_EVENT_OTHER_DRIVER_RESET_REQ 0x00010000 171 - 172 - }; 173 - 11 + #define PORT_0 0 12 + #define PORT_1 1 13 + #define PORT_MAX 2 174 14 175 15 /**************************************************************************** 176 16 * Shared HW configuration * ··· 89 249 #define SHARED_HW_CFG_SMBUS_TIMING_100KHZ 0x00000000 90 250 #define SHARED_HW_CFG_SMBUS_TIMING_400KHZ 0x00001000 91 251 92 - #define SHARED_HW_CFG_HIDE_FUNC1 0x00002000 252 + #define SHARED_HW_CFG_HIDE_PORT1 0x00002000 93 253 94 254 u32 power_dissipated; /* 0x11c */ 95 255 #define SHARED_HW_CFG_POWER_DIS_CMN_MASK 0xff000000 ··· 130 290 #define SHARED_HW_CFG_BOARD_TYPE_BCM957710T1015G 0x00000006 131 291 #define SHARED_HW_CFG_BOARD_TYPE_BCM957710A1020G 0x00000007 132 292 #define SHARED_HW_CFG_BOARD_TYPE_BCM957710T1003G 0x00000008 293 + #define SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G 0x00000009 294 + #define SHARED_HW_CFG_BOARD_TYPE_BCM957710A1021G 0x0000000a 133 295 134 296 #define SHARED_HW_CFG_BOARD_VER_MASK 0xffff0000 135 297 #define SHARED_HW_CFG_BOARD_VER_SHIFT 16 ··· 146 304 147 305 }; 148 306 307 + 149 308 /**************************************************************************** 150 309 * Port HW configuration * 151 310 ****************************************************************************/ 152 - struct port_hw_cfg { /* function 0: 0x12c-0x2bb, function 1: 0x2bc-0x44b */ 311 + struct port_hw_cfg { /* port 0: 0x12c port 1: 0x2bc */ 153 312 154 - /* Fields below are port specific (in anticipation of dual port 155 - devices */ 156 313 u32 pci_id; 157 314 #define PORT_HW_CFG_PCI_VENDOR_ID_MASK 0xffff0000 158 315 #define PORT_HW_CFG_PCI_DEVICE_ID_MASK 0x0000ffff ··· 261 420 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706 0x00000500 262 421 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8276 0x00000600 263 422 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481 0x00000700 423 + #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101 0x00000800 424 + #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE 0x0000fd00 264 425 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN 0x0000ff00 265 426 266 427 #define PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK 0x000000ff ··· 305 462 306 463 }; 307 464 465 + 308 466 /**************************************************************************** 309 467 * Shared Feature configuration * 310 468 ****************************************************************************/ 311 469 struct shared_feat_cfg { /* NVRAM Offset */ 312 - u32 bmc_common; /* 0x450 */ 470 + 471 + u32 config; /* 0x450 */ 313 472 #define SHARED_FEATURE_BMC_ECHO_MODE_EN 0x00000001 314 473 315 474 }; ··· 320 475 /**************************************************************************** 321 476 * Port Feature configuration * 322 477 ****************************************************************************/ 323 - struct port_feat_cfg { /* function 0: 0x454-0x4c7, function 1: 0x4c8-0x53b */ 478 + struct port_feat_cfg { /* port 0: 0x454 port 1: 0x4c8 */ 479 + 324 480 u32 config; 325 481 #define PORT_FEATURE_BAR1_SIZE_MASK 0x0000000f 326 482 #define PORT_FEATURE_BAR1_SIZE_SHIFT 0 ··· 455 609 #define PORT_FEATURE_SMBUS_ADDR_MASK 0x000000fe 456 610 #define PORT_FEATURE_SMBUS_ADDR_SHIFT 1 457 611 458 - u32 iscsib_boot_cfg; 459 - #define PORT_FEATURE_ISCSIB_SKIP_TARGET_BOOT 0x00000001 612 + u32 reserved1; 460 613 461 614 u32 link_config; /* Used as HW defaults for the driver */ 462 615 #define PORT_FEATURE_CONNECTED_SWITCH_MASK 0x03000000 ··· 502 657 }; 503 658 504 659 660 + /***************************************************************************** 661 + * Device Information * 662 + *****************************************************************************/ 663 + struct dev_info { /* size */ 664 + 665 + u32 bc_rev; /* 8 bits each: major, minor, build */ /* 4 */ 666 + 667 + struct shared_hw_cfg shared_hw_config; /* 40 */ 668 + 669 + struct port_hw_cfg port_hw_config[PORT_MAX]; /* 400*2=800 */ 670 + 671 + struct shared_feat_cfg shared_feature_config; /* 4 */ 672 + 673 + struct port_feat_cfg port_feature_config[PORT_MAX]; /* 116*2=232 */ 674 + 675 + }; 676 + 677 + 678 + #define FUNC_0 0 679 + #define FUNC_1 1 680 + #define E1_FUNC_MAX 2 681 + #define FUNC_MAX E1_FUNC_MAX 682 + 683 + 684 + /* This value (in milliseconds) determines the frequency of the driver 685 + * issuing the PULSE message code. The firmware monitors this periodic 686 + * pulse to determine when to switch to an OS-absent mode. */ 687 + #define DRV_PULSE_PERIOD_MS 250 688 + 689 + /* This value (in milliseconds) determines how long the driver should 690 + * wait for an acknowledgement from the firmware before timing out. Once 691 + * the firmware has timed out, the driver will assume there is no firmware 692 + * running and there won't be any firmware-driver synchronization during a 693 + * driver reset. */ 694 + #define FW_ACK_TIME_OUT_MS 5000 695 + 696 + #define FW_ACK_POLL_TIME_MS 1 697 + 698 + #define FW_ACK_NUM_OF_POLL (FW_ACK_TIME_OUT_MS/FW_ACK_POLL_TIME_MS) 699 + 700 + /* LED Blink rate that will achieve ~15.9Hz */ 701 + #define LED_BLINK_RATE_VAL 480 702 + 505 703 /**************************************************************************** 506 - * Device Information * 704 + * Driver <-> FW Mailbox * 507 705 ****************************************************************************/ 508 - struct dev_info { /* size */ 706 + struct drv_port_mb { 509 707 510 - u32 bc_rev; /* 8 bits each: major, minor, build */ /* 4 */ 708 + u32 link_status; 709 + /* Driver should update this field on any link change event */ 511 710 512 - struct shared_hw_cfg shared_hw_config; /* 40 */ 711 + #define LINK_STATUS_LINK_FLAG_MASK 0x00000001 712 + #define LINK_STATUS_LINK_UP 0x00000001 713 + #define LINK_STATUS_SPEED_AND_DUPLEX_MASK 0x0000001E 714 + #define LINK_STATUS_SPEED_AND_DUPLEX_AN_NOT_COMPLETE (0<<1) 715 + #define LINK_STATUS_SPEED_AND_DUPLEX_10THD (1<<1) 716 + #define LINK_STATUS_SPEED_AND_DUPLEX_10TFD (2<<1) 717 + #define LINK_STATUS_SPEED_AND_DUPLEX_100TXHD (3<<1) 718 + #define LINK_STATUS_SPEED_AND_DUPLEX_100T4 (4<<1) 719 + #define LINK_STATUS_SPEED_AND_DUPLEX_100TXFD (5<<1) 720 + #define LINK_STATUS_SPEED_AND_DUPLEX_1000THD (6<<1) 721 + #define LINK_STATUS_SPEED_AND_DUPLEX_1000TFD (7<<1) 722 + #define LINK_STATUS_SPEED_AND_DUPLEX_1000XFD (7<<1) 723 + #define LINK_STATUS_SPEED_AND_DUPLEX_2500THD (8<<1) 724 + #define LINK_STATUS_SPEED_AND_DUPLEX_2500TFD (9<<1) 725 + #define LINK_STATUS_SPEED_AND_DUPLEX_2500XFD (9<<1) 726 + #define LINK_STATUS_SPEED_AND_DUPLEX_10GTFD (10<<1) 727 + #define LINK_STATUS_SPEED_AND_DUPLEX_10GXFD (10<<1) 728 + #define LINK_STATUS_SPEED_AND_DUPLEX_12GTFD (11<<1) 729 + #define LINK_STATUS_SPEED_AND_DUPLEX_12GXFD (11<<1) 730 + #define LINK_STATUS_SPEED_AND_DUPLEX_12_5GTFD (12<<1) 731 + #define LINK_STATUS_SPEED_AND_DUPLEX_12_5GXFD (12<<1) 732 + #define LINK_STATUS_SPEED_AND_DUPLEX_13GTFD (13<<1) 733 + #define LINK_STATUS_SPEED_AND_DUPLEX_13GXFD (13<<1) 734 + #define LINK_STATUS_SPEED_AND_DUPLEX_15GTFD (14<<1) 735 + #define LINK_STATUS_SPEED_AND_DUPLEX_15GXFD (14<<1) 736 + #define LINK_STATUS_SPEED_AND_DUPLEX_16GTFD (15<<1) 737 + #define LINK_STATUS_SPEED_AND_DUPLEX_16GXFD (15<<1) 513 738 514 - struct port_hw_cfg port_hw_config[FUNC_MAX]; /* 400*2=800 */ 739 + #define LINK_STATUS_AUTO_NEGOTIATE_FLAG_MASK 0x00000020 740 + #define LINK_STATUS_AUTO_NEGOTIATE_ENABLED 0x00000020 515 741 516 - struct shared_feat_cfg shared_feature_config; /* 4 */ 742 + #define LINK_STATUS_AUTO_NEGOTIATE_COMPLETE 0x00000040 743 + #define LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK 0x00000080 744 + #define LINK_STATUS_PARALLEL_DETECTION_USED 0x00000080 517 745 518 - struct port_feat_cfg port_feature_config[FUNC_MAX];/* 116*2=232 */ 746 + #define LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE 0x00000200 747 + #define LINK_STATUS_LINK_PARTNER_1000THD_CAPABLE 0x00000400 748 + #define LINK_STATUS_LINK_PARTNER_100T4_CAPABLE 0x00000800 749 + #define LINK_STATUS_LINK_PARTNER_100TXFD_CAPABLE 0x00001000 750 + #define LINK_STATUS_LINK_PARTNER_100TXHD_CAPABLE 0x00002000 751 + #define LINK_STATUS_LINK_PARTNER_10TFD_CAPABLE 0x00004000 752 + #define LINK_STATUS_LINK_PARTNER_10THD_CAPABLE 0x00008000 753 + 754 + #define LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK 0x00010000 755 + #define LINK_STATUS_TX_FLOW_CONTROL_ENABLED 0x00010000 756 + 757 + #define LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK 0x00020000 758 + #define LINK_STATUS_RX_FLOW_CONTROL_ENABLED 0x00020000 759 + 760 + #define LINK_STATUS_LINK_PARTNER_FLOW_CONTROL_MASK 0x000C0000 761 + #define LINK_STATUS_LINK_PARTNER_NOT_PAUSE_CAPABLE (0<<18) 762 + #define LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE (1<<18) 763 + #define LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE (2<<18) 764 + #define LINK_STATUS_LINK_PARTNER_BOTH_PAUSE (3<<18) 765 + 766 + #define LINK_STATUS_SERDES_LINK 0x00100000 767 + 768 + #define LINK_STATUS_LINK_PARTNER_2500XFD_CAPABLE 0x00200000 769 + #define LINK_STATUS_LINK_PARTNER_2500XHD_CAPABLE 0x00400000 770 + #define LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE 0x00800000 771 + #define LINK_STATUS_LINK_PARTNER_12GXFD_CAPABLE 0x01000000 772 + #define LINK_STATUS_LINK_PARTNER_12_5GXFD_CAPABLE 0x02000000 773 + #define LINK_STATUS_LINK_PARTNER_13GXFD_CAPABLE 0x04000000 774 + #define LINK_STATUS_LINK_PARTNER_15GXFD_CAPABLE 0x08000000 775 + #define LINK_STATUS_LINK_PARTNER_16GXFD_CAPABLE 0x10000000 776 + 777 + u32 reserved[3]; 778 + 779 + }; 780 + 781 + 782 + struct drv_func_mb { 783 + 784 + u32 drv_mb_header; 785 + #define DRV_MSG_CODE_MASK 0xffff0000 786 + #define DRV_MSG_CODE_LOAD_REQ 0x10000000 787 + #define DRV_MSG_CODE_LOAD_DONE 0x11000000 788 + #define DRV_MSG_CODE_UNLOAD_REQ_WOL_EN 0x20000000 789 + #define DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS 0x20010000 790 + #define DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP 0x20020000 791 + #define DRV_MSG_CODE_UNLOAD_DONE 0x21000000 792 + #define DRV_MSG_CODE_DIAG_ENTER_REQ 0x50000000 793 + #define DRV_MSG_CODE_DIAG_EXIT_REQ 0x60000000 794 + #define DRV_MSG_CODE_VALIDATE_KEY 0x70000000 795 + #define DRV_MSG_CODE_GET_CURR_KEY 0x80000000 796 + #define DRV_MSG_CODE_GET_UPGRADE_KEY 0x81000000 797 + #define DRV_MSG_CODE_GET_MANUF_KEY 0x82000000 798 + #define DRV_MSG_CODE_LOAD_L2B_PRAM 0x90000000 799 + 800 + #define DRV_MSG_SEQ_NUMBER_MASK 0x0000ffff 801 + 802 + u32 drv_mb_param; 803 + 804 + u32 fw_mb_header; 805 + #define FW_MSG_CODE_MASK 0xffff0000 806 + #define FW_MSG_CODE_DRV_LOAD_COMMON 0x10100000 807 + #define FW_MSG_CODE_DRV_LOAD_PORT 0x10110000 808 + #define FW_MSG_CODE_DRV_LOAD_FUNCTION 0x10120000 809 + #define FW_MSG_CODE_DRV_LOAD_REFUSED 0x10200000 810 + #define FW_MSG_CODE_DRV_LOAD_DONE 0x11100000 811 + #define FW_MSG_CODE_DRV_UNLOAD_COMMON 0x20100000 812 + #define FW_MSG_CODE_DRV_UNLOAD_PORT 0x20110000 813 + #define FW_MSG_CODE_DRV_UNLOAD_FUNCTION 0x20120000 814 + #define FW_MSG_CODE_DRV_UNLOAD_DONE 0x21100000 815 + #define FW_MSG_CODE_DIAG_ENTER_DONE 0x50100000 816 + #define FW_MSG_CODE_DIAG_REFUSE 0x50200000 817 + #define FW_MSG_CODE_DIAG_EXIT_DONE 0x60100000 818 + #define FW_MSG_CODE_VALIDATE_KEY_SUCCESS 0x70100000 819 + #define FW_MSG_CODE_VALIDATE_KEY_FAILURE 0x70200000 820 + #define FW_MSG_CODE_GET_KEY_DONE 0x80100000 821 + #define FW_MSG_CODE_NO_KEY 0x80f00000 822 + #define FW_MSG_CODE_LIC_INFO_NOT_READY 0x80f80000 823 + #define FW_MSG_CODE_L2B_PRAM_LOADED 0x90100000 824 + #define FW_MSG_CODE_L2B_PRAM_T_LOAD_FAILURE 0x90210000 825 + #define FW_MSG_CODE_L2B_PRAM_C_LOAD_FAILURE 0x90220000 826 + #define FW_MSG_CODE_L2B_PRAM_X_LOAD_FAILURE 0x90230000 827 + #define FW_MSG_CODE_L2B_PRAM_U_LOAD_FAILURE 0x90240000 828 + 829 + #define FW_MSG_SEQ_NUMBER_MASK 0x0000ffff 830 + 831 + u32 fw_mb_param; 832 + 833 + u32 drv_pulse_mb; 834 + #define DRV_PULSE_SEQ_MASK 0x00007fff 835 + #define DRV_PULSE_SYSTEM_TIME_MASK 0xffff0000 836 + /* The system time is in the format of 837 + * (year-2001)*12*32 + month*32 + day. */ 838 + #define DRV_PULSE_ALWAYS_ALIVE 0x00008000 839 + /* Indicate to the firmware not to go into the 840 + * OS-absent when it is not getting driver pulse. 841 + * This is used for debugging as well for PXE(MBA). */ 842 + 843 + u32 mcp_pulse_mb; 844 + #define MCP_PULSE_SEQ_MASK 0x00007fff 845 + #define MCP_PULSE_ALWAYS_ALIVE 0x00008000 846 + /* Indicates to the driver not to assert due to lack 847 + * of MCP response */ 848 + #define MCP_EVENT_MASK 0xffff0000 849 + #define MCP_EVENT_OTHER_DRIVER_RESET_REQ 0x00010000 850 + 851 + u32 iscsi_boot_signature; 852 + u32 iscsi_boot_block_offset; 853 + 854 + u32 reserved[3]; 519 855 520 856 }; 521 857 ··· 704 678 /**************************************************************************** 705 679 * Management firmware state * 706 680 ****************************************************************************/ 707 - /* Allocate 320 bytes for management firmware: still not known exactly 708 - * how much IMD needs. */ 709 - #define MGMTFW_STATE_WORD_SIZE 80 681 + /* Allocate 440 bytes for management firmware */ 682 + #define MGMTFW_STATE_WORD_SIZE 110 710 683 711 684 struct mgmtfw_state { 712 685 u32 opaque[MGMTFW_STATE_WORD_SIZE]; ··· 716 691 * Shared Memory Region * 717 692 ****************************************************************************/ 718 693 struct shmem_region { /* SharedMem Offset (size) */ 719 - u32 validity_map[FUNC_MAX]; /* 0x0 (4 * 2 = 0x8) */ 720 - #define SHR_MEM_VALIDITY_PCI_CFG 0x00000001 721 - #define SHR_MEM_VALIDITY_MB 0x00000002 722 - #define SHR_MEM_VALIDITY_DEV_INFO 0x00000004 694 + 695 + u32 validity_map[PORT_MAX]; /* 0x0 (4*2 = 0x8) */ 696 + #define SHR_MEM_FORMAT_REV_ID ('A'<<24) 697 + #define SHR_MEM_FORMAT_REV_MASK 0xff000000 698 + /* validity bits */ 699 + #define SHR_MEM_VALIDITY_PCI_CFG 0x00100000 700 + #define SHR_MEM_VALIDITY_MB 0x00200000 701 + #define SHR_MEM_VALIDITY_DEV_INFO 0x00400000 702 + #define SHR_MEM_VALIDITY_RESERVED 0x00000007 723 703 /* One licensing bit should be set */ 724 704 #define SHR_MEM_VALIDITY_LIC_KEY_IN_EFFECT_MASK 0x00000038 725 705 #define SHR_MEM_VALIDITY_LIC_MANUF_KEY_IN_EFFECT 0x00000008 726 706 #define SHR_MEM_VALIDITY_LIC_UPGRADE_KEY_IN_EFFECT 0x00000010 727 707 #define SHR_MEM_VALIDITY_LIC_NO_KEY_IN_EFFECT 0x00000020 708 + /* Active MFW */ 709 + #define SHR_MEM_VALIDITY_ACTIVE_MFW_UNKNOWN 0x00000000 710 + #define SHR_MEM_VALIDITY_ACTIVE_MFW_IPMI 0x00000040 711 + #define SHR_MEM_VALIDITY_ACTIVE_MFW_UMP 0x00000080 712 + #define SHR_MEM_VALIDITY_ACTIVE_MFW_NCSI 0x000000c0 713 + #define SHR_MEM_VALIDITY_ACTIVE_MFW_NONE 0x000001c0 714 + #define SHR_MEM_VALIDITY_ACTIVE_MFW_MASK 0x000001c0 728 715 729 - struct drv_fw_mb drv_fw_mb[FUNC_MAX]; /* 0x8 (28 * 2 = 0x38) */ 716 + struct dev_info dev_info; /* 0x8 (0x438) */ 730 717 731 - struct dev_info dev_info; /* 0x40 (0x438) */ 732 - 733 - #ifdef _LICENSE_H 734 - license_key_t drv_lic_key[FUNC_MAX]; /* 0x478 (52 * 2 = 0x68) */ 735 - #else /* Linux! */ 736 - u8 reserved[52*FUNC_MAX]; 737 - #endif 718 + u8 reserved[52*PORT_MAX]; 738 719 739 720 /* FW information (for internal FW use) */ 740 - u32 fw_info_fio_offset; /* 0x4e0 (0x4) */ 741 - struct mgmtfw_state mgmtfw_state; /* 0x4e4 (0x140) */ 721 + u32 fw_info_fio_offset; /* 0x4a8 (0x4) */ 722 + struct mgmtfw_state mgmtfw_state; /* 0x4ac (0x1b8) */ 742 723 743 - }; /* 0x624 */ 724 + struct drv_port_mb port_mb[PORT_MAX]; /* 0x664 (16*2=0x20) */ 725 + struct drv_func_mb func_mb[FUNC_MAX]; /* 0x684 (44*2=0x58) */ 726 + 727 + }; /* 0x6dc */ 744 728 745 729 746 730 #define BCM_5710_FW_MAJOR_VERSION 4
+211 -1
drivers/net/bnx2x_reg.h
··· 1 1 /* bnx2x_reg.h: Broadcom Everest network driver. 2 2 * 3 - * Copyright (c) 2007 Broadcom Corporation 3 + * Copyright (c) 2007-2008 Broadcom Corporation 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify 6 6 * it under the terms of the GNU General Public License as published by ··· 24 24 #define BRB1_REG_BRB1_INT_STS 0x6011c 25 25 /* [RW 4] Parity mask register #0 read/write */ 26 26 #define BRB1_REG_BRB1_PRTY_MASK 0x60138 27 + /* [R 4] Parity register #0 read */ 28 + #define BRB1_REG_BRB1_PRTY_STS 0x6012c 27 29 /* [RW 10] At address BRB1_IND_FREE_LIST_PRS_CRDT initialize free head. At 28 30 address BRB1_IND_FREE_LIST_PRS_CRDT+1 initialize free tail. At address 29 31 BRB1_IND_FREE_LIST_PRS_CRDT+2 initialize parser initial credit. */ ··· 283 281 #define CDU_REG_CDU_INT_STS 0x101030 284 282 /* [RW 5] Parity mask register #0 read/write */ 285 283 #define CDU_REG_CDU_PRTY_MASK 0x10104c 284 + /* [R 5] Parity register #0 read */ 285 + #define CDU_REG_CDU_PRTY_STS 0x101040 286 286 /* [RC 32] logging of error data in case of a CDU load error: 287 287 {expected_cid[15:0]; xpected_type[2:0]; xpected_region[2:0]; ctive_error; 288 288 ype_error; ctual_active; ctual_compressed_context}; */ ··· 312 308 #define CFC_REG_CFC_INT_STS_CLR 0x104100 313 309 /* [RW 4] Parity mask register #0 read/write */ 314 310 #define CFC_REG_CFC_PRTY_MASK 0x104118 311 + /* [R 4] Parity register #0 read */ 312 + #define CFC_REG_CFC_PRTY_STS 0x10410c 315 313 /* [RW 21] CID cam access (21:1 - Data; alid - 0) */ 316 314 #define CFC_REG_CID_CAM 0x104800 317 315 #define CFC_REG_CONTROL0 0x104028 ··· 360 354 #define CSDM_REG_CSDM_INT_MASK_1 0xc22ac 361 355 /* [RW 11] Parity mask register #0 read/write */ 362 356 #define CSDM_REG_CSDM_PRTY_MASK 0xc22bc 357 + /* [R 11] Parity register #0 read */ 358 + #define CSDM_REG_CSDM_PRTY_STS 0xc22b0 363 359 #define CSDM_REG_ENABLE_IN1 0xc2238 364 360 #define CSDM_REG_ENABLE_IN2 0xc223c 365 361 #define CSDM_REG_ENABLE_OUT1 0xc2240 ··· 446 438 /* [RW 32] Parity mask register #0 read/write */ 447 439 #define CSEM_REG_CSEM_PRTY_MASK_0 0x200130 448 440 #define CSEM_REG_CSEM_PRTY_MASK_1 0x200140 441 + /* [R 32] Parity register #0 read */ 442 + #define CSEM_REG_CSEM_PRTY_STS_0 0x200124 443 + #define CSEM_REG_CSEM_PRTY_STS_1 0x200134 449 444 #define CSEM_REG_ENABLE_IN 0x2000a4 450 445 #define CSEM_REG_ENABLE_OUT 0x2000a8 451 446 /* [RW 32] This address space contains all registers and memories that are ··· 537 526 #define CSEM_REG_TS_9_AS 0x20005c 538 527 /* [RW 1] Parity mask register #0 read/write */ 539 528 #define DBG_REG_DBG_PRTY_MASK 0xc0a8 529 + /* [R 1] Parity register #0 read */ 530 + #define DBG_REG_DBG_PRTY_STS 0xc09c 540 531 /* [RW 2] debug only: These bits indicate the credit for PCI request type 4 541 532 interface; MUST be configured AFTER pci_ext_buffer_strt_addr_lsb/msb are 542 533 configured */ ··· 556 543 #define DMAE_REG_DMAE_INT_MASK 0x102054 557 544 /* [RW 4] Parity mask register #0 read/write */ 558 545 #define DMAE_REG_DMAE_PRTY_MASK 0x102064 546 + /* [R 4] Parity register #0 read */ 547 + #define DMAE_REG_DMAE_PRTY_STS 0x102058 559 548 /* [RW 1] Command 0 go. */ 560 549 #define DMAE_REG_GO_C0 0x102080 561 550 /* [RW 1] Command 1 go. */ ··· 638 623 #define DORQ_REG_DORQ_INT_STS_CLR 0x170178 639 624 /* [RW 2] Parity mask register #0 read/write */ 640 625 #define DORQ_REG_DORQ_PRTY_MASK 0x170190 626 + /* [R 2] Parity register #0 read */ 627 + #define DORQ_REG_DORQ_PRTY_STS 0x170184 641 628 /* [RW 8] The address to write the DPM CID to STORM. */ 642 629 #define DORQ_REG_DPM_CID_ADDR 0x170044 643 630 /* [RW 5] The DPM mode CID extraction offset. */ ··· 709 692 #define HC_REG_CONFIG_1 0x108004 710 693 /* [RW 3] Parity mask register #0 read/write */ 711 694 #define HC_REG_HC_PRTY_MASK 0x1080a0 695 + /* [R 3] Parity register #0 read */ 696 + #define HC_REG_HC_PRTY_STS 0x108094 712 697 /* [RW 17] status block interrupt mask; one in each bit means unmask; zerow 713 698 in each bit means mask; bit 0 - default SB; bit 1 - SB_0; bit 2 - SB_1... 714 699 bit 16- SB_15; addr 0 - port 0; addr 1 - port 1 */ ··· 1146 1127 #define MISC_REG_AEU_GENERAL_ATTN_17 0xa044 1147 1128 #define MISC_REG_AEU_GENERAL_ATTN_18 0xa048 1148 1129 #define MISC_REG_AEU_GENERAL_ATTN_19 0xa04c 1130 + #define MISC_REG_AEU_GENERAL_ATTN_10 0xa028 1149 1131 #define MISC_REG_AEU_GENERAL_ATTN_11 0xa02c 1150 1132 #define MISC_REG_AEU_GENERAL_ATTN_2 0xa008 1151 1133 #define MISC_REG_AEU_GENERAL_ATTN_20 0xa050 ··· 1155 1135 #define MISC_REG_AEU_GENERAL_ATTN_4 0xa010 1156 1136 #define MISC_REG_AEU_GENERAL_ATTN_5 0xa014 1157 1137 #define MISC_REG_AEU_GENERAL_ATTN_6 0xa018 1138 + #define MISC_REG_AEU_GENERAL_ATTN_7 0xa01c 1139 + #define MISC_REG_AEU_GENERAL_ATTN_8 0xa020 1140 + #define MISC_REG_AEU_GENERAL_ATTN_9 0xa024 1158 1141 /* [RW 32] first 32b for inverting the input for function 0; for each bit: 1159 1142 0= do not invert; 1= invert; mapped as follows: [0] NIG attention for 1160 1143 function0; [1] NIG attention for function1; [2] GPIO1 mcp; [3] GPIO2 mcp; ··· 1206 1183 starts at 0x0 for the A0 tape-out and increments by one for each 1207 1184 all-layer tape-out. */ 1208 1185 #define MISC_REG_CHIP_REV 0xa40c 1186 + /* [RW 32] The following driver registers(1..6) represent 6 drivers and 32 1187 + clients. Each client can be controlled by one driver only. One in each 1188 + bit represent that this driver control the appropriate client (Ex: bit 5 1189 + is set means this driver control client number 5). addr1 = set; addr0 = 1190 + clear; read from both addresses will give the same result = status. write 1191 + to address 1 will set a request to control all the clients that their 1192 + appropriate bit (in the write command) is set. if the client is free (the 1193 + appropriate bit in all the other drivers is clear) one will be written to 1194 + that driver register; if the client isn't free the bit will remain zero. 1195 + if the appropriate bit is set (the driver request to gain control on a 1196 + client it already controls the ~MISC_REGISTERS_INT_STS.GENERIC_SW 1197 + interrupt will be asserted). write to address 0 will set a request to 1198 + free all the clients that their appropriate bit (in the write command) is 1199 + set. if the appropriate bit is clear (the driver request to free a client 1200 + it doesn't controls the ~MISC_REGISTERS_INT_STS.GENERIC_SW interrupt will 1201 + be asserted). */ 1202 + #define MISC_REG_DRIVER_CONTROL_1 0xa510 1203 + /* [RW 32] GPIO. [31-28] FLOAT port 0; [27-24] FLOAT port 0; When any of 1204 + these bits is written as a '1'; the corresponding SPIO bit will turn off 1205 + it's drivers and become an input. This is the reset state of all GPIO 1206 + pins. The read value of these bits will be a '1' if that last command 1207 + (#SET; #CLR; or #FLOAT) for this bit was a #FLOAT. (reset value 0xff). 1208 + [23-20] CLR port 1; 19-16] CLR port 0; When any of these bits is written 1209 + as a '1'; the corresponding GPIO bit will drive low. The read value of 1210 + these bits will be a '1' if that last command (#SET; #CLR; or #FLOAT) for 1211 + this bit was a #CLR. (reset value 0). [15-12] SET port 1; 11-8] port 0; 1212 + SET When any of these bits is written as a '1'; the corresponding GPIO 1213 + bit will drive high (if it has that capability). The read value of these 1214 + bits will be a '1' if that last command (#SET; #CLR; or #FLOAT) for this 1215 + bit was a #SET. (reset value 0). [7-4] VALUE port 1; [3-0] VALUE port 0; 1216 + RO; These bits indicate the read value of each of the eight GPIO pins. 1217 + This is the result value of the pin; not the drive value. Writing these 1218 + bits will have not effect. */ 1219 + #define MISC_REG_GPIO 0xa490 1209 1220 /* [RW 1] Setting this bit enables a timer in the GRC block to timeout any 1210 1221 access that does not finish within 1211 1222 ~misc_registers_grc_timout_val.grc_timeout_val cycles. When this bit is ··· 1280 1223 #define MISC_REG_MISC_INT_MASK 0xa388 1281 1224 /* [RW 1] Parity mask register #0 read/write */ 1282 1225 #define MISC_REG_MISC_PRTY_MASK 0xa398 1226 + /* [R 1] Parity register #0 read */ 1227 + #define MISC_REG_MISC_PRTY_STS 0xa38c 1283 1228 /* [RW 32] 32 LSB of storm PLL first register; reset val = 0x 071d2911. 1284 1229 inside order of the bits is: [0] P1 divider[0] (reset value 1); [1] P1 1285 1230 divider[1] (reset value 0); [2] P1 divider[2] (reset value 0); [3] P1 ··· 1323 1264 /* [RW 20] 20 bit GRC address where the scratch-pad of the MCP that is 1324 1265 shared with the driver resides */ 1325 1266 #define MISC_REG_SHARED_MEM_ADDR 0xa2b4 1267 + /* [RW 32] SPIO. [31-24] FLOAT When any of these bits is written as a '1'; 1268 + the corresponding SPIO bit will turn off it's drivers and become an 1269 + input. This is the reset state of all SPIO pins. The read value of these 1270 + bits will be a '1' if that last command (#SET; #CL; or #FLOAT) for this 1271 + bit was a #FLOAT. (reset value 0xff). [23-16] CLR When any of these bits 1272 + is written as a '1'; the corresponding SPIO bit will drive low. The read 1273 + value of these bits will be a '1' if that last command (#SET; #CLR; or 1274 + #FLOAT) for this bit was a #CLR. (reset value 0). [15-8] SET When any of 1275 + these bits is written as a '1'; the corresponding SPIO bit will drive 1276 + high (if it has that capability). The read value of these bits will be a 1277 + '1' if that last command (#SET; #CLR; or #FLOAT) for this bit was a #SET. 1278 + (reset value 0). [7-0] VALUE RO; These bits indicate the read value of 1279 + each of the eight SPIO pins. This is the result value of the pin; not the 1280 + drive value. Writing these bits will have not effect. Each 8 bits field 1281 + is divided as follows: [0] VAUX Enable; when pulsed low; enables supply 1282 + from VAUX. (This is an output pin only; the FLOAT field is not applicable 1283 + for this pin); [1] VAUX Disable; when pulsed low; disables supply form 1284 + VAUX. (This is an output pin only; FLOAT field is not applicable for this 1285 + pin); [2] SEL_VAUX_B - Control to power switching logic. Drive low to 1286 + select VAUX supply. (This is an output pin only; it is not controlled by 1287 + the SET and CLR fields; it is controlled by the Main Power SM; the FLOAT 1288 + field is not applicable for this pin; only the VALUE fields is relevant - 1289 + it reflects the output value); [3] reserved; [4] spio_4; [5] spio_5; [6] 1290 + Bit 0 of UMP device ID select; read by UMP firmware; [7] Bit 1 of UMP 1291 + device ID select; read by UMP firmware. */ 1292 + #define MISC_REG_SPIO 0xa4fc 1293 + /* [RW 8] These bits enable the SPIO_INTs to signals event to the IGU/MC. 1294 + according to the following map: [3:0] reserved; [4] spio_4 [5] spio_5; 1295 + [7:0] reserved */ 1296 + #define MISC_REG_SPIO_EVENT_EN 0xa2b8 1297 + /* [RW 32] SPIO INT. [31-24] OLD_CLR Writing a '1' to these bit clears the 1298 + corresponding bit in the #OLD_VALUE register. This will acknowledge an 1299 + interrupt on the falling edge of corresponding SPIO input (reset value 1300 + 0). [23-16] OLD_SET Writing a '1' to these bit sets the corresponding bit 1301 + in the #OLD_VALUE register. This will acknowledge an interrupt on the 1302 + rising edge of corresponding SPIO input (reset value 0). [15-8] OLD_VALUE 1303 + RO; These bits indicate the old value of the SPIO input value. When the 1304 + ~INT_STATE bit is set; this bit indicates the OLD value of the pin such 1305 + that if ~INT_STATE is set and this bit is '0'; then the interrupt is due 1306 + to a low to high edge. If ~INT_STATE is set and this bit is '1'; then the 1307 + interrupt is due to a high to low edge (reset value 0). [7-0] INT_STATE 1308 + RO; These bits indicate the current SPIO interrupt state for each SPIO 1309 + pin. This bit is cleared when the appropriate #OLD_SET or #OLD_CLR 1310 + command bit is written. This bit is set when the SPIO input does not 1311 + match the current value in #OLD_VALUE (reset value 0). */ 1312 + #define MISC_REG_SPIO_INT 0xa500 1313 + /* [RW 1] Set by the MCP to remember if one or more of the drivers is/are 1314 + loaded; 0-prepare; -unprepare */ 1315 + #define MISC_REG_UNPREPARED 0xa424 1326 1316 #define NIG_MASK_INTERRUPT_PORT0_REG_MASK_EMAC0_MISC_MI_INT (0x1<<0) 1327 1317 #define NIG_MASK_INTERRUPT_PORT0_REG_MASK_SERDES0_LINK_STATUS (0x1<<9) 1328 1318 #define NIG_MASK_INTERRUPT_PORT0_REG_MASK_XGXS0_LINK10G (0x1<<15) ··· 1500 1392 #define NIG_REG_NIG_INGRESS_EMAC0_NO_CRC 0x10044 1501 1393 /* [RW 1] Input enable for RX PBF LP IF */ 1502 1394 #define NIG_REG_PBF_LB_IN_EN 0x100b4 1395 + /* [RW 1] Value of this register will be transmitted to port swap when 1396 + ~nig_registers_strap_override.strap_override =1 */ 1397 + #define NIG_REG_PORT_SWAP 0x10394 1503 1398 /* [RW 1] output enable for RX parser descriptor IF */ 1504 1399 #define NIG_REG_PRS_EOP_OUT_EN 0x10104 1505 1400 /* [RW 1] Input enable for RX parser request IF */ ··· 1521 1410 #define NIG_REG_STAT2_BRB_OCTET 0x107e0 1522 1411 #define NIG_REG_STATUS_INTERRUPT_PORT0 0x10328 1523 1412 #define NIG_REG_STATUS_INTERRUPT_PORT1 0x1032c 1413 + /* [RW 1] port swap mux selection. If this register equal to 0 then port 1414 + swap is equal to SPIO pin that inputs from ifmux_serdes_swap. If 1 then 1415 + ort swap is equal to ~nig_registers_port_swap.port_swap */ 1416 + #define NIG_REG_STRAP_OVERRIDE 0x10398 1524 1417 /* [RW 1] output enable for RX_XCM0 IF */ 1525 1418 #define NIG_REG_XCM0_OUT_EN 0x100f0 1526 1419 /* [RW 1] output enable for RX_XCM1 IF */ ··· 1614 1499 #define PB_REG_PB_INT_STS 0x1c 1615 1500 /* [RW 4] Parity mask register #0 read/write */ 1616 1501 #define PB_REG_PB_PRTY_MASK 0x38 1502 + /* [R 4] Parity register #0 read */ 1503 + #define PB_REG_PB_PRTY_STS 0x2c 1617 1504 #define PRS_REG_A_PRSU_20 0x40134 1618 1505 /* [R 8] debug only: CFC load request current credit. Transaction based. */ 1619 1506 #define PRS_REG_CFC_LD_CURRENT_CREDIT 0x40164 ··· 1707 1590 #define PRS_REG_PRS_INT_STS 0x40188 1708 1591 /* [RW 8] Parity mask register #0 read/write */ 1709 1592 #define PRS_REG_PRS_PRTY_MASK 0x401a4 1593 + /* [R 8] Parity register #0 read */ 1594 + #define PRS_REG_PRS_PRTY_STS 0x40198 1710 1595 /* [RW 8] Context region for pure acknowledge packets. Used in CFC load 1711 1596 request message */ 1712 1597 #define PRS_REG_PURE_REGIONS 0x40024 ··· 1837 1718 /* [RW 32] Parity mask register #0 read/write */ 1838 1719 #define PXP2_REG_PXP2_PRTY_MASK_0 0x120588 1839 1720 #define PXP2_REG_PXP2_PRTY_MASK_1 0x120598 1721 + /* [R 32] Parity register #0 read */ 1722 + #define PXP2_REG_PXP2_PRTY_STS_0 0x12057c 1723 + #define PXP2_REG_PXP2_PRTY_STS_1 0x12058c 1840 1724 /* [R 1] Debug only: The 'almost full' indication from each fifo (gives 1841 1725 indication about backpressure) */ 1842 1726 #define PXP2_REG_RD_ALMOST_FULL_0 0x120424 ··· 2033 1911 #define PXP2_REG_RQ_HC_ENDIAN_M 0x1201a8 2034 1912 /* [WB 53] Onchip address table */ 2035 1913 #define PXP2_REG_RQ_ONCHIP_AT 0x122000 1914 + /* [RW 13] Pending read limiter threshold; in Dwords */ 1915 + #define PXP2_REG_RQ_PDR_LIMIT 0x12033c 2036 1916 /* [RW 2] Endian mode for qm */ 2037 1917 #define PXP2_REG_RQ_QM_ENDIAN_M 0x120194 2038 1918 /* [RW 3] page size in L2P table for QM module; -4k; -8k; -16k; -32k; -64k; ··· 2045 1921 /* [RW 3] Max burst size filed for read requests port 0; 000 - 128B; 2046 1922 001:256B; 010: 512B; 11:1K:100:2K; 01:4K */ 2047 1923 #define PXP2_REG_RQ_RD_MBS0 0x120160 1924 + /* [RW 3] Max burst size filed for read requests port 1; 000 - 128B; 1925 + 001:256B; 010: 512B; 11:1K:100:2K; 01:4K */ 1926 + #define PXP2_REG_RQ_RD_MBS1 0x120168 2048 1927 /* [RW 2] Endian mode for src */ 2049 1928 #define PXP2_REG_RQ_SRC_ENDIAN_M 0x12019c 2050 1929 /* [RW 3] page size in L2P table for SRC module; -4k; -8k; -16k; -32k; -64k; ··· 2127 2000 /* [RW 3] Max burst size filed for write requests port 0; 000 - 128B; 2128 2001 001:256B; 010: 512B; */ 2129 2002 #define PXP2_REG_RQ_WR_MBS0 0x12015c 2003 + /* [RW 3] Max burst size filed for write requests port 1; 000 - 128B; 2004 + 001:256B; 010: 512B; */ 2005 + #define PXP2_REG_RQ_WR_MBS1 0x120164 2130 2006 /* [RW 10] if Number of entries in dmae fifo will be higer than this 2131 2007 threshold then has_payload indication will be asserted; the default value 2132 2008 should be equal to &gt; write MBS size! */ 2133 2009 #define PXP2_REG_WR_DMAE_TH 0x120368 2010 + /* [RW 10] if Number of entries in usdmdp fifo will be higer than this 2011 + threshold then has_payload indication will be asserted; the default value 2012 + should be equal to &gt; write MBS size! */ 2013 + #define PXP2_REG_WR_USDMDP_TH 0x120348 2134 2014 /* [R 1] debug only: Indication if PSWHST arbiter is idle */ 2135 2015 #define PXP_REG_HST_ARB_IS_IDLE 0x103004 2136 2016 /* [R 8] debug only: A bit mask for all PSWHST arbiter clients. '1' means ··· 2155 2021 #define PXP_REG_PXP_INT_STS_CLR_0 0x10306c 2156 2022 /* [RW 26] Parity mask register #0 read/write */ 2157 2023 #define PXP_REG_PXP_PRTY_MASK 0x103094 2024 + /* [R 26] Parity register #0 read */ 2025 + #define PXP_REG_PXP_PRTY_STS 0x103088 2158 2026 /* [RW 4] The activity counter initial increment value sent in the load 2159 2027 request */ 2160 2028 #define QM_REG_ACTCTRINITVAL_0 0x168040 ··· 2263 2127 #define QM_REG_QM_INT_STS 0x168438 2264 2128 /* [RW 9] Parity mask register #0 read/write */ 2265 2129 #define QM_REG_QM_PRTY_MASK 0x168454 2130 + /* [R 9] Parity register #0 read */ 2131 + #define QM_REG_QM_PRTY_STS 0x168448 2266 2132 /* [R 32] Current queues in pipeline: Queues from 32 to 63 */ 2267 2133 #define QM_REG_QSTATUS_HIGH 0x16802c 2268 2134 /* [R 32] Current queues in pipeline: Queues from 0 to 31 */ ··· 2548 2410 #define SRC_REG_SRC_INT_STS 0x404ac 2549 2411 /* [RW 3] Parity mask register #0 read/write */ 2550 2412 #define SRC_REG_SRC_PRTY_MASK 0x404c8 2413 + /* [R 3] Parity register #0 read */ 2414 + #define SRC_REG_SRC_PRTY_STS 0x404bc 2551 2415 /* [R 4] Used to read the value of the XX protection CAM occupancy counter. */ 2552 2416 #define TCM_REG_CAM_OCCUP 0x5017c 2553 2417 /* [RW 1] CDU AG read Interface enable. If 0 - the request input is ··· 2870 2730 #define TSDM_REG_TSDM_INT_MASK_1 0x422ac 2871 2731 /* [RW 11] Parity mask register #0 read/write */ 2872 2732 #define TSDM_REG_TSDM_PRTY_MASK 0x422bc 2733 + /* [R 11] Parity register #0 read */ 2734 + #define TSDM_REG_TSDM_PRTY_STS 0x422b0 2873 2735 /* [RW 5] The number of time_slots in the arbitration cycle */ 2874 2736 #define TSEM_REG_ARB_CYCLE_SIZE 0x180034 2875 2737 /* [RW 3] The source that is associated with arbitration element 0. Source ··· 2996 2854 /* [RW 32] Parity mask register #0 read/write */ 2997 2855 #define TSEM_REG_TSEM_PRTY_MASK_0 0x180120 2998 2856 #define TSEM_REG_TSEM_PRTY_MASK_1 0x180130 2857 + /* [R 32] Parity register #0 read */ 2858 + #define TSEM_REG_TSEM_PRTY_STS_0 0x180114 2859 + #define TSEM_REG_TSEM_PRTY_STS_1 0x180124 2999 2860 /* [R 5] Used to read the XX protection CAM occupancy counter. */ 3000 2861 #define UCM_REG_CAM_OCCUP 0xe0170 3001 2862 /* [RW 1] CDU AG read Interface enable. If 0 - the request input is ··· 3300 3155 #define USDM_REG_USDM_INT_MASK_1 0xc42b0 3301 3156 /* [RW 11] Parity mask register #0 read/write */ 3302 3157 #define USDM_REG_USDM_PRTY_MASK 0xc42c0 3158 + /* [R 11] Parity register #0 read */ 3159 + #define USDM_REG_USDM_PRTY_STS 0xc42b4 3303 3160 /* [RW 5] The number of time_slots in the arbitration cycle */ 3304 3161 #define USEM_REG_ARB_CYCLE_SIZE 0x300034 3305 3162 /* [RW 3] The source that is associated with arbitration element 0. Source ··· 3426 3279 /* [RW 32] Parity mask register #0 read/write */ 3427 3280 #define USEM_REG_USEM_PRTY_MASK_0 0x300130 3428 3281 #define USEM_REG_USEM_PRTY_MASK_1 0x300140 3282 + /* [R 32] Parity register #0 read */ 3283 + #define USEM_REG_USEM_PRTY_STS_0 0x300124 3284 + #define USEM_REG_USEM_PRTY_STS_1 0x300134 3429 3285 /* [RW 2] The queue index for registration on Aux1 counter flag. */ 3430 3286 #define XCM_REG_AUX1_Q 0x20134 3431 3287 /* [RW 2] Per each decision rule the queue index to register to. */ ··· 3834 3684 #define XSDM_REG_XSDM_INT_MASK_1 0x1662ac 3835 3685 /* [RW 11] Parity mask register #0 read/write */ 3836 3686 #define XSDM_REG_XSDM_PRTY_MASK 0x1662bc 3687 + /* [R 11] Parity register #0 read */ 3688 + #define XSDM_REG_XSDM_PRTY_STS 0x1662b0 3837 3689 /* [RW 5] The number of time_slots in the arbitration cycle */ 3838 3690 #define XSEM_REG_ARB_CYCLE_SIZE 0x280034 3839 3691 /* [RW 3] The source that is associated with arbitration element 0. Source ··· 3960 3808 /* [RW 32] Parity mask register #0 read/write */ 3961 3809 #define XSEM_REG_XSEM_PRTY_MASK_0 0x280130 3962 3810 #define XSEM_REG_XSEM_PRTY_MASK_1 0x280140 3811 + /* [R 32] Parity register #0 read */ 3812 + #define XSEM_REG_XSEM_PRTY_STS_0 0x280124 3813 + #define XSEM_REG_XSEM_PRTY_STS_1 0x280134 3963 3814 #define MCPR_NVM_ACCESS_ENABLE_EN (1L<<0) 3964 3815 #define MCPR_NVM_ACCESS_ENABLE_WR_EN (1L<<1) 3965 3816 #define MCPR_NVM_ADDR_NVM_ADDR_VALUE (0xffffffL<<0) ··· 4002 3847 #define EMAC_MDIO_COMM_START_BUSY (1L<<29) 4003 3848 #define EMAC_MDIO_MODE_AUTO_POLL (1L<<4) 4004 3849 #define EMAC_MDIO_MODE_CLAUSE_45 (1L<<31) 3850 + #define EMAC_MDIO_MODE_CLOCK_CNT (0x3fL<<16) 3851 + #define EMAC_MDIO_MODE_CLOCK_CNT_BITSHIFT 16 4005 3852 #define EMAC_MODE_25G_MODE (1L<<5) 4006 3853 #define EMAC_MODE_ACPI_RCVD (1L<<20) 4007 3854 #define EMAC_MODE_HALF_DUPLEX (1L<<1) ··· 4031 3874 #define EMAC_RX_MTU_SIZE_JUMBO_ENA (1L<<31) 4032 3875 #define EMAC_TX_MODE_EXT_PAUSE_EN (1L<<3) 4033 3876 #define EMAC_TX_MODE_RESET (1L<<0) 3877 + #define MISC_REGISTERS_GPIO_1 1 3878 + #define MISC_REGISTERS_GPIO_2 2 3879 + #define MISC_REGISTERS_GPIO_3 3 3880 + #define MISC_REGISTERS_GPIO_CLR_POS 16 3881 + #define MISC_REGISTERS_GPIO_FLOAT (0xffL<<24) 3882 + #define MISC_REGISTERS_GPIO_FLOAT_POS 24 3883 + #define MISC_REGISTERS_GPIO_INPUT_HI_Z 2 3884 + #define MISC_REGISTERS_GPIO_OUTPUT_HIGH 1 3885 + #define MISC_REGISTERS_GPIO_OUTPUT_LOW 0 3886 + #define MISC_REGISTERS_GPIO_PORT_SHIFT 4 3887 + #define MISC_REGISTERS_GPIO_SET_POS 8 4034 3888 #define MISC_REGISTERS_RESET_REG_1_CLEAR 0x588 4035 3889 #define MISC_REGISTERS_RESET_REG_1_SET 0x584 4036 3890 #define MISC_REGISTERS_RESET_REG_2_CLEAR 0x598 ··· 4059 3891 #define MISC_REGISTERS_RESET_REG_3_MISC_NIG_MUX_XGXS0_RSTB_HW (0x1<<4) 4060 3892 #define MISC_REGISTERS_RESET_REG_3_MISC_NIG_MUX_XGXS0_TXD_FIFO_RSTB (0x1<<8) 4061 3893 #define MISC_REGISTERS_RESET_REG_3_SET 0x5a4 3894 + #define MISC_REGISTERS_SPIO_4 4 3895 + #define MISC_REGISTERS_SPIO_5 5 3896 + #define MISC_REGISTERS_SPIO_7 7 3897 + #define MISC_REGISTERS_SPIO_CLR_POS 16 3898 + #define MISC_REGISTERS_SPIO_FLOAT (0xffL<<24) 3899 + #define GRC_MISC_REGISTERS_SPIO_FLOAT7 0x80000000 3900 + #define GRC_MISC_REGISTERS_SPIO_FLOAT6 0x40000000 3901 + #define GRC_MISC_REGISTERS_SPIO_FLOAT5 0x20000000 3902 + #define GRC_MISC_REGISTERS_SPIO_FLOAT4 0x10000000 3903 + #define MISC_REGISTERS_SPIO_FLOAT_POS 24 3904 + #define MISC_REGISTERS_SPIO_INPUT_HI_Z 2 3905 + #define MISC_REGISTERS_SPIO_INT_OLD_SET_POS 16 3906 + #define MISC_REGISTERS_SPIO_OUTPUT_HIGH 1 3907 + #define MISC_REGISTERS_SPIO_OUTPUT_LOW 0 3908 + #define MISC_REGISTERS_SPIO_SET_POS 8 3909 + #define HW_LOCK_MAX_RESOURCE_VALUE 31 3910 + #define HW_LOCK_RESOURCE_8072_MDIO 0 3911 + #define HW_LOCK_RESOURCE_GPIO 1 3912 + #define HW_LOCK_RESOURCE_SPIO 2 4062 3913 #define AEU_INPUTS_ATTN_BITS_BRB_PARITY_ERROR (1<<18) 4063 3914 #define AEU_INPUTS_ATTN_BITS_CCM_HW_INTERRUPT (1<<31) 4064 3915 #define AEU_INPUTS_ATTN_BITS_CDU_HW_INTERRUPT (1<<9) ··· 4105 3918 #define AEU_INPUTS_ATTN_BITS_QM_HW_INTERRUPT (1<<3) 4106 3919 #define AEU_INPUTS_ATTN_BITS_QM_PARITY_ERROR (1<<2) 4107 3920 #define AEU_INPUTS_ATTN_BITS_SEARCHER_PARITY_ERROR (1<<22) 3921 + #define AEU_INPUTS_ATTN_BITS_SPIO5 (1<<15) 4108 3922 #define AEU_INPUTS_ATTN_BITS_TCM_HW_INTERRUPT (1<<27) 4109 3923 #define AEU_INPUTS_ATTN_BITS_TIMERS_HW_INTERRUPT (1<<5) 4110 3924 #define AEU_INPUTS_ATTN_BITS_TSDM_HW_INTERRUPT (1<<25) ··· 4394 4206 #define MDIO_XGXS_BLOCK2_RX_LN_SWAP_FORCE_ENABLE 0x4000 4395 4207 #define MDIO_XGXS_BLOCK2_TX_LN_SWAP 0x11 4396 4208 #define MDIO_XGXS_BLOCK2_TX_LN_SWAP_ENABLE 0x8000 4209 + #define MDIO_XGXS_BLOCK2_UNICORE_MODE_10G 0x14 4210 + #define MDIO_XGXS_BLOCK2_UNICORE_MODE_10G_CX4_XGXS 0x0001 4211 + #define MDIO_XGXS_BLOCK2_UNICORE_MODE_10G_HIGIG_XGXS 0x0010 4397 4212 #define MDIO_XGXS_BLOCK2_TEST_MODE_LANE 0x15 4398 4213 4399 4214 #define MDIO_REG_BANK_GP_STATUS 0x8120 ··· 4553 4362 #define MDIO_COMBO_IEEE0_AUTO_NEG_LINK_PARTNER_ABILITY1_SGMII_MODE 0x0001 4554 4363 4555 4364 4365 + #define EXT_PHY_AUTO_NEG_DEVAD 0x7 4556 4366 #define EXT_PHY_OPT_PMA_PMD_DEVAD 0x1 4557 4367 #define EXT_PHY_OPT_WIS_DEVAD 0x2 4558 4368 #define EXT_PHY_OPT_PCS_DEVAD 0x3 4559 4369 #define EXT_PHY_OPT_PHY_XS_DEVAD 0x4 4560 4370 #define EXT_PHY_OPT_CNTL 0x0 4371 + #define EXT_PHY_OPT_CNTL2 0x7 4561 4372 #define EXT_PHY_OPT_PMD_RX_SD 0xa 4562 4373 #define EXT_PHY_OPT_PMD_MISC_CNTL 0xca0a 4563 4374 #define EXT_PHY_OPT_PHY_IDENTIFIER 0xc800 ··· 4571 4378 #define EXT_PHY_OPT_LASI_STATUS 0x9005 4572 4379 #define EXT_PHY_OPT_PCS_STATUS 0x0020 4573 4380 #define EXT_PHY_OPT_XGXS_LANE_STATUS 0x0018 4381 + #define EXT_PHY_OPT_AN_LINK_STATUS 0x8304 4382 + #define EXT_PHY_OPT_AN_CL37_CL73 0x8370 4383 + #define EXT_PHY_OPT_AN_CL37_FD 0xffe4 4384 + #define EXT_PHY_OPT_AN_CL37_AN 0xffe0 4385 + #define EXT_PHY_OPT_AN_ADV 0x11 4574 4386 4575 4387 #define EXT_PHY_KR_PMA_PMD_DEVAD 0x1 4576 4388 #define EXT_PHY_KR_PCS_DEVAD 0x3 4577 4389 #define EXT_PHY_KR_AUTO_NEG_DEVAD 0x7 4578 4390 #define EXT_PHY_KR_CTRL 0x0000 4391 + #define EXT_PHY_KR_STATUS 0x0001 4392 + #define EXT_PHY_KR_AUTO_NEG_COMPLETE 0x0020 4393 + #define EXT_PHY_KR_AUTO_NEG_ADVERT 0x0010 4394 + #define EXT_PHY_KR_AUTO_NEG_ADVERT_PAUSE 0x0400 4395 + #define EXT_PHY_KR_AUTO_NEG_ADVERT_PAUSE_ASYMMETRIC 0x0800 4396 + #define EXT_PHY_KR_AUTO_NEG_ADVERT_PAUSE_BOTH 0x0C00 4397 + #define EXT_PHY_KR_AUTO_NEG_ADVERT_PAUSE_MASK 0x0C00 4398 + #define EXT_PHY_KR_LP_AUTO_NEG 0x0013 4579 4399 #define EXT_PHY_KR_CTRL2 0x0007 4580 4400 #define EXT_PHY_KR_PCS_STATUS 0x0020 4581 4401 #define EXT_PHY_KR_PMD_CTRL 0x0096 ··· 4597 4391 #define EXT_PHY_KR_MISC_CTRL1 0xca85 4598 4392 #define EXT_PHY_KR_GEN_CTRL 0xca10 4599 4393 #define EXT_PHY_KR_ROM_CODE 0xca19 4394 + #define EXT_PHY_KR_ROM_RESET_INTERNAL_MP 0x0188 4395 + #define EXT_PHY_KR_ROM_MICRO_RESET 0x018a 4396 + 4397 + #define EXT_PHY_SFX7101_XGXS_TEST1 0xc00a 4600 4398