]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blob - arch/avr32/mach-at32ap/at32ap.c
Merge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6
[mirror_ubuntu-hirsute-kernel.git] / arch / avr32 / mach-at32ap / at32ap.c
1 /*
2 * Copyright (C) 2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9 #include <linux/clk.h>
10 #include <linux/err.h>
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
13
14 #include <asm/io.h>
15
16 #include <asm/arch/init.h>
17 #include <asm/arch/sm.h>
18
19 struct at32_sm system_manager;
20
21 static int __init at32_sm_init(void)
22 {
23 struct resource *regs;
24 struct at32_sm *sm = &system_manager;
25 int ret = -ENXIO;
26
27 regs = platform_get_resource(&at32_sm_device, IORESOURCE_MEM, 0);
28 if (!regs)
29 goto fail;
30
31 spin_lock_init(&sm->lock);
32 sm->pdev = &at32_sm_device;
33
34 ret = -ENOMEM;
35 sm->regs = ioremap(regs->start, regs->end - regs->start + 1);
36 if (!sm->regs)
37 goto fail;
38
39 return 0;
40
41 fail:
42 printk(KERN_ERR "Failed to initialize System Manager: %d\n", ret);
43 return ret;
44 }
45
46 void __init setup_platform(void)
47 {
48 at32_sm_init();
49 at32_clock_init();
50 at32_portmux_init();
51
52 /* FIXME: This doesn't belong here */
53 at32_setup_serial_console(1);
54 }
55
56 static int __init pdc_probe(struct platform_device *pdev)
57 {
58 struct clk *pclk, *hclk;
59
60 pclk = clk_get(&pdev->dev, "pclk");
61 if (IS_ERR(pclk)) {
62 dev_err(&pdev->dev, "no pclk defined\n");
63 return PTR_ERR(pclk);
64 }
65 hclk = clk_get(&pdev->dev, "hclk");
66 if (IS_ERR(hclk)) {
67 dev_err(&pdev->dev, "no hclk defined\n");
68 clk_put(pclk);
69 return PTR_ERR(hclk);
70 }
71
72 clk_enable(pclk);
73 clk_enable(hclk);
74
75 dev_info(&pdev->dev, "Atmel Peripheral DMA Controller enabled\n");
76 return 0;
77 }
78
79 static struct platform_driver pdc_driver = {
80 .probe = pdc_probe,
81 .driver = {
82 .name = "pdc",
83 },
84 };
85
86 static int __init pdc_init(void)
87 {
88 return platform_driver_register(&pdc_driver);
89 }
90 arch_initcall(pdc_init);