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)
67 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA) || \
68 ((CONFIG_COMMANDS & CFG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD))
72 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
73 static int pcmcia_off (void);
78 extern int i82365_init (void);
79 extern void i82365_exit (void);
81 #else /* ! CONFIG_I82365 */
83 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
84 static int hardware_disable(int slot);
86 static int hardware_enable (int slot);
87 static int voltage_set(int slot, int vcc, int vpp);
90 static u_int m8xx_get_graycode(u_int size);
91 #endif /* CONFIG_I82365 */
93 static u_int m8xx_get_speed(u_int ns, u_int is_io);
96 /* -------------------------------------------------------------------- */
98 /* look up table for pgcrx registers */
100 static u_int *pcmcia_pgcrx[2] = {
101 &((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pgcra,
102 &((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pgcrb,
105 #define PCMCIA_PGCRX(slot) (*pcmcia_pgcrx[slot])
107 #endif /* CONFIG_I82365 */
109 #ifdef CONFIG_IDE_8xx_PCCARD
110 static void print_funcid (int func);
111 static void print_fixed (volatile uchar *p);
112 static int identify (volatile uchar *p);
113 static int check_ide_device (int slot);
114 #endif /* CONFIG_IDE_8xx_PCCARD */
116 const char *indent = "\t ";
118 /* -------------------------------------------------------------------- */
120 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
122 int do_pinit (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
127 printf ("Usage: pinit {on | off}\n");
130 if (strcmp(argv[1],"on") == 0) {
131 rcode = pcmcia_on ();
132 } else if (strcmp(argv[1],"off") == 0) {
133 rcode = pcmcia_off ();
135 printf ("Usage: pinit {on | off}\n");
141 #endif /* CFG_CMD_PCMCIA */
143 /* -------------------------------------------------------------------- */
150 debug ("Enable PCMCIA " PCMCIA_SLOT_MSG "\n");
156 rc = check_ide_device(0);
163 #if defined(CONFIG_LWMON) || defined(CONFIG_NSCU)
164 # define CFG_PCMCIA_TIMING (PCMCIA_SHT(9) | PCMCIA_SST(3) | PCMCIA_SL(12))
166 # define CFG_PCMCIA_TIMING (PCMCIA_SHT(2) | PCMCIA_SST(4) | PCMCIA_SL(9))
177 debug ("Enable PCMCIA " PCMCIA_SLOT_MSG "\n");
179 /* intialize the fixed memory windows */
180 win = (pcmcia_win_t *)(&((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pbr0);
181 base = CFG_PCMCIA_MEM_ADDR;
183 if((reg = m8xx_get_graycode(CFG_PCMCIA_MEM_SIZE)) == -1) {
184 printf ("Cannot set window size to 0x%08x\n",
185 CFG_PCMCIA_MEM_SIZE);
189 slotbit = PCMCIA_SLOT_x;
190 for (i=0; i<PCMCIA_MEM_WIN_NO; ++i) {
193 #if (PCMCIA_SOCKETS_NO == 2)
194 if (i == 4) /* Another slot starting from win 4 */
195 slotbit = (slotbit ? PCMCIA_PSLOT_A : PCMCIA_PSLOT_B);
198 #ifdef CONFIG_IDE_8xx_PCCARD
200 case 0: { /* map attribute memory */
201 win->or = ( PCMCIA_BSIZE_64M
206 | CFG_PCMCIA_TIMING );
210 case 1: { /* map I/O window for data reg */
211 win->or = ( PCMCIA_BSIZE_1K
216 | CFG_PCMCIA_TIMING );
220 case 2: { /* map I/O window for cmd/ctrl reg block */
221 win->or = ( PCMCIA_BSIZE_1K
226 | CFG_PCMCIA_TIMING );
229 #endif /* CONFIG_IDE_8xx_PCCARD */
230 #ifdef CONFIG_BMS2003
231 case 3: { /* map I/O window for 4xUART data/ctrl */
233 win->or = ( PCMCIA_BSIZE_256K
238 | CFG_PCMCIA_TIMING );
241 #endif /* CONFIG_BMS2003 */
242 default: /* set to not valid */
247 debug ("MemWin %d: PBR 0x%08lX POR %08lX\n",
248 i, win->br, win->or);
249 base += CFG_PCMCIA_MEM_SIZE;
253 for (i=0, rc=0, slot=_slot_; i<PCMCIA_SOCKETS_NO; i++, slot = !slot) {
254 /* turn off voltage */
255 if ((rc = voltage_set(slot, 0, 0)))
258 /* Enable external hardware */
259 if ((rc = hardware_enable(slot)))
262 #ifdef CONFIG_IDE_8xx_PCCARD
263 if ((rc = check_ide_device(i)))
269 #endif /* CONFIG_I82365 */
271 /* -------------------------------------------------------------------- */
273 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
276 static int pcmcia_off (void)
278 printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n");
285 static int pcmcia_off (void)
290 printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n");
292 /* clear interrupt state, and disable interrupts */
293 ((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pscr = PCMCIA_MASK(_slot_);
294 ((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_per &= ~PCMCIA_MASK(_slot_);
296 /* turn off interrupt and disable CxOE */
297 PCMCIA_PGCRX(_slot_) = __MY_PCMCIA_GCRX_CXOE;
299 /* turn off memory windows */
300 win = (pcmcia_win_t *)(&((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pbr0);
302 for (i=0; i<PCMCIA_MEM_WIN_NO; ++i) {
303 /* disable memory window */
308 /* turn off voltage */
309 voltage_set(_slot_, 0, 0);
311 /* disable external hardware */
312 printf ("Shutdown and Poweroff " PCMCIA_SLOT_MSG "\n");
313 hardware_disable(_slot_);
316 #endif /* CONFIG_I82365 */
318 #endif /* CFG_CMD_PCMCIA */
320 /* -------------------------------------------------------------------- */
322 #ifdef CONFIG_IDE_8xx_PCCARD
324 #define MAX_TUPEL_SZ 512
325 #define MAX_FEATURES 4
327 int ide_devices_found;
328 static int check_ide_device (int slot)
330 volatile uchar *ident = NULL;
331 volatile uchar *feature_p[MAX_FEATURES];
332 volatile uchar *p, *start, *addr;
336 ushort config_base = 0;
340 addr = (volatile uchar *)(CFG_PCMCIA_MEM_ADDR +
341 CFG_PCMCIA_MEM_SIZE * (slot * 4));
342 debug ("PCMCIA MEM: %08lX\n", (ulong)addr);
344 start = p = (volatile uchar *) addr;
346 while ((p - start) < MAX_TUPEL_SZ) {
350 if (code == 0xFF) { /* End of chain */
355 #if defined(DEBUG) && (DEBUG > 1)
356 { volatile uchar *q = p;
357 printf ("\nTuple code %02x length %d\n\tData:",
360 for (i = 0; i < len; ++i) {
361 printf (" %02x", *q);
371 /* Fix for broken SanDisk which may have 0x80 bit set */
375 if (n_features < MAX_FEATURES)
376 feature_p[n_features++] = p;
379 config_base = (*(p+6) << 8) + (*(p+4));
380 debug ("\n## Config_base = %04x ###\n", config_base);
387 found = identify (ident);
389 if (func_id != ((uchar)~0)) {
390 print_funcid (func_id);
392 if (func_id == CISTPL_FUNCID_FIXED)
395 return (1); /* no disk drive */
398 for (i=0; i<n_features; ++i) {
399 print_fixed (feature_p[i]);
403 printf ("unknown card type\n");
407 ide_devices_found |= (1 << slot);
409 /* set I/O area in config reg -> only valid for ARGOSY D5!!! */
410 *((uchar *)(addr + config_base)) = 1;
414 #endif /* CONFIG_IDE_8xx_PCCARD */
416 /* -------------------------------------------------------------------- */
419 /* -------------------------------------------------------------------- */
420 /* board specific stuff: */
421 /* voltage_set(), hardware_enable() and hardware_disable() */
422 /* -------------------------------------------------------------------- */
424 /* -------------------------------------------------------------------- */
425 /* RPX Boards from Embedded Planet */
426 /* -------------------------------------------------------------------- */
428 #if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_RPXLITE)
430 /* The RPX boards seems to have it's bus monitor timeout set to 6*8 clocks.
431 * SYPCR is write once only, therefore must the slowest memory be faster
432 * than the bus monitor or we will get a machine check due to the bus timeout.
435 #define PCMCIA_BOARD_MSG "RPX CLASSIC or RPX LITE"
437 #undef PCMCIA_BMT_LIMIT
438 #define PCMCIA_BMT_LIMIT (6*8)
440 static int voltage_set(int slot, int vcc, int vpp)
446 case 33: reg |= BCSR1_PCVCTL4; break;
447 case 50: reg |= BCSR1_PCVCTL5; break;
456 reg |= BCSR1_PCVCTL6;
461 reg |= BCSR1_PCVCTL7;
468 /* first, turn off all power */
470 *((uint *)RPX_CSR_ADDR) &= ~(BCSR1_PCVCTL4 | BCSR1_PCVCTL5
471 | BCSR1_PCVCTL6 | BCSR1_PCVCTL7);
473 /* enable new powersettings */
475 *((uint *)RPX_CSR_ADDR) |= reg;
480 #define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
481 static int hardware_enable (int slot)
483 return 0; /* No hardware to enable */
485 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
486 static int hardware_disable(int slot)
488 return 0; /* No hardware to disable */
490 #endif /* CFG_CMD_PCMCIA */
491 #endif /* CONFIG_RPXCLASSIC */
493 /* -------------------------------------------------------------------- */
494 /* (F)ADS Boards from Motorola */
495 /* -------------------------------------------------------------------- */
497 #if defined(CONFIG_ADS) || defined(CONFIG_FADS)
500 #define PCMCIA_BOARD_MSG "ADS"
501 #define PCMCIA_GLITCHY_CD /* My ADS board needs this */
503 #define PCMCIA_BOARD_MSG "FADS"
506 static int voltage_set(int slot, int vcc, int vpp)
511 case 0: reg = 0; break;
512 case 50: reg = 1; break;
513 case 120: reg = 2; break;
518 case 0: reg = 0; break;
520 case 50: reg = BCSR1_PCCVCCON; break;
523 case 33: reg = BCSR1_PCCVCC0 | BCSR1_PCCVCC1; break;
524 case 50: reg = BCSR1_PCCVCC1; break;
529 /* first, turn off all power */
532 *((uint *)BCSR1) |= BCSR1_PCCVCCON;
535 *((uint *)BCSR1) &= ~(BCSR1_PCCVCC0 | BCSR1_PCCVCC1);
537 *((uint *)BCSR1) &= ~BCSR1_PCCVPP_MASK;
539 /* enable new powersettings */
542 *((uint *)BCSR1) &= ~reg;
545 *((uint *)BCSR1) |= reg;
548 *((uint *)BCSR1) |= reg << 20;
553 #define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
555 static int hardware_enable(int slot)
557 *((uint *)BCSR1) &= ~BCSR1_PCCEN;
561 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
562 static int hardware_disable(int slot)
564 *((uint *)BCSR1) &= ~BCSR1_PCCEN;
567 #endif /* CFG_CMD_PCMCIA */
571 /* -------------------------------------------------------------------- */
572 /* TQM8xxL Boards by TQ Components */
573 /* SC8xx Boards by SinoVee Microsystems */
574 /* -------------------------------------------------------------------- */
576 #if defined(CONFIG_TQM8xxL) || defined(CONFIG_SVM_SC8xx)
578 #if defined(CONFIG_TQM8xxL)
579 #define PCMCIA_BOARD_MSG "TQM8xxL"
581 #if defined(CONFIG_SVM_SC8xx)
582 #define PCMCIA_BOARD_MSG "SC8xx"
585 static int hardware_enable(int slot)
587 volatile immap_t *immap;
588 volatile cpm8xx_t *cp;
589 volatile pcmconf8xx_t *pcmp;
590 volatile sysconf8xx_t *sysp;
593 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
597 immap = (immap_t *)CFG_IMMR;
598 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
599 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
600 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
603 * Configure SIUMCR to enable PCMCIA port B
604 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
606 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
608 /* clear interrupt state, and disable interrupts */
609 pcmp->pcmc_pscr = PCMCIA_MASK(slot);
610 pcmp->pcmc_per &= ~PCMCIA_MASK(slot);
613 * Disable interrupts, DMA, and PCMCIA buffers
614 * (isolate the interface) and assert RESET signal
616 debug ("Disable PCMCIA buffers and assert RESET\n");
618 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
620 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
622 PCMCIA_PGCRX(slot) = reg;
627 * Configure Port C pins for
628 * 5 Volts Enable and 3 Volts enable
630 immap->im_ioport.iop_pcpar &= ~(0x0002 | 0x0004);
631 immap->im_ioport.iop_pcso &= ~(0x0002 | 0x0004);
632 /* remove all power */
634 immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004);
638 * Make sure there is a card in the slot, then configure the interface.
641 debug ("[%d] %s: PIPR(%p)=0x%x\n",
642 __LINE__,__FUNCTION__,
643 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
644 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
645 printf (" No Card found\n");
652 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
653 reg = pcmp->pcmc_pipr;
654 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
656 (reg&PCMCIA_VS1(slot))?"n":"ff",
657 (reg&PCMCIA_VS2(slot))?"n":"ff");
659 if ((reg & mask) == mask) {
660 immap->im_ioport.iop_pcdat |= 0x0004;
661 puts (" 5.0V card found: ");
663 immap->im_ioport.iop_pcdat |= 0x0002;
664 puts (" 3.3V card found: ");
666 immap->im_ioport.iop_pcdir |= (0x0002 | 0x0004);
668 if ((reg & mask) == mask) {
669 puts (" 5.0V card found: ");
671 puts (" 3.3V card found: ");
675 /* VCC switch error flag, PCMCIA slot INPACK_ pin */
676 cp->cp_pbdir &= ~(0x0020 | 0x0010);
677 cp->cp_pbpar &= ~(0x0020 | 0x0010);
681 debug ("Enable PCMCIA buffers and stop RESET\n");
682 reg = PCMCIA_PGCRX(slot);
683 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
685 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
687 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
689 PCMCIA_PGCRX(slot) = reg;
691 udelay(250000); /* some cards need >150 ms to come up :-( */
693 debug ("# hardware_enable done\n");
699 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
700 static int hardware_disable(int slot)
702 volatile immap_t *immap;
703 volatile pcmconf8xx_t *pcmp;
706 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
708 immap = (immap_t *)CFG_IMMR;
709 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
712 /* remove all power */
713 immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004);
716 debug ("Disable PCMCIA buffers and assert RESET\n");
718 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
720 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
722 PCMCIA_PGCRX(slot) = reg;
728 #endif /* CFG_CMD_PCMCIA */
731 static int voltage_set(int slot, int vcc, int vpp)
736 static int voltage_set(int slot, int vcc, int vpp)
738 volatile immap_t *immap;
739 volatile pcmconf8xx_t *pcmp;
742 debug ("voltage_set: "
744 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
745 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
747 immap = (immap_t *)CFG_IMMR;
748 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
750 * Disable PCMCIA buffers (isolate the interface)
751 * and assert RESET signal
753 debug ("Disable PCMCIA buffers and assert RESET\n");
754 reg = PCMCIA_PGCRX(slot);
755 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
757 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
759 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
761 PCMCIA_PGCRX(slot) = reg;
765 * Configure Port C pins for
766 * 5 Volts Enable and 3 Volts enable,
769 debug ("PCMCIA power OFF\n");
770 immap->im_ioport.iop_pcpar &= ~(0x0002 | 0x0004);
771 immap->im_ioport.iop_pcso &= ~(0x0002 | 0x0004);
772 immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004);
777 case 33: reg |= 0x0002; break;
778 case 50: reg |= 0x0004; break;
782 /* Checking supported voltages */
784 debug ("PIPR: 0x%x --> %s\n",
786 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
788 immap->im_ioport.iop_pcdat |= reg;
789 immap->im_ioport.iop_pcdir |= (0x0002 | 0x0004);
791 debug ("PCMCIA powered at %sV\n",
792 (reg&0x0004) ? "5.0" : "3.3");
794 debug ("PCMCIA powered down\n");
798 debug ("Enable PCMCIA buffers and stop RESET\n");
799 reg = PCMCIA_PGCRX(slot);
800 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
802 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
804 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
806 PCMCIA_PGCRX(slot) = reg;
809 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
818 /* -------------------------------------------------------------------- */
820 /* -------------------------------------------------------------------- */
822 #if defined(CONFIG_LWMON)
824 #define PCMCIA_BOARD_MSG "LWMON"
826 /* #define's for MAX1604 Power Switch */
827 #define MAX1604_OP_SUS 0x80
828 #define MAX1604_VCCBON 0x40
829 #define MAX1604_VCC_35 0x20
830 #define MAX1604_VCCBHIZ 0x10
831 #define MAX1604_VPPBON 0x08
832 #define MAX1604_VPPBPBPGM 0x04
833 #define MAX1604_VPPBHIZ 0x02
836 static int hardware_enable(int slot)
838 volatile immap_t *immap;
839 volatile cpm8xx_t *cp;
840 volatile pcmconf8xx_t *pcmp;
841 volatile sysconf8xx_t *sysp;
846 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
848 /* Switch on PCMCIA port in PIC register 0x60 */
849 reg = pic_read (0x60);
850 debug ("[%d] PIC read: reg_60 = 0x%02x\n", __LINE__, reg);
852 /* reg |= 0x08; Vpp not needed */
853 pic_write (0x60, reg);
855 reg = pic_read (0x60);
856 printf ("[%d] PIC read: reg_60 = 0x%02x\n", __LINE__, reg);
860 immap = (immap_t *)CFG_IMMR;
861 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
862 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
863 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
866 * Configure SIUMCR to enable PCMCIA port B
867 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
869 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
871 /* clear interrupt state, and disable interrupts */
872 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
873 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
876 * Disable interrupts, DMA, and PCMCIA buffers
877 * (isolate the interface) and assert RESET signal
879 debug ("Disable PCMCIA buffers and assert RESET\n");
881 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
882 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
883 PCMCIA_PGCRX(_slot_) = reg;
887 * Make sure there is a card in the slot, then configure the interface.
890 debug ("[%d] %s: PIPR(%p)=0x%x\n",
891 __LINE__,__FUNCTION__,
892 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
893 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
894 printf (" No Card found\n");
901 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
902 reg = pcmp->pcmc_pipr;
903 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
905 (reg&PCMCIA_VS1(slot))?"n":"ff",
906 (reg&PCMCIA_VS2(slot))?"n":"ff");
907 if ((reg & mask) == mask) {
908 val = 0; /* VCCB3/5 = 0 ==> use Vx = 5.0 V */
909 puts (" 5.0V card found: ");
911 val = MAX1604_VCC_35; /* VCCB3/5 = 1 ==> use Vy = 3.3 V */
912 puts (" 3.3V card found: ");
916 val |= MAX1604_OP_SUS | MAX1604_VCCBON;
917 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
918 i2c_write (CFG_I2C_POWER_A_ADDR, 0, 0, &val, 1);
922 debug ("Enable PCMCIA buffers and stop RESET\n");
923 reg = PCMCIA_PGCRX(_slot_);
924 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
925 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
926 PCMCIA_PGCRX(_slot_) = reg;
928 udelay(250000); /* some cards need >150 ms to come up :-( */
930 debug ("# hardware_enable done\n");
936 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
937 static int hardware_disable(int slot)
939 volatile immap_t *immap;
940 volatile pcmconf8xx_t *pcmp;
944 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
946 immap = (immap_t *)CFG_IMMR;
947 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
949 /* remove all power, put output in high impedance state */
950 val = MAX1604_VCCBHIZ | MAX1604_VPPBHIZ;
951 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
952 i2c_write (CFG_I2C_POWER_A_ADDR, 0, 0, &val, 1);
954 /* Configure PCMCIA General Control Register */
955 debug ("Disable PCMCIA buffers and assert RESET\n");
957 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
958 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
959 PCMCIA_PGCRX(_slot_) = reg;
961 /* Switch off PCMCIA port in PIC register 0x60 */
962 reg = pic_read (0x60);
963 debug ("[%d] PIC read: reg_60 = 0x%02x\n", __LINE__, reg);
966 pic_write (0x60, reg);
968 reg = pic_read (0x60);
969 printf ("[%d] PIC read: reg_60 = 0x%02x\n", __LINE__, reg);
975 #endif /* CFG_CMD_PCMCIA */
978 static int voltage_set(int slot, int vcc, int vpp)
980 volatile immap_t *immap;
981 volatile pcmconf8xx_t *pcmp;
985 debug ("voltage_set: "
987 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
988 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
990 immap = (immap_t *)CFG_IMMR;
991 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
993 * Disable PCMCIA buffers (isolate the interface)
994 * and assert RESET signal
996 debug ("Disable PCMCIA buffers and assert RESET\n");
997 reg = PCMCIA_PGCRX(_slot_);
998 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
999 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1000 PCMCIA_PGCRX(_slot_) = reg;
1004 * Turn off all power (switch to high impedance)
1006 debug ("PCMCIA power OFF\n");
1007 val = MAX1604_VCCBHIZ | MAX1604_VPPBHIZ;
1008 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
1009 i2c_write (CFG_I2C_POWER_A_ADDR, 0, 0, &val, 1);
1014 case 33: val = MAX1604_VCC_35; break;
1019 /* Checking supported voltages */
1021 debug ("PIPR: 0x%x --> %s\n",
1023 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
1025 i2c_write (CFG_I2C_POWER_A_ADDR, 0, 0, &val, 1);
1027 debug ("PCMCIA powered at %sV\n",
1028 (val & MAX1604_VCC_35) ? "3.3" : "5.0");
1030 debug ("PCMCIA powered down\n");
1034 debug ("Enable PCMCIA buffers and stop RESET\n");
1035 reg = PCMCIA_PGCRX(_slot_);
1036 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1037 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1038 PCMCIA_PGCRX(_slot_) = reg;
1041 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
1048 /* -------------------------------------------------------------------- */
1049 /* GTH board by Corelatus AB */
1050 /* -------------------------------------------------------------------- */
1051 #if defined(CONFIG_GTH)
1053 #define PCMCIA_BOARD_MSG "GTH COMPACT FLASH"
1055 static int voltage_set (int slot, int vcc, int vpp)
1060 static int hardware_enable (int slot)
1062 volatile immap_t *immap;
1063 volatile cpm8xx_t *cp;
1064 volatile pcmconf8xx_t *pcmp;
1065 volatile sysconf8xx_t *sysp;
1068 debug ("hardware_enable: GTH Slot %c\n", 'A' + slot);
1070 immap = (immap_t *) CFG_IMMR;
1071 sysp = (sysconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_siu_conf));
1072 pcmp = (pcmconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_pcmcia));
1073 cp = (cpm8xx_t *) (&(((immap_t *) CFG_IMMR)->im_cpm));
1075 /* clear interrupt state, and disable interrupts */
1076 pcmp->pcmc_pscr = PCMCIA_MASK (_slot_);
1077 pcmp->pcmc_per &= ~PCMCIA_MASK (_slot_);
1080 * Disable interrupts, DMA, and PCMCIA buffers
1081 * (isolate the interface) and assert RESET signal
1083 debug ("Disable PCMCIA buffers and assert RESET\n");
1085 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1086 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1087 PCMCIA_PGCRX (_slot_) = reg;
1091 * Make sure there is a card in the slot,
1092 * then configure the interface.
1095 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1096 __LINE__, __FUNCTION__,
1097 &(pcmp->pcmc_pipr), pcmp->pcmc_pipr);
1098 if (pcmp->pcmc_pipr & 0x98000000) {
1099 printf (" No Card found\n");
1103 mask = PCMCIA_VS1 (slot) | PCMCIA_VS2 (slot);
1104 reg = pcmp->pcmc_pipr;
1105 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
1107 (reg & PCMCIA_VS1 (slot)) ? "n" : "ff",
1108 (reg & PCMCIA_VS2 (slot)) ? "n" : "ff");
1110 debug ("Enable PCMCIA buffers and stop RESET\n");
1111 reg = PCMCIA_PGCRX (_slot_);
1112 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1113 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1114 PCMCIA_PGCRX (_slot_) = reg;
1116 udelay (250000); /* some cards need >150 ms to come up :-( */
1118 debug ("# hardware_enable done\n");
1122 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1123 static int hardware_disable(int slot)
1125 return 0; /* No hardware to disable */
1127 #endif /* CFG_CMD_PCMCIA */
1128 #endif /* CONFIG_GTH */
1130 /* -------------------------------------------------------------------- */
1131 /* ICU862 Boards by Cambridge Broadband Ltd. */
1132 /* -------------------------------------------------------------------- */
1134 #if defined(CONFIG_ICU862)
1136 #define PCMCIA_BOARD_MSG "ICU862"
1138 static void cfg_port_B (void);
1140 static int hardware_enable(int slot)
1142 volatile immap_t *immap;
1143 volatile cpm8xx_t *cp;
1144 volatile pcmconf8xx_t *pcmp;
1145 volatile sysconf8xx_t *sysp;
1146 uint reg, pipr, mask;
1149 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1153 immap = (immap_t *)CFG_IMMR;
1154 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
1155 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1156 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1158 /* Configure Port B for TPS2205 PC-Card Power-Interface Switch */
1162 * Configure SIUMCR to enable PCMCIA port B
1163 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
1165 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
1167 /* clear interrupt state, and disable interrupts */
1168 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
1169 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
1172 * Disable interrupts, DMA, and PCMCIA buffers
1173 * (isolate the interface) and assert RESET signal
1175 debug ("Disable PCMCIA buffers and assert RESET\n");
1177 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1178 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1179 PCMCIA_PGCRX(_slot_) = reg;
1183 * Make sure there is a card in the slot, then configure the interface.
1186 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1187 __LINE__,__FUNCTION__,
1188 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
1189 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
1190 printf (" No Card found\n");
1195 * Power On: Set VAVCC to 3.3V or 5V, set VAVPP to Hi-Z
1197 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
1198 pipr = pcmp->pcmc_pipr;
1199 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
1201 (reg&PCMCIA_VS1(slot))?"n":"ff",
1202 (reg&PCMCIA_VS2(slot))?"n":"ff");
1205 if ((pipr & mask) == mask) {
1206 reg |= (TPS2205_VPP_PGM | TPS2205_VPP_VCC | /* VAVPP => Hi-Z */
1207 TPS2205_VCC3); /* 3V off */
1208 reg &= ~(TPS2205_VCC5); /* 5V on */
1209 puts (" 5.0V card found: ");
1211 reg |= (TPS2205_VPP_PGM | TPS2205_VPP_VCC | /* VAVPP => Hi-Z */
1212 TPS2205_VCC5); /* 5V off */
1213 reg &= ~(TPS2205_VCC3); /* 3V on */
1214 puts (" 3.3V card found: ");
1217 debug ("\nPB DAT: %08x -> 3.3V %s 5.0V %s VPP_PGM %s VPP_VCC %s\n",
1219 (reg & TPS2205_VCC3) ? "off" : "on",
1220 (reg & TPS2205_VCC5) ? "off" : "on",
1221 (reg & TPS2205_VPP_PGM) ? "off" : "on",
1222 (reg & TPS2205_VPP_VCC) ? "off" : "on" );
1226 /* Wait 500 ms; use this to check for over-current */
1227 for (i=0; i<5000; ++i) {
1228 if ((cp->cp_pbdat & TPS2205_OC) == 0) {
1229 printf (" *** Overcurrent - Safety shutdown ***\n");
1230 cp->cp_pbdat &= ~(TPS2205_SHDN);
1236 debug ("Enable PCMCIA buffers and stop RESET\n");
1237 reg = PCMCIA_PGCRX(_slot_);
1238 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1239 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1240 PCMCIA_PGCRX(_slot_) = reg;
1242 udelay(250000); /* some cards need >150 ms to come up :-( */
1244 debug ("# hardware_enable done\n");
1250 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1251 static int hardware_disable(int slot)
1253 volatile immap_t *immap;
1254 volatile cpm8xx_t *cp;
1255 volatile pcmconf8xx_t *pcmp;
1258 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1260 immap = (immap_t *)CFG_IMMR;
1261 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1262 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1265 cp->cp_pbdat &= ~(TPS2205_SHDN);
1267 /* Configure PCMCIA General Control Register */
1268 debug ("Disable PCMCIA buffers and assert RESET\n");
1270 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1271 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1272 PCMCIA_PGCRX(_slot_) = reg;
1278 #endif /* CFG_CMD_PCMCIA */
1281 static int voltage_set(int slot, int vcc, int vpp)
1283 volatile immap_t *immap;
1284 volatile cpm8xx_t *cp;
1285 volatile pcmconf8xx_t *pcmp;
1288 debug ("voltage_set: "
1290 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
1291 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
1293 immap = (immap_t *)CFG_IMMR;
1294 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1295 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1297 * Disable PCMCIA buffers (isolate the interface)
1298 * and assert RESET signal
1300 debug ("Disable PCMCIA buffers and assert RESET\n");
1301 reg = PCMCIA_PGCRX(_slot_);
1302 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1303 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1304 PCMCIA_PGCRX(_slot_) = reg;
1308 * Configure Port C pins for
1309 * 5 Volts Enable and 3 Volts enable,
1310 * Turn all power pins to Hi-Z
1312 debug ("PCMCIA power OFF\n");
1313 cfg_port_B (); /* Enables switch, but all in Hi-Z */
1318 case 0: break; /* Switch off */
1319 case 33: reg &= ~TPS2205_VCC3; break; /* Switch on 3.3V */
1320 case 50: reg &= ~TPS2205_VCC5; break; /* Switch on 5.0V */
1324 /* Checking supported voltages */
1326 debug ("PIPR: 0x%x --> %s\n",
1328 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
1336 if ((reg & TPS2205_VCC3) == 0) {
1338 } else if ((reg & TPS2205_VCC5) == 0) {
1343 printf ("PCMCIA powered %s\n", s);
1348 debug ("Enable PCMCIA buffers and stop RESET\n");
1349 reg = PCMCIA_PGCRX(_slot_);
1350 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1351 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1352 PCMCIA_PGCRX(_slot_) = reg;
1355 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
1360 static void cfg_port_B (void)
1362 volatile immap_t *immap;
1363 volatile cpm8xx_t *cp;
1366 immap = (immap_t *)CFG_IMMR;
1367 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1370 * Configure Port B for TPS2205 PC-Card Power-Interface Switch
1372 * Switch off all voltages, assert shutdown
1375 reg |= (TPS2205_VPP_PGM | TPS2205_VPP_VCC | /* VAVPP => Hi-Z */
1376 TPS2205_VCC3 | TPS2205_VCC5 | /* VAVCC => Hi-Z */
1377 TPS2205_SHDN); /* enable switch */
1380 cp->cp_pbpar &= ~(TPS2205_INPUTS | TPS2205_OUTPUTS);
1382 reg = cp->cp_pbdir & ~(TPS2205_INPUTS);
1383 cp->cp_pbdir = reg | TPS2205_OUTPUTS;
1385 debug ("Set Port B: PAR: %08x DIR: %08x DAT: %08x\n",
1386 cp->cp_pbpar, cp->cp_pbdir, cp->cp_pbdat);
1392 /* -------------------------------------------------------------------- */
1393 /* C2MON Boards by TTTech Computertechnik AG */
1394 /* -------------------------------------------------------------------- */
1396 #if defined(CONFIG_C2MON)
1398 #define PCMCIA_BOARD_MSG "C2MON"
1400 static void cfg_ports (void);
1402 static int hardware_enable(int slot)
1404 volatile immap_t *immap;
1405 volatile cpm8xx_t *cp;
1406 volatile pcmconf8xx_t *pcmp;
1407 volatile sysconf8xx_t *sysp;
1408 uint reg, pipr, mask;
1412 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1416 immap = (immap_t *)CFG_IMMR;
1417 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
1418 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1419 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1421 /* Configure Ports for TPS2211A PC-Card Power-Interface Switch */
1425 * Configure SIUMCR to enable PCMCIA port B
1426 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
1428 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
1430 /* clear interrupt state, and disable interrupts */
1431 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
1432 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
1435 * Disable interrupts, DMA, and PCMCIA buffers
1436 * (isolate the interface) and assert RESET signal
1438 debug ("Disable PCMCIA buffers and assert RESET\n");
1440 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1441 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1442 PCMCIA_PGCRX(_slot_) = reg;
1446 * Make sure there is a card in the slot, then configure the interface.
1449 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1450 __LINE__,__FUNCTION__,
1451 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
1452 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
1453 printf (" No Card found\n");
1458 * Power On: Set VAVCC to 3.3V or 5V, set VAVPP to Hi-Z
1460 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
1461 pipr = pcmp->pcmc_pipr;
1462 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
1464 (reg&PCMCIA_VS1(slot))?"n":"ff",
1465 (reg&PCMCIA_VS2(slot))?"n":"ff");
1467 sreg = immap->im_ioport.iop_pcdat;
1468 if ((pipr & mask) == mask) {
1469 sreg |= (TPS2211_VPPD0 | TPS2211_VPPD1 | /* VAVPP => Hi-Z */
1470 TPS2211_VCCD1); /* 5V on */
1471 sreg &= ~(TPS2211_VCCD0); /* 3V off */
1472 puts (" 5.0V card found: ");
1474 sreg |= (TPS2211_VPPD0 | TPS2211_VPPD1 | /* VAVPP => Hi-Z */
1475 TPS2211_VCCD0); /* 3V on */
1476 sreg &= ~(TPS2211_VCCD1); /* 5V off */
1477 puts (" 3.3V card found: ");
1480 debug ("\nPC DAT: %04x -> 3.3V %s 5.0V %s\n",
1482 ( (sreg & TPS2211_VCCD0) && !(sreg & TPS2211_VCCD1)) ? "on" : "off",
1483 (!(sreg & TPS2211_VCCD0) && (sreg & TPS2211_VCCD1)) ? "on" : "off"
1486 immap->im_ioport.iop_pcdat = sreg;
1488 /* Wait 500 ms; use this to check for over-current */
1489 for (i=0; i<5000; ++i) {
1490 if ((cp->cp_pbdat & TPS2211_OC) == 0) {
1491 printf (" *** Overcurrent - Safety shutdown ***\n");
1492 immap->im_ioport.iop_pcdat &= ~(TPS2211_VCCD0|TPS2211_VCCD1);
1498 debug ("Enable PCMCIA buffers and stop RESET\n");
1499 reg = PCMCIA_PGCRX(_slot_);
1500 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1501 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1502 PCMCIA_PGCRX(_slot_) = reg;
1504 udelay(250000); /* some cards need >150 ms to come up :-( */
1506 debug ("# hardware_enable done\n");
1512 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1513 static int hardware_disable(int slot)
1515 volatile immap_t *immap;
1516 volatile cpm8xx_t *cp;
1517 volatile pcmconf8xx_t *pcmp;
1520 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1522 immap = (immap_t *)CFG_IMMR;
1523 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1525 /* Configure PCMCIA General Control Register */
1526 debug ("Disable PCMCIA buffers and assert RESET\n");
1528 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1529 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1530 PCMCIA_PGCRX(_slot_) = reg;
1532 /* ALl voltages off / Hi-Z */
1533 immap->im_ioport.iop_pcdat |= (TPS2211_VPPD0 | TPS2211_VPPD1 |
1534 TPS2211_VCCD0 | TPS2211_VCCD1 );
1540 #endif /* CFG_CMD_PCMCIA */
1543 static int voltage_set(int slot, int vcc, int vpp)
1545 volatile immap_t *immap;
1546 volatile cpm8xx_t *cp;
1547 volatile pcmconf8xx_t *pcmp;
1551 debug ("voltage_set: "
1553 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
1554 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
1556 immap = (immap_t *)CFG_IMMR;
1557 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1558 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1560 * Disable PCMCIA buffers (isolate the interface)
1561 * and assert RESET signal
1563 debug ("Disable PCMCIA buffers and assert RESET\n");
1564 reg = PCMCIA_PGCRX(_slot_);
1565 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1566 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1567 PCMCIA_PGCRX(_slot_) = reg;
1571 * Configure Port C pins for
1572 * 5 Volts Enable and 3 Volts enable,
1573 * Turn all power pins to Hi-Z
1575 debug ("PCMCIA power OFF\n");
1576 cfg_ports (); /* Enables switch, but all in Hi-Z */
1578 sreg = immap->im_ioport.iop_pcdat;
1579 sreg |= TPS2211_VPPD0 | TPS2211_VPPD1; /* VAVPP always Hi-Z */
1582 case 0: break; /* Switch off */
1583 case 33: sreg |= TPS2211_VCCD0; /* Switch on 3.3V */
1584 sreg &= ~TPS2211_VCCD1;
1586 case 50: sreg &= ~TPS2211_VCCD0; /* Switch on 5.0V */
1587 sreg |= TPS2211_VCCD1;
1592 /* Checking supported voltages */
1594 debug ("PIPR: 0x%x --> %s\n",
1596 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
1598 immap->im_ioport.iop_pcdat = sreg;
1604 if ((sreg & TPS2211_VCCD0) && !(sreg & TPS2211_VCCD1)) {
1606 } else if (!(sreg & TPS2211_VCCD0) && (sreg & TPS2211_VCCD1)) {
1611 printf ("PCMCIA powered %s\n", s);
1616 debug ("Enable PCMCIA buffers and stop RESET\n");
1617 reg = PCMCIA_PGCRX(_slot_);
1618 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1619 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1620 PCMCIA_PGCRX(_slot_) = reg;
1623 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
1628 static void cfg_ports (void)
1630 volatile immap_t *immap;
1631 volatile cpm8xx_t *cp;
1634 immap = (immap_t *)CFG_IMMR;
1635 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1638 * Configure Port C for TPS2211 PC-Card Power-Interface Switch
1640 * Switch off all voltages, assert shutdown
1642 sreg = immap->im_ioport.iop_pcdat;
1643 sreg |= (TPS2211_VPPD0 | TPS2211_VPPD1); /* VAVPP => Hi-Z */
1644 sreg &= ~(TPS2211_VCCD0 | TPS2211_VCCD1); /* 3V and 5V off */
1645 immap->im_ioport.iop_pcdat = sreg;
1647 immap->im_ioport.iop_pcpar &= ~(TPS2211_OUTPUTS);
1648 immap->im_ioport.iop_pcdir |= TPS2211_OUTPUTS;
1650 debug ("Set Port C: PAR: %04x DIR: %04x DAT: %04x\n",
1651 immap->im_ioport.iop_pcpar,
1652 immap->im_ioport.iop_pcdir,
1653 immap->im_ioport.iop_pcdat);
1656 * Configure Port B for TPS2211 PC-Card Power-Interface Switch
1658 * Over-Current Input only
1660 cp->cp_pbpar &= ~(TPS2211_INPUTS);
1661 cp->cp_pbdir &= ~(TPS2211_INPUTS);
1663 debug ("Set Port B: PAR: %08x DIR: %08x DAT: %08x\n",
1664 cp->cp_pbpar, cp->cp_pbdir, cp->cp_pbdat);
1669 /* -------------------------------------------------------------------- */
1670 /* MBX board from Morotola */
1671 /* -------------------------------------------------------------------- */
1673 #if defined( CONFIG_MBX )
1674 #include <../board/mbx8xx/csr.h>
1676 /* A lot of this has been taken from the RPX code in this file it works from me.
1677 I have added the voltage selection for the MBX board. */
1679 /* MBX voltage bit in control register #2 */
1680 #define CR2_VPP12 ((uchar)0x10)
1681 #define CR2_VPPVDD ((uchar)0x20)
1682 #define CR2_VDD5 ((uchar)0x40)
1683 #define CR2_VDD3 ((uchar)0x80)
1685 #define PCMCIA_BOARD_MSG "MBX860"
1687 static int voltage_set (int slot, int vcc, int vpp)
1691 debug ("voltage_set: PCMCIA_BOARD_MSG Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
1692 'A' + slot, vcc / 10, vcc % 10, vpp / 10, vcc % 10);
1725 /* first, turn off all power */
1726 MBX_CSR2 &= ~(CR2_VDDSEL | CR2_VPPSEL);
1728 /* enable new powersettings */
1730 debug ("MBX_CSR2 read = 0x%02x\n", MBX_CSR2);
1735 static int hardware_enable (int slot)
1737 volatile immap_t *immap;
1738 volatile cpm8xx_t *cp;
1739 volatile pcmconf8xx_t *pcmp;
1740 volatile sysconf8xx_t *sysp;
1743 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n",
1748 immap = (immap_t *) CFG_IMMR;
1749 sysp = (sysconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_siu_conf));
1750 pcmp = (pcmconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_pcmcia));
1751 cp = (cpm8xx_t *) (&(((immap_t *) CFG_IMMR)->im_cpm));
1753 /* clear interrupt state, and disable interrupts */
1754 pcmp->pcmc_pscr = PCMCIA_MASK (_slot_);
1755 pcmp->pcmc_per &= ~PCMCIA_MASK (_slot_);
1758 * Disable interrupts, DMA, and PCMCIA buffers
1759 * (isolate the interface) and assert RESET signal
1761 debug ("Disable PCMCIA buffers and assert RESET\n");
1763 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1764 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1765 PCMCIA_PGCRX (_slot_) = reg;
1768 /* remove all power */
1769 voltage_set (slot, 0, 0);
1771 * Make sure there is a card in the slot, then configure the interface.
1774 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1775 __LINE__,__FUNCTION__,
1776 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
1777 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
1778 printf (" No Card found\n");
1785 mask = PCMCIA_VS1 (_slot_) | PCMCIA_VS2 (_slot_);
1786 reg = pcmp->pcmc_pipr;
1787 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n", reg,
1788 (reg & PCMCIA_VS1 (slot)) ? "n" : "ff",
1789 (reg & PCMCIA_VS2 (slot)) ? "n" : "ff");
1791 if ((reg & mask) == mask) {
1792 voltage_set (_slot_, 50, 0);
1793 printf (" 5.0V card found: ");
1795 voltage_set (_slot_, 33, 0);
1796 printf (" 3.3V card found: ");
1799 debug ("Enable PCMCIA buffers and stop RESET\n");
1800 reg = PCMCIA_PGCRX (_slot_);
1801 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1802 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1803 PCMCIA_PGCRX (_slot_) = reg;
1805 udelay (250000); /* some cards need >150 ms to come up :-( */
1807 debug ("# hardware_enable done\n");
1812 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1813 static int hardware_disable (int slot)
1815 return 0; /* No hardware to disable */
1817 #endif /* CFG_CMD_PCMCIA */
1818 #endif /* CONFIG_MBX */
1819 /* -------------------------------------------------------------------- */
1821 /* -------------------------------------------------------------------- */
1823 #if defined(CONFIG_R360MPI)
1825 #define PCMCIA_BOARD_MSG "R360MPI"
1828 static int hardware_enable(int slot)
1830 volatile immap_t *immap;
1831 volatile cpm8xx_t *cp;
1832 volatile pcmconf8xx_t *pcmp;
1833 volatile sysconf8xx_t *sysp;
1836 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1840 immap = (immap_t *)CFG_IMMR;
1841 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
1842 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1843 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1846 * Configure SIUMCR to enable PCMCIA port B
1847 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
1849 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
1851 /* clear interrupt state, and disable interrupts */
1852 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
1853 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
1856 * Disable interrupts, DMA, and PCMCIA buffers
1857 * (isolate the interface) and assert RESET signal
1859 debug ("Disable PCMCIA buffers and assert RESET\n");
1861 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1862 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1863 PCMCIA_PGCRX(_slot_) = reg;
1867 * Configure Ports A, B & C pins for
1868 * 5 Volts Enable and 3 Volts enable
1870 immap->im_ioport.iop_pcpar &= ~(0x0400);
1871 immap->im_ioport.iop_pcso &= ~(0x0400);/*
1872 immap->im_ioport.iop_pcdir |= 0x0400;*/
1874 immap->im_ioport.iop_papar &= ~(0x0200);/*
1875 immap->im_ioport.iop_padir |= 0x0200;*/
1877 immap->im_ioport.iop_pbpar &= ~(0xC000);
1878 immap->im_ioport.iop_pbdir &= ~(0xC000);
1880 /* remove all power */
1882 immap->im_ioport.iop_pcdat |= 0x0400;
1883 immap->im_ioport.iop_padat |= 0x0200;
1886 * Make sure there is a card in the slot, then configure the interface.
1889 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1890 __LINE__,__FUNCTION__,
1891 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
1892 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
1893 printf (" No Card found\n");
1900 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
1901 reg = pcmp->pcmc_pipr;
1902 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
1904 (reg&PCMCIA_VS1(slot))?"n":"ff",
1905 (reg&PCMCIA_VS2(slot))?"n":"ff");
1906 if ((reg & mask) == mask) {
1907 immap->im_ioport.iop_pcdat &= ~(0x4000);
1908 puts (" 5.0V card found: ");
1910 immap->im_ioport.iop_padat &= ~(0x0002);
1911 puts (" 3.3V card found: ");
1913 immap->im_ioport.iop_pcdir |= 0x0400;
1914 immap->im_ioport.iop_padir |= 0x0200;
1916 /* VCC switch error flag, PCMCIA slot INPACK_ pin */
1917 cp->cp_pbdir &= ~(0x0020 | 0x0010);
1918 cp->cp_pbpar &= ~(0x0020 | 0x0010);
1921 debug ("Enable PCMCIA buffers and stop RESET\n");
1922 reg = PCMCIA_PGCRX(_slot_);
1923 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1924 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1925 PCMCIA_PGCRX(_slot_) = reg;
1927 udelay(250000); /* some cards need >150 ms to come up :-( */
1929 debug ("# hardware_enable done\n");
1935 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1936 static int hardware_disable(int slot)
1938 volatile immap_t *immap;
1939 volatile pcmconf8xx_t *pcmp;
1942 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1944 immap = (immap_t *)CFG_IMMR;
1945 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1947 /* remove all power */
1948 immap->im_ioport.iop_pcdat |= 0x0400;
1949 immap->im_ioport.iop_padat |= 0x0200;
1951 /* Configure PCMCIA General Control Register */
1952 debug ("Disable PCMCIA buffers and assert RESET\n");
1954 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1955 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1956 PCMCIA_PGCRX(_slot_) = reg;
1962 #endif /* CFG_CMD_PCMCIA */
1965 static int voltage_set(int slot, int vcc, int vpp)
1967 volatile immap_t *immap;
1968 volatile pcmconf8xx_t *pcmp;
1971 debug ("voltage_set: "
1973 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
1974 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
1976 immap = (immap_t *)CFG_IMMR;
1977 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1979 * Disable PCMCIA buffers (isolate the interface)
1980 * and assert RESET signal
1982 debug ("Disable PCMCIA buffers and assert RESET\n");
1983 reg = PCMCIA_PGCRX(_slot_);
1984 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1985 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1986 PCMCIA_PGCRX(_slot_) = reg;
1990 * Configure Ports A & C pins for
1991 * 5 Volts Enable and 3 Volts enable,
1992 * Turn off all power
1994 debug ("PCMCIA power OFF\n");
1995 immap->im_ioport.iop_pcpar &= ~(0x0400);
1996 immap->im_ioport.iop_pcso &= ~(0x0400);/*
1997 immap->im_ioport.iop_pcdir |= 0x0400;*/
1999 immap->im_ioport.iop_papar &= ~(0x0200);/*
2000 immap->im_ioport.iop_padir |= 0x0200;*/
2002 immap->im_ioport.iop_pcdat |= 0x0400;
2003 immap->im_ioport.iop_padat |= 0x0200;
2008 case 33: reg |= 0x0200; break;
2009 case 50: reg |= 0x0400; break;
2013 /* Checking supported voltages */
2015 debug ("PIPR: 0x%x --> %s\n",
2017 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
2020 immap->im_ioport.iop_pcdat &= !reg;
2022 immap->im_ioport.iop_padat &= !reg;
2023 immap->im_ioport.iop_pcdir |= 0x0200;
2024 immap->im_ioport.iop_padir |= 0x0400;
2026 debug ("PCMCIA powered at %sV\n",
2027 (reg&0x0400) ? "5.0" : "3.3");
2029 debug ("PCMCIA powered down\n");
2033 debug ("Enable PCMCIA buffers and stop RESET\n");
2034 reg = PCMCIA_PGCRX(_slot_);
2035 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2036 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2037 PCMCIA_PGCRX(_slot_) = reg;
2040 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
2045 #endif /* R360MPI */
2047 /* -------------------------------------------------------------------- */
2049 /* -------------------------------------------------------------------- */
2050 #if defined(CONFIG_KUP4K)
2052 #define PCMCIA_BOARD_MSG "KUP4K"
2054 #define KUP4K_PCMCIA_B_3V3 (0x00020000)
2056 static int hardware_enable(int slot)
2058 volatile immap_t *immap;
2059 volatile cpm8xx_t *cp;
2060 volatile pcmconf8xx_t *pcmp;
2061 volatile sysconf8xx_t *sysp;
2064 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
2068 immap = (immap_t *)CFG_IMMR;
2069 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
2070 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2071 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
2074 * Configure SIUMCR to enable PCMCIA port B
2075 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
2077 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
2079 /* clear interrupt state, and disable interrupts */
2080 pcmp->pcmc_pscr = PCMCIA_MASK(slot);
2081 pcmp->pcmc_per &= ~PCMCIA_MASK(slot);
2084 * Disable interrupts, DMA, and PCMCIA buffers
2085 * (isolate the interface) and assert RESET signal
2087 debug ("Disable PCMCIA buffers and assert RESET\n");
2089 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2090 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2091 PCMCIA_PGCRX(slot) = reg;
2095 * Configure Port B pins for
2098 if (slot) { /* Slot A is built-in */
2099 cp->cp_pbdir |= KUP4K_PCMCIA_B_3V3;
2100 cp->cp_pbpar &= ~KUP4K_PCMCIA_B_3V3;
2101 /* remove all power */
2102 cp->cp_pbdat |= KUP4K_PCMCIA_B_3V3; /* active low */
2105 * Make sure there is a card in the slot, then configure the interface.
2108 debug ("[%d] %s: PIPR(%p)=0x%x\n",
2109 __LINE__,__FUNCTION__,
2110 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
2111 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
2112 printf (" No Card found\n");
2119 printf("%s Slot %c:", slot ? "" : "\n", 'A' + slot);
2120 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
2121 reg = pcmp->pcmc_pipr;
2122 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
2124 (reg&PCMCIA_VS1(slot))?"n":"ff",
2125 (reg&PCMCIA_VS2(slot))?"n":"ff");
2126 if ((reg & mask) == mask) {
2127 puts (" 5.0V card found: NOT SUPPORTED !!!\n");
2130 cp->cp_pbdat &= ~KUP4K_PCMCIA_B_3V3;
2131 puts (" 3.3V card found: ");
2134 /* VCC switch error flag, PCMCIA slot INPACK_ pin */
2135 cp->cp_pbdir &= ~(0x0020 | 0x0010);
2136 cp->cp_pbpar &= ~(0x0020 | 0x0010);
2139 debug ("Enable PCMCIA buffers and stop RESET\n");
2140 reg = PCMCIA_PGCRX(slot);
2141 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2142 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2143 PCMCIA_PGCRX(slot) = reg;
2145 udelay(250000); /* some cards need >150 ms to come up :-( */
2147 debug ("# hardware_enable done\n");
2153 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
2154 static int hardware_disable(int slot)
2156 volatile immap_t *immap;
2157 volatile cpm8xx_t *cp;
2158 volatile pcmconf8xx_t *pcmp;
2161 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
2163 immap = (immap_t *)CFG_IMMR;
2164 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2165 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
2167 /* remove all power */
2169 cp->cp_pbdat |= KUP4K_PCMCIA_B_3V3;
2171 /* Configure PCMCIA General Control Register */
2172 debug ("Disable PCMCIA buffers and assert RESET\n");
2174 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2175 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2176 PCMCIA_PGCRX(slot) = reg;
2182 #endif /* CFG_CMD_PCMCIA */
2185 static int voltage_set(int slot, int vcc, int vpp)
2187 volatile immap_t *immap;
2188 volatile cpm8xx_t *cp;
2189 volatile pcmconf8xx_t *pcmp;
2192 debug ("voltage_set: " \
2194 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
2195 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
2197 if (!slot) /* Slot A is not configurable */
2200 immap = (immap_t *)CFG_IMMR;
2201 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2202 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
2205 * Disable PCMCIA buffers (isolate the interface)
2206 * and assert RESET signal
2208 debug ("Disable PCMCIA buffers and assert RESET\n");
2209 reg = PCMCIA_PGCRX(slot);
2210 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2211 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2212 PCMCIA_PGCRX(slot) = reg;
2215 debug ("PCMCIA power OFF\n");
2217 * Configure Port B pins for
2220 cp->cp_pbdir |= KUP4K_PCMCIA_B_3V3;
2221 cp->cp_pbpar &= ~KUP4K_PCMCIA_B_3V3;
2222 /* remove all power */
2223 cp->cp_pbdat |= KUP4K_PCMCIA_B_3V3; /* active low */
2228 cp->cp_pbdat &= ~KUP4K_PCMCIA_B_3V3;
2229 debug ("PCMCIA powered at 3.3V\n");
2232 debug ("PCMCIA: 5Volt vcc not supported\n");
2235 puts("PCMCIA: vcc not supported");
2239 /* Checking supported voltages */
2241 debug ("PIPR: 0x%x --> %s\n",
2243 (pcmp->pcmc_pipr & (0x80000000 >> (slot << 4)))
2244 ? "only 5 V --> NOT SUPPORTED"
2248 debug ("Enable PCMCIA buffers and stop RESET\n");
2249 reg = PCMCIA_PGCRX(slot);
2250 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2251 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2252 PCMCIA_PGCRX(slot) = reg;
2255 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
2263 /* -------------------------------------------------------------------- */
2264 /* End of Board Specific Stuff */
2265 /* -------------------------------------------------------------------- */
2268 /* -------------------------------------------------------------------- */
2269 /* MPC8xx Specific Stuff - should go to MPC8xx directory */
2270 /* -------------------------------------------------------------------- */
2273 * Search this table to see if the windowsize is
2277 #define M8XX_SIZES_NO 32
2279 static const u_int m8xx_size_to_gray[M8XX_SIZES_NO] =
2280 { 0x00000001, 0x00000002, 0x00000008, 0x00000004,
2281 0x00000080, 0x00000040, 0x00000010, 0x00000020,
2282 0x00008000, 0x00004000, 0x00001000, 0x00002000,
2283 0x00000100, 0x00000200, 0x00000800, 0x00000400,
2285 0x0fffffff, 0xffffffff, 0xffffffff, 0xffffffff,
2286 0x01000000, 0x02000000, 0xffffffff, 0x04000000,
2287 0x00010000, 0x00020000, 0x00080000, 0x00040000,
2288 0x00800000, 0x00400000, 0x00100000, 0x00200000 };
2291 /* -------------------------------------------------------------------- */
2293 #ifndef CONFIG_I82365
2295 static u_int m8xx_get_graycode(u_int size)
2299 for (k = 0; k < M8XX_SIZES_NO; k++) {
2300 if(m8xx_size_to_gray[k] == size)
2304 if((k == M8XX_SIZES_NO) || (m8xx_size_to_gray[k] == -1))
2310 #endif /* CONFIG_I82365 */
2312 /* -------------------------------------------------------------------- */
2315 static u_int m8xx_get_speed(u_int ns, u_int is_io)
2317 u_int reg, clocks, psst, psl, psht;
2322 * We get called with IO maps setup to 0ns
2323 * if not specified by the user.
2324 * They should be 255ns.
2330 ns = 100; /* fast memory if 0 */
2334 * In PSST, PSL, PSHT fields we tell the controller
2335 * timing parameters in CLKOUT clock cycles.
2336 * CLKOUT is the same as GCLK2_50.
2339 /* how we want to adjust the timing - in percent */
2341 #define ADJ 180 /* 80 % longer accesstime - to be sure */
2343 clocks = ((M8XX_BUSFREQ / 1000) * ns) / 1000;
2344 clocks = (clocks * ADJ) / (100*1000);
2346 if(clocks >= PCMCIA_BMT_LIMIT) {
2347 DEBUG(0, "Max access time limit reached\n");
2348 clocks = PCMCIA_BMT_LIMIT-1;
2351 psst = clocks / 7; /* setup time */
2352 psht = clocks / 7; /* hold time */
2353 psl = (clocks * 5) / 7; /* strobe length */
2355 psst += clocks - (psst + psht + psl);
2365 /* -------------------------------------------------------------------- */
2367 #ifdef CONFIG_IDE_8xx_PCCARD
2368 static void print_funcid (int func)
2372 case CISTPL_FUNCID_MULTI:
2373 puts (" Multi-Function");
2375 case CISTPL_FUNCID_MEMORY:
2378 case CISTPL_FUNCID_SERIAL:
2379 puts (" Serial Port");
2381 case CISTPL_FUNCID_PARALLEL:
2382 puts (" Parallel Port");
2384 case CISTPL_FUNCID_FIXED:
2385 puts (" Fixed Disk");
2387 case CISTPL_FUNCID_VIDEO:
2388 puts (" Video Adapter");
2390 case CISTPL_FUNCID_NETWORK:
2391 puts (" Network Adapter");
2393 case CISTPL_FUNCID_AIMS:
2394 puts (" AIMS Card");
2396 case CISTPL_FUNCID_SCSI:
2397 puts (" SCSI Adapter");
2405 #endif /* CONFIG_IDE_8xx_PCCARD */
2407 /* -------------------------------------------------------------------- */
2409 #ifdef CONFIG_IDE_8xx_PCCARD
2410 static void print_fixed (volatile uchar *p)
2418 case CISTPL_FUNCE_IDE_IFACE:
2419 { uchar iface = *(p+2);
2421 puts ((iface == CISTPL_IDE_INTERFACE) ? " IDE" : " unknown");
2422 puts (" interface ");
2425 case CISTPL_FUNCE_IDE_MASTER:
2426 case CISTPL_FUNCE_IDE_SLAVE:
2427 { uchar f1 = *(p+2);
2430 puts ((f1 & CISTPL_IDE_SILICON) ? " [silicon]" : " [rotating]");
2432 if (f1 & CISTPL_IDE_UNIQUE)
2435 puts ((f1 & CISTPL_IDE_DUAL) ? " [dual]" : " [single]");
2437 if (f2 & CISTPL_IDE_HAS_SLEEP)
2440 if (f2 & CISTPL_IDE_HAS_STANDBY)
2441 puts (" [standby]");
2443 if (f2 & CISTPL_IDE_HAS_IDLE)
2446 if (f2 & CISTPL_IDE_LOW_POWER)
2447 puts (" [low power]");
2449 if (f2 & CISTPL_IDE_REG_INHIBIT)
2450 puts (" [reg inhibit]");
2452 if (f2 & CISTPL_IDE_HAS_INDEX)
2455 if (f2 & CISTPL_IDE_IOIS16)
2463 #endif /* CONFIG_IDE_8xx_PCCARD */
2465 /* -------------------------------------------------------------------- */
2467 #ifdef CONFIG_IDE_8xx_PCCARD
2469 #define MAX_IDENT_CHARS 64
2470 #define MAX_IDENT_FIELDS 4
2472 static uchar *known_cards[] = {
2477 static int identify (volatile uchar *p)
2479 uchar id_str[MAX_IDENT_CHARS];
2486 return (0); /* Don't know */
2491 for (i=0; i<=4 && !done; ++i, p+=2) {
2492 while ((data = *p) != '\0') {
2498 if (t == &id_str[MAX_IDENT_CHARS-1]) {
2508 while (--t > id_str) {
2517 for (card=known_cards; *card; ++card) {
2518 debug ("## Compare against \"%s\"\n", *card);
2519 if (strcmp(*card, id_str) == 0) { /* found! */
2520 debug ("## CARD FOUND ##\n");
2525 return (0); /* don't know */
2527 #endif /* CONFIG_IDE_8xx_PCCARD */
2529 /* -------------------------------------------------------------------- */
2531 #endif /* CFG_CMD_PCMCIA || (CFG_CMD_IDE && CONFIG_IDE_8xx_PCCARD) */
2533 /**************************************************/
2535 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
2537 pinit, 2, 1, do_pinit,
2538 "pinit - PCMCIA sub-system\n",
2539 "on - power on PCMCIA socket\n"
2540 "pinit off - power off PCMCIA socket\n"