Commit 90778574 authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by Bartlomiej Zolnierkiewicz

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: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent f36702b4
/* /*
* linux/drivers/ide/pci/hpt366.c Version 0.43 May 17, 2006 * linux/drivers/ide/pci/hpt366.c Version 0.44 May 20, 2006
* *
* Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
* Portions Copyright (C) 2001 Sun Microsystems, Inc. * Portions Copyright (C) 2001 Sun Microsystems, Inc.
...@@ -76,6 +76,8 @@ ...@@ -76,6 +76,8 @@
* and for HPT36x the obsolete HDIO_TRISTATE_HWIF handler was called instead * and for HPT36x the obsolete HDIO_TRISTATE_HWIF handler was called instead
* - pass to init_chipset() handlers a copy of the IDE PCI device structure as * - pass to init_chipset() handlers a copy of the IDE PCI device structure as
* they tamper with its fields * they tamper with its fields
* - prefix the driver startup messages with the real chip name
* - claim the extra 240 bytes of I/O space for all chips
* - optimize the rate masking/filtering and the drive list lookup code * - optimize the rate masking/filtering and the drive list lookup code
* <source@mvista.com> * <source@mvista.com>
* *
...@@ -994,8 +996,9 @@ static void __devinit hpt366_clocking(ide_hwif_t *hwif) ...@@ -994,8 +996,9 @@ static void __devinit hpt366_clocking(ide_hwif_t *hwif)
static void __devinit hpt37x_clocking(ide_hwif_t *hwif) static void __devinit hpt37x_clocking(ide_hwif_t *hwif)
{ {
struct hpt_info *info = ide_get_hwifdata(hwif); struct hpt_info *info = ide_get_hwifdata(hwif);
struct pci_dev *dev = hwif->pci_dev; struct pci_dev *dev = hwif->pci_dev;
char *name = hwif->cds->name;
int adjust, i; int adjust, i;
u16 freq = 0; u16 freq = 0;
u32 pll, temp = 0; u32 pll, temp = 0;
...@@ -1028,7 +1031,7 @@ static void __devinit hpt37x_clocking(ide_hwif_t *hwif) ...@@ -1028,7 +1031,7 @@ static void __devinit hpt37x_clocking(ide_hwif_t *hwif)
*/ */
temp = inl(pci_resource_start(dev, 4) + 0x90); temp = inl(pci_resource_start(dev, 4) + 0x90);
if ((temp & 0xFFFFF000) != 0xABCDE000) { if ((temp & 0xFFFFF000) != 0xABCDE000) {
printk(KERN_WARNING "HPT37X: no clock data saved by BIOS\n"); printk(KERN_WARNING "%s: no clock data saved by BIOS\n", name);
/* Calculate the average value of f_CNT */ /* Calculate the average value of f_CNT */
for (temp = i = 0; i < 128; i++) { for (temp = i = 0; i < 128; i++) {
...@@ -1055,10 +1058,7 @@ static void __devinit hpt37x_clocking(ide_hwif_t *hwif) ...@@ -1055,10 +1058,7 @@ static void __devinit hpt37x_clocking(ide_hwif_t *hwif)
else else
pll = F_LOW_PCI_66; pll = F_LOW_PCI_66;
printk(KERN_INFO "HPT3xxN detected, FREQ: %d, PLL: %d\n", freq, pll); } else {
}
else
{
if(freq < 0x9C) if(freq < 0x9C)
pll = F_LOW_PCI_33; pll = F_LOW_PCI_33;
else if(freq < 0xb0) else if(freq < 0xb0)
...@@ -1067,18 +1067,21 @@ static void __devinit hpt37x_clocking(ide_hwif_t *hwif) ...@@ -1067,18 +1067,21 @@ static void __devinit hpt37x_clocking(ide_hwif_t *hwif)
pll = F_LOW_PCI_50; pll = F_LOW_PCI_50;
else else
pll = F_LOW_PCI_66; pll = F_LOW_PCI_66;
}
printk(KERN_INFO "%s: FREQ: %d, PLL: %d\n", name, freq, pll);
if (!(info->flags & IS_3xxN)) {
if (pll == F_LOW_PCI_33) { if (pll == F_LOW_PCI_33) {
info->speed = thirty_three_base_hpt37x; info->speed = thirty_three_base_hpt37x;
printk(KERN_DEBUG "HPT37X: using 33MHz PCI clock\n"); printk(KERN_DEBUG "%s: using 33MHz PCI clock\n", name);
} else if (pll == F_LOW_PCI_40) { } else if (pll == F_LOW_PCI_40) {
/* Unsupported */ /* Unsupported */
} else if (pll == F_LOW_PCI_50) { } else if (pll == F_LOW_PCI_50) {
info->speed = fifty_base_hpt37x; info->speed = fifty_base_hpt37x;
printk(KERN_DEBUG "HPT37X: using 50MHz PCI clock\n"); printk(KERN_DEBUG "%s: using 50MHz PCI clock\n", name);
} else { } else {
info->speed = sixty_six_base_hpt37x; info->speed = sixty_six_base_hpt37x;
printk(KERN_DEBUG "HPT37X: using 66MHz PCI clock\n"); printk(KERN_DEBUG "%s: using 66MHz PCI clock\n", name);
} }
} }
...@@ -1127,7 +1130,7 @@ static void __devinit hpt37x_clocking(ide_hwif_t *hwif) ...@@ -1127,7 +1130,7 @@ static void __devinit hpt37x_clocking(ide_hwif_t *hwif)
pci_write_config_byte(dev, 0x5b, 0x21); pci_write_config_byte(dev, 0x5b, 0x21);
info->speed = fifty_base_hpt37x; info->speed = fifty_base_hpt37x;
printk("HPT37X: using 50MHz internal PLL\n"); printk("%s: using 50MHz internal PLL\n", name);
goto init_hpt37X_done; goto init_hpt37X_done;
} }
} }
...@@ -1140,8 +1143,8 @@ static void __devinit hpt37x_clocking(ide_hwif_t *hwif) ...@@ -1140,8 +1143,8 @@ static void __devinit hpt37x_clocking(ide_hwif_t *hwif)
init_hpt37X_done: init_hpt37X_done:
if (!info->speed) if (!info->speed)
printk(KERN_ERR "HPT37x%s: unknown bus timing [%d %d].\n", printk(KERN_ERR "%s: unknown bus timing [%d %d].\n",
(info->flags & IS_3xxN) ? "N" : "", pll, freq); name, pll, freq);
/* /*
* Reset the state engines. * Reset the state engines.
* NOTE: avoid accidentally enabling the primary channel on HPT371N. * 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,7 +1337,8 @@ static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase)
return; return;
if(info->speed == NULL) { if(info->speed == NULL) {
printk(KERN_WARNING "hpt366: no known IDE timings, disabling DMA.\n"); printk(KERN_WARNING "%s: no known IDE timings, disabling DMA.\n",
hwif->cds->name);
return; return;
} }
...@@ -1369,7 +1373,7 @@ static void __devinit init_iops_hpt366(ide_hwif_t *hwif) ...@@ -1369,7 +1373,7 @@ static void __devinit init_iops_hpt366(ide_hwif_t *hwif)
u8 mode, rid = 0; u8 mode, rid = 0;
if(info == NULL) { if(info == NULL) {
printk(KERN_WARNING "hpt366: out of memory.\n"); printk(KERN_WARNING "%s: out of memory.\n", hwif->cds->name);
return; return;
} }
ide_set_hwifdata(hwif, info); 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,14 +1438,19 @@ static int __devinit init_setup_hpt374(struct pci_dev *dev, ide_pci_device_t *d)
return ide_setup_pci_device(dev, d); return ide_setup_pci_device(dev, d);
} }
static int __devinit init_setup_hpt37x(struct pci_dev *dev, ide_pci_device_t *d) static int __devinit init_setup_hpt372n(struct pci_dev *dev, ide_pci_device_t *d)
{ {
return ide_setup_pci_device(dev, d); return ide_setup_pci_device(dev, d);
} }
static int __devinit init_setup_hpt371(struct pci_dev *dev, ide_pci_device_t *d) static int __devinit init_setup_hpt371(struct pci_dev *dev, ide_pci_device_t *d)
{ {
u8 mcr1 = 0; u8 rev = 0, mcr1 = 0;
pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
if (rev > 1)
d->name = "HPT371N";
/* /*
* HPT371 chips physically have only one channel, the secondary one, * 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,7 +1460,31 @@ static int __devinit init_setup_hpt371(struct pci_dev *dev, ide_pci_device_t *d)
*/ */
pci_read_config_byte(dev, 0x50, &mcr1); pci_read_config_byte(dev, 0x50, &mcr1);
if (mcr1 & 0x04) if (mcr1 & 0x04)
pci_write_config_byte(dev, 0x50, (mcr1 & ~0x04)); pci_write_config_byte(dev, 0x50, mcr1 & ~0x04);
return ide_setup_pci_device(dev, d);
}
static int __devinit init_setup_hpt372a(struct pci_dev *dev, ide_pci_device_t *d)
{
u8 rev = 0;
pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
if (rev > 1)
d->name = "HPT372N";
return ide_setup_pci_device(dev, d);
}
static int __devinit init_setup_hpt302(struct pci_dev *dev, ide_pci_device_t *d)
{
u8 rev = 0;
pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
if (rev > 1)
d->name = "HPT302N";
return ide_setup_pci_device(dev, d); return ide_setup_pci_device(dev, d);
} }
...@@ -1460,30 +1493,22 @@ static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d) ...@@ -1460,30 +1493,22 @@ static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d)
{ {
struct pci_dev *findev = NULL; struct pci_dev *findev = NULL;
u8 rev = 0, pin1 = 0, pin2 = 0; u8 rev = 0, pin1 = 0, pin2 = 0;
char *chipset_names[] = {"HPT366", "HPT366", "HPT368", static char *chipset_names[] = { "HPT366", "HPT366", "HPT368",
"HPT370", "HPT370A", "HPT372", "HPT370", "HPT370A", "HPT372",
"HPT372N" }; "HPT372N" };
if (PCI_FUNC(dev->devfn) & 1) if (PCI_FUNC(dev->devfn) & 1)
return -ENODEV; return -ENODEV;
pci_read_config_byte(dev, PCI_REVISION_ID, &rev); pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
if(dev->device == PCI_DEVICE_ID_TTI_HPT372N) if (rev > 6)
rev = 6; rev = 6;
if(rev <= 6) d->name = chipset_names[rev];
d->name = chipset_names[rev];
switch(rev) { if (rev > 2)
case 6: goto init_single;
case 5:
case 4:
case 3:
goto init_single;
default:
break;
}
d->channels = 1; d->channels = 1;
...@@ -1521,7 +1546,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { ...@@ -1521,7 +1546,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
.extra = 240 .extra = 240
},{ /* 1 */ },{ /* 1 */
.name = "HPT372A", .name = "HPT372A",
.init_setup = init_setup_hpt37x, .init_setup = init_setup_hpt372a,
.init_chipset = init_chipset_hpt366, .init_chipset = init_chipset_hpt366,
.init_iops = init_iops_hpt366, .init_iops = init_iops_hpt366,
.init_hwif = init_hwif_hpt366, .init_hwif = init_hwif_hpt366,
...@@ -1529,9 +1554,10 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { ...@@ -1529,9 +1554,10 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.bootable = OFF_BOARD, .bootable = OFF_BOARD,
.extra = 240
},{ /* 2 */ },{ /* 2 */
.name = "HPT302", .name = "HPT302",
.init_setup = init_setup_hpt37x, .init_setup = init_setup_hpt302,
.init_chipset = init_chipset_hpt366, .init_chipset = init_chipset_hpt366,
.init_iops = init_iops_hpt366, .init_iops = init_iops_hpt366,
.init_hwif = init_hwif_hpt366, .init_hwif = init_hwif_hpt366,
...@@ -1539,6 +1565,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { ...@@ -1539,6 +1565,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.bootable = OFF_BOARD, .bootable = OFF_BOARD,
.extra = 240
},{ /* 3 */ },{ /* 3 */
.name = "HPT371", .name = "HPT371",
.init_setup = init_setup_hpt371, .init_setup = init_setup_hpt371,
...@@ -1550,6 +1577,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { ...@@ -1550,6 +1577,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
.autodma = AUTODMA, .autodma = AUTODMA,
.enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
.bootable = OFF_BOARD, .bootable = OFF_BOARD,
.extra = 240
},{ /* 4 */ },{ /* 4 */
.name = "HPT374", .name = "HPT374",
.init_setup = init_setup_hpt374, .init_setup = init_setup_hpt374,
...@@ -1560,9 +1588,10 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { ...@@ -1560,9 +1588,10 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
.channels = 2, /* 4 */ .channels = 2, /* 4 */
.autodma = AUTODMA, .autodma = AUTODMA,
.bootable = OFF_BOARD, .bootable = OFF_BOARD,
.extra = 240
},{ /* 5 */ },{ /* 5 */
.name = "HPT372N", .name = "HPT372N",
.init_setup = init_setup_hpt37x, .init_setup = init_setup_hpt372n,
.init_chipset = init_chipset_hpt366, .init_chipset = init_chipset_hpt366,
.init_iops = init_iops_hpt366, .init_iops = init_iops_hpt366,
.init_hwif = init_hwif_hpt366, .init_hwif = init_hwif_hpt366,
...@@ -1570,6 +1599,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { ...@@ -1570,6 +1599,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
.channels = 2, /* 4 */ .channels = 2, /* 4 */
.autodma = AUTODMA, .autodma = AUTODMA,
.bootable = OFF_BOARD, .bootable = OFF_BOARD,
.extra = 240
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment