Skip to content

Commit 163543a

Browse files
chenhuacaijfvogel
authored andcommitted
ahci: Marvell 88SE9215 controllers prefer DMA for ATAPI
[ Upstream commit 0507c777f5d8f9e34b137d28ee263599a7b81242 ] We use CD/DVD drives under Marvell 88SE9215 SATA controller on many Loongson-based machines. We found its PIO doesn't work well, and on the opposite its DMA seems work very well. We don't know the detail of the 88SE9215 SATA controller, but we have tested different CD/DVD drives and they all have problems under 88SE9215 (but they all work well under an Intel SATA controller). So, we consider this problem is bound to 88SE9215 SATA controller rather than bound to CD/DVD drives. As a solution, we define a new dedicated AHCI board id which is named board_ahci_yes_fbs_atapi_dma for 88SE9215, and for this id we set the AHCI_HFLAG_ATAPI_DMA_QUIRK and ATA_QUIRK_ATAPI_MOD16_DMA flags on the SATA controller in order to prefer ATAPI DMA. Reported-by: Yuli Wang <[email protected]> Tested-by: Jie Fan <[email protected]> Tested-by: Erpeng Xu <[email protected]> Tested-by: Yuli Wang <[email protected]> Signed-off-by: Huacai Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Niklas Cassel <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit 0519ba030c3e993007ed4e641ad10a0e13589b7a) Signed-off-by: Jack Vogel <[email protected]>
1 parent 164f6cb commit 163543a

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

drivers/ata/ahci.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ enum board_ids {
6363
board_ahci_pcs_quirk_no_devslp,
6464
board_ahci_pcs_quirk_no_sntf,
6565
board_ahci_yes_fbs,
66+
board_ahci_yes_fbs_atapi_dma,
6667

6768
/* board IDs for specific chipsets in alphabetical order */
6869
board_ahci_al,
@@ -188,6 +189,14 @@ static const struct ata_port_info ahci_port_info[] = {
188189
.udma_mask = ATA_UDMA6,
189190
.port_ops = &ahci_ops,
190191
},
192+
[board_ahci_yes_fbs_atapi_dma] = {
193+
AHCI_HFLAGS (AHCI_HFLAG_YES_FBS |
194+
AHCI_HFLAG_ATAPI_DMA_QUIRK),
195+
.flags = AHCI_FLAG_COMMON,
196+
.pio_mask = ATA_PIO4,
197+
.udma_mask = ATA_UDMA6,
198+
.port_ops = &ahci_ops,
199+
},
191200
/* by chipsets */
192201
[board_ahci_al] = {
193202
AHCI_HFLAGS (AHCI_HFLAG_NO_PMP | AHCI_HFLAG_NO_MSI),
@@ -590,7 +599,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
590599
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a3),
591600
.driver_data = board_ahci_yes_fbs },
592601
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9215),
593-
.driver_data = board_ahci_yes_fbs },
602+
.driver_data = board_ahci_yes_fbs_atapi_dma },
594603
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230),
595604
.driver_data = board_ahci_yes_fbs },
596605
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9235),

drivers/ata/ahci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ enum {
246246
AHCI_HFLAG_NO_SXS = BIT(26), /* SXS not supported */
247247
AHCI_HFLAG_43BIT_ONLY = BIT(27), /* 43bit DMA addr limit */
248248
AHCI_HFLAG_INTEL_PCS_QUIRK = BIT(28), /* apply Intel PCS quirk */
249+
AHCI_HFLAG_ATAPI_DMA_QUIRK = BIT(29), /* force ATAPI to use DMA */
249250

250251
/* ap->flags bits */
251252

drivers/ata/libahci.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,10 @@ static void ahci_dev_config(struct ata_device *dev)
13211321
{
13221322
struct ahci_host_priv *hpriv = dev->link->ap->host->private_data;
13231323

1324+
if ((dev->class == ATA_DEV_ATAPI) &&
1325+
(hpriv->flags & AHCI_HFLAG_ATAPI_DMA_QUIRK))
1326+
dev->quirks |= ATA_QUIRK_ATAPI_MOD16_DMA;
1327+
13241328
if (hpriv->flags & AHCI_HFLAG_SECT255) {
13251329
dev->max_sectors = 255;
13261330
ata_dev_info(dev,

0 commit comments

Comments
 (0)