dsp.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. /*
  14. * XXX The function pointers to the PRM/CM functions are incorrect and
  15. * should be removed. No device driver should be changing PRM/CM bits
  16. * directly; that's a layering violation -- those bits are the responsibility
  17. * of the OMAP PM core code.
  18. */
  19. #include <linux/module.h>
  20. #include <linux/platform_device.h>
  21. #include "cm2xxx_3xxx.h"
  22. #include "prm2xxx_3xxx.h"
  23. #ifdef CONFIG_BRIDGE_DVFS
  24. #include <plat/omap-pm.h>
  25. #endif
  26. #include <plat/dsp.h>
  27. extern phys_addr_t omap_dsp_get_mempool_base(void);
  28. static struct platform_device *omap_dsp_pdev;
  29. static struct omap_dsp_platform_data omap_dsp_pdata __initdata = {
  30. #ifdef CONFIG_BRIDGE_DVFS
  31. .dsp_set_min_opp = omap_pm_dsp_set_min_opp,
  32. .dsp_get_opp = omap_pm_dsp_get_opp,
  33. .cpu_set_freq = omap_pm_cpu_set_freq,
  34. .cpu_get_freq = omap_pm_cpu_get_freq,
  35. #endif
  36. .dsp_prm_read = omap2_prm_read_mod_reg,
  37. .dsp_prm_write = omap2_prm_write_mod_reg,
  38. .dsp_prm_rmw_bits = omap2_prm_rmw_mod_reg_bits,
  39. .dsp_cm_read = omap2_cm_read_mod_reg,
  40. .dsp_cm_write = omap2_cm_write_mod_reg,
  41. .dsp_cm_rmw_bits = omap2_cm_rmw_mod_reg_bits,
  42. };
  43. static int __init omap_dsp_init(void)
  44. {
  45. struct platform_device *pdev;
  46. int err = -ENOMEM;
  47. struct omap_dsp_platform_data *pdata = &omap_dsp_pdata;
  48. pdata->phys_mempool_base = omap_dsp_get_mempool_base();
  49. if (pdata->phys_mempool_base) {
  50. pdata->phys_mempool_size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
  51. pr_info("%s: %x bytes @ %x\n", __func__,
  52. pdata->phys_mempool_size, pdata->phys_mempool_base);
  53. }
  54. pdev = platform_device_alloc("omap-dsp", -1);
  55. if (!pdev)
  56. goto err_out;
  57. err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
  58. if (err)
  59. goto err_out;
  60. err = platform_device_add(pdev);
  61. if (err)
  62. goto err_out;
  63. omap_dsp_pdev = pdev;
  64. return 0;
  65. err_out:
  66. platform_device_put(pdev);
  67. return err;
  68. }
  69. module_init(omap_dsp_init);
  70. static void __exit omap_dsp_exit(void)
  71. {
  72. platform_device_unregister(omap_dsp_pdev);
  73. }
  74. module_exit(omap_dsp_exit);
  75. MODULE_AUTHOR("Hiroshi DOYU");
  76. MODULE_DESCRIPTION("TI's OMAP DSP platform device registration");
  77. MODULE_LICENSE("GPL");