~ubuntu-branches/ubuntu/saucy/linux-ti-omap4/saucy-proposed

« back to all changes in this revision

Viewing changes to arch/mips/lantiq/xway/dma.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Stefan Bader, Upstream Kernel Changes
  • Date: 2012-08-15 17:17:43 UTC
  • Revision ID: package-import@ubuntu.com-20120815171743-h5wnuf51xe7pvdid
Tags: 3.5.0-207.13
[ Paolo Pisati ]

* Start new release

[ Stefan Bader ]

* (config) Enable getabis to use local package copies

[ Upstream Kernel Changes ]

* fixup: gargabe collect iva_seq[0|1] init
* [Config] enable all SND_OMAP_SOC_*s
* fixup: cm2xxx_3xxx.o is needed for omap2_cm_read|write_reg
* fixup: add some snd_soc_dai* helper functions
* fixup: s/snd_soc_dpcm_params/snd_soc_dpcm/g
* fixup: typo, no_host_mode and useless SDP4430 init
* fixup: enable again aess hwmod

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include <linux/platform_device.h>
20
20
#include <linux/io.h>
21
21
#include <linux/dma-mapping.h>
22
 
#include <linux/export.h>
 
22
#include <linux/module.h>
 
23
#include <linux/clk.h>
23
24
 
24
25
#include <lantiq_soc.h>
25
26
#include <xway_dma.h>
55
56
#define ltq_dma_w32_mask(x, y, z)       ltq_w32_mask(x, y, \
56
57
                                                ltq_dma_membase + (z))
57
58
 
58
 
static struct resource ltq_dma_resource = {
59
 
        .name   = "dma",
60
 
        .start  = LTQ_DMA_BASE_ADDR,
61
 
        .end    = LTQ_DMA_BASE_ADDR + LTQ_DMA_SIZE - 1,
62
 
        .flags  = IORESOURCE_MEM,
63
 
};
64
 
 
65
59
static void __iomem *ltq_dma_membase;
66
60
 
67
61
void
215
209
}
216
210
EXPORT_SYMBOL_GPL(ltq_dma_init_port);
217
211
 
218
 
int __init
219
 
ltq_dma_init(void)
 
212
static int __devinit
 
213
ltq_dma_init(struct platform_device *pdev)
220
214
{
 
215
        struct clk *clk;
 
216
        struct resource *res;
221
217
        int i;
222
218
 
223
 
        /* insert and request the memory region */
224
 
        if (insert_resource(&iomem_resource, &ltq_dma_resource) < 0)
225
 
                panic("Failed to insert dma memory");
226
 
 
227
 
        if (request_mem_region(ltq_dma_resource.start,
228
 
                        resource_size(&ltq_dma_resource), "dma") < 0)
229
 
                panic("Failed to request dma memory");
 
219
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
220
        if (!res)
 
221
                panic("Failed to get dma resource");
230
222
 
231
223
        /* remap dma register range */
232
 
        ltq_dma_membase = ioremap_nocache(ltq_dma_resource.start,
233
 
                                resource_size(&ltq_dma_resource));
 
224
        ltq_dma_membase = devm_request_and_ioremap(&pdev->dev, res);
234
225
        if (!ltq_dma_membase)
235
 
                panic("Failed to remap dma memory");
 
226
                panic("Failed to remap dma resource");
236
227
 
237
228
        /* power up and reset the dma engine */
238
 
        ltq_pmu_enable(PMU_DMA);
 
229
        clk = clk_get(&pdev->dev, NULL);
 
230
        if (IS_ERR(clk))
 
231
                panic("Failed to get dma clock");
 
232
 
 
233
        clk_enable(clk);
239
234
        ltq_dma_w32_mask(0, DMA_RESET, LTQ_DMA_CTRL);
240
235
 
241
236
        /* disable all interrupts */
248
243
                ltq_dma_w32(DMA_POLL | DMA_CLK_DIV4, LTQ_DMA_CPOLL);
249
244
                ltq_dma_w32_mask(DMA_CHAN_ON, 0, LTQ_DMA_CCTRL);
250
245
        }
 
246
        dev_info(&pdev->dev, "init done\n");
251
247
        return 0;
252
248
}
253
249
 
254
 
postcore_initcall(ltq_dma_init);
 
250
static const struct of_device_id dma_match[] = {
 
251
        { .compatible = "lantiq,dma-xway" },
 
252
        {},
 
253
};
 
254
MODULE_DEVICE_TABLE(of, dma_match);
 
255
 
 
256
static struct platform_driver dma_driver = {
 
257
        .probe = ltq_dma_init,
 
258
        .driver = {
 
259
                .name = "dma-xway",
 
260
                .owner = THIS_MODULE,
 
261
                .of_match_table = dma_match,
 
262
        },
 
263
};
 
264
 
 
265
int __init
 
266
dma_init(void)
 
267
{
 
268
        return platform_driver_register(&dma_driver);
 
269
}
 
270
 
 
271
postcore_initcall(dma_init);