7 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
11 #if (CONFIG_COMMANDS & CFG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD)
17 #define PCMCIA_BOARD_MSG "KUP"
19 #define KUP4K_PCMCIA_B_3V3 (0x00020000)
21 int pcmcia_hardware_enable(int slot)
23 volatile immap_t *immap;
24 volatile cpm8xx_t *cp;
25 volatile pcmconf8xx_t *pcmp;
26 volatile sysconf8xx_t *sysp;
29 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
33 immap = (immap_t *)CFG_IMMR;
34 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
35 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
36 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
39 * Configure SIUMCR to enable PCMCIA port B
40 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
42 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
44 /* clear interrupt state, and disable interrupts */
45 pcmp->pcmc_pscr = PCMCIA_MASK(slot);
46 pcmp->pcmc_per &= ~PCMCIA_MASK(slot);
49 * Disable interrupts, DMA, and PCMCIA buffers
50 * (isolate the interface) and assert RESET signal
52 debug ("Disable PCMCIA buffers and assert RESET\n");
54 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
55 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
56 PCMCIA_PGCRX(slot) = reg;
60 * Configure Port B pins for
63 if (slot) { /* Slot A is built-in */
64 cp->cp_pbdir |= KUP4K_PCMCIA_B_3V3;
65 cp->cp_pbpar &= ~KUP4K_PCMCIA_B_3V3;
66 /* remove all power */
67 cp->cp_pbdat |= KUP4K_PCMCIA_B_3V3; /* active low */
70 * Make sure there is a card in the slot, then configure the interface.
73 debug ("[%d] %s: PIPR(%p)=0x%x\n",
74 __LINE__,__FUNCTION__,
75 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
76 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
77 printf (" No Card found\n");
84 printf("%s Slot %c:", slot ? "" : "\n", 'A' + slot);
85 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
86 reg = pcmp->pcmc_pipr;
87 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
89 (reg&PCMCIA_VS1(slot))?"n":"ff",
90 (reg&PCMCIA_VS2(slot))?"n":"ff");
91 if ((reg & mask) == mask) {
92 puts (" 5.0V card found: NOT SUPPORTED !!!\n");
95 cp->cp_pbdat &= ~KUP4K_PCMCIA_B_3V3;
96 puts (" 3.3V card found: ");
99 /* VCC switch error flag, PCMCIA slot INPACK_ pin */
100 cp->cp_pbdir &= ~(0x0020 | 0x0010);
101 cp->cp_pbpar &= ~(0x0020 | 0x0010);
104 debug ("Enable PCMCIA buffers and stop RESET\n");
105 reg = PCMCIA_PGCRX(slot);
106 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
107 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
108 PCMCIA_PGCRX(slot) = reg;
110 udelay(250000); /* some cards need >150 ms to come up :-( */
112 debug ("# hardware_enable done\n");
118 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
119 int pcmcia_hardware_disable(int slot)
121 volatile immap_t *immap;
122 volatile cpm8xx_t *cp;
123 volatile pcmconf8xx_t *pcmp;
126 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
128 immap = (immap_t *)CFG_IMMR;
129 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
130 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
132 /* remove all power */
134 cp->cp_pbdat |= KUP4K_PCMCIA_B_3V3;
136 /* Configure PCMCIA General Control Register */
137 debug ("Disable PCMCIA buffers and assert RESET\n");
139 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
140 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
141 PCMCIA_PGCRX(slot) = reg;
147 #endif /* CFG_CMD_PCMCIA */
150 int pcmcia_voltage_set(int slot, int vcc, int vpp)
152 volatile immap_t *immap;
153 volatile cpm8xx_t *cp;
154 volatile pcmconf8xx_t *pcmp;
157 debug ("voltage_set: " \
159 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
160 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
162 if (!slot) /* Slot A is not configurable */
165 immap = (immap_t *)CFG_IMMR;
166 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
167 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
170 * Disable PCMCIA buffers (isolate the interface)
171 * and assert RESET signal
173 debug ("Disable PCMCIA buffers and assert RESET\n");
174 reg = PCMCIA_PGCRX(slot);
175 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
176 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
177 PCMCIA_PGCRX(slot) = reg;
180 debug ("PCMCIA power OFF\n");
182 * Configure Port B pins for
185 cp->cp_pbdir |= KUP4K_PCMCIA_B_3V3;
186 cp->cp_pbpar &= ~KUP4K_PCMCIA_B_3V3;
187 /* remove all power */
188 cp->cp_pbdat |= KUP4K_PCMCIA_B_3V3; /* active low */
193 cp->cp_pbdat &= ~KUP4K_PCMCIA_B_3V3;
194 debug ("PCMCIA powered at 3.3V\n");
197 debug ("PCMCIA: 5Volt vcc not supported\n");
200 puts("PCMCIA: vcc not supported");
204 /* Checking supported voltages */
206 debug ("PIPR: 0x%x --> %s\n",
208 (pcmp->pcmc_pipr & (0x80000000 >> (slot << 4)))
209 ? "only 5 V --> NOT SUPPORTED"
213 debug ("Enable PCMCIA buffers and stop RESET\n");
214 reg = PCMCIA_PGCRX(slot);
215 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
216 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
217 PCMCIA_PGCRX(slot) = reg;
220 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
225 #endif /* CONFIG_PCMCIA */