pdc.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. static int __init pdc_probe(struct platform_device *pdev)
  13. {
  14. struct clk *pclk, *hclk;
  15. pclk = clk_get(&pdev->dev, "pclk");
  16. if (IS_ERR(pclk)) {
  17. dev_err(&pdev->dev, "no pclk defined\n");
  18. return PTR_ERR(pclk);
  19. }
  20. hclk = clk_get(&pdev->dev, "hclk");
  21. if (IS_ERR(hclk)) {
  22. dev_err(&pdev->dev, "no hclk defined\n");
  23. clk_put(pclk);
  24. return PTR_ERR(hclk);
  25. }
  26. clk_enable(pclk);
  27. clk_enable(hclk);
  28. dev_info(&pdev->dev, "Atmel Peripheral DMA Controller enabled\n");
  29. return 0;
  30. }
  31. static struct platform_driver pdc_driver = {
  32. .driver = {
  33. .name = "pdc",
  34. },
  35. };
  36. static int __init pdc_init(void)
  37. {
  38. return platform_driver_probe(&pdc_driver, pdc_probe);
  39. }
  40. arch_initcall(pdc_init);