android_kernel_xiaomi_sm7250/drivers/ata
Mikael Pettersson 78c4af0b43 pata_pdc2027x: PLL detection fixes
Previously I reported that the pata_pdc2027x PLL detection changes
in kernel 2.6.22 broke the driver on my PowerMac:

>pata_pdc2027x: Invalid PLL input clock 1691742kHz, give up!

This is followed by a number of errors and speed reduction
steps on the affected ports.

There are two bugs in pata_pdc2027x's PLL detection code:

1. The PLL counter's start value is read before the chip is
   put in "test mode". Outside of test mode the counter is
   halted, and on the PowerMac the counter is zero because
   the chip hasn't been initialised by its BIOS.

   The fix is to move the read of the start value to after
   test mode is started, but before the mdelay() in test mode.
   This also improves the precision of the PLL detection.

2. The code to compute the number of PLL decrements during the
   mdelay() in test mode fails to consider that the PLL counter
   only is 30 bits wide. If there is a wraparound, it will compute
   an incorrect and much too large value. On the PowerMac, the
   start count is zero, the end count is a large 30-bit value, so
   wraparound occurs and an out of bounds PLL clock is detected.

   The fix is to mask the (start - end) computation to 30 bits.

While debugging this I also noticed that pdc_read_counter()
reads the two halves of the 30-bit PLL counter as 16-bit values,
and then combines them as if the halves only are 15 bits wide.
To avoid confusion, the halves should be read as 15-bit values.

