From patchwork Fri Sep 28 19:37:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 1522551 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id C9D9D3FE80 for ; Fri, 28 Sep 2012 19:40:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030481Ab2I1Tj7 (ORCPT ); Fri, 28 Sep 2012 15:39:59 -0400 Received: from mail-ie0-f174.google.com ([209.85.223.174]:38829 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965458Ab2I1Thp (ORCPT ); Fri, 28 Sep 2012 15:37:45 -0400 Received: by mail-ie0-f174.google.com with SMTP id k13so8209939iea.19 for ; Fri, 28 Sep 2012 12:37:45 -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=Q0hODEGymypxwQlb52vkyGWBqH9RS9q2cR9STiUw01U=; b=CNcFBP5vceKqNXKX4Z+oofA2W54JFo/W2hTpCxCLL0iCpoh92GwZ2eYSVZARyVuUZi A/i3QICBjnLBI13/MWSXIO20Vl9ySDfLdy7jBSTDwMzqqnvmHR79jKBxhzmRqdK9lY2r VZElVyVoXZpaZ9UXzBsH889fAQ7NkblbPFcZcQEdDytI0pGJIIVrMgjKkkzOq7iQmKqW Bnjrko94z54/MTkko1JDQeyGNkUKOBVWQxGRJ329eBHr8eYq7nRq+USTZi3hQG8QZody 9MGbBNLPHb4nHCjMNvdQVTo/k6bW+/ESI7hyZQuR/vTl1tqQodjnBuQGeVaXVXp+byfb lMnA== Received: by 10.43.131.193 with SMTP id hr1mr6453325icc.31.1348861065260; Fri, 28 Sep 2012 12:37:45 -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 q1sm449747igj.15.2012.09.28.12.37.43 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 28 Sep 2012 12:37:44 -0700 (PDT) From: Matt Porter To: Greg Kroah-Hartman , "Hans J. Koch" , Benoit Cousson , Paul Walmsley , Sekhar Nori Cc: Tony Lindgren , Russell King , Linux OMAP List , Linux Kernel Mailing List , Linux ARM Kernel List , Linux DaVinci Kernel List Subject: [PATCH v2 1/7] uio: uio_pruss: replace private SRAM API with genalloc Date: Fri, 28 Sep 2012 15:37:46 -0400 Message-Id: <1348861072-14507-2-git-send-email-mporter@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1348861072-14507-1-git-send-email-mporter@ti.com> References: <1348861072-14507-1-git-send-email-mporter@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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 --- 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..1b55db3 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->l3ram_pool) { + gdev->sram_pool = pdata->l3ram_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..e500fe6 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 *l3ram_pool; }; #endif /* _UIO_PRUSS_H_ */