From patchwork Thu Sep 5 07:52:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11132341 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CBFF815E9 for ; Thu, 5 Sep 2019 07:52:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A8F8D2082E for ; Thu, 5 Sep 2019 07:52:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mks+sh9i"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="P3M2iaYy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A8F8D2082E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=UdY/xXiOm9DV4V/Ohq4dY5faQksoNFnaXlLpvPgiG+U=; b=mks +sh9i/pXCKMnwPytzWP+KgxYpPsrtqs1rmmALZY1/zvymglmFiJuDPS86DhDbyI4Gl3+AUnuIZFJE YTtWyOBZi8CF5jJOJVomd20CBwlvPi3uPbRgMClDpk3YKXU0GaJTuIXUdXjr9ZXbrrGTf3iPrXWRU Q3vWey0yr3G50vazT476dzawXCilHIa5VHhtbAMOYMMpZN9xHmAhWoVgqGthsTfK0qXBbO0c43rCl e1v5Wb1TS3J4sdz8IFyasCMRlB8dQcLrtS+Swrf+Lbb/AJtvRPcV4hofNVULVE8Z1CfQY2k08WYU4 9IBrVoxT/2POivwTro9TFyBfNkBceew==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i5mZ3-0005L3-2X; Thu, 05 Sep 2019 07:52:21 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i5mZ0-0005KT-Gi for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2019 07:52:19 +0000 Received: by mail-wm1-x342.google.com with SMTP id r17so4319333wme.0 for ; Thu, 05 Sep 2019 00:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=8QTtt8+sGnSqf2GZqqr6eKF9qx6336YqhCVxZTe4hN4=; b=P3M2iaYypKmONmySetZUFaEg2hS2Zw4ANUaBhR6r5Ydm74kgAH+IhORp1ZlSO3+SvG bPCT3dkX2yVgIb96qqnsLFsYvscdlxnkL5q7N2vsbXFwuzu0KFsjgL2cm4cVMQIVCiHg E3HyFv/qZeAvK2dR5fvXAwdJ6ohLBAUxXUlpSrnwZygHBjnfzUXN7K/XTGA3fFhhPMLp aef7z4TL+zPCwYLGdxAx8P883nSG9rZIhxXDy0ApUIjVYUWVdz2yX3BC0F3ldwajVhor yFM9sHNlHvSqgAqu2mpD6gLSQXdhjL2FV5gmXWXcKoqfAWr8dBPfgBb+lndVXZwEXGIy zv9g== 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=8QTtt8+sGnSqf2GZqqr6eKF9qx6336YqhCVxZTe4hN4=; b=ckXMvSMHW9tZWwro63sbEO6VsY9Ix48Os7P05ILLEAMIRokqTfUBbeaFJrBiWOuU1Z 94Tl8CZyi5OFbpIjbOAGwzTJpL7fEsYNmEv73CpsSNg4aKKU+sj1wGv49vWrIzSHAmCl DJKYSPMKK2D3iCE6Hbv6Jahfgrux8xdgw8QLbWHeq5O0vz/JZJ+S3cBIKrSMYpQWm4e9 Ps1NbM0HgZzN3NCGcRo08zat3Oe13oA21OygudO3vA4S76C6bWxewm2mOBwgkveTPE8F FMI2kMR/8FHKW9YDNZ+zDba3YSgNFeNWlYFDsAM2ydoMS0DQKMdYqf6IrtCktUe4GDBM v89A== X-Gm-Message-State: APjAAAW6Yn5+5a5ijycn4rAxbDRJtMTL+PYiscyd2oCwpANwKObdx1iX wpMtp9hb+NyW6EnK07rRgynuxA== X-Google-Smtp-Source: APXvYqwzQVlp8PCbFWrdVBA5xmrr3ZHShk2IdYXuGYRwilcld1G0FXOEOyA9G0LVuEDXC8E5xXtsSg== X-Received: by 2002:a1c:7919:: with SMTP id l25mr1454666wme.23.1567669937202; Thu, 05 Sep 2019 00:52:17 -0700 (PDT) Received: from localhost.localdomain ([95.147.198.36]) by smtp.gmail.com with ESMTPSA id a13sm3418784wrf.73.2019.09.05.00.52.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2019 00:52:16 -0700 (PDT) From: Lee Jones To: alokc@codeaurora.org, agross@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, bjorn.andersson@linaro.org, linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, wsa@the-dreams.de, vkoul@kernel.org Subject: [PATCH 1/2] dt-bindings: soc: qcom: Provide option to disable DMA Date: Thu, 5 Sep 2019 08:52:12 +0100 Message-Id: <20190905075213.13260-1-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190905_005218_562181_B93BFFD5 X-CRM114-Status: UNSURE ( 9.99 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:342 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lee Jones , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Used when DMA is not available or the best option. Signed-off-by: Lee Jones Reviewed-by: Vinod Koul Acked-by: Rob Herring --- Documentation/devicetree/bindings/soc/qcom/qcom,geni-se.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,geni-se.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,geni-se.txt index dab7ca9f250c..a14889ee76b0 100644 --- a/Documentation/devicetree/bindings/soc/qcom/qcom,geni-se.txt +++ b/Documentation/devicetree/bindings/soc/qcom/qcom,geni-se.txt @@ -40,6 +40,7 @@ Required properties: Optional property: - clock-frequency: Desired I2C bus clock frequency in Hz. When missing default to 100000Hz. +- qcom,geni-se-no-dma: Prevents the use of DMA in the Geni SE. Child nodes should conform to I2C bus binding as described in i2c.txt. From patchwork Thu Sep 5 07:52:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11132345 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0A791395 for ; Thu, 5 Sep 2019 07:52:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ADF442082E for ; Thu, 5 Sep 2019 07:52:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="P2ym94Pu"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jbQFjKO6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ADF442082E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=XtrBuh5fs0hNfEmY6rAHxuLA159fLcOzNI7se4NLvNo=; b=P2ym94PuY8RFRz69w2U94zv84W Ra+VRVI2ycW+xIxtM2UvGL0BhaNFum45tgzkQJp7hNkWoI0TecxIt1G9M4/8CcGA/le9w1ULeMRqv 7FhL6gvnnZrBvh0hqf3G8qCcYSGAJ7n8ZSrsgHeMUxOXrQQT4wRdkZcoqoqPA2RGJtmxlI1IC8j6+ WceQmCm9x+vnd7h4EBahqBPTiFY5T8jatCF0H6e0o5BKOsYQwwZsMOGZsGRLM7ldy8L+ia1NuFTEy QiiCkMaZva/S6pCC3qTi1WNmC2Z3CX2sVtMvN83DTivTcHIBsnUOsYzLo8twzJhIAMpxWCw9CKI7V nr6ZMK2w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i5mZE-0005V5-Fv; Thu, 05 Sep 2019 07:52:32 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i5mZ1-0005KX-KR for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2019 07:52:20 +0000 Received: by mail-wr1-x434.google.com with SMTP id i1so908600wro.4 for ; Thu, 05 Sep 2019 00:52:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=O9chrP35VeaOQspYv6yq0N6dO1x9er7VLpJQvN93FOI=; b=jbQFjKO6Qmkr3vx8C0XsOTK+x7zrOxshYBIVG7sm9rgWvOAJMvAeFSduofVvDDe5er TK61PFDj3AgbrmAv1r+Al9SaMV8HOTWcaHS1nHEKt/tE+uPuRYWDiaG7hoy7NEX1pby5 narsaOua/J7JS7NIgo6i1GyQAX9PMaMiyqvcF4WlfEXl0ezdXbQ3kL9wnvYWp29AMFwO CH+nTirZx7HPPYzGt/mYDjNXMG7M4AtEbpm4qibTCSvvUbXdTXBAHJDsXSQV7FZerQZb 4Wi6eNLOZa8Auw5uqGklYXGwK1noKCmKNaHYGorNCyyfb4JrAyt4KoXtRjQaZxVJzXzM J+qg== 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=O9chrP35VeaOQspYv6yq0N6dO1x9er7VLpJQvN93FOI=; b=I55h2K08joEqaWG1DbTdUo8VVQHNHayN0KptayrmFtbTSCl694GEQ7bxCzteJtxiQe XgAZyX55K4cuICKJVjHr6dwxHrX7tsPrau89LjYa4tHksMlbAfnMPYMgp2B//iZRChw3 0HhC7DwMRpBdo9glL6RzUDlVo/z3TB162AvNPxORAz2I4yNPQa6PlxSgp56huwLXmuY0 mhl4k1NmaWYjdtVWThlI67ggrj+RH7i58+GCAWV8lF8ytzSrNaugq+bY1jAdtSmcy+Y/ SvylU/6+mE3Bv20b07QMnPr0D/pcPaN3bOod5ISaegktms17mAS/813TO5yjou7WVL9E QVaA== X-Gm-Message-State: APjAAAUpzLFX8We6nPeGLByDhziAF9mJImnxrnskxZFUAGYvt2jzA47b DWGglrQFdxonqa1G7LNHE/LxdQ== X-Google-Smtp-Source: APXvYqyBf31WXqww2s1UsleaLTEgcVXsPmaZxCo4gB/O0+uIHD8GYImVDdW0XW1mm1vGmln7SgI7vw== X-Received: by 2002:a5d:680e:: with SMTP id w14mr1338770wru.3.1567669938104; Thu, 05 Sep 2019 00:52:18 -0700 (PDT) Received: from localhost.localdomain ([95.147.198.36]) by smtp.gmail.com with ESMTPSA id a13sm3418784wrf.73.2019.09.05.00.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2019 00:52:17 -0700 (PDT) From: Lee Jones To: alokc@codeaurora.org, agross@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, bjorn.andersson@linaro.org, linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, wsa@the-dreams.de, vkoul@kernel.org Subject: [PATCH 2/2] i2c: qcom-geni: Provide an option to disable DMA processing Date: Thu, 5 Sep 2019 08:52:13 +0100 Message-Id: <20190905075213.13260-2-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190905075213.13260-1-lee.jones@linaro.org> References: <20190905075213.13260-1-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190905_005219_667808_142AD328 X-CRM114-Status: GOOD ( 13.04 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:434 listed in] [list.dnswl.org] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lee Jones , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org We have a production-level laptop (Lenovo Yoga C630) which is exhibiting a rather horrific bug. When I2C HID devices are being scanned for at boot-time the QCom Geni based I2C (Serial Engine) attempts to use DMA. When it does, the laptop reboots and the user never sees the OS. The beautiful thing about this approach is that, *if* the Geni SE DMA ever starts working, we can remove the C code and any old properties left in older DTs just become NOOP. Older kernels with newer DTs (less of a priority) *still* will not work - but they do not work now anyway. Fixes: 8bc529b25354 ("soc: qcom: geni: Add support for ACPI") Signed-off-by: Lee Jones Reviewed-by: Vinod Koul --- drivers/i2c/busses/i2c-qcom-geni.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index a89bfce5388e..8822dea82980 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -353,13 +353,16 @@ static void geni_i2c_tx_fsm_rst(struct geni_i2c_dev *gi2c) static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, u32 m_param) { + struct device_node *np = gi2c->se.dev->of_node; dma_addr_t rx_dma; unsigned long time_left; - void *dma_buf; + void *dma_buf = NULL; struct geni_se *se = &gi2c->se; size_t len = msg->len; - dma_buf = i2c_get_dma_safe_msg_buf(msg, 32); + if (!of_property_read_bool(np, "qcom,geni-se-no-dma")) + dma_buf = i2c_get_dma_safe_msg_buf(msg, 32); + if (dma_buf) geni_se_select_mode(se, GENI_SE_DMA); else @@ -392,13 +395,16 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, u32 m_param) { + struct device_node *np = gi2c->se.dev->of_node; dma_addr_t tx_dma; unsigned long time_left; - void *dma_buf; + void *dma_buf = NULL; struct geni_se *se = &gi2c->se; size_t len = msg->len; - dma_buf = i2c_get_dma_safe_msg_buf(msg, 32); + if (!of_property_read_bool(np, "qcom,geni-se-no-dma")) + dma_buf = i2c_get_dma_safe_msg_buf(msg, 32); + if (dma_buf) geni_se_select_mode(se, GENI_SE_DMA); else