cw1200_sagrad.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * Platform glue data for ST-Ericsson CW1200 driver
  3. *
  4. * Copyright (c) 2013, Sagrad, Inc
  5. * Author: Solomon Peachy <speachy@sagrad.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/module.h>
  12. #include <linux/cw1200_platform.h>
  13. MODULE_AUTHOR("Solomon Peachy <speachy@sagrad.com>");
  14. MODULE_DESCRIPTION("ST-Ericsson CW1200 Platform glue driver");
  15. MODULE_LICENSE("GPL");
  16. /* Define just one of these. Feel free to customize as needed */
  17. #define SAGRAD_1091_1098_EVK_SDIO
  18. /* #define SAGRAD_1091_1098_EVK_SPI */
  19. #ifdef SAGRAD_1091_1098_EVK_SDIO
  20. #if 0
  21. static struct resource cw1200_href_resources[] = {
  22. {
  23. .start = 215, /* fix me as appropriate */
  24. .end = 215, /* ditto */
  25. .flags = IORESOURCE_IO,
  26. .name = "cw1200_wlan_reset",
  27. },
  28. {
  29. .start = 216, /* fix me as appropriate */
  30. .end = 216, /* ditto */
  31. .flags = IORESOURCE_IO,
  32. .name = "cw1200_wlan_powerup",
  33. },
  34. {
  35. .start = NOMADIK_GPIO_TO_IRQ(216), /* fix me as appropriate */
  36. .end = NOMADIK_GPIO_TO_IRQ(216), /* ditto */
  37. .flags = IORESOURCE_IRQ,
  38. .name = "cw1200_wlan_irq",
  39. },
  40. };
  41. #endif
  42. static int cw1200_power_ctrl(const struct cw1200_platform_data_sdio *pdata,
  43. bool enable)
  44. {
  45. /* Control 3v3 and 1v8 to hardware as appropriate */
  46. /* Note this is not needed if it's controlled elsewhere or always on */
  47. /* May require delay for power to stabilize */
  48. return 0;
  49. }
  50. static int cw1200_clk_ctrl(const struct cw1200_platform_data_sdio *pdata,
  51. bool enable)
  52. {
  53. /* Turn CLK_32K off and on as appropriate. */
  54. /* Note this is not needed if it's always on */
  55. /* May require delay for clock to stabilize */
  56. return 0;
  57. }
  58. static struct cw1200_platform_data_sdio cw1200_platform_data = {
  59. .ref_clk = 38400,
  60. .have_5ghz = false,
  61. #if 0
  62. .reset = &cw1200_href_resources[0],
  63. .powerup = &cw1200_href_resources[1],
  64. .irq = &cw1200_href_resources[2],
  65. #endif
  66. .power_ctrl = cw1200_power_ctrl,
  67. .clk_ctrl = cw1200_clk_ctrl,
  68. /* .macaddr = ??? */
  69. .sdd_file = "sdd_sagrad_1091_1098.bin",
  70. };
  71. #endif
  72. #ifdef SAGRAD_1091_1098_EVK_SPI
  73. /* Note that this is an example of integrating into your board support file */
  74. static struct resource cw1200_href_resources[] = {
  75. {
  76. .start = GPIO_RF_RESET,
  77. .end = GPIO_RF_RESET,
  78. .flags = IORESOURCE_IO,
  79. .name = "cw1200_wlan_reset",
  80. },
  81. {
  82. .start = GPIO_RF_POWERUP,
  83. .end = GPIO_RF_POWERUP,
  84. .flags = IORESOURCE_IO,
  85. .name = "cw1200_wlan_powerup",
  86. },
  87. };
  88. static int cw1200_power_ctrl(const struct cw1200_platform_data_spi *pdata,
  89. bool enable)
  90. {
  91. /* Control 3v3 and 1v8 to hardware as appropriate */
  92. /* Note this is not needed if it's controlled elsewhere or always on */
  93. /* May require delay for power to stabilize */
  94. return 0;
  95. }
  96. static int cw1200_clk_ctrl(const struct cw1200_platform_data_spi *pdata,
  97. bool enable)
  98. {
  99. /* Turn CLK_32K off and on as appropriate. */
  100. /* Note this is not needed if it's always on */
  101. /* May require delay for clock to stabilize */
  102. return 0;
  103. }
  104. static struct cw1200_platform_data_spi cw1200_platform_data = {
  105. .ref_clk = 38400,
  106. .spi_bits_per_word = 16,
  107. .reset = &cw1200_href_resources[0],
  108. .powerup = &cw1200_href_resources[1],
  109. .power_ctrl = cw1200_power_ctrl,
  110. .clk_ctrl = cw1200_clk_ctrl,
  111. /* .macaddr = ??? */
  112. .sdd_file = "sdd_sagrad_1091_1098.bin",
  113. };
  114. static struct spi_board_info myboard_spi_devices[] __initdata = {
  115. {
  116. .modalias = "cw1200_wlan_spi",
  117. .max_speed_hz = 10000000, /* 52MHz Max */
  118. .bus_num = 0,
  119. .irq = WIFI_IRQ,
  120. .platform_data = &cw1200_platform_data,
  121. .chip_select = 0,
  122. },
  123. };
  124. #endif
  125. const void *cw1200_get_platform_data(void)
  126. {
  127. return &cw1200_platform_data;
  128. }
  129. EXPORT_SYMBOL_GPL(cw1200_get_platform_data);