dev-spi.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Atheros AR71XX/AR724X/AR913X SPI controller device
  3. *
  4. * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
  5. * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published
  9. * by the Free Software Foundation.
  10. */
  11. #include <linux/platform_device.h>
  12. #include <asm/mach-ath79/ar71xx_regs.h>
  13. #include "dev-spi.h"
  14. static struct resource ath79_spi_resources[] = {
  15. {
  16. .start = AR71XX_SPI_BASE,
  17. .end = AR71XX_SPI_BASE + AR71XX_SPI_SIZE - 1,
  18. .flags = IORESOURCE_MEM,
  19. },
  20. };
  21. static struct platform_device ath79_spi_device = {
  22. .name = "ath79-spi",
  23. .id = -1,
  24. .resource = ath79_spi_resources,
  25. .num_resources = ARRAY_SIZE(ath79_spi_resources),
  26. };
  27. void __init ath79_register_spi(struct ath79_spi_platform_data *pdata,
  28. struct spi_board_info const *info,
  29. unsigned n)
  30. {
  31. spi_register_board_info(info, n);
  32. ath79_spi_device.dev.platform_data = pdata;
  33. platform_device_register(&ath79_spi_device);
  34. }