]>
Commit | Line | Data |
---|---|---|
e7300d04 MB |
1 | /* |
2 | * Broadcom BCM63xx VoIP DSP registration | |
3 | * | |
4 | * This file is subject to the terms and conditions of the GNU General Public | |
5 | * License. See the file "COPYING" in the main directory of this archive | |
6 | * for more details. | |
7 | * | |
8 | * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org> | |
9 | */ | |
10 | ||
11 | #include <linux/init.h> | |
12 | #include <linux/kernel.h> | |
13 | #include <linux/platform_device.h> | |
14 | ||
15 | #include <bcm63xx_cpu.h> | |
16 | #include <bcm63xx_dev_dsp.h> | |
17 | #include <bcm63xx_regs.h> | |
18 | #include <bcm63xx_io.h> | |
19 | ||
20 | static struct resource voip_dsp_resources[] = { | |
21 | { | |
22 | .start = -1, /* filled at runtime */ | |
23 | .end = -1, /* filled at runtime */ | |
24 | .flags = IORESOURCE_MEM, | |
25 | }, | |
26 | { | |
27 | .start = -1, /* filled at runtime */ | |
28 | .flags = IORESOURCE_IRQ, | |
29 | }, | |
30 | }; | |
31 | ||
32 | static struct platform_device bcm63xx_voip_dsp_device = { | |
33 | .name = "bcm63xx-voip-dsp", | |
34 | .id = 0, | |
35 | .num_resources = ARRAY_SIZE(voip_dsp_resources), | |
36 | .resource = voip_dsp_resources, | |
37 | }; | |
38 | ||
39 | int __init bcm63xx_dsp_register(const struct bcm63xx_dsp_platform_data *pd) | |
40 | { | |
41 | struct bcm63xx_dsp_platform_data *dpd; | |
42 | u32 val; | |
43 | ||
44 | /* Get the memory window */ | |
45 | val = bcm_mpi_readl(MPI_CSBASE_REG(pd->cs - 1)); | |
46 | val &= MPI_CSBASE_BASE_MASK; | |
47 | voip_dsp_resources[0].start = val; | |
48 | voip_dsp_resources[0].end = val + 0xFFFFFFF; | |
49 | voip_dsp_resources[1].start = pd->ext_irq; | |
50 | ||
51 | /* copy given platform data */ | |
52 | dpd = bcm63xx_voip_dsp_device.dev.platform_data; | |
53 | memcpy(dpd, pd, sizeof (*pd)); | |
54 | ||
55 | return platform_device_register(&bcm63xx_voip_dsp_device); | |
56 | } |