[ide] ns87415: PA-RISC update

From: Grant Grundler <grundler@parisc-linux.org>
(minor changes by me - bart)

Move Superio (NatSem 87560) IDE hacks into the ns87415 driver
instead of exporting IDE data structures.

To date, only PA-RISC port is known to use the 87560 chip.
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 5855d2f9
......@@ -4,6 +4,7 @@
* Copyright (C) 1997-1998 Mark Lord <mlord@pobox.com>
* Copyright (C) 1998 Eddie C. Dost <ecd@skynet.be>
* Copyright (C) 1999-2000 Andre Hedrick <andre@linux-ide.org>
* Copyright (C) 2004 Grant Grundler <grundler at parisc-linux.org>
*
* Inspired by an earlier effort from David S. Miller <davem@redhat.com>
*/
......@@ -25,6 +26,81 @@
#include <asm/io.h>
#ifdef CONFIG_SUPERIO
/* SUPERIO 87560 is a PoS chip that NatSem denies exists.
* Unfortunately, it's built-in on all Astro-based PA-RISC workstations
* which use the integrated NS87514 cell for CD-ROM support.
* i.e we have to support for CD-ROM installs.
* See drivers/parisc/superio.c for more gory details.
*/
#include <asm/superio.h>
static unsigned long superio_ide_status[2];
static unsigned long superio_ide_select[2];
static unsigned long superio_ide_dma_status[2];
#define SUPERIO_IDE_MAX_RETRIES 25
/* Because of a defect in Super I/O, all reads of the PCI DMA status
* registers, IDE status register and the IDE select register need to be
* retried
*/
static u8 superio_ide_inb (unsigned long port)
{
if (port == superio_ide_status[0] ||
port == superio_ide_status[1] ||
port == superio_ide_select[0] ||
port == superio_ide_select[1] ||
port == superio_ide_dma_status[0] ||
port == superio_ide_dma_status[1]) {
u8 tmp;
int retries = SUPERIO_IDE_MAX_RETRIES;
/* printk(" [ reading port 0x%x with retry ] ", port); */
do {
tmp = inb(port);
if (tmp == 0)
udelay(50);
} while (tmp == 0 && retries-- > 0);
return tmp;
}
return inb(port);
}
static void __devinit superio_ide_init_iops (struct hwif_s *hwif)
{
u32 base, dmabase;
u8 tmp;
struct pci_dev *pdev = hwif->pci_dev;
u8 port = hwif->channel;
base = pci_resource_start(pdev, port * 2) & ~3;
dmabase = pci_resource_start(pdev, 4) & ~3;
superio_ide_status[port] = base + IDE_STATUS_OFFSET;
superio_ide_select[port] = base + IDE_SELECT_OFFSET;
superio_ide_dma_status[port] = dmabase + (!port ? 2 : 0xa);
/* Clear error/interrupt, enable dma */
tmp = superio_ide_inb(superio_ide_dma_status[port]);
outb(tmp | 0x66, superio_ide_dma_status[port]);
/* We need to override inb to workaround a SuperIO errata */
hwif->INB = superio_ide_inb;
}
static void __devinit init_iops_ns87415(ide_hwif_t *hwif)
{
if (PCI_SLOT(hwif->pci_dev->devfn) == 0xE) {
/* Built-in - assume it's under superio. */
superio_ide_init_iops(hwif);
}
}
#endif
static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 };
/*
......@@ -205,6 +281,9 @@ static void __init init_hwif_ns87415 (ide_hwif_t *hwif)
static ide_pci_device_t ns87415_chipset __devinitdata = {
.name = "NS87415",
#ifdef CONFIG_SUPERIO
.init_iops = init_iops_ns87415,
#endif
.init_hwif = init_hwif_ns87415,
.channels = 2,
.autodma = AUTODMA,
......
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