Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309084
b: refs/heads/master
c: ddd4eec
h: refs/heads/master
v: v3
  • Loading branch information
John Crispin authored and Ralf Baechle committed May 21, 2012
1 parent 6eb066f commit 45a5ab3
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 287e3f3f4e68ca881e3faa413e7aa114fee609d3
refs/heads/master: ddd4eeca961cc6b1d57e0ca2f264403d690b6882
61 changes: 39 additions & 22 deletions trunk/arch/mips/lantiq/xway/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/dma-mapping.h>
#include <linux/export.h>
#include <linux/module.h>
#include <linux/clk.h>

#include <lantiq_soc.h>
#include <xway_dma.h>
Expand Down Expand Up @@ -55,13 +56,6 @@
#define ltq_dma_w32_mask(x, y, z) ltq_w32_mask(x, y, \
ltq_dma_membase + (z))

static struct resource ltq_dma_resource = {
.name = "dma",
.start = LTQ_DMA_BASE_ADDR,
.end = LTQ_DMA_BASE_ADDR + LTQ_DMA_SIZE - 1,
.flags = IORESOURCE_MEM,
};

static void __iomem *ltq_dma_membase;

void
Expand Down Expand Up @@ -215,27 +209,28 @@ ltq_dma_init_port(int p)
}
EXPORT_SYMBOL_GPL(ltq_dma_init_port);

int __init
ltq_dma_init(void)
static int __devinit
ltq_dma_init(struct platform_device *pdev)
{
struct clk *clk;
struct resource *res;
int i;

/* insert and request the memory region */
if (insert_resource(&iomem_resource, &ltq_dma_resource) < 0)
panic("Failed to insert dma memory");

if (request_mem_region(ltq_dma_resource.start,
resource_size(&ltq_dma_resource), "dma") < 0)
panic("Failed to request dma memory");
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
panic("Failed to get dma resource");

/* remap dma register range */
ltq_dma_membase = ioremap_nocache(ltq_dma_resource.start,
resource_size(&ltq_dma_resource));
ltq_dma_membase = devm_request_and_ioremap(&pdev->dev, res);
if (!ltq_dma_membase)
panic("Failed to remap dma memory");
panic("Failed to remap dma resource");

/* power up and reset the dma engine */
ltq_pmu_enable(PMU_DMA);
clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(clk))
panic("Failed to get dma clock");

clk_enable(clk);
ltq_dma_w32_mask(0, DMA_RESET, LTQ_DMA_CTRL);

/* disable all interrupts */
Expand All @@ -248,7 +243,29 @@ ltq_dma_init(void)
ltq_dma_w32(DMA_POLL | DMA_CLK_DIV4, LTQ_DMA_CPOLL);
ltq_dma_w32_mask(DMA_CHAN_ON, 0, LTQ_DMA_CCTRL);
}
dev_info(&pdev->dev, "init done\n");
return 0;
}

postcore_initcall(ltq_dma_init);
static const struct of_device_id dma_match[] = {
{ .compatible = "lantiq,dma-xway" },
{},
};
MODULE_DEVICE_TABLE(of, dma_match);

static struct platform_driver dma_driver = {
.probe = ltq_dma_init,
.driver = {
.name = "dma-xway",
.owner = THIS_MODULE,
.of_match_table = dma_match,
},
};

int __init
dma_init(void)
{
return platform_driver_register(&dma_driver);
}

postcore_initcall(dma_init);

0 comments on commit 45a5ab3

Please sign in to comment.