From patchwork Thu Feb 15 12:25:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 128416 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1691889ljc; Thu, 15 Feb 2018 04:28:43 -0800 (PST) X-Google-Smtp-Source: AH8x2276mZLdWUpSv/aGNvzRhS7Sy58pSFlZYLD+y4zGX8Zk4WC1lcDqRQBkcqTHXz9LzOjqG3sB X-Received: by 10.98.74.212 with SMTP id c81mr2533213pfj.26.1518697723255; Thu, 15 Feb 2018 04:28:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518697723; cv=none; d=google.com; s=arc-20160816; b=hiJnIbjGXcGt33rn9+lovJkyqiEUxtwckAxHl1rBESpSqSmYzTsF/aJs2Bh7yYKi5Z 1pVvE1oHkL3Tc+lHdIoofue4nT4Xmjve09VOBh1li1I/KlrQ1awRES8pzmW1YQC0rj/y L9NiFSlJoyudXoQmHFH/UdP97jnPKs5HPuoFyM0zFO05YqQPwxW6ooTwqTpqEi9bJZJI n217MtqHycobDwDiRbz1ldQkScBiByrjUBxDkhE8qK9ww313PjlG/8Hle3P+y2ZbNIkM LWlmzksZntvoAKS5txgHMtYs97DdCs1ffunAabjU8t2WY87MqwF0ivl8FzwUBDFrfJTO vyYw== 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:arc-authentication-results; bh=EWynJQezwOi2Rg6g9E4IBYEVVvN3bAvry+hdSSbD/bA=; b=IOXNvGAlxSDDmrk8IHa3M4oyDMH2FAmUdoG6PagOTjE0qXmtZG1RR2SSX2bnmrunfI oil4BcnT8udhE0IIi2HgtuZ10x7N85RhoI43z8UE0UNoInGo0FwPS4lDsOwU1W08QOXM lbK9njOIM22Dy+qYD4AX1oCSjwDpjvCheeaGxr16FkmyiB0chF6asxcr5xOhc0Naxvdu kyDioatnX/T8nUAoS9IpBumrkS1VgWROXD1riim1StAE4DtSx5lcqQo/Ot7YPk5l8kMe vbUtpQ37gONgKsYgt7uTR4IfuMT+kBZYum7zQzAizVwmkgDvUTKgyRsoutRHCEFh0pcV FIew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eFyHQ+BD; 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 t1-v6si3081445plr.558.2018.02.15.04.28.43; Thu, 15 Feb 2018 04:28:43 -0800 (PST) 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=eFyHQ+BD; 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 S968060AbeBOM2i (ORCPT + 28 others); Thu, 15 Feb 2018 07:28:38 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:45225 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031251AbeBOM1S (ORCPT ); Thu, 15 Feb 2018 07:27:18 -0500 Received: by mail-wr0-f193.google.com with SMTP id q16so1363716wrf.12 for ; Thu, 15 Feb 2018 04:27:17 -0800 (PST) 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=EWynJQezwOi2Rg6g9E4IBYEVVvN3bAvry+hdSSbD/bA=; b=eFyHQ+BDv6Wte9hEHRprnoM2hBHFhT9h5ePfLl7b2BdZwwxVW0ubE3Bja5j63Kg0lP S6ytSPb/9LT8qpg2V6c/Kgnabr9UBMGijzvy4E9quLgew7lnuetxfOckX3DNOHnK80qo N/zWyQLnkqWOlmIV97ZIrLgqIpFboTlvp9UuM= 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=EWynJQezwOi2Rg6g9E4IBYEVVvN3bAvry+hdSSbD/bA=; b=UdNC0IWCxOruuS/zv86czkUAPIGu4lbM6uOtg6CP6VqeWbIMzgURsBQUPKTYHbYMuM k8wvrXuHcEDVro1fxtPs3q2/Rasw+dGvDLRVkpdf0TbAd2cj59D2bSnuXB1LBNG/d5Ky g09/F3ADIRhLqMods7f4RFQ1cc8EJmRLHfRuXEAWy3BMQv2nK2MRKsxbIIZI7K8cZbVZ RNKtPxtZkvdpMWU/2oxQIbTIsndJ6dsKAdR9DLR4cFmq9vbyuFw8m1WCn3/BFf39PND+ ep2SnQR4Dt1Edoo45zthX2gQoEmmhIm9bLT3hqNTvHmaijo4JD341cv8sUsZwKzp6pZK 5fNg== X-Gm-Message-State: APf1xPAzRzq00k8qLTNNvUH3HBofmTHnq8SfeLbB5DRcy8ry65BGfFiH LmfzUXcwO9lJmWnPAuUaj1mIgg== X-Received: by 10.223.164.215 with SMTP id h23mr723363wrb.38.1518697637078; Thu, 15 Feb 2018 04:27:17 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id s9sm15632778wra.4.2018.02.15.04.27.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Feb 2018 04:27:16 -0800 (PST) From: srinivas.kandagatla@linaro.org To: vinod.koul@intel.com, andy.gross@linaro.org, dmaengine@vger.kernel.org Cc: robh+dt@kernel.org, mark.rutland@arm.com, david.brown@linaro.org, dan.j.williams@intel.com, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-soc@vger.kernel.org, yanhe@quicinc.com, ramkri@qti.qualcomm.com, sdharia@quicinc.com, Srinivas Kandagatla Subject: [PATCH v3 1/5] dmaengine: qcom: bam_dma: make bam clk optional Date: Thu, 15 Feb 2018 12:25:07 +0000 Message-Id: <20180215122511.13517-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180215122511.13517-1-srinivas.kandagatla@linaro.org> References: <20180215122511.13517-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Srinivas Kandagatla When BAM is remotely controlled it does not sound correct to control its clk on Linux side. Make it optional, so that its not mandatory for remote controlled BAM instances. Signed-off-by: Srinivas Kandagatla --- drivers/dma/qcom/bam_dma.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.15.1 diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index d076940e0c69..b79691fcc82d 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -1233,8 +1233,12 @@ static int bam_dma_probe(struct platform_device *pdev) "qcom,controlled-remotely"); bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk"); - if (IS_ERR(bdev->bamclk)) - return PTR_ERR(bdev->bamclk); + if (IS_ERR(bdev->bamclk)) { + if (!bdev->controlled_remotely) + return PTR_ERR(bdev->bamclk); + + bdev->bamclk = NULL; + } ret = clk_prepare_enable(bdev->bamclk); if (ret) { From patchwork Thu Feb 15 12:25:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 128412 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1690866ljc; Thu, 15 Feb 2018 04:27:32 -0800 (PST) X-Google-Smtp-Source: AH8x225562eI/NOV1KJob1gzbwtscpL/JtVTXbjVrQ/4VDqo8rGie7GYaM2xaAczIR7giLaRyWHw X-Received: by 10.98.217.211 with SMTP id b80mr511518pfl.107.1518697652444; Thu, 15 Feb 2018 04:27:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518697652; cv=none; d=google.com; s=arc-20160816; b=ycs+hQF4wAenPjTcnrzQopHLhdIxq6KIzndTWBlUBen+jU5jcqHYcr+TjUBIjAXaig uAQtiPE08zJN0LGE8GMc3jYAkpXKsMbuKQHyidZatfpz6YpHQYt3IREvx4FJz3Ig5FTo rjpgTYj7mehVi8W5fu0kRhzP7fYnLQloo9wSeVG+iV3y7o6fz+1xiHknjCJdtrr7fH7l S1m+GWnT+oK2NuLbmyvhE5aCIaIBTKL7PuAbqFAX2uhji152STqErFBkgP1OzNrM3Mq2 harec38NvvwebJNWTBdB6cHIJlsGJEI/DVNT00CoGh8+2t5dOsynhwBkgujy/C9o13Bd yOmg== 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:arc-authentication-results; bh=RSa3LU5wUBWKC8vAfFrBH1aVnlFF86oIsBtMOFIVLZw=; b=mq4ULx/3oa07e6PJGt7gJltHJ7qmj2CD6LWKD0GIh5pRO+snsqjyb32lIB2UhdqgZI qRpBLlI08qKDCqNLKe13O4savVvK6V9m7Pub9ENqAZn0Ga1cAxR3kDQWTZhNPEBsq0ho aFLON+gGNzy+iLMTHxl3S5eD+9w8Ouq27rWLBc0LhAU1nz+eZUp1dIjEYNGzmuW+ReKP lRoXI3240Qphe8XgEgTadntRgiAqkcDzTLcFAkBG7W7dYPpTAnR8oPhQlHFckQYo1Oxx m3z3LrjT2qHgtwlO5gsJ+WOou36aHHebb5eVJNFsNjdteteS/dXAEhID2qWP60EpFT1w O2Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D4UJVLMH; 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 m15si1344632pga.684.2018.02.15.04.27.32; Thu, 15 Feb 2018 04:27:32 -0800 (PST) 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=D4UJVLMH; 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 S1031661AbeBOM13 (ORCPT + 28 others); Thu, 15 Feb 2018 07:27:29 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:34252 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031468AbeBOM1W (ORCPT ); Thu, 15 Feb 2018 07:27:22 -0500 Received: by mail-wr0-f194.google.com with SMTP id m5so3178101wrg.1 for ; Thu, 15 Feb 2018 04:27:21 -0800 (PST) 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=RSa3LU5wUBWKC8vAfFrBH1aVnlFF86oIsBtMOFIVLZw=; b=D4UJVLMHo36uQkREUXWg5shcnT3pNCptXgQcW0vwJFd/T1oRkT6YFHzaU/YCv3KPzu X6bR4fBogmy27NebYFej0zFFE4pveiu3xDQpWLrfgyIcVAxirD0wCvQI9h+jc+BMok7V 1MQVxyhfS0JU4S6JtOvwA9SG6mYdy6nlrC8E4= 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=RSa3LU5wUBWKC8vAfFrBH1aVnlFF86oIsBtMOFIVLZw=; b=pcUEuIAuTfk9lB+gYs03ZP5t+k8T8hUurhvvuoAdyXketXeObJSzjlOM+QXhIN9rwd PqjvlOAFALN54PRbQM76Q6YhI5Wz7EyIFFwmB78n4NT754y6hX3cMp2Vl7qm3OcUn1hV Jht7fl8SRNy01EI5sXL0vwQPotrH5ZUBTb2LcEdxx1a/6jpfg5YdZl1+qGLKXFfiBkbW T6N/jRbMHK3XNM9v8y52qFJZomCdl2Yxo9qyqkOzIjCx1wuGwckDTstogAEJzfcx3D2z GdZI7HbzCcdu33QWVjxmJuHLNcK4+p1Jn1MpvT7PoS0dip01TeTTOZ7SACk7Hv5cUaEQ 56Bw== X-Gm-Message-State: APf1xPAI+sT6424p0Te0yspS1V07046sMetMiaZ2SxEiLRqgPEjONdH9 Jg/zOoPDE5r0IJxoA8oMWg7IMQ== X-Received: by 10.223.172.75 with SMTP id v69mr2354462wrc.269.1518697640840; Thu, 15 Feb 2018 04:27:20 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id s9sm15632778wra.4.2018.02.15.04.27.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Feb 2018 04:27:20 -0800 (PST) From: srinivas.kandagatla@linaro.org To: vinod.koul@intel.com, andy.gross@linaro.org, dmaengine@vger.kernel.org Cc: robh+dt@kernel.org, mark.rutland@arm.com, david.brown@linaro.org, dan.j.williams@intel.com, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-soc@vger.kernel.org, yanhe@quicinc.com, ramkri@qti.qualcomm.com, sdharia@quicinc.com, Srinivas Kandagatla Subject: [PATCH v3 4/5] dmaengine: qcom: bam_dma: do not write to global regs in remote mode Date: Thu, 15 Feb 2018 12:25:10 +0000 Message-Id: <20180215122511.13517-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180215122511.13517-1-srinivas.kandagatla@linaro.org> References: <20180215122511.13517-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Srinivas Kandagatla BAM_DESC_CNT_TRSHLD register is global register, which can only be written when BAM is in master mode, So check the mode of operation before writing it. Without this check SOC's xPU would catch such access and crash the system. First noticed on DB820c while testing SLIMBus BAM. Signed-off-by: Srinivas Kandagatla --- drivers/dma/qcom/bam_dma.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) -- 2.15.1 diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index 139e9f5e47a9..6919f501b9f3 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -935,12 +935,15 @@ static void bam_apply_new_config(struct bam_chan *bchan, struct bam_device *bdev = bchan->bdev; u32 maxburst; - if (dir == DMA_DEV_TO_MEM) - maxburst = bchan->slave.src_maxburst; - else - maxburst = bchan->slave.dst_maxburst; + if (!bdev->controlled_remotely) { + if (dir == DMA_DEV_TO_MEM) + maxburst = bchan->slave.src_maxburst; + else + maxburst = bchan->slave.dst_maxburst; - writel_relaxed(maxburst, bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD)); + writel_relaxed(maxburst, + bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD)); + } bchan->reconfigure = 0; }