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