dsp.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. static struct platform_device *omap_dsp_pdev;
  28. static struct omap_dsp_platform_data omap_dsp_pdata __initdata = {
  29. #ifdef CONFIG_BRIDGE_DVFS
  30. .dsp_set_min_opp = omap_pm_dsp_set_min_opp,
  31. .dsp_get_opp = omap_pm_dsp_get_opp,
  32. .cpu_set_freq = omap_pm_cpu_set_freq,
  33. .cpu_get_freq = omap_pm_cpu_get_freq,
  34. #endif
  35. .dsp_prm_read = omap2_prm_read_mod_reg,
  36. .dsp_prm_write = omap2_prm_write_mod_reg,
  37. .dsp_prm_rmw_bits = omap2_prm_rmw_mod_reg_bits,
  38. .dsp_cm_read = omap2_cm_read_mod_reg,
  39. .dsp_cm_write = omap2_cm_write_mod_reg,
  40. .dsp_cm_rmw_bits = omap2_cm_rmw_mod_reg_bits,
  41. };
  42. static phys_addr_t omap_dsp_phys_mempool_base;
  43. void __init omap_dsp_reserve_sdram_memblock(void)
  44. {
  45. phys_addr_t size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
  46. phys_addr_t paddr;
  47. if (!size)
  48. return;
  49. paddr = arm_memblock_steal(size, SZ_1M);
  50. if (!paddr) {
  51. pr_err("%s: failed to reserve %llx bytes\n",
  52. __func__, (unsigned long long)size);
  53. return;
  54. }
  55. omap_dsp_phys_mempool_base = paddr;
  56. }
  57. static phys_addr_t omap_dsp_get_mempool_base(void)
  58. {
  59. return omap_dsp_phys_mempool_base;
  60. }
  61. static int __init omap_dsp_init(void)
  62. {
  63. struct platform_device *pdev;
  64. int err = -ENOMEM;
  65. struct omap_dsp_platform_data *pdata = &omap_dsp_pdata;
  66. pdata->phys_mempool_base = omap_dsp_get_mempool_base();
  67. if (pdata->phys_mempool_base) {
  68. pdata->phys_mempool_size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
  69. pr_info("%s: %llx bytes @ %llx\n", __func__,
  70. (unsigned long long)pdata->phys_mempool_size,
  71. (unsigned long long)pdata->phys_mempool_base);
  72. }
  73. pdev = platform_device_alloc("omap-dsp", -1);
  74. if (!pdev)
  75. goto err_out;
  76. err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
  77. if (err)
  78. goto err_out;
  79. err = platform_device_add(pdev);
  80. if (err)
  81. goto err_out;
  82. omap_dsp_pdev = pdev;
  83. return 0;
  84. err_out:
  85. platform_device_put(pdev);
  86. return err;
  87. }
  88. module_init(omap_dsp_init);
  89. static void __exit omap_dsp_exit(void)
  90. {
  91. platform_device_unregister(omap_dsp_pdev);
  92. }
  93. module_exit(omap_dsp_exit);
  94. MODULE_AUTHOR("Hiroshi DOYU");
  95. MODULE_DESCRIPTION("TI's OMAP DSP platform device registration");
  96. MODULE_LICENSE("GPL");