ezkit.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * File: arch/blackfin/mach-bf561/ezkit.c
  3. * Based on:
  4. * Author:
  5. *
  6. * Created:
  7. * Description:
  8. *
  9. * Modified:
  10. * Copyright 2004-2006 Analog Devices Inc.
  11. *
  12. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, see the file COPYING, or write
  26. * to the Free Software Foundation, Inc.,
  27. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  28. */
  29. #include <linux/device.h>
  30. #include <linux/platform_device.h>
  31. #include <linux/spi/spi.h>
  32. #include <asm/irq.h>
  33. #include <asm/bfin5xx_spi.h>
  34. /*
  35. * Name the Board for the /proc/cpuinfo
  36. */
  37. char *bfin_board_name = "ADDS-BF561-EZKIT";
  38. /*
  39. * USB-LAN EzExtender board
  40. * Driver needs to know address, irq and flag pin.
  41. */
  42. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  43. static struct resource smc91x_resources[] = {
  44. {
  45. .name = "smc91x-regs",
  46. .start = 0x2C010300,
  47. .end = 0x2C010300 + 16,
  48. .flags = IORESOURCE_MEM,
  49. },{
  50. .start = IRQ_PF9,
  51. .end = IRQ_PF9,
  52. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  53. },
  54. };
  55. static struct platform_device smc91x_device = {
  56. .name = "smc91x",
  57. .id = 0,
  58. .num_resources = ARRAY_SIZE(smc91x_resources),
  59. .resource = smc91x_resources,
  60. };
  61. #endif
  62. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  63. static struct resource bfin_uart_resources[] = {
  64. {
  65. .start = 0xFFC00400,
  66. .end = 0xFFC004FF,
  67. .flags = IORESOURCE_MEM,
  68. },
  69. };
  70. static struct platform_device bfin_uart_device = {
  71. .name = "bfin-uart",
  72. .id = 1,
  73. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  74. .resource = bfin_uart_resources,
  75. };
  76. #endif
  77. #ifdef CONFIG_SPI_BFIN
  78. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  79. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  80. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  81. .enable_dma = 0,
  82. .bits_per_word = 16,
  83. };
  84. #endif
  85. #endif
  86. /* SPI controller data */
  87. static struct bfin5xx_spi_master spi_bfin_master_info = {
  88. .num_chipselect = 8,
  89. .enable_dma = 1, /* master has the ability to do dma transfer */
  90. };
  91. static struct platform_device spi_bfin_master_device = {
  92. .name = "bfin-spi-master",
  93. .id = 1, /* Bus number */
  94. .dev = {
  95. .platform_data = &spi_bfin_master_info, /* Passed to driver */
  96. },
  97. };
  98. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  99. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  100. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  101. {
  102. .modalias = "ad1836-spi",
  103. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  104. .bus_num = 1,
  105. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  106. .controller_data = &ad1836_spi_chip_info,
  107. },
  108. #endif
  109. };
  110. static struct platform_device *ezkit_devices[] __initdata = {
  111. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  112. &smc91x_device,
  113. #endif
  114. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  115. &spi_bfin_master_device,
  116. #endif
  117. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  118. &bfin_uart_device,
  119. #endif
  120. };
  121. static int __init ezkit_init(void)
  122. {
  123. int ret;
  124. printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
  125. ret = platform_add_devices(ezkit_devices,
  126. ARRAY_SIZE(ezkit_devices));
  127. if (ret < 0)
  128. return ret;
  129. return spi_register_board_info(bfin_spi_board_info,
  130. ARRAY_SIZE(bfin_spi_board_info));
  131. }
  132. arch_initcall(ezkit_init);