This patch implements all three changes. It fixes the PLL detection
failure on my PowerMac, and doesn't cause any regressions on an x86
with an identical card.

Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-08-23 05:32:07 -04:00
..
ahci.c The SATA controller device ID is different according to 2007-07-20 08:07:46 -04:00
ata_generic.c [libata] Use ATA_UDMAx standard masks when filling driver's udma_mask info 2007-07-09 12:17:35 -04:00
ata_piix.c ata_piix: add TECRA M7 to broken suspend list 2007-08-15 04:20:14 -04:00
Kconfig pata_hpt3x3: major reworking and testing 2007-07-10 21:30:33 -04:00
libata-acpi.c libata-acpi: implement _GTM/_STM support 2007-07-09 12:17:32 -04:00
libata-core.c libata: fix n_sectors failure handling during revalidation 2007-08-23 05:23:14 -04:00
libata-eh.c libata: implement EH fast drain 2007-07-20 08:26:26 -04:00
libata-scsi.c [BLOCK] Get rid of request_queue_t typedef 2007-07-24 09:28:11 +02:00
libata-sff.c libata-sff; Unbreak non DMA capable controllers again 2007-08-01 10:00:56 -04:00
libata.h libata: implement EH fast drain 2007-07-20 08:26:26 -04:00
Makefile libata-acpi: s/CONFIG_SATA_ACPI/CONFIG_ATA_ACPI/ 2007-05-11 18:12:42 -04:00
pata_ali.c pata_ali: Correct HP detect 2007-07-24 16:55:01 -04:00
pata_amd.c PCI: Change all drivers to use pci_device->revision 2007-07-11 16:02:10 -07:00
pata_artop.c pata_artop: fix UDMA5 for AEC6280[R] and UDMA6 for AEC6880[R] 2007-08-15 04:17:14 -04:00
pata_atiixp.c [libata] PATA drivers: remove ATA_FLAG_SRST 2007-07-09 12:17:32 -04:00
pata_cmd64x.c pata_cmd64x: Correct the speed ranges 2007-08-01 10:00:56 -04:00
pata_cmd640.c [libata] PATA drivers: remove ATA_FLAG_SRST 2007-07-09 12:17:32 -04:00
pata_cs5520.c pata_cs5520: Fix probe bug regression introduced in 2.6.22 2007-07-20 09:08:44 -07:00
pata_cs5530.c PCI: add pci_try_set_mwi 2007-07-11 16:02:11 -07:00
pata_cs5535.c [libata] Use ATA_UDMAx standard masks when filling driver's udma_mask info 2007-07-09 12:17:35 -04:00
pata_cypress.c [libata] PATA drivers: remove ATA_FLAG_SRST 2007-07-09 12:17:32 -04:00
pata_efar.c [libata] PATA drivers: remove ATA_FLAG_SRST 2007-07-09 12:17:32 -04:00
pata_hpt3x2n.c pata_hpt{37x|3x2n}: fix clock reporting (take 2) 2007-08-15 04:19:07 -04:00
pata_hpt3x3.c pata_hpt3x3: fix DMA Kconfig option to actually have a hope of working 2007-07-10 21:36:13 -04:00
pata_hpt37x.c pata_hpt{37x|3x2n}: fix clock reporting (take 2) 2007-08-15 04:19:07 -04:00
pata_hpt366.c [libata] Use ATA_UDMAx standard masks when filling driver's udma_mask info 2007-07-09 12:17:35 -04:00
pata_icside.c [ARM] pata_icside: fix the FIXMEs 2007-08-06 16:10:54 +01:00
pata_isapnp.c [libata] pata_isapnp: replace missing module device table 2007-08-15 02:53:38 -04:00
pata_it821x.c PCI: Change all drivers to use pci_device->revision 2007-07-11 16:02:10 -07:00
pata_it8213.c [libata] Use ATA_UDMAx standard masks when filling driver's udma_mask info 2007-07-09 12:17:35 -04:00
pata_ixp4xx_cf.c [libata] pata_ixp4xx: kill unused var 2007-07-09 12:17:34 -04:00
pata_jmicron.c [libata] Use ATA_UDMAx standard masks when filling driver's udma_mask info 2007-07-09 12:17:35 -04:00
pata_legacy.c libata: bump versions 2007-05-21 20:26:38 -04:00
pata_marvell.c [libata] Use ATA_UDMAx standard masks when filling driver's udma_mask info 2007-07-09 12:17:35 -04:00
pata_mpc52xx.c pata_mpc52xx: suspend/resume support 2007-07-10 21:14:20 -04:00
pata_mpiix.c libata: reimplement suspend/resume support using sdev->manage_start_stop 2007-05-11 18:01:03 -04:00
pata_netcell.c [libata] Use ATA_UDMAx standard masks when filling driver's udma_mask info 2007-07-09 12:17:35 -04:00
pata_ns87410.c [libata] PATA drivers: remove ATA_FLAG_SRST 2007-07-09 12:17:32 -04:00
pata_oldpiix.c [libata] PATA drivers: remove ATA_FLAG_SRST 2007-07-09 12:17:32 -04:00
pata_opti.c [libata] PATA drivers: remove ATA_FLAG_SRST 2007-07-09 12:17:32 -04:00
pata_optidma.c [libata] PATA drivers: remove ATA_FLAG_SRST 2007-07-09 12:17:32 -04:00
pata_pcmcia.c PCMCIA: Add another MemoryCard to ide-cs/pata_pcmcia 2007-07-20 01:11:53 +02:00
pata_pdc202xx_old.c [libata] PATA drivers: remove ATA_FLAG_SRST 2007-07-09 12:17:32 -04:00
pata_pdc2027x.c pata_pdc2027x: PLL detection fixes 2007-08-23 05:32:07 -04:00
pata_platform.c pata_platform: Fix NULL pointer dereference 2007-07-20 07:16:24 -04:00
pata_qdi.c libata: bump versions 2007-05-21 20:26:38 -04:00
pata_radisys.c [libata] PATA drivers: remove ATA_FLAG_SRST 2007-07-09 12:17:32 -04:00
pata_rz1000.c [libata] PATA drivers: remove ATA_FLAG_SRST 2007-07-09 12:17:32 -04:00
pata_sc1200.c libata: Support chips with 64K PRD quirk 2007-07-09 12:17:35 -04:00
pata_scc.c [libata] Fix reported task file values in sense data 2007-07-20 07:44:44 -04:00
pata_serverworks.c PCI: Change all drivers to use pci_device->revision 2007-07-11 16:02:10 -07:00
pata_sil680.c [libata] Use ATA_UDMAx standard masks when filling driver's udma_mask info 2007-07-09 12:17:35 -04:00
pata_sis.c pata_sis: fix MWDMA for <= UDMA66 chipsets and UDMA for UDMA33 chipsets 2007-08-01 10:00:56 -04:00
pata_sl82c105.c PCI: Change all drivers to use pci_device->revision 2007-07-11 16:02:10 -07:00
pata_triflex.c [libata] PATA drivers: remove ATA_FLAG_SRST 2007-07-09 12:17:32 -04:00
pata_via.c PCI: Change all drivers to use pci_device->revision 2007-07-11 16:02:10 -07:00
pata_winbond.c libata: bump versions 2007-05-21 20:26:38 -04:00
pdc_adma.c [libata] Use ATA_UDMAx standard masks when filling driver's udma_mask info 2007-07-09 12:17:35 -04:00
sata_inic162x.c libata: make ->scr_read/write callbacks return error code 2007-07-20 08:02:11 -04:00
sata_mv.c sata_mv: PCI IDs for Hightpoint RocketRaid 1740/1742 2007-08-15 02:53:39 -04:00
sata_nv.c libata: make ->scr_read/write callbacks return error code 2007-07-20 08:02:11 -04:00
sata_promise.c libata: make ->scr_read/write callbacks return error code 2007-07-20 08:02:11 -04:00
sata_promise.h Move libata to drivers/ata. 2006-08-10 07:31:37 -04:00
sata_qstor.c libata: make ->scr_read/write callbacks return error code 2007-07-20 08:02:11 -04:00
sata_sil24.c libata: make ->scr_read/write callbacks return error code 2007-07-20 08:02:11 -04:00
sata_sil.c libata: make ->scr_read/write callbacks return error code 2007-07-20 08:02:11 -04:00
sata_sis.c libata: make ->scr_read/write callbacks return error code 2007-07-20 08:02:11 -04:00
sata_svw.c libata: make ->scr_read/write callbacks return error code 2007-07-20 08:02:11 -04:00
sata_sx4.c [libata] Clean up driver udma_mask initializers 2007-07-09 12:17:35 -04:00
sata_uli.c libata: make ->scr_read/write callbacks return error code 2007-07-20 08:02:11 -04:00
sata_via.c libata: make ->scr_read/write callbacks return error code 2007-07-20 08:02:11 -04:00
sata_vsc.c libata: make ->scr_read/write callbacks return error code 2007-07-20 08:02:11 -04:00
sis.h libata: PATA-mode fixes for sis_sata 2007-07-02 10:17:42 -04:00