summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/chipsets/ata-marvell.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ata/chipsets/ata-marvell.c')
-rw-r--r--sys/dev/ata/chipsets/ata-marvell.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/sys/dev/ata/chipsets/ata-marvell.c b/sys/dev/ata/chipsets/ata-marvell.c
index bda1a17..0d11266 100644
--- a/sys/dev/ata/chipsets/ata-marvell.c
+++ b/sys/dev/ata/chipsets/ata-marvell.c
@@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$");
/* local prototypes */
static int ata_marvell_chipinit(device_t dev);
static int ata_marvell_ch_attach(device_t dev);
-static void ata_marvell_setmode(device_t dev, int mode);
+static int ata_marvell_setmode(device_t dev, int target, int mode);
static int ata_marvell_edma_ch_attach(device_t dev);
static int ata_marvell_edma_ch_detach(device_t dev);
static int ata_marvell_edma_status(device_t dev);
@@ -170,20 +170,24 @@ ata_marvell_ch_attach(device_t dev)
error = ata_pci_ch_attach(dev);
/* dont use 32 bit PIO transfers */
ch->flags |= ATA_USE_16BIT;
+ ch->flags |= ATA_CHECKS_CABLE;
return (error);
}
-static void
-ata_marvell_setmode(device_t dev, int mode)
+static int
+ata_marvell_setmode(device_t dev, int target, int mode)
{
- device_t gparent = GRANDPARENT(dev);
- struct ata_pci_controller *ctlr = device_get_softc(gparent);
- struct ata_device *atadev = device_get_softc(dev);
-
- mode = ata_limit_mode(dev, mode, ctlr->chip->max_dma);
- mode = ata_check_80pin(dev, mode);
- if (!ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_SETXFER, 0, mode))
- atadev->mode = mode;
+ struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
+ struct ata_channel *ch = device_get_softc(dev);
+
+ mode = min(mode, ctlr->chip->max_dma);
+ /* Check for 80pin cable present. */
+ if (mode > ATA_UDMA2 && ATA_IDX_INB(ch, ATA_BMDEVSPEC_0) & 0x01) {
+ ata_print_cable(dev, "controller");
+ mode = ATA_UDMA2;
+ }
+ /* Nothing to do to setup mode, the controller snoop SET_FEATURE cmd. */
+ return (mode);
}
int
@@ -210,6 +214,7 @@ ata_marvell_edma_chipinit(device_t dev)
ctlr->ch_detach = ata_marvell_edma_ch_detach;
ctlr->reset = ata_marvell_edma_reset;
ctlr->setmode = ata_sata_setmode;
+ ctlr->getrev = ata_sata_getrev;
ctlr->channels = ctlr->chip->cfg1;
/* clear host controller interrupts */
@@ -281,6 +286,7 @@ ata_marvell_edma_ch_attach(device_t dev)
ch->flags |= ATA_NO_SLAVE;
ch->flags |= ATA_USE_16BIT; /* XXX SOS needed ? */
+ ch->flags |= ATA_SATA;
ata_generic_hw(dev);
ch->hw.begin_transaction = ata_marvell_edma_begin_transaction;
ch->hw.end_transaction = ata_marvell_edma_end_transaction;
@@ -601,8 +607,6 @@ ata_marvell_edma_dmainit(device_t dev)
/* chip does not reliably do 64K DMA transfers */
if (ctlr->chip->cfg2 == MV_50XX || ctlr->chip->cfg2 == MV_60XX)
ch->dma.max_iosize = 64 * DEV_BSIZE;
- else
- ch->dma.max_iosize = (ATA_DMA_ENTRIES - 1) * PAGE_SIZE;
}
ATA_DECLARE_DRIVER(ata_marvell);
OpenPOWER on IntegriCloud