dev-hsspi.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2012 Jonas Gorski <jonas.gorski@gmail.com>
  7. */
  8. #include <linux/init.h>
  9. #include <linux/kernel.h>
  10. #include <linux/platform_device.h>
  11. #include <bcm63xx_cpu.h>
  12. #include <bcm63xx_dev_hsspi.h>
  13. #include <bcm63xx_regs.h>
  14. static struct resource spi_resources[] = {
  15. {
  16. .start = -1, /* filled at runtime */
  17. .end = -1, /* filled at runtime */
  18. .flags = IORESOURCE_MEM,
  19. },
  20. {
  21. .start = -1, /* filled at runtime */
  22. .flags = IORESOURCE_IRQ,
  23. },
  24. };
  25. static struct platform_device bcm63xx_hsspi_device = {
  26. .name = "bcm63xx-hsspi",
  27. .id = 0,
  28. .num_resources = ARRAY_SIZE(spi_resources),
  29. .resource = spi_resources,
  30. };
  31. int __init bcm63xx_hsspi_register(void)
  32. {
  33. if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362())
  34. return -ENODEV;
  35. spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI);
  36. spi_resources[0].end = spi_resources[0].start;
  37. spi_resources[0].end += RSET_HSSPI_SIZE - 1;
  38. spi_resources[1].start = bcm63xx_get_irq_number(IRQ_HSSPI);
  39. return platform_device_register(&bcm63xx_hsspi_device);
  40. }