pdc.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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);