platform.c 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * DBAu1xxx board platform device registration
  3. *
  4. * Copyright (C) 2009 Manuel Lauss
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include <linux/init.h>
  21. #include <linux/platform_device.h>
  22. #include <asm/mach-au1x00/au1xxx.h>
  23. #include "../platform.h"
  24. /* DB1xxx PCMCIA interrupt sources:
  25. * CD0/1 GPIO0/3
  26. * STSCHG0/1 GPIO1/4
  27. * CARD0/1 GPIO2/5
  28. * Db1550: 0/1, 21/22, 3/5
  29. */
  30. #define DB1XXX_HAS_PCMCIA
  31. #if defined(CONFIG_MIPS_DB1000)
  32. #define DB1XXX_PCMCIA_CD0 AU1000_GPIO0_INT
  33. #define DB1XXX_PCMCIA_STSCHG0 AU1000_GPIO1_INT
  34. #define DB1XXX_PCMCIA_CARD0 AU1000_GPIO2_INT
  35. #define DB1XXX_PCMCIA_CD1 AU1000_GPIO3_INT
  36. #define DB1XXX_PCMCIA_STSCHG1 AU1000_GPIO4_INT
  37. #define DB1XXX_PCMCIA_CARD1 AU1000_GPIO5_INT
  38. #elif defined(CONFIG_MIPS_DB1100)
  39. #define DB1XXX_PCMCIA_CD0 AU1100_GPIO0_INT
  40. #define DB1XXX_PCMCIA_STSCHG0 AU1100_GPIO1_INT
  41. #define DB1XXX_PCMCIA_CARD0 AU1100_GPIO2_INT
  42. #define DB1XXX_PCMCIA_CD1 AU1100_GPIO3_INT
  43. #define DB1XXX_PCMCIA_STSCHG1 AU1100_GPIO4_INT
  44. #define DB1XXX_PCMCIA_CARD1 AU1100_GPIO5_INT
  45. #elif defined(CONFIG_MIPS_DB1500)
  46. #define DB1XXX_PCMCIA_CD0 AU1500_GPIO0_INT
  47. #define DB1XXX_PCMCIA_STSCHG0 AU1500_GPIO1_INT
  48. #define DB1XXX_PCMCIA_CARD0 AU1500_GPIO2_INT
  49. #define DB1XXX_PCMCIA_CD1 AU1500_GPIO3_INT
  50. #define DB1XXX_PCMCIA_STSCHG1 AU1500_GPIO4_INT
  51. #define DB1XXX_PCMCIA_CARD1 AU1500_GPIO5_INT
  52. #elif defined(CONFIG_MIPS_DB1550)
  53. #define DB1XXX_PCMCIA_CD0 AU1550_GPIO0_INT
  54. #define DB1XXX_PCMCIA_STSCHG0 AU1550_GPIO21_INT
  55. #define DB1XXX_PCMCIA_CARD0 AU1550_GPIO3_INT
  56. #define DB1XXX_PCMCIA_CD1 AU1550_GPIO1_INT
  57. #define DB1XXX_PCMCIA_STSCHG1 AU1550_GPIO22_INT
  58. #define DB1XXX_PCMCIA_CARD1 AU1550_GPIO5_INT
  59. #else
  60. /* other board: no PCMCIA */
  61. #undef DB1XXX_HAS_PCMCIA
  62. #endif
  63. static int __init db1xxx_dev_init(void)
  64. {
  65. #ifdef DB1XXX_HAS_PCMCIA
  66. db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS,
  67. PCMCIA_ATTR_PSEUDO_PHYS + 0x00040000 - 1,
  68. PCMCIA_MEM_PSEUDO_PHYS,
  69. PCMCIA_MEM_PSEUDO_PHYS + 0x00040000 - 1,
  70. PCMCIA_IO_PSEUDO_PHYS,
  71. PCMCIA_IO_PSEUDO_PHYS + 0x00001000 - 1,
  72. DB1XXX_PCMCIA_CARD0,
  73. DB1XXX_PCMCIA_CD0,
  74. /*DB1XXX_PCMCIA_STSCHG0*/0,
  75. 0,
  76. 0);
  77. db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS + 0x00400000,
  78. PCMCIA_ATTR_PSEUDO_PHYS + 0x00440000 - 1,
  79. PCMCIA_MEM_PSEUDO_PHYS + 0x00400000,
  80. PCMCIA_MEM_PSEUDO_PHYS + 0x00440000 - 1,
  81. PCMCIA_IO_PSEUDO_PHYS + 0x00400000,
  82. PCMCIA_IO_PSEUDO_PHYS + 0x00401000 - 1,
  83. DB1XXX_PCMCIA_CARD1,
  84. DB1XXX_PCMCIA_CD1,
  85. /*DB1XXX_PCMCIA_STSCHG1*/0,
  86. 0,
  87. 1);
  88. #endif
  89. return 0;
  90. }
  91. device_initcall(db1xxx_dev_init);