コード例 #1
0
static int bcm_dmaman_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct vc_dmaman *dmaman;
	struct resource *r;
	void __iomem *dma_base;
	uint32_t val;

	if (!of_property_read_u32(dev->of_node,
				  "brcm,dma-channel-mask", &val))
		dmachans = val;
	else if (dmachans == -1)
		dmachans = DEFAULT_DMACHAN_BITMAP;

	dmaman = devm_kzalloc(dev, sizeof(*dmaman), GFP_KERNEL);
	if (!dmaman)
		return -ENOMEM;

	mutex_init(&dmaman->lock);
	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	dma_base = devm_ioremap_resource(dev, r);
	if (IS_ERR(dma_base))
		return PTR_ERR(dma_base);

	vc_dmaman_init(dmaman, dma_base, dmachans);
	g_dmaman = dmaman;
	dmaman_dev = dev;

	dev_info(dev, "DMA legacy API manager at %p, dmachans=0x%x\n",
		 dma_base, dmachans);

	return 0;
}
コード例 #2
0
int bcm_dmaman_probe(struct platform_device *pdev, void __iomem *base,
		     u32 chans_available)
{
	struct device *dev = &pdev->dev;
	struct vc_dmaman *dmaman;

	dmaman = devm_kzalloc(dev, sizeof(*dmaman), GFP_KERNEL);
	if (!dmaman)
		return -ENOMEM;

	mutex_init(&dmaman->lock);
	vc_dmaman_init(dmaman, base, chans_available);
	g_dmaman = dmaman;
	dmaman_dev = dev;

	dev_info(dev, "DMA legacy API manager at %p, dmachans=0x%x\n",
		 base, chans_available);

	return 0;
}