at32ap.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. #include <linux/clk.h>
  9. #include <linux/err.h>
  10. #include <linux/init.h>
  11. #include <linux/platform_device.h>
  12. #include <asm/arch/init.h>
  13. void __init setup_platform(void)
  14. {
  15. at32_clock_init();
  16. at32_portmux_init();
  17. }
  18. static int __init pdc_probe(struct platform_device *pdev)
  19. {
  20. struct clk *pclk, *hclk;
  21. pclk = clk_get(&pdev->dev, "pclk");
  22. if (IS_ERR(pclk)) {
  23. dev_err(&pdev->dev, "no pclk defined\n");
  24. return PTR_ERR(pclk);
  25. }
  26. hclk = clk_get(&pdev->dev, "hclk");
  27. if (IS_ERR(hclk)) {
  28. dev_err(&pdev->dev, "no hclk defined\n");
  29. clk_put(pclk);
  30. return PTR_ERR(hclk);
  31. }
  32. clk_enable(pclk);
  33. clk_enable(hclk);
  34. dev_info(&pdev->dev, "Atmel Peripheral DMA Controller enabled\n");
  35. return 0;
  36. }
  37. static struct platform_driver pdc_driver = {
  38. .probe = pdc_probe,
  39. .driver = {
  40. .name = "pdc",
  41. },
  42. };
  43. static int __init pdc_init(void)
  44. {
  45. return platform_driver_register(&pdc_driver);
  46. }
  47. arch_initcall(pdc_init);