Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e28372b2 authored by Sergey Shtylyov's avatar Sergey Shtylyov Committed by Greg Kroah-Hartman
Browse files

ata: pata_hpt37x: fix PCI clock detection



[ Upstream commit 5f6b0f2d037c8864f20ff15311c695f65eb09db5 ]

The f_CNT register (at the PCI config. address 0x78) is 16-bit, not
8-bit! The bug was there from the very start... :-(

Signed-off-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
Fixes: 669a5db4 ("[libata] Add a bunch of PATA drivers.")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 58b419d1
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -962,14 +962,14 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)


	if ((freq >> 12) != 0xABCDE) {
	if ((freq >> 12) != 0xABCDE) {
		int i;
		int i;
		u8 sr;
		u16 sr;
		u32 total = 0;
		u32 total = 0;


		pr_warn("BIOS has not set timing clocks\n");
		pr_warn("BIOS has not set timing clocks\n");


		/* This is the process the HPT371 BIOS is reported to use */
		/* This is the process the HPT371 BIOS is reported to use */
		for (i = 0; i < 128; i++) {
		for (i = 0; i < 128; i++) {
			pci_read_config_byte(dev, 0x78, &sr);
			pci_read_config_word(dev, 0x78, &sr);
			total += sr & 0x1FF;
			total += sr & 0x1FF;
			udelay(15);
			udelay(15);
		}
		}