mrshpc.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef __MACH_SE_MRSHPC_H
  2. #define __MACH_SE_MRSHPC_H
  3. #include <linux/io.h>
  4. static inline void __init mrshpc_setup_windows(void)
  5. {
  6. if ((__raw_readw(MRSHPC_CSR) & 0x000c) != 0)
  7. return; /* Not detected */
  8. if ((__raw_readw(MRSHPC_CSR) & 0x0080) == 0) {
  9. __raw_writew(0x0674, MRSHPC_CPWCR); /* Card Vcc is 3.3v? */
  10. } else {
  11. __raw_writew(0x0678, MRSHPC_CPWCR); /* Card Vcc is 5V */
  12. }
  13. /*
  14. * PC-Card window open
  15. * flag == COMMON/ATTRIBUTE/IO
  16. */
  17. /* common window open */
  18. __raw_writew(0x8a84, MRSHPC_MW0CR1);
  19. if((__raw_readw(MRSHPC_CSR) & 0x4000) != 0)
  20. /* common mode & bus width 16bit SWAP = 1*/
  21. __raw_writew(0x0b00, MRSHPC_MW0CR2);
  22. else
  23. /* common mode & bus width 16bit SWAP = 0*/
  24. __raw_writew(0x0300, MRSHPC_MW0CR2);
  25. /* attribute window open */
  26. __raw_writew(0x8a85, MRSHPC_MW1CR1);
  27. if ((__raw_readw(MRSHPC_CSR) & 0x4000) != 0)
  28. /* attribute mode & bus width 16bit SWAP = 1*/
  29. __raw_writew(0x0a00, MRSHPC_MW1CR2);
  30. else
  31. /* attribute mode & bus width 16bit SWAP = 0*/
  32. __raw_writew(0x0200, MRSHPC_MW1CR2);
  33. /* I/O window open */
  34. __raw_writew(0x8a86, MRSHPC_IOWCR1);
  35. __raw_writew(0x0008, MRSHPC_CDCR); /* I/O card mode */
  36. if ((__raw_readw(MRSHPC_CSR) & 0x4000) != 0)
  37. __raw_writew(0x0a00, MRSHPC_IOWCR2); /* bus width 16bit SWAP = 1*/
  38. else
  39. __raw_writew(0x0200, MRSHPC_IOWCR2); /* bus width 16bit SWAP = 0*/
  40. __raw_writew(0x2000, MRSHPC_ICR);
  41. __raw_writeb(0x00, PA_MRSHPC_MW2 + 0x206);
  42. __raw_writeb(0x42, PA_MRSHPC_MW2 + 0x200);
  43. }
  44. #endif /* __MACH_SE_MRSHPC_H */