Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp525620ybe; Thu, 5 Sep 2019 01:34:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMZscjRuta/jHIMvX1F7gWGnnJmkxlB3lbkh22kJ/qPi5WArMRbE0ebNkrMOZQ4/ZuAnf3 X-Received: by 2002:a17:902:b082:: with SMTP id p2mr2102436plr.334.1567672444570; Thu, 05 Sep 2019 01:34:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567672444; cv=none; d=google.com; s=arc-20160816; b=S+brCM7ACtSVQvUxx3t6ETjIzbm0mOXHzZXMeIEtKkHX2nlCX+HpT+r42U+wny26rN sczKpGnwAc/l37fsv3QedM9AYravo065cTQ8AZhyA2xvTqZescn4MmmBuwPp0+rHw/7D HYDjnXPpj0QrYgCgGcTEtiJQ7DvPbCfw1ObzJRL/M45dE8sJlQ3jlJ4xrTUellMCzVQ/ pq126oDZLhY1zy8NcNPVdnR/oxEtads5DQ8LD7nDzXuB/J2pWvszmYo8b+tsEn+UGlFz 3+NRKhv2ocr2DIRzAqPx46YPzJhK1NeWYa2PwG4n+0lrGXRR0fvSFTobQp4vZZBG0erE SKdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=O9chrP35VeaOQspYv6yq0N6dO1x9er7VLpJQvN93FOI=; b=keHtG1sdxp1AD4V45J3CAmjf3uD1sCYmDq+VTfNmpcECHX5lW97v0476VhvIzmIhwi nbFSQmA6VnIdhOhmeNPHMslJojqPotESWvsWw7RSrr48INpcGCjwj3d9Ez9USWGQY8v3 CIXgHwKd9vySoWrjL50GD+rfM+Wllf8qGLjG4505fdVNrnpKvzZPSqXI0mHC9mcAByYe ZYQzo40C/wmi7lCYIl79grq7xlUU0sfTj5hxjYygFIXO2B6e2VODk0Q+uFQ0gekh0v8M n1lKuRyMGc3n69ijGuq+cn8wcZFh/kn1cKc6hGmpnPuSF/yCyMvDj1dgTSCRV25TV7kg cORg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jbQFjKO6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s76si36847pfs.170.2019.09.05.01.33.48; Thu, 05 Sep 2019 01:34:04 -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; dkim=pass header.i=@linaro.org header.s=google header.b=jbQFjKO6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732258AbfIEHwX (ORCPT + 99 others); Thu, 5 Sep 2019 03:52:23 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]:39240 "EHLO mail-wr1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731666AbfIEHwU (ORCPT ); Thu, 5 Sep 2019 03:52:20 -0400 Received: by mail-wr1-f42.google.com with SMTP id t16so1492368wra.6 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=Re2/13qRM6R6RO/kk4c3Z9XVlWZBRnutYGkNCE3koKCrAVH0DAm+y/sTpOgSba19uR lWD9ax11JWYyruXq1qm/Mec1IoD9Fd5T4+jKmGOzZtuCoI7K1HhYxOC/+hpiSzHbs5bB 0x2apBkzrYp/BienLkByYuJsmO9Y5qHq+aLIkrXIUogGaiY9PZQcjE5WtGcl8DO91+2D pOP0SxZw0fVh/kVDbt7HBx6G+m7WOPJdacwiuDf6gDvFj0JjCT8H9BA/sd6EsUDJUmGS e+7Px99tKGsRHMRZ3jlaGHKoShhQnqFNqkTgsjdQCnbG3KqU5MU/h5ieJJrWHZbNMlsg wCyg== X-Gm-Message-State: APjAAAWuOsytZTNvj7ien1JNzU/zaGt9X1+GwtFB8vGUsrnEwulO/xHh wpDC9OkWpU0R9vGBoLrTG2bUyA== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 -- 2.17.1