linux/drivers/ide/pci/amd74xx.c

359 lines
11 KiB
C
Raw Normal View History

/*
* AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04
* IDE driver for Linux.
*
* Copyright (c) 2000-2002 Vojtech Pavlik
* Copyright (c) 2007 Bartlomiej Zolnierkiewicz
*
* Based on the work of:
* Andre Hedrick
*/
/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/ide.h>
#include "ide-timing.h"
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
enum {
AMD_IDE_CONFIG = 0x41,
AMD_CABLE_DETECT = 0x42,
AMD_DRIVE_TIMING = 0x48,
AMD_8BIT_TIMING = 0x4e,
AMD_ADDRESS_SETUP = 0x4c,
AMD_UDMA_TIMING = 0x50,
};
static unsigned int amd_80w;
static unsigned int amd_clock;
static char *amd_dma[] = { "16", "25", "33", "44", "66", "100", "133" };
static unsigned char amd_cyc2udma[] = { 6, 6, 5, 4, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 7 };
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
static inline u8 amd_offset(struct pci_dev *dev)
{
return (dev->vendor == PCI_VENDOR_ID_NVIDIA) ? 0x10 : 0;
}
/*
* amd_set_speed() writes timing values to the chipset registers
*/
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
static void amd_set_speed(struct pci_dev *dev, u8 dn, u8 udma_mask,
struct ide_timing *timing)
{
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
u8 t = 0, offset = amd_offset(dev);
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
pci_read_config_byte(dev, AMD_ADDRESS_SETUP + offset, &t);
t = (t & ~(3 << ((3 - dn) << 1))) | ((FIT(timing->setup, 1, 4) - 1) << ((3 - dn) << 1));
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
pci_write_config_byte(dev, AMD_ADDRESS_SETUP + offset, t);
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
pci_write_config_byte(dev, AMD_8BIT_TIMING + offset + (1 - (dn >> 1)),
((FIT(timing->act8b, 1, 16) - 1) << 4) | (FIT(timing->rec8b, 1, 16) - 1));
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
pci_write_config_byte(dev, AMD_DRIVE_TIMING + offset + (3 - dn),
((FIT(timing->active, 1, 16) - 1) << 4) | (FIT(timing->recover, 1, 16) - 1));
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
switch (udma_mask) {
case ATA_UDMA2: t = timing->udma ? (0xc0 | (FIT(timing->udma, 2, 5) - 2)) : 0x03; break;
case ATA_UDMA4: t = timing->udma ? (0xc0 | amd_cyc2udma[FIT(timing->udma, 2, 10)]) : 0x03; break;
case ATA_UDMA5: t = timing->udma ? (0xc0 | amd_cyc2udma[FIT(timing->udma, 1, 10)]) : 0x03; break;
case ATA_UDMA6: t = timing->udma ? (0xc0 | amd_cyc2udma[FIT(timing->udma, 1, 15)]) : 0x03; break;
default: return;
}
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
pci_write_config_byte(dev, AMD_UDMA_TIMING + offset + (3 - dn), t);
}
/*
ide: move ide_config_drive_speed() calls to upper layers (take 2) * Convert {ide_hwif_t,ide_pci_device_t}->host_flag to be u16. * Add IDE_HFLAG_POST_SET_MODE host flag to indicate the need to program the host for the transfer mode after programming the device. Set it in au1xxx-ide, amd74xx, cs5530, cs5535, pdc202xx_new, sc1200, pmac and via82cxxx host drivers. * Add IDE_HFLAG_NO_SET_MODE host flag to indicate the need to completely skip programming of host/device for the transfer mode ("smart" hosts). Set it in it821x host driver and check it in ide_tune_dma(). * Add ide_set_pio_mode()/ide_set_dma_mode() helpers and convert all direct ->set_pio_mode/->speedproc users to use these helpers. * Move ide_config_drive_speed() calls from ->set_pio_mode/->speedproc methods to callers. * Rename ->speedproc method to ->set_dma_mode, make it void and update all implementations accordingly. * Update ide_set_xfer_rate() comments. * Unexport ide_config_drive_speed(). v2: * Fix issues noticed by Sergei: - export ide_set_dma_mode() instead of moving ->set_pio_mode abuse wrt to setting DMA modes from sc1200_set_pio_mode() to do_special() - check IDE_HFLAG_NO_SET_MODE in ide_tune_dma() - check for (hwif->set_pio_mode) == NULL in ide_set_pio_mode() - check for (hwif->set_dma_mode) == NULL in ide_set_dma_mode() - return -1 from ide_set_{pio,dma}_mode() if ->set_{pio,dma}_mode == NULL - don't set ->set_{pio,dma}_mode on it821x in "smart" mode - fix build problem in pmac.c - minor fixes in au1xxx-ide.c/cs5530.c/siimage.c - improve patch description Changes in behavior caused by this patch: - HDIO_SET_PIO_MODE ioctl would now return -ENOSYS for attempts to change PIO mode if it821x controller is in "smart" mode - removal of two debugging printk-s (from cs5530.c and sc1200.c) - transfer modes 0x00-0x07 passed from user space may be programmed twice on the device (not really an issue since 0x00 is not supported correctly by any host driver ATM, 0x01 is not supported at all and 0x02-0x07 are invalid) Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2007-10-13 17:47:51 +02:00
* amd_set_drive() computes timing values and configures the chipset
* to a desired transfer mode. It also can be called by upper layers.
*/
ide: move ide_config_drive_speed() calls to upper layers (take 2) * Convert {ide_hwif_t,ide_pci_device_t}->host_flag to be u16. * Add IDE_HFLAG_POST_SET_MODE host flag to indicate the need to program the host for the transfer mode after programming the device. Set it in au1xxx-ide, amd74xx, cs5530, cs5535, pdc202xx_new, sc1200, pmac and via82cxxx host drivers. * Add IDE_HFLAG_NO_SET_MODE host flag to indicate the need to completely skip programming of host/device for the transfer mode ("smart" hosts). Set it in it821x host driver and check it in ide_tune_dma(). * Add ide_set_pio_mode()/ide_set_dma_mode() helpers and convert all direct ->set_pio_mode/->speedproc users to use these helpers. * Move ide_config_drive_speed() calls from ->set_pio_mode/->speedproc methods to callers. * Rename ->speedproc method to ->set_dma_mode, make it void and update all implementations accordingly. * Update ide_set_xfer_rate() comments. * Unexport ide_config_drive_speed(). v2: * Fix issues noticed by Sergei: - export ide_set_dma_mode() instead of moving ->set_pio_mode abuse wrt to setting DMA modes from sc1200_set_pio_mode() to do_special() - check IDE_HFLAG_NO_SET_MODE in ide_tune_dma() - check for (hwif->set_pio_mode) == NULL in ide_set_pio_mode() - check for (hwif->set_dma_mode) == NULL in ide_set_dma_mode() - return -1 from ide_set_{pio,dma}_mode() if ->set_{pio,dma}_mode == NULL - don't set ->set_{pio,dma}_mode on it821x in "smart" mode - fix build problem in pmac.c - minor fixes in au1xxx-ide.c/cs5530.c/siimage.c - improve patch description Changes in behavior caused by this patch: - HDIO_SET_PIO_MODE ioctl would now return -ENOSYS for attempts to change PIO mode if it821x controller is in "smart" mode - removal of two debugging printk-s (from cs5530.c and sc1200.c) - transfer modes 0x00-0x07 passed from user space may be programmed twice on the device (not really an issue since 0x00 is not supported correctly by any host driver ATM, 0x01 is not supported at all and 0x02-0x07 are invalid) Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2007-10-13 17:47:51 +02:00
static void amd_set_drive(ide_drive_t *drive, const u8 speed)
{
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
ide_hwif_t *hwif = drive->hwif;
struct pci_dev *dev = to_pci_dev(hwif->dev);
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
ide_drive_t *peer = hwif->drives + (~drive->dn & 1);
struct ide_timing t, p;
int T, UT;
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
u8 udma_mask = hwif->ultra_mask;
T = 1000000000 / amd_clock;
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
UT = (udma_mask == ATA_UDMA2) ? T : (T / 2);
ide_timing_compute(drive, speed, &t, T, UT);
if (peer->present) {
ide_timing_compute(peer, peer->current_speed, &p, T, UT);
ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT);
}
if (speed == XFER_UDMA_5 && amd_clock <= 33333) t.udma = 1;
if (speed == XFER_UDMA_6 && amd_clock <= 33333) t.udma = 15;
amd_set_speed(dev, drive->dn, udma_mask, &t);
}
/*
* amd_set_pio_mode() is a callback from upper layers for PIO-only tuning.
*/
static void amd_set_pio_mode(ide_drive_t *drive, const u8 pio)
{
amd_set_drive(drive, XFER_PIO_0 + pio);
}
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
static void __devinit amd7409_cable_detect(struct pci_dev *dev,
const char *name)
{
/* no host side cable detection */
amd_80w = 0x03;
}
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
static void __devinit amd7411_cable_detect(struct pci_dev *dev,
const char *name)
{
int i;
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
u32 u = 0;
u8 t = 0, offset = amd_offset(dev);
pci_read_config_byte(dev, AMD_CABLE_DETECT + offset, &t);
pci_read_config_dword(dev, AMD_UDMA_TIMING + offset, &u);
amd_80w = ((t & 0x3) ? 1 : 0) | ((t & 0xc) ? 2 : 0);
for (i = 24; i >= 0; i -= 8)
if (((u >> i) & 4) && !(amd_80w & (1 << (1 - (i >> 4))))) {
printk(KERN_WARNING "%s: BIOS didn't set cable bits "
"correctly. Enabling workaround.\n",
name);
amd_80w |= (1 << (1 - (i >> 4)));
}
}
/*
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
* The initialization callback. Initialize drive independent registers.
*/
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev,
const char *name)
{
u8 t = 0, offset = amd_offset(dev);
/*
* Check 80-wire cable presence.
*/
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
if (dev->vendor == PCI_VENDOR_ID_AMD &&
dev->device == PCI_DEVICE_ID_AMD_COBRA_7401)
; /* no UDMA > 2 */
else if (dev->vendor == PCI_VENDOR_ID_AMD &&
dev->device == PCI_DEVICE_ID_AMD_VIPER_7409)
amd7409_cable_detect(dev, name);
else
amd7411_cable_detect(dev, name);
/*
* Take care of prefetch & postwrite.
*/
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
pci_read_config_byte(dev, AMD_IDE_CONFIG + offset, &t);
/*
* Check for broken FIFO support.
*/
if (dev->vendor == PCI_VENDOR_ID_AMD &&
dev->vendor == PCI_DEVICE_ID_AMD_VIPER_7411)
t &= 0x0f;
else
t |= 0xf0;
pci_write_config_byte(dev, AMD_IDE_CONFIG + offset, t);
/*
* Determine the system bus clock.
*/
amd_clock = (ide_pci_clk ? ide_pci_clk : system_bus_clock()) * 1000;
switch (amd_clock) {
case 33000: amd_clock = 33333; break;
case 37000: amd_clock = 37500; break;
case 41000: amd_clock = 41666; break;
}
if (amd_clock < 20000 || amd_clock > 50000) {
printk(KERN_WARNING "%s: User given PCI clock speed impossible (%d), using 33 MHz instead.\n",
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
name, amd_clock);
amd_clock = 33333;
}
return dev->irq;
}
static u8 __devinit amd_cable_detect(ide_hwif_t *hwif)
{
if ((amd_80w >> hwif->channel) & 1)
return ATA_CBL_PATA80;
else
return ATA_CBL_PATA40;
}
static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
{
struct pci_dev *dev = to_pci_dev(hwif->dev);
if (hwif->irq == 0) /* 0 is bogus but will do for now */
hwif->irq = pci_get_legacy_ide_irq(dev, hwif->channel);
}
static const struct ide_port_ops amd_port_ops = {
.set_pio_mode = amd_set_pio_mode,
.set_dma_mode = amd_set_drive,
.cable_detect = amd_cable_detect,
};
#define IDE_HFLAGS_AMD \
(IDE_HFLAG_PIO_NO_BLACKLIST | \
IDE_HFLAG_ABUSE_SET_DMA_MODE | \
IDE_HFLAG_POST_SET_MODE | \
IDE_HFLAG_IO_32BIT | \
IDE_HFLAG_UNMASK_IRQS)
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
#define DECLARE_AMD_DEV(name_str, swdma, udma) \
{ \
.name = name_str, \
.init_chipset = init_chipset_amd74xx, \
.init_hwif = init_hwif_amd74xx, \
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \
.port_ops = &amd_port_ops, \
.host_flags = IDE_HFLAGS_AMD, \
.pio_mask = ATA_PIO5, \
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
.swdma_mask = swdma, \
.mwdma_mask = ATA_MWDMA2, \
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
.udma_mask = udma, \
}
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
#define DECLARE_NV_DEV(name_str, udma) \
{ \
.name = name_str, \
.init_chipset = init_chipset_amd74xx, \
.init_hwif = init_hwif_amd74xx, \
.enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \
.port_ops = &amd_port_ops, \
.host_flags = IDE_HFLAGS_AMD, \
.pio_mask = ATA_PIO5, \
.swdma_mask = ATA_SWDMA2, \
.mwdma_mask = ATA_MWDMA2, \
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
.udma_mask = udma, \
}
static const struct ide_port_info amd74xx_chipsets[] __devinitdata = {
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
/* 0 */ DECLARE_AMD_DEV("AMD7401", 0x00, ATA_UDMA2),
/* 1 */ DECLARE_AMD_DEV("AMD7409", ATA_SWDMA2, ATA_UDMA4),
/* 2 */ DECLARE_AMD_DEV("AMD7411", ATA_SWDMA2, ATA_UDMA5),
/* 3 */ DECLARE_AMD_DEV("AMD7441", ATA_SWDMA2, ATA_UDMA5),
/* 4 */ DECLARE_AMD_DEV("AMD8111", ATA_SWDMA2, ATA_UDMA6),
/* 5 */ DECLARE_NV_DEV("NFORCE", ATA_UDMA5),
/* 6 */ DECLARE_NV_DEV("NFORCE2", ATA_UDMA6),
/* 7 */ DECLARE_NV_DEV("NFORCE2-U400R", ATA_UDMA6),
/* 8 */ DECLARE_NV_DEV("NFORCE2-U400R-SATA", ATA_UDMA6),
/* 9 */ DECLARE_NV_DEV("NFORCE3-150", ATA_UDMA6),
/* 10 */ DECLARE_NV_DEV("NFORCE3-250", ATA_UDMA6),
/* 11 */ DECLARE_NV_DEV("NFORCE3-250-SATA", ATA_UDMA6),
/* 12 */ DECLARE_NV_DEV("NFORCE3-250-SATA2", ATA_UDMA6),
/* 13 */ DECLARE_NV_DEV("NFORCE-CK804", ATA_UDMA6),
/* 14 */ DECLARE_NV_DEV("NFORCE-MCP04", ATA_UDMA6),
/* 15 */ DECLARE_NV_DEV("NFORCE-MCP51", ATA_UDMA6),
/* 16 */ DECLARE_NV_DEV("NFORCE-MCP55", ATA_UDMA6),
/* 17 */ DECLARE_NV_DEV("NFORCE-MCP61", ATA_UDMA6),
/* 18 */ DECLARE_NV_DEV("NFORCE-MCP65", ATA_UDMA6),
/* 19 */ DECLARE_NV_DEV("NFORCE-MCP67", ATA_UDMA6),
/* 20 */ DECLARE_NV_DEV("NFORCE-MCP73", ATA_UDMA6),
/* 21 */ DECLARE_NV_DEV("NFORCE-MCP77", ATA_UDMA6),
/* 22 */ DECLARE_AMD_DEV("AMD5536", ATA_SWDMA2, ATA_UDMA5),
};
static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
struct ide_port_info d;
u8 idx = id->driver_data;
d = amd74xx_chipsets[idx];
/*
* Check for bad SWDMA and incorrectly wired Serenade mainboards.
*/
if (idx == 1) {
if (dev->revision <= 7)
d.swdma_mask = 0;
d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX;
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
} else if (idx == 4) {
if (dev->subsystem_vendor == PCI_VENDOR_ID_AMD &&
dev->subsystem_device == PCI_DEVICE_ID_AMD_SERENADE)
d.udma_mask = ATA_UDMA5;
}
amd74xx: remove amd_ide_chips table * Remove no longer needed assertion from amd74xx_probe(). * Factor out cable detection for AMD7409 to amd7409_cable_detect() and for chipsets >= AMD7411 to amd7411_cable_detect(). * Use dev->vendor and dev->device instead of amd_config->udma_mask when selecting cable detection method and checking for broken FIFO support in init_chipset_amd74xx(). * Remove no longer needed AMD_BAD_FIFO define. * Add 'swdma' parameter for setting .swdma_mask to DECLARE_AMD_DEV() macro. * Add 'udma' parameter for setting .udma_mask to DECLARE_{AMD,NV}_DEV() macro. * Keep a copy of a current amd74xx_chipsets[] entry in amd74xx_probe() in order to fix ->swdma_mask on early AMD7409 revisions and ->udma_mask on Serenade mainboards. * Remove no longer needed fixups from init_chipset_amd74xx() and AMD_CHECK_{SWDMA,SERENADE} defines. * Move printing banner message from init_chipset_amd74xx() to amd74xx_probe(), also remove incorrect comment while at it. * Use hwif->ultra_mask instead of amd_config->udma_mask in amd_set_drive(). * Add 'udma_mask' argument to amd_set_speed() and pass UDMA mask from amd_set_drive() instead of using amd_config->udma_mask. * Move amd_config->base from AMD_* defines to users of these defines and add 0x40 the defined values. Then add amd_offset() inline helper for selecting offset from 0x40 base (needed for nVidia controllers) and finally use it in amd_set_speed(), amd7411_cable_detect() and init_chipset_amd74xx() instead of amd_config->base. * Remove no longer needed AMD_BAD_SWDMA define, ->{swdma,ultra}_mask setup from init_hwif_amd74xx(), amd_{config,chipset} variables and amd_ide_chips table. * Fix init_chipset_amd74xx() comment. * Bump driver version. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-01 23:09:30 +01:00
printk(KERN_INFO "%s: %s (rev %02x) UDMA%s controller\n",
d.name, pci_name(dev), dev->revision,
amd_dma[fls(d.udma_mask) - 1]);
return ide_setup_pci_device(dev, &d);
}
static const struct pci_device_id amd74xx_pci_tbl[] = {
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_COBRA_7401), 0 },
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_VIPER_7409), 1 },
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_VIPER_7411), 2 },
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_OPUS_7441), 3 },
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_8111_IDE), 4 },
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_IDE), 5 },
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE), 6 },
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE), 7 },
#ifdef CONFIG_BLK_DEV_IDE_SATA
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA), 8 },
#endif
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE), 9 },
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE), 10 },
#ifdef CONFIG_BLK_DEV_IDE_SATA
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA), 11 },
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2), 12 },
#endif
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE), 13 },
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE), 14 },
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE), 15 },
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE), 16 },
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE), 17 },
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE), 18 },
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE), 19 },
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE), 20 },
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE), 21 },
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CS5536_IDE), 22 },
{ 0, },
};
MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl);
static struct pci_driver driver = {
.name = "AMD_IDE",
.id_table = amd74xx_pci_tbl,
.probe = amd74xx_probe,
};
static int __init amd74xx_ide_init(void)
{
return ide_pci_register_driver(&driver);
}
module_init(amd74xx_ide_init);
MODULE_AUTHOR("Vojtech Pavlik");
MODULE_DESCRIPTION("AMD PCI IDE driver");
MODULE_LICENSE("GPL");