2 * (C) Copyright 2000-2004
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 ********************************************************************
25 * Lots of code copied from:
27 * m8xx_pcmcia.c - Linux PCMCIA socket driver for the mpc8xx series.
28 * (C) 1999-2000 Magnus Damm <damm@bitsmart.com>
30 * "The ExCA standard specifies that socket controllers should provide
31 * two IO and five memory windows per socket, which can be independently
32 * configured and positioned in the host address space and mapped to
33 * arbitrary segments of card address space. " - David A Hinds. 1999
35 * This controller does _not_ meet the ExCA standard.
37 * m8xx pcmcia controller brief info:
38 * + 8 windows (attrib, mem, i/o)
39 * + up to two slots (SLOT_A and SLOT_B)
40 * + inputpins, outputpins, event and mask registers.
41 * - no offset register. sigh.
43 * Because of the lacking offset register we must map the whole card.
44 * We assign each memory window PCMCIA_MEM_WIN_SIZE address space.
45 * Make sure there is (PCMCIA_MEM_WIN_SIZE * PCMCIA_MEM_WIN_NO
46 * * PCMCIA_SOCKETS_NO) bytes at PCMCIA_MEM_WIN_BASE.
47 * The i/o windows are dynamically allocated at PCMCIA_IO_WIN_BASE.
48 * They are maximum 64KByte each...
60 #if defined(CONFIG_8xx)
63 #if defined(CONFIG_LWMON)
66 #ifdef CONFIG_PXA_PCMCIA
67 #include <asm/arch/pxa-regs.h>
70 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA) || \
71 ((CONFIG_COMMANDS & CFG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD))
75 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
76 static int pcmcia_off (void);
81 extern int i82365_init (void);
82 extern void i82365_exit (void);
84 #else /* ! CONFIG_I82365 */
86 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
87 static int hardware_disable(int slot);
89 static int hardware_enable (int slot);
90 static int voltage_set(int slot, int vcc, int vpp);
92 #if (! defined(CONFIG_I82365)) && (! defined(CONFIG_PXA_PCMCIA))
93 static u_int m8xx_get_graycode(u_int size);
94 #endif /* !CONFIG_I82365, !CONFIG_PXA_PCMCIA */
96 static u_int m8xx_get_speed(u_int ns, u_int is_io);
99 /* -------------------------------------------------------------------- */
101 #ifndef CONFIG_PXA_PCMCIA
103 /* look up table for pgcrx registers */
105 static u_int *pcmcia_pgcrx[2] = {
106 &((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pgcra,
107 &((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pgcrb,
109 #define PCMCIA_PGCRX(slot) (*pcmcia_pgcrx[slot])
111 #endif /* CONFIG_PXA_PCMCIA */
113 #endif /* CONFIG_I82365 */
115 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
116 static void print_funcid (int func);
117 static void print_fixed (volatile uchar *p);
118 static int identify (volatile uchar *p);
119 static int check_ide_device (int slot);
120 #endif /* CONFIG_IDE_8xx_PCCARD, CONFIG_PXA_PCMCIA */
122 const char *indent = "\t ";
124 /* -------------------------------------------------------------------- */
126 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
128 int do_pinit (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
133 printf ("Usage: pinit {on | off}\n");
136 if (strcmp(argv[1],"on") == 0) {
137 rcode = pcmcia_on ();
138 } else if (strcmp(argv[1],"off") == 0) {
139 rcode = pcmcia_off ();
141 printf ("Usage: pinit {on | off}\n");
147 #endif /* CFG_CMD_PCMCIA */
149 /* -------------------------------------------------------------------- */
156 debug ("Enable PCMCIA " PCMCIA_SLOT_MSG "\n");
161 rc = check_ide_device(0);
168 #ifndef CONFIG_PXA_PCMCIA
171 # define HMI10_FRAM_TIMING (PCMCIA_SHT(2) | PCMCIA_SST(2) | PCMCIA_SL(4))
173 #if defined(CONFIG_LWMON) || defined(CONFIG_NSCU)
174 # define CFG_PCMCIA_TIMING (PCMCIA_SHT(9) | PCMCIA_SST(3) | PCMCIA_SL(12))
176 # define CFG_PCMCIA_TIMING (PCMCIA_SHT(2) | PCMCIA_SST(4) | PCMCIA_SL(9))
187 debug ("Enable PCMCIA " PCMCIA_SLOT_MSG "\n");
189 /* intialize the fixed memory windows */
190 win = (pcmcia_win_t *)(&((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pbr0);
191 base = CFG_PCMCIA_MEM_ADDR;
193 if((reg = m8xx_get_graycode(CFG_PCMCIA_MEM_SIZE)) == -1) {
194 printf ("Cannot set window size to 0x%08x\n",
195 CFG_PCMCIA_MEM_SIZE);
199 slotbit = PCMCIA_SLOT_x;
200 for (i=0; i<PCMCIA_MEM_WIN_NO; ++i) {
203 #if (PCMCIA_SOCKETS_NO == 2)
204 if (i == 4) /* Another slot starting from win 4 */
205 slotbit = (slotbit ? PCMCIA_PSLOT_A : PCMCIA_PSLOT_B);
208 #ifdef CONFIG_IDE_8xx_PCCARD
211 { /* map FRAM area */
212 win->or = ( PCMCIA_BSIZE_256K
217 | HMI10_FRAM_TIMING );
221 case 0: { /* map attribute memory */
222 win->or = ( PCMCIA_BSIZE_64M
227 | CFG_PCMCIA_TIMING );
231 case 1: { /* map I/O window for data reg */
232 win->or = ( PCMCIA_BSIZE_1K
237 | CFG_PCMCIA_TIMING );
241 case 2: { /* map I/O window for cmd/ctrl reg block */
242 win->or = ( PCMCIA_BSIZE_1K
247 | CFG_PCMCIA_TIMING );
250 #endif /* CONFIG_IDE_8xx_PCCARD */
252 case 3: { /* map I/O window for 4xUART data/ctrl */
254 win->or = ( PCMCIA_BSIZE_256K
259 | CFG_PCMCIA_TIMING );
262 #endif /* CONFIG_HMI10 */
263 default: /* set to not valid */
268 debug ("MemWin %d: PBR 0x%08lX POR %08lX\n",
269 i, win->br, win->or);
270 base += CFG_PCMCIA_MEM_SIZE;
274 for (i=0, rc=0, slot=_slot_; i<PCMCIA_SOCKETS_NO; i++, slot = !slot) {
275 /* turn off voltage */
276 if ((rc = voltage_set(slot, 0, 0)))
279 /* Enable external hardware */
280 if ((rc = hardware_enable(slot)))
283 #ifdef CONFIG_IDE_8xx_PCCARD
284 if ((rc = check_ide_device(i)))
291 #endif /* CONFIG_PXA_PCMCIA */
293 #endif /* CONFIG_I82365 */
295 #ifdef CONFIG_PXA_PCMCIA
297 static int hardware_enable (int slot)
299 return 0; /* No hardware to enable */
302 static int hardware_disable(int slot)
304 return 0; /* No hardware to disable */
307 static int voltage_set(int slot, int vcc, int vpp)
312 void msWait(unsigned msVal)
319 unsigned int reg_arr[] = {
320 0x48000028, CFG_MCMEM0_VAL,
321 0x4800002c, CFG_MCMEM1_VAL,
322 0x48000030, CFG_MCATT0_VAL,
323 0x48000034, CFG_MCATT1_VAL,
324 0x48000038, CFG_MCIO0_VAL,
325 0x4800003c, CFG_MCIO1_VAL,
331 #ifdef CONFIG_EXADRON1
333 volatile unsigned int *v_pBCRReg =
334 (volatile unsigned int *) 0x08000000;
337 debug ("%s\n", __FUNCTION__);
341 *((volatile unsigned int *) reg_arr[i++]) |= reg_arr[i++];
344 debug ("%s: programmed mem controller \n", __FUNCTION__);
346 #ifdef CONFIG_EXADRON1
348 /*define useful BCR masks */
349 #define BCR_CF_INIT_VAL 0x00007230
350 #define BCR_CF_PWRON_BUSOFF_RESETOFF_VAL 0x00007231
351 #define BCR_CF_PWRON_BUSOFF_RESETON_VAL 0x00007233
352 #define BCR_CF_PWRON_BUSON_RESETON_VAL 0x00007213
353 #define BCR_CF_PWRON_BUSON_RESETOFF_VAL 0x00007211
355 /* we see from the GPIO bit if the card is present */
356 cardDetect = !(GPLR0 & GPIO_bit (14));
359 printf ("No PCMCIA card found!\n");
362 /* reset the card via the BCR line */
363 *v_pBCRReg = (unsigned) BCR_CF_INIT_VAL;
366 *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSOFF_RESETOFF_VAL;
369 *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSOFF_RESETON_VAL;
372 *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSON_RESETON_VAL;
375 *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSON_RESETOFF_VAL;
378 /* enable address bus */
380 /* and the first CF slot */
383 #endif /* EXADRON 1 */
385 rc = check_ide_device (0); /* use just slot 0 */
390 #endif /* CONFIG_PXA_PCMCIA */
392 /* -------------------------------------------------------------------- */
394 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
397 static int pcmcia_off (void)
399 printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n");
407 #ifndef CONFIG_PXA_PCMCIA
409 static int pcmcia_off (void)
414 printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n");
416 /* clear interrupt state, and disable interrupts */
417 ((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pscr = PCMCIA_MASK(_slot_);
418 ((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_per &= ~PCMCIA_MASK(_slot_);
420 /* turn off interrupt and disable CxOE */
421 PCMCIA_PGCRX(_slot_) = __MY_PCMCIA_GCRX_CXOE;
423 /* turn off memory windows */
424 win = (pcmcia_win_t *)(&((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pbr0);
426 for (i=0; i<PCMCIA_MEM_WIN_NO; ++i) {
427 /* disable memory window */
432 /* turn off voltage */
433 voltage_set(_slot_, 0, 0);
435 /* disable external hardware */
436 printf ("Shutdown and Poweroff " PCMCIA_SLOT_MSG "\n");
437 hardware_disable(_slot_);
441 #endif /* CONFIG_PXA_PCMCIA */
443 #endif /* CONFIG_I82365 */
445 #ifdef CONFIG_PXA_PCMCIA
446 static int pcmcia_off (void)
452 #endif /* CFG_CMD_PCMCIA */
454 /* -------------------------------------------------------------------- */
456 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
458 #define MAX_TUPEL_SZ 512
459 #define MAX_FEATURES 4
461 int ide_devices_found;
462 static int check_ide_device (int slot)
464 volatile uchar *ident = NULL;
465 volatile uchar *feature_p[MAX_FEATURES];
466 volatile uchar *p, *start, *addr;
470 ushort config_base = 0;
474 addr = (volatile uchar *)(CFG_PCMCIA_MEM_ADDR +
475 CFG_PCMCIA_MEM_SIZE * (slot * 4));
476 debug ("PCMCIA MEM: %08lX\n", (ulong)addr);
478 start = p = (volatile uchar *) addr;
480 while ((p - start) < MAX_TUPEL_SZ) {
484 if (code == 0xFF) { /* End of chain */
489 #if defined(DEBUG) && (DEBUG > 1)
490 { volatile uchar *q = p;
491 printf ("\nTuple code %02x length %d\n\tData:",
494 for (i = 0; i < len; ++i) {
495 printf (" %02x", *q);
505 /* Fix for broken SanDisk which may have 0x80 bit set */
509 if (n_features < MAX_FEATURES)
510 feature_p[n_features++] = p;
513 config_base = (*(p+6) << 8) + (*(p+4));
514 debug ("\n## Config_base = %04x ###\n", config_base);
521 found = identify (ident);
523 if (func_id != ((uchar)~0)) {
524 print_funcid (func_id);
526 if (func_id == CISTPL_FUNCID_FIXED)
529 return (1); /* no disk drive */
532 for (i=0; i<n_features; ++i) {
533 print_fixed (feature_p[i]);
537 printf ("unknown card type\n");
541 ide_devices_found |= (1 << slot);
543 /* set I/O area in config reg -> only valid for ARGOSY D5!!! */
544 *((uchar *)(addr + config_base)) = 1;
548 #endif /* CONFIG_IDE_8xx_PCCARD */
550 /* -------------------------------------------------------------------- */
553 /* -------------------------------------------------------------------- */
554 /* board specific stuff: */
555 /* voltage_set(), hardware_enable() and hardware_disable() */
556 /* -------------------------------------------------------------------- */
558 /* -------------------------------------------------------------------- */
559 /* RPX Boards from Embedded Planet */
560 /* -------------------------------------------------------------------- */
562 #if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_RPXLITE)
564 /* The RPX boards seems to have it's bus monitor timeout set to 6*8 clocks.
565 * SYPCR is write once only, therefore must the slowest memory be faster
566 * than the bus monitor or we will get a machine check due to the bus timeout.
569 #define PCMCIA_BOARD_MSG "RPX CLASSIC or RPX LITE"
571 #undef PCMCIA_BMT_LIMIT
572 #define PCMCIA_BMT_LIMIT (6*8)
574 static int voltage_set(int slot, int vcc, int vpp)
580 case 33: reg |= BCSR1_PCVCTL4; break;
581 case 50: reg |= BCSR1_PCVCTL5; break;
590 reg |= BCSR1_PCVCTL6;
595 reg |= BCSR1_PCVCTL7;
602 /* first, turn off all power */
604 *((uint *)RPX_CSR_ADDR) &= ~(BCSR1_PCVCTL4 | BCSR1_PCVCTL5
605 | BCSR1_PCVCTL6 | BCSR1_PCVCTL7);
607 /* enable new powersettings */
609 *((uint *)RPX_CSR_ADDR) |= reg;
614 #define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
615 static int hardware_enable (int slot)
617 return 0; /* No hardware to enable */
619 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
620 static int hardware_disable(int slot)
622 return 0; /* No hardware to disable */
624 #endif /* CFG_CMD_PCMCIA */
625 #endif /* CONFIG_RPXCLASSIC */
627 /* -------------------------------------------------------------------- */
628 /* (F)ADS Boards from Motorola */
629 /* -------------------------------------------------------------------- */
631 #if defined(CONFIG_ADS) || defined(CONFIG_FADS)
634 #define PCMCIA_BOARD_MSG "ADS"
635 #define PCMCIA_GLITCHY_CD /* My ADS board needs this */
637 #define PCMCIA_BOARD_MSG "FADS"
640 static int voltage_set(int slot, int vcc, int vpp)
645 case 0: reg = 0; break;
646 case 50: reg = 1; break;
647 case 120: reg = 2; break;
652 case 0: reg = 0; break;
654 case 50: reg = BCSR1_PCCVCCON; break;
657 case 33: reg = BCSR1_PCCVCC0 | BCSR1_PCCVCC1; break;
658 case 50: reg = BCSR1_PCCVCC1; break;
663 /* first, turn off all power */
666 *((uint *)BCSR1) |= BCSR1_PCCVCCON;
669 *((uint *)BCSR1) &= ~(BCSR1_PCCVCC0 | BCSR1_PCCVCC1);
671 *((uint *)BCSR1) &= ~BCSR1_PCCVPP_MASK;
673 /* enable new powersettings */
676 *((uint *)BCSR1) &= ~reg;
679 *((uint *)BCSR1) |= reg;
682 *((uint *)BCSR1) |= reg << 20;
687 #define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
689 static int hardware_enable(int slot)
691 *((uint *)BCSR1) &= ~BCSR1_PCCEN;
695 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
696 static int hardware_disable(int slot)
698 *((uint *)BCSR1) &= ~BCSR1_PCCEN;
701 #endif /* CFG_CMD_PCMCIA */
705 /* -------------------------------------------------------------------- */
706 /* TQM8xxL Boards by TQ Components */
707 /* SC8xx Boards by SinoVee Microsystems */
708 /* -------------------------------------------------------------------- */
710 #if defined(CONFIG_TQM8xxL) || defined(CONFIG_SVM_SC8xx)
712 #if defined(CONFIG_TQM8xxL)
713 #define PCMCIA_BOARD_MSG "TQM8xxL"
715 #if defined(CONFIG_SVM_SC8xx)
716 #define PCMCIA_BOARD_MSG "SC8xx"
719 static int hardware_enable(int slot)
721 volatile immap_t *immap;
722 volatile cpm8xx_t *cp;
723 volatile pcmconf8xx_t *pcmp;
724 volatile sysconf8xx_t *sysp;
727 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
731 immap = (immap_t *)CFG_IMMR;
732 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
733 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
734 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
737 * Configure SIUMCR to enable PCMCIA port B
738 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
740 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
742 /* clear interrupt state, and disable interrupts */
743 pcmp->pcmc_pscr = PCMCIA_MASK(slot);
744 pcmp->pcmc_per &= ~PCMCIA_MASK(slot);
747 * Disable interrupts, DMA, and PCMCIA buffers
748 * (isolate the interface) and assert RESET signal
750 debug ("Disable PCMCIA buffers and assert RESET\n");
752 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
754 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
756 PCMCIA_PGCRX(slot) = reg;
762 * Configure Port C pins for
763 * 5 Volts Enable and 3 Volts enable
765 immap->im_ioport.iop_pcpar &= ~(0x0002 | 0x0004);
766 immap->im_ioport.iop_pcso &= ~(0x0002 | 0x0004);
767 /* remove all power */
769 immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004);
771 #else /* CONFIG_HMI10 */
773 * Configure Port B pins for
774 * 5 Volts Enable and 3 Volts enable
776 immap->im_cpm.cp_pbpar &= ~(0x00000300);
778 /* remove all power */
779 immap->im_cpm.cp_pbdat |= 0x00000300;
780 #endif /* CONFIG_HMI10 */
783 * Make sure there is a card in the slot, then configure the interface.
786 debug ("[%d] %s: PIPR(%p)=0x%x\n",
787 __LINE__,__FUNCTION__,
788 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
790 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
792 if (pcmp->pcmc_pipr & (0x10000000 >> (slot << 4))) {
793 #endif /* CONFIG_HMI10 */
794 printf (" No Card found\n");
801 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
802 reg = pcmp->pcmc_pipr;
803 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
805 (reg&PCMCIA_VS1(slot))?"n":"ff",
806 (reg&PCMCIA_VS2(slot))?"n":"ff");
808 if ((reg & mask) == mask) {
810 immap->im_ioport.iop_pcdat |= 0x0004;
812 immap->im_cpm.cp_pbdat &= ~(0x0000100);
813 #endif /* CONFIG_HMI10 */
814 puts (" 5.0V card found: ");
817 immap->im_ioport.iop_pcdat |= 0x0002;
819 immap->im_cpm.cp_pbdat &= ~(0x0000200);
820 #endif /* CONFIG_HMI10 */
821 puts (" 3.3V card found: ");
824 immap->im_ioport.iop_pcdir |= (0x0002 | 0x0004);
826 immap->im_cpm.cp_pbdir |= 0x00000300;
827 #endif /* CONFIG_HMI10 */
829 if ((reg & mask) == mask) {
830 puts (" 5.0V card found: ");
832 puts (" 3.3V card found: ");
836 /* VCC switch error flag, PCMCIA slot INPACK_ pin */
837 cp->cp_pbdir &= ~(0x0020 | 0x0010);
838 cp->cp_pbpar &= ~(0x0020 | 0x0010);
842 debug ("Enable PCMCIA buffers and stop RESET\n");
843 reg = PCMCIA_PGCRX(slot);
844 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
846 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
848 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
850 PCMCIA_PGCRX(slot) = reg;
852 udelay(250000); /* some cards need >150 ms to come up :-( */
854 debug ("# hardware_enable done\n");
860 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
861 static int hardware_disable(int slot)
863 volatile immap_t *immap;
864 volatile pcmconf8xx_t *pcmp;
867 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
869 immap = (immap_t *)CFG_IMMR;
870 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
874 /* remove all power */
875 immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004);
877 #else /* CONFIG_HMI10 */
878 immap->im_cpm.cp_pbdat |= 0x00000300;
879 #endif /* CONFIG_HMI10 */
881 debug ("Disable PCMCIA buffers and assert RESET\n");
883 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
885 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
887 PCMCIA_PGCRX(slot) = reg;
893 #endif /* CFG_CMD_PCMCIA */
896 static int voltage_set(int slot, int vcc, int vpp)
901 static int voltage_set(int slot, int vcc, int vpp)
903 volatile immap_t *immap;
904 volatile pcmconf8xx_t *pcmp;
907 debug ("voltage_set: "
909 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
910 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
912 immap = (immap_t *)CFG_IMMR;
913 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
915 * Disable PCMCIA buffers (isolate the interface)
916 * and assert RESET signal
918 debug ("Disable PCMCIA buffers and assert RESET\n");
919 reg = PCMCIA_PGCRX(slot);
920 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
922 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
924 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
926 PCMCIA_PGCRX(slot) = reg;
931 * Configure Port C pins for
932 * 5 Volts Enable and 3 Volts enable,
935 debug ("PCMCIA power OFF\n");
936 immap->im_ioport.iop_pcpar &= ~(0x0002 | 0x0004);
937 immap->im_ioport.iop_pcso &= ~(0x0002 | 0x0004);
938 immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004);
943 case 33: reg |= 0x0002; break;
944 case 50: reg |= 0x0004; break;
947 #else /* CONFIG_HMI10 */
949 * Configure Port B pins for
950 * 5 Volts Enable and 3 Volts enable,
953 debug ("PCMCIA power OFF\n");
954 immap->im_cpm.cp_pbpar &= ~(0x00000300);
955 /* remove all power */
957 immap->im_cpm.cp_pbdat |= 0x00000300;
962 case 33: reg |= 0x00000200; break;
963 case 50: reg |= 0x00000100; break;
966 #endif /* CONFIG_HMI10 */
968 /* Checking supported voltages */
970 debug ("PIPR: 0x%x --> %s\n",
972 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
975 immap->im_ioport.iop_pcdat |= reg;
976 immap->im_ioport.iop_pcdir |= (0x0002 | 0x0004);
978 immap->im_cpm.cp_pbdat &= !reg;
979 immap->im_cpm.cp_pbdir |= 0x00000300;
980 #endif /* CONFIG_HMI10 */
983 debug ("PCMCIA powered at %sV\n",
984 (reg&0x0004) ? "5.0" : "3.3");
986 debug ("PCMCIA powered at %sV\n",
987 (reg&0x00000200) ? "5.0" : "3.3");
988 #endif /* CONFIG_HMI10 */
990 debug ("PCMCIA powered down\n");
994 debug ("Enable PCMCIA buffers and stop RESET\n");
995 reg = PCMCIA_PGCRX(slot);
996 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
998 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1000 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1002 PCMCIA_PGCRX(slot) = reg;
1005 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
1011 #endif /* TQM8xxL */
1014 /* -------------------------------------------------------------------- */
1016 /* -------------------------------------------------------------------- */
1018 #if defined(CONFIG_LWMON)
1020 #define PCMCIA_BOARD_MSG "LWMON"
1022 /* #define's for MAX1604 Power Switch */
1023 #define MAX1604_OP_SUS 0x80
1024 #define MAX1604_VCCBON 0x40
1025 #define MAX1604_VCC_35 0x20
1026 #define MAX1604_VCCBHIZ 0x10
1027 #define MAX1604_VPPBON 0x08
1028 #define MAX1604_VPPBPBPGM 0x04
1029 #define MAX1604_VPPBHIZ 0x02
1032 static int hardware_enable(int slot)
1034 volatile immap_t *immap;
1035 volatile cpm8xx_t *cp;
1036 volatile pcmconf8xx_t *pcmp;
1037 volatile sysconf8xx_t *sysp;
1042 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1044 /* Switch on PCMCIA port in PIC register 0x60 */
1045 reg = pic_read (0x60);
1046 debug ("[%d] PIC read: reg_60 = 0x%02x\n", __LINE__, reg);
1048 /* reg |= 0x08; Vpp not needed */
1049 pic_write (0x60, reg);
1051 reg = pic_read (0x60);
1052 printf ("[%d] PIC read: reg_60 = 0x%02x\n", __LINE__, reg);
1056 immap = (immap_t *)CFG_IMMR;
1057 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
1058 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1059 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1062 * Configure SIUMCR to enable PCMCIA port B
1063 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
1065 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
1067 /* clear interrupt state, and disable interrupts */
1068 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
1069 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
1072 * Disable interrupts, DMA, and PCMCIA buffers
1073 * (isolate the interface) and assert RESET signal
1075 debug ("Disable PCMCIA buffers and assert RESET\n");
1077 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1078 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1079 PCMCIA_PGCRX(_slot_) = reg;
1083 * Make sure there is a card in the slot, then configure the interface.
1086 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1087 __LINE__,__FUNCTION__,
1088 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
1089 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
1090 printf (" No Card found\n");
1097 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
1098 reg = pcmp->pcmc_pipr;
1099 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
1101 (reg&PCMCIA_VS1(slot))?"n":"ff",
1102 (reg&PCMCIA_VS2(slot))?"n":"ff");
1103 if ((reg & mask) == mask) {
1104 val = 0; /* VCCB3/5 = 0 ==> use Vx = 5.0 V */
1105 puts (" 5.0V card found: ");
1107 val = MAX1604_VCC_35; /* VCCB3/5 = 1 ==> use Vy = 3.3 V */
1108 puts (" 3.3V card found: ");
1112 val |= MAX1604_OP_SUS | MAX1604_VCCBON;
1113 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
1114 i2c_write (CFG_I2C_POWER_A_ADDR, 0, 0, &val, 1);
1118 debug ("Enable PCMCIA buffers and stop RESET\n");
1119 reg = PCMCIA_PGCRX(_slot_);
1120 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1121 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1122 PCMCIA_PGCRX(_slot_) = reg;
1124 udelay(250000); /* some cards need >150 ms to come up :-( */
1126 debug ("# hardware_enable done\n");
1132 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1133 static int hardware_disable(int slot)
1135 volatile immap_t *immap;
1136 volatile pcmconf8xx_t *pcmp;
1140 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1142 immap = (immap_t *)CFG_IMMR;
1143 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1145 /* remove all power, put output in high impedance state */
1146 val = MAX1604_VCCBHIZ | MAX1604_VPPBHIZ;
1147 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
1148 i2c_write (CFG_I2C_POWER_A_ADDR, 0, 0, &val, 1);
1150 /* Configure PCMCIA General Control Register */
1151 debug ("Disable PCMCIA buffers and assert RESET\n");
1153 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1154 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1155 PCMCIA_PGCRX(_slot_) = reg;
1157 /* Switch off PCMCIA port in PIC register 0x60 */
1158 reg = pic_read (0x60);
1159 debug ("[%d] PIC read: reg_60 = 0x%02x\n", __LINE__, reg);
1162 pic_write (0x60, reg);
1164 reg = pic_read (0x60);
1165 printf ("[%d] PIC read: reg_60 = 0x%02x\n", __LINE__, reg);
1171 #endif /* CFG_CMD_PCMCIA */
1174 static int voltage_set(int slot, int vcc, int vpp)
1176 volatile immap_t *immap;
1177 volatile pcmconf8xx_t *pcmp;
1181 debug ("voltage_set: "
1183 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
1184 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
1186 immap = (immap_t *)CFG_IMMR;
1187 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1189 * Disable PCMCIA buffers (isolate the interface)
1190 * and assert RESET signal
1192 debug ("Disable PCMCIA buffers and assert RESET\n");
1193 reg = PCMCIA_PGCRX(_slot_);
1194 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1195 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1196 PCMCIA_PGCRX(_slot_) = reg;
1200 * Turn off all power (switch to high impedance)
1202 debug ("PCMCIA power OFF\n");
1203 val = MAX1604_VCCBHIZ | MAX1604_VPPBHIZ;
1204 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
1205 i2c_write (CFG_I2C_POWER_A_ADDR, 0, 0, &val, 1);
1210 case 33: val = MAX1604_VCC_35; break;
1215 /* Checking supported voltages */
1217 debug ("PIPR: 0x%x --> %s\n",
1219 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
1221 i2c_write (CFG_I2C_POWER_A_ADDR, 0, 0, &val, 1);
1223 debug ("PCMCIA powered at %sV\n",
1224 (val & MAX1604_VCC_35) ? "3.3" : "5.0");
1226 debug ("PCMCIA powered down\n");
1230 debug ("Enable PCMCIA buffers and stop RESET\n");
1231 reg = PCMCIA_PGCRX(_slot_);
1232 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1233 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1234 PCMCIA_PGCRX(_slot_) = reg;
1237 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
1244 /* -------------------------------------------------------------------- */
1245 /* GTH board by Corelatus AB */
1246 /* -------------------------------------------------------------------- */
1247 #if defined(CONFIG_GTH)
1249 #define PCMCIA_BOARD_MSG "GTH COMPACT FLASH"
1251 static int voltage_set (int slot, int vcc, int vpp)
1256 static int hardware_enable (int slot)
1258 volatile immap_t *immap;
1259 volatile cpm8xx_t *cp;
1260 volatile pcmconf8xx_t *pcmp;
1261 volatile sysconf8xx_t *sysp;
1264 debug ("hardware_enable: GTH Slot %c\n", 'A' + slot);
1266 immap = (immap_t *) CFG_IMMR;
1267 sysp = (sysconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_siu_conf));
1268 pcmp = (pcmconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_pcmcia));
1269 cp = (cpm8xx_t *) (&(((immap_t *) CFG_IMMR)->im_cpm));
1271 /* clear interrupt state, and disable interrupts */
1272 pcmp->pcmc_pscr = PCMCIA_MASK (_slot_);
1273 pcmp->pcmc_per &= ~PCMCIA_MASK (_slot_);
1276 * Disable interrupts, DMA, and PCMCIA buffers
1277 * (isolate the interface) and assert RESET signal
1279 debug ("Disable PCMCIA buffers and assert RESET\n");
1281 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1282 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1283 PCMCIA_PGCRX (_slot_) = reg;
1287 * Make sure there is a card in the slot,
1288 * then configure the interface.
1291 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1292 __LINE__, __FUNCTION__,
1293 &(pcmp->pcmc_pipr), pcmp->pcmc_pipr);
1294 if (pcmp->pcmc_pipr & 0x98000000) {
1295 printf (" No Card found\n");
1299 mask = PCMCIA_VS1 (slot) | PCMCIA_VS2 (slot);
1300 reg = pcmp->pcmc_pipr;
1301 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
1303 (reg & PCMCIA_VS1 (slot)) ? "n" : "ff",
1304 (reg & PCMCIA_VS2 (slot)) ? "n" : "ff");
1306 debug ("Enable PCMCIA buffers and stop RESET\n");
1307 reg = PCMCIA_PGCRX (_slot_);
1308 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1309 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1310 PCMCIA_PGCRX (_slot_) = reg;
1312 udelay (250000); /* some cards need >150 ms to come up :-( */
1314 debug ("# hardware_enable done\n");
1318 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1319 static int hardware_disable(int slot)
1321 return 0; /* No hardware to disable */
1323 #endif /* CFG_CMD_PCMCIA */
1324 #endif /* CONFIG_GTH */
1326 /* -------------------------------------------------------------------- */
1327 /* ICU862 Boards by Cambridge Broadband Ltd. */
1328 /* -------------------------------------------------------------------- */
1330 #if defined(CONFIG_ICU862)
1332 #define PCMCIA_BOARD_MSG "ICU862"
1334 static void cfg_port_B (void);
1336 static int hardware_enable(int slot)
1338 volatile immap_t *immap;
1339 volatile cpm8xx_t *cp;
1340 volatile pcmconf8xx_t *pcmp;
1341 volatile sysconf8xx_t *sysp;
1342 uint reg, pipr, mask;
1345 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1349 immap = (immap_t *)CFG_IMMR;
1350 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
1351 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1352 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1354 /* Configure Port B for TPS2205 PC-Card Power-Interface Switch */
1358 * Configure SIUMCR to enable PCMCIA port B
1359 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
1361 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
1363 /* clear interrupt state, and disable interrupts */
1364 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
1365 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
1368 * Disable interrupts, DMA, and PCMCIA buffers
1369 * (isolate the interface) and assert RESET signal
1371 debug ("Disable PCMCIA buffers and assert RESET\n");
1373 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1374 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1375 PCMCIA_PGCRX(_slot_) = reg;
1379 * Make sure there is a card in the slot, then configure the interface.
1382 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1383 __LINE__,__FUNCTION__,
1384 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
1385 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
1386 printf (" No Card found\n");
1391 * Power On: Set VAVCC to 3.3V or 5V, set VAVPP to Hi-Z
1393 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
1394 pipr = pcmp->pcmc_pipr;
1395 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
1397 (reg&PCMCIA_VS1(slot))?"n":"ff",
1398 (reg&PCMCIA_VS2(slot))?"n":"ff");
1401 if ((pipr & mask) == mask) {
1402 reg |= (TPS2205_VPP_PGM | TPS2205_VPP_VCC | /* VAVPP => Hi-Z */
1403 TPS2205_VCC3); /* 3V off */
1404 reg &= ~(TPS2205_VCC5); /* 5V on */
1405 puts (" 5.0V card found: ");
1407 reg |= (TPS2205_VPP_PGM | TPS2205_VPP_VCC | /* VAVPP => Hi-Z */
1408 TPS2205_VCC5); /* 5V off */
1409 reg &= ~(TPS2205_VCC3); /* 3V on */
1410 puts (" 3.3V card found: ");
1413 debug ("\nPB DAT: %08x -> 3.3V %s 5.0V %s VPP_PGM %s VPP_VCC %s\n",
1415 (reg & TPS2205_VCC3) ? "off" : "on",
1416 (reg & TPS2205_VCC5) ? "off" : "on",
1417 (reg & TPS2205_VPP_PGM) ? "off" : "on",
1418 (reg & TPS2205_VPP_VCC) ? "off" : "on" );
1422 /* Wait 500 ms; use this to check for over-current */
1423 for (i=0; i<5000; ++i) {
1424 if ((cp->cp_pbdat & TPS2205_OC) == 0) {
1425 printf (" *** Overcurrent - Safety shutdown ***\n");
1426 cp->cp_pbdat &= ~(TPS2205_SHDN);
1432 debug ("Enable PCMCIA buffers and stop RESET\n");
1433 reg = PCMCIA_PGCRX(_slot_);
1434 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1435 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1436 PCMCIA_PGCRX(_slot_) = reg;
1438 udelay(250000); /* some cards need >150 ms to come up :-( */
1440 debug ("# hardware_enable done\n");
1446 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1447 static int hardware_disable(int slot)
1449 volatile immap_t *immap;
1450 volatile cpm8xx_t *cp;
1451 volatile pcmconf8xx_t *pcmp;
1454 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1456 immap = (immap_t *)CFG_IMMR;
1457 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1458 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1461 cp->cp_pbdat &= ~(TPS2205_SHDN);
1463 /* Configure PCMCIA General Control Register */
1464 debug ("Disable PCMCIA buffers and assert RESET\n");
1466 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1467 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1468 PCMCIA_PGCRX(_slot_) = reg;
1474 #endif /* CFG_CMD_PCMCIA */
1477 static int voltage_set(int slot, int vcc, int vpp)
1479 volatile immap_t *immap;
1480 volatile cpm8xx_t *cp;
1481 volatile pcmconf8xx_t *pcmp;
1484 debug ("voltage_set: "
1486 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
1487 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
1489 immap = (immap_t *)CFG_IMMR;
1490 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1491 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1493 * Disable PCMCIA buffers (isolate the interface)
1494 * and assert RESET signal
1496 debug ("Disable PCMCIA buffers and assert RESET\n");
1497 reg = PCMCIA_PGCRX(_slot_);
1498 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1499 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1500 PCMCIA_PGCRX(_slot_) = reg;
1504 * Configure Port C pins for
1505 * 5 Volts Enable and 3 Volts enable,
1506 * Turn all power pins to Hi-Z
1508 debug ("PCMCIA power OFF\n");
1509 cfg_port_B (); /* Enables switch, but all in Hi-Z */
1514 case 0: break; /* Switch off */
1515 case 33: reg &= ~TPS2205_VCC3; break; /* Switch on 3.3V */
1516 case 50: reg &= ~TPS2205_VCC5; break; /* Switch on 5.0V */
1520 /* Checking supported voltages */
1522 debug ("PIPR: 0x%x --> %s\n",
1524 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
1532 if ((reg & TPS2205_VCC3) == 0) {
1534 } else if ((reg & TPS2205_VCC5) == 0) {
1539 printf ("PCMCIA powered %s\n", s);
1544 debug ("Enable PCMCIA buffers and stop RESET\n");
1545 reg = PCMCIA_PGCRX(_slot_);
1546 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1547 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1548 PCMCIA_PGCRX(_slot_) = reg;
1551 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
1556 static void cfg_port_B (void)
1558 volatile immap_t *immap;
1559 volatile cpm8xx_t *cp;
1562 immap = (immap_t *)CFG_IMMR;
1563 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1566 * Configure Port B for TPS2205 PC-Card Power-Interface Switch
1568 * Switch off all voltages, assert shutdown
1571 reg |= (TPS2205_VPP_PGM | TPS2205_VPP_VCC | /* VAVPP => Hi-Z */
1572 TPS2205_VCC3 | TPS2205_VCC5 | /* VAVCC => Hi-Z */
1573 TPS2205_SHDN); /* enable switch */
1576 cp->cp_pbpar &= ~(TPS2205_INPUTS | TPS2205_OUTPUTS);
1578 reg = cp->cp_pbdir & ~(TPS2205_INPUTS);
1579 cp->cp_pbdir = reg | TPS2205_OUTPUTS;
1581 debug ("Set Port B: PAR: %08x DIR: %08x DAT: %08x\n",
1582 cp->cp_pbpar, cp->cp_pbdir, cp->cp_pbdat);
1588 /* -------------------------------------------------------------------- */
1589 /* C2MON Boards by TTTech Computertechnik AG */
1590 /* -------------------------------------------------------------------- */
1592 #if defined(CONFIG_C2MON)
1594 #define PCMCIA_BOARD_MSG "C2MON"
1596 static void cfg_ports (void);
1598 static int hardware_enable(int slot)
1600 volatile immap_t *immap;
1601 volatile cpm8xx_t *cp;
1602 volatile pcmconf8xx_t *pcmp;
1603 volatile sysconf8xx_t *sysp;
1604 uint reg, pipr, mask;
1608 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1612 immap = (immap_t *)CFG_IMMR;
1613 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
1614 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1615 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1617 /* Configure Ports for TPS2211A PC-Card Power-Interface Switch */
1621 * Configure SIUMCR to enable PCMCIA port B
1622 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
1624 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
1626 /* clear interrupt state, and disable interrupts */
1627 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
1628 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
1631 * Disable interrupts, DMA, and PCMCIA buffers
1632 * (isolate the interface) and assert RESET signal
1634 debug ("Disable PCMCIA buffers and assert RESET\n");
1636 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1637 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1638 PCMCIA_PGCRX(_slot_) = reg;
1642 * Make sure there is a card in the slot, then configure the interface.
1645 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1646 __LINE__,__FUNCTION__,
1647 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
1648 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
1649 printf (" No Card found\n");
1654 * Power On: Set VAVCC to 3.3V or 5V, set VAVPP to Hi-Z
1656 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
1657 pipr = pcmp->pcmc_pipr;
1658 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
1660 (reg&PCMCIA_VS1(slot))?"n":"ff",
1661 (reg&PCMCIA_VS2(slot))?"n":"ff");
1663 sreg = immap->im_ioport.iop_pcdat;
1664 if ((pipr & mask) == mask) {
1665 sreg |= (TPS2211_VPPD0 | TPS2211_VPPD1 | /* VAVPP => Hi-Z */
1666 TPS2211_VCCD1); /* 5V on */
1667 sreg &= ~(TPS2211_VCCD0); /* 3V off */
1668 puts (" 5.0V card found: ");
1670 sreg |= (TPS2211_VPPD0 | TPS2211_VPPD1 | /* VAVPP => Hi-Z */
1671 TPS2211_VCCD0); /* 3V on */
1672 sreg &= ~(TPS2211_VCCD1); /* 5V off */
1673 puts (" 3.3V card found: ");
1676 debug ("\nPC DAT: %04x -> 3.3V %s 5.0V %s\n",
1678 ( (sreg & TPS2211_VCCD0) && !(sreg & TPS2211_VCCD1)) ? "on" : "off",
1679 (!(sreg & TPS2211_VCCD0) && (sreg & TPS2211_VCCD1)) ? "on" : "off"
1682 immap->im_ioport.iop_pcdat = sreg;
1684 /* Wait 500 ms; use this to check for over-current */
1685 for (i=0; i<5000; ++i) {
1686 if ((cp->cp_pbdat & TPS2211_OC) == 0) {
1687 printf (" *** Overcurrent - Safety shutdown ***\n");
1688 immap->im_ioport.iop_pcdat &= ~(TPS2211_VCCD0|TPS2211_VCCD1);
1694 debug ("Enable PCMCIA buffers and stop RESET\n");
1695 reg = PCMCIA_PGCRX(_slot_);
1696 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1697 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1698 PCMCIA_PGCRX(_slot_) = reg;
1700 udelay(250000); /* some cards need >150 ms to come up :-( */
1702 debug ("# hardware_enable done\n");
1708 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1709 static int hardware_disable(int slot)
1711 volatile immap_t *immap;
1712 volatile cpm8xx_t *cp;
1713 volatile pcmconf8xx_t *pcmp;
1716 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1718 immap = (immap_t *)CFG_IMMR;
1719 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1721 /* Configure PCMCIA General Control Register */
1722 debug ("Disable PCMCIA buffers and assert RESET\n");
1724 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1725 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1726 PCMCIA_PGCRX(_slot_) = reg;
1728 /* ALl voltages off / Hi-Z */
1729 immap->im_ioport.iop_pcdat |= (TPS2211_VPPD0 | TPS2211_VPPD1 |
1730 TPS2211_VCCD0 | TPS2211_VCCD1 );
1736 #endif /* CFG_CMD_PCMCIA */
1739 static int voltage_set(int slot, int vcc, int vpp)
1741 volatile immap_t *immap;
1742 volatile cpm8xx_t *cp;
1743 volatile pcmconf8xx_t *pcmp;
1747 debug ("voltage_set: "
1749 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
1750 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
1752 immap = (immap_t *)CFG_IMMR;
1753 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1754 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1756 * Disable PCMCIA buffers (isolate the interface)
1757 * and assert RESET signal
1759 debug ("Disable PCMCIA buffers and assert RESET\n");
1760 reg = PCMCIA_PGCRX(_slot_);
1761 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1762 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1763 PCMCIA_PGCRX(_slot_) = reg;
1767 * Configure Port C pins for
1768 * 5 Volts Enable and 3 Volts enable,
1769 * Turn all power pins to Hi-Z
1771 debug ("PCMCIA power OFF\n");
1772 cfg_ports (); /* Enables switch, but all in Hi-Z */
1774 sreg = immap->im_ioport.iop_pcdat;
1775 sreg |= TPS2211_VPPD0 | TPS2211_VPPD1; /* VAVPP always Hi-Z */
1778 case 0: break; /* Switch off */
1779 case 33: sreg |= TPS2211_VCCD0; /* Switch on 3.3V */
1780 sreg &= ~TPS2211_VCCD1;
1782 case 50: sreg &= ~TPS2211_VCCD0; /* Switch on 5.0V */
1783 sreg |= TPS2211_VCCD1;
1788 /* Checking supported voltages */
1790 debug ("PIPR: 0x%x --> %s\n",
1792 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
1794 immap->im_ioport.iop_pcdat = sreg;
1800 if ((sreg & TPS2211_VCCD0) && !(sreg & TPS2211_VCCD1)) {
1802 } else if (!(sreg & TPS2211_VCCD0) && (sreg & TPS2211_VCCD1)) {
1807 printf ("PCMCIA powered %s\n", s);
1812 debug ("Enable PCMCIA buffers and stop RESET\n");
1813 reg = PCMCIA_PGCRX(_slot_);
1814 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1815 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1816 PCMCIA_PGCRX(_slot_) = reg;
1819 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
1824 static void cfg_ports (void)
1826 volatile immap_t *immap;
1827 volatile cpm8xx_t *cp;
1830 immap = (immap_t *)CFG_IMMR;
1831 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1834 * Configure Port C for TPS2211 PC-Card Power-Interface Switch
1836 * Switch off all voltages, assert shutdown
1838 sreg = immap->im_ioport.iop_pcdat;
1839 sreg |= (TPS2211_VPPD0 | TPS2211_VPPD1); /* VAVPP => Hi-Z */
1840 sreg &= ~(TPS2211_VCCD0 | TPS2211_VCCD1); /* 3V and 5V off */
1841 immap->im_ioport.iop_pcdat = sreg;
1843 immap->im_ioport.iop_pcpar &= ~(TPS2211_OUTPUTS);
1844 immap->im_ioport.iop_pcdir |= TPS2211_OUTPUTS;
1846 debug ("Set Port C: PAR: %04x DIR: %04x DAT: %04x\n",
1847 immap->im_ioport.iop_pcpar,
1848 immap->im_ioport.iop_pcdir,
1849 immap->im_ioport.iop_pcdat);
1852 * Configure Port B for TPS2211 PC-Card Power-Interface Switch
1854 * Over-Current Input only
1856 cp->cp_pbpar &= ~(TPS2211_INPUTS);
1857 cp->cp_pbdir &= ~(TPS2211_INPUTS);
1859 debug ("Set Port B: PAR: %08x DIR: %08x DAT: %08x\n",
1860 cp->cp_pbpar, cp->cp_pbdir, cp->cp_pbdat);
1865 /* -------------------------------------------------------------------- */
1866 /* MBX board from Morotola */
1867 /* -------------------------------------------------------------------- */
1869 #if defined( CONFIG_MBX )
1870 #include <../board/mbx8xx/csr.h>
1872 /* A lot of this has been taken from the RPX code in this file it works from me.
1873 I have added the voltage selection for the MBX board. */
1875 /* MBX voltage bit in control register #2 */
1876 #define CR2_VPP12 ((uchar)0x10)
1877 #define CR2_VPPVDD ((uchar)0x20)
1878 #define CR2_VDD5 ((uchar)0x40)
1879 #define CR2_VDD3 ((uchar)0x80)
1881 #define PCMCIA_BOARD_MSG "MBX860"
1883 static int voltage_set (int slot, int vcc, int vpp)
1887 debug ("voltage_set: PCMCIA_BOARD_MSG Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
1888 'A' + slot, vcc / 10, vcc % 10, vpp / 10, vcc % 10);
1921 /* first, turn off all power */
1922 MBX_CSR2 &= ~(CR2_VDDSEL | CR2_VPPSEL);
1924 /* enable new powersettings */
1926 debug ("MBX_CSR2 read = 0x%02x\n", MBX_CSR2);
1931 static int hardware_enable (int slot)
1933 volatile immap_t *immap;
1934 volatile cpm8xx_t *cp;
1935 volatile pcmconf8xx_t *pcmp;
1936 volatile sysconf8xx_t *sysp;
1939 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n",
1944 immap = (immap_t *) CFG_IMMR;
1945 sysp = (sysconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_siu_conf));
1946 pcmp = (pcmconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_pcmcia));
1947 cp = (cpm8xx_t *) (&(((immap_t *) CFG_IMMR)->im_cpm));
1949 /* clear interrupt state, and disable interrupts */
1950 pcmp->pcmc_pscr = PCMCIA_MASK (_slot_);
1951 pcmp->pcmc_per &= ~PCMCIA_MASK (_slot_);
1954 * Disable interrupts, DMA, and PCMCIA buffers
1955 * (isolate the interface) and assert RESET signal
1957 debug ("Disable PCMCIA buffers and assert RESET\n");
1959 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1960 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1961 PCMCIA_PGCRX (_slot_) = reg;
1964 /* remove all power */
1965 voltage_set (slot, 0, 0);
1967 * Make sure there is a card in the slot, then configure the interface.
1970 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1971 __LINE__,__FUNCTION__,
1972 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
1973 #ifndef CONFIG_HMI10
1974 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
1976 if (pcmp->pcmc_pipr & (0x10000000 >> (slot << 4))) {
1977 #endif /* CONFIG_HMI10 */
1978 printf (" No Card found\n");
1985 mask = PCMCIA_VS1 (_slot_) | PCMCIA_VS2 (_slot_);
1986 reg = pcmp->pcmc_pipr;
1987 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n", reg,
1988 (reg & PCMCIA_VS1 (slot)) ? "n" : "ff",
1989 (reg & PCMCIA_VS2 (slot)) ? "n" : "ff");
1991 if ((reg & mask) == mask) {
1992 voltage_set (_slot_, 50, 0);
1993 printf (" 5.0V card found: ");
1995 voltage_set (_slot_, 33, 0);
1996 printf (" 3.3V card found: ");
1999 debug ("Enable PCMCIA buffers and stop RESET\n");
2000 reg = PCMCIA_PGCRX (_slot_);
2001 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2002 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2003 PCMCIA_PGCRX (_slot_) = reg;
2005 udelay (250000); /* some cards need >150 ms to come up :-( */
2007 debug ("# hardware_enable done\n");
2012 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
2013 static int hardware_disable (int slot)
2015 return 0; /* No hardware to disable */
2017 #endif /* CFG_CMD_PCMCIA */
2018 #endif /* CONFIG_MBX */
2019 /* -------------------------------------------------------------------- */
2021 /* -------------------------------------------------------------------- */
2023 #if defined(CONFIG_R360MPI)
2025 #define PCMCIA_BOARD_MSG "R360MPI"
2028 static int hardware_enable(int slot)
2030 volatile immap_t *immap;
2031 volatile cpm8xx_t *cp;
2032 volatile pcmconf8xx_t *pcmp;
2033 volatile sysconf8xx_t *sysp;
2036 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
2040 immap = (immap_t *)CFG_IMMR;
2041 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
2042 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2043 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
2046 * Configure SIUMCR to enable PCMCIA port B
2047 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
2049 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
2051 /* clear interrupt state, and disable interrupts */
2052 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
2053 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
2056 * Disable interrupts, DMA, and PCMCIA buffers
2057 * (isolate the interface) and assert RESET signal
2059 debug ("Disable PCMCIA buffers and assert RESET\n");
2061 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2062 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2063 PCMCIA_PGCRX(_slot_) = reg;
2067 * Configure Ports A, B & C pins for
2068 * 5 Volts Enable and 3 Volts enable
2070 immap->im_ioport.iop_pcpar &= ~(0x0400);
2071 immap->im_ioport.iop_pcso &= ~(0x0400);/*
2072 immap->im_ioport.iop_pcdir |= 0x0400;*/
2074 immap->im_ioport.iop_papar &= ~(0x0200);/*
2075 immap->im_ioport.iop_padir |= 0x0200;*/
2077 immap->im_ioport.iop_pbpar &= ~(0xC000);
2078 immap->im_ioport.iop_pbdir &= ~(0xC000);
2080 /* remove all power */
2082 immap->im_ioport.iop_pcdat |= 0x0400;
2083 immap->im_ioport.iop_padat |= 0x0200;
2086 * Make sure there is a card in the slot, then configure the interface.
2089 debug ("[%d] %s: PIPR(%p)=0x%x\n",
2090 __LINE__,__FUNCTION__,
2091 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
2092 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
2093 printf (" No Card found\n");
2100 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
2101 reg = pcmp->pcmc_pipr;
2102 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
2104 (reg&PCMCIA_VS1(slot))?"n":"ff",
2105 (reg&PCMCIA_VS2(slot))?"n":"ff");
2106 if ((reg & mask) == mask) {
2107 immap->im_ioport.iop_pcdat &= ~(0x4000);
2108 puts (" 5.0V card found: ");
2110 immap->im_ioport.iop_padat &= ~(0x0002);
2111 puts (" 3.3V card found: ");
2113 immap->im_ioport.iop_pcdir |= 0x0400;
2114 immap->im_ioport.iop_padir |= 0x0200;
2116 /* VCC switch error flag, PCMCIA slot INPACK_ pin */
2117 cp->cp_pbdir &= ~(0x0020 | 0x0010);
2118 cp->cp_pbpar &= ~(0x0020 | 0x0010);
2121 debug ("Enable PCMCIA buffers and stop RESET\n");
2122 reg = PCMCIA_PGCRX(_slot_);
2123 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2124 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2125 PCMCIA_PGCRX(_slot_) = reg;
2127 udelay(250000); /* some cards need >150 ms to come up :-( */
2129 debug ("# hardware_enable done\n");
2135 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
2136 static int hardware_disable(int slot)
2138 volatile immap_t *immap;
2139 volatile pcmconf8xx_t *pcmp;
2142 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
2144 immap = (immap_t *)CFG_IMMR;
2145 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2147 /* remove all power */
2148 immap->im_ioport.iop_pcdat |= 0x0400;
2149 immap->im_ioport.iop_padat |= 0x0200;
2151 /* Configure PCMCIA General Control Register */
2152 debug ("Disable PCMCIA buffers and assert RESET\n");
2154 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2155 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2156 PCMCIA_PGCRX(_slot_) = reg;
2162 #endif /* CFG_CMD_PCMCIA */
2165 static int voltage_set(int slot, int vcc, int vpp)
2167 volatile immap_t *immap;
2168 volatile pcmconf8xx_t *pcmp;
2171 debug ("voltage_set: "
2173 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
2174 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
2176 immap = (immap_t *)CFG_IMMR;
2177 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2179 * Disable PCMCIA buffers (isolate the interface)
2180 * and assert RESET signal
2182 debug ("Disable PCMCIA buffers and assert RESET\n");
2183 reg = PCMCIA_PGCRX(_slot_);
2184 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2185 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2186 PCMCIA_PGCRX(_slot_) = reg;
2190 * Configure Ports A & C pins for
2191 * 5 Volts Enable and 3 Volts enable,
2192 * Turn off all power
2194 debug ("PCMCIA power OFF\n");
2195 immap->im_ioport.iop_pcpar &= ~(0x0400);
2196 immap->im_ioport.iop_pcso &= ~(0x0400);/*
2197 immap->im_ioport.iop_pcdir |= 0x0400;*/
2199 immap->im_ioport.iop_papar &= ~(0x0200);/*
2200 immap->im_ioport.iop_padir |= 0x0200;*/
2202 immap->im_ioport.iop_pcdat |= 0x0400;
2203 immap->im_ioport.iop_padat |= 0x0200;
2208 case 33: reg |= 0x0200; break;
2209 case 50: reg |= 0x0400; break;
2213 /* Checking supported voltages */
2215 debug ("PIPR: 0x%x --> %s\n",
2217 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
2220 immap->im_ioport.iop_pcdat &= !reg;
2222 immap->im_ioport.iop_padat &= !reg;
2223 immap->im_ioport.iop_pcdir |= 0x0200;
2224 immap->im_ioport.iop_padir |= 0x0400;
2226 debug ("PCMCIA powered at %sV\n",
2227 (reg&0x0400) ? "5.0" : "3.3");
2229 debug ("PCMCIA powered down\n");
2233 debug ("Enable PCMCIA buffers and stop RESET\n");
2234 reg = PCMCIA_PGCRX(_slot_);
2235 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2236 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2237 PCMCIA_PGCRX(_slot_) = reg;
2240 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
2245 #endif /* R360MPI */
2247 /* -------------------------------------------------------------------- */
2248 /* KUP4K and KUP4X Boards */
2249 /* -------------------------------------------------------------------- */
2250 #if defined(CONFIG_KUP4K) || defined(CONFIG_KUP4X)
2252 #define PCMCIA_BOARD_MSG "KUP"
2254 #define KUP4K_PCMCIA_B_3V3 (0x00020000)
2256 static int hardware_enable(int slot)
2258 volatile immap_t *immap;
2259 volatile cpm8xx_t *cp;
2260 volatile pcmconf8xx_t *pcmp;
2261 volatile sysconf8xx_t *sysp;
2264 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
2268 immap = (immap_t *)CFG_IMMR;
2269 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
2270 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2271 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
2274 * Configure SIUMCR to enable PCMCIA port B
2275 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
2277 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
2279 /* clear interrupt state, and disable interrupts */
2280 pcmp->pcmc_pscr = PCMCIA_MASK(slot);
2281 pcmp->pcmc_per &= ~PCMCIA_MASK(slot);
2284 * Disable interrupts, DMA, and PCMCIA buffers
2285 * (isolate the interface) and assert RESET signal
2287 debug ("Disable PCMCIA buffers and assert RESET\n");
2289 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2290 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2291 PCMCIA_PGCRX(slot) = reg;
2295 * Configure Port B pins for
2298 if (slot) { /* Slot A is built-in */
2299 cp->cp_pbdir |= KUP4K_PCMCIA_B_3V3;
2300 cp->cp_pbpar &= ~KUP4K_PCMCIA_B_3V3;
2301 /* remove all power */
2302 cp->cp_pbdat |= KUP4K_PCMCIA_B_3V3; /* active low */
2305 * Make sure there is a card in the slot, then configure the interface.
2308 debug ("[%d] %s: PIPR(%p)=0x%x\n",
2309 __LINE__,__FUNCTION__,
2310 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
2311 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
2312 printf (" No Card found\n");
2319 printf("%s Slot %c:", slot ? "" : "\n", 'A' + slot);
2320 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
2321 reg = pcmp->pcmc_pipr;
2322 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
2324 (reg&PCMCIA_VS1(slot))?"n":"ff",
2325 (reg&PCMCIA_VS2(slot))?"n":"ff");
2326 if ((reg & mask) == mask) {
2327 puts (" 5.0V card found: NOT SUPPORTED !!!\n");
2330 cp->cp_pbdat &= ~KUP4K_PCMCIA_B_3V3;
2331 puts (" 3.3V card found: ");
2334 /* VCC switch error flag, PCMCIA slot INPACK_ pin */
2335 cp->cp_pbdir &= ~(0x0020 | 0x0010);
2336 cp->cp_pbpar &= ~(0x0020 | 0x0010);
2339 debug ("Enable PCMCIA buffers and stop RESET\n");
2340 reg = PCMCIA_PGCRX(slot);
2341 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2342 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2343 PCMCIA_PGCRX(slot) = reg;
2345 udelay(250000); /* some cards need >150 ms to come up :-( */
2347 debug ("# hardware_enable done\n");
2353 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
2354 static int hardware_disable(int slot)
2356 volatile immap_t *immap;
2357 volatile cpm8xx_t *cp;
2358 volatile pcmconf8xx_t *pcmp;
2361 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
2363 immap = (immap_t *)CFG_IMMR;
2364 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2365 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
2367 /* remove all power */
2369 cp->cp_pbdat |= KUP4K_PCMCIA_B_3V3;
2371 /* Configure PCMCIA General Control Register */
2372 debug ("Disable PCMCIA buffers and assert RESET\n");
2374 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2375 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2376 PCMCIA_PGCRX(slot) = reg;
2382 #endif /* CFG_CMD_PCMCIA */
2385 static int voltage_set(int slot, int vcc, int vpp)
2387 volatile immap_t *immap;
2388 volatile cpm8xx_t *cp;
2389 volatile pcmconf8xx_t *pcmp;
2392 debug ("voltage_set: " \
2394 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
2395 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
2397 if (!slot) /* Slot A is not configurable */
2400 immap = (immap_t *)CFG_IMMR;
2401 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2402 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
2405 * Disable PCMCIA buffers (isolate the interface)
2406 * and assert RESET signal
2408 debug ("Disable PCMCIA buffers and assert RESET\n");
2409 reg = PCMCIA_PGCRX(slot);
2410 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2411 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2412 PCMCIA_PGCRX(slot) = reg;
2415 debug ("PCMCIA power OFF\n");
2417 * Configure Port B pins for
2420 cp->cp_pbdir |= KUP4K_PCMCIA_B_3V3;
2421 cp->cp_pbpar &= ~KUP4K_PCMCIA_B_3V3;
2422 /* remove all power */
2423 cp->cp_pbdat |= KUP4K_PCMCIA_B_3V3; /* active low */
2428 cp->cp_pbdat &= ~KUP4K_PCMCIA_B_3V3;
2429 debug ("PCMCIA powered at 3.3V\n");
2432 debug ("PCMCIA: 5Volt vcc not supported\n");
2435 puts("PCMCIA: vcc not supported");
2439 /* Checking supported voltages */
2441 debug ("PIPR: 0x%x --> %s\n",
2443 (pcmp->pcmc_pipr & (0x80000000 >> (slot << 4)))
2444 ? "only 5 V --> NOT SUPPORTED"
2448 debug ("Enable PCMCIA buffers and stop RESET\n");
2449 reg = PCMCIA_PGCRX(slot);
2450 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2451 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2452 PCMCIA_PGCRX(slot) = reg;
2455 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
2460 #endif /* KUP4K || KUP4X */
2463 /* -------------------------------------------------------------------- */
2464 /* End of Board Specific Stuff */
2465 /* -------------------------------------------------------------------- */
2468 /* -------------------------------------------------------------------- */
2469 /* MPC8xx Specific Stuff - should go to MPC8xx directory */
2470 /* -------------------------------------------------------------------- */
2473 * Search this table to see if the windowsize is
2477 #define M8XX_SIZES_NO 32
2479 static const u_int m8xx_size_to_gray[M8XX_SIZES_NO] =
2480 { 0x00000001, 0x00000002, 0x00000008, 0x00000004,
2481 0x00000080, 0x00000040, 0x00000010, 0x00000020,
2482 0x00008000, 0x00004000, 0x00001000, 0x00002000,
2483 0x00000100, 0x00000200, 0x00000800, 0x00000400,
2485 0x0fffffff, 0xffffffff, 0xffffffff, 0xffffffff,
2486 0x01000000, 0x02000000, 0xffffffff, 0x04000000,
2487 0x00010000, 0x00020000, 0x00080000, 0x00040000,
2488 0x00800000, 0x00400000, 0x00100000, 0x00200000 };
2491 /* -------------------------------------------------------------------- */
2493 #if ( ! defined(CONFIG_I82365) && ! defined(CONFIG_PXA_PCMCIA) )
2495 static u_int m8xx_get_graycode(u_int size)
2499 for (k = 0; k < M8XX_SIZES_NO; k++) {
2500 if(m8xx_size_to_gray[k] == size)
2504 if((k == M8XX_SIZES_NO) || (m8xx_size_to_gray[k] == -1))
2510 #endif /* CONFIG_I82365 */
2512 /* -------------------------------------------------------------------- */
2515 static u_int m8xx_get_speed(u_int ns, u_int is_io)
2517 u_int reg, clocks, psst, psl, psht;
2522 * We get called with IO maps setup to 0ns
2523 * if not specified by the user.
2524 * They should be 255ns.
2530 ns = 100; /* fast memory if 0 */
2534 * In PSST, PSL, PSHT fields we tell the controller
2535 * timing parameters in CLKOUT clock cycles.
2536 * CLKOUT is the same as GCLK2_50.
2539 /* how we want to adjust the timing - in percent */
2541 #define ADJ 180 /* 80 % longer accesstime - to be sure */
2543 clocks = ((M8XX_BUSFREQ / 1000) * ns) / 1000;
2544 clocks = (clocks * ADJ) / (100*1000);
2546 if(clocks >= PCMCIA_BMT_LIMIT) {
2547 DEBUG(0, "Max access time limit reached\n");
2548 clocks = PCMCIA_BMT_LIMIT-1;
2551 psst = clocks / 7; /* setup time */
2552 psht = clocks / 7; /* hold time */
2553 psl = (clocks * 5) / 7; /* strobe length */
2555 psst += clocks - (psst + psht + psl);
2565 /* -------------------------------------------------------------------- */
2567 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
2568 static void print_funcid (int func)
2572 case CISTPL_FUNCID_MULTI:
2573 puts (" Multi-Function");
2575 case CISTPL_FUNCID_MEMORY:
2578 case CISTPL_FUNCID_SERIAL:
2579 puts (" Serial Port");
2581 case CISTPL_FUNCID_PARALLEL:
2582 puts (" Parallel Port");
2584 case CISTPL_FUNCID_FIXED:
2585 puts (" Fixed Disk");
2587 case CISTPL_FUNCID_VIDEO:
2588 puts (" Video Adapter");
2590 case CISTPL_FUNCID_NETWORK:
2591 puts (" Network Adapter");
2593 case CISTPL_FUNCID_AIMS:
2594 puts (" AIMS Card");
2596 case CISTPL_FUNCID_SCSI:
2597 puts (" SCSI Adapter");
2605 #endif /* CONFIG_IDE_8xx_PCCARD */
2607 /* -------------------------------------------------------------------- */
2609 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
2610 static void print_fixed (volatile uchar *p)
2618 case CISTPL_FUNCE_IDE_IFACE:
2619 { uchar iface = *(p+2);
2621 puts ((iface == CISTPL_IDE_INTERFACE) ? " IDE" : " unknown");
2622 puts (" interface ");
2625 case CISTPL_FUNCE_IDE_MASTER:
2626 case CISTPL_FUNCE_IDE_SLAVE:
2627 { uchar f1 = *(p+2);
2630 puts ((f1 & CISTPL_IDE_SILICON) ? " [silicon]" : " [rotating]");
2632 if (f1 & CISTPL_IDE_UNIQUE)
2635 puts ((f1 & CISTPL_IDE_DUAL) ? " [dual]" : " [single]");
2637 if (f2 & CISTPL_IDE_HAS_SLEEP)
2640 if (f2 & CISTPL_IDE_HAS_STANDBY)
2641 puts (" [standby]");
2643 if (f2 & CISTPL_IDE_HAS_IDLE)
2646 if (f2 & CISTPL_IDE_LOW_POWER)
2647 puts (" [low power]");
2649 if (f2 & CISTPL_IDE_REG_INHIBIT)
2650 puts (" [reg inhibit]");
2652 if (f2 & CISTPL_IDE_HAS_INDEX)
2655 if (f2 & CISTPL_IDE_IOIS16)
2663 #endif /* CONFIG_IDE_8xx_PCCARD */
2665 /* -------------------------------------------------------------------- */
2667 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
2669 #define MAX_IDENT_CHARS 64
2670 #define MAX_IDENT_FIELDS 4
2672 static uchar *known_cards[] = {
2677 static int identify (volatile uchar *p)
2679 uchar id_str[MAX_IDENT_CHARS];
2686 return (0); /* Don't know */
2691 for (i=0; i<=4 && !done; ++i, p+=2) {
2692 while ((data = *p) != '\0') {
2698 if (t == &id_str[MAX_IDENT_CHARS-1]) {
2708 while (--t > id_str) {
2717 for (card=known_cards; *card; ++card) {
2718 debug ("## Compare against \"%s\"\n", *card);
2719 if (strcmp(*card, id_str) == 0) { /* found! */
2720 debug ("## CARD FOUND ##\n");
2725 return (0); /* don't know */
2727 #endif /* CONFIG_IDE_8xx_PCCARD */
2729 /* -------------------------------------------------------------------- */
2730 /* NETTA board by Intracom S.A. */
2731 /* -------------------------------------------------------------------- */
2733 #if defined(CONFIG_NETTA)
2735 /* some sane bit macros */
2736 #define _BD(_b) (1U << (31-(_b)))
2737 #define _BDR(_l, _h) (((((1U << (31-(_l))) - 1) << 1) | 1) & ~((1U << (31-(_h))) - 1))
2739 #define _BW(_b) (1U << (15-(_b)))
2740 #define _BWR(_l, _h) (((((1U << (15-(_l))) - 1) << 1) | 1) & ~((1U << (15-(_h))) - 1))
2742 #define _BB(_b) (1U << (7-(_b)))
2743 #define _BBR(_l, _h) (((((1U << (7-(_l))) - 1) << 1) | 1) & ~((1U << (7-(_h))) - 1))
2745 #define _B(_b) _BD(_b)
2746 #define _BR(_l, _h) _BDR(_l, _h)
2748 #define PCMCIA_BOARD_MSG "NETTA"
2750 static const unsigned short vppd_masks[2] = { _BW(14), _BW(15) };
2752 static void cfg_vppd(int no)
2754 volatile immap_t *immap = (immap_t *)CFG_IMMR;
2755 unsigned short mask;
2757 if ((unsigned int)no >= sizeof(vppd_masks)/sizeof(vppd_masks[0]))
2760 mask = vppd_masks[no];
2762 immap->im_ioport.iop_papar &= ~mask;
2763 immap->im_ioport.iop_paodr &= ~mask;
2764 immap->im_ioport.iop_padir |= mask;
2767 static void set_vppd(int no, int what)
2769 volatile immap_t *immap = (immap_t *)CFG_IMMR;
2770 unsigned short mask;
2772 if ((unsigned int)no >= sizeof(vppd_masks)/sizeof(vppd_masks[0]))
2775 mask = vppd_masks[no];
2778 immap->im_ioport.iop_padat |= mask;
2780 immap->im_ioport.iop_padat &= ~mask;
2783 static const unsigned short vccd_masks[2] = { _BW(10), _BW(6) };
2785 static void cfg_vccd(int no)
2787 volatile immap_t *immap = (immap_t *)CFG_IMMR;
2788 unsigned short mask;
2790 if ((unsigned int)no >= sizeof(vccd_masks)/sizeof(vccd_masks[0]))
2793 mask = vccd_masks[no];
2795 immap->im_ioport.iop_papar &= ~mask;
2796 immap->im_ioport.iop_paodr &= ~mask;
2797 immap->im_ioport.iop_padir |= mask;
2800 static void set_vccd(int no, int what)
2802 volatile immap_t *immap = (immap_t *)CFG_IMMR;
2803 unsigned short mask;
2805 if ((unsigned int)no >= sizeof(vccd_masks)/sizeof(vccd_masks[0]))
2808 mask = vccd_masks[no];
2811 immap->im_ioport.iop_padat |= mask;
2813 immap->im_ioport.iop_padat &= ~mask;
2816 static const unsigned short oc_mask = _BW(8);
2818 static void cfg_oc(void)
2820 volatile immap_t *immap = (immap_t *)CFG_IMMR;
2821 unsigned short mask = oc_mask;
2823 immap->im_ioport.iop_pcdir &= ~mask;
2824 immap->im_ioport.iop_pcso &= ~mask;
2825 immap->im_ioport.iop_pcint &= ~mask;
2826 immap->im_ioport.iop_pcpar &= ~mask;
2829 static int get_oc(void)
2831 volatile immap_t *immap = (immap_t *)CFG_IMMR;
2832 unsigned short mask = oc_mask;
2835 what = !!(immap->im_ioport.iop_pcdat & mask);;
2839 static const unsigned short shdn_mask = _BW(12);
2841 static void cfg_shdn(void)
2843 volatile immap_t *immap = (immap_t *)CFG_IMMR;
2844 unsigned short mask;
2848 immap->im_ioport.iop_papar &= ~mask;
2849 immap->im_ioport.iop_paodr &= ~mask;
2850 immap->im_ioport.iop_padir |= mask;
2853 static void set_shdn(int what)
2855 volatile immap_t *immap = (immap_t *)CFG_IMMR;
2856 unsigned short mask;
2861 immap->im_ioport.iop_padat |= mask;
2863 immap->im_ioport.iop_padat &= ~mask;
2866 static void cfg_ports (void);
2868 static int hardware_enable(int slot)
2870 volatile immap_t *immap;
2871 volatile cpm8xx_t *cp;
2872 volatile pcmconf8xx_t *pcmp;
2873 volatile sysconf8xx_t *sysp;
2874 uint reg, pipr, mask;
2877 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
2881 immap = (immap_t *)CFG_IMMR;
2882 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
2883 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2884 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
2886 /* Configure Ports for TPS2211A PC-Card Power-Interface Switch */
2889 /* clear interrupt state, and disable interrupts */
2890 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
2891 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
2894 * Disable interrupts, DMA, and PCMCIA buffers
2895 * (isolate the interface) and assert RESET signal
2897 debug ("Disable PCMCIA buffers and assert RESET\n");
2899 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2900 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2901 PCMCIA_PGCRX(_slot_) = reg;
2906 * Make sure there is a card in the slot, then configure the interface.
2909 debug ("[%d] %s: PIPR(%p)=0x%x\n",
2910 __LINE__,__FUNCTION__,
2911 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
2912 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
2913 printf (" No Card found\n");
2918 * Power On: Set VAVCC to 3.3V or 5V, set VAVPP to Hi-Z
2920 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
2921 pipr = pcmp->pcmc_pipr;
2922 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
2924 (reg&PCMCIA_VS1(slot))?"n":"ff",
2925 (reg&PCMCIA_VS2(slot))?"n":"ff");
2927 if ((pipr & mask) == mask) {
2928 set_vppd(0, 1); set_vppd(1, 1); /* VAVPP => Hi-Z */
2929 set_vccd(0, 0); set_vccd(1, 1); /* 5V on, 3V off */
2930 puts (" 5.0V card found: ");
2932 set_vppd(0, 1); set_vppd(1, 1); /* VAVPP => Hi-Z */
2933 set_vccd(0, 1); set_vccd(1, 0); /* 5V off, 3V on */
2934 puts (" 3.3V card found: ");
2937 /* Wait 500 ms; use this to check for over-current */
2938 for (i=0; i<5000; ++i) {
2940 printf (" *** Overcurrent - Safety shutdown ***\n");
2941 set_vccd(0, 0); set_vccd(1, 0); /* VAVPP => Hi-Z */
2947 debug ("Enable PCMCIA buffers and stop RESET\n");
2948 reg = PCMCIA_PGCRX(_slot_);
2949 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2950 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2951 PCMCIA_PGCRX(_slot_) = reg;
2953 udelay(250000); /* some cards need >150 ms to come up :-( */
2955 debug ("# hardware_enable done\n");
2961 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
2962 static int hardware_disable(int slot)
2964 volatile immap_t *immap;
2965 volatile pcmconf8xx_t *pcmp;
2968 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
2970 immap = (immap_t *)CFG_IMMR;
2971 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2973 /* Configure PCMCIA General Control Register */
2974 debug ("Disable PCMCIA buffers and assert RESET\n");
2976 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2977 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2978 PCMCIA_PGCRX(_slot_) = reg;
2980 /* All voltages off / Hi-Z */
2981 set_vppd(0, 1); set_vppd(1, 1);
2982 set_vccd(0, 1); set_vccd(1, 1);
2988 #endif /* CFG_CMD_PCMCIA */
2991 static int voltage_set(int slot, int vcc, int vpp)
2993 volatile immap_t *immap;
2994 volatile cpm8xx_t *cp;
2995 volatile pcmconf8xx_t *pcmp;
2999 debug ("voltage_set: "
3001 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
3002 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
3004 immap = (immap_t *)CFG_IMMR;
3005 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
3006 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
3008 * Disable PCMCIA buffers (isolate the interface)
3009 * and assert RESET signal
3011 debug ("Disable PCMCIA buffers and assert RESET\n");
3012 reg = PCMCIA_PGCRX(_slot_);
3013 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
3014 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
3015 PCMCIA_PGCRX(_slot_) = reg;
3019 * Configure Port C pins for
3020 * 5 Volts Enable and 3 Volts enable,
3021 * Turn all power pins to Hi-Z
3023 debug ("PCMCIA power OFF\n");
3024 cfg_ports (); /* Enables switch, but all in Hi-Z */
3026 sreg = immap->im_ioport.iop_pcdat;
3027 set_vppd(0, 1); set_vppd(1, 1);
3031 break; /* Switch off */
3034 set_vccd(0, 1); set_vccd(1, 0);
3038 set_vccd(0, 0); set_vccd(1, 1);
3045 /* Checking supported voltages */
3047 debug ("PIPR: 0x%x --> %s\n",
3049 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
3052 debug ("Enable PCMCIA buffers and stop RESET\n");
3053 reg = PCMCIA_PGCRX(_slot_);
3054 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
3055 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
3056 PCMCIA_PGCRX(_slot_) = reg;
3059 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
3064 static void cfg_ports (void)
3066 volatile immap_t *immap;
3067 volatile cpm8xx_t *cp;
3069 immap = (immap_t *)CFG_IMMR;
3070 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
3073 cfg_vppd(0); cfg_vppd(1); /* VPPD0,VPPD1 VAVPP => Hi-Z */
3074 cfg_vccd(0); cfg_vccd(1); /* 3V and 5V off */
3079 * Configure Port A for TPS2211 PC-Card Power-Interface Switch
3081 * Switch off all voltages, assert shutdown
3083 set_vppd(0, 1); set_vppd(1, 1);
3084 set_vccd(0, 0); set_vccd(1, 0);
3093 /* -------------------------------------------------------------------- */
3095 #endif /* CFG_CMD_PCMCIA || (CFG_CMD_IDE && CONFIG_IDE_8xx_PCCARD) */
3097 /**************************************************/
3099 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
3101 pinit, 2, 1, do_pinit,
3102 "pinit - PCMCIA sub-system\n",
3103 "on - power on PCMCIA socket\n"
3104 "pinit off - power off PCMCIA socket\n"