Commit 803f9fb8 authored by Richard Zhu's avatar Richard Zhu Committed by Niklas Cassel
Browse files

ata: ahci_imx: Enlarge RX water mark for i.MX8QM SATA



The RXWM(RxWaterMark) sets the minimum number of free location within
the RX FIFO before the watermark is exceeded which in turn will cause
the Transport Layer to instruct the Link Layer to transmit HOLDS to the
transmitting end.

Based on the default RXWM value 0x20, RX FIFO overflow might be observed
on i.MX8QM MEK board, when some Gen3 SATA disks are used.

The FIFO overflow will result in CRC error, internal error and protocol
error, then the SATA link is not stable anymore.

To fix this issue, enlarge RX water mark setting from 0x20 to 0x29.

Signed-off-by: default avatarRichard Zhu <hongxing.zhu@nxp.com>
Link: https://lore.kernel.org/r/1723428055-27021-5-git-send-email-hongxing.zhu@nxp.com


Signed-off-by: default avatarNiklas Cassel <cassel@kernel.org>
parent 3156e1b2
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -45,6 +45,10 @@ enum {
	/* Clock Reset Register */
	IMX_CLOCK_RESET				= 0x7f3f,
	IMX_CLOCK_RESET_RESET			= 1 << 0,
	/* IMX8QM SATA specific control registers */
	IMX8QM_SATA_AHCI_PTC			= 0xc8,
	IMX8QM_SATA_AHCI_PTC_RXWM_MASK		= GENMASK(6, 0),
	IMX8QM_SATA_AHCI_PTC_RXWM		= 0x29,
};

enum ahci_imx_type {
@@ -466,6 +470,12 @@ static int imx8_sata_enable(struct ahci_host_priv *hpriv)
	phy_power_off(imxpriv->cali_phy0);
	phy_exit(imxpriv->cali_phy0);

	/* RxWaterMark setting */
	val = readl(hpriv->mmio + IMX8QM_SATA_AHCI_PTC);
	val &= ~IMX8QM_SATA_AHCI_PTC_RXWM_MASK;
	val |= IMX8QM_SATA_AHCI_PTC_RXWM;
	writel(val, hpriv->mmio + IMX8QM_SATA_AHCI_PTC);

	return 0;

err_sata_phy_exit: