From patchwork Fri Apr 5 05:57:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rashmica Gupta X-Patchwork-Id: 1078049 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44b8HB2HQ4z9sPc for ; Fri, 5 Apr 2019 16:57:42 +1100 (AEDT) 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="G6gbyVCv"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44b8HB00jZzDqQy for ; Fri, 5 Apr 2019 16:57:42 +1100 (AEDT) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::641; helo=mail-pl1-x641.google.com; envelope-from=rashmica.g@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="G6gbyVCv"; dkim-atps=neutral Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44b8Gz6FKCzDqQV for ; Fri, 5 Apr 2019 16:57:31 +1100 (AEDT) Received: by mail-pl1-x641.google.com with SMTP id w24so2446876plp.2 for ; Thu, 04 Apr 2019 22:57:31 -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; bh=VVtQlSB9vRwcK+7TVZuaSzDKBe5gkWZ7/78GVWkUAPk=; b=G6gbyVCvKV5iM7ojSzeB5sR8GO0x+0UNyTTDoXlU8OcycNk3BYiw3iyJNclqEAxWBC rtzYUBihJKlHC2l2+gd5snd2vBX4Q4fkpUT0VbB57HjAHFLQ5FIEYefuuMJWsP5VMRVw ixvr3NyjG26woKygS8cyMTBSTRPf3VHzzVUGp0J8fYOgpK9aoT4xANw7EazbiMl5qlAa jGb/m1B+tlVLhlM4G9NGEmufL5D1ft9GxPS9jZNTDz4n1w7WrULQhM9Y42TJxXY3IWvq CLz0xu4fVvxTB5RVUfmRpyNKdNNqZgXV38oOZYcPIiM4gPtkkkUAgtB9OLF/tyPa6Su5 aRSQ== 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; bh=VVtQlSB9vRwcK+7TVZuaSzDKBe5gkWZ7/78GVWkUAPk=; b=Q/A8lBJRPNt1YKN4PVQ4L3qAmfkb2CMLGNmeKU+FtUs6Z+CFtO6Uxf2ErlnujLfN52 xJeLn5nx9xrjSUXDG/VJWEn2P3M90prdvwiEqNtE0OTwcvYitAzGf5efN8ZMEq7x45hC FQLPGkeY7XY2mTUlls53iXfSCCYiAFUvuFG7SbcNtZA79d2c5iWxENTilU6J9ZXpjslR WP0l3kjsGl9n5ppKfVr4NVhwyIiO1suohKwIKm9UMp+H911OIEUjDdjCt9eMpfvIbiwS TAri8913BejQYLyBWKGr5coTZd46TWi2AzbkVobKGW4ifzJcfvd3RvUfVbxl1JVJ8XGm HLtg== X-Gm-Message-State: APjAAAXTukzqfBKjjiGMApd/0oXjx6v3/G/5M0UTkok/UNnTGmRrNa5K um/ow16iXpcEkOGTh20jJWyF7X4u X-Google-Smtp-Source: APXvYqwRa+T9ZnmGF+xg2rhClAwW+Fz4af1LLzPKGRsZepZWKGXwaSccDrfNni08TpZ0SM7lsDreBw== X-Received: by 2002:a17:902:12f:: with SMTP id 44mr10884313plb.208.1554443848153; Thu, 04 Apr 2019 22:57:28 -0700 (PDT) Received: from rashmica.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id y15sm10810074pfo.22.2019.04.04.22.57.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Apr 2019 22:57:27 -0700 (PDT) From: Rashmica Gupta To: pdbg@lists.ozlabs.org, alistair@popple.id.au, joel@jms.id.au Date: Fri, 5 Apr 2019 16:57:14 +1100 Message-Id: <20190405055717.6424-1-rashmica.g@gmail.com> X-Mailer: git-send-email 2.17.2 Subject: [Pdbg] [RFC PATCH 0/3] Read i2c devices X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" This is still hacky and gross, but would be good to get some feedback so we can get this in pdbg sooner rather than later. The hack in libpdbg/kernel.c in patch 2 in particular needs some work. The i2c reset function doesn't work as well as I would like... Sometimes if you try to read from devices that don't exist, you can no longer read from devices that do exist - using the reset func in skiboot (by doing i2ctransfer from i2ctools on the host or a reboot) or resetting the lbus (./pdbg -P fsi0 -D4 putcfam 0x80d 0x20000000) sometimes but not always fixes things. eg reading from EEPROM0 via a PIB I2C master (host): sudo ./pdbg -P i2cm@a1000 geti2c 0 0x50 10 8 eg reading from EEPROM0 via the CFAM I2C master (bmc): ./pdbg -P i2cm geti2c 0 0x50 10 8 Rashmica Gupta (3): enable libpdbg to use i2ctools lib add i2cm from bmc add i2c get for host Makefile.am | 7 + configure.ac | 5 + libpdbg/i2cm.c | 552 ++++++++++++++++++++++++++++++++++++++++++++++ libpdbg/i2cm.h | 123 +++++++++++ libpdbg/kernel.c | 8 +- libpdbg/libpdbg.h | 3 + libpdbg/target.c | 11 + libpdbg/target.h | 9 + p9-fsi.dtsi.m4 | 7 + p9-host.dts.m4 | 28 +++ p9-i2c.dts.m4 | 21 ++ p9-kernel.dts.m4 | 8 + src/i2c.c | 44 ++++ src/main.c | 5 +- 14 files changed, 828 insertions(+), 3 deletions(-) create mode 100644 libpdbg/i2cm.c create mode 100644 libpdbg/i2cm.h create mode 100644 p9-i2c.dts.m4 create mode 100644 src/i2c.c