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: 11132343 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 9CBA515E9 for ; Thu, 5 Sep 2019 07:52:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7DC982082E for ; Thu, 5 Sep 2019 07:52:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="P3M2iaYy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731944AbfIEHwT (ORCPT ); Thu, 5 Sep 2019 03:52:19 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:55643 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730785AbfIEHwT (ORCPT ); Thu, 5 Sep 2019 03:52:19 -0400 Received: by mail-wm1-f65.google.com with SMTP id g207so1513219wmg.5 for ; Thu, 05 Sep 2019 00:52:17 -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=gjEOCqbz5HyF6SAjgXE5MhAdwDKiHe8ZseZB5NSjXpQX0kVnSteoobWMkf8HZ87XLd N7dc11bx76mw1NdLeytpknG5AzVJVhAlLA8uNr2uEao8t157fY52DluNq2tNdCeVqEdL 3QZyh554ih/68EsfGLh5hm7E/jmU7A8AgZ/miROmNLlBQpdH75uVzQaRomZyuCigVp2k ct3ZTooW3aR8NCCqtMZW5Qrf1B/kM4NWw3oGGz6mLwE50TmeT7CULoPSPbps5K/4nZoq oNu7W4hDaK7flBdYEbn9JcrbmjOYvHNKHAQmKvk4P54nmueL69mU1E/H1YEzJJV/7iCr FMLQ== X-Gm-Message-State: APjAAAX0P3i+3RXDTcvmSR0cwT4Mn9q0NLfjc44R/IX2tYBFM9iq8qNu GTYnGDaFpJk6kKDIaLx+BdrVTQ== 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Lee Jones 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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.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: 11132339 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 649BE1395 for ; Thu, 5 Sep 2019 07:52:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4413921848 for ; Thu, 5 Sep 2019 07:52:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jbQFjKO6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731672AbfIEHwW (ORCPT ); Thu, 5 Sep 2019 03:52:22 -0400 Received: from mail-wr1-f49.google.com ([209.85.221.49]:37572 "EHLO mail-wr1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731725AbfIEHwU (ORCPT ); Thu, 5 Sep 2019 03:52:20 -0400 Received: by mail-wr1-f49.google.com with SMTP id i1so908601wro.4 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: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=ZPzbOqQMdqBDDk7PmA76w91XS4IGffTshJDNttSNjNt0sj5yuadxXSu87UHpLqdzTz xKfBWUAavFIvPInFOYlswc9FXjHf+w5Z1p4KkZxkhgP05CaQxSD8yrwvj8eB5eZBCQNg FPADIvDEy11Qgy3aXxCqEmivyOjKjpalU6yZSBth/yMjBCtEzIQu7zR+x+YGFC20ElUO rq3VTuC4pFqicEInmZbaROmfiRYtqQIiRdit9QO65lKPifg1FkVgP1o1rbKjRXaKjTu6 MccYcLusWR8kmPlYlQs4nHQGCLM8kweZi091z/y3bX9MRZS5aKy564BHCoutBsNGbNFh kTfw== X-Gm-Message-State: APjAAAVc0NDW6I4MVMPLB2yt2dqpA8MGVCwlr5muyAMMQlPeK2pqS3Kf nj9kAvCO3orjf715jFA+FWXtcPF/wqE= 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Lee Jones 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> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.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