From patchwork Tue Oct 3 22:35:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 821049 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="FwXAuLzf"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3y6DRD3CfBz9t2c for ; Wed, 4 Oct 2017 09:36:40 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750865AbdJCWgj (ORCPT ); Tue, 3 Oct 2017 18:36:39 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:47269 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751120AbdJCWgi (ORCPT ); Tue, 3 Oct 2017 18:36:38 -0400 Received: by mail-wm0-f67.google.com with SMTP id t69so19410165wmt.2 for ; Tue, 03 Oct 2017 15:36:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=z3MFIa0DOGa6f8qgNn89qQWs37F8K7KkTFTUrYrqSS8=; b=FwXAuLzfHZygCthhOJ8muYMDNZK2UGTUWSwacUB1bFfM17IEazWWjUkT89nvQQIQEo 3Q6IG0whuVEoPb2FCdLTon5Ww7/+WhRcVaq3/qi3oKxDla/KbnaHckv4kR4dj2V8jXZZ TNieWGb/oQSbDw+8b6an9wwj71PyE3AVosn1nPGia/FH+7zZZWEtJEZD1AoWnD9kuovZ f5juC87G/j+JiCwCQbrZovTjcEsILzBPFbE/2llSVHVa2fo9Fm+rMrpGq62t+kWufvFT L4qkqTBbBtmvsKh+ySQvEs4oQ/R4fsNs7hOBubcvQoTAQQ4UvLQpfbjeDfdSMPHktXwU Gl9w== 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:in-reply-to:references; bh=z3MFIa0DOGa6f8qgNn89qQWs37F8K7KkTFTUrYrqSS8=; b=U4sjfdfalQ0R0GZySEPo5VA3/43CcAiE68YFGwdM0/ugKh3LcdM+oeubcOYcnxUPn0 kUIocKjh5FClOyvgTeGbAe8q3jTj8MBW0WyhR5seOXEmyoaQq6J0S3nA58nBuy1obOYu alDe5W3G97819dkIqIDsvY7X+R54QSWMnPcP3yS8YffCT/Txz8+1ygkIRazLjf7gYJ2m Wa4SfLyKDIy+v4o8yv3wfEaDwLT4K/w9AQWdyR4rE/9HbRxL3nHys6sbFGRaK1sB4r1C ob5zso9l35RTx7pKZjbwPULQjCB+jl773C95j0ujVsJPV6vHn6HClTafxcjcILInAfix mlfg== X-Gm-Message-State: AMCzsaVpsksNfRDDqIBBdqkSyqLUjbppoJGLyuI3WpGUG5uWf+prGPsm T3SN0/ZeDTQn6kRAwysPEgY= X-Google-Smtp-Source: AOwi7QCPC+h0vrQlCm8ui0e5Xwmp3onv1bgPARMmer6g2OLBLNgLSbGSt/NMQWshSWJ+XAHSQ1+aqQ== X-Received: by 10.28.196.205 with SMTP id u196mr13859470wmf.120.1507070197635; Tue, 03 Oct 2017 15:36:37 -0700 (PDT) Received: from localhost.localdomain (ppp109-252-55-163.pppoe.spdop.ru. [109.252.55.163]) by smtp.gmail.com with ESMTPSA id r68sm16192413wmd.4.2017.10.03.15.36.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Oct 2017 15:36:37 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter Cc: linux-tegra@vger.kernel.org Subject: [PATCH v2 1/2] soc/tegra: fuse: Fix reading registers using DMA on Tegra20 Date: Wed, 4 Oct 2017 01:35:08 +0300 Message-Id: <1fe535d4655ae00199a8d60768b384e87df3ed51.1507068874.git.digetx@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org DMA config is incorrect, because of it DMA transfer is never issued and tegra20_fuse_read() always returns 0x0. Signed-off-by: Dmitry Osipenko Acked-by: Jon Hunter --- drivers/soc/tegra/fuse/fuse-tegra.c | 1 + drivers/soc/tegra/fuse/fuse-tegra20.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index b7c552e3133c..73a3a2c74021 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -132,6 +132,7 @@ static int tegra_fuse_probe(struct platform_device *pdev) /* take over the memory region from the early initialization */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + fuse->phys = res->start; fuse->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(fuse->base)) return PTR_ERR(fuse->base); diff --git a/drivers/soc/tegra/fuse/fuse-tegra20.c b/drivers/soc/tegra/fuse/fuse-tegra20.c index 294413a969a0..a33f48c06771 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra20.c +++ b/drivers/soc/tegra/fuse/fuse-tegra20.c @@ -59,7 +59,7 @@ static u32 tegra20_fuse_read(struct tegra_fuse *fuse, unsigned int offset) mutex_lock(&fuse->apbdma.lock); - fuse->apbdma.config.src_addr = fuse->apbdma.phys + FUSE_BEGIN + offset; + fuse->apbdma.config.src_addr = fuse->phys + FUSE_BEGIN + offset; err = dmaengine_slave_config(fuse->apbdma.chan, &fuse->apbdma.config); if (err) @@ -119,6 +119,7 @@ static int tegra20_fuse_probe(struct tegra_fuse *fuse) fuse->apbdma.config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; fuse->apbdma.config.src_maxburst = 1; fuse->apbdma.config.dst_maxburst = 1; + fuse->apbdma.config.direction = DMA_DEV_TO_MEM; init_completion(&fuse->apbdma.wait); mutex_init(&fuse->apbdma.lock); From patchwork Tue Oct 3 22:35:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 821050 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="U4ewg5uc"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3y6DRF0ZByz9t2Z for ; Wed, 4 Oct 2017 09:36:41 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751169AbdJCWgk (ORCPT ); Tue, 3 Oct 2017 18:36:40 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:37686 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751090AbdJCWgk (ORCPT ); Tue, 3 Oct 2017 18:36:40 -0400 Received: by mail-wr0-f195.google.com with SMTP id v38so3872200wrc.4 for ; Tue, 03 Oct 2017 15:36:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=oQ8+G8kukjKUKFOmG5aBnKcBbdTEEKv2ReEXk+Yi4eI=; b=U4ewg5ucgsgJwai8ap86jBEzQzhufkd8z+gntqNd47rNlvIg31hEUXj50bB+Cx/gB1 pbLNNpn4lrIWccpW0v+TyDQ/nVuKzvE1YwQyVPHqllZK/HEEL6xErBsCOE9smlLN6pez MPJkqn7aJQUmajnSfUhKxm0/MGMDrwKEFPTA1p0Gr6oz7rbJrUowoypkxo8pvQsDMJfl rpYMYRzXiI9U3Kj+z8psucalcD8x3hO3dtAaiCxIKEbDg54sd+i4gNsVlu+rfGNQ6D/s 7bjlZerq5VOHB1fZSJwtH6+Dsb64rSiOGXfoUNUil98xl9tF6C9PJl983ZseMj61lht2 0hFQ== 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:in-reply-to:references; bh=oQ8+G8kukjKUKFOmG5aBnKcBbdTEEKv2ReEXk+Yi4eI=; b=IS37ca89l2xOkMS1iD3LFEq1sj7Wz22RuoareNt9CpbXw1oQwPpDMid6oXoiDR36Ax wPzV+ZbDrlzCF/TvZj/FtsCm0gxeaYRnJdhUbI+feYttvQ97YQRq3gPBv6UstnsqqXQt I1vogzbeKq73YOStibNayTuaA1gDcqzvfGMqxfwHMC9DltJBjCRGGADQnO1hMowmna0w hT2SNk408kmo9G7UQYW9q8jHdXLPaC3rmW5cxr1ZDMM4oMgtMbFoCbu7XJG0yrweH/eX tn3oVDvevMxH1lgnTlHlnoHEcilnyea6NDdH6oU1+aU/N/Dlyo8YUqpIKlQPd0jqeUYO SmnA== X-Gm-Message-State: AMCzsaXErkbvm9+j0DlhFOoLtmM7EB3X25aeOvz3mnXRUW6dg0cFEzLJ m0vAejnm6YKRIuNYxL5OtC8= X-Google-Smtp-Source: AOwi7QDs67MVBV96Q5NMxWFIbKxto4DLYReiTxJU3ph0/RwXz8LNLea+Tly8CCtNYEQno53JhqZV8Q== X-Received: by 10.223.132.6 with SMTP id 6mr5523798wrf.93.1507070198900; Tue, 03 Oct 2017 15:36:38 -0700 (PDT) Received: from localhost.localdomain (ppp109-252-55-163.pppoe.spdop.ru. [109.252.55.163]) by smtp.gmail.com with ESMTPSA id r68sm16192413wmd.4.2017.10.03.15.36.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Oct 2017 15:36:38 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter Cc: linux-tegra@vger.kernel.org Subject: [PATCH v2 2/2] soc/tegra: fuse: Explicitly request DMA channel from APB DMA driver Date: Wed, 4 Oct 2017 01:35:09 +0300 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Currently fuse driver requests DMA channel from an arbitrary DMA device, it is not a problem since there is only one DMA provider for Tegra20 yet, but it will become troublesome once another provider will be added. Signed-off-by: Dmitry Osipenko --- drivers/soc/tegra/fuse/fuse-tegra20.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra20.c b/drivers/soc/tegra/fuse/fuse-tegra20.c index a33f48c06771..e9e127a24c70 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra20.c +++ b/drivers/soc/tegra/fuse/fuse-tegra20.c @@ -37,6 +37,11 @@ #define FUSE_UID_LOW 0x08 #define FUSE_UID_HIGH 0x0c +static const struct of_device_id apbdma_of_match[] = { + { .compatible = "nvidia,tegra20-apbdma" }, + { }, +}; + static u32 tegra20_fuse_read_early(struct tegra_fuse *fuse, unsigned int offset) { return readl_relaxed(fuse->base + FUSE_BEGIN + offset); @@ -96,6 +101,11 @@ static u32 tegra20_fuse_read(struct tegra_fuse *fuse, unsigned int offset) return value; } +static bool dma_filter(struct dma_chan *chan, void *filter_param) +{ + return of_match_device(apbdma_of_match, chan->device->dev) != NULL; +} + static int tegra20_fuse_probe(struct tegra_fuse *fuse) { dma_cap_mask_t mask; @@ -103,7 +113,7 @@ static int tegra20_fuse_probe(struct tegra_fuse *fuse) dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); - fuse->apbdma.chan = dma_request_channel(mask, NULL, NULL); + fuse->apbdma.chan = __dma_request_channel(&mask, dma_filter, NULL); if (!fuse->apbdma.chan) return -EPROBE_DEFER;