dsp.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * TI's OMAP DSP platform device registration
  3. *
  4. * Copyright (C) 2005-2006 Texas Instruments, Inc.
  5. * Copyright (C) 2009 Nokia Corporation
  6. *
  7. * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/platform_device.h>
  14. #include "prm.h"
  15. #include "cm.h"
  16. #ifdef CONFIG_BRIDGE_DVFS
  17. #include <plat/omap-pm.h>
  18. #endif
  19. #include <plat/dsp.h>
  20. extern phys_addr_t omap_dsp_get_mempool_base(void);
  21. static struct platform_device *omap_dsp_pdev;
  22. static struct omap_dsp_platform_data omap_dsp_pdata __initdata = {
  23. #ifdef CONFIG_BRIDGE_DVFS
  24. .dsp_set_min_opp = omap_pm_dsp_set_min_opp,
  25. .dsp_get_opp = omap_pm_dsp_get_opp,
  26. .cpu_set_freq = omap_pm_cpu_set_freq,
  27. .cpu_get_freq = omap_pm_cpu_get_freq,
  28. #endif
  29. .dsp_prm_read = prm_read_mod_reg,
  30. .dsp_prm_write = prm_write_mod_reg,
  31. .dsp_prm_rmw_bits = prm_rmw_mod_reg_bits,
  32. .dsp_cm_read = cm_read_mod_reg,
  33. .dsp_cm_write = cm_write_mod_reg,
  34. .dsp_cm_rmw_bits = cm_rmw_mod_reg_bits,
  35. };
  36. static int __init omap_dsp_init(void)
  37. {
  38. struct platform_device *pdev;
  39. int err = -ENOMEM;
  40. struct omap_dsp_platform_data *pdata = &omap_dsp_pdata;
  41. pdata->phys_mempool_base = omap_dsp_get_mempool_base();
  42. if (pdata->phys_mempool_base) {
  43. pdata->phys_mempool_size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
  44. pr_info("%s: %x bytes @ %x\n", __func__,
  45. pdata->phys_mempool_size, pdata->phys_mempool_base);
  46. }
  47. pdev = platform_device_alloc("omap-dsp", -1);
  48. if (!pdev)
  49. goto err_out;
  50. err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
  51. if (err)
  52. goto err_out;
  53. err = platform_device_add(pdev);
  54. if (err)
  55. goto err_out;
  56. omap_dsp_pdev = pdev;
  57. return 0;
  58. err_out:
  59. platform_device_put(pdev);
  60. return err;
  61. }
  62. module_init(omap_dsp_init);
  63. static void __exit omap_dsp_exit(void)
  64. {
  65. platform_device_unregister(omap_dsp_pdev);
  66. }
  67. module_exit(omap_dsp_exit);
  68. MODULE_AUTHOR("Hiroshi DOYU");
  69. MODULE_DESCRIPTION("TI's OMAP DSP platform device registration");
  70. MODULE_LICENSE("GPL");