Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3303962imm; Tue, 17 Jul 2018 02:29:19 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeGx1+np7zLABGdHxHRBLfjXjgXGyiKT+c6AigCpXwG3W9z5ON8OAabj6hg19ELHlIm+qZe X-Received: by 2002:a62:8b0f:: with SMTP id j15-v6mr907772pfe.33.1531819759069; Tue, 17 Jul 2018 02:29:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531819759; cv=none; d=google.com; s=arc-20160816; b=xSCpzfccgL9Nttt5+ZZXtQHBbfjPdck9S5xbrTdLJyAbb7xgBU5+kNQS9rXtR9tDcu b2tAwClciIgx8WRpyiCKlXOzb6SZ753W7bwZ1lq8pDmK2035mlcxFP4Nz7x9sptnMMq2 g+TRO04XaqaH4YXOMt6YsLiZ6GPTi/RjmexcL7ch4RV0FErxB47bVf2pDiMUdTo+fYEr g2brkTcLikkeVDXQ6mWkk8yAExJNpykLNiLA7se8kJB1/g/26X/O43dIrnQ8T3DtWFAi MEp0IZmMZTWwhVITGDTU2xMfOYic38hU1M5IzDvHs9GDH54m7GeCDYAyHEa1NiYetfUh KUFA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=V3i6ZNvquD3Dy+hpyKRmaagHHWfHxwjiWtDmhPyBu/Y=; b=xVi4f18x5QwCiRYqpRaBqNuGZUQU77/ZYmts+oxBE21wgjySVmDEgFIThobRUwE2mU HiJpG+3xVFGozQXcCQkIM1M9fECGED6+w2xAkimA/Cpj5kSLR97aenMQ7zoJw/tj926V wok83V2tCLHDU827on/1yg2EpmrqLrOgn5AQ7acNH2QHObdYvml7CEbG7ZVUnHeVM7Xx M/PZ74k9bOvmgMrLzLAtIaUL25bT3AjOUKhsaYzSDLWOk//mVa5nbPaIcxMslktcDkkG RGgwy8OkfM5w0EUYEbgWiJgy+1nwRhWda2FJx78j2Y/MS3IcI9/iSV6NwJpUoQtVGvdZ aKHw== ARC-Authentication-Results: i=1; mx.google.com; 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 u90-v6si441808pfk.82.2018.07.17.02.29.03; Tue, 17 Jul 2018 02:29:19 -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; 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 S1730172AbeGQJ6w (ORCPT + 99 others); Tue, 17 Jul 2018 05:58:52 -0400 Received: from anchovy3.45ru.net.au ([203.30.46.155]:53020 "EHLO anchovy3.45ru.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729734AbeGQJ6v (ORCPT ); Tue, 17 Jul 2018 05:58:51 -0400 Received: (qmail 23729 invoked by uid 5089); 17 Jul 2018 09:27:09 -0000 Received: by simscan 1.2.0 ppid: 23635, pid: 23636, t: 0.0474s scanners: regex: 1.2.0 attach: 1.2.0 clamav: 0.88.3/m:40/d:1950 Received: from unknown (HELO ?192.168.0.122?) (preid@electromag.com.au@203.59.235.95) by anchovy2.45ru.net.au with ESMTPA; 17 Jul 2018 09:27:08 -0000 Subject: Re: [PATCH/RFT 1/6] i2c: designware: use open drain for recovery GPIO To: Wolfram Sang Cc: Wolfram Sang , linux-i2c@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@pengutronix.de, Jarkko Nikula , Andy Shevchenko , Mika Westerberg , linux-kernel@vger.kernel.org References: <20180713210920.3648-1-wsa+renesas@sang-engineering.com> <20180713210920.3648-2-wsa+renesas@sang-engineering.com> <20180717090920.zy6lkeqlcewhrfs5@ninjato> From: Phil Reid Message-ID: Date: Tue, 17 Jul 2018 17:27:01 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180717090920.zy6lkeqlcewhrfs5@ninjato> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-AU Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/07/2018 17:09, Wolfram Sang wrote: > Hi Phil, > >>> - gpio = devm_gpiod_get(dev->dev, "scl", GPIOD_OUT_HIGH); >>> + gpio = devm_gpiod_get(dev->dev, "scl", GPIOD_OUT_HIGH_OPEN_DRAIN); >>> if (IS_ERR(gpio)) { >>> r = PTR_ERR(gpio); >>> if (r == -ENOENT || r == -ENOSYS) >>> >> >> This was intentional. The gpio we use to drive the i2c line is implemented in an >> FPGA and signals a buffer attached to the GPIO to drive scl OPEN drain. The GPIO is output >> only. > > So, it is not possible to read SCL status then? Hmm, currently a working > get_scl is required... > >> The gpio setup can still specify the the GPIO be allocated OPEN drain if someone wishes >> to use a "smarter" gpio. >> >> So while the scl is open drain, there may be hardware in between that isn't. >> What would the correct way be to deal with that now? > > Well, I don't know much about this IP core and how/where it is used. I > just wonder what happens if another user comes along using an > open-drain GPIO. Is that possible? > > I assume it is the same with SDA? Non open-drain? Output only? > Just had a closer look at how it's setup here. Maybe the following helps. The designware core is routed thru the fpga fabric. Which provides and SCL SDA output enable pin. Recovery gpio are provided by a FPGA gpio IO core. This core has a fixed output and fixed input. Here's the relevant bit on how it's all combined. PWR_SDA_a / PWR_SCL_a are the signals to the outside world. All the other signals are internal I2c0_Dat_s <= PWR_SDA_a; I2c0_Clk_s <= PWR_SCL_a; PWR_SDA_a <= '0' when (I2c0_Dat_Oe_s = '1') else 'Z'; This bit of logic combines the i2c core and gpios. PWR_SCL_a <= '0' when ((I2c0_Clk_Oe_s = '1') or (PWR_SCL_rec_s = '0')) else 'Z'; , pio_io_in_port(1) => PWR_SCL_a , pio_io_in_port(2) => PWR_SDA_a , pio_io_out_port(1) => PWR_SCL_rec_s pio_io_out_port port is the fixed config for output pio_io_in_port is the fixed config for input The gpio input / outputs exist in the same ip core. PWR_SCL_rec_s is the recovery clock gpio signal. It needs to be driven high / low. There's no concept of HiZ internally in the FPGA. If there was some kinda of OpenDrain gpio driver that modelled a FET driven by a push pull GPIO I guess it could be made to work. -- Regards Phil Reid