PCI: i386: traps, change VENDOR to DEVICE
[wrt350n-kernel.git] / arch / avr32 / mach-at32ap / at32ap.c
blob90f207e8e96d809c1e14ac3348e90772e1d87826
1 /*
2 * Copyright (C) 2006 Atmel Corporation
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 */
9 #include <linux/clk.h>
10 #include <linux/err.h>
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
14 #include <asm/io.h>
16 #include <asm/arch/init.h>
17 #include <asm/arch/sm.h>
19 struct at32_sm system_manager;
21 static int __init at32_sm_init(void)
23 struct resource *regs;
24 struct at32_sm *sm = &system_manager;
25 int ret = -ENXIO;
27 regs = platform_get_resource(&at32_sm_device, IORESOURCE_MEM, 0);
28 if (!regs)
29 goto fail;
31 spin_lock_init(&sm->lock);
32 sm->pdev = &at32_sm_device;
34 ret = -ENOMEM;
35 sm->regs = ioremap(regs->start, regs->end - regs->start + 1);
36 if (!sm->regs)
37 goto fail;
39 return 0;
41 fail:
42 printk(KERN_ERR "Failed to initialize System Manager: %d\n", ret);
43 return ret;
46 void __init setup_platform(void)
48 at32_sm_init();
49 at32_clock_init();
50 at32_portmux_init();
53 static int __init pdc_probe(struct platform_device *pdev)
55 struct clk *pclk, *hclk;
57 pclk = clk_get(&pdev->dev, "pclk");
58 if (IS_ERR(pclk)) {
59 dev_err(&pdev->dev, "no pclk defined\n");
60 return PTR_ERR(pclk);
62 hclk = clk_get(&pdev->dev, "hclk");
63 if (IS_ERR(hclk)) {
64 dev_err(&pdev->dev, "no hclk defined\n");
65 clk_put(pclk);
66 return PTR_ERR(hclk);
69 clk_enable(pclk);
70 clk_enable(hclk);
72 dev_info(&pdev->dev, "Atmel Peripheral DMA Controller enabled\n");
73 return 0;
76 static struct platform_driver pdc_driver = {
77 .probe = pdc_probe,
78 .driver = {
79 .name = "pdc",
83 static int __init pdc_init(void)
85 return platform_driver_register(&pdc_driver);
87 arch_initcall(pdc_init);