xref: /openbmc/linux/drivers/ata/pata_rdc.c (revision 2fc75da0c59634b81223af497c4a037822f6e457)
16b406782SAlan Cox /*
26b406782SAlan Cox  *  pata_rdc		-	Driver for later RDC PATA controllers
36b406782SAlan Cox  *
46b406782SAlan Cox  *  This is actually a driver for hardware meeting
56b406782SAlan Cox  *  INCITS 370-2004 (1510D): ATA Host Adapter Standards
66b406782SAlan Cox  *
76b406782SAlan Cox  *  Based on ata_piix.
86b406782SAlan Cox  *
96b406782SAlan Cox  *  This program is free software; you can redistribute it and/or modify
106b406782SAlan Cox  *  it under the terms of the GNU General Public License as published by
116b406782SAlan Cox  *  the Free Software Foundation; either version 2, or (at your option)
126b406782SAlan Cox  *  any later version.
136b406782SAlan Cox  *
146b406782SAlan Cox  *  This program is distributed in the hope that it will be useful,
156b406782SAlan Cox  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
166b406782SAlan Cox  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
176b406782SAlan Cox  *  GNU General Public License for more details.
186b406782SAlan Cox  *
196b406782SAlan Cox  *  You should have received a copy of the GNU General Public License
206b406782SAlan Cox  *  along with this program; see the file COPYING.  If not, write to
216b406782SAlan Cox  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
226b406782SAlan Cox  */
236b406782SAlan Cox 
246b406782SAlan Cox #include <linux/kernel.h>
256b406782SAlan Cox #include <linux/module.h>
266b406782SAlan Cox #include <linux/pci.h>
276b406782SAlan Cox #include <linux/init.h>
286b406782SAlan Cox #include <linux/blkdev.h>
296b406782SAlan Cox #include <linux/delay.h>
306b406782SAlan Cox #include <linux/device.h>
315a0e3ad6STejun Heo #include <linux/gfp.h>
326b406782SAlan Cox #include <scsi/scsi_host.h>
336b406782SAlan Cox #include <linux/libata.h>
346b406782SAlan Cox #include <linux/dmi.h>
356b406782SAlan Cox 
366b406782SAlan Cox #define DRV_NAME	"pata_rdc"
376b406782SAlan Cox #define DRV_VERSION	"0.01"
386b406782SAlan Cox 
396b406782SAlan Cox struct rdc_host_priv {
406b406782SAlan Cox 	u32 saved_iocfg;
416b406782SAlan Cox };
426b406782SAlan Cox 
436b406782SAlan Cox /**
446b406782SAlan Cox  *	rdc_pata_cable_detect - Probe host controller cable detect info
456b406782SAlan Cox  *	@ap: Port for which cable detect info is desired
466b406782SAlan Cox  *
476b406782SAlan Cox  *	Read 80c cable indicator from ATA PCI device's PCI config
486b406782SAlan Cox  *	register.  This register is normally set by firmware (BIOS).
496b406782SAlan Cox  *
506b406782SAlan Cox  *	LOCKING:
516b406782SAlan Cox  *	None (inherited from caller).
526b406782SAlan Cox  */
536b406782SAlan Cox 
546b406782SAlan Cox static int rdc_pata_cable_detect(struct ata_port *ap)
556b406782SAlan Cox {
566b406782SAlan Cox 	struct rdc_host_priv *hpriv = ap->host->private_data;
576b406782SAlan Cox 	u8 mask;
586b406782SAlan Cox 
596b406782SAlan Cox 	/* check BIOS cable detect results */
606b406782SAlan Cox 	mask = 0x30 << (2 * ap->port_no);
616b406782SAlan Cox 	if ((hpriv->saved_iocfg & mask) == 0)
626b406782SAlan Cox 		return ATA_CBL_PATA40;
636b406782SAlan Cox 	return ATA_CBL_PATA80;
646b406782SAlan Cox }
656b406782SAlan Cox 
666b406782SAlan Cox /**
676b406782SAlan Cox  *	rdc_pata_prereset - prereset for PATA host controller
686b406782SAlan Cox  *	@link: Target link
696b406782SAlan Cox  *	@deadline: deadline jiffies for the operation
706b406782SAlan Cox  *
716b406782SAlan Cox  *	LOCKING:
726b406782SAlan Cox  *	None (inherited from caller).
736b406782SAlan Cox  */
746b406782SAlan Cox static int rdc_pata_prereset(struct ata_link *link, unsigned long deadline)
756b406782SAlan Cox {
766b406782SAlan Cox 	struct ata_port *ap = link->ap;
776b406782SAlan Cox 	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
786b406782SAlan Cox 
796b406782SAlan Cox 	static const struct pci_bits rdc_enable_bits[] = {
806b406782SAlan Cox 		{ 0x41U, 1U, 0x80UL, 0x80UL },	/* port 0 */
816b406782SAlan Cox 		{ 0x43U, 1U, 0x80UL, 0x80UL },	/* port 1 */
826b406782SAlan Cox 	};
836b406782SAlan Cox 
846b406782SAlan Cox 	if (!pci_test_config_bits(pdev, &rdc_enable_bits[ap->port_no]))
856b406782SAlan Cox 		return -ENOENT;
866b406782SAlan Cox 	return ata_sff_prereset(link, deadline);
876b406782SAlan Cox }
886b406782SAlan Cox 
89bb612cbaSBartlomiej Zolnierkiewicz static DEFINE_SPINLOCK(rdc_lock);
90bb612cbaSBartlomiej Zolnierkiewicz 
916b406782SAlan Cox /**
926b406782SAlan Cox  *	rdc_set_piomode - Initialize host controller PATA PIO timings
936b406782SAlan Cox  *	@ap: Port whose timings we are configuring
946b406782SAlan Cox  *	@adev: um
956b406782SAlan Cox  *
966b406782SAlan Cox  *	Set PIO mode for device, in host controller PCI config space.
976b406782SAlan Cox  *
986b406782SAlan Cox  *	LOCKING:
996b406782SAlan Cox  *	None (inherited from caller).
1006b406782SAlan Cox  */
1016b406782SAlan Cox 
1026b406782SAlan Cox static void rdc_set_piomode(struct ata_port *ap, struct ata_device *adev)
1036b406782SAlan Cox {
1046b406782SAlan Cox 	unsigned int pio	= adev->pio_mode - XFER_PIO_0;
1056b406782SAlan Cox 	struct pci_dev *dev	= to_pci_dev(ap->host->dev);
106bb612cbaSBartlomiej Zolnierkiewicz 	unsigned long flags;
1076b406782SAlan Cox 	unsigned int is_slave	= (adev->devno != 0);
1086b406782SAlan Cox 	unsigned int master_port= ap->port_no ? 0x42 : 0x40;
1096b406782SAlan Cox 	unsigned int slave_port	= 0x44;
1106b406782SAlan Cox 	u16 master_data;
1116b406782SAlan Cox 	u8 slave_data;
1126b406782SAlan Cox 	u8 udma_enable;
1136b406782SAlan Cox 	int control = 0;
1146b406782SAlan Cox 
1156b406782SAlan Cox 	static const	 /* ISP  RTC */
1166b406782SAlan Cox 	u8 timings[][2]	= { { 0, 0 },
1176b406782SAlan Cox 			    { 0, 0 },
1186b406782SAlan Cox 			    { 1, 0 },
1196b406782SAlan Cox 			    { 2, 1 },
1206b406782SAlan Cox 			    { 2, 3 }, };
1216b406782SAlan Cox 
1226b406782SAlan Cox 	if (pio >= 2)
1236b406782SAlan Cox 		control |= 1;	/* TIME1 enable */
1246b406782SAlan Cox 	if (ata_pio_need_iordy(adev))
1256b406782SAlan Cox 		control |= 2;	/* IE enable */
1266b406782SAlan Cox 
1276b406782SAlan Cox 	if (adev->class == ATA_DEV_ATA)
1286b406782SAlan Cox 		control |= 4;	/* PPE enable */
1296b406782SAlan Cox 
130bb612cbaSBartlomiej Zolnierkiewicz 	spin_lock_irqsave(&rdc_lock, flags);
131bb612cbaSBartlomiej Zolnierkiewicz 
1326b406782SAlan Cox 	/* PIO configuration clears DTE unconditionally.  It will be
1336b406782SAlan Cox 	 * programmed in set_dmamode which is guaranteed to be called
1346b406782SAlan Cox 	 * after set_piomode if any DMA mode is available.
1356b406782SAlan Cox 	 */
1366b406782SAlan Cox 	pci_read_config_word(dev, master_port, &master_data);
1376b406782SAlan Cox 	if (is_slave) {
1386b406782SAlan Cox 		/* clear TIME1|IE1|PPE1|DTE1 */
1396b406782SAlan Cox 		master_data &= 0xff0f;
1406b406782SAlan Cox 		/* Enable SITRE (separate slave timing register) */
1416b406782SAlan Cox 		master_data |= 0x4000;
1426b406782SAlan Cox 		/* enable PPE1, IE1 and TIME1 as needed */
1436b406782SAlan Cox 		master_data |= (control << 4);
1446b406782SAlan Cox 		pci_read_config_byte(dev, slave_port, &slave_data);
1456b406782SAlan Cox 		slave_data &= (ap->port_no ? 0x0f : 0xf0);
1466b406782SAlan Cox 		/* Load the timing nibble for this slave */
1476b406782SAlan Cox 		slave_data |= ((timings[pio][0] << 2) | timings[pio][1])
1486b406782SAlan Cox 						<< (ap->port_no ? 4 : 0);
1496b406782SAlan Cox 	} else {
1506b406782SAlan Cox 		/* clear ISP|RCT|TIME0|IE0|PPE0|DTE0 */
1516b406782SAlan Cox 		master_data &= 0xccf0;
1526b406782SAlan Cox 		/* Enable PPE, IE and TIME as appropriate */
1536b406782SAlan Cox 		master_data |= control;
1546b406782SAlan Cox 		/* load ISP and RCT */
1556b406782SAlan Cox 		master_data |=
1566b406782SAlan Cox 			(timings[pio][0] << 12) |
1576b406782SAlan Cox 			(timings[pio][1] << 8);
1586b406782SAlan Cox 	}
1596b406782SAlan Cox 	pci_write_config_word(dev, master_port, master_data);
1606b406782SAlan Cox 	if (is_slave)
1616b406782SAlan Cox 		pci_write_config_byte(dev, slave_port, slave_data);
1626b406782SAlan Cox 
1636b406782SAlan Cox 	/* Ensure the UDMA bit is off - it will be turned back on if
1646b406782SAlan Cox 	   UDMA is selected */
1656b406782SAlan Cox 
1666b406782SAlan Cox 	pci_read_config_byte(dev, 0x48, &udma_enable);
1676b406782SAlan Cox 	udma_enable &= ~(1 << (2 * ap->port_no + adev->devno));
1686b406782SAlan Cox 	pci_write_config_byte(dev, 0x48, udma_enable);
169bb612cbaSBartlomiej Zolnierkiewicz 
170bb612cbaSBartlomiej Zolnierkiewicz 	spin_unlock_irqrestore(&rdc_lock, flags);
1716b406782SAlan Cox }
1726b406782SAlan Cox 
1736b406782SAlan Cox /**
1746b406782SAlan Cox  *	rdc_set_dmamode - Initialize host controller PATA PIO timings
1756b406782SAlan Cox  *	@ap: Port whose timings we are configuring
1766b406782SAlan Cox  *	@adev: Drive in question
1776b406782SAlan Cox  *
1786b406782SAlan Cox  *	Set UDMA mode for device, in host controller PCI config space.
1796b406782SAlan Cox  *
1806b406782SAlan Cox  *	LOCKING:
1816b406782SAlan Cox  *	None (inherited from caller).
1826b406782SAlan Cox  */
1836b406782SAlan Cox 
1846b406782SAlan Cox static void rdc_set_dmamode(struct ata_port *ap, struct ata_device *adev)
1856b406782SAlan Cox {
1866b406782SAlan Cox 	struct pci_dev *dev	= to_pci_dev(ap->host->dev);
187bb612cbaSBartlomiej Zolnierkiewicz 	unsigned long flags;
1886b406782SAlan Cox 	u8 master_port		= ap->port_no ? 0x42 : 0x40;
1896b406782SAlan Cox 	u16 master_data;
1906b406782SAlan Cox 	u8 speed		= adev->dma_mode;
1916b406782SAlan Cox 	int devid		= adev->devno + 2 * ap->port_no;
1926b406782SAlan Cox 	u8 udma_enable		= 0;
1936b406782SAlan Cox 
1946b406782SAlan Cox 	static const	 /* ISP  RTC */
1956b406782SAlan Cox 	u8 timings[][2]	= { { 0, 0 },
1966b406782SAlan Cox 			    { 0, 0 },
1976b406782SAlan Cox 			    { 1, 0 },
1986b406782SAlan Cox 			    { 2, 1 },
1996b406782SAlan Cox 			    { 2, 3 }, };
2006b406782SAlan Cox 
201bb612cbaSBartlomiej Zolnierkiewicz 	spin_lock_irqsave(&rdc_lock, flags);
202bb612cbaSBartlomiej Zolnierkiewicz 
2036b406782SAlan Cox 	pci_read_config_word(dev, master_port, &master_data);
2046b406782SAlan Cox 	pci_read_config_byte(dev, 0x48, &udma_enable);
2056b406782SAlan Cox 
2066b406782SAlan Cox 	if (speed >= XFER_UDMA_0) {
2076b406782SAlan Cox 		unsigned int udma = adev->dma_mode - XFER_UDMA_0;
2086b406782SAlan Cox 		u16 udma_timing;
2096b406782SAlan Cox 		u16 ideconf;
2106b406782SAlan Cox 		int u_clock, u_speed;
2116b406782SAlan Cox 
2126b406782SAlan Cox 		/*
2136b406782SAlan Cox 		 * UDMA is handled by a combination of clock switching and
2146b406782SAlan Cox 		 * selection of dividers
2156b406782SAlan Cox 		 *
2166b406782SAlan Cox 		 * Handy rule: Odd modes are UDMATIMx 01, even are 02
2176b406782SAlan Cox 		 *	       except UDMA0 which is 00
2186b406782SAlan Cox 		 */
2196b406782SAlan Cox 		u_speed = min(2 - (udma & 1), udma);
2206b406782SAlan Cox 		if (udma == 5)
2216b406782SAlan Cox 			u_clock = 0x1000;	/* 100Mhz */
2226b406782SAlan Cox 		else if (udma > 2)
2236b406782SAlan Cox 			u_clock = 1;		/* 66Mhz */
2246b406782SAlan Cox 		else
2256b406782SAlan Cox 			u_clock = 0;		/* 33Mhz */
2266b406782SAlan Cox 
2276b406782SAlan Cox 		udma_enable |= (1 << devid);
2286b406782SAlan Cox 
2296b406782SAlan Cox 		/* Load the CT/RP selection */
2306b406782SAlan Cox 		pci_read_config_word(dev, 0x4A, &udma_timing);
2316b406782SAlan Cox 		udma_timing &= ~(3 << (4 * devid));
2326b406782SAlan Cox 		udma_timing |= u_speed << (4 * devid);
2336b406782SAlan Cox 		pci_write_config_word(dev, 0x4A, udma_timing);
2346b406782SAlan Cox 
2356b406782SAlan Cox 		/* Select a 33/66/100Mhz clock */
2366b406782SAlan Cox 		pci_read_config_word(dev, 0x54, &ideconf);
2376b406782SAlan Cox 		ideconf &= ~(0x1001 << devid);
2386b406782SAlan Cox 		ideconf |= u_clock << devid;
2396b406782SAlan Cox 		pci_write_config_word(dev, 0x54, ideconf);
2406b406782SAlan Cox 	} else {
2416b406782SAlan Cox 		/*
2426b406782SAlan Cox 		 * MWDMA is driven by the PIO timings. We must also enable
2436b406782SAlan Cox 		 * IORDY unconditionally along with TIME1. PPE has already
2446b406782SAlan Cox 		 * been set when the PIO timing was set.
2456b406782SAlan Cox 		 */
2466b406782SAlan Cox 		unsigned int mwdma	= adev->dma_mode - XFER_MW_DMA_0;
2476b406782SAlan Cox 		unsigned int control;
2486b406782SAlan Cox 		u8 slave_data;
2496b406782SAlan Cox 		const unsigned int needed_pio[3] = {
2506b406782SAlan Cox 			XFER_PIO_0, XFER_PIO_3, XFER_PIO_4
2516b406782SAlan Cox 		};
2526b406782SAlan Cox 		int pio = needed_pio[mwdma] - XFER_PIO_0;
2536b406782SAlan Cox 
2546b406782SAlan Cox 		control = 3;	/* IORDY|TIME1 */
2556b406782SAlan Cox 
2566b406782SAlan Cox 		/* If the drive MWDMA is faster than it can do PIO then
2576b406782SAlan Cox 		   we must force PIO into PIO0 */
2586b406782SAlan Cox 
2596b406782SAlan Cox 		if (adev->pio_mode < needed_pio[mwdma])
2606b406782SAlan Cox 			/* Enable DMA timing only */
2616b406782SAlan Cox 			control |= 8;	/* PIO cycles in PIO0 */
2626b406782SAlan Cox 
2636b406782SAlan Cox 		if (adev->devno) {	/* Slave */
2646b406782SAlan Cox 			master_data &= 0xFF4F;  /* Mask out IORDY|TIME1|DMAONLY */
2656b406782SAlan Cox 			master_data |= control << 4;
2666b406782SAlan Cox 			pci_read_config_byte(dev, 0x44, &slave_data);
2676b406782SAlan Cox 			slave_data &= (ap->port_no ? 0x0f : 0xf0);
2686b406782SAlan Cox 			/* Load the matching timing */
2696b406782SAlan Cox 			slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << (ap->port_no ? 4 : 0);
2706b406782SAlan Cox 			pci_write_config_byte(dev, 0x44, slave_data);
2716b406782SAlan Cox 		} else { 	/* Master */
2726b406782SAlan Cox 			master_data &= 0xCCF4;	/* Mask out IORDY|TIME1|DMAONLY
2736b406782SAlan Cox 						   and master timing bits */
2746b406782SAlan Cox 			master_data |= control;
2756b406782SAlan Cox 			master_data |=
2766b406782SAlan Cox 				(timings[pio][0] << 12) |
2776b406782SAlan Cox 				(timings[pio][1] << 8);
2786b406782SAlan Cox 		}
2796b406782SAlan Cox 
2806b406782SAlan Cox 		udma_enable &= ~(1 << devid);
2816b406782SAlan Cox 		pci_write_config_word(dev, master_port, master_data);
2826b406782SAlan Cox 	}
2836b406782SAlan Cox 	pci_write_config_byte(dev, 0x48, udma_enable);
284bb612cbaSBartlomiej Zolnierkiewicz 
285bb612cbaSBartlomiej Zolnierkiewicz 	spin_unlock_irqrestore(&rdc_lock, flags);
2866b406782SAlan Cox }
2876b406782SAlan Cox 
2886b406782SAlan Cox static struct ata_port_operations rdc_pata_ops = {
2896b406782SAlan Cox 	.inherits		= &ata_bmdma32_port_ops,
2906b406782SAlan Cox 	.cable_detect		= rdc_pata_cable_detect,
2916b406782SAlan Cox 	.set_piomode		= rdc_set_piomode,
2926b406782SAlan Cox 	.set_dmamode		= rdc_set_dmamode,
2936b406782SAlan Cox 	.prereset		= rdc_pata_prereset,
2946b406782SAlan Cox };
2956b406782SAlan Cox 
2966b406782SAlan Cox static struct ata_port_info rdc_port_info = {
2976b406782SAlan Cox 
2986b406782SAlan Cox 	.flags		= ATA_FLAG_SLAVE_POSS,
2996b406782SAlan Cox 	.pio_mask	= ATA_PIO4,
30082563232SBartlomiej Zolnierkiewicz 	.mwdma_mask	= ATA_MWDMA12_ONLY,
3016b406782SAlan Cox 	.udma_mask	= ATA_UDMA5,
3026b406782SAlan Cox 	.port_ops	= &rdc_pata_ops,
3036b406782SAlan Cox };
3046b406782SAlan Cox 
3056b406782SAlan Cox static struct scsi_host_template rdc_sht = {
3066b406782SAlan Cox 	ATA_BMDMA_SHT(DRV_NAME),
3076b406782SAlan Cox };
3086b406782SAlan Cox 
3096b406782SAlan Cox /**
3106b406782SAlan Cox  *	rdc_init_one - Register PIIX ATA PCI device with kernel services
3116b406782SAlan Cox  *	@pdev: PCI device to register
3126b406782SAlan Cox  *	@ent: Entry in rdc_pci_tbl matching with @pdev
3136b406782SAlan Cox  *
3146b406782SAlan Cox  *	Called from kernel PCI layer.  We probe for combined mode (sigh),
3156b406782SAlan Cox  *	and then hand over control to libata, for it to do the rest.
3166b406782SAlan Cox  *
3176b406782SAlan Cox  *	LOCKING:
3186b406782SAlan Cox  *	Inherited from PCI layer (may sleep).
3196b406782SAlan Cox  *
3206b406782SAlan Cox  *	RETURNS:
3216b406782SAlan Cox  *	Zero on success, or -ERRNO value.
3226b406782SAlan Cox  */
3236b406782SAlan Cox 
3246b406782SAlan Cox static int __devinit rdc_init_one(struct pci_dev *pdev,
3256b406782SAlan Cox 				   const struct pci_device_id *ent)
3266b406782SAlan Cox {
3276b406782SAlan Cox 	struct device *dev = &pdev->dev;
3286b406782SAlan Cox 	struct ata_port_info port_info[2];
3296b406782SAlan Cox 	const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] };
3306b406782SAlan Cox 	unsigned long port_flags;
3316b406782SAlan Cox 	struct ata_host *host;
3326b406782SAlan Cox 	struct rdc_host_priv *hpriv;
3336b406782SAlan Cox 	int rc;
3346b406782SAlan Cox 
33506296a1eSJoe Perches 	ata_print_version_once(&pdev->dev, DRV_VERSION);
3366b406782SAlan Cox 
3376b406782SAlan Cox 	port_info[0] = rdc_port_info;
3386b406782SAlan Cox 	port_info[1] = rdc_port_info;
3396b406782SAlan Cox 
3406b406782SAlan Cox 	port_flags = port_info[0].flags;
3416b406782SAlan Cox 
3426b406782SAlan Cox 	/* enable device and prepare host */
3436b406782SAlan Cox 	rc = pcim_enable_device(pdev);
3446b406782SAlan Cox 	if (rc)
3456b406782SAlan Cox 		return rc;
3466b406782SAlan Cox 
3476b406782SAlan Cox 	hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
3486b406782SAlan Cox 	if (!hpriv)
3496b406782SAlan Cox 		return -ENOMEM;
3506b406782SAlan Cox 
3516b406782SAlan Cox 	/* Save IOCFG, this will be used for cable detection, quirk
3526b406782SAlan Cox 	 * detection and restoration on detach.
3536b406782SAlan Cox 	 */
3546b406782SAlan Cox 	pci_read_config_dword(pdev, 0x54, &hpriv->saved_iocfg);
3556b406782SAlan Cox 
3561c5afdf7STejun Heo 	rc = ata_pci_bmdma_prepare_host(pdev, ppi, &host);
3576b406782SAlan Cox 	if (rc)
3586b406782SAlan Cox 		return rc;
3596b406782SAlan Cox 	host->private_data = hpriv;
3606b406782SAlan Cox 
3616b406782SAlan Cox 	pci_intx(pdev, 1);
3626b406782SAlan Cox 
3636b406782SAlan Cox 	host->flags |= ATA_HOST_PARALLEL_SCAN;
3646b406782SAlan Cox 
3656b406782SAlan Cox 	pci_set_master(pdev);
366c3b28894STejun Heo 	return ata_pci_sff_activate_host(host, ata_bmdma_interrupt, &rdc_sht);
3676b406782SAlan Cox }
3686b406782SAlan Cox 
3696b406782SAlan Cox static void rdc_remove_one(struct pci_dev *pdev)
3706b406782SAlan Cox {
3716b406782SAlan Cox 	struct ata_host *host = dev_get_drvdata(&pdev->dev);
3726b406782SAlan Cox 	struct rdc_host_priv *hpriv = host->private_data;
3736b406782SAlan Cox 
3746b406782SAlan Cox 	pci_write_config_dword(pdev, 0x54, hpriv->saved_iocfg);
3756b406782SAlan Cox 
3766b406782SAlan Cox 	ata_pci_remove_one(pdev);
3776b406782SAlan Cox }
3786b406782SAlan Cox 
3796b406782SAlan Cox static const struct pci_device_id rdc_pci_tbl[] = {
3806b406782SAlan Cox 	{ PCI_DEVICE(0x17F3, 0x1011), },
3816b406782SAlan Cox 	{ PCI_DEVICE(0x17F3, 0x1012), },
3826b406782SAlan Cox 	{ }	/* terminate list */
3836b406782SAlan Cox };
3846b406782SAlan Cox 
3856b406782SAlan Cox static struct pci_driver rdc_pci_driver = {
3866b406782SAlan Cox 	.name			= DRV_NAME,
3876b406782SAlan Cox 	.id_table		= rdc_pci_tbl,
3886b406782SAlan Cox 	.probe			= rdc_init_one,
3896b406782SAlan Cox 	.remove			= rdc_remove_one,
3905a298548SBartlomiej Zolnierkiewicz #ifdef CONFIG_PM
3915a298548SBartlomiej Zolnierkiewicz 	.suspend		= ata_pci_device_suspend,
3925a298548SBartlomiej Zolnierkiewicz 	.resume			= ata_pci_device_resume,
3935a298548SBartlomiej Zolnierkiewicz #endif
3946b406782SAlan Cox };
3956b406782SAlan Cox 
3966b406782SAlan Cox 
397*2fc75da0SAxel Lin module_pci_driver(rdc_pci_driver);
3986b406782SAlan Cox 
3996b406782SAlan Cox MODULE_AUTHOR("Alan Cox (based on ata_piix)");
4006b406782SAlan Cox MODULE_DESCRIPTION("SCSI low-level driver for RDC PATA controllers");
4016b406782SAlan Cox MODULE_LICENSE("GPL");
4026b406782SAlan Cox MODULE_DEVICE_TABLE(pci, rdc_pci_tbl);
4036b406782SAlan Cox MODULE_VERSION(DRV_VERSION);
404