From: Egor Starkov Date: Mon, 13 Nov 2017 10:31:01 +0000 (+0000) Subject: ahci: imx: Handle increased read failures for IMX53 temperature sensor in low frequen... X-Git-Tag: microblaze-4.16-rc1~346^2 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=5bca462d2d18b1c9ec86c7985753134f06fa5cd2;p=linux-2.6-microblaze.git ahci: imx: Handle increased read failures for IMX53 temperature sensor in low frequency mode. Extended testing has shown that the imx ahci driver sometimes requires more than the 100 attempts currently alotted in the driver to perform a successful temperature reading when running at minimum (throttled) CPU frequency. Debugging suggests that the read cycle can take 160 attempts (which given that the driver averages 80 readings from the ADC equates to one failure on each read). Increase the attempt limit to 200 in order to greatly reduce the likelihood of the driver failing to perform a temperature reading, especially at low CPU frequency. Signed-off-by: Egor Starkov Signed-off-by: Martyn Welch Signed-off-by: Tejun Heo --- diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index 787567e840bd..a58bcc069c54 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c @@ -230,7 +230,7 @@ static int read_adc_sum(void *dev, u16 rtune_ctl_reg, void __iomem * mmio) { u16 adc_out_reg, read_sum; u32 index, read_attempt; - const u32 attempt_limit = 100; + const u32 attempt_limit = 200; imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_RTUNE_CTL, mmio); imx_phy_reg_write(rtune_ctl_reg, mmio);