LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: tony@atomide.com, linux@arm.linux.org.uk,
	grant.likely@linaro.org, dmaengine@vger.kernel.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	robh+dt@kernel.org, nm@ti.com
Subject: Re: [PATCH v2 3/7] dmaengine: Add driver for TI DMA crossbar on DRA7x
Date: Thu, 26 Mar 2015 21:07:27 +0530	[thread overview]
Message-ID: <20150326153727.GN32683@intel.com> (raw)
In-Reply-To: <5513FC22.2030304@ti.com>

On Thu, Mar 26, 2015 at 02:31:30PM +0200, Peter Ujfalusi wrote:
> On 03/26/2015 12:56 PM, Vinod Koul wrote:
> >> +#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?
> 
> They are coming from DT. I'm using these as fall back values in case we can
> not get this from DT and a warning will be printed in case if this unlikely
> event happens.
Oops missed, that. Looks fine then

> 
> >> +
> >> +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 :)
> 
> good point, not much I guess. I had it implemented w/o regmap as well, but
> thought why not use regmap if it is available.
Yes but there is overhead involved in setting it up. I though you have some
latency issues. It is okay to have it :)
Cache is anyways fastest :)

> >> +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?
> 
> The code takes the real dma controller's node and it should be put back after
> I have got the information I needed from it (number of DMA requests).
> 
> > 
> >> +int omap_dmaxbar_init(void)
> >> +{
> >> +	return platform_driver_register(&ti_dma_xbar_driver);
> >> +}
> >> +arch_initcall(omap_dmaxbar_init);
> > why arch_initcall?
> 
> It should be on the same init level as the real DMA controller. omap-dma at
> the moment, but in some platforms this can work with the edma as well.
> Since all device in the system (well most of them anyway) uses DMA it is
> better to not delay their probe with deferring because the crossbar driver is
> still not loaded
Deferring if resources not available is the right thing and helps you get rid
of init level ordering magic...

-- 
~Vinod


  parent reply	other threads:[~2015-03-26 15:42 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
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
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
2015-03-26 10:56   ` Vinod Koul
2015-03-26 12:31     ` Peter Ujfalusi
2015-03-26 15:22       ` Tony Lindgren
2015-03-26 15:37       ` Vinod Koul [this message]
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
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=20150326153727.GN32683@intel.com \
    --to=vinod.koul@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=nm@ti.com \
    --cc=peter.ujfalusi@ti.com \
    --cc=robh+dt@kernel.org \
    --cc=tony@atomide.com \
    /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).