Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1024004ybe; Wed, 4 Sep 2019 11:18:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBbnQVg6/3EfvjIfWc7RNmHu+W6vdi4LkEB5NK99wwjTBb02r2IZb6K/WXo/TfE5H+syuw X-Received: by 2002:a17:90a:f993:: with SMTP id cq19mr6457479pjb.51.1567621105481; Wed, 04 Sep 2019 11:18:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567621105; cv=none; d=google.com; s=arc-20160816; b=bU1mIWSuu3PT1ce1taPO/nOpw2kJmrJH3VE3hdLX+d4WORgUtLoAIhxnYV7nCmJgHH bnW7O9xV6TkSSCTBRJ0BcVRhdE+ybAxuAhtUxGeh/JWYDrBFzLlxFedXGmkSRrhZIVlG qt6M8ifrQTP9P9L2jakYnppbOd/ss+ptbE1FyY4UxIjgi5aI1AMSpAG4y/Pp3upGFyBK B5d5DJh7/RvpuoBOwNmobNR1LEWeiQg9y2hf4PmzlMVoZIkC9SYpBzhvgDEZgCYcCT11 spisJLJty36ZVUezjplNY+S67/LA3POX68/6pHFY6Q1OKX5yDlJx/iAbOhD1CZdfBwdF 6zbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JsGkF38+SYB5mIAQ5mLSMV96cv3db8tnzQezyP2A01E=; b=pqxCejRqs7p7Eqw28sUt62rX3aWoVAGepnJZfES9lMAMEa295ApQpKSFHsYpWPgmQV SBz1DiiatzEaWa8HNDV87LgxvSrxPeHriKo8xCaZgSBqBG0DTjeCF0n5eHettcSAYcAq C1kNGcjqkFwQZNHJr/f1UXdkf5Kq7kO2M37bDPR4cLgiPd2ZOePoxu4DNGXpwxh/D0vO JdCraDCK+Ta7xhu1G5987l2gn8Az2eK+rGL1BmwNHmlJF4gGXqVMnimiw7d1AStMbYkn 47GOTIpfhbc4z6CTNW1H0pqWMp6sK3f7by5C+12VJEAWxPmjwtIEJggeXMaXZfqmw3sI Etlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Xot1CW3T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7si2783069pjw.103.2019.09.04.11.18.09; Wed, 04 Sep 2019 11:18:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Xot1CW3T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390381AbfIDSN7 (ORCPT + 99 others); Wed, 4 Sep 2019 14:13:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:58884 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389036AbfIDSN4 (ORCPT ); Wed, 4 Sep 2019 14:13:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 54BEE22DBF; Wed, 4 Sep 2019 18:13:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620835; bh=0qnFdWszRctW5Yc3OLMs8/do88zi4L5hr+8kWol5ZO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xot1CW3TRfr9SfDvPVzGG/hO3payEFwe2TE8rRRbdewt3CO76XfhBljMWJE0KEH+V wu8UqI8iiVt93lKWIV6SjzEskBfi8CaPxwl623TNEEa1KNmgjlzX4zpubwWm5Z8EcY iPeR4ZylB0lgIVJ3uXKpv4xoQ8o1CzYl5E1fCcG4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Cooks , Jean Delvare , Wolfram Sang Subject: [PATCH 5.2 114/143] i2c: piix4: Fix port selection for AMD Family 16h Model 30h Date: Wed, 4 Sep 2019 19:54:17 +0200 Message-Id: <20190904175318.855124160@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175314.206239922@linuxfoundation.org> References: <20190904175314.206239922@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrew Cooks commit c7c06a1532f3fe106687ac82a13492c6a619ff1c upstream. Family 16h Model 30h SMBus controller needs the same port selection fix as described and fixed in commit 0fe16195f891 ("i2c: piix4: Fix SMBus port selection for AMD Family 17h chips") commit 6befa3fde65f ("i2c: piix4: Support alternative port selection register") also fixed the port selection for Hudson2, but unfortunately this is not the exact same device and the AMD naming and PCI Device IDs aren't particularly helpful here. The SMBus port selection register is common to the following Families and models, as documented in AMD's publicly available BIOS and Kernel Developer Guides: 50742 - Family 15h Model 60h-6Fh (PCI_DEVICE_ID_AMD_KERNCZ_SMBUS) 55072 - Family 15h Model 70h-7Fh (PCI_DEVICE_ID_AMD_KERNCZ_SMBUS) 52740 - Family 16h Model 30h-3Fh (PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) The Hudson2 PCI Device ID (PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) is shared between Bolton FCH and Family 16h Model 30h, but the location of the SmBus0Sel port selection bits are different: 51192 - Bolton Register Reference Guide We distinguish between Bolton and Family 16h Model 30h using the PCI Revision ID: Bolton is device 0x780b, revision 0x15 Family 16h Model 30h is device 0x780b, revision 0x1F Family 15h Model 60h and 70h are both device 0x790b, revision 0x4A. The following additional public AMD BKDG documents were checked and do not share the same port selection register: 42301 - Family 15h Model 00h-0Fh doesn't mention any 42300 - Family 15h Model 10h-1Fh doesn't mention any 49125 - Family 15h Model 30h-3Fh doesn't mention any 48751 - Family 16h Model 00h-0Fh uses the previously supported index register SB800_PIIX4_PORT_IDX_ALT at 0x2e Signed-off-by: Andrew Cooks Signed-off-by: Jean Delvare Cc: stable@vger.kernel.org [v4.6+] Signed-off-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-piix4.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c @@ -91,7 +91,7 @@ #define SB800_PIIX4_PORT_IDX_MASK 0x06 #define SB800_PIIX4_PORT_IDX_SHIFT 1 -/* On kerncz, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */ +/* On kerncz and Hudson2, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */ #define SB800_PIIX4_PORT_IDX_KERNCZ 0x02 #define SB800_PIIX4_PORT_IDX_MASK_KERNCZ 0x18 #define SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ 3 @@ -358,18 +358,16 @@ static int piix4_setup_sb800(struct pci_ /* Find which register is used for port selection */ if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD || PIIX4_dev->vendor == PCI_VENDOR_ID_HYGON) { - switch (PIIX4_dev->device) { - case PCI_DEVICE_ID_AMD_KERNCZ_SMBUS: + if (PIIX4_dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS || + (PIIX4_dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS && + PIIX4_dev->revision >= 0x1F)) { piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_KERNCZ; piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK_KERNCZ; piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ; - break; - case PCI_DEVICE_ID_AMD_HUDSON2_SMBUS: - default: + } else { piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_ALT; piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK; piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT; - break; } } else { if (!request_muxed_region(SB800_PIIX4_SMB_IDX, 2,