diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2011-12-15 05:49:43 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2011-12-18 18:35:06 -0500 |
commit | ebe6c6fe60683e951ff52803c6d126480a970df5 (patch) | |
tree | 25aebc86e87f5792cb2b97ae9c21e6630ee3dd84 /arch/arm/mach-ux500/cpu-db5500.c | |
parent | d5608bbf81987375ced3802374b145e148140b33 (diff) |
ARM: ux500: register DB5500 PMU dynamically
Use platform_device_register_simple() rather than a static
struct, so we create and register the PMU device on-the-fly.
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm/mach-ux500/cpu-db5500.c')
-rw-r--r-- | arch/arm/mach-ux500/cpu-db5500.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/arch/arm/mach-ux500/cpu-db5500.c b/arch/arm/mach-ux500/cpu-db5500.c index 9de1af008094..8187909c29ef 100644 --- a/arch/arm/mach-ux500/cpu-db5500.c +++ b/arch/arm/mach-ux500/cpu-db5500.c | |||
@@ -47,26 +47,6 @@ static struct map_desc u5500_io_desc[] __initdata = { | |||
47 | __IO_DEV_DESC(U5500_PRCMU_TCDM_BASE, SZ_4K), | 47 | __IO_DEV_DESC(U5500_PRCMU_TCDM_BASE, SZ_4K), |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static struct resource db5500_pmu_resources[] = { | ||
51 | [0] = { | ||
52 | .start = IRQ_DB5500_PMU0, | ||
53 | .end = IRQ_DB5500_PMU0, | ||
54 | .flags = IORESOURCE_IRQ, | ||
55 | }, | ||
56 | [1] = { | ||
57 | .start = IRQ_DB5500_PMU1, | ||
58 | .end = IRQ_DB5500_PMU1, | ||
59 | .flags = IORESOURCE_IRQ, | ||
60 | }, | ||
61 | }; | ||
62 | |||
63 | static struct platform_device db5500_pmu_device = { | ||
64 | .name = "arm-pmu", | ||
65 | .id = ARM_PMU_DEVICE_CPU, | ||
66 | .num_resources = ARRAY_SIZE(db5500_pmu_resources), | ||
67 | .resource = db5500_pmu_resources, | ||
68 | }; | ||
69 | |||
70 | static struct resource mbox0_resources[] = { | 50 | static struct resource mbox0_resources[] = { |
71 | { | 51 | { |
72 | .name = "mbox_peer", | 52 | .name = "mbox_peer", |
@@ -152,7 +132,6 @@ static struct platform_device mbox2_device = { | |||
152 | }; | 132 | }; |
153 | 133 | ||
154 | static struct platform_device *db5500_platform_devs[] __initdata = { | 134 | static struct platform_device *db5500_platform_devs[] __initdata = { |
155 | &db5500_pmu_device, | ||
156 | &mbox0_device, | 135 | &mbox0_device, |
157 | &mbox1_device, | 136 | &mbox1_device, |
158 | &mbox2_device, | 137 | &mbox2_device, |
@@ -193,6 +172,25 @@ void __init u5500_map_io(void) | |||
193 | _PRCMU_BASE = __io_address(U5500_PRCMU_BASE); | 172 | _PRCMU_BASE = __io_address(U5500_PRCMU_BASE); |
194 | } | 173 | } |
195 | 174 | ||
175 | static void __init db5500_pmu_init(void) | ||
176 | { | ||
177 | struct resource res[] = { | ||
178 | [0] = { | ||
179 | .start = IRQ_DB5500_PMU0, | ||
180 | .end = IRQ_DB5500_PMU0, | ||
181 | .flags = IORESOURCE_IRQ, | ||
182 | }, | ||
183 | [1] = { | ||
184 | .start = IRQ_DB5500_PMU1, | ||
185 | .end = IRQ_DB5500_PMU1, | ||
186 | .flags = IORESOURCE_IRQ, | ||
187 | }, | ||
188 | }; | ||
189 | |||
190 | platform_device_register_simple("arm-pmu", ARM_PMU_DEVICE_CPU, | ||
191 | res, ARRAY_SIZE(res)); | ||
192 | } | ||
193 | |||
196 | static int usb_db5500_rx_dma_cfg[] = { | 194 | static int usb_db5500_rx_dma_cfg[] = { |
197 | DB5500_DMA_DEV4_USB_OTG_IEP_1_9, | 195 | DB5500_DMA_DEV4_USB_OTG_IEP_1_9, |
198 | DB5500_DMA_DEV5_USB_OTG_IEP_2_10, | 196 | DB5500_DMA_DEV5_USB_OTG_IEP_2_10, |
@@ -218,6 +216,7 @@ static int usb_db5500_tx_dma_cfg[] = { | |||
218 | void __init u5500_init_devices(void) | 216 | void __init u5500_init_devices(void) |
219 | { | 217 | { |
220 | db5500_add_gpios(); | 218 | db5500_add_gpios(); |
219 | db5500_pmu_init(); | ||
221 | db5500_dma_init(); | 220 | db5500_dma_init(); |
222 | db5500_add_rtc(); | 221 | db5500_add_rtc(); |
223 | db5500_add_usb(usb_db5500_rx_dma_cfg, usb_db5500_tx_dma_cfg); | 222 | db5500_add_usb(usb_db5500_rx_dma_cfg, usb_db5500_tx_dma_cfg); |