From: mporter@ti.com (Matt Porter)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 1/7] uio: uio_pruss: replace private SRAM API with genalloc
Date: Thu, 18 Oct 2012 10:53:38 -0400 [thread overview]
Message-ID: <20121018145338.GA25164@beef> (raw)
In-Reply-To: <1349456686-22736-2-git-send-email-mporter@ti.com>
On Fri, Oct 05, 2012 at 01:04:40PM -0400, Matt Porter wrote:
> 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 <mporter@ti.com>
Hans,
Any additional concerns on this patch? Sekhar is holding off on applying
parts 4,5,7 for davinci until this is accepted.
Thanks,
Matt
> ---
> 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 <linux/clk.h>
> #include <linux/dma-mapping.h>
> #include <linux/slab.h>
> -#include <mach/sram.h>
> +#include <linux/genalloc.h>
>
> #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_ */
> --
> 1.7.9.5
>
next prev parent reply other threads:[~2012-10-18 14:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-05 17:04 [PATCH v4 0/7] uio_pruss cleanup and platform support Matt Porter
2012-10-05 17:04 ` [PATCH v4 1/7] uio: uio_pruss: replace private SRAM API with genalloc Matt Porter
2012-10-18 14:53 ` Matt Porter [this message]
2012-10-21 23:15 ` Hans J. Koch
2012-10-05 17:04 ` [PATCH v4 2/7] ARM: davinci: sram: switch from iotable to ioremapped regions Matt Porter
2012-10-05 17:04 ` [PATCH v4 3/7] ARM: davinci: da850: changed SRAM allocator to shared ram Matt Porter
2012-10-05 17:04 ` [PATCH v4 4/7] ARM: davinci: add platform hook to fetch the SRAM pool Matt Porter
2012-10-05 17:04 ` [PATCH v4 5/7] ARM: davinci: add DA850 PRUSS support Matt Porter
2012-10-08 13:53 ` [PATCH v5 5/7] ARM: davinci: da8xx: " Matt Porter
2012-10-05 17:04 ` [PATCH v4 6/7] ARM: davinci: clean up DA850 EVM include ordering Matt Porter
2012-10-08 11:04 ` Sekhar Nori
2012-10-05 17:04 ` [PATCH v4 7/7] ARM: davinci: register pruss_uio device on DA850 EVM Matt Porter
2012-10-08 10:53 ` Sekhar Nori
2012-10-08 11:58 ` Matt Porter
2012-10-08 13:54 ` [PATCH v5 7/7] ARM: davinci: da850 evm: register uio_pruss device Matt Porter
2012-10-25 11:20 ` Sekhar Nori
2012-10-08 10:57 ` [PATCH v4 0/7] uio_pruss cleanup and platform support Sekhar Nori
2012-10-08 12:03 ` Matt Porter
2012-10-24 16:54 ` Matt Porter
2012-10-25 11:38 ` Sekhar Nori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121018145338.GA25164@beef \
--to=mporter@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).