From patchwork Mon Aug 8 05:52:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9266697 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AD92C60839 for ; Mon, 8 Aug 2016 05:57:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F12826E69 for ; Mon, 8 Aug 2016 05:57:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93E6F27813; Mon, 8 Aug 2016 05:57:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2FE5626E69 for ; Mon, 8 Aug 2016 05:57:38 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bWdXq-0003Ve-6O; Mon, 08 Aug 2016 05:56:14 +0000 Received: from mail-pf0-x22c.google.com ([2607:f8b0:400e:c00::22c]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bWdWS-0000yF-Do for linux-arm-kernel@lists.infradead.org; Mon, 08 Aug 2016 05:54:52 +0000 Received: by mail-pf0-x22c.google.com with SMTP id x72so115737625pfd.2 for ; Sun, 07 Aug 2016 22:54:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aoNyyAGhfJpacRuEHyQuw8g1DPMumraESyWE0eZFDWU=; b=V3B8+W/1PpDzPbxovzaxGFCK5l3VUTR4FMfjOnQA0mzz0/t9GHEK4YdY++4fH536xE 8dwuthXwDaAqrupzq6wnBLIv0+ekLF4oIfHe1b88KrSFeR5n2+5k1M0IVqBnjZfGja3C jnXaUiC804KNrygfcuC3f2l+OFYOy6IAWGAdo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aoNyyAGhfJpacRuEHyQuw8g1DPMumraESyWE0eZFDWU=; b=YtnT1bPpyWh0QTnHVtjb9lYAdaawG0Fj6/Wx7x6dY+ClzlNZwr7++egBraHwhm1ZY+ taR8WkOtUpPDwTMwslsFt+pV9kvS46/sfJBjPPw6B1t1Z4s9EWODSiInDgcXoqR3Mvxp KCc1wOMZqpqqCTgxSGz4FNgN/XTtwyVwPj9JanPjqWD9cr5ZO6Fx6LQwpyfMwlaSYodA jB9v1cIJhMFMzQzH+PDukfjV5GWFbu9S7SCeLmHk3ROKcpK1iMv7z36JijqHmxHsKNyM vYHCaPzTw0vCDp3C4B6ahN2Q3eNF6lZYfS2VlAjY/mhWCKMl7letx27OzxcTiZP6mzS0 k/ag== X-Gm-Message-State: AEkooutoUlv2vp7Pgdv4591/XXZDitgmvvWA+EC78JUkRUt02A2iH4DFfyEJ/9vBbqq5tNWF X-Received: by 10.98.17.83 with SMTP id z80mr160430608pfi.38.1470635667210; Sun, 07 Aug 2016 22:54:27 -0700 (PDT) Received: from anup-HP-Compaq-8100-Elite-CMT-PC.ban.broadcom.com ([202.140.56.34]) by smtp.gmail.com with ESMTPSA id u72sm44404402pfa.31.2016.08.07.22.54.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 07 Aug 2016 22:54:26 -0700 (PDT) From: Anup Patel To: Greg Kroah-Hartman , Jonathan Corbet Subject: [PATCH RESEND v2 8/8] uio: Use new memtypes in uio_dmem_genirq Date: Mon, 8 Aug 2016 11:22:37 +0530 Message-Id: <1470635557-13416-9-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470635557-13416-1-git-send-email-anup.patel@broadcom.com> References: <1470635557-13416-1-git-send-email-anup.patel@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160807_225448_634553_4AB4DDF4 X-CRM114-Status: GOOD ( 12.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Anup Patel , Scott Branden , linux-doc@vger.kernel.org, Ray Jui , Russell King - ARM Linux , linux-kernel@vger.kernel.org, Rob Herring , bcm-kernel-feedback-list@broadcom.com, Ankit Jindal , linux-arm-kernel@lists.infradead.org, Jan Viktorin MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch extends uio_dmem_genirq driver to use recently added memtypes as follows: 1. Use UIO_MEM_DEVICE memtype for MEM resources 2. Use UIO_MEM_PHYS_CACHE memtype for dynamic regions when UIO DT node is marked as DMA coherent. Signed-off-by: Anup Patel --- drivers/uio/uio_dmem_genirq.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c index 1db2559..ce36afd 100644 --- a/drivers/uio/uio_dmem_genirq.c +++ b/drivers/uio/uio_dmem_genirq.c @@ -327,7 +327,7 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev) break; } - uiomem->memtype = UIO_MEM_PHYS; + uiomem->memtype = UIO_MEM_DEVICE; uiomem->addr = r->start; uiomem->size = resource_size(r); ++uiomem; @@ -343,7 +343,12 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev) " dynamic and fixed memory regions.\n"); break; } - uiomem->memtype = UIO_MEM_PHYS; + + if (pdev->dev.of_node && + of_dma_is_coherent(pdev->dev.of_node)) + uiomem->memtype = UIO_MEM_PHYS_CACHE; + else + uiomem->memtype = UIO_MEM_PHYS; uiomem->addr = DMEM_MAP_ERROR; uiomem->size = pdata->dynamic_region_sizes[i]; ++uiomem;