xref: /kernel/linux/linux-5.10/drivers/ide/amd74xx.c (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04
48c2ecf20Sopenharmony_ci * IDE driver for Linux.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Copyright (c) 2000-2002 Vojtech Pavlik
78c2ecf20Sopenharmony_ci * Copyright (c) 2007-2010 Bartlomiej Zolnierkiewicz
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * Based on the work of:
108c2ecf20Sopenharmony_ci *      Andre Hedrick
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <linux/module.h>
158c2ecf20Sopenharmony_ci#include <linux/kernel.h>
168c2ecf20Sopenharmony_ci#include <linux/pci.h>
178c2ecf20Sopenharmony_ci#include <linux/init.h>
188c2ecf20Sopenharmony_ci#include <linux/ide.h>
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define DRV_NAME "amd74xx"
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_cienum {
238c2ecf20Sopenharmony_ci	AMD_IDE_CONFIG		= 0x41,
248c2ecf20Sopenharmony_ci	AMD_CABLE_DETECT	= 0x42,
258c2ecf20Sopenharmony_ci	AMD_DRIVE_TIMING	= 0x48,
268c2ecf20Sopenharmony_ci	AMD_8BIT_TIMING		= 0x4e,
278c2ecf20Sopenharmony_ci	AMD_ADDRESS_SETUP	= 0x4c,
288c2ecf20Sopenharmony_ci	AMD_UDMA_TIMING		= 0x50,
298c2ecf20Sopenharmony_ci};
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_cistatic unsigned int amd_80w;
328c2ecf20Sopenharmony_cistatic unsigned int amd_clock;
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistatic char *amd_dma[] = { "16", "25", "33", "44", "66", "100", "133" };
358c2ecf20Sopenharmony_cistatic unsigned char amd_cyc2udma[] = { 6, 6, 5, 4, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 7 };
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_cistatic inline u8 amd_offset(struct pci_dev *dev)
388c2ecf20Sopenharmony_ci{
398c2ecf20Sopenharmony_ci	return (dev->vendor == PCI_VENDOR_ID_NVIDIA) ? 0x10 : 0;
408c2ecf20Sopenharmony_ci}
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/*
438c2ecf20Sopenharmony_ci * amd_set_speed() writes timing values to the chipset registers
448c2ecf20Sopenharmony_ci */
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_cistatic void amd_set_speed(struct pci_dev *dev, u8 dn, u8 udma_mask,
478c2ecf20Sopenharmony_ci			  struct ide_timing *timing)
488c2ecf20Sopenharmony_ci{
498c2ecf20Sopenharmony_ci	u8 t = 0, offset = amd_offset(dev);
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci	pci_read_config_byte(dev, AMD_ADDRESS_SETUP + offset, &t);
528c2ecf20Sopenharmony_ci	t = (t & ~(3 << ((3 - dn) << 1))) | ((clamp_val(timing->setup, 1, 4) - 1) << ((3 - dn) << 1));
538c2ecf20Sopenharmony_ci	pci_write_config_byte(dev, AMD_ADDRESS_SETUP + offset, t);
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci	pci_write_config_byte(dev, AMD_8BIT_TIMING + offset + (1 - (dn >> 1)),
568c2ecf20Sopenharmony_ci		((clamp_val(timing->act8b, 1, 16) - 1) << 4) | (clamp_val(timing->rec8b, 1, 16) - 1));
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci	pci_write_config_byte(dev, AMD_DRIVE_TIMING + offset + (3 - dn),
598c2ecf20Sopenharmony_ci		((clamp_val(timing->active, 1, 16) - 1) << 4) | (clamp_val(timing->recover, 1, 16) - 1));
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci	switch (udma_mask) {
628c2ecf20Sopenharmony_ci	case ATA_UDMA2: t = timing->udma ? (0xc0 | (clamp_val(timing->udma, 2, 5) - 2)) : 0x03; break;
638c2ecf20Sopenharmony_ci	case ATA_UDMA4: t = timing->udma ? (0xc0 | amd_cyc2udma[clamp_val(timing->udma, 2, 10)]) : 0x03; break;
648c2ecf20Sopenharmony_ci	case ATA_UDMA5: t = timing->udma ? (0xc0 | amd_cyc2udma[clamp_val(timing->udma, 1, 10)]) : 0x03; break;
658c2ecf20Sopenharmony_ci	case ATA_UDMA6: t = timing->udma ? (0xc0 | amd_cyc2udma[clamp_val(timing->udma, 1, 15)]) : 0x03; break;
668c2ecf20Sopenharmony_ci	default: return;
678c2ecf20Sopenharmony_ci	}
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci	if (timing->udma)
708c2ecf20Sopenharmony_ci		pci_write_config_byte(dev, AMD_UDMA_TIMING + offset + 3 - dn, t);
718c2ecf20Sopenharmony_ci}
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci/*
748c2ecf20Sopenharmony_ci * amd_set_drive() computes timing values and configures the chipset
758c2ecf20Sopenharmony_ci * to a desired transfer mode.  It also can be called by upper layers.
768c2ecf20Sopenharmony_ci */
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_cistatic void amd_set_drive(ide_hwif_t *hwif, ide_drive_t *drive)
798c2ecf20Sopenharmony_ci{
808c2ecf20Sopenharmony_ci	struct pci_dev *dev = to_pci_dev(hwif->dev);
818c2ecf20Sopenharmony_ci	ide_drive_t *peer = ide_get_pair_dev(drive);
828c2ecf20Sopenharmony_ci	struct ide_timing t, p;
838c2ecf20Sopenharmony_ci	int T, UT;
848c2ecf20Sopenharmony_ci	u8 udma_mask = hwif->ultra_mask;
858c2ecf20Sopenharmony_ci	const u8 speed = drive->dma_mode;
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci	T = 1000000000 / amd_clock;
888c2ecf20Sopenharmony_ci	UT = (udma_mask == ATA_UDMA2) ? T : (T / 2);
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci	ide_timing_compute(drive, speed, &t, T, UT);
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci	if (peer) {
938c2ecf20Sopenharmony_ci		ide_timing_compute(peer, peer->pio_mode, &p, T, UT);
948c2ecf20Sopenharmony_ci		ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT);
958c2ecf20Sopenharmony_ci	}
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci	if (speed == XFER_UDMA_5 && amd_clock <= 33333) t.udma = 1;
988c2ecf20Sopenharmony_ci	if (speed == XFER_UDMA_6 && amd_clock <= 33333) t.udma = 15;
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci	amd_set_speed(dev, drive->dn, udma_mask, &t);
1018c2ecf20Sopenharmony_ci}
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci/*
1048c2ecf20Sopenharmony_ci * amd_set_pio_mode() is a callback from upper layers for PIO-only tuning.
1058c2ecf20Sopenharmony_ci */
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_cistatic void amd_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
1088c2ecf20Sopenharmony_ci{
1098c2ecf20Sopenharmony_ci	drive->dma_mode = drive->pio_mode;
1108c2ecf20Sopenharmony_ci	amd_set_drive(hwif, drive);
1118c2ecf20Sopenharmony_ci}
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_cistatic void amd7409_cable_detect(struct pci_dev *dev)
1148c2ecf20Sopenharmony_ci{
1158c2ecf20Sopenharmony_ci	/* no host side cable detection */
1168c2ecf20Sopenharmony_ci	amd_80w = 0x03;
1178c2ecf20Sopenharmony_ci}
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_cistatic void amd7411_cable_detect(struct pci_dev *dev)
1208c2ecf20Sopenharmony_ci{
1218c2ecf20Sopenharmony_ci	int i;
1228c2ecf20Sopenharmony_ci	u32 u = 0;
1238c2ecf20Sopenharmony_ci	u8 t = 0, offset = amd_offset(dev);
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci	pci_read_config_byte(dev, AMD_CABLE_DETECT + offset, &t);
1268c2ecf20Sopenharmony_ci	pci_read_config_dword(dev, AMD_UDMA_TIMING + offset, &u);
1278c2ecf20Sopenharmony_ci	amd_80w = ((t & 0x3) ? 1 : 0) | ((t & 0xc) ? 2 : 0);
1288c2ecf20Sopenharmony_ci	for (i = 24; i >= 0; i -= 8)
1298c2ecf20Sopenharmony_ci		if (((u >> i) & 4) && !(amd_80w & (1 << (1 - (i >> 4))))) {
1308c2ecf20Sopenharmony_ci			printk(KERN_WARNING DRV_NAME " %s: BIOS didn't set "
1318c2ecf20Sopenharmony_ci				"cable bits correctly. Enabling workaround.\n",
1328c2ecf20Sopenharmony_ci				pci_name(dev));
1338c2ecf20Sopenharmony_ci			amd_80w |= (1 << (1 - (i >> 4)));
1348c2ecf20Sopenharmony_ci		}
1358c2ecf20Sopenharmony_ci}
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci/*
1388c2ecf20Sopenharmony_ci * The initialization callback.  Initialize drive independent registers.
1398c2ecf20Sopenharmony_ci */
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_cistatic int init_chipset_amd74xx(struct pci_dev *dev)
1428c2ecf20Sopenharmony_ci{
1438c2ecf20Sopenharmony_ci	u8 t = 0, offset = amd_offset(dev);
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci/*
1468c2ecf20Sopenharmony_ci * Check 80-wire cable presence.
1478c2ecf20Sopenharmony_ci */
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci	if (dev->vendor == PCI_VENDOR_ID_AMD &&
1508c2ecf20Sopenharmony_ci	    dev->device == PCI_DEVICE_ID_AMD_COBRA_7401)
1518c2ecf20Sopenharmony_ci		; /* no UDMA > 2 */
1528c2ecf20Sopenharmony_ci	else if (dev->vendor == PCI_VENDOR_ID_AMD &&
1538c2ecf20Sopenharmony_ci		 dev->device == PCI_DEVICE_ID_AMD_VIPER_7409)
1548c2ecf20Sopenharmony_ci		amd7409_cable_detect(dev);
1558c2ecf20Sopenharmony_ci	else
1568c2ecf20Sopenharmony_ci		amd7411_cable_detect(dev);
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci/*
1598c2ecf20Sopenharmony_ci * Take care of prefetch & postwrite.
1608c2ecf20Sopenharmony_ci */
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci	pci_read_config_byte(dev, AMD_IDE_CONFIG + offset, &t);
1638c2ecf20Sopenharmony_ci	/*
1648c2ecf20Sopenharmony_ci	 * Check for broken FIFO support.
1658c2ecf20Sopenharmony_ci	 */
1668c2ecf20Sopenharmony_ci	if (dev->vendor == PCI_VENDOR_ID_AMD &&
1678c2ecf20Sopenharmony_ci	    dev->device == PCI_DEVICE_ID_AMD_VIPER_7411)
1688c2ecf20Sopenharmony_ci		t &= 0x0f;
1698c2ecf20Sopenharmony_ci	else
1708c2ecf20Sopenharmony_ci		t |= 0xf0;
1718c2ecf20Sopenharmony_ci	pci_write_config_byte(dev, AMD_IDE_CONFIG + offset, t);
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci	return 0;
1748c2ecf20Sopenharmony_ci}
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_cistatic u8 amd_cable_detect(ide_hwif_t *hwif)
1778c2ecf20Sopenharmony_ci{
1788c2ecf20Sopenharmony_ci	if ((amd_80w >> hwif->channel) & 1)
1798c2ecf20Sopenharmony_ci		return ATA_CBL_PATA80;
1808c2ecf20Sopenharmony_ci	else
1818c2ecf20Sopenharmony_ci		return ATA_CBL_PATA40;
1828c2ecf20Sopenharmony_ci}
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_cistatic const struct ide_port_ops amd_port_ops = {
1858c2ecf20Sopenharmony_ci	.set_pio_mode		= amd_set_pio_mode,
1868c2ecf20Sopenharmony_ci	.set_dma_mode		= amd_set_drive,
1878c2ecf20Sopenharmony_ci	.cable_detect		= amd_cable_detect,
1888c2ecf20Sopenharmony_ci};
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ci#define IDE_HFLAGS_AMD \
1918c2ecf20Sopenharmony_ci	(IDE_HFLAG_PIO_NO_BLACKLIST | \
1928c2ecf20Sopenharmony_ci	 IDE_HFLAG_POST_SET_MODE | \
1938c2ecf20Sopenharmony_ci	 IDE_HFLAG_IO_32BIT | \
1948c2ecf20Sopenharmony_ci	 IDE_HFLAG_UNMASK_IRQS)
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci#define DECLARE_AMD_DEV(swdma, udma)				\
1978c2ecf20Sopenharmony_ci	{								\
1988c2ecf20Sopenharmony_ci		.name		= DRV_NAME,				\
1998c2ecf20Sopenharmony_ci		.init_chipset	= init_chipset_amd74xx,			\
2008c2ecf20Sopenharmony_ci		.enablebits	= {{0x40,0x02,0x02}, {0x40,0x01,0x01}},	\
2018c2ecf20Sopenharmony_ci		.port_ops	= &amd_port_ops,			\
2028c2ecf20Sopenharmony_ci		.host_flags	= IDE_HFLAGS_AMD,			\
2038c2ecf20Sopenharmony_ci		.pio_mask	= ATA_PIO5,				\
2048c2ecf20Sopenharmony_ci		.swdma_mask	= swdma,				\
2058c2ecf20Sopenharmony_ci		.mwdma_mask	= ATA_MWDMA2,				\
2068c2ecf20Sopenharmony_ci		.udma_mask	= udma,					\
2078c2ecf20Sopenharmony_ci	}
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci#define DECLARE_NV_DEV(udma)					\
2108c2ecf20Sopenharmony_ci	{								\
2118c2ecf20Sopenharmony_ci		.name		= DRV_NAME,				\
2128c2ecf20Sopenharmony_ci		.init_chipset	= init_chipset_amd74xx,			\
2138c2ecf20Sopenharmony_ci		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x01,0x01}},	\
2148c2ecf20Sopenharmony_ci		.port_ops	= &amd_port_ops,			\
2158c2ecf20Sopenharmony_ci		.host_flags	= IDE_HFLAGS_AMD,			\
2168c2ecf20Sopenharmony_ci		.pio_mask	= ATA_PIO5,				\
2178c2ecf20Sopenharmony_ci		.swdma_mask	= ATA_SWDMA2,				\
2188c2ecf20Sopenharmony_ci		.mwdma_mask	= ATA_MWDMA2,				\
2198c2ecf20Sopenharmony_ci		.udma_mask	= udma,					\
2208c2ecf20Sopenharmony_ci	}
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_cistatic const struct ide_port_info amd74xx_chipsets[] = {
2238c2ecf20Sopenharmony_ci	/* 0: AMD7401 */	DECLARE_AMD_DEV(0x00, ATA_UDMA2),
2248c2ecf20Sopenharmony_ci	/* 1: AMD7409 */	DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA4),
2258c2ecf20Sopenharmony_ci	/* 2: AMD7411/7441 */	DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA5),
2268c2ecf20Sopenharmony_ci	/* 3: AMD8111 */	DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA6),
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci	/* 4: NFORCE */		DECLARE_NV_DEV(ATA_UDMA5),
2298c2ecf20Sopenharmony_ci	/* 5: >= NFORCE2 */	DECLARE_NV_DEV(ATA_UDMA6),
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci	/* 6: AMD5536 */	DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA5),
2328c2ecf20Sopenharmony_ci};
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_cistatic int amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id)
2358c2ecf20Sopenharmony_ci{
2368c2ecf20Sopenharmony_ci	struct ide_port_info d;
2378c2ecf20Sopenharmony_ci	u8 idx = id->driver_data;
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci	d = amd74xx_chipsets[idx];
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_ci	/*
2428c2ecf20Sopenharmony_ci	 * Check for bad SWDMA and incorrectly wired Serenade mainboards.
2438c2ecf20Sopenharmony_ci	 */
2448c2ecf20Sopenharmony_ci	if (idx == 1) {
2458c2ecf20Sopenharmony_ci		if (dev->revision <= 7)
2468c2ecf20Sopenharmony_ci			d.swdma_mask = 0;
2478c2ecf20Sopenharmony_ci		d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX;
2488c2ecf20Sopenharmony_ci	} else if (idx == 3) {
2498c2ecf20Sopenharmony_ci		if (dev->subsystem_vendor == PCI_VENDOR_ID_AMD &&
2508c2ecf20Sopenharmony_ci		    dev->subsystem_device == PCI_DEVICE_ID_AMD_SERENADE)
2518c2ecf20Sopenharmony_ci			d.udma_mask = ATA_UDMA5;
2528c2ecf20Sopenharmony_ci	}
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci	/*
2558c2ecf20Sopenharmony_ci	 * It seems that on some nVidia controllers using AltStatus
2568c2ecf20Sopenharmony_ci	 * register can be unreliable so default to Status register
2578c2ecf20Sopenharmony_ci	 * if the device is in Compatibility Mode.
2588c2ecf20Sopenharmony_ci	 */
2598c2ecf20Sopenharmony_ci	if (dev->vendor == PCI_VENDOR_ID_NVIDIA &&
2608c2ecf20Sopenharmony_ci	    ide_pci_is_in_compatibility_mode(dev))
2618c2ecf20Sopenharmony_ci		d.host_flags |= IDE_HFLAG_BROKEN_ALTSTATUS;
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci	printk(KERN_INFO "%s %s: UDMA%s controller\n",
2648c2ecf20Sopenharmony_ci		d.name, pci_name(dev), amd_dma[fls(d.udma_mask) - 1]);
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci	/*
2678c2ecf20Sopenharmony_ci	* Determine the system bus clock.
2688c2ecf20Sopenharmony_ci	*/
2698c2ecf20Sopenharmony_ci	amd_clock = (ide_pci_clk ? ide_pci_clk : 33) * 1000;
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci	switch (amd_clock) {
2728c2ecf20Sopenharmony_ci	case 33000: amd_clock = 33333; break;
2738c2ecf20Sopenharmony_ci	case 37000: amd_clock = 37500; break;
2748c2ecf20Sopenharmony_ci	case 41000: amd_clock = 41666; break;
2758c2ecf20Sopenharmony_ci	}
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci	if (amd_clock < 20000 || amd_clock > 50000) {
2788c2ecf20Sopenharmony_ci		printk(KERN_WARNING "%s: User given PCI clock speed impossible"
2798c2ecf20Sopenharmony_ci				    " (%d), using 33 MHz instead.\n",
2808c2ecf20Sopenharmony_ci				    d.name, amd_clock);
2818c2ecf20Sopenharmony_ci		amd_clock = 33333;
2828c2ecf20Sopenharmony_ci	}
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci	return ide_pci_init_one(dev, &d, NULL);
2858c2ecf20Sopenharmony_ci}
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_cistatic const struct pci_device_id amd74xx_pci_tbl[] = {
2888c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(AMD,	PCI_DEVICE_ID_AMD_COBRA_7401),		 0 },
2898c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(AMD,	PCI_DEVICE_ID_AMD_VIPER_7409),		 1 },
2908c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(AMD,	PCI_DEVICE_ID_AMD_VIPER_7411),		 2 },
2918c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(AMD,	PCI_DEVICE_ID_AMD_OPUS_7441),		 2 },
2928c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(AMD,	PCI_DEVICE_ID_AMD_8111_IDE),		 3 },
2938c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE_IDE),	 4 },
2948c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE),	 5 },
2958c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE),	 5 },
2968c2ecf20Sopenharmony_ci#ifdef CONFIG_BLK_DEV_IDE_SATA
2978c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA),	 5 },
2988c2ecf20Sopenharmony_ci#endif
2998c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE),	 5 },
3008c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE),	 5 },
3018c2ecf20Sopenharmony_ci#ifdef CONFIG_BLK_DEV_IDE_SATA
3028c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA),	 5 },
3038c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2),	 5 },
3048c2ecf20Sopenharmony_ci#endif
3058c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE),	 5 },
3068c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE),	 5 },
3078c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE),	 5 },
3088c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE),	 5 },
3098c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE),	 5 },
3108c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE),	 5 },
3118c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE),	 5 },
3128c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE),	 5 },
3138c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE),	 5 },
3148c2ecf20Sopenharmony_ci	{ PCI_VDEVICE(AMD,	PCI_DEVICE_ID_AMD_CS5536_IDE),		 6 },
3158c2ecf20Sopenharmony_ci	{ 0, },
3168c2ecf20Sopenharmony_ci};
3178c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl);
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_cistatic struct pci_driver amd74xx_pci_driver = {
3208c2ecf20Sopenharmony_ci	.name		= "AMD_IDE",
3218c2ecf20Sopenharmony_ci	.id_table	= amd74xx_pci_tbl,
3228c2ecf20Sopenharmony_ci	.probe		= amd74xx_probe,
3238c2ecf20Sopenharmony_ci	.remove		= ide_pci_remove,
3248c2ecf20Sopenharmony_ci	.suspend	= ide_pci_suspend,
3258c2ecf20Sopenharmony_ci	.resume		= ide_pci_resume,
3268c2ecf20Sopenharmony_ci};
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_cistatic int __init amd74xx_ide_init(void)
3298c2ecf20Sopenharmony_ci{
3308c2ecf20Sopenharmony_ci	return ide_pci_register_driver(&amd74xx_pci_driver);
3318c2ecf20Sopenharmony_ci}
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_cistatic void __exit amd74xx_ide_exit(void)
3348c2ecf20Sopenharmony_ci{
3358c2ecf20Sopenharmony_ci	pci_unregister_driver(&amd74xx_pci_driver);
3368c2ecf20Sopenharmony_ci}
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_cimodule_init(amd74xx_ide_init);
3398c2ecf20Sopenharmony_cimodule_exit(amd74xx_ide_exit);
3408c2ecf20Sopenharmony_ci
3418c2ecf20Sopenharmony_ciMODULE_AUTHOR("Vojtech Pavlik, Bartlomiej Zolnierkiewicz");
3428c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("AMD PCI IDE driver");
3438c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL");
344