main.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * This file is part of wl1271
  3. *
  4. * Copyright (C) 2008-2010 Nokia Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * version 2 as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  18. * 02110-1301 USA
  19. *
  20. */
  21. #include <linux/module.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/err.h>
  24. #include "../wlcore/wlcore.h"
  25. #include "../wlcore/debug.h"
  26. #include "../wlcore/reg.h"
  27. static struct wlcore_ops wl12xx_ops = {
  28. };
  29. static struct wlcore_partition_set wl12xx_ptable[PART_TABLE_LEN] = {
  30. [PART_DOWN] = {
  31. .mem = {
  32. .start = 0x00000000,
  33. .size = 0x000177c0
  34. },
  35. .reg = {
  36. .start = REGISTERS_BASE,
  37. .size = 0x00008800
  38. },
  39. .mem2 = {
  40. .start = 0x00000000,
  41. .size = 0x00000000
  42. },
  43. .mem3 = {
  44. .start = 0x00000000,
  45. .size = 0x00000000
  46. },
  47. },
  48. [PART_WORK] = {
  49. .mem = {
  50. .start = 0x00040000,
  51. .size = 0x00014fc0
  52. },
  53. .reg = {
  54. .start = REGISTERS_BASE,
  55. .size = 0x0000a000
  56. },
  57. .mem2 = {
  58. .start = 0x003004f8,
  59. .size = 0x00000004
  60. },
  61. .mem3 = {
  62. .start = 0x00040404,
  63. .size = 0x00000000
  64. },
  65. },
  66. [PART_DRPW] = {
  67. .mem = {
  68. .start = 0x00040000,
  69. .size = 0x00014fc0
  70. },
  71. .reg = {
  72. .start = DRPW_BASE,
  73. .size = 0x00006000
  74. },
  75. .mem2 = {
  76. .start = 0x00000000,
  77. .size = 0x00000000
  78. },
  79. .mem3 = {
  80. .start = 0x00000000,
  81. .size = 0x00000000
  82. }
  83. }
  84. };
  85. static int __devinit wl12xx_probe(struct platform_device *pdev)
  86. {
  87. struct wl1271 *wl;
  88. struct ieee80211_hw *hw;
  89. hw = wlcore_alloc_hw();
  90. if (IS_ERR(hw)) {
  91. wl1271_error("can't allocate hw");
  92. return PTR_ERR(hw);
  93. }
  94. wl = hw->priv;
  95. wl->ops = &wl12xx_ops;
  96. wl->ptable = wl12xx_ptable;
  97. return wlcore_probe(wl, pdev);
  98. }
  99. static const struct platform_device_id wl12xx_id_table[] __devinitconst = {
  100. { "wl12xx", 0 },
  101. { } /* Terminating Entry */
  102. };
  103. MODULE_DEVICE_TABLE(platform, wl12xx_id_table);
  104. static struct platform_driver wl12xx_driver = {
  105. .probe = wl12xx_probe,
  106. .remove = __devexit_p(wlcore_remove),
  107. .id_table = wl12xx_id_table,
  108. .driver = {
  109. .name = "wl12xx_driver",
  110. .owner = THIS_MODULE,
  111. }
  112. };
  113. static int __init wl12xx_init(void)
  114. {
  115. return platform_driver_register(&wl12xx_driver);
  116. }
  117. module_init(wl12xx_init);
  118. static void __exit wl12xx_exit(void)
  119. {
  120. platform_driver_unregister(&wl12xx_driver);
  121. }
  122. module_exit(wl12xx_exit);
  123. MODULE_LICENSE("GPL v2");
  124. MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");