Commit 26b90050 authored by Ivan Kokshaysky's avatar Ivan Kokshaysky Committed by Jens Axboe

[PATCH] ALi and Cypress IDE fixes

These two chipsets are most common on alpha.
- cy82c693: allow the generic IDE setup code to work correctly
  with broken PCI registers layout of this chip. This fixes
  quite a few problems with secondary channel, plus some hacks in
  arch code can go away.
- ALi M5229: enable DMA.
parent 92f2c52c
......@@ -338,6 +338,9 @@ static void cy82c693_tune_drive (ide_drive_t *drive, u8 pio)
*/
unsigned int __init init_chipset_cy82c693(struct pci_dev *dev, const char *name)
{
if (PCI_FUNC(dev->devfn) != 1)
return 0;
#ifdef CY82C693_SETDMA_CLOCK
u8 data = 0;
#endif /* CY82C693_SETDMA_CLOCK */
......@@ -411,20 +414,30 @@ void __init init_hwif_cy82c693(ide_hwif_t *hwif)
#endif /* CONFIG_BLK_DEV_IDEDMA */
}
void __init init_dma_cy82c693 (ide_hwif_t *hwif, unsigned long dmabase)
static __initdata ide_hwif_t *primary;
void __init init_iops_cy82c693(ide_hwif_t *hwif)
{
ide_setup_dma(hwif, dmabase, 8);
if (PCI_FUNC(hwif->pci_dev->devfn) == 1)
primary = hwif;
else {
hwif->mate = primary;
hwif->channel = 1;
}
}
extern void ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *);
static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
ide_pci_device_t *d = &cy82c693_chipsets[id->driver_data];
if ((!(PCI_FUNC(dev->devfn) & 1) ||
(!((dev->class >> 8) == PCI_CLASS_STORAGE_IDE))))
return 0; /* CY82C693 is more than only a IDE controller */
ide_setup_pci_device(dev, d);
struct pci_dev *dev2;
/* CY82C693 is more than only a IDE controller.
Function 1 is primary IDE channel, function 2 - secondary. */
if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE &&
PCI_FUNC(dev->devfn) == 1) {
dev2 = pci_find_slot(dev->bus->number, dev->devfn + 1);
ide_setup_pci_devices(dev, dev2, d);
}
return 0;
}
......
......@@ -66,7 +66,7 @@ typedef struct pio_clocks_s {
extern unsigned int init_chipset_cy82c693(struct pci_dev *, const char *);
extern void init_hwif_cy82c693(ide_hwif_t *);
extern void init_dma_cy82c693(ide_hwif_t *, unsigned long);
extern void init_iops_cy82c693(ide_hwif_t *);
static ide_pci_device_t cy82c693_chipsets[] __initdata = {
{ /* 0 */
......@@ -74,10 +74,10 @@ static ide_pci_device_t cy82c693_chipsets[] __initdata = {
device: PCI_DEVICE_ID_CONTAQ_82C693,
name: "CY82C693",
init_chipset: init_chipset_cy82c693,
init_iops: NULL,
init_iops: init_iops_cy82c693,
init_hwif: init_hwif_cy82c693,
init_dma: init_dma_cy82c693,
channels: 2,
init_dma: NULL,
channels: 1,
autodma: AUTODMA,
enablebits: {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
bootable: ON_BOARD,
......
......@@ -250,6 +250,7 @@ static unsigned long __init ide_get_or_set_dma_base (ide_hwif_t *hwif)
switch(dev->device) {
case PCI_DEVICE_ID_AL_M5219:
case PCI_DEVICE_ID_AL_M5229:
case PCI_DEVICE_ID_AMD_VIPER_7409:
case PCI_DEVICE_ID_CMD_643:
case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE:
......
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