Haavard Skinnemoen | 5f97f7f | 2006-09-25 23:32:13 -0700 | [diff] [blame] | 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 | |
Haavard Skinnemoen | 5f97f7f | 2006-09-25 23:32:13 -0700 | [diff] [blame] | 14 | #include <asm/arch/init.h> |
Haavard Skinnemoen | 5f97f7f | 2006-09-25 23:32:13 -0700 | [diff] [blame] | 15 | |
| 16 | void __init setup_platform(void) |
| 17 | { |
Haavard Skinnemoen | 5f97f7f | 2006-09-25 23:32:13 -0700 | [diff] [blame] | 18 | at32_clock_init(); |
| 19 | at32_portmux_init(); |
Haavard Skinnemoen | 5f97f7f | 2006-09-25 23:32:13 -0700 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | static int __init pdc_probe(struct platform_device *pdev) |
| 23 | { |
| 24 | struct clk *pclk, *hclk; |
| 25 | |
| 26 | pclk = clk_get(&pdev->dev, "pclk"); |
| 27 | if (IS_ERR(pclk)) { |
| 28 | dev_err(&pdev->dev, "no pclk defined\n"); |
| 29 | return PTR_ERR(pclk); |
| 30 | } |
| 31 | hclk = clk_get(&pdev->dev, "hclk"); |
| 32 | if (IS_ERR(hclk)) { |
| 33 | dev_err(&pdev->dev, "no hclk defined\n"); |
| 34 | clk_put(pclk); |
| 35 | return PTR_ERR(hclk); |
| 36 | } |
| 37 | |
| 38 | clk_enable(pclk); |
| 39 | clk_enable(hclk); |
| 40 | |
| 41 | dev_info(&pdev->dev, "Atmel Peripheral DMA Controller enabled\n"); |
| 42 | return 0; |
| 43 | } |
| 44 | |
| 45 | static struct platform_driver pdc_driver = { |
| 46 | .probe = pdc_probe, |
| 47 | .driver = { |
| 48 | .name = "pdc", |
| 49 | }, |
| 50 | }; |
| 51 | |
| 52 | static int __init pdc_init(void) |
| 53 | { |
| 54 | return platform_driver_register(&pdc_driver); |
| 55 | } |
| 56 | arch_initcall(pdc_init); |