From patchwork Fri Oct 5 17:04:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 1555351 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 4F9EDDF24C for ; Fri, 5 Oct 2012 17:07:42 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TKBKH-0003rO-5j; Fri, 05 Oct 2012 17:04:37 +0000 Received: from mail-ie0-f177.google.com ([209.85.223.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TKBJx-0003nz-44 for linux-arm-kernel@lists.infradead.org; Fri, 05 Oct 2012 17:04:18 +0000 Received: by mail-ie0-f177.google.com with SMTP id e14so4780893iej.36 for ; Fri, 05 Oct 2012 10:04:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=JBcU523MiKoyCzQ+hpUjurro3ZkZjankz3DcDgj7rGs=; b=ydeGKmLl5VG3m4Vniop3A2eEjNbSIioL3sm+zlgxhWXPaI1NTlZ1YIStW6ilf8s+Ng 3QYlIkmSTztA00z3IaW8kdHJB8oxe+XiUcibEsm048GOGt240cM63xG2+Y+xIXw+D4ea OshIIYivXpmxWWtP1MNGezGSy6pses++CaUqJR5KuRKN+qlE+WYez0XFp9jti5hYVTkK VhVK2qA+ckgVrXCLNxJd3v025cLj7ScXETmwxcYafPynuOWKTs5cVjLQtSXgtXqBfxb9 jgPi+7Wl2IS/2y6Kj1iiDu/NwrOfAkw2I4/76S/u3eppAosIVW+hvsOXcdgPSM6z9tuu mEIA== Received: by 10.50.202.73 with SMTP id kg9mr1787819igc.42.1349456655830; Fri, 05 Oct 2012 10:04:15 -0700 (PDT) Received: from beef.ohporter.com (cpe-24-166-64-7.neo.res.rr.com. [24.166.64.7]) by mx.google.com with ESMTPS id u4sm1210118igw.6.2012.10.05.10.04.14 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 05 Oct 2012 10:04:15 -0700 (PDT) From: Matt Porter To: Greg Kroah-Hartman , "Hans J. Koch" , Sekhar Nori Subject: [PATCH v4 1/7] uio: uio_pruss: replace private SRAM API with genalloc Date: Fri, 5 Oct 2012 13:04:40 -0400 Message-Id: <1349456686-22736-2-git-send-email-mporter@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1349456686-22736-1-git-send-email-mporter@ti.com> References: <1349456686-22736-1-git-send-email-mporter@ti.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.223.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (ohiomdp[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Ben Gardiner , Linux DaVinci Kernel List , Russell King , Linux Kernel Mailing List , Linux ARM Kernel List X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Remove the use of the private DaVinci SRAM API in favor of genalloc. The pool to be used is provided by platform data. Signed-off-by: Matt Porter Signed-off-by: "Hans J. Koch" --- drivers/uio/Kconfig | 1 + drivers/uio/uio_pruss.c | 24 +++++++++++++++++------- include/linux/platform_data/uio_pruss.h | 3 ++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig index 6f3ea9b..c48b938 100644 --- a/drivers/uio/Kconfig +++ b/drivers/uio/Kconfig @@ -97,6 +97,7 @@ config UIO_NETX config UIO_PRUSS tristate "Texas Instruments PRUSS driver" depends on ARCH_DAVINCI_DA850 + select GENERIC_ALLOCATOR help PRUSS driver for OMAPL138/DA850/AM18XX devices PRUSS driver requires user space components, examples and user space diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c index 33a7a27..f8738de 100644 --- a/drivers/uio/uio_pruss.c +++ b/drivers/uio/uio_pruss.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #define DRV_NAME "pruss_uio" #define DRV_VERSION "1.0" @@ -65,10 +65,11 @@ struct uio_pruss_dev { dma_addr_t sram_paddr; dma_addr_t ddr_paddr; void __iomem *prussio_vaddr; - void *sram_vaddr; + unsigned long sram_vaddr; void *ddr_vaddr; unsigned int hostirq_start; unsigned int pintc_base; + struct gen_pool *sram_pool; }; static irqreturn_t pruss_handler(int irq, struct uio_info *info) @@ -106,7 +107,9 @@ static void pruss_cleanup(struct platform_device *dev, gdev->ddr_paddr); } if (gdev->sram_vaddr) - sram_free(gdev->sram_vaddr, sram_pool_sz); + gen_pool_free(gdev->sram_pool, + gdev->sram_vaddr, + sram_pool_sz); kfree(gdev->info); clk_put(gdev->pruss_clk); kfree(gdev); @@ -152,10 +155,17 @@ static int __devinit pruss_probe(struct platform_device *dev) goto out_free; } - gdev->sram_vaddr = sram_alloc(sram_pool_sz, &(gdev->sram_paddr)); - if (!gdev->sram_vaddr) { - dev_err(&dev->dev, "Could not allocate SRAM pool\n"); - goto out_free; + if (pdata->sram_pool) { + gdev->sram_pool = pdata->sram_pool; + gdev->sram_vaddr = + gen_pool_alloc(gdev->sram_pool, sram_pool_sz); + if (!gdev->sram_vaddr) { + dev_err(&dev->dev, "Could not allocate SRAM pool\n"); + goto out_free; + } + gdev->sram_paddr = + gen_pool_virt_to_phys(gdev->sram_pool, + gdev->sram_vaddr); } gdev->ddr_vaddr = dma_alloc_coherent(&dev->dev, extram_pool_sz, diff --git a/include/linux/platform_data/uio_pruss.h b/include/linux/platform_data/uio_pruss.h index f39140a..3d47d21 100644 --- a/include/linux/platform_data/uio_pruss.h +++ b/include/linux/platform_data/uio_pruss.h @@ -20,6 +20,7 @@ /* To configure the PRUSS INTC base offset for UIO driver */ struct uio_pruss_pdata { - u32 pintc_base; + u32 pintc_base; + struct gen_pool *sram_pool; }; #endif /* _UIO_PRUSS_H_ */