git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
drivers
/
ide
/
pci
/
alim15x3.c
diff --git
a/drivers/ide/pci/alim15x3.c
b/drivers/ide/pci/alim15x3.c
index
82a449d
..
68df77e
100644
(file)
--- a/
drivers/ide/pci/alim15x3.c
+++ b/
drivers/ide/pci/alim15x3.c
@@
-8,6
+8,7
@@
* Copyright (C) 1998-2000 Andre Hedrick (andre@linux-ide.org)
* May be copied or modified under the terms of the GNU General Public License
* Copyright (C) 2002 Alan Cox <alan@redhat.com>
* Copyright (C) 1998-2000 Andre Hedrick (andre@linux-ide.org)
* May be copied or modified under the terms of the GNU General Public License
* Copyright (C) 2002 Alan Cox <alan@redhat.com>
+ * ALi (now ULi M5228) support by Clear Zhang <Clear.Zhang@ali.com.tw>
*
* (U)DMA capable version of ali 1533/1543(C), 1535(D)
*
*
* (U)DMA capable version of ali 1533/1543(C), 1535(D)
*
@@
-26,7
+27,6
@@
*
*/
*
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
@@
-558,18
+558,19
@@
no_dma_set:
}
/**
}
/**
- * ali15x3_dma_
write - do a DMA IDE writ
e
- * @drive:
drive to issue write for
+ * ali15x3_dma_
setup - begin a DMA phas
e
+ * @drive:
target device
*
*
- * Returns 1 if the DMA write cannot be performed, zero on
- * success.
+ * Returns 1 if the DMA cannot be performed, zero on success.
*/
*/
-
-static int ali15x3_dma_
write
(ide_drive_t *drive)
+
+static int ali15x3_dma_
setup
(ide_drive_t *drive)
{
{
- if ((m5229_revision < 0xC2) && (drive->media != ide_disk))
- return 1; /* try PIO instead of DMA */
- return __ide_dma_write(drive);
+ if (m5229_revision < 0xC2 && drive->media != ide_disk) {
+ if (rq_data_dir(drive->hwif->hwgroup->rq))
+ return 1; /* try PIO instead of DMA */
+ }
+ return ide_dma_setup(drive);
}
/**
}
/**
@@
-581,15
+582,15
@@
static int ali15x3_dma_write (ide_drive_t *drive)
* appropriate also sets up the 1533 southbridge.
*/
* appropriate also sets up the 1533 southbridge.
*/
-static unsigned int __init init_chipset_ali15x3 (struct pci_dev *dev, const char *name)
+static unsigned int __
dev
init init_chipset_ali15x3 (struct pci_dev *dev, const char *name)
{
unsigned long flags;
u8 tmpbyte;
{
unsigned long flags;
u8 tmpbyte;
- struct pci_dev *north = pci_
find_slot(0
, PCI_DEVFN(0,0));
+ struct pci_dev *north = pci_
get_slot(dev->bus
, PCI_DEVFN(0,0));
pci_read_config_byte(dev, PCI_REVISION_ID, &m5229_revision);
pci_read_config_byte(dev, PCI_REVISION_ID, &m5229_revision);
- isa_dev = pci_
find
_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
+ isa_dev = pci_
get
_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
#if defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS)
if (!ali_proc) {
#if defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS)
if (!ali_proc) {
@@
-612,8
+613,7
@@
static unsigned int __init init_chipset_ali15x3 (struct pci_dev *dev, const char
* clear bit 7
*/
pci_write_config_byte(dev, 0x4b, tmpbyte & 0x7F);
* clear bit 7
*/
pci_write_config_byte(dev, 0x4b, tmpbyte & 0x7F);
- local_irq_restore(flags);
- return 0;
+ goto out;
}
/*
}
/*
@@
-636,10
+636,8
@@
static unsigned int __init init_chipset_ali15x3 (struct pci_dev *dev, const char
* box without a device at 0:0.0. The ALi bridge will be at
* 0:0.0 so if we didn't find one we know what is cooking.
*/
* box without a device at 0:0.0. The ALi bridge will be at
* 0:0.0 so if we didn't find one we know what is cooking.
*/
- if (north && north->vendor != PCI_VENDOR_ID_AL) {
- local_irq_restore(flags);
- return 0;
- }
+ if (north && north->vendor != PCI_VENDOR_ID_AL)
+ goto out;
if (m5229_revision < 0xC5 && isa_dev)
{
if (m5229_revision < 0xC5 && isa_dev)
{
@@
-660,6
+658,9
@@
static unsigned int __init init_chipset_ali15x3 (struct pci_dev *dev, const char
pci_write_config_byte(isa_dev, 0x79, tmpbyte | 0x02);
}
}
pci_write_config_byte(isa_dev, 0x79, tmpbyte | 0x02);
}
}
+out:
+ pci_dev_put(north);
+ pci_dev_put(isa_dev);
local_irq_restore(flags);
return 0;
}
local_irq_restore(flags);
return 0;
}
@@
-675,7
+676,7
@@
static unsigned int __init init_chipset_ali15x3 (struct pci_dev *dev, const char
* FIXME: frobs bits that are not defined on newer ALi devicea
*/
* FIXME: frobs bits that are not defined on newer ALi devicea
*/
-static unsigned int __init ata66_ali15x3 (ide_hwif_t *hwif)
+static unsigned int __
dev
init ata66_ali15x3 (ide_hwif_t *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
unsigned int ata66 = 0;
{
struct pci_dev *dev = hwif->pci_dev;
unsigned int ata66 = 0;
@@
-729,6
+730,8
@@
static unsigned int __init ata66_ali15x3 (ide_hwif_t *hwif)
if(m5229_revision <= 0x20)
tmpbyte = (tmpbyte & (~0x02)) | 0x01;
if(m5229_revision <= 0x20)
tmpbyte = (tmpbyte & (~0x02)) | 0x01;
+ else if (m5229_revision == 0xc7 || m5229_revision == 0xc8)
+ tmpbyte |= 0x03;
else
tmpbyte |= 0x01;
else
tmpbyte |= 0x01;
@@
-746,7
+749,7
@@
static unsigned int __init ata66_ali15x3 (ide_hwif_t *hwif)
* Initialize the IDE structure side of the ALi 15x3 driver.
*/
* Initialize the IDE structure side of the ALi 15x3 driver.
*/
-static void __init init_hwif_common_ali15x3 (ide_hwif_t *hwif)
+static void __
dev
init init_hwif_common_ali15x3 (ide_hwif_t *hwif)
{
hwif->autodma = 0;
hwif->tuneproc = &ali15x3_tune_drive;
{
hwif->autodma = 0;
hwif->tuneproc = &ali15x3_tune_drive;
@@
-773,7
+776,7
@@
static void __init init_hwif_common_ali15x3 (ide_hwif_t *hwif)
* M1543C or newer for DMAing
*/
hwif->ide_dma_check = &ali15x3_config_drive_for_dma;
* M1543C or newer for DMAing
*/
hwif->ide_dma_check = &ali15x3_config_drive_for_dma;
-
hwif->ide_dma_write = &ali15x3_dma_write
;
+
hwif->dma_setup = &ali15x3_dma_setup
;
if (!noautodma)
hwif->autodma = 1;
if (!(hwif->udma_four))
if (!noautodma)
hwif->autodma = 1;
if (!(hwif->udma_four))
@@
-792,14
+795,15
@@
static void __init init_hwif_common_ali15x3 (ide_hwif_t *hwif)
* Sparc systems
*/
* Sparc systems
*/
-static void __init init_hwif_ali15x3 (ide_hwif_t *hwif)
+static void __
dev
init init_hwif_ali15x3 (ide_hwif_t *hwif)
{
u8 ideic, inmir;
s8 irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6,
1, 11, 0, 12, 0, 14, 0, 15 };
int irq = -1;
{
u8 ideic, inmir;
s8 irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6,
1, 11, 0, 12, 0, 14, 0, 15 };
int irq = -1;
-
- hwif->irq = hwif->channel ? 15 : 14;
+
+ if (hwif->pci_dev->device == PCI_DEVICE_ID_AL_M5229)
+ hwif->irq = hwif->channel ? 15 : 14;
if (isa_dev) {
/*
if (isa_dev) {
/*
@@
-844,7
+848,7
@@
static void __init init_hwif_ali15x3 (ide_hwif_t *hwif)
* the actual work.
*/
* the actual work.
*/
-static void __init init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase)
+static void __
dev
init init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase)
{
if (m5229_revision < 0x20)
return;
{
if (m5229_revision < 0x20)
return;
@@
-873,21
+877,26
@@
static ide_pci_device_t ali15x3_chipset __devinitdata = {
static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
+ static struct pci_device_id ati_rs100[] = {
+ { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100) },
+ { },
+ };
+
ide_pci_device_t *d = &ali15x3_chipset;
ide_pci_device_t *d = &ali15x3_chipset;
- if
(pci_find_device(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100, NULL
))
- printk(KERN_
ERR "Warning
: ATI Radeon IGP Northbridge is not yet fully tested.\n");
+ if
(pci_dev_present(ati_rs100
))
+ printk(KERN_
WARNING "alim15x3
: ATI Radeon IGP Northbridge is not yet fully tested.\n");
#if defined(CONFIG_SPARC64)
d->init_hwif = init_hwif_common_ali15x3;
#endif /* CONFIG_SPARC64 */
#if defined(CONFIG_SPARC64)
d->init_hwif = init_hwif_common_ali15x3;
#endif /* CONFIG_SPARC64 */
- ide_setup_pci_device(dev, d);
- return 0;
+ return ide_setup_pci_device(dev, d);
}
static struct pci_device_id alim15x3_pci_tbl[] = {
{ PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M5229, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
}
static struct pci_device_id alim15x3_pci_tbl[] = {
{ PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M5229, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+ { PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M5228, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ 0, },
};
MODULE_DEVICE_TABLE(pci, alim15x3_pci_tbl);
{ 0, },
};
MODULE_DEVICE_TABLE(pci, alim15x3_pci_tbl);
@@
-898,7
+907,7
@@
static struct pci_driver driver = {
.probe = alim15x3_init_one,
};
.probe = alim15x3_init_one,
};
-static int ali15x3_ide_init(void)
+static int
__init
ali15x3_ide_init(void)
{
return ide_pci_register_driver(&driver);
}
{
return ide_pci_register_driver(&driver);
}