Changeset 1460
- Timestamp:
- 11/07/11 00:51:09 (7 months ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
chipset_enable.c (modified) (7 diffs)
-
ich_descriptors.h (modified) (2 diffs)
-
ichspi.c (modified) (18 diffs)
-
programmer.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/chipset_enable.c
r1454 r1460 490 490 491 491 static int enable_flash_ich_dc_spi(struct pci_dev *dev, const char *name, 492 int ich_generation)492 enum ich_chipset ich_generation) 493 493 { 494 494 int ret; … … 505 505 506 506 switch (ich_generation) { 507 case 7:507 case CHIPSET_ICH7: 508 508 /* EP80579 may need further changes, but this is the least 509 509 * intrusive way to get correct BOOT Strap printing without … … 514 514 straps_names = straps_names_ich7_nm10; 515 515 break; 516 case 8:517 case 9:518 case 10:516 case CHIPSET_ICH8: 517 case CHIPSET_ICH9: 518 case CHIPSET_ICH10: 519 519 straps_names = straps_names_ich8910; 520 520 break; 521 case 11:522 case 12:521 case CHIPSET_5_SERIES_IBEX_PEAK: 522 case CHIPSET_6_SERIES_COUGAR_POINT: 523 523 straps_names = straps_names_pch56; 524 524 break; … … 558 558 */ 559 559 buses_supported = BUS_FWH; 560 if (ich_generation == 7) {560 if (ich_generation == CHIPSET_ICH7) { 561 561 if (bbs == 0x03) { 562 562 /* If strapped to LPC, no further SPI initialization is … … 580 580 static int enable_flash_ich7(struct pci_dev *dev, const char *name) 581 581 { 582 return enable_flash_ich_dc_spi(dev, name, 7);582 return enable_flash_ich_dc_spi(dev, name, CHIPSET_ICH7); 583 583 } 584 584 585 585 static int enable_flash_ich8(struct pci_dev *dev, const char *name) 586 586 { 587 return enable_flash_ich_dc_spi(dev, name, 8);587 return enable_flash_ich_dc_spi(dev, name, CHIPSET_ICH8); 588 588 } 589 589 590 590 static int enable_flash_ich9(struct pci_dev *dev, const char *name) 591 591 { 592 return enable_flash_ich_dc_spi(dev, name, 9);592 return enable_flash_ich_dc_spi(dev, name, CHIPSET_ICH9); 593 593 } 594 594 595 595 static int enable_flash_ich10(struct pci_dev *dev, const char *name) 596 596 { 597 return enable_flash_ich_dc_spi(dev, name, 10);597 return enable_flash_ich_dc_spi(dev, name, CHIPSET_ICH10); 598 598 } 599 599 … … 601 601 static int enable_flash_pch5(struct pci_dev *dev, const char *name) 602 602 { 603 return enable_flash_ich_dc_spi(dev, name, 11);603 return enable_flash_ich_dc_spi(dev, name, CHIPSET_5_SERIES_IBEX_PEAK); 604 604 } 605 605 … … 607 607 static int enable_flash_pch6(struct pci_dev *dev, const char *name) 608 608 { 609 return enable_flash_ich_dc_spi(dev, name, 12);609 return enable_flash_ich_dc_spi(dev, name, CHIPSET_6_SERIES_COUGAR_POINT); 610 610 } 611 611 -
trunk/ich_descriptors.h
r1452 r1460 25 25 26 26 #include <stdint.h> 27 #include "programmer.h" /* for enum ich_chipset */ 27 28 28 29 /* FIXME: Replace with generic return codes */ … … 64 65 #define ICH_FREG_LIMIT(flreg) (((flreg) >> 4) & 0x01fff000) 65 66 66 /* Used to select the right descriptor printing function.67 * Currently only ICH8 and Ibex Peak are supported.68 */69 enum ich_chipset {70 CHIPSET_ICH_UNKNOWN,71 CHIPSET_ICH7 = 7,72 CHIPSET_ICH8,73 CHIPSET_ICH9,74 CHIPSET_ICH10,75 CHIPSET_5_SERIES_IBEX_PEAK,76 CHIPSET_6_SERIES_COUGAR_POINT,77 CHIPSET_7_SERIES_PANTHER_POINT78 };79 80 67 void prettyprint_ich_reg_vscc(uint32_t reg_val, int verbosity); 81 68 -
trunk/ichspi.c
r1452 r1460 173 173 static int ichspi_lock = 0; 174 174 175 static enum ich_chipset ich_generation = CHIPSET_ICH_UNKNOWN; 175 176 uint32_t ichspi_bbar = 0; 176 177 … … 455 456 } 456 457 457 switch (spi_programmer->type) { 458 case SPI_CONTROLLER_ICH7: 459 case SPI_CONTROLLER_VIA: 458 switch (ich_generation) { 459 case CHIPSET_ICH7: 460 460 preop = REGREAD16(ICH7_REG_PREOP); 461 461 optype = REGREAD16(ICH7_REG_OPTYPE); … … 463 463 opmenu[1] = REGREAD32(ICH7_REG_OPMENU + 4); 464 464 break; 465 case SPI_CONTROLLER_ICH9: 465 case CHIPSET_ICH8: 466 default: /* Future version might behave the same */ 466 467 preop = REGREAD16(ICH9_REG_PREOP); 467 468 optype = REGREAD16(ICH9_REG_OPTYPE); … … 469 470 opmenu[1] = REGREAD32(ICH9_REG_OPMENU + 4); 470 471 break; 471 default:472 msg_perr("%s: unsupported chipset\n", __func__);473 return -1;474 472 } 475 473 … … 530 528 531 529 msg_pdbg("\n%s: preop=%04x optype=%04x opmenu=%08x%08x\n", __func__, preop, optype, opmenu[0], opmenu[1]); 532 switch (spi_programmer->type) { 533 case SPI_CONTROLLER_ICH7: 534 case SPI_CONTROLLER_VIA: 530 switch (ich_generation) { 531 case CHIPSET_ICH7: 535 532 /* Register undo only for enable_undo=1, i.e. first call. */ 536 533 if (enable_undo) { … … 545 542 mmio_writel(opmenu[1], ich_spibar + ICH7_REG_OPMENU + 4); 546 543 break; 547 case SPI_CONTROLLER_ICH9: 544 case CHIPSET_ICH8: 545 default: /* Future version might behave the same */ 548 546 /* Register undo only for enable_undo=1, i.e. first call. */ 549 547 if (enable_undo) { … … 558 556 mmio_writel(opmenu[1], ich_spibar + ICH9_REG_OPMENU + 4); 559 557 break; 560 default:561 msg_perr("%s: unsupported chipset\n", __func__);562 return -1;563 558 } 564 559 … … 570 565 * it didn't stick. 571 566 */ 572 static void ich_set_bbar( int ich_generation,uint32_t min_addr)567 static void ich_set_bbar(uint32_t min_addr) 573 568 { 574 569 int bbar_off; 575 570 switch (ich_generation) { 576 case 7:571 case CHIPSET_ICH7: 577 572 bbar_off = 0x50; 578 573 break; 579 case 8:574 case CHIPSET_ICH8: 580 575 msg_perr("BBAR offset is unknown on ICH8!\n"); 581 576 return; 577 case CHIPSET_ICH9: 582 578 default: /* Future version might behave the same */ 583 579 bbar_off = ICH9_REG_BBAR; … … 944 940 } 945 941 946 switch (spi_programmer->type) { 947 case SPI_CONTROLLER_VIA: 948 case SPI_CONTROLLER_ICH7: 942 switch (ich_generation) { 943 case CHIPSET_ICH7: 949 944 return ich7_run_opcode(op, offset, datalength, data, maxlength); 950 case SPI_CONTROLLER_ICH9: 945 case CHIPSET_ICH8: 946 default: /* Future version might behave the same */ 951 947 return ich9_run_opcode(op, offset, datalength, data); 952 default:953 /* If we ever get here, something really weird happened */954 return -1;955 948 } 956 949 } … … 1023 1016 addr = (writearr[1] << 16) | 1024 1017 (writearr[2] << 8) | (writearr[3] << 0); 1025 switch (spi_programmer->type) { 1026 case SPI_CONTROLLER_ICH7: 1027 case SPI_CONTROLLER_VIA: 1028 case SPI_CONTROLLER_ICH9: 1029 if (addr < ichspi_bbar) { 1030 msg_perr("%s: Address 0x%06x below allowed " 1031 "range 0x%06x-0xffffff\n", __func__, 1032 addr, ichspi_bbar); 1033 return SPI_INVALID_ADDRESS; 1034 } 1035 break; 1036 default: 1037 break; 1018 if (addr < ichspi_bbar) { 1019 msg_perr("%s: Address 0x%06x below allowed " 1020 "range 0x%06x-0xffffff\n", __func__, 1021 addr, ichspi_bbar); 1022 return SPI_INVALID_ADDRESS; 1038 1023 } 1039 1024 } … … 1317 1302 1318 1303 int ich_init_spi(struct pci_dev *dev, uint32_t base, void *rcrb, 1319 int ich_generation)1304 enum ich_chipset ich_gen) 1320 1305 { 1321 1306 int i; … … 1325 1310 int desc_valid = 0; 1326 1311 1312 ich_generation = ich_gen; 1313 1327 1314 switch (ich_generation) { 1328 case 7: 1315 case CHIPSET_ICH_UNKNOWN: 1316 return -1; 1317 case CHIPSET_ICH7: 1318 case CHIPSET_ICH8: 1329 1319 spibar_offset = 0x3020; 1330 1320 break; 1331 case 8: 1332 spibar_offset = 0x3020; 1333 break; 1334 case 9: 1335 case 10: 1321 case CHIPSET_ICH9: 1336 1322 default: /* Future version might behave the same */ 1337 1323 spibar_offset = 0x3800; … … 1346 1332 1347 1333 switch (ich_generation) { 1348 case 7:1334 case CHIPSET_ICH7: 1349 1335 msg_pdbg("0x00: 0x%04x (SPIS)\n", 1350 1336 mmio_readw(ich_spibar + 0)); … … 1382 1368 ichspi_lock = 1; 1383 1369 } 1384 ich_set_bbar( ich_generation,0);1370 ich_set_bbar(0); 1385 1371 register_spi_programmer(&spi_programmer_ich7); 1386 1372 ich_init_opcodes(); 1387 1373 break; 1388 case 8: 1389 case 9: 1390 case 10: 1374 case CHIPSET_ICH8: 1391 1375 default: /* Future version might behave the same */ 1392 1376 tmp2 = mmio_readw(ich_spibar + ICH9_REG_HSFS); … … 1448 1432 msg_pdbg("0x9C: 0x%08x (OPMENU+4)\n", 1449 1433 mmio_readl(ich_spibar + ICH9_REG_OPMENU + 4)); 1450 if (ich_generation == 8) {1434 if (ich_generation == CHIPSET_ICH8) { 1451 1435 tmp = mmio_readl(ich_spibar + ICH8_REG_VSCC); 1452 1436 msg_pdbg("0xC1: 0x%08x (VSCC)\n", tmp); … … 1470 1454 tmp = mmio_readl(ich_spibar + ICH9_REG_FPB); 1471 1455 msg_pdbg("0xD0: 0x%08x (FPB)\n", tmp); 1472 ich_set_bbar( ich_generation,0);1456 ich_set_bbar(0); 1473 1457 } 1474 1458 … … 1525 1509 /* Not sure if it speaks all these bus protocols. */ 1526 1510 buses_supported = BUS_LPC | BUS_FWH; 1511 ich_generation = CHIPSET_ICH7; 1527 1512 register_spi_programmer(&spi_programmer_via); 1528 1513 … … 1557 1542 } 1558 1543 1559 ich_set_bbar( 7,0);1544 ich_set_bbar(0); 1560 1545 ich_init_opcodes(); 1561 1546 -
trunk/programmer.h
r1459 r1460 580 580 /* ichspi.c */ 581 581 #if CONFIG_INTERNAL == 1 582 enum ich_chipset { 583 CHIPSET_ICH_UNKNOWN, 584 CHIPSET_ICH7 = 7, 585 CHIPSET_ICH8, 586 CHIPSET_ICH9, 587 CHIPSET_ICH10, 588 CHIPSET_5_SERIES_IBEX_PEAK, 589 CHIPSET_6_SERIES_COUGAR_POINT, 590 CHIPSET_7_SERIES_PANTHER_POINT 591 }; 592 582 593 extern uint32_t ichspi_bbar; 583 594 int ich_init_spi(struct pci_dev *dev, uint32_t base, void *rcrb, 584 int ich_generation);595 enum ich_chipset ich_generation); 585 596 int via_init_spi(struct pci_dev *dev); 586 597
Note: See TracChangeset
for help on using the changeset viewer.
