dev-dsp.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Broadcom BCM63xx VoIP DSP registration
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org>
  9. */
  10. #include <linux/init.h>
  11. #include <linux/kernel.h>
  12. #include <linux/platform_device.h>
  13. #include <bcm63xx_cpu.h>
  14. #include <bcm63xx_dev_dsp.h>
  15. #include <bcm63xx_regs.h>
  16. #include <bcm63xx_io.h>
  17. static struct resource voip_dsp_resources[] = {
  18. {
  19. .start = -1, /* filled at runtime */
  20. .end = -1, /* filled at runtime */
  21. .flags = IORESOURCE_MEM,
  22. },
  23. {
  24. .start = -1, /* filled at runtime */
  25. .flags = IORESOURCE_IRQ,
  26. },
  27. };
  28. static struct platform_device bcm63xx_voip_dsp_device = {
  29. .name = "bcm63xx-voip-dsp",
  30. .id = -1,
  31. .num_resources = ARRAY_SIZE(voip_dsp_resources),
  32. .resource = voip_dsp_resources,
  33. };
  34. int __init bcm63xx_dsp_register(const struct bcm63xx_dsp_platform_data *pd)
  35. {
  36. struct bcm63xx_dsp_platform_data *dpd;
  37. u32 val;
  38. /* Get the memory window */
  39. val = bcm_mpi_readl(MPI_CSBASE_REG(pd->cs - 1));
  40. val &= MPI_CSBASE_BASE_MASK;
  41. voip_dsp_resources[0].start = val;
  42. voip_dsp_resources[0].end = val + 0xFFFFFFF;
  43. voip_dsp_resources[1].start = pd->ext_irq;
  44. /* copy given platform data */
  45. dpd = bcm63xx_voip_dsp_device.dev.platform_data;
  46. memcpy(dpd, pd, sizeof (*pd));
  47. return platform_device_register(&bcm63xx_voip_dsp_device);
  48. }