X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fide%2Fpci%2Fit8213.c;h=e3427eaab430b9de5ef463c4e8c558e6bace1fec;hb=dd07a8db7283f52f347aee468007556944b5b393;hp=2a0f45c4f4c4167290db93a4814a2c40facc18c4;hpb=2ba14a017a4ba8d2266316f481d4ad7400073d18;p=pandora-kernel.git diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c index 2a0f45c4f4c4..e3427eaab430 100644 --- a/drivers/ide/pci/it8213.c +++ b/drivers/ide/pci/it8213.c @@ -10,13 +10,10 @@ #include #include #include -#include #include #include #include -#include - /** * it8213_set_pio_mode - set host controller for PIO mode * @drive: drive @@ -28,7 +25,7 @@ static void it8213_set_pio_mode(ide_drive_t *drive, const u8 pio) { ide_hwif_t *hwif = HWIF(drive); - struct pci_dev *dev = hwif->pci_dev; + struct pci_dev *dev = to_pci_dev(hwif->dev); int is_slave = drive->dn & 1; int master_port = 0x40; int slave_port = 0x44; @@ -85,7 +82,7 @@ static void it8213_set_pio_mode(ide_drive_t *drive, const u8 pio) static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed) { ide_hwif_t *hwif = HWIF(drive); - struct pci_dev *dev = hwif->pci_dev; + struct pci_dev *dev = to_pci_dev(hwif->dev); u8 maslave = 0x40; int a_speed = 3 << (drive->dn * 4); int u_flag = 1 << drive->dn; @@ -143,6 +140,16 @@ static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed) } } +static u8 __devinit it8213_cable_detect(ide_hwif_t *hwif) +{ + struct pci_dev *dev = to_pci_dev(hwif->dev); + u8 reg42h = 0; + + pci_read_config_byte(dev, 0x42, ®42h); + + return (reg42h & 0x02) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; +} + /** * init_hwif_it8213 - set up hwif structs * @hwif: interface to set up @@ -152,18 +159,10 @@ static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed) static void __devinit init_hwif_it8213(ide_hwif_t *hwif) { - u8 reg42h = 0; - hwif->set_dma_mode = &it8213_set_dma_mode; hwif->set_pio_mode = &it8213_set_pio_mode; - if (!hwif->dma_base) - return; - - pci_read_config_byte(hwif->pci_dev, 0x42, ®42h); - - if (hwif->cbl != ATA_CBL_PATA40_SHORT) - hwif->cbl = (reg42h & 0x02) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; + hwif->cable_detect = it8213_cable_detect; }