Skip to content

Commit

Permalink
ata: pata_hpt37x: fix PCI clock detection
Browse files Browse the repository at this point in the history
[ Upstream commit 5f6b0f2 ]

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: Sergey Shtylyov <s.shtylyov@omp.ru>
Fixes: 669a5db ("[libata] Add a bunch of PATA drivers.")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Sergey Shtylyov authored and gregkh committed Mar 8, 2022
1 parent 335f11f commit 67e25eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/ata/pata_hpt37x.c
Expand Up @@ -962,14 +962,14 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)

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

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

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

0 comments on commit 67e25eb

Please sign in to comment.