Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1776289pxp; Mon, 7 Mar 2022 02:03:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyGhiRosrGfoyQmftTo0WhMlw3vwVWfERWU9v3g92cxCTbPx4XfOJgtV9JNd/tKfu2pPqk4 X-Received: by 2002:a17:907:6e07:b0:6da:9722:8796 with SMTP id sd7-20020a1709076e0700b006da97228796mr8093188ejc.610.1646647412692; Mon, 07 Mar 2022 02:03:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646647412; cv=none; d=google.com; s=arc-20160816; b=0l/0/LuX/qRjhQqi/N3nWO171WLvj2k6MLRh8KepkDa0XFPfaNWfd3AUiBzMfxFQkw wGMV08hsy1qyzvNT6OqyxiD/jgmiMGxh16TKJk5NGiOpoR+8y7eU1lN0RS+N/e3Zeh5P EsVAoonQQGl+Dp3L11yd75NrG5s4eFTV57K8zCXIDGsP0iwrzqMvMqwCwcBbD6/fdwVs NSp42Bkegbl0TUZL+Ddd6NDcVWe3hvxNC8GTPQUAQrp81WeOSNQdwOcjVXeKIPQB1Dc1 BUwGd3Qd4py/k+O3g3f8+OPWGrj42wZrFCfmUVdMpjdmGdreuiKssM9KJUg9eqbvzJgM hiqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8RFQJVHVI6j0mKOhMxnKkfmKNENLNYNaTXJN7oiNK2M=; b=U1+b6n3Odwkzym+5pJm2uz83cyOf0el7g1TbVUrG7O1YwsIpH3h/iQi7wOXZipsGKQ etKJ5YJGHyAA/I/uTkFfeJRkkA9hBxOXDBmw7JtJlA2Ci7w5Pu+V5mTItJnbCjzRtzPx hr3yS/p7rSYIiNuQxZkZ5dXu6axozMpC/J0u8QtgdLLiP38VXgnAwTjHpmUNbED4TqbB 5PnHPEWIsMg65eTpC06kcXHfRd/HzVobvpbzhCdkFW31J0UHJFcrrbYcW1OwlNr1p8No JERCCVjP67Xa5dKu3Gx0LLzVA30iapcgIKTp32TkWr2Y/BSsEvKctpniVfvwYDQXVf9e B1qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m+t2ldCZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb26-20020a1709076d9a00b006d712d5f42dsi9506280ejc.739.2022.03.07.02.03.10; Mon, 07 Mar 2022 02:03:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m+t2ldCZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231676AbiCGJ0Z (ORCPT + 99 others); Mon, 7 Mar 2022 04:26:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236951AbiCGJXP (ORCPT ); Mon, 7 Mar 2022 04:23:15 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 043CA65D3D; Mon, 7 Mar 2022 01:21:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7E0F1610A3; Mon, 7 Mar 2022 09:21:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79A42C340F3; Mon, 7 Mar 2022 09:21:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644888; bh=8r8xQxUYIAElm/cXRBDz/i3qLnpZQ+9y3zYzdXn6jMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m+t2ldCZwxVAAz3L2s1S6mqsPqmbXt7yYS5/WaYiNAt5Fqony5Yi6PvC5tNfqejQd XtkiutdvoVSGdUGwfadydAKAjzY2SHiZd0Ioa1YDI7zqaSqljmfyeLUB5UAFFNgWs9 z48g9c5P1d+8xWE6ONbjTxACDjr7X6x8erHiyt74= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Damien Le Moal , Sasha Levin Subject: [PATCH 4.14 12/42] ata: pata_hpt37x: fix PCI clock detection Date: Mon, 7 Mar 2022 10:18:46 +0100 Message-Id: <20220307091636.507674209@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091636.146155347@linuxfoundation.org> References: <20220307091636.146155347@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergey Shtylyov [ 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: Sergey Shtylyov Fixes: 669a5db411d8 ("[libata] Add a bunch of PATA drivers.") Cc: stable@vger.kernel.org Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin --- drivers/ata/pata_hpt37x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c index 821fc1f2324c8..44cc02afaa8bd 100644 --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c @@ -964,14 +964,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); } -- 2.34.1