From: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Peter Ujfalusi <peter.ujfalusi-l0cyMroinI0@public.gmane.org>
Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org,
linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
nm-l0cyMroinI0@public.gmane.org
Subject: Re: [PATCH v2 3/7] dmaengine: Add driver for TI DMA crossbar on DRA7x
Date: Thu, 26 Mar 2015 16:26:03 +0530 [thread overview]
Message-ID: <20150326105603.GK32683@intel.com> (raw)
In-Reply-To: <1426080210-841-4-git-send-email-peter.ujfalusi-l0cyMroinI0@public.gmane.org>
On Wed, Mar 11, 2015 at 03:23:26PM +0200, Peter Ujfalusi wrote:
> The DRA7x has more peripherals with DMA requests than the sDMA can handle:
> 205 vs 127. All DMA requests are routed through the DMA crossbar, which can
> be configured to route selected incoming DMA requests to specific sDMA
> request.
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi-l0cyMroinI0@public.gmane.org>
> ---
> drivers/dma/Kconfig | 4 +
> drivers/dma/Makefile | 1 +
> drivers/dma/ti-dma-crossbar.c | 190 ++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 195 insertions(+)
> create mode 100644 drivers/dma/ti-dma-crossbar.c
>
> diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
> index 074ffad334a7..519657a37ca1 100644
> --- a/drivers/dma/Kconfig
> +++ b/drivers/dma/Kconfig
> @@ -247,6 +247,9 @@ config TI_EDMA
> Enable support for the TI EDMA controller. This DMA
> engine is found on TI DaVinci and AM33xx parts.
>
> +config TI_DMA_CROSSBAR
> + bool
> +
> config ARCH_HAS_ASYNC_TX_FIND_CHANNEL
> bool
>
> @@ -332,6 +335,7 @@ config DMA_OMAP
> depends on ARCH_OMAP
> select DMA_ENGINE
> select DMA_VIRTUAL_CHANNELS
> + select TI_DMA_CROSSBAR if SOC_DRA7XX
>
> config DMA_BCM2835
> tristate "BCM2835 DMA engine support"
> diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
> index bf4485800c60..6ec7af6a416c 100644
> --- a/drivers/dma/Makefile
> +++ b/drivers/dma/Makefile
> @@ -39,6 +39,7 @@ obj-$(CONFIG_EP93XX_DMA) += ep93xx_dma.o
> obj-$(CONFIG_DMA_SA11X0) += sa11x0-dma.o
> obj-$(CONFIG_MMP_TDMA) += mmp_tdma.o
> obj-$(CONFIG_DMA_OMAP) += omap-dma.o
> +obj-$(CONFIG_TI_DMA_CROSSBAR) += ti-dma-crossbar.o
> obj-$(CONFIG_DMA_BCM2835) += bcm2835-dma.o
> obj-$(CONFIG_MMP_PDMA) += mmp_pdma.o
> obj-$(CONFIG_DMA_JZ4740) += dma-jz4740.o
> diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c
> new file mode 100644
> index 000000000000..591307bd4370
> --- /dev/null
> +++ b/drivers/dma/ti-dma-crossbar.c
> @@ -0,0 +1,190 @@
> +/*
> + * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com
> + * Author: Peter Ujfalusi <peter.ujfalusi-l0cyMroinI0@public.gmane.org>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + */
> +#include <linux/slab.h>
> +#include <linux/err.h>
> +#include <linux/init.h>
> +#include <linux/list.h>
> +#include <linux/io.h>
> +#include <linux/regmap.h>
> +#include <linux/idr.h>
> +#include <linux/of_address.h>
> +#include <linux/of_device.h>
> +#include <linux/of_dma.h>
> +
> +#define TI_XBAR_OUTPUTS 127
> +#define TI_XBAR_INPUTS 256
Ideally this should be moved to DT. Will next revision of this chip always
support these output and inputs?
> +
> +static DEFINE_IDR(map_idr);
> +
> +struct ti_dma_xbar_data {
> + struct dma_router dmarouter;
> + struct regmap *regmap;
> +
> + uint safe_val; /* Value to rest the crossbar lines */
> + uint xbar_requests; /* number of DMA requests connected to XBAR */
> + uint dma_requests; /* number of DMA requests forwarded to DMA */
> +
> + void __iomem *iomem;
> +};
> +
> +struct ti_dma_xbar_map {
> + int xbar_in;
> + int xbar_out;
> +};
> +
> +static void ti_dma_xbar_free(struct device *dev, void *route_data)
> +{
> + struct ti_dma_xbar_data *xbar = dev_get_drvdata(dev);
> + struct ti_dma_xbar_map *map = route_data;
> +
> + dev_dbg(dev, "Unmapping XBAR%d (was routed to %d)\n",
> + map->xbar_in, map->xbar_out);
> +
> + regmap_write(xbar->regmap, map->xbar_out * 2, 0);
just out of curiosity how much do you save using regmap :)
> +static int ti_dma_xbar_probe(struct platform_device *pdev)
> +{
> + struct device_node *node = pdev->dev.of_node;
> + struct device_node *dma_node;
> + struct ti_dma_xbar_data *xbar;
> + struct resource *res;
> + void __iomem *iomem;
> + int i, ret;
> +
> + if (!node)
> + return -ENODEV;
> +
> + dma_node = of_parse_phandle(node, "dma-device", 0);
> + if (!dma_node) {
> + dev_err(&pdev->dev, "Can't get target DMA node\n");
> + return -ENODEV;
> + }
> +
> + xbar = devm_kzalloc(&pdev->dev, sizeof(*xbar), GFP_KERNEL);
> + if (!xbar)
> + return -ENOMEM;
> +
> + if (of_property_read_u32(dma_node, "dma-requests",
> + &xbar->dma_requests)) {
> + dev_info(&pdev->dev,
> + "Missing XBAR output information, using %u.\n",
> + TI_XBAR_OUTPUTS);
> + xbar->dma_requests = TI_XBAR_OUTPUTS;
> + }
> + of_node_put(dma_node);
_put here?
> +int omap_dmaxbar_init(void)
> +{
> + return platform_driver_register(&ti_dma_xbar_driver);
> +}
> +arch_initcall(omap_dmaxbar_init);
why arch_initcall?
--
~Vinod
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-03-26 10:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-11 13:23 [PATCH v2 0/7] dmaengine/dra7x: DMA router (crossbar support) Peter Ujfalusi
2015-03-11 13:23 ` [PATCH v2 1/7] dmaengine: of_dma: Support for DMA routers Peter Ujfalusi
[not found] ` <1426080210-841-2-git-send-email-peter.ujfalusi-l0cyMroinI0@public.gmane.org>
2015-03-26 10:50 ` Vinod Koul
2015-03-26 12:11 ` Peter Ujfalusi
2015-03-26 15:32 ` Vinod Koul
2015-03-27 12:25 ` Peter Ujfalusi
[not found] ` <55154C39.3030602-l0cyMroinI0@public.gmane.org>
2015-03-30 17:20 ` Vinod Koul
2015-03-11 13:23 ` [PATCH v2 2/7] Documentation: devicetree: dma: Binding documentation for TI DMA crossbar Peter Ujfalusi
2015-03-11 13:23 ` [PATCH v2 3/7] dmaengine: Add driver for TI DMA crossbar on DRA7x Peter Ujfalusi
[not found] ` <1426080210-841-4-git-send-email-peter.ujfalusi-l0cyMroinI0@public.gmane.org>
2015-03-26 10:56 ` Vinod Koul [this message]
2015-03-26 12:31 ` Peter Ujfalusi
[not found] ` <5513FC22.2030304-l0cyMroinI0@public.gmane.org>
2015-03-26 15:22 ` Tony Lindgren
2015-03-26 15:37 ` Vinod Koul
2015-03-11 13:23 ` [PATCH v2 4/7] dmaengine: omap-dma: Use defines for dma channels and request count Peter Ujfalusi
2015-03-26 10:57 ` Vinod Koul
2015-03-26 12:32 ` Peter Ujfalusi
[not found] ` <1426080210-841-1-git-send-email-peter.ujfalusi-l0cyMroinI0@public.gmane.org>
2015-03-11 13:23 ` [PATCH v2 5/7] dmaengine: omap-dma: Take DMA request number from DT if it is available Peter Ujfalusi
2015-03-11 13:23 ` [PATCH v2 6/7] dmaengine: omap-dma: Remove mapping between virtual channels and requests Peter Ujfalusi
2015-03-11 13:23 ` [PATCH v2 7/7] ARM: DTS: dra7x: Integrate sDMA crossbar Peter Ujfalusi
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=20150326105603.GK32683@intel.com \
--to=vinod.koul-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=nm-l0cyMroinI0@public.gmane.org \
--cc=peter.ujfalusi-l0cyMroinI0@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.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).