dsp.c 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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/platform_device.h>
  20. #include "cm2xxx_3xxx.h"
  21. #include "prm2xxx_3xxx.h"
  22. #ifdef CONFIG_BRIDGE_DVFS
  23. #include <plat/omap-pm.h>
  24. #endif
  25. #include <plat/dsp.h>
  26. extern phys_addr_t omap_dsp_get_mempool_base(void);
  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 int __init omap_dsp_init(void)
  43. {
  44. struct platform_device *pdev;
  45. int err = -ENOMEM;
  46. struct omap_dsp_platform_data *pdata = &omap_dsp_pdata;
  47. pdata->phys_mempool_base = omap_dsp_get_mempool_base();
  48. if (pdata->phys_mempool_base) {
  49. pdata->phys_mempool_size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
  50. pr_info("%s: %x bytes @ %x\n", __func__,
  51. pdata->phys_mempool_size, pdata->phys_mempool_base);
  52. }
  53. pdev = platform_device_alloc("omap-dsp", -1);
  54. if (!pdev)
  55. goto err_out;
  56. err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
  57. if (err)
  58. goto err_out;
  59. err = platform_device_add(pdev);
  60. if (err)
  61. goto err_out;
  62. omap_dsp_pdev = pdev;
  63. return 0;
  64. err_out:
  65. platform_device_put(pdev);
  66. return err;
  67. }
  68. module_init(omap_dsp_init);
  69. static void __exit omap_dsp_exit(void)
  70. {
  71. platform_device_unregister(omap_dsp_pdev);
  72. }
  73. module_exit(omap_dsp_exit);
  74. MODULE_AUTHOR("Hiroshi DOYU");
  75. MODULE_DESCRIPTION("TI's OMAP DSP platform device registration");
  76. MODULE_LICENSE("GPL");