18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 1997-1998	Mark Lord <mlord@pobox.com>
48c2ecf20Sopenharmony_ci * Copyright (C) 1998		Eddie C. Dost <ecd@skynet.be>
58c2ecf20Sopenharmony_ci * Copyright (C) 1999-2000	Andre Hedrick <andre@linux-ide.org>
68c2ecf20Sopenharmony_ci * Copyright (C) 2004		Grant Grundler <grundler at parisc-linux.org>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Inspired by an earlier effort from David S. Miller <davem@redhat.com>
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/module.h>
128c2ecf20Sopenharmony_ci#include <linux/types.h>
138c2ecf20Sopenharmony_ci#include <linux/kernel.h>
148c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
158c2ecf20Sopenharmony_ci#include <linux/pci.h>
168c2ecf20Sopenharmony_ci#include <linux/delay.h>
178c2ecf20Sopenharmony_ci#include <linux/ide.h>
188c2ecf20Sopenharmony_ci#include <linux/init.h>
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#include <asm/io.h>
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define DRV_NAME "ns87415"
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#ifdef CONFIG_SUPERIO
258c2ecf20Sopenharmony_ci/* SUPERIO 87560 is a PoS chip that NatSem denies exists.
268c2ecf20Sopenharmony_ci * Unfortunately, it's built-in on all Astro-based PA-RISC workstations
278c2ecf20Sopenharmony_ci * which use the integrated NS87514 cell for CD-ROM support.
288c2ecf20Sopenharmony_ci * i.e we have to support for CD-ROM installs.
298c2ecf20Sopenharmony_ci * See drivers/parisc/superio.c for more gory details.
308c2ecf20Sopenharmony_ci */
318c2ecf20Sopenharmony_ci#include <asm/superio.h>
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define SUPERIO_IDE_MAX_RETRIES 25
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci/* Because of a defect in Super I/O, all reads of the PCI DMA status
368c2ecf20Sopenharmony_ci * registers, IDE status register and the IDE select register need to be
378c2ecf20Sopenharmony_ci * retried
388c2ecf20Sopenharmony_ci */
398c2ecf20Sopenharmony_cistatic u8 superio_ide_inb (unsigned long port)
408c2ecf20Sopenharmony_ci{
418c2ecf20Sopenharmony_ci	u8 tmp;
428c2ecf20Sopenharmony_ci	int retries = SUPERIO_IDE_MAX_RETRIES;
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci	/* printk(" [ reading port 0x%x with retry ] ", port); */
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci	do {
478c2ecf20Sopenharmony_ci		tmp = inb(port);
488c2ecf20Sopenharmony_ci		if (tmp == 0)
498c2ecf20Sopenharmony_ci			udelay(50);
508c2ecf20Sopenharmony_ci	} while (tmp == 0 && retries-- > 0);
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci	return tmp;
538c2ecf20Sopenharmony_ci}
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_cistatic u8 superio_read_status(ide_hwif_t *hwif)
568c2ecf20Sopenharmony_ci{
578c2ecf20Sopenharmony_ci	return superio_ide_inb(hwif->io_ports.status_addr);
588c2ecf20Sopenharmony_ci}
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_cistatic u8 superio_dma_sff_read_status(ide_hwif_t *hwif)
618c2ecf20Sopenharmony_ci{
628c2ecf20Sopenharmony_ci	return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS);
638c2ecf20Sopenharmony_ci}
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_cistatic void superio_tf_read(ide_drive_t *drive, struct ide_taskfile *tf,
668c2ecf20Sopenharmony_ci			    u8 valid)
678c2ecf20Sopenharmony_ci{
688c2ecf20Sopenharmony_ci	struct ide_io_ports *io_ports = &drive->hwif->io_ports;
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci	if (valid & IDE_VALID_ERROR)
718c2ecf20Sopenharmony_ci		tf->error  = inb(io_ports->feature_addr);
728c2ecf20Sopenharmony_ci	if (valid & IDE_VALID_NSECT)
738c2ecf20Sopenharmony_ci		tf->nsect  = inb(io_ports->nsect_addr);
748c2ecf20Sopenharmony_ci	if (valid & IDE_VALID_LBAL)
758c2ecf20Sopenharmony_ci		tf->lbal   = inb(io_ports->lbal_addr);
768c2ecf20Sopenharmony_ci	if (valid & IDE_VALID_LBAM)
778c2ecf20Sopenharmony_ci		tf->lbam   = inb(io_ports->lbam_addr);
788c2ecf20Sopenharmony_ci	if (valid & IDE_VALID_LBAH)
798c2ecf20Sopenharmony_ci		tf->lbah   = inb(io_ports->lbah_addr);
808c2ecf20Sopenharmony_ci	if (valid & IDE_VALID_DEVICE)
818c2ecf20Sopenharmony_ci		tf->device = superio_ide_inb(io_ports->device_addr);
828c2ecf20Sopenharmony_ci}
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_cistatic void ns87415_dev_select(ide_drive_t *drive);
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_cistatic const struct ide_tp_ops superio_tp_ops = {
878c2ecf20Sopenharmony_ci	.exec_command		= ide_exec_command,
888c2ecf20Sopenharmony_ci	.read_status		= superio_read_status,
898c2ecf20Sopenharmony_ci	.read_altstatus		= ide_read_altstatus,
908c2ecf20Sopenharmony_ci	.write_devctl		= ide_write_devctl,
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci	.dev_select		= ns87415_dev_select,
938c2ecf20Sopenharmony_ci	.tf_load		= ide_tf_load,
948c2ecf20Sopenharmony_ci	.tf_read		= superio_tf_read,
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci	.input_data		= ide_input_data,
978c2ecf20Sopenharmony_ci	.output_data		= ide_output_data,
988c2ecf20Sopenharmony_ci};
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_cistatic void superio_init_iops(struct hwif_s *hwif)
1018c2ecf20Sopenharmony_ci{
1028c2ecf20Sopenharmony_ci	struct pci_dev *pdev = to_pci_dev(hwif->dev);
1038c2ecf20Sopenharmony_ci	u32 dma_stat;
1048c2ecf20Sopenharmony_ci	u8 port = hwif->channel, tmp;
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci	dma_stat = (pci_resource_start(pdev, 4) & ~3) + (!port ? 2 : 0xa);
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci	/* Clear error/interrupt, enable dma */
1098c2ecf20Sopenharmony_ci	tmp = superio_ide_inb(dma_stat);
1108c2ecf20Sopenharmony_ci	outb(tmp | 0x66, dma_stat);
1118c2ecf20Sopenharmony_ci}
1128c2ecf20Sopenharmony_ci#else
1138c2ecf20Sopenharmony_ci#define superio_dma_sff_read_status ide_dma_sff_read_status
1148c2ecf20Sopenharmony_ci#endif
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_cistatic unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 };
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci/*
1198c2ecf20Sopenharmony_ci * This routine either enables/disables (according to IDE_DFLAG_PRESENT)
1208c2ecf20Sopenharmony_ci * the IRQ associated with the port,
1218c2ecf20Sopenharmony_ci * and selects either PIO or DMA handshaking for the next I/O operation.
1228c2ecf20Sopenharmony_ci */
1238c2ecf20Sopenharmony_cistatic void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma)
1248c2ecf20Sopenharmony_ci{
1258c2ecf20Sopenharmony_ci	ide_hwif_t *hwif = drive->hwif;
1268c2ecf20Sopenharmony_ci	struct pci_dev *dev = to_pci_dev(hwif->dev);
1278c2ecf20Sopenharmony_ci	unsigned int bit, other, new, *old = (unsigned int *) hwif->select_data;
1288c2ecf20Sopenharmony_ci	unsigned long flags;
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci	local_irq_save(flags);
1318c2ecf20Sopenharmony_ci	new = *old;
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci	/* Adjust IRQ enable bit */
1348c2ecf20Sopenharmony_ci	bit = 1 << (8 + hwif->channel);
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci	if (drive->dev_flags & IDE_DFLAG_PRESENT)
1378c2ecf20Sopenharmony_ci		new &= ~bit;
1388c2ecf20Sopenharmony_ci	else
1398c2ecf20Sopenharmony_ci		new |= bit;
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci	/* Select PIO or DMA, DMA may only be selected for one drive/channel. */
1428c2ecf20Sopenharmony_ci	bit   = 1 << (20 + (drive->dn & 1) + (hwif->channel << 1));
1438c2ecf20Sopenharmony_ci	other = 1 << (20 + (1 - (drive->dn & 1)) + (hwif->channel << 1));
1448c2ecf20Sopenharmony_ci	new = use_dma ? ((new & ~other) | bit) : (new & ~bit);
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci	if (new != *old) {
1478c2ecf20Sopenharmony_ci		unsigned char stat;
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci		/*
1508c2ecf20Sopenharmony_ci		 * Don't change DMA engine settings while Write Buffers
1518c2ecf20Sopenharmony_ci		 * are busy.
1528c2ecf20Sopenharmony_ci		 */
1538c2ecf20Sopenharmony_ci		(void) pci_read_config_byte(dev, 0x43, &stat);
1548c2ecf20Sopenharmony_ci		while (stat & 0x03) {
1558c2ecf20Sopenharmony_ci			udelay(1);
1568c2ecf20Sopenharmony_ci			(void) pci_read_config_byte(dev, 0x43, &stat);
1578c2ecf20Sopenharmony_ci		}
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci		*old = new;
1608c2ecf20Sopenharmony_ci		(void) pci_write_config_dword(dev, 0x40, new);
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci		/*
1638c2ecf20Sopenharmony_ci		 * And let things settle...
1648c2ecf20Sopenharmony_ci		 */
1658c2ecf20Sopenharmony_ci		udelay(10);
1668c2ecf20Sopenharmony_ci	}
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci	local_irq_restore(flags);
1698c2ecf20Sopenharmony_ci}
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_cistatic void ns87415_dev_select(ide_drive_t *drive)
1728c2ecf20Sopenharmony_ci{
1738c2ecf20Sopenharmony_ci	ns87415_prepare_drive(drive,
1748c2ecf20Sopenharmony_ci			      !!(drive->dev_flags & IDE_DFLAG_USING_DMA));
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci	outb(drive->select | ATA_DEVICE_OBS, drive->hwif->io_ports.device_addr);
1778c2ecf20Sopenharmony_ci}
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_cistatic void ns87415_dma_start(ide_drive_t *drive)
1808c2ecf20Sopenharmony_ci{
1818c2ecf20Sopenharmony_ci	ns87415_prepare_drive(drive, 1);
1828c2ecf20Sopenharmony_ci	ide_dma_start(drive);
1838c2ecf20Sopenharmony_ci}
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_cistatic int ns87415_dma_end(ide_drive_t *drive)
1868c2ecf20Sopenharmony_ci{
1878c2ecf20Sopenharmony_ci	ide_hwif_t *hwif = drive->hwif;
1888c2ecf20Sopenharmony_ci	u8 dma_stat = 0, dma_cmd = 0;
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ci	dma_stat = hwif->dma_ops->dma_sff_read_status(hwif);
1918c2ecf20Sopenharmony_ci	/* get DMA command mode */
1928c2ecf20Sopenharmony_ci	dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
1938c2ecf20Sopenharmony_ci	/* stop DMA */
1948c2ecf20Sopenharmony_ci	outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD);
1958c2ecf20Sopenharmony_ci	/* from ERRATA: clear the INTR & ERROR bits */
1968c2ecf20Sopenharmony_ci	dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
1978c2ecf20Sopenharmony_ci	outb(dma_cmd | 6, hwif->dma_base + ATA_DMA_CMD);
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci	ns87415_prepare_drive(drive, 0);
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ci	/* verify good DMA status */
2028c2ecf20Sopenharmony_ci	return (dma_stat & 7) != 4;
2038c2ecf20Sopenharmony_ci}
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_cistatic void init_hwif_ns87415 (ide_hwif_t *hwif)
2068c2ecf20Sopenharmony_ci{
2078c2ecf20Sopenharmony_ci	struct pci_dev *dev = to_pci_dev(hwif->dev);
2088c2ecf20Sopenharmony_ci	unsigned int ctrl, using_inta;
2098c2ecf20Sopenharmony_ci	u8 progif;
2108c2ecf20Sopenharmony_ci#ifdef __sparc_v9__
2118c2ecf20Sopenharmony_ci	int timeout;
2128c2ecf20Sopenharmony_ci	u8 stat;
2138c2ecf20Sopenharmony_ci#endif
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci	/*
2168c2ecf20Sopenharmony_ci	 * We cannot probe for IRQ: both ports share common IRQ on INTA.
2178c2ecf20Sopenharmony_ci	 * Also, leave IRQ masked during drive probing, to prevent infinite
2188c2ecf20Sopenharmony_ci	 * interrupts from a potentially floating INTA..
2198c2ecf20Sopenharmony_ci	 *
2208c2ecf20Sopenharmony_ci	 * IRQs get unmasked in dev_select() when drive is first used.
2218c2ecf20Sopenharmony_ci	 */
2228c2ecf20Sopenharmony_ci	(void) pci_read_config_dword(dev, 0x40, &ctrl);
2238c2ecf20Sopenharmony_ci	(void) pci_read_config_byte(dev, 0x09, &progif);
2248c2ecf20Sopenharmony_ci	/* is irq in "native" mode? */
2258c2ecf20Sopenharmony_ci	using_inta = progif & (1 << (hwif->channel << 1));
2268c2ecf20Sopenharmony_ci	if (!using_inta)
2278c2ecf20Sopenharmony_ci		using_inta = ctrl & (1 << (4 + hwif->channel));
2288c2ecf20Sopenharmony_ci	if (hwif->mate) {
2298c2ecf20Sopenharmony_ci		hwif->select_data = hwif->mate->select_data;
2308c2ecf20Sopenharmony_ci	} else {
2318c2ecf20Sopenharmony_ci		hwif->select_data = (unsigned long)
2328c2ecf20Sopenharmony_ci					&ns87415_control[ns87415_count++];
2338c2ecf20Sopenharmony_ci		ctrl |= (1 << 8) | (1 << 9);	/* mask both IRQs */
2348c2ecf20Sopenharmony_ci		if (using_inta)
2358c2ecf20Sopenharmony_ci			ctrl &= ~(1 << 6);	/* unmask INTA */
2368c2ecf20Sopenharmony_ci		*((unsigned int *)hwif->select_data) = ctrl;
2378c2ecf20Sopenharmony_ci		(void) pci_write_config_dword(dev, 0x40, ctrl);
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci		/*
2408c2ecf20Sopenharmony_ci		 * Set prefetch size to 512 bytes for both ports,
2418c2ecf20Sopenharmony_ci		 * but don't turn on/off prefetching here.
2428c2ecf20Sopenharmony_ci		 */
2438c2ecf20Sopenharmony_ci		pci_write_config_byte(dev, 0x55, 0xee);
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci#ifdef __sparc_v9__
2468c2ecf20Sopenharmony_ci		/*
2478c2ecf20Sopenharmony_ci		 * XXX: Reset the device, if we don't it will not respond to
2488c2ecf20Sopenharmony_ci		 *      dev_select() properly during first ide_probe_port().
2498c2ecf20Sopenharmony_ci		 */
2508c2ecf20Sopenharmony_ci		timeout = 10000;
2518c2ecf20Sopenharmony_ci		outb(12, hwif->io_ports.ctl_addr);
2528c2ecf20Sopenharmony_ci		udelay(10);
2538c2ecf20Sopenharmony_ci		outb(8, hwif->io_ports.ctl_addr);
2548c2ecf20Sopenharmony_ci		do {
2558c2ecf20Sopenharmony_ci			udelay(50);
2568c2ecf20Sopenharmony_ci			stat = hwif->tp_ops->read_status(hwif);
2578c2ecf20Sopenharmony_ci			if (stat == 0xff)
2588c2ecf20Sopenharmony_ci				break;
2598c2ecf20Sopenharmony_ci		} while ((stat & ATA_BUSY) && --timeout);
2608c2ecf20Sopenharmony_ci#endif
2618c2ecf20Sopenharmony_ci	}
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci	if (!using_inta)
2648c2ecf20Sopenharmony_ci		hwif->irq = pci_get_legacy_ide_irq(dev, hwif->channel);
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci	if (!hwif->dma_base)
2678c2ecf20Sopenharmony_ci		return;
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci	outb(0x60, hwif->dma_base + ATA_DMA_STATUS);
2708c2ecf20Sopenharmony_ci}
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_cistatic const struct ide_tp_ops ns87415_tp_ops = {
2738c2ecf20Sopenharmony_ci	.exec_command		= ide_exec_command,
2748c2ecf20Sopenharmony_ci	.read_status		= ide_read_status,
2758c2ecf20Sopenharmony_ci	.read_altstatus		= ide_read_altstatus,
2768c2ecf20Sopenharmony_ci	.write_devctl		= ide_write_devctl,
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci	.dev_select		= ns87415_dev_select,
2798c2ecf20Sopenharmony_ci	.tf_load		= ide_tf_load,
2808c2ecf20Sopenharmony_ci	.tf_read		= ide_tf_read,
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci	.input_data		= ide_input_data,
2838c2ecf20Sopenharmony_ci	.output_data		= ide_output_data,
2848c2ecf20Sopenharmony_ci};
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_cistatic const struct ide_dma_ops ns87415_dma_ops = {
2878c2ecf20Sopenharmony_ci	.dma_host_set		= ide_dma_host_set,
2888c2ecf20Sopenharmony_ci	.dma_setup		= ide_dma_setup,
2898c2ecf20Sopenharmony_ci	.dma_start		= ns87415_dma_start,
2908c2ecf20Sopenharmony_ci	.dma_end		= ns87415_dma_end,
2918c2ecf20Sopenharmony_ci	.dma_test_irq		= ide_dma_test_irq,
2928c2ecf20Sopenharmony_ci	.dma_lost_irq		= ide_dma_lost_irq,
2938c2ecf20Sopenharmony_ci	.dma_timer_expiry	= ide_dma_sff_timer_expiry,
2948c2ecf20Sopenharmony_ci	.dma_sff_read_status	= superio_dma_sff_read_status,
2958c2ecf20Sopenharmony_ci};
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_cistatic const struct ide_port_info ns87415_chipset = {
2988c2ecf20Sopenharmony_ci	.name		= DRV_NAME,
2998c2ecf20Sopenharmony_ci	.init_hwif	= init_hwif_ns87415,
3008c2ecf20Sopenharmony_ci	.tp_ops 	= &ns87415_tp_ops,
3018c2ecf20Sopenharmony_ci	.dma_ops	= &ns87415_dma_ops,
3028c2ecf20Sopenharmony_ci	.host_flags	= IDE_HFLAG_TRUST_BIOS_FOR_DMA |
3038c2ecf20Sopenharmony_ci			  IDE_HFLAG_NO_ATAPI_DMA,
3048c2ecf20Sopenharmony_ci};
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_cistatic int ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id)
3078c2ecf20Sopenharmony_ci{
3088c2ecf20Sopenharmony_ci	struct ide_port_info d = ns87415_chipset;
3098c2ecf20Sopenharmony_ci
3108c2ecf20Sopenharmony_ci#ifdef CONFIG_SUPERIO
3118c2ecf20Sopenharmony_ci	if (PCI_SLOT(dev->devfn) == 0xE) {
3128c2ecf20Sopenharmony_ci		/* Built-in - assume it's under superio. */
3138c2ecf20Sopenharmony_ci		d.init_iops = superio_init_iops;
3148c2ecf20Sopenharmony_ci		d.tp_ops = &superio_tp_ops;
3158c2ecf20Sopenharmony_ci	}
3168c2ecf20Sopenharmony_ci#endif
3178c2ecf20Sopenharmony_ci	return ide_pci_init_one(dev, &d, NULL);
3188c2ecf20Sopenharmony_ci}
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_cistatic const struct pci_device_id ns87415_pci_tbl[] = {
3218c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NS, PCI_DEVICE_ID_NS_87415), 0 },
3228c2ecf20Sopenharmony_ci	{ 0, },
3238c2ecf20Sopenharmony_ci};
3248c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(pci, ns87415_pci_tbl);
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_cistatic struct pci_driver ns87415_pci_driver = {
3278c2ecf20Sopenharmony_ci	.name		= "NS87415_IDE",
3288c2ecf20Sopenharmony_ci	.id_table	= ns87415_pci_tbl,
3298c2ecf20Sopenharmony_ci	.probe		= ns87415_init_one,
3308c2ecf20Sopenharmony_ci	.remove		= ide_pci_remove,
3318c2ecf20Sopenharmony_ci	.suspend	= ide_pci_suspend,
3328c2ecf20Sopenharmony_ci	.resume		= ide_pci_resume,
3338c2ecf20Sopenharmony_ci};
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_cistatic int __init ns87415_ide_init(void)
3368c2ecf20Sopenharmony_ci{
3378c2ecf20Sopenharmony_ci	return ide_pci_register_driver(&ns87415_pci_driver);
3388c2ecf20Sopenharmony_ci}
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_cistatic void __exit ns87415_ide_exit(void)
3418c2ecf20Sopenharmony_ci{
3428c2ecf20Sopenharmony_ci	pci_unregister_driver(&ns87415_pci_driver);
3438c2ecf20Sopenharmony_ci}
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_cimodule_init(ns87415_ide_init);
3468c2ecf20Sopenharmony_cimodule_exit(ns87415_ide_exit);
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ciMODULE_AUTHOR("Mark Lord, Eddie Dost, Andre Hedrick");
3498c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("PCI driver module for NS87415 IDE");
3508c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL");
351