au1000_generic.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /*
  2. * Alchemy Semi Au1000 pcmcia driver include file
  3. *
  4. * Copyright 2001 MontaVista Software Inc.
  5. * Author: MontaVista Software, Inc.
  6. * ppopov@mvista.com or source@mvista.com
  7. *
  8. * This program is free software; you can distribute it and/or modify it
  9. * under the terms of the GNU General Public License (Version 2) as
  10. * published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  15. * for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program; if not, write to the Free Software Foundation, Inc.,
  19. * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  20. */
  21. #ifndef __ASM_AU1000_PCMCIA_H
  22. #define __ASM_AU1000_PCMCIA_H
  23. /* include the world */
  24. #include <pcmcia/cs_types.h>
  25. #include <pcmcia/cs.h>
  26. #include <pcmcia/ss.h>
  27. #include <pcmcia/cistpl.h>
  28. #include "cs_internal.h"
  29. #define AU1000_PCMCIA_POLL_PERIOD (2*HZ)
  30. #define AU1000_PCMCIA_IO_SPEED (255)
  31. #define AU1000_PCMCIA_MEM_SPEED (300)
  32. #define AU1X_SOCK0_IO 0xF00000000ULL
  33. #define AU1X_SOCK0_PHYS_ATTR 0xF40000000ULL
  34. #define AU1X_SOCK0_PHYS_MEM 0xF80000000ULL
  35. /* pseudo 32 bit phys addresses, which get fixed up to the
  36. * real 36 bit address in fixup_bigphys_addr() */
  37. #define AU1X_SOCK0_PSEUDO_PHYS_ATTR 0xF4000000
  38. #define AU1X_SOCK0_PSEUDO_PHYS_MEM 0xF8000000
  39. /* pcmcia socket 1 needs external glue logic so the memory map
  40. * differs from board to board.
  41. */
  42. #if defined(CONFIG_MIPS_PB1000) || defined(CONFIG_MIPS_PB1100) || \
  43. defined(CONFIG_MIPS_PB1500) || defined(CONFIG_MIPS_PB1550) || \
  44. defined(CONFIG_MIPS_PB1200)
  45. #define AU1X_SOCK1_IO 0xF08000000ULL
  46. #define AU1X_SOCK1_PHYS_ATTR 0xF48000000ULL
  47. #define AU1X_SOCK1_PHYS_MEM 0xF88000000ULL
  48. #define AU1X_SOCK1_PSEUDO_PHYS_ATTR 0xF4800000
  49. #define AU1X_SOCK1_PSEUDO_PHYS_MEM 0xF8800000
  50. #elif defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) || \
  51. defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_DB1550) || \
  52. defined(CONFIG_MIPS_DB1200)
  53. #define AU1X_SOCK1_IO 0xF04000000ULL
  54. #define AU1X_SOCK1_PHYS_ATTR 0xF44000000ULL
  55. #define AU1X_SOCK1_PHYS_MEM 0xF84000000ULL
  56. #define AU1X_SOCK1_PSEUDO_PHYS_ATTR 0xF4400000
  57. #define AU1X_SOCK1_PSEUDO_PHYS_MEM 0xF8400000
  58. #endif
  59. struct pcmcia_state {
  60. unsigned detect: 1,
  61. ready: 1,
  62. wrprot: 1,
  63. bvd1: 1,
  64. bvd2: 1,
  65. vs_3v: 1,
  66. vs_Xv: 1;
  67. };
  68. struct pcmcia_configure {
  69. unsigned sock: 8,
  70. vcc: 8,
  71. vpp: 8,
  72. output: 1,
  73. speaker: 1,
  74. reset: 1;
  75. };
  76. struct pcmcia_irqs {
  77. int sock;
  78. int irq;
  79. const char *str;
  80. };
  81. struct au1000_pcmcia_socket {
  82. struct pcmcia_socket socket;
  83. /*
  84. * Info from low level handler
  85. */
  86. struct device *dev;
  87. unsigned int nr;
  88. unsigned int irq;
  89. /*
  90. * Core PCMCIA state
  91. */
  92. struct pcmcia_low_level *ops;
  93. unsigned int status;
  94. socket_state_t cs_state;
  95. unsigned short spd_io[MAX_IO_WIN];
  96. unsigned short spd_mem[MAX_WIN];
  97. unsigned short spd_attr[MAX_WIN];
  98. struct resource res_skt;
  99. struct resource res_io;
  100. struct resource res_mem;
  101. struct resource res_attr;
  102. void * virt_io;
  103. unsigned int phys_io;
  104. unsigned int phys_attr;
  105. unsigned int phys_mem;
  106. unsigned short speed_io, speed_attr, speed_mem;
  107. unsigned int irq_state;
  108. struct timer_list poll_timer;
  109. };
  110. struct pcmcia_low_level {
  111. struct module *owner;
  112. int (*hw_init)(struct au1000_pcmcia_socket *);
  113. void (*hw_shutdown)(struct au1000_pcmcia_socket *);
  114. void (*socket_state)(struct au1000_pcmcia_socket *, struct pcmcia_state *);
  115. int (*configure_socket)(struct au1000_pcmcia_socket *, struct socket_state_t *);
  116. /*
  117. * Enable card status IRQs on (re-)initialisation. This can
  118. * be called at initialisation, power management event, or
  119. * pcmcia event.
  120. */
  121. void (*socket_init)(struct au1000_pcmcia_socket *);
  122. /*
  123. * Disable card status IRQs and PCMCIA bus on suspend.
  124. */
  125. void (*socket_suspend)(struct au1000_pcmcia_socket *);
  126. };
  127. extern int au1x_board_init(struct device *dev);
  128. #endif /* __ASM_AU1000_PCMCIA_H */