On 08/04/14 09:04, Shevchenko, Andriy wrote:
On Mon, 2014-04-07 at 21:07 +0100, Ben Dooks wrote:
Add support for building shdma internal data from the device tree to allow
converting the driver to be device tree enabled.
It includes a helper for the of case to build the internal data used to
select and filter out the DMA channels from the ID information in the
device tree. Also updates the documentation for the DT case.
Few minor comments below.
--- a/drivers/dma/sh/shdma-of.c
+++ b/drivers/dma/sh/shdma-of.c
@@ -40,6 +71,109 @@ static struct dma_chan *shdma_of_xlate(struct of_phandle_args *dma_spec,
return chan;
}
+const struct sh_dmae_pdata *
+sh_dma_probe_of(struct platform_device *pdev, const struct of_device_id *ofmatch)
+{
+ const struct device_node *np = pdev->dev.of_node;
+ const struct sh_dmae_of_info *ofinf;
+ struct device *dev = &pdev->dev;
+ struct sh_dmae_pdata *pdata;
+ struct sh_dmae_channel *chan;
+ struct property *prop;
+ u32 nr_chan;
+ unsigned ch;
+ int ret;
+ int len;
+
+ if (!ofmatch)
+ return NULL;
+
+ ofinf = ofmatch->data;
+
+ pdata = devm_kzalloc(dev, sizeof(struct sh_dmae_pdata), GFP_KERNEL);
sizeof(*pdata) ?
I will think on this one.
+ if (!pdata) {
+ dev_err(dev, "failed to make platform data\n");
+ return NULL;
+ }
+
+ *pdata = *ofinf->pdata_template; /* copy in template first */
+
+ ret = of_property_read_u32(np, "dma-channels", &nr_chan);
+ if (ret < 0) {
+ dev_err(dev, "failed to get number of channels\n");
+ return NULL;
+ }
+
+ chan = devm_kzalloc(dev, nr_chan * sizeof(struct sh_dmae_channel),
+ GFP_KERNEL);
devm_kcalloc()
Thanks.
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html