aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2007-02-07 12:17:51 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-02-07 12:17:51 -0500
commit90778574c9257ea2d11c433626e1b12ac4135e0a (patch)
tree21a214527e523e7e6c982b194eed5df99b897ca2 /drivers
parentf36702b4de1f7ea57927c8eb88d624504d33fc34 (diff)
hpt366: print the real chip name at startup
- Rework the driver setup code so that it prefixes the driver startup messages with the real chip name. - Print the measured f_CNT value and the DPLL setting for non-HPT3xx chips as well. - Claim the extra 240 bytes of I/O space for all chips, not only for those having PCI device ID of 0x0004. Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/pci/hpt366.c104
1 files changed, 67 insertions, 37 deletions
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 28bf2bad1541..32a40710e73e 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/hpt366.c Version 0.43 May 17, 2006 2 * linux/drivers/ide/pci/hpt366.c Version 0.44 May 20, 2006
3 * 3 *
4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
5 * Portions Copyright (C) 2001 Sun Microsystems, Inc. 5 * Portions Copyright (C) 2001 Sun Microsystems, Inc.
@@ -76,6 +76,8 @@
76 * and for HPT36x the obsolete HDIO_TRISTATE_HWIF handler was called instead 76 * and for HPT36x the obsolete HDIO_TRISTATE_HWIF handler was called instead
77 * - pass to init_chipset() handlers a copy of the IDE PCI device structure as 77 * - pass to init_chipset() handlers a copy of the IDE PCI device structure as
78 * they tamper with its fields 78 * they tamper with its fields
79 * - prefix the driver startup messages with the real chip name
80 * - claim the extra 240 bytes of I/O space for all chips
79 * - optimize the rate masking/filtering and the drive list lookup code 81 * - optimize the rate masking/filtering and the drive list lookup code
80 * <source@mvista.com> 82 * <source@mvista.com>
81 * 83 *
@@ -994,8 +996,9 @@ static void __devinit hpt366_clocking(ide_hwif_t *hwif)
994 996
995static void __devinit hpt37x_clocking(ide_hwif_t *hwif) 997static void __devinit hpt37x_clocking(ide_hwif_t *hwif)
996{ 998{
997 struct hpt_info *info = ide_get_hwifdata(hwif); 999 struct hpt_info *info = ide_get_hwifdata(hwif);
998 struct pci_dev *dev = hwif->pci_dev; 1000 struct pci_dev *dev = hwif->pci_dev;
1001 char *name = hwif->cds->name;
999 int adjust, i; 1002 int adjust, i;
1000 u16 freq = 0; 1003 u16 freq = 0;
1001 u32 pll, temp = 0; 1004 u32 pll, temp = 0;
@@ -1028,7 +1031,7 @@ static void __devinit hpt37x_clocking(ide_hwif_t *hwif)
1028 */ 1031 */
1029 temp = inl(pci_resource_start(dev, 4) + 0x90); 1032 temp = inl(pci_resource_start(dev, 4) + 0x90);
1030 if ((temp & 0xFFFFF000) != 0xABCDE000) { 1033 if ((temp & 0xFFFFF000) != 0xABCDE000) {
1031 printk(KERN_WARNING "HPT37X: no clock data saved by BIOS\n"); 1034 printk(KERN_WARNING "%s: no clock data saved by BIOS\n", name);
1032 1035
1033 /* Calculate the average value of f_CNT */ 1036 /* Calculate the average value of f_CNT */
1034 for (temp = i = 0; i < 128; i++) { 1037 for (temp = i = 0; i < 128; i++) {
@@ -1055,10 +1058,7 @@ static void __devinit hpt37x_clocking(ide_hwif_t *hwif)
1055 else 1058 else
1056 pll = F_LOW_PCI_66; 1059 pll = F_LOW_PCI_66;
1057 1060
1058 printk(KERN_INFO "HPT3xxN detected, FREQ: %d, PLL: %d\n", freq, pll); 1061 } else {
1059 }
1060 else
1061 {
1062 if(freq < 0x9C) 1062 if(freq < 0x9C)
1063 pll = F_LOW_PCI_33; 1063 pll = F_LOW_PCI_33;
1064 else if(freq < 0xb0) 1064 else if(freq < 0xb0)
@@ -1067,18 +1067,21 @@ static void __devinit hpt37x_clocking(ide_hwif_t *hwif)
1067 pll = F_LOW_PCI_50; 1067 pll = F_LOW_PCI_50;
1068 else 1068 else
1069 pll = F_LOW_PCI_66; 1069 pll = F_LOW_PCI_66;
1070 }
1071 printk(KERN_INFO "%s: FREQ: %d, PLL: %d\n", name, freq, pll);
1070 1072
1073 if (!(info->flags & IS_3xxN)) {
1071 if (pll == F_LOW_PCI_33) { 1074 if (pll == F_LOW_PCI_33) {
1072 info->speed = thirty_three_base_hpt37x; 1075 info->speed = thirty_three_base_hpt37x;
1073 printk(KERN_DEBUG "HPT37X: using 33MHz PCI clock\n"); 1076 printk(KERN_DEBUG "%s: using 33MHz PCI clock\n", name);
1074 } else if (pll == F_LOW_PCI_40) { 1077 } else if (pll == F_LOW_PCI_40) {
1075 /* Unsupported */ 1078 /* Unsupported */
1076 } else if (pll == F_LOW_PCI_50) { 1079 } else if (pll == F_LOW_PCI_50) {
1077 info->speed = fifty_base_hpt37x; 1080 info->speed = fifty_base_hpt37x;
1078 printk(KERN_DEBUG "HPT37X: using 50MHz PCI clock\n"); 1081 printk(KERN_DEBUG "%s: using 50MHz PCI clock\n", name);
1079 } else { 1082 } else {
1080 info->speed = sixty_six_base_hpt37x; 1083 info->speed = sixty_six_base_hpt37x;
1081 printk(KERN_DEBUG "HPT37X: using 66MHz PCI clock\n"); 1084 printk(KERN_DEBUG "%s: using 66MHz PCI clock\n", name);
1082 } 1085 }
1083 } 1086 }
1084 1087
@@ -1127,7 +1130,7 @@ static void __devinit hpt37x_clocking(ide_hwif_t *hwif)
1127 pci_write_config_byte(dev, 0x5b, 0x21); 1130 pci_write_config_byte(dev, 0x5b, 0x21);
1128 1131
1129 info->speed = fifty_base_hpt37x; 1132 info->speed = fifty_base_hpt37x;
1130 printk("HPT37X: using 50MHz internal PLL\n"); 1133 printk("%s: using 50MHz internal PLL\n", name);
1131 goto init_hpt37X_done; 1134 goto init_hpt37X_done;
1132 } 1135 }
1133 } 1136 }
@@ -1140,8 +1143,8 @@ pll_recal:
1140 1143
1141init_hpt37X_done: 1144init_hpt37X_done:
1142 if (!info->speed) 1145 if (!info->speed)
1143 printk(KERN_ERR "HPT37x%s: unknown bus timing [%d %d].\n", 1146 printk(KERN_ERR "%s: unknown bus timing [%d %d].\n",
1144 (info->flags & IS_3xxN) ? "N" : "", pll, freq); 1147 name, pll, freq);
1145 /* 1148 /*
1146 * Reset the state engines. 1149 * Reset the state engines.
1147 * NOTE: avoid accidentally enabling the primary channel on HPT371N. 1150 * NOTE: avoid accidentally enabling the primary channel on HPT371N.
@@ -1334,7 +1337,8 @@ static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase)
1334 return; 1337 return;
1335 1338
1336 if(info->speed == NULL) { 1339 if(info->speed == NULL) {
1337 printk(KERN_WARNING "hpt366: no known IDE timings, disabling DMA.\n"); 1340 printk(KERN_WARNING "%s: no known IDE timings, disabling DMA.\n",
1341 hwif->cds->name);
1338 return; 1342 return;
1339 } 1343 }
1340 1344
@@ -1369,7 +1373,7 @@ static void __devinit init_iops_hpt366(ide_hwif_t *hwif)
1369 u8 mode, rid = 0; 1373 u8 mode, rid = 0;
1370 1374
1371 if(info == NULL) { 1375 if(info == NULL) {
1372 printk(KERN_WARNING "hpt366: out of memory.\n"); 1376 printk(KERN_WARNING "%s: out of memory.\n", hwif->cds->name);
1373 return; 1377 return;
1374 } 1378 }
1375 ide_set_hwifdata(hwif, info); 1379 ide_set_hwifdata(hwif, info);
@@ -1434,14 +1438,19 @@ static int __devinit init_setup_hpt374(struct pci_dev *dev, ide_pci_device_t *d)
1434 return ide_setup_pci_device(dev, d); 1438 return ide_setup_pci_device(dev, d);
1435} 1439}
1436 1440
1437static int __devinit init_setup_hpt37x(struct pci_dev *dev, ide_pci_device_t *d) 1441static int __devinit init_setup_hpt372n(struct pci_dev *dev, ide_pci_device_t *d)
1438{ 1442{
1439 return ide_setup_pci_device(dev, d); 1443 return ide_setup_pci_device(dev, d);
1440} 1444}
1441 1445
1442static int __devinit init_setup_hpt371(struct pci_dev *dev, ide_pci_device_t *d) 1446static int __devinit init_setup_hpt371(struct pci_dev *dev, ide_pci_device_t *d)
1443{ 1447{
1444 u8 mcr1 = 0; 1448 u8 rev = 0, mcr1 = 0;
1449
1450 pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
1451
1452 if (rev > 1)
1453 d->name = "HPT371N";
1445 1454
1446 /* 1455 /*
1447 * HPT371 chips physically have only one channel, the secondary one, 1456 * HPT371 chips physically have only one channel, the secondary one,
@@ -1451,7 +1460,31 @@ static int __devinit init_setup_hpt371(struct pci_dev *dev, ide_pci_device_t *d)
1451 */ 1460 */
1452 pci_read_config_byte(dev, 0x50, &mcr1); 1461 pci_read_config_byte(dev, 0x50, &mcr1);
1453 if (mcr1 & 0x04) 1462 if (mcr1 & 0x04)
1454 pci_write_config_byte(dev, 0x50, (mcr1 & ~0x04)); 1463 pci_write_config_byte(dev, 0x50, mcr1 & ~0x04);
1464
1465 return ide_setup_pci_device(dev, d);
1466}
1467
1468static int __devinit init_setup_hpt372a(struct pci_dev *dev, ide_pci_device_t *d)
1469{
1470 u8 rev = 0;
1471
1472 pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
1473
1474 if (rev > 1)
1475 d->name = "HPT372N";
1476
1477 return ide_setup_pci_device(dev, d);
1478}
1479
1480static int __devinit init_setup_hpt302(struct pci_dev *dev, ide_pci_device_t *d)
1481{
1482 u8 rev = 0;
1483
1484 pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
1485
1486 if (rev > 1)
1487 d->name = "HPT302N";
1455 1488
1456 return ide_setup_pci_device(dev, d); 1489 return ide_setup_pci_device(dev, d);
1457} 1490}
@@ -1460,30 +1493,22 @@ static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d)
1460{ 1493{
1461 struct pci_dev *findev = NULL; 1494 struct pci_dev *findev = NULL;
1462 u8 rev = 0, pin1 = 0, pin2 = 0; 1495 u8 rev = 0, pin1 = 0, pin2 = 0;
1463 char *chipset_names[] = {"HPT366", "HPT366", "HPT368", 1496 static char *chipset_names[] = { "HPT366", "HPT366", "HPT368",
1464 "HPT370", "HPT370A", "HPT372", 1497 "HPT370", "HPT370A", "HPT372",
1465 "HPT372N" }; 1498 "HPT372N" };
1466 1499
1467 if (PCI_FUNC(dev->devfn) & 1) 1500 if (PCI_FUNC(dev->devfn) & 1)
1468 return -ENODEV; 1501 return -ENODEV;
1469 1502
1470 pci_read_config_byte(dev, PCI_REVISION_ID, &rev); 1503 pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
1471 1504
1472 if(dev->device == PCI_DEVICE_ID_TTI_HPT372N) 1505 if (rev > 6)
1473 rev = 6; 1506 rev = 6;
1474 1507
1475 if(rev <= 6) 1508 d->name = chipset_names[rev];
1476 d->name = chipset_names[rev];
1477 1509
1478 switch(rev) { 1510 if (rev > 2)
1479 case 6: 1511 goto init_single;
1480 case 5:
1481 case 4:
1482 case 3:
1483 goto init_single;
1484 default:
1485 break;
1486 }
1487 1512
1488 d->channels = 1; 1513 d->channels = 1;
1489 1514
@@ -1521,7 +1546,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
1521 .extra = 240 1546 .extra = 240
1522 },{ /* 1 */ 1547 },{ /* 1 */
1523 .name = "HPT372A", 1548 .name = "HPT372A",
1524 .init_setup = init_setup_hpt37x, 1549 .init_setup = init_setup_hpt372a,
1525 .init_chipset = init_chipset_hpt366, 1550 .init_chipset = init_chipset_hpt366,
1526 .init_iops = init_iops_hpt366, 1551 .init_iops = init_iops_hpt366,
1527 .init_hwif = init_hwif_hpt366, 1552 .init_hwif = init_hwif_hpt366,
@@ -1529,9 +1554,10 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
1529 .channels = 2, 1554 .channels = 2,
1530 .autodma = AUTODMA, 1555 .autodma = AUTODMA,
1531 .bootable = OFF_BOARD, 1556 .bootable = OFF_BOARD,
1557 .extra = 240
1532 },{ /* 2 */ 1558 },{ /* 2 */
1533 .name = "HPT302", 1559 .name = "HPT302",
1534 .init_setup = init_setup_hpt37x, 1560 .init_setup = init_setup_hpt302,
1535 .init_chipset = init_chipset_hpt366, 1561 .init_chipset = init_chipset_hpt366,
1536 .init_iops = init_iops_hpt366, 1562 .init_iops = init_iops_hpt366,
1537 .init_hwif = init_hwif_hpt366, 1563 .init_hwif = init_hwif_hpt366,
@@ -1539,6 +1565,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
1539 .channels = 2, 1565 .channels = 2,
1540 .autodma = AUTODMA, 1566 .autodma = AUTODMA,
1541 .bootable = OFF_BOARD, 1567 .bootable = OFF_BOARD,
1568 .extra = 240
1542 },{ /* 3 */ 1569 },{ /* 3 */
1543 .name = "HPT371", 1570 .name = "HPT371",
1544 .init_setup = init_setup_hpt371, 1571 .init_setup = init_setup_hpt371,
@@ -1550,6 +1577,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
1550 .autodma = AUTODMA, 1577 .autodma = AUTODMA,
1551 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1578 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1552 .bootable = OFF_BOARD, 1579 .bootable = OFF_BOARD,
1580 .extra = 240
1553 },{ /* 4 */ 1581 },{ /* 4 */
1554 .name = "HPT374", 1582 .name = "HPT374",
1555 .init_setup = init_setup_hpt374, 1583 .init_setup = init_setup_hpt374,
@@ -1560,9 +1588,10 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
1560 .channels = 2, /* 4 */ 1588 .channels = 2, /* 4 */
1561 .autodma = AUTODMA, 1589 .autodma = AUTODMA,
1562 .bootable = OFF_BOARD, 1590 .bootable = OFF_BOARD,
1591 .extra = 240
1563 },{ /* 5 */ 1592 },{ /* 5 */
1564 .name = "HPT372N", 1593 .name = "HPT372N",
1565 .init_setup = init_setup_hpt37x, 1594 .init_setup = init_setup_hpt372n,
1566 .init_chipset = init_chipset_hpt366, 1595 .init_chipset = init_chipset_hpt366,
1567 .init_iops = init_iops_hpt366, 1596 .init_iops = init_iops_hpt366,
1568 .init_hwif = init_hwif_hpt366, 1597 .init_hwif = init_hwif_hpt366,
@@ -1570,6 +1599,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
1570 .channels = 2, /* 4 */ 1599 .channels = 2, /* 4 */
1571 .autodma = AUTODMA, 1600 .autodma = AUTODMA,
1572 .bootable = OFF_BOARD, 1601 .bootable = OFF_BOARD,
1602 .extra = 240
1573 } 1603 }
1574}; 1604};
1575 1605