2 * Marubun MR-SHPC-01 PCMCIA controller device driver
4 * (c) 2007 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
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.
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., 59 Temple Place, Suite 330, Boston,
30 #if defined(CONFIG_CMD_PCMCIA)
34 #if defined(CONFIG_CMD_IDE)
38 #if defined(CONFIG_PCMCIA)
40 /* MR-SHPC-01 register */
41 #define MRSHPC_MODE (CONFIG_SYS_MARUBUN_MRSHPC + 4)
42 #define MRSHPC_OPTION (CONFIG_SYS_MARUBUN_MRSHPC + 6)
43 #define MRSHPC_CSR (CONFIG_SYS_MARUBUN_MRSHPC + 8)
44 #define MRSHPC_ISR (CONFIG_SYS_MARUBUN_MRSHPC + 10)
45 #define MRSHPC_ICR (CONFIG_SYS_MARUBUN_MRSHPC + 12)
46 #define MRSHPC_CPWCR (CONFIG_SYS_MARUBUN_MRSHPC + 14)
47 #define MRSHPC_MW0CR1 (CONFIG_SYS_MARUBUN_MRSHPC + 16)
48 #define MRSHPC_MW1CR1 (CONFIG_SYS_MARUBUN_MRSHPC + 18)
49 #define MRSHPC_IOWCR1 (CONFIG_SYS_MARUBUN_MRSHPC + 20)
50 #define MRSHPC_MW0CR2 (CONFIG_SYS_MARUBUN_MRSHPC + 22)
51 #define MRSHPC_MW1CR2 (CONFIG_SYS_MARUBUN_MRSHPC + 24)
52 #define MRSHPC_IOWCR2 (CONFIG_SYS_MARUBUN_MRSHPC + 26)
53 #define MRSHPC_CDCR (CONFIG_SYS_MARUBUN_MRSHPC + 28)
54 #define MRSHPC_PCIC_INFO (CONFIG_SYS_MARUBUN_MRSHPC + 30)
58 printf("Enable PCMCIA " PCMCIA_SLOT_MSG "\n");
61 outw( 0x0000 , MRSHPC_MODE );
63 if ((inw(MRSHPC_CSR) & 0x000c) == 0){ /* if card detect is true */
64 if ((inw(MRSHPC_CSR) & 0x0080) == 0){
65 outw(0x0674 ,MRSHPC_CPWCR); /* Card Vcc is 3.3v? */
67 outw(0x0678 ,MRSHPC_CPWCR); /* Card Vcc is 5V */
69 udelay( 100000 ); /* wait for power on */
75 * flag == COMMON/ATTRIBUTE/IO
77 /* common window open */
78 outw(0x8a84,MRSHPC_MW0CR1); /* window 0xb8400000 */
79 if ((inw(MRSHPC_CSR) & 0x4000) != 0)
80 outw(0x0b00,MRSHPC_MW0CR2); /* common mode & bus width 16bit SWAP = 1 */
82 outw(0x0300,MRSHPC_MW0CR2); /* common mode & bus width 16bit SWAP = 0 */
84 /* attribute window open */
85 outw(0x8a85,MRSHPC_MW1CR1); /* window 0xb8500000 */
86 if ((inw(MRSHPC_CSR) & 0x4000) != 0)
87 outw(0x0a00,MRSHPC_MW1CR2); /* attribute mode & bus width 16bit SWAP = 1 */
89 outw(0x0200,MRSHPC_MW1CR2); /* attribute mode & bus width 16bit SWAP = 0 */
92 outw(0x8a86,MRSHPC_IOWCR1); /* I/O window 0xb8600000 */
93 outw(0x0008,MRSHPC_CDCR); /* I/O card mode */
94 if ((inw(MRSHPC_CSR) & 0x4000) != 0)
95 outw(0x0a00,MRSHPC_IOWCR2); /* bus width 16bit SWAP = 1 */
97 outw(0x0200,MRSHPC_IOWCR2); /* bus width 16bit SWAP = 0 */
99 outw(0x0000,MRSHPC_ISR);
100 outw(0x2000,MRSHPC_ICR);
101 outb(0x00,(CONFIG_SYS_MARUBUN_MW2 + 0x206));
102 outb(0x42,(CONFIG_SYS_MARUBUN_MW2 + 0x200));
107 int pcmcia_off (void)
109 printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n");
114 #endif /* CONFIG_PCMCIA */