sa1100_generic.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*======================================================================
  2. Device driver for the PCMCIA control functionality of StrongARM
  3. SA-1100 microprocessors.
  4. The contents of this file are subject to the Mozilla Public
  5. License Version 1.1 (the "License"); you may not use this file
  6. except in compliance with the License. You may obtain a copy of
  7. the License at http://www.mozilla.org/MPL/
  8. Software distributed under the License is distributed on an "AS
  9. IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  10. implied. See the License for the specific language governing
  11. rights and limitations under the License.
  12. The initial developer of the original code is John G. Dorsey
  13. <john+@cs.cmu.edu>. Portions created by John G. Dorsey are
  14. Copyright (C) 1999 John G. Dorsey. All Rights Reserved.
  15. Alternatively, the contents of this file may be used under the
  16. terms of the GNU Public License version 2 (the "GPL"), in which
  17. case the provisions of the GPL are applicable instead of the
  18. above. If you wish to allow the use of your version of this file
  19. only under the terms of the GPL and not to allow others to use
  20. your version of this file under the MPL, indicate your decision
  21. by deleting the provisions above and replace them with the notice
  22. and other provisions required by the GPL. If you do not delete
  23. the provisions above, a recipient may use your version of this
  24. file under either the MPL or the GPL.
  25. ======================================================================*/
  26. #include <linux/module.h>
  27. #include <linux/init.h>
  28. #include <linux/slab.h>
  29. #include <linux/platform_device.h>
  30. #include <pcmcia/ss.h>
  31. #include <asm/hardware/scoop.h>
  32. #include "sa1100_generic.h"
  33. int __init pcmcia_collie_init(struct device *dev);
  34. static int (*sa11x0_pcmcia_hw_init[])(struct device *dev) = {
  35. #ifdef CONFIG_SA1100_ASSABET
  36. pcmcia_assabet_init,
  37. #endif
  38. #ifdef CONFIG_SA1100_CERF
  39. pcmcia_cerf_init,
  40. #endif
  41. #if defined(CONFIG_SA1100_H3100) || defined(CONFIG_SA1100_H3600)
  42. pcmcia_h3600_init,
  43. #endif
  44. #ifdef CONFIG_SA1100_NANOENGINE
  45. pcmcia_nanoengine_init,
  46. #endif
  47. #ifdef CONFIG_SA1100_SHANNON
  48. pcmcia_shannon_init,
  49. #endif
  50. #ifdef CONFIG_SA1100_SIMPAD
  51. pcmcia_simpad_init,
  52. #endif
  53. #ifdef CONFIG_SA1100_COLLIE
  54. pcmcia_collie_init,
  55. #endif
  56. };
  57. static int sa11x0_drv_pcmcia_probe(struct platform_device *dev)
  58. {
  59. int i, ret = -ENODEV;
  60. /*
  61. * Initialise any "on-board" PCMCIA sockets.
  62. */
  63. for (i = 0; i < ARRAY_SIZE(sa11x0_pcmcia_hw_init); i++) {
  64. ret = sa11x0_pcmcia_hw_init[i](&dev->dev);
  65. if (ret == 0)
  66. break;
  67. }
  68. return ret;
  69. }
  70. static int sa11x0_drv_pcmcia_remove(struct platform_device *dev)
  71. {
  72. struct skt_dev_info *sinfo = platform_get_drvdata(dev);
  73. int i;
  74. platform_set_drvdata(dev, NULL);
  75. for (i = 0; i < sinfo->nskt; i++)
  76. soc_pcmcia_remove_one(&sinfo->skt[i]);
  77. return 0;
  78. }
  79. static struct platform_driver sa11x0_pcmcia_driver = {
  80. .driver = {
  81. .name = "sa11x0-pcmcia",
  82. },
  83. .probe = sa11x0_drv_pcmcia_probe,
  84. .remove = sa11x0_drv_pcmcia_remove,
  85. };
  86. /* sa11x0_pcmcia_init()
  87. * ^^^^^^^^^^^^^^^^^^^^
  88. *
  89. * This routine performs low-level PCMCIA initialization and then
  90. * registers this socket driver with Card Services.
  91. *
  92. * Returns: 0 on success, -ve error code on failure
  93. */
  94. static int __init sa11x0_pcmcia_init(void)
  95. {
  96. return platform_driver_register(&sa11x0_pcmcia_driver);
  97. }
  98. /* sa11x0_pcmcia_exit()
  99. * ^^^^^^^^^^^^^^^^^^^^
  100. * Invokes the low-level kernel service to free IRQs associated with this
  101. * socket controller and reset GPIO edge detection.
  102. */
  103. static void __exit sa11x0_pcmcia_exit(void)
  104. {
  105. platform_driver_unregister(&sa11x0_pcmcia_driver);
  106. }
  107. MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>");
  108. MODULE_DESCRIPTION("Linux PCMCIA Card Services: SA-11x0 Socket Controller");
  109. MODULE_LICENSE("Dual MPL/GPL");
  110. fs_initcall(sa11x0_pcmcia_init);
  111. module_exit(sa11x0_pcmcia_exit);