From patchwork Mon Sep 24 07:14:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 973846 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42Jb7J16mNz9s9N for ; Mon, 24 Sep 2018 17:14:52 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nVnagXuU"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42Jb7H6RB5zF3G9 for ; Mon, 24 Sep 2018 17:14:51 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nVnagXuU"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::644; helo=mail-pl1-x644.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nVnagXuU"; dkim-atps=neutral Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42Jb6s5QGpzDqjx for ; Mon, 24 Sep 2018 17:14:29 +1000 (AEST) Received: by mail-pl1-x644.google.com with SMTP id b12-v6so8712596plr.8 for ; Mon, 24 Sep 2018 00:14:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GxtUfaNyW1S2qdkgZfKW1oJJ6LmetoTRWxRbETyGF4Q=; b=nVnagXuUztOFiZ/T3iFJXbqTPqOCgoIt5NE6BPZoVU4Vs2Wmg95TrUXIFPh6D8jbCR yk03z66vLKI+oNI/5hcGTLzQvke6mtf8+R7ilMX5utK/WZxxf7yZNg27DybVXWhqZnr/ 0RDd+AYRcs1lJUA1s4Ov6AwMtX9XWR6wrqtALSiPKYlZTYxQdirIEj6MVmbTNIvhFVNc N2nC5BuQ7AWtAsjKbqKRbx02BNw28ytEWoEIVrbMVL0ZqOMfdzHGS1cc9ZdPCp1sC3kA R3LtFjGwTE19S8e9rSMABZHzUnbgfSkmspn9PMd6TjgcLor2CWxO862+qJYlQqFCNS2p diaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GxtUfaNyW1S2qdkgZfKW1oJJ6LmetoTRWxRbETyGF4Q=; b=POSie5hLgNm8nzB/HIX4LCcfGPEIuqCMGkyo12ifSJ6KQrcpKeOHk1FrYecc2Z+Jlv Nf7GEpFQM6izArWy5TV6RKTDr8sgEEDJaatk1YxiSjZ31K++bZlhgUqLSN6dTydwPvqd PSKFpkDnCVZIyKsraaB6I68XnuBm0vI1x1e5PDw7sTNtfuj59d8tQyhnEiFyXRpjqGJk YsCqF+BtOhFWdFGIjKg/XwLXDg/turBxMiBd8NZ4rV1vC30wS5rc8kp5HGVpLNP9JUmT O8s6tUK/W+KguDYrjoHg0Vh3omVcT/1lUh0P9sTRsaI3nOOUrYfidFgocdM8lgCUvB3I X2nA== X-Gm-Message-State: ABuFfog2/FjaQTUgSbBb1boivvwQsuNQ9kCghkCw0lVGImCkhKWcTueN RA93ZGvTUoiRzMtcCajhQ4DqNvTY X-Google-Smtp-Source: ACcGV60FTcnhyPzK4FKkEKzJCCyREU28LQEFjyN/eOQM17BZLk3UCZgfxg37sCv6xzWKD5Ddv4DlCA== X-Received: by 2002:a17:902:162:: with SMTP id 89-v6mr9188077plb.91.1537773267514; Mon, 24 Sep 2018 00:14:27 -0700 (PDT) Received: from flat-canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id f15-v6sm4083662pgv.66.2018.09.24.00.14.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Sep 2018 00:14:27 -0700 (PDT) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Mon, 24 Sep 2018 17:14:08 +1000 Message-Id: <20180924071408.11897-2-oohall@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180924071408.11897-1-oohall@gmail.com> References: <20180924071408.11897-1-oohall@gmail.com> Subject: [Skiboot] [PATCH 2/2] hdata/i2c: Make SPD workaround more workaroundy X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" We have a hack in the I2C device parser to fix up entries generated by hostboot for the DIMM SPD devices. For some reason they get reported as 128Kbit EEPROMs which is bad since those have a different I2C interface to an actual SPD device. Oddly enough, the FSP also gets this wrong in a slightly different way. In the FSP case they are reported as a at24c04 (4Kbit) EEPROM, which also has a different I2C interface. To fix both these problems for any eeprom we find on that bus to have the compatible string of "spd". Signed-off-by: Oliver O'Halloran Reviewed-by: Vasant Hegde --- hdata/i2c.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hdata/i2c.c b/hdata/i2c.c index 5a6d8506c4e4..c129d5e5ce93 100644 --- a/hdata/i2c.c +++ b/hdata/i2c.c @@ -298,10 +298,15 @@ int parse_i2c_devs(const struct HDIF_common_hdr *hdr, int idata_index, * driver will send 2 bytes when doing a random read, * potentially overwriting part of the SPD information. * - * To work around this we force the compat string to "spd" + * Just to make things interested the FSP also gets the device + * type wrong. To work around both just set the device-type to + * "spd" for anything in the 0x50 to 0x57 range since that's the + * SPD eeprom range. + * + * XXX: Future chips might not use engine 3 for the DIMM buses. */ - if (proc_gen == proc_gen_p9 && dev->type == 0x2 && - dev->i2cm_engine == 3) { + if (dev->i2cm_engine == 3 && dev_addr >= 0x50 + && dev_addr < 0x58) { compat = "spd"; name = "eeprom"; } else if (type) {