2 * (C) Copyright 2000-2002
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 */
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,
110 #define PCMCIA_PGCRX(slot) (*pcmcia_pgcrx[slot])
112 #endif /* CONFIG_I82365 */
114 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
115 static void print_funcid (int func);
116 static void print_fixed (volatile uchar *p);
117 static int identify (volatile uchar *p);
118 static int check_ide_device (int slot);
119 #endif /* CONFIG_IDE_8xx_PCCARD */
123 const char *indent = "\t ";
125 /* -------------------------------------------------------------------- */
127 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
129 int do_pinit (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
134 printf ("Usage: pinit {on | off}\n");
137 if (strcmp(argv[1],"on") == 0) {
138 rcode = pcmcia_on ();
139 } else if (strcmp(argv[1],"off") == 0) {
140 rcode = pcmcia_off ();
142 printf ("Usage: pinit {on | off}\n");
148 #endif /* CFG_CMD_PCMCIA */
150 /* -------------------------------------------------------------------- */
157 debug ("Enable PCMCIA " PCMCIA_SLOT_MSG "\n");
162 rc = check_ide_device(0);
169 #ifndef CONFIG_PXA_PCMCIA
172 # define HMI10_FRAM_TIMING (PCMCIA_SHT(2) | PCMCIA_SST(2) | PCMCIA_SL(4))
174 #if defined(CONFIG_LWMON) || defined(CONFIG_NSCU)
175 # define CFG_PCMCIA_TIMING (PCMCIA_SHT(9) | PCMCIA_SST(3) | PCMCIA_SL(12))
177 # define CFG_PCMCIA_TIMING (PCMCIA_SHT(2) | PCMCIA_SST(4) | PCMCIA_SL(9))
188 debug ("Enable PCMCIA " PCMCIA_SLOT_MSG "\n");
190 /* intialize the fixed memory windows */
191 win = (pcmcia_win_t *)(&((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pbr0);
192 base = CFG_PCMCIA_MEM_ADDR;
194 if((reg = m8xx_get_graycode(CFG_PCMCIA_MEM_SIZE)) == -1) {
195 printf ("Cannot set window size to 0x%08x\n",
196 CFG_PCMCIA_MEM_SIZE);
200 slotbit = PCMCIA_SLOT_x;
201 for (i=0; i<PCMCIA_MEM_WIN_NO; ++i) {
204 #if (PCMCIA_SOCKETS_NO == 2)
205 if (i == 4) /* Another slot starting from win 4 */
206 slotbit = (slotbit ? PCMCIA_PSLOT_A : PCMCIA_PSLOT_B);
209 #ifdef CONFIG_IDE_8xx_PCCARD
212 { /* map FRAM area */
213 win->or = ( PCMCIA_BSIZE_256K
218 | HMI10_FRAM_TIMING );
222 case 0: { /* map attribute memory */
223 win->or = ( PCMCIA_BSIZE_64M
228 | CFG_PCMCIA_TIMING );
232 case 1: { /* map I/O window for data reg */
233 win->or = ( PCMCIA_BSIZE_1K
238 | CFG_PCMCIA_TIMING );
242 case 2: { /* map I/O window for cmd/ctrl reg block */
243 win->or = ( PCMCIA_BSIZE_1K
248 | CFG_PCMCIA_TIMING );
251 #endif /* CONFIG_IDE_8xx_PCCARD */
253 case 3: { /* map I/O window for 4xUART data/ctrl */
255 win->or = ( PCMCIA_BSIZE_256K
260 | CFG_PCMCIA_TIMING );
263 #endif /* CONFIG_HMI10 */
264 default: /* set to not valid */
269 debug ("MemWin %d: PBR 0x%08lX POR %08lX\n",
270 i, win->br, win->or);
271 base += CFG_PCMCIA_MEM_SIZE;
275 for (i=0, rc=0, slot=_slot_; i<PCMCIA_SOCKETS_NO; i++, slot = !slot) {
276 /* turn off voltage */
277 if ((rc = voltage_set(slot, 0, 0)))
280 /* Enable external hardware */
281 if ((rc = hardware_enable(slot)))
284 #ifdef CONFIG_IDE_8xx_PCCARD
285 if ((rc = check_ide_device(i)))
292 #endif / CONFIG_PXA_PCMCIA */
294 #endif /* CONFIG_I82365 */
296 #ifdef CONFIG_PXA_PCMCIA
298 static int hardware_enable (int slot)
300 return 0; /* No hardware to enable */
303 static int hardware_disable(int slot)
305 return 0; /* No hardware to disable */
308 static int voltage_set(int slot, int vcc, int vpp)
313 void msWait(unsigned msVal)
320 unsigned int reg_arr[] = {
321 0x48000028, CFG_MCMEM0_VAL,
322 0x4800002c, CFG_MCMEM1_VAL,
323 0x48000030, CFG_MCATT0_VAL,
324 0x48000034, CFG_MCATT1_VAL,
325 0x48000038, CFG_MCIO0_VAL,
326 0x4800003c, CFG_MCIO1_VAL,
332 #ifdef CONFIG_EXADRON1
334 volatile unsigned int *v_pBCRReg =
335 (volatile unsigned int *) 0x08000000;
338 debug ("%s\n", __FUNCTION__);
342 *((volatile unsigned int *) reg_arr[i++]) |= reg_arr[i++];
345 debug ("%s: programmed mem controller \n", __FUNCTION__);
347 #ifdef CONFIG_EXADRON1
349 /*define useful BCR masks */
350 #define BCR_CF_INIT_VAL 0x00007230
351 #define BCR_CF_PWRON_BUSOFF_RESETOFF_VAL 0x00007231
352 #define BCR_CF_PWRON_BUSOFF_RESETON_VAL 0x00007233
353 #define BCR_CF_PWRON_BUSON_RESETON_VAL 0x00007213
354 #define BCR_CF_PWRON_BUSON_RESETOFF_VAL 0x00007211
356 /* we see from the GPIO bit if the card is present */
357 cardDetect = !(GPLR0 & GPIO_bit (14));
360 printf ("No PCMCIA card found!\n");
363 /* reset the card via the BCR line */
364 *v_pBCRReg = (unsigned) BCR_CF_INIT_VAL;
367 *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSOFF_RESETOFF_VAL;
370 *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSOFF_RESETON_VAL;
373 *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSON_RESETON_VAL;
376 *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSON_RESETOFF_VAL;
379 /* enable address bus */
381 /* and the first CF slot */
384 #endif /* EXADRON 1 */
386 rc = check_ide_device (0); /* use just slot 0 */
391 #endif /* CONFIG_PXA_PCMCIA */
393 /* -------------------------------------------------------------------- */
395 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
398 static int pcmcia_off (void)
400 printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n");
408 #ifndef CONFIG_PXA_PCMCIA
410 static int pcmcia_off (void)
415 printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n");
417 /* clear interrupt state, and disable interrupts */
418 ((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pscr = PCMCIA_MASK(_slot_);
419 ((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_per &= ~PCMCIA_MASK(_slot_);
421 /* turn off interrupt and disable CxOE */
422 PCMCIA_PGCRX(_slot_) = __MY_PCMCIA_GCRX_CXOE;
424 /* turn off memory windows */
425 win = (pcmcia_win_t *)(&((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pbr0);
427 for (i=0; i<PCMCIA_MEM_WIN_NO; ++i) {
428 /* disable memory window */
433 /* turn off voltage */
434 voltage_set(_slot_, 0, 0);
436 /* disable external hardware */
437 printf ("Shutdown and Poweroff " PCMCIA_SLOT_MSG "\n");
438 hardware_disable(_slot_);
442 #endif /* CONFIG_PXA_PCMCIA */
444 #endif /* CONFIG_I82365 */
446 #ifdef CONFIG_PXA_PCMCIA
447 static int pcmcia_off (void)
453 #endif /* CFG_CMD_PCMCIA */
455 /* -------------------------------------------------------------------- */
457 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
459 #define MAX_TUPEL_SZ 512
460 #define MAX_FEATURES 4
462 int ide_devices_found;
463 static int check_ide_device (int slot)
465 volatile uchar *ident = NULL;
466 volatile uchar *feature_p[MAX_FEATURES];
467 volatile uchar *p, *start, *addr;
471 ushort config_base = 0;
475 addr = (volatile uchar *)(CFG_PCMCIA_MEM_ADDR +
476 CFG_PCMCIA_MEM_SIZE * (slot * 4));
477 debug ("PCMCIA MEM: %08lX\n", (ulong)addr);
479 start = p = (volatile uchar *) addr;
481 while ((p - start) < MAX_TUPEL_SZ) {
485 if (code == 0xFF) { /* End of chain */
490 #if defined(DEBUG) && (DEBUG > 1)
491 { volatile uchar *q = p;
492 printf ("\nTuple code %02x length %d\n\tData:",
495 for (i = 0; i < len; ++i) {
496 printf (" %02x", *q);
506 /* Fix for broken SanDisk which may have 0x80 bit set */
510 if (n_features < MAX_FEATURES)
511 feature_p[n_features++] = p;
514 config_base = (*(p+6) << 8) + (*(p+4));
515 debug ("\n## Config_base = %04x ###\n", config_base);
522 found = identify (ident);
524 if (func_id != ((uchar)~0)) {
525 print_funcid (func_id);
527 if (func_id == CISTPL_FUNCID_FIXED)
530 return (1); /* no disk drive */
533 for (i=0; i<n_features; ++i) {
534 print_fixed (feature_p[i]);
538 printf ("unknown card type\n");
542 ide_devices_found |= (1 << slot);
544 /* set I/O area in config reg -> only valid for ARGOSY D5!!! */
545 *((uchar *)(addr + config_base)) = 1;
549 #endif /* CONFIG_IDE_8xx_PCCARD */
551 /* -------------------------------------------------------------------- */
554 /* -------------------------------------------------------------------- */
555 /* board specific stuff: */
556 /* voltage_set(), hardware_enable() and hardware_disable() */
557 /* -------------------------------------------------------------------- */
559 /* -------------------------------------------------------------------- */
560 /* RPX Boards from Embedded Planet */
561 /* -------------------------------------------------------------------- */
563 #if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_RPXLITE)
565 /* The RPX boards seems to have it's bus monitor timeout set to 6*8 clocks.
566 * SYPCR is write once only, therefore must the slowest memory be faster
567 * than the bus monitor or we will get a machine check due to the bus timeout.
570 #define PCMCIA_BOARD_MSG "RPX CLASSIC or RPX LITE"
572 #undef PCMCIA_BMT_LIMIT
573 #define PCMCIA_BMT_LIMIT (6*8)
575 static int voltage_set(int slot, int vcc, int vpp)
581 case 33: reg |= BCSR1_PCVCTL4; break;
582 case 50: reg |= BCSR1_PCVCTL5; break;
591 reg |= BCSR1_PCVCTL6;
596 reg |= BCSR1_PCVCTL7;
603 /* first, turn off all power */
605 *((uint *)RPX_CSR_ADDR) &= ~(BCSR1_PCVCTL4 | BCSR1_PCVCTL5
606 | BCSR1_PCVCTL6 | BCSR1_PCVCTL7);
608 /* enable new powersettings */
610 *((uint *)RPX_CSR_ADDR) |= reg;
615 #define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
616 static int hardware_enable (int slot)
618 return 0; /* No hardware to enable */
620 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
621 static int hardware_disable(int slot)
623 return 0; /* No hardware to disable */
625 #endif /* CFG_CMD_PCMCIA */
626 #endif /* CONFIG_RPXCLASSIC */
628 /* -------------------------------------------------------------------- */
629 /* (F)ADS Boards from Motorola */
630 /* -------------------------------------------------------------------- */
632 #if defined(CONFIG_ADS) || defined(CONFIG_FADS)
635 #define PCMCIA_BOARD_MSG "ADS"
636 #define PCMCIA_GLITCHY_CD /* My ADS board needs this */
638 #define PCMCIA_BOARD_MSG "FADS"
641 static int voltage_set(int slot, int vcc, int vpp)
646 case 0: reg = 0; break;
647 case 50: reg = 1; break;
648 case 120: reg = 2; break;
653 case 0: reg = 0; break;
655 case 50: reg = BCSR1_PCCVCCON; break;
658 case 33: reg = BCSR1_PCCVCC0 | BCSR1_PCCVCC1; break;
659 case 50: reg = BCSR1_PCCVCC1; break;
664 /* first, turn off all power */
667 *((uint *)BCSR1) |= BCSR1_PCCVCCON;
670 *((uint *)BCSR1) &= ~(BCSR1_PCCVCC0 | BCSR1_PCCVCC1);
672 *((uint *)BCSR1) &= ~BCSR1_PCCVPP_MASK;
674 /* enable new powersettings */
677 *((uint *)BCSR1) &= ~reg;
680 *((uint *)BCSR1) |= reg;
683 *((uint *)BCSR1) |= reg << 20;
688 #define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
690 static int hardware_enable(int slot)
692 *((uint *)BCSR1) &= ~BCSR1_PCCEN;
696 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
697 static int hardware_disable(int slot)
699 *((uint *)BCSR1) &= ~BCSR1_PCCEN;
702 #endif /* CFG_CMD_PCMCIA */
706 /* -------------------------------------------------------------------- */
707 /* TQM8xxL Boards by TQ Components */
708 /* SC8xx Boards by SinoVee Microsystems */
709 /* -------------------------------------------------------------------- */
711 #if defined(CONFIG_TQM8xxL) || defined(CONFIG_SVM_SC8xx)
713 #if defined(CONFIG_TQM8xxL)
714 #define PCMCIA_BOARD_MSG "TQM8xxL"
716 #if defined(CONFIG_SVM_SC8xx)
717 #define PCMCIA_BOARD_MSG "SC8xx"
720 static int hardware_enable(int slot)
722 volatile immap_t *immap;
723 volatile cpm8xx_t *cp;
724 volatile pcmconf8xx_t *pcmp;
725 volatile sysconf8xx_t *sysp;
728 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
732 immap = (immap_t *)CFG_IMMR;
733 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
734 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
735 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
738 * Configure SIUMCR to enable PCMCIA port B
739 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
741 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
743 /* clear interrupt state, and disable interrupts */
744 pcmp->pcmc_pscr = PCMCIA_MASK(slot);
745 pcmp->pcmc_per &= ~PCMCIA_MASK(slot);
748 * Disable interrupts, DMA, and PCMCIA buffers
749 * (isolate the interface) and assert RESET signal
751 debug ("Disable PCMCIA buffers and assert RESET\n");
753 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
755 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
757 PCMCIA_PGCRX(slot) = reg;
763 * Configure Port C pins for
764 * 5 Volts Enable and 3 Volts enable
766 immap->im_ioport.iop_pcpar &= ~(0x0002 | 0x0004);
767 immap->im_ioport.iop_pcso &= ~(0x0002 | 0x0004);
768 /* remove all power */
770 immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004);
772 #else /* CONFIG_HMI10 */
774 * Configure Port B pins for
775 * 5 Volts Enable and 3 Volts enable
777 immap->im_cpm.cp_pbpar &= ~(0x00000300);
779 /* remove all power */
780 immap->im_cpm.cp_pbdat |= 0x00000300;
781 #endif /* CONFIG_HMI10 */
784 * Make sure there is a card in the slot, then configure the interface.
787 debug ("[%d] %s: PIPR(%p)=0x%x\n",
788 __LINE__,__FUNCTION__,
789 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
791 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
793 if (pcmp->pcmc_pipr & (0x10000000 >> (slot << 4))) {
794 #endif /* CONFIG_HMI10 */
795 printf (" No Card found\n");
802 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
803 reg = pcmp->pcmc_pipr;
804 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
806 (reg&PCMCIA_VS1(slot))?"n":"ff",
807 (reg&PCMCIA_VS2(slot))?"n":"ff");
809 if ((reg & mask) == mask) {
811 immap->im_ioport.iop_pcdat |= 0x0004;
813 immap->im_cpm.cp_pbdat &= ~(0x0000100);
814 #endif /* CONFIG_HMI10 */
815 puts (" 5.0V card found: ");
818 immap->im_ioport.iop_pcdat |= 0x0002;
820 immap->im_cpm.cp_pbdat &= ~(0x0000200);
821 #endif /* CONFIG_HMI10 */
822 puts (" 3.3V card found: ");
825 immap->im_ioport.iop_pcdir |= (0x0002 | 0x0004);
827 immap->im_cpm.cp_pbdir |= 0x00000300;
828 #endif /* CONFIG_HMI10 */
830 if ((reg & mask) == mask) {
831 puts (" 5.0V card found: ");
833 puts (" 3.3V card found: ");
837 /* VCC switch error flag, PCMCIA slot INPACK_ pin */
838 cp->cp_pbdir &= ~(0x0020 | 0x0010);
839 cp->cp_pbpar &= ~(0x0020 | 0x0010);
843 debug ("Enable PCMCIA buffers and stop RESET\n");
844 reg = PCMCIA_PGCRX(slot);
845 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
847 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
849 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
851 PCMCIA_PGCRX(slot) = reg;
853 udelay(250000); /* some cards need >150 ms to come up :-( */
855 debug ("# hardware_enable done\n");
861 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
862 static int hardware_disable(int slot)
864 volatile immap_t *immap;
865 volatile pcmconf8xx_t *pcmp;
868 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
870 immap = (immap_t *)CFG_IMMR;
871 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
875 /* remove all power */
876 immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004);
878 #else /* CONFIG_HMI10 */
879 immap->im_cpm.cp_pbdat |= 0x00000300;
880 #endif /* CONFIG_HMI10 */
882 debug ("Disable PCMCIA buffers and assert RESET\n");
884 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
886 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
888 PCMCIA_PGCRX(slot) = reg;
894 #endif /* CFG_CMD_PCMCIA */
897 static int voltage_set(int slot, int vcc, int vpp)
902 static int voltage_set(int slot, int vcc, int vpp)
904 volatile immap_t *immap;
905 volatile pcmconf8xx_t *pcmp;
908 debug ("voltage_set: "
910 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
911 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
913 immap = (immap_t *)CFG_IMMR;
914 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
916 * Disable PCMCIA buffers (isolate the interface)
917 * and assert RESET signal
919 debug ("Disable PCMCIA buffers and assert RESET\n");
920 reg = PCMCIA_PGCRX(slot);
921 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
923 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
925 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
927 PCMCIA_PGCRX(slot) = reg;
932 * Configure Port C pins for
933 * 5 Volts Enable and 3 Volts enable,
936 debug ("PCMCIA power OFF\n");
937 immap->im_ioport.iop_pcpar &= ~(0x0002 | 0x0004);
938 immap->im_ioport.iop_pcso &= ~(0x0002 | 0x0004);
939 immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004);
944 case 33: reg |= 0x0002; break;
945 case 50: reg |= 0x0004; break;
948 #else /* CONFIG_HMI10 */
950 * Configure Port B pins for
951 * 5 Volts Enable and 3 Volts enable,
954 debug ("PCMCIA power OFF\n");
955 immap->im_cpm.cp_pbpar &= ~(0x00000300);
956 /* remove all power */
958 immap->im_cpm.cp_pbdat |= 0x00000300;
963 case 33: reg |= 0x00000200; break;
964 case 50: reg |= 0x00000100; break;
967 #endif /* CONFIG_HMI10 */
969 /* Checking supported voltages */
971 debug ("PIPR: 0x%x --> %s\n",
973 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
976 immap->im_ioport.iop_pcdat |= reg;
977 immap->im_ioport.iop_pcdir |= (0x0002 | 0x0004);
979 immap->im_cpm.cp_pbdat &= !reg;
980 immap->im_cpm.cp_pbdir |= 0x00000300;
981 #endif /* CONFIG_HMI10 */
984 debug ("PCMCIA powered at %sV\n",
985 (reg&0x0004) ? "5.0" : "3.3");
987 debug ("PCMCIA powered at %sV\n",
988 (reg&0x00000200) ? "5.0" : "3.3");
989 #endif /* CONFIG_HMI10 */
991 debug ("PCMCIA powered down\n");
995 debug ("Enable PCMCIA buffers and stop RESET\n");
996 reg = PCMCIA_PGCRX(slot);
997 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
999 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1001 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1003 PCMCIA_PGCRX(slot) = reg;
1006 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
1012 #endif /* TQM8xxL */
1015 /* -------------------------------------------------------------------- */
1017 /* -------------------------------------------------------------------- */
1019 #if defined(CONFIG_LWMON)
1021 #define PCMCIA_BOARD_MSG "LWMON"
1023 /* #define's for MAX1604 Power Switch */
1024 #define MAX1604_OP_SUS 0x80
1025 #define MAX1604_VCCBON 0x40
1026 #define MAX1604_VCC_35 0x20
1027 #define MAX1604_VCCBHIZ 0x10
1028 #define MAX1604_VPPBON 0x08
1029 #define MAX1604_VPPBPBPGM 0x04
1030 #define MAX1604_VPPBHIZ 0x02
1033 static int hardware_enable(int slot)
1035 volatile immap_t *immap;
1036 volatile cpm8xx_t *cp;
1037 volatile pcmconf8xx_t *pcmp;
1038 volatile sysconf8xx_t *sysp;
1043 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1045 /* Switch on PCMCIA port in PIC register 0x60 */
1046 reg = pic_read (0x60);
1047 debug ("[%d] PIC read: reg_60 = 0x%02x\n", __LINE__, reg);
1049 /* reg |= 0x08; Vpp not needed */
1050 pic_write (0x60, reg);
1052 reg = pic_read (0x60);
1053 printf ("[%d] PIC read: reg_60 = 0x%02x\n", __LINE__, reg);
1057 immap = (immap_t *)CFG_IMMR;
1058 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
1059 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1060 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1063 * Configure SIUMCR to enable PCMCIA port B
1064 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
1066 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
1068 /* clear interrupt state, and disable interrupts */
1069 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
1070 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
1073 * Disable interrupts, DMA, and PCMCIA buffers
1074 * (isolate the interface) and assert RESET signal
1076 debug ("Disable PCMCIA buffers and assert RESET\n");
1078 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1079 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1080 PCMCIA_PGCRX(_slot_) = reg;
1084 * Make sure there is a card in the slot, then configure the interface.
1087 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1088 __LINE__,__FUNCTION__,
1089 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
1090 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
1091 printf (" No Card found\n");
1098 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
1099 reg = pcmp->pcmc_pipr;
1100 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
1102 (reg&PCMCIA_VS1(slot))?"n":"ff",
1103 (reg&PCMCIA_VS2(slot))?"n":"ff");
1104 if ((reg & mask) == mask) {
1105 val = 0; /* VCCB3/5 = 0 ==> use Vx = 5.0 V */
1106 puts (" 5.0V card found: ");
1108 val = MAX1604_VCC_35; /* VCCB3/5 = 1 ==> use Vy = 3.3 V */
1109 puts (" 3.3V card found: ");
1113 val |= MAX1604_OP_SUS | MAX1604_VCCBON;
1114 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
1115 i2c_write (CFG_I2C_POWER_A_ADDR, 0, 0, &val, 1);
1119 debug ("Enable PCMCIA buffers and stop RESET\n");
1120 reg = PCMCIA_PGCRX(_slot_);
1121 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1122 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1123 PCMCIA_PGCRX(_slot_) = reg;
1125 udelay(250000); /* some cards need >150 ms to come up :-( */
1127 debug ("# hardware_enable done\n");
1133 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1134 static int hardware_disable(int slot)
1136 volatile immap_t *immap;
1137 volatile pcmconf8xx_t *pcmp;
1141 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1143 immap = (immap_t *)CFG_IMMR;
1144 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1146 /* remove all power, put output in high impedance state */
1147 val = MAX1604_VCCBHIZ | MAX1604_VPPBHIZ;
1148 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
1149 i2c_write (CFG_I2C_POWER_A_ADDR, 0, 0, &val, 1);
1151 /* Configure PCMCIA General Control Register */
1152 debug ("Disable PCMCIA buffers and assert RESET\n");
1154 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1155 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1156 PCMCIA_PGCRX(_slot_) = reg;
1158 /* Switch off PCMCIA port in PIC register 0x60 */
1159 reg = pic_read (0x60);
1160 debug ("[%d] PIC read: reg_60 = 0x%02x\n", __LINE__, reg);
1163 pic_write (0x60, reg);
1165 reg = pic_read (0x60);
1166 printf ("[%d] PIC read: reg_60 = 0x%02x\n", __LINE__, reg);
1172 #endif /* CFG_CMD_PCMCIA */
1175 static int voltage_set(int slot, int vcc, int vpp)
1177 volatile immap_t *immap;
1178 volatile pcmconf8xx_t *pcmp;
1182 debug ("voltage_set: "
1184 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
1185 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
1187 immap = (immap_t *)CFG_IMMR;
1188 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1190 * Disable PCMCIA buffers (isolate the interface)
1191 * and assert RESET signal
1193 debug ("Disable PCMCIA buffers and assert RESET\n");
1194 reg = PCMCIA_PGCRX(_slot_);
1195 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1196 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1197 PCMCIA_PGCRX(_slot_) = reg;
1201 * Turn off all power (switch to high impedance)
1203 debug ("PCMCIA power OFF\n");
1204 val = MAX1604_VCCBHIZ | MAX1604_VPPBHIZ;
1205 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
1206 i2c_write (CFG_I2C_POWER_A_ADDR, 0, 0, &val, 1);
1211 case 33: val = MAX1604_VCC_35; break;
1216 /* Checking supported voltages */
1218 debug ("PIPR: 0x%x --> %s\n",
1220 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
1222 i2c_write (CFG_I2C_POWER_A_ADDR, 0, 0, &val, 1);
1224 debug ("PCMCIA powered at %sV\n",
1225 (val & MAX1604_VCC_35) ? "3.3" : "5.0");
1227 debug ("PCMCIA powered down\n");
1231 debug ("Enable PCMCIA buffers and stop RESET\n");
1232 reg = PCMCIA_PGCRX(_slot_);
1233 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1234 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1235 PCMCIA_PGCRX(_slot_) = reg;
1238 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
1245 /* -------------------------------------------------------------------- */
1246 /* GTH board by Corelatus AB */
1247 /* -------------------------------------------------------------------- */
1248 #if defined(CONFIG_GTH)
1250 #define PCMCIA_BOARD_MSG "GTH COMPACT FLASH"
1252 static int voltage_set (int slot, int vcc, int vpp)
1257 static int hardware_enable (int slot)
1259 volatile immap_t *immap;
1260 volatile cpm8xx_t *cp;
1261 volatile pcmconf8xx_t *pcmp;
1262 volatile sysconf8xx_t *sysp;
1265 debug ("hardware_enable: GTH Slot %c\n", 'A' + slot);
1267 immap = (immap_t *) CFG_IMMR;
1268 sysp = (sysconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_siu_conf));
1269 pcmp = (pcmconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_pcmcia));
1270 cp = (cpm8xx_t *) (&(((immap_t *) CFG_IMMR)->im_cpm));
1272 /* clear interrupt state, and disable interrupts */
1273 pcmp->pcmc_pscr = PCMCIA_MASK (_slot_);
1274 pcmp->pcmc_per &= ~PCMCIA_MASK (_slot_);
1277 * Disable interrupts, DMA, and PCMCIA buffers
1278 * (isolate the interface) and assert RESET signal
1280 debug ("Disable PCMCIA buffers and assert RESET\n");
1282 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1283 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1284 PCMCIA_PGCRX (_slot_) = reg;
1288 * Make sure there is a card in the slot,
1289 * then configure the interface.
1292 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1293 __LINE__, __FUNCTION__,
1294 &(pcmp->pcmc_pipr), pcmp->pcmc_pipr);
1295 if (pcmp->pcmc_pipr & 0x98000000) {
1296 printf (" No Card found\n");
1300 mask = PCMCIA_VS1 (slot) | PCMCIA_VS2 (slot);
1301 reg = pcmp->pcmc_pipr;
1302 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
1304 (reg & PCMCIA_VS1 (slot)) ? "n" : "ff",
1305 (reg & PCMCIA_VS2 (slot)) ? "n" : "ff");
1307 debug ("Enable PCMCIA buffers and stop RESET\n");
1308 reg = PCMCIA_PGCRX (_slot_);
1309 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1310 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1311 PCMCIA_PGCRX (_slot_) = reg;
1313 udelay (250000); /* some cards need >150 ms to come up :-( */
1315 debug ("# hardware_enable done\n");
1319 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1320 static int hardware_disable(int slot)
1322 return 0; /* No hardware to disable */
1324 #endif /* CFG_CMD_PCMCIA */
1325 #endif /* CONFIG_GTH */
1327 /* -------------------------------------------------------------------- */
1328 /* ICU862 Boards by Cambridge Broadband Ltd. */
1329 /* -------------------------------------------------------------------- */
1331 #if defined(CONFIG_ICU862)
1333 #define PCMCIA_BOARD_MSG "ICU862"
1335 static void cfg_port_B (void);
1337 static int hardware_enable(int slot)
1339 volatile immap_t *immap;
1340 volatile cpm8xx_t *cp;
1341 volatile pcmconf8xx_t *pcmp;
1342 volatile sysconf8xx_t *sysp;
1343 uint reg, pipr, mask;
1346 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1350 immap = (immap_t *)CFG_IMMR;
1351 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
1352 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1353 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1355 /* Configure Port B for TPS2205 PC-Card Power-Interface Switch */
1359 * Configure SIUMCR to enable PCMCIA port B
1360 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
1362 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
1364 /* clear interrupt state, and disable interrupts */
1365 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
1366 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
1369 * Disable interrupts, DMA, and PCMCIA buffers
1370 * (isolate the interface) and assert RESET signal
1372 debug ("Disable PCMCIA buffers and assert RESET\n");
1374 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1375 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1376 PCMCIA_PGCRX(_slot_) = reg;
1380 * Make sure there is a card in the slot, then configure the interface.
1383 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1384 __LINE__,__FUNCTION__,
1385 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
1386 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
1387 printf (" No Card found\n");
1392 * Power On: Set VAVCC to 3.3V or 5V, set VAVPP to Hi-Z
1394 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
1395 pipr = pcmp->pcmc_pipr;
1396 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
1398 (reg&PCMCIA_VS1(slot))?"n":"ff",
1399 (reg&PCMCIA_VS2(slot))?"n":"ff");
1402 if ((pipr & mask) == mask) {
1403 reg |= (TPS2205_VPP_PGM | TPS2205_VPP_VCC | /* VAVPP => Hi-Z */
1404 TPS2205_VCC3); /* 3V off */
1405 reg &= ~(TPS2205_VCC5); /* 5V on */
1406 puts (" 5.0V card found: ");
1408 reg |= (TPS2205_VPP_PGM | TPS2205_VPP_VCC | /* VAVPP => Hi-Z */
1409 TPS2205_VCC5); /* 5V off */
1410 reg &= ~(TPS2205_VCC3); /* 3V on */
1411 puts (" 3.3V card found: ");
1414 debug ("\nPB DAT: %08x -> 3.3V %s 5.0V %s VPP_PGM %s VPP_VCC %s\n",
1416 (reg & TPS2205_VCC3) ? "off" : "on",
1417 (reg & TPS2205_VCC5) ? "off" : "on",
1418 (reg & TPS2205_VPP_PGM) ? "off" : "on",
1419 (reg & TPS2205_VPP_VCC) ? "off" : "on" );
1423 /* Wait 500 ms; use this to check for over-current */
1424 for (i=0; i<5000; ++i) {
1425 if ((cp->cp_pbdat & TPS2205_OC) == 0) {
1426 printf (" *** Overcurrent - Safety shutdown ***\n");
1427 cp->cp_pbdat &= ~(TPS2205_SHDN);
1433 debug ("Enable PCMCIA buffers and stop RESET\n");
1434 reg = PCMCIA_PGCRX(_slot_);
1435 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1436 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1437 PCMCIA_PGCRX(_slot_) = reg;
1439 udelay(250000); /* some cards need >150 ms to come up :-( */
1441 debug ("# hardware_enable done\n");
1447 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1448 static int hardware_disable(int slot)
1450 volatile immap_t *immap;
1451 volatile cpm8xx_t *cp;
1452 volatile pcmconf8xx_t *pcmp;
1455 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1457 immap = (immap_t *)CFG_IMMR;
1458 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1459 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1462 cp->cp_pbdat &= ~(TPS2205_SHDN);
1464 /* Configure PCMCIA General Control Register */
1465 debug ("Disable PCMCIA buffers and assert RESET\n");
1467 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1468 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1469 PCMCIA_PGCRX(_slot_) = reg;
1475 #endif /* CFG_CMD_PCMCIA */
1478 static int voltage_set(int slot, int vcc, int vpp)
1480 volatile immap_t *immap;
1481 volatile cpm8xx_t *cp;
1482 volatile pcmconf8xx_t *pcmp;
1485 debug ("voltage_set: "
1487 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
1488 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
1490 immap = (immap_t *)CFG_IMMR;
1491 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1492 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1494 * Disable PCMCIA buffers (isolate the interface)
1495 * and assert RESET signal
1497 debug ("Disable PCMCIA buffers and assert RESET\n");
1498 reg = PCMCIA_PGCRX(_slot_);
1499 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1500 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1501 PCMCIA_PGCRX(_slot_) = reg;
1505 * Configure Port C pins for
1506 * 5 Volts Enable and 3 Volts enable,
1507 * Turn all power pins to Hi-Z
1509 debug ("PCMCIA power OFF\n");
1510 cfg_port_B (); /* Enables switch, but all in Hi-Z */
1515 case 0: break; /* Switch off */
1516 case 33: reg &= ~TPS2205_VCC3; break; /* Switch on 3.3V */
1517 case 50: reg &= ~TPS2205_VCC5; break; /* Switch on 5.0V */
1521 /* Checking supported voltages */
1523 debug ("PIPR: 0x%x --> %s\n",
1525 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
1533 if ((reg & TPS2205_VCC3) == 0) {
1535 } else if ((reg & TPS2205_VCC5) == 0) {
1540 printf ("PCMCIA powered %s\n", s);
1545 debug ("Enable PCMCIA buffers and stop RESET\n");
1546 reg = PCMCIA_PGCRX(_slot_);
1547 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1548 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1549 PCMCIA_PGCRX(_slot_) = reg;
1552 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
1557 static void cfg_port_B (void)
1559 volatile immap_t *immap;
1560 volatile cpm8xx_t *cp;
1563 immap = (immap_t *)CFG_IMMR;
1564 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1567 * Configure Port B for TPS2205 PC-Card Power-Interface Switch
1569 * Switch off all voltages, assert shutdown
1572 reg |= (TPS2205_VPP_PGM | TPS2205_VPP_VCC | /* VAVPP => Hi-Z */
1573 TPS2205_VCC3 | TPS2205_VCC5 | /* VAVCC => Hi-Z */
1574 TPS2205_SHDN); /* enable switch */
1577 cp->cp_pbpar &= ~(TPS2205_INPUTS | TPS2205_OUTPUTS);
1579 reg = cp->cp_pbdir & ~(TPS2205_INPUTS);
1580 cp->cp_pbdir = reg | TPS2205_OUTPUTS;
1582 debug ("Set Port B: PAR: %08x DIR: %08x DAT: %08x\n",
1583 cp->cp_pbpar, cp->cp_pbdir, cp->cp_pbdat);
1589 /* -------------------------------------------------------------------- */
1590 /* C2MON Boards by TTTech Computertechnik AG */
1591 /* -------------------------------------------------------------------- */
1593 #if defined(CONFIG_C2MON)
1595 #define PCMCIA_BOARD_MSG "C2MON"
1597 static void cfg_ports (void);
1599 static int hardware_enable(int slot)
1601 volatile immap_t *immap;
1602 volatile cpm8xx_t *cp;
1603 volatile pcmconf8xx_t *pcmp;
1604 volatile sysconf8xx_t *sysp;
1605 uint reg, pipr, mask;
1609 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1613 immap = (immap_t *)CFG_IMMR;
1614 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
1615 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1616 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1618 /* Configure Ports for TPS2211A PC-Card Power-Interface Switch */
1622 * Configure SIUMCR to enable PCMCIA port B
1623 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
1625 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
1627 /* clear interrupt state, and disable interrupts */
1628 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
1629 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
1632 * Disable interrupts, DMA, and PCMCIA buffers
1633 * (isolate the interface) and assert RESET signal
1635 debug ("Disable PCMCIA buffers and assert RESET\n");
1637 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1638 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1639 PCMCIA_PGCRX(_slot_) = reg;
1643 * Make sure there is a card in the slot, then configure the interface.
1646 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1647 __LINE__,__FUNCTION__,
1648 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
1649 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
1650 printf (" No Card found\n");
1655 * Power On: Set VAVCC to 3.3V or 5V, set VAVPP to Hi-Z
1657 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
1658 pipr = pcmp->pcmc_pipr;
1659 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
1661 (reg&PCMCIA_VS1(slot))?"n":"ff",
1662 (reg&PCMCIA_VS2(slot))?"n":"ff");
1664 sreg = immap->im_ioport.iop_pcdat;
1665 if ((pipr & mask) == mask) {
1666 sreg |= (TPS2211_VPPD0 | TPS2211_VPPD1 | /* VAVPP => Hi-Z */
1667 TPS2211_VCCD1); /* 5V on */
1668 sreg &= ~(TPS2211_VCCD0); /* 3V off */
1669 puts (" 5.0V card found: ");
1671 sreg |= (TPS2211_VPPD0 | TPS2211_VPPD1 | /* VAVPP => Hi-Z */
1672 TPS2211_VCCD0); /* 3V on */
1673 sreg &= ~(TPS2211_VCCD1); /* 5V off */
1674 puts (" 3.3V card found: ");
1677 debug ("\nPC DAT: %04x -> 3.3V %s 5.0V %s\n",
1679 ( (sreg & TPS2211_VCCD0) && !(sreg & TPS2211_VCCD1)) ? "on" : "off",
1680 (!(sreg & TPS2211_VCCD0) && (sreg & TPS2211_VCCD1)) ? "on" : "off"
1683 immap->im_ioport.iop_pcdat = sreg;
1685 /* Wait 500 ms; use this to check for over-current */
1686 for (i=0; i<5000; ++i) {
1687 if ((cp->cp_pbdat & TPS2211_OC) == 0) {
1688 printf (" *** Overcurrent - Safety shutdown ***\n");
1689 immap->im_ioport.iop_pcdat &= ~(TPS2211_VCCD0|TPS2211_VCCD1);
1695 debug ("Enable PCMCIA buffers and stop RESET\n");
1696 reg = PCMCIA_PGCRX(_slot_);
1697 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1698 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1699 PCMCIA_PGCRX(_slot_) = reg;
1701 udelay(250000); /* some cards need >150 ms to come up :-( */
1703 debug ("# hardware_enable done\n");
1709 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1710 static int hardware_disable(int slot)
1712 volatile immap_t *immap;
1713 volatile cpm8xx_t *cp;
1714 volatile pcmconf8xx_t *pcmp;
1717 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1719 immap = (immap_t *)CFG_IMMR;
1720 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1722 /* Configure PCMCIA General Control Register */
1723 debug ("Disable PCMCIA buffers and assert RESET\n");
1725 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1726 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1727 PCMCIA_PGCRX(_slot_) = reg;
1729 /* ALl voltages off / Hi-Z */
1730 immap->im_ioport.iop_pcdat |= (TPS2211_VPPD0 | TPS2211_VPPD1 |
1731 TPS2211_VCCD0 | TPS2211_VCCD1 );
1737 #endif /* CFG_CMD_PCMCIA */
1740 static int voltage_set(int slot, int vcc, int vpp)
1742 volatile immap_t *immap;
1743 volatile cpm8xx_t *cp;
1744 volatile pcmconf8xx_t *pcmp;
1748 debug ("voltage_set: "
1750 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
1751 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
1753 immap = (immap_t *)CFG_IMMR;
1754 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1755 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1757 * Disable PCMCIA buffers (isolate the interface)
1758 * and assert RESET signal
1760 debug ("Disable PCMCIA buffers and assert RESET\n");
1761 reg = PCMCIA_PGCRX(_slot_);
1762 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1763 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1764 PCMCIA_PGCRX(_slot_) = reg;
1768 * Configure Port C pins for
1769 * 5 Volts Enable and 3 Volts enable,
1770 * Turn all power pins to Hi-Z
1772 debug ("PCMCIA power OFF\n");
1773 cfg_ports (); /* Enables switch, but all in Hi-Z */
1775 sreg = immap->im_ioport.iop_pcdat;
1776 sreg |= TPS2211_VPPD0 | TPS2211_VPPD1; /* VAVPP always Hi-Z */
1779 case 0: break; /* Switch off */
1780 case 33: sreg |= TPS2211_VCCD0; /* Switch on 3.3V */
1781 sreg &= ~TPS2211_VCCD1;
1783 case 50: sreg &= ~TPS2211_VCCD0; /* Switch on 5.0V */
1784 sreg |= TPS2211_VCCD1;
1789 /* Checking supported voltages */
1791 debug ("PIPR: 0x%x --> %s\n",
1793 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
1795 immap->im_ioport.iop_pcdat = sreg;
1801 if ((sreg & TPS2211_VCCD0) && !(sreg & TPS2211_VCCD1)) {
1803 } else if (!(sreg & TPS2211_VCCD0) && (sreg & TPS2211_VCCD1)) {
1808 printf ("PCMCIA powered %s\n", s);
1813 debug ("Enable PCMCIA buffers and stop RESET\n");
1814 reg = PCMCIA_PGCRX(_slot_);
1815 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1816 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1817 PCMCIA_PGCRX(_slot_) = reg;
1820 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
1825 static void cfg_ports (void)
1827 volatile immap_t *immap;
1828 volatile cpm8xx_t *cp;
1831 immap = (immap_t *)CFG_IMMR;
1832 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1835 * Configure Port C for TPS2211 PC-Card Power-Interface Switch
1837 * Switch off all voltages, assert shutdown
1839 sreg = immap->im_ioport.iop_pcdat;
1840 sreg |= (TPS2211_VPPD0 | TPS2211_VPPD1); /* VAVPP => Hi-Z */
1841 sreg &= ~(TPS2211_VCCD0 | TPS2211_VCCD1); /* 3V and 5V off */
1842 immap->im_ioport.iop_pcdat = sreg;
1844 immap->im_ioport.iop_pcpar &= ~(TPS2211_OUTPUTS);
1845 immap->im_ioport.iop_pcdir |= TPS2211_OUTPUTS;
1847 debug ("Set Port C: PAR: %04x DIR: %04x DAT: %04x\n",
1848 immap->im_ioport.iop_pcpar,
1849 immap->im_ioport.iop_pcdir,
1850 immap->im_ioport.iop_pcdat);
1853 * Configure Port B for TPS2211 PC-Card Power-Interface Switch
1855 * Over-Current Input only
1857 cp->cp_pbpar &= ~(TPS2211_INPUTS);
1858 cp->cp_pbdir &= ~(TPS2211_INPUTS);
1860 debug ("Set Port B: PAR: %08x DIR: %08x DAT: %08x\n",
1861 cp->cp_pbpar, cp->cp_pbdir, cp->cp_pbdat);
1866 /* -------------------------------------------------------------------- */
1867 /* MBX board from Morotola */
1868 /* -------------------------------------------------------------------- */
1870 #if defined( CONFIG_MBX )
1871 #include <../board/mbx8xx/csr.h>
1873 /* A lot of this has been taken from the RPX code in this file it works from me.
1874 I have added the voltage selection for the MBX board. */
1876 /* MBX voltage bit in control register #2 */
1877 #define CR2_VPP12 ((uchar)0x10)
1878 #define CR2_VPPVDD ((uchar)0x20)
1879 #define CR2_VDD5 ((uchar)0x40)
1880 #define CR2_VDD3 ((uchar)0x80)
1882 #define PCMCIA_BOARD_MSG "MBX860"
1884 static int voltage_set (int slot, int vcc, int vpp)
1888 debug ("voltage_set: PCMCIA_BOARD_MSG Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
1889 'A' + slot, vcc / 10, vcc % 10, vpp / 10, vcc % 10);
1922 /* first, turn off all power */
1923 MBX_CSR2 &= ~(CR2_VDDSEL | CR2_VPPSEL);
1925 /* enable new powersettings */
1927 debug ("MBX_CSR2 read = 0x%02x\n", MBX_CSR2);
1932 static int hardware_enable (int slot)
1934 volatile immap_t *immap;
1935 volatile cpm8xx_t *cp;
1936 volatile pcmconf8xx_t *pcmp;
1937 volatile sysconf8xx_t *sysp;
1940 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n",
1945 immap = (immap_t *) CFG_IMMR;
1946 sysp = (sysconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_siu_conf));
1947 pcmp = (pcmconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_pcmcia));
1948 cp = (cpm8xx_t *) (&(((immap_t *) CFG_IMMR)->im_cpm));
1950 /* clear interrupt state, and disable interrupts */
1951 pcmp->pcmc_pscr = PCMCIA_MASK (_slot_);
1952 pcmp->pcmc_per &= ~PCMCIA_MASK (_slot_);
1955 * Disable interrupts, DMA, and PCMCIA buffers
1956 * (isolate the interface) and assert RESET signal
1958 debug ("Disable PCMCIA buffers and assert RESET\n");
1960 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1961 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1962 PCMCIA_PGCRX (_slot_) = reg;
1965 /* remove all power */
1966 voltage_set (slot, 0, 0);
1968 * Make sure there is a card in the slot, then configure the interface.
1971 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1972 __LINE__,__FUNCTION__,
1973 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
1974 #ifndef CONFIG_HMI10
1975 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
1977 if (pcmp->pcmc_pipr & (0x10000000 >> (slot << 4))) {
1978 #endif /* CONFIG_HMI10 */
1979 printf (" No Card found\n");
1986 mask = PCMCIA_VS1 (_slot_) | PCMCIA_VS2 (_slot_);
1987 reg = pcmp->pcmc_pipr;
1988 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n", reg,
1989 (reg & PCMCIA_VS1 (slot)) ? "n" : "ff",
1990 (reg & PCMCIA_VS2 (slot)) ? "n" : "ff");
1992 if ((reg & mask) == mask) {
1993 voltage_set (_slot_, 50, 0);
1994 printf (" 5.0V card found: ");
1996 voltage_set (_slot_, 33, 0);
1997 printf (" 3.3V card found: ");
2000 debug ("Enable PCMCIA buffers and stop RESET\n");
2001 reg = PCMCIA_PGCRX (_slot_);
2002 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2003 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2004 PCMCIA_PGCRX (_slot_) = reg;
2006 udelay (250000); /* some cards need >150 ms to come up :-( */
2008 debug ("# hardware_enable done\n");
2013 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
2014 static int hardware_disable (int slot)
2016 return 0; /* No hardware to disable */
2018 #endif /* CFG_CMD_PCMCIA */
2019 #endif /* CONFIG_MBX */
2020 /* -------------------------------------------------------------------- */
2022 /* -------------------------------------------------------------------- */
2024 #if defined(CONFIG_R360MPI)
2026 #define PCMCIA_BOARD_MSG "R360MPI"
2029 static int hardware_enable(int slot)
2031 volatile immap_t *immap;
2032 volatile cpm8xx_t *cp;
2033 volatile pcmconf8xx_t *pcmp;
2034 volatile sysconf8xx_t *sysp;
2037 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
2041 immap = (immap_t *)CFG_IMMR;
2042 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
2043 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2044 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
2047 * Configure SIUMCR to enable PCMCIA port B
2048 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
2050 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
2052 /* clear interrupt state, and disable interrupts */
2053 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
2054 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
2057 * Disable interrupts, DMA, and PCMCIA buffers
2058 * (isolate the interface) and assert RESET signal
2060 debug ("Disable PCMCIA buffers and assert RESET\n");
2062 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2063 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2064 PCMCIA_PGCRX(_slot_) = reg;
2068 * Configure Ports A, B & C pins for
2069 * 5 Volts Enable and 3 Volts enable
2071 immap->im_ioport.iop_pcpar &= ~(0x0400);
2072 immap->im_ioport.iop_pcso &= ~(0x0400);/*
2073 immap->im_ioport.iop_pcdir |= 0x0400;*/
2075 immap->im_ioport.iop_papar &= ~(0x0200);/*
2076 immap->im_ioport.iop_padir |= 0x0200;*/
2078 immap->im_ioport.iop_pbpar &= ~(0xC000);
2079 immap->im_ioport.iop_pbdir &= ~(0xC000);
2081 /* remove all power */
2083 immap->im_ioport.iop_pcdat |= 0x0400;
2084 immap->im_ioport.iop_padat |= 0x0200;
2087 * Make sure there is a card in the slot, then configure the interface.
2090 debug ("[%d] %s: PIPR(%p)=0x%x\n",
2091 __LINE__,__FUNCTION__,
2092 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
2093 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
2094 printf (" No Card found\n");
2101 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
2102 reg = pcmp->pcmc_pipr;
2103 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
2105 (reg&PCMCIA_VS1(slot))?"n":"ff",
2106 (reg&PCMCIA_VS2(slot))?"n":"ff");
2107 if ((reg & mask) == mask) {
2108 immap->im_ioport.iop_pcdat &= ~(0x4000);
2109 puts (" 5.0V card found: ");
2111 immap->im_ioport.iop_padat &= ~(0x0002);
2112 puts (" 3.3V card found: ");
2114 immap->im_ioport.iop_pcdir |= 0x0400;
2115 immap->im_ioport.iop_padir |= 0x0200;
2117 /* VCC switch error flag, PCMCIA slot INPACK_ pin */
2118 cp->cp_pbdir &= ~(0x0020 | 0x0010);
2119 cp->cp_pbpar &= ~(0x0020 | 0x0010);
2122 debug ("Enable PCMCIA buffers and stop RESET\n");
2123 reg = PCMCIA_PGCRX(_slot_);
2124 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2125 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2126 PCMCIA_PGCRX(_slot_) = reg;
2128 udelay(250000); /* some cards need >150 ms to come up :-( */
2130 debug ("# hardware_enable done\n");
2136 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
2137 static int hardware_disable(int slot)
2139 volatile immap_t *immap;
2140 volatile pcmconf8xx_t *pcmp;
2143 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
2145 immap = (immap_t *)CFG_IMMR;
2146 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2148 /* remove all power */
2149 immap->im_ioport.iop_pcdat |= 0x0400;
2150 immap->im_ioport.iop_padat |= 0x0200;
2152 /* Configure PCMCIA General Control Register */
2153 debug ("Disable PCMCIA buffers and assert RESET\n");
2155 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2156 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2157 PCMCIA_PGCRX(_slot_) = reg;
2163 #endif /* CFG_CMD_PCMCIA */
2166 static int voltage_set(int slot, int vcc, int vpp)
2168 volatile immap_t *immap;
2169 volatile pcmconf8xx_t *pcmp;
2172 debug ("voltage_set: "
2174 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
2175 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
2177 immap = (immap_t *)CFG_IMMR;
2178 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2180 * Disable PCMCIA buffers (isolate the interface)
2181 * and assert RESET signal
2183 debug ("Disable PCMCIA buffers and assert RESET\n");
2184 reg = PCMCIA_PGCRX(_slot_);
2185 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2186 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2187 PCMCIA_PGCRX(_slot_) = reg;
2191 * Configure Ports A & C pins for
2192 * 5 Volts Enable and 3 Volts enable,
2193 * Turn off all power
2195 debug ("PCMCIA power OFF\n");
2196 immap->im_ioport.iop_pcpar &= ~(0x0400);
2197 immap->im_ioport.iop_pcso &= ~(0x0400);/*
2198 immap->im_ioport.iop_pcdir |= 0x0400;*/
2200 immap->im_ioport.iop_papar &= ~(0x0200);/*
2201 immap->im_ioport.iop_padir |= 0x0200;*/
2203 immap->im_ioport.iop_pcdat |= 0x0400;
2204 immap->im_ioport.iop_padat |= 0x0200;
2209 case 33: reg |= 0x0200; break;
2210 case 50: reg |= 0x0400; break;
2214 /* Checking supported voltages */
2216 debug ("PIPR: 0x%x --> %s\n",
2218 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
2221 immap->im_ioport.iop_pcdat &= !reg;
2223 immap->im_ioport.iop_padat &= !reg;
2224 immap->im_ioport.iop_pcdir |= 0x0200;
2225 immap->im_ioport.iop_padir |= 0x0400;
2227 debug ("PCMCIA powered at %sV\n",
2228 (reg&0x0400) ? "5.0" : "3.3");
2230 debug ("PCMCIA powered down\n");
2234 debug ("Enable PCMCIA buffers and stop RESET\n");
2235 reg = PCMCIA_PGCRX(_slot_);
2236 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2237 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2238 PCMCIA_PGCRX(_slot_) = reg;
2241 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
2246 #endif /* R360MPI */
2248 /* -------------------------------------------------------------------- */
2249 /* KUP4K and KUP4X Boards */
2250 /* -------------------------------------------------------------------- */
2251 #if defined(CONFIG_KUP4K) || defined(CONFIG_KUP4X)
2253 #define PCMCIA_BOARD_MSG "KUP"
2255 #define KUP4K_PCMCIA_B_3V3 (0x00020000)
2257 static int hardware_enable(int slot)
2259 volatile immap_t *immap;
2260 volatile cpm8xx_t *cp;
2261 volatile pcmconf8xx_t *pcmp;
2262 volatile sysconf8xx_t *sysp;
2265 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
2269 immap = (immap_t *)CFG_IMMR;
2270 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
2271 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2272 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
2275 * Configure SIUMCR to enable PCMCIA port B
2276 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
2278 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
2280 /* clear interrupt state, and disable interrupts */
2281 pcmp->pcmc_pscr = PCMCIA_MASK(slot);
2282 pcmp->pcmc_per &= ~PCMCIA_MASK(slot);
2285 * Disable interrupts, DMA, and PCMCIA buffers
2286 * (isolate the interface) and assert RESET signal
2288 debug ("Disable PCMCIA buffers and assert RESET\n");
2290 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2291 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2292 PCMCIA_PGCRX(slot) = reg;
2296 * Configure Port B pins for
2299 if (slot) { /* Slot A is built-in */
2300 cp->cp_pbdir |= KUP4K_PCMCIA_B_3V3;
2301 cp->cp_pbpar &= ~KUP4K_PCMCIA_B_3V3;
2302 /* remove all power */
2303 cp->cp_pbdat |= KUP4K_PCMCIA_B_3V3; /* active low */
2306 * Make sure there is a card in the slot, then configure the interface.
2309 debug ("[%d] %s: PIPR(%p)=0x%x\n",
2310 __LINE__,__FUNCTION__,
2311 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
2312 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
2313 printf (" No Card found\n");
2320 printf("%s Slot %c:", slot ? "" : "\n", 'A' + slot);
2321 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
2322 reg = pcmp->pcmc_pipr;
2323 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
2325 (reg&PCMCIA_VS1(slot))?"n":"ff",
2326 (reg&PCMCIA_VS2(slot))?"n":"ff");
2327 if ((reg & mask) == mask) {
2328 puts (" 5.0V card found: NOT SUPPORTED !!!\n");
2331 cp->cp_pbdat &= ~KUP4K_PCMCIA_B_3V3;
2332 puts (" 3.3V card found: ");
2335 /* VCC switch error flag, PCMCIA slot INPACK_ pin */
2336 cp->cp_pbdir &= ~(0x0020 | 0x0010);
2337 cp->cp_pbpar &= ~(0x0020 | 0x0010);
2340 debug ("Enable PCMCIA buffers and stop RESET\n");
2341 reg = PCMCIA_PGCRX(slot);
2342 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2343 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2344 PCMCIA_PGCRX(slot) = reg;
2346 udelay(250000); /* some cards need >150 ms to come up :-( */
2348 debug ("# hardware_enable done\n");
2354 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
2355 static int hardware_disable(int slot)
2357 volatile immap_t *immap;
2358 volatile cpm8xx_t *cp;
2359 volatile pcmconf8xx_t *pcmp;
2362 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
2364 immap = (immap_t *)CFG_IMMR;
2365 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2366 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
2368 /* remove all power */
2370 cp->cp_pbdat |= KUP4K_PCMCIA_B_3V3;
2372 /* Configure PCMCIA General Control Register */
2373 debug ("Disable PCMCIA buffers and assert RESET\n");
2375 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2376 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2377 PCMCIA_PGCRX(slot) = reg;
2383 #endif /* CFG_CMD_PCMCIA */
2386 static int voltage_set(int slot, int vcc, int vpp)
2388 volatile immap_t *immap;
2389 volatile cpm8xx_t *cp;
2390 volatile pcmconf8xx_t *pcmp;
2393 debug ("voltage_set: " \
2395 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
2396 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
2398 if (!slot) /* Slot A is not configurable */
2401 immap = (immap_t *)CFG_IMMR;
2402 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2403 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
2406 * Disable PCMCIA buffers (isolate the interface)
2407 * and assert RESET signal
2409 debug ("Disable PCMCIA buffers and assert RESET\n");
2410 reg = PCMCIA_PGCRX(slot);
2411 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2412 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2413 PCMCIA_PGCRX(slot) = reg;
2416 debug ("PCMCIA power OFF\n");
2418 * Configure Port B pins for
2421 cp->cp_pbdir |= KUP4K_PCMCIA_B_3V3;
2422 cp->cp_pbpar &= ~KUP4K_PCMCIA_B_3V3;
2423 /* remove all power */
2424 cp->cp_pbdat |= KUP4K_PCMCIA_B_3V3; /* active low */
2429 cp->cp_pbdat &= ~KUP4K_PCMCIA_B_3V3;
2430 debug ("PCMCIA powered at 3.3V\n");
2433 debug ("PCMCIA: 5Volt vcc not supported\n");
2436 puts("PCMCIA: vcc not supported");
2440 /* Checking supported voltages */
2442 debug ("PIPR: 0x%x --> %s\n",
2444 (pcmp->pcmc_pipr & (0x80000000 >> (slot << 4)))
2445 ? "only 5 V --> NOT SUPPORTED"
2449 debug ("Enable PCMCIA buffers and stop RESET\n");
2450 reg = PCMCIA_PGCRX(slot);
2451 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2452 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2453 PCMCIA_PGCRX(slot) = reg;
2456 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
2461 #endif /* KUP4K || KUP4X */
2464 /* -------------------------------------------------------------------- */
2465 /* End of Board Specific Stuff */
2466 /* -------------------------------------------------------------------- */
2469 /* -------------------------------------------------------------------- */
2470 /* MPC8xx Specific Stuff - should go to MPC8xx directory */
2471 /* -------------------------------------------------------------------- */
2474 * Search this table to see if the windowsize is
2478 #define M8XX_SIZES_NO 32
2480 static const u_int m8xx_size_to_gray[M8XX_SIZES_NO] =
2481 { 0x00000001, 0x00000002, 0x00000008, 0x00000004,
2482 0x00000080, 0x00000040, 0x00000010, 0x00000020,
2483 0x00008000, 0x00004000, 0x00001000, 0x00002000,
2484 0x00000100, 0x00000200, 0x00000800, 0x00000400,
2486 0x0fffffff, 0xffffffff, 0xffffffff, 0xffffffff,
2487 0x01000000, 0x02000000, 0xffffffff, 0x04000000,
2488 0x00010000, 0x00020000, 0x00080000, 0x00040000,
2489 0x00800000, 0x00400000, 0x00100000, 0x00200000 };
2492 /* -------------------------------------------------------------------- */
2494 #if ( ! defined(CONFIG_I82365) && ! defined(CONFIG_PXA_PCMCIA) )
2496 static u_int m8xx_get_graycode(u_int size)
2500 for (k = 0; k < M8XX_SIZES_NO; k++) {
2501 if(m8xx_size_to_gray[k] == size)
2505 if((k == M8XX_SIZES_NO) || (m8xx_size_to_gray[k] == -1))
2511 #endif /* CONFIG_I82365 */
2513 /* -------------------------------------------------------------------- */
2516 static u_int m8xx_get_speed(u_int ns, u_int is_io)
2518 u_int reg, clocks, psst, psl, psht;
2523 * We get called with IO maps setup to 0ns
2524 * if not specified by the user.
2525 * They should be 255ns.
2531 ns = 100; /* fast memory if 0 */
2535 * In PSST, PSL, PSHT fields we tell the controller
2536 * timing parameters in CLKOUT clock cycles.
2537 * CLKOUT is the same as GCLK2_50.
2540 /* how we want to adjust the timing - in percent */
2542 #define ADJ 180 /* 80 % longer accesstime - to be sure */
2544 clocks = ((M8XX_BUSFREQ / 1000) * ns) / 1000;
2545 clocks = (clocks * ADJ) / (100*1000);
2547 if(clocks >= PCMCIA_BMT_LIMIT) {
2548 DEBUG(0, "Max access time limit reached\n");
2549 clocks = PCMCIA_BMT_LIMIT-1;
2552 psst = clocks / 7; /* setup time */
2553 psht = clocks / 7; /* hold time */
2554 psl = (clocks * 5) / 7; /* strobe length */
2556 psst += clocks - (psst + psht + psl);
2566 /* -------------------------------------------------------------------- */
2568 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
2569 static void print_funcid (int func)
2573 case CISTPL_FUNCID_MULTI:
2574 puts (" Multi-Function");
2576 case CISTPL_FUNCID_MEMORY:
2579 case CISTPL_FUNCID_SERIAL:
2580 puts (" Serial Port");
2582 case CISTPL_FUNCID_PARALLEL:
2583 puts (" Parallel Port");
2585 case CISTPL_FUNCID_FIXED:
2586 puts (" Fixed Disk");
2588 case CISTPL_FUNCID_VIDEO:
2589 puts (" Video Adapter");
2591 case CISTPL_FUNCID_NETWORK:
2592 puts (" Network Adapter");
2594 case CISTPL_FUNCID_AIMS:
2595 puts (" AIMS Card");
2597 case CISTPL_FUNCID_SCSI:
2598 puts (" SCSI Adapter");
2606 #endif /* CONFIG_IDE_8xx_PCCARD */
2608 /* -------------------------------------------------------------------- */
2610 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
2611 static void print_fixed (volatile uchar *p)
2619 case CISTPL_FUNCE_IDE_IFACE:
2620 { uchar iface = *(p+2);
2622 puts ((iface == CISTPL_IDE_INTERFACE) ? " IDE" : " unknown");
2623 puts (" interface ");
2626 case CISTPL_FUNCE_IDE_MASTER:
2627 case CISTPL_FUNCE_IDE_SLAVE:
2628 { uchar f1 = *(p+2);
2631 puts ((f1 & CISTPL_IDE_SILICON) ? " [silicon]" : " [rotating]");
2633 if (f1 & CISTPL_IDE_UNIQUE)
2636 puts ((f1 & CISTPL_IDE_DUAL) ? " [dual]" : " [single]");
2638 if (f2 & CISTPL_IDE_HAS_SLEEP)
2641 if (f2 & CISTPL_IDE_HAS_STANDBY)
2642 puts (" [standby]");
2644 if (f2 & CISTPL_IDE_HAS_IDLE)
2647 if (f2 & CISTPL_IDE_LOW_POWER)
2648 puts (" [low power]");
2650 if (f2 & CISTPL_IDE_REG_INHIBIT)
2651 puts (" [reg inhibit]");
2653 if (f2 & CISTPL_IDE_HAS_INDEX)
2656 if (f2 & CISTPL_IDE_IOIS16)
2664 #endif /* CONFIG_IDE_8xx_PCCARD */
2666 /* -------------------------------------------------------------------- */
2668 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
2670 #define MAX_IDENT_CHARS 64
2671 #define MAX_IDENT_FIELDS 4
2673 static uchar *known_cards[] = {
2678 static int identify (volatile uchar *p)
2680 uchar id_str[MAX_IDENT_CHARS];
2687 return (0); /* Don't know */
2692 for (i=0; i<=4 && !done; ++i, p+=2) {
2693 while ((data = *p) != '\0') {
2699 if (t == &id_str[MAX_IDENT_CHARS-1]) {
2709 while (--t > id_str) {
2718 for (card=known_cards; *card; ++card) {
2719 debug ("## Compare against \"%s\"\n", *card);
2720 if (strcmp(*card, id_str) == 0) { /* found! */
2721 debug ("## CARD FOUND ##\n");
2726 return (0); /* don't know */
2728 #endif /* CONFIG_IDE_8xx_PCCARD */
2730 /* -------------------------------------------------------------------- */
2731 /* NETTA board by Intracom S.A. */
2732 /* -------------------------------------------------------------------- */
2734 #if defined(CONFIG_NETTA)
2736 /* some sane bit macros */
2737 #define _BD(_b) (1U << (31-(_b)))
2738 #define _BDR(_l, _h) (((((1U << (31-(_l))) - 1) << 1) | 1) & ~((1U << (31-(_h))) - 1))
2740 #define _BW(_b) (1U << (15-(_b)))
2741 #define _BWR(_l, _h) (((((1U << (15-(_l))) - 1) << 1) | 1) & ~((1U << (15-(_h))) - 1))
2743 #define _BB(_b) (1U << (7-(_b)))
2744 #define _BBR(_l, _h) (((((1U << (7-(_l))) - 1) << 1) | 1) & ~((1U << (7-(_h))) - 1))
2746 #define _B(_b) _BD(_b)
2747 #define _BR(_l, _h) _BDR(_l, _h)
2749 #define PCMCIA_BOARD_MSG "NETTA"
2751 static const unsigned short vppd_masks[2] = { _BW(14), _BW(15) };
2753 static void cfg_vppd(int no)
2755 volatile immap_t *immap = (immap_t *)CFG_IMMR;
2756 unsigned short mask;
2758 if ((unsigned int)no >= sizeof(vppd_masks)/sizeof(vppd_masks[0]))
2761 mask = vppd_masks[no];
2763 immap->im_ioport.iop_papar &= ~mask;
2764 immap->im_ioport.iop_paodr &= ~mask;
2765 immap->im_ioport.iop_padir |= mask;
2768 static void set_vppd(int no, int what)
2770 volatile immap_t *immap = (immap_t *)CFG_IMMR;
2771 unsigned short mask;
2773 if ((unsigned int)no >= sizeof(vppd_masks)/sizeof(vppd_masks[0]))
2776 mask = vppd_masks[no];
2779 immap->im_ioport.iop_padat |= mask;
2781 immap->im_ioport.iop_padat &= ~mask;
2784 static const unsigned short vccd_masks[2] = { _BW(10), _BW(6) };
2786 static void cfg_vccd(int no)
2788 volatile immap_t *immap = (immap_t *)CFG_IMMR;
2789 unsigned short mask;
2791 if ((unsigned int)no >= sizeof(vccd_masks)/sizeof(vccd_masks[0]))
2794 mask = vccd_masks[no];
2796 immap->im_ioport.iop_papar &= ~mask;
2797 immap->im_ioport.iop_paodr &= ~mask;
2798 immap->im_ioport.iop_padir |= mask;
2801 static void set_vccd(int no, int what)
2803 volatile immap_t *immap = (immap_t *)CFG_IMMR;
2804 unsigned short mask;
2806 if ((unsigned int)no >= sizeof(vccd_masks)/sizeof(vccd_masks[0]))
2809 mask = vccd_masks[no];
2812 immap->im_ioport.iop_padat |= mask;
2814 immap->im_ioport.iop_padat &= ~mask;
2817 static const unsigned short oc_mask = _BW(8);
2819 static void cfg_oc(void)
2821 volatile immap_t *immap = (immap_t *)CFG_IMMR;
2822 unsigned short mask = oc_mask;
2824 immap->im_ioport.iop_pcdir &= ~mask;
2825 immap->im_ioport.iop_pcso &= ~mask;
2826 immap->im_ioport.iop_pcint &= ~mask;
2827 immap->im_ioport.iop_pcpar &= ~mask;
2830 static int get_oc(void)
2832 volatile immap_t *immap = (immap_t *)CFG_IMMR;
2833 unsigned short mask = oc_mask;
2836 what = !!(immap->im_ioport.iop_pcdat & mask);;
2840 static const unsigned short shdn_mask = _BW(12);
2842 static void cfg_shdn(void)
2844 volatile immap_t *immap = (immap_t *)CFG_IMMR;
2845 unsigned short mask;
2849 immap->im_ioport.iop_papar &= ~mask;
2850 immap->im_ioport.iop_paodr &= ~mask;
2851 immap->im_ioport.iop_padir |= mask;
2854 static void set_shdn(int what)
2856 volatile immap_t *immap = (immap_t *)CFG_IMMR;
2857 unsigned short mask;
2862 immap->im_ioport.iop_padat |= mask;
2864 immap->im_ioport.iop_padat &= ~mask;
2867 static void cfg_ports (void);
2869 static int hardware_enable(int slot)
2871 volatile immap_t *immap;
2872 volatile cpm8xx_t *cp;
2873 volatile pcmconf8xx_t *pcmp;
2874 volatile sysconf8xx_t *sysp;
2875 uint reg, pipr, mask;
2878 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
2882 immap = (immap_t *)CFG_IMMR;
2883 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
2884 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2885 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
2887 /* Configure Ports for TPS2211A PC-Card Power-Interface Switch */
2890 /* clear interrupt state, and disable interrupts */
2891 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
2892 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
2895 * Disable interrupts, DMA, and PCMCIA buffers
2896 * (isolate the interface) and assert RESET signal
2898 debug ("Disable PCMCIA buffers and assert RESET\n");
2900 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2901 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2902 PCMCIA_PGCRX(_slot_) = reg;
2907 * Make sure there is a card in the slot, then configure the interface.
2910 debug ("[%d] %s: PIPR(%p)=0x%x\n",
2911 __LINE__,__FUNCTION__,
2912 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
2913 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
2914 printf (" No Card found\n");
2919 * Power On: Set VAVCC to 3.3V or 5V, set VAVPP to Hi-Z
2921 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
2922 pipr = pcmp->pcmc_pipr;
2923 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
2925 (reg&PCMCIA_VS1(slot))?"n":"ff",
2926 (reg&PCMCIA_VS2(slot))?"n":"ff");
2928 if ((pipr & mask) == mask) {
2929 set_vppd(0, 1); set_vppd(1, 1); /* VAVPP => Hi-Z */
2930 set_vccd(0, 0); set_vccd(1, 1); /* 5V on, 3V off */
2931 puts (" 5.0V card found: ");
2933 set_vppd(0, 1); set_vppd(1, 1); /* VAVPP => Hi-Z */
2934 set_vccd(0, 1); set_vccd(1, 0); /* 5V off, 3V on */
2935 puts (" 3.3V card found: ");
2938 /* Wait 500 ms; use this to check for over-current */
2939 for (i=0; i<5000; ++i) {
2941 printf (" *** Overcurrent - Safety shutdown ***\n");
2942 set_vccd(0, 0); set_vccd(1, 0); /* VAVPP => Hi-Z */
2948 debug ("Enable PCMCIA buffers and stop RESET\n");
2949 reg = PCMCIA_PGCRX(_slot_);
2950 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2951 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2952 PCMCIA_PGCRX(_slot_) = reg;
2954 udelay(250000); /* some cards need >150 ms to come up :-( */
2956 debug ("# hardware_enable done\n");
2962 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
2963 static int hardware_disable(int slot)
2965 volatile immap_t *immap;
2966 volatile pcmconf8xx_t *pcmp;
2969 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
2971 immap = (immap_t *)CFG_IMMR;
2972 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2974 /* Configure PCMCIA General Control Register */
2975 debug ("Disable PCMCIA buffers and assert RESET\n");
2977 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2978 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2979 PCMCIA_PGCRX(_slot_) = reg;
2981 /* All voltages off / Hi-Z */
2982 set_vppd(0, 1); set_vppd(1, 1);
2983 set_vccd(0, 1); set_vccd(1, 1);
2989 #endif /* CFG_CMD_PCMCIA */
2992 static int voltage_set(int slot, int vcc, int vpp)
2994 volatile immap_t *immap;
2995 volatile cpm8xx_t *cp;
2996 volatile pcmconf8xx_t *pcmp;
3000 debug ("voltage_set: "
3002 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
3003 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
3005 immap = (immap_t *)CFG_IMMR;
3006 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
3007 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
3009 * Disable PCMCIA buffers (isolate the interface)
3010 * and assert RESET signal
3012 debug ("Disable PCMCIA buffers and assert RESET\n");
3013 reg = PCMCIA_PGCRX(_slot_);
3014 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
3015 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
3016 PCMCIA_PGCRX(_slot_) = reg;
3020 * Configure Port C pins for
3021 * 5 Volts Enable and 3 Volts enable,
3022 * Turn all power pins to Hi-Z
3024 debug ("PCMCIA power OFF\n");
3025 cfg_ports (); /* Enables switch, but all in Hi-Z */
3027 sreg = immap->im_ioport.iop_pcdat;
3028 set_vppd(0, 1); set_vppd(1, 1);
3032 break; /* Switch off */
3035 set_vccd(0, 1); set_vccd(1, 0);
3039 set_vccd(0, 0); set_vccd(1, 1);
3046 /* Checking supported voltages */
3048 debug ("PIPR: 0x%x --> %s\n",
3050 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
3053 debug ("Enable PCMCIA buffers and stop RESET\n");
3054 reg = PCMCIA_PGCRX(_slot_);
3055 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
3056 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
3057 PCMCIA_PGCRX(_slot_) = reg;
3060 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
3065 static void cfg_ports (void)
3067 volatile immap_t *immap;
3068 volatile cpm8xx_t *cp;
3070 immap = (immap_t *)CFG_IMMR;
3071 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
3074 cfg_vppd(0); cfg_vppd(1); /* VPPD0,VPPD1 VAVPP => Hi-Z */
3075 cfg_vccd(0); cfg_vccd(1); /* 3V and 5V off */
3080 * Configure Port A for TPS2211 PC-Card Power-Interface Switch
3082 * Switch off all voltages, assert shutdown
3084 set_vppd(0, 1); set_vppd(1, 1);
3085 set_vccd(0, 0); set_vccd(1, 0);
3094 /* -------------------------------------------------------------------- */
3096 #endif /* CFG_CMD_PCMCIA || (CFG_CMD_IDE && CONFIG_IDE_8xx_PCCARD) */
3098 /**************************************************/
3100 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
3102 pinit, 2, 1, do_pinit,
3103 "pinit - PCMCIA sub-system\n",
3104 "on - power on PCMCIA socket\n"
3105 "pinit off - power off PCMCIA socket\n"