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 default: /* set to not valid */
235 debug ("MemWin %d: PBR 0x%08lX POR %08lX\n",
236 i, win->br, win->or);
237 base += CFG_PCMCIA_MEM_SIZE;
241 for (i=0, rc=0, slot=_slot_; i<PCMCIA_SOCKETS_NO; i++, slot = !slot) {
242 /* turn off voltage */
243 if ((rc = voltage_set(slot, 0, 0)))
246 /* Enable external hardware */
247 if ((rc = hardware_enable(slot)))
250 #ifdef CONFIG_IDE_8xx_PCCARD
251 if ((rc = check_ide_device(i)))
257 #endif /* CONFIG_I82365 */
259 /* -------------------------------------------------------------------- */
261 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
264 static int pcmcia_off (void)
266 printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n");
273 static int pcmcia_off (void)
278 printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n");
280 /* clear interrupt state, and disable interrupts */
281 ((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pscr = PCMCIA_MASK(_slot_);
282 ((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_per &= ~PCMCIA_MASK(_slot_);
284 /* turn off interrupt and disable CxOE */
285 PCMCIA_PGCRX(_slot_) = __MY_PCMCIA_GCRX_CXOE;
287 /* turn off memory windows */
288 win = (pcmcia_win_t *)(&((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pbr0);
290 for (i=0; i<PCMCIA_MEM_WIN_NO; ++i) {
291 /* disable memory window */
296 /* turn off voltage */
297 voltage_set(_slot_, 0, 0);
299 /* disable external hardware */
300 printf ("Shutdown and Poweroff " PCMCIA_SLOT_MSG "\n");
301 hardware_disable(_slot_);
304 #endif /* CONFIG_I82365 */
306 #endif /* CFG_CMD_PCMCIA */
308 /* -------------------------------------------------------------------- */
310 #ifdef CONFIG_IDE_8xx_PCCARD
312 #define MAX_TUPEL_SZ 512
313 #define MAX_FEATURES 4
315 int ide_devices_found;
316 static int check_ide_device (int slot)
318 volatile uchar *ident = NULL;
319 volatile uchar *feature_p[MAX_FEATURES];
320 volatile uchar *p, *start, *addr;
324 ushort config_base = 0;
328 addr = (volatile uchar *)(CFG_PCMCIA_MEM_ADDR +
329 CFG_PCMCIA_MEM_SIZE * (slot * 4));
330 debug ("PCMCIA MEM: %08lX\n", (ulong)addr);
332 start = p = (volatile uchar *) addr;
334 while ((p - start) < MAX_TUPEL_SZ) {
338 if (code == 0xFF) { /* End of chain */
343 #if defined(DEBUG) && (DEBUG > 1)
344 { volatile uchar *q = p;
345 printf ("\nTuple code %02x length %d\n\tData:",
348 for (i = 0; i < len; ++i) {
349 printf (" %02x", *q);
359 /* Fix for broken SanDisk which may have 0x80 bit set */
363 if (n_features < MAX_FEATURES)
364 feature_p[n_features++] = p;
367 config_base = (*(p+6) << 8) + (*(p+4));
368 debug ("\n## Config_base = %04x ###\n", config_base);
375 found = identify (ident);
377 if (func_id != ((uchar)~0)) {
378 print_funcid (func_id);
380 if (func_id == CISTPL_FUNCID_FIXED)
383 return (1); /* no disk drive */
386 for (i=0; i<n_features; ++i) {
387 print_fixed (feature_p[i]);
391 printf ("unknown card type\n");
395 ide_devices_found |= (1 << slot);
397 /* set I/O area in config reg -> only valid for ARGOSY D5!!! */
398 *((uchar *)(addr + config_base)) = 1;
402 #endif /* CONFIG_IDE_8xx_PCCARD */
404 /* -------------------------------------------------------------------- */
407 /* -------------------------------------------------------------------- */
408 /* board specific stuff: */
409 /* voltage_set(), hardware_enable() and hardware_disable() */
410 /* -------------------------------------------------------------------- */
412 /* -------------------------------------------------------------------- */
413 /* RPX Boards from Embedded Planet */
414 /* -------------------------------------------------------------------- */
416 #if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_RPXLITE)
418 /* The RPX boards seems to have it's bus monitor timeout set to 6*8 clocks.
419 * SYPCR is write once only, therefore must the slowest memory be faster
420 * than the bus monitor or we will get a machine check due to the bus timeout.
423 #define PCMCIA_BOARD_MSG "RPX CLASSIC or RPX LITE"
425 #undef PCMCIA_BMT_LIMIT
426 #define PCMCIA_BMT_LIMIT (6*8)
428 static int voltage_set(int slot, int vcc, int vpp)
434 case 33: reg |= BCSR1_PCVCTL4; break;
435 case 50: reg |= BCSR1_PCVCTL5; break;
444 reg |= BCSR1_PCVCTL6;
449 reg |= BCSR1_PCVCTL7;
456 /* first, turn off all power */
458 *((uint *)RPX_CSR_ADDR) &= ~(BCSR1_PCVCTL4 | BCSR1_PCVCTL5
459 | BCSR1_PCVCTL6 | BCSR1_PCVCTL7);
461 /* enable new powersettings */
463 *((uint *)RPX_CSR_ADDR) |= reg;
468 #define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
469 static int hardware_enable (int slot)
471 return 0; /* No hardware to enable */
473 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
474 static int hardware_disable(int slot)
476 return 0; /* No hardware to disable */
478 #endif /* CFG_CMD_PCMCIA */
479 #endif /* CONFIG_RPXCLASSIC */
481 /* -------------------------------------------------------------------- */
482 /* (F)ADS Boards from Motorola */
483 /* -------------------------------------------------------------------- */
485 #if defined(CONFIG_ADS) || defined(CONFIG_FADS)
488 #define PCMCIA_BOARD_MSG "ADS"
489 #define PCMCIA_GLITCHY_CD /* My ADS board needs this */
491 #define PCMCIA_BOARD_MSG "FADS"
494 static int voltage_set(int slot, int vcc, int vpp)
499 case 0: reg = 0; break;
500 case 50: reg = 1; break;
501 case 120: reg = 2; break;
506 case 0: reg = 0; break;
508 case 50: reg = BCSR1_PCCVCCON; break;
511 case 33: reg = BCSR1_PCCVCC0 | BCSR1_PCCVCC1; break;
512 case 50: reg = BCSR1_PCCVCC1; break;
517 /* first, turn off all power */
520 *((uint *)BCSR1) |= BCSR1_PCCVCCON;
523 *((uint *)BCSR1) &= ~(BCSR1_PCCVCC0 | BCSR1_PCCVCC1);
525 *((uint *)BCSR1) &= ~BCSR1_PCCVPP_MASK;
527 /* enable new powersettings */
530 *((uint *)BCSR1) &= ~reg;
533 *((uint *)BCSR1) |= reg;
536 *((uint *)BCSR1) |= reg << 20;
541 #define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
543 static int hardware_enable(int slot)
545 *((uint *)BCSR1) &= ~BCSR1_PCCEN;
549 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
550 static int hardware_disable(int slot)
552 *((uint *)BCSR1) &= ~BCSR1_PCCEN;
555 #endif /* CFG_CMD_PCMCIA */
559 /* -------------------------------------------------------------------- */
560 /* TQM8xxL Boards by TQ Components */
561 /* SC8xx Boards by SinoVee Microsystems */
562 /* -------------------------------------------------------------------- */
564 #if defined(CONFIG_TQM8xxL) || defined(CONFIG_SVM_SC8xx)
566 #if defined(CONFIG_TQM8xxL)
567 #define PCMCIA_BOARD_MSG "TQM8xxL"
569 #if defined(CONFIG_SVM_SC8xx)
570 #define PCMCIA_BOARD_MSG "SC8xx"
573 static int hardware_enable(int slot)
575 volatile immap_t *immap;
576 volatile cpm8xx_t *cp;
577 volatile pcmconf8xx_t *pcmp;
578 volatile sysconf8xx_t *sysp;
581 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
585 immap = (immap_t *)CFG_IMMR;
586 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
587 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
588 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
591 * Configure SIUMCR to enable PCMCIA port B
592 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
594 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
596 /* clear interrupt state, and disable interrupts */
597 pcmp->pcmc_pscr = PCMCIA_MASK(slot);
598 pcmp->pcmc_per &= ~PCMCIA_MASK(slot);
601 * Disable interrupts, DMA, and PCMCIA buffers
602 * (isolate the interface) and assert RESET signal
604 debug ("Disable PCMCIA buffers and assert RESET\n");
606 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
608 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
610 PCMCIA_PGCRX(slot) = reg;
615 * Configure Port C pins for
616 * 5 Volts Enable and 3 Volts enable
618 immap->im_ioport.iop_pcpar &= ~(0x0002 | 0x0004);
619 immap->im_ioport.iop_pcso &= ~(0x0002 | 0x0004);
620 /* remove all power */
622 immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004);
626 * Make sure there is a card in the slot, then configure the interface.
629 debug ("[%d] %s: PIPR(%p)=0x%x\n",
630 __LINE__,__FUNCTION__,
631 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
632 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
633 printf (" No Card found\n");
640 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
641 reg = pcmp->pcmc_pipr;
642 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
644 (reg&PCMCIA_VS1(slot))?"n":"ff",
645 (reg&PCMCIA_VS2(slot))?"n":"ff");
647 if ((reg & mask) == mask) {
648 immap->im_ioport.iop_pcdat |= 0x0004;
649 puts (" 5.0V card found: ");
651 immap->im_ioport.iop_pcdat |= 0x0002;
652 puts (" 3.3V card found: ");
654 immap->im_ioport.iop_pcdir |= (0x0002 | 0x0004);
656 if ((reg & mask) == mask) {
657 puts (" 5.0V card found: ");
659 puts (" 3.3V card found: ");
663 /* VCC switch error flag, PCMCIA slot INPACK_ pin */
664 cp->cp_pbdir &= ~(0x0020 | 0x0010);
665 cp->cp_pbpar &= ~(0x0020 | 0x0010);
669 debug ("Enable PCMCIA buffers and stop RESET\n");
670 reg = PCMCIA_PGCRX(slot);
671 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
673 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
675 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
677 PCMCIA_PGCRX(slot) = reg;
679 udelay(250000); /* some cards need >150 ms to come up :-( */
681 debug ("# hardware_enable done\n");
687 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
688 static int hardware_disable(int slot)
690 volatile immap_t *immap;
691 volatile pcmconf8xx_t *pcmp;
694 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
696 immap = (immap_t *)CFG_IMMR;
697 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
700 /* remove all power */
701 immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004);
704 debug ("Disable PCMCIA buffers and assert RESET\n");
706 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
708 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
710 PCMCIA_PGCRX(slot) = reg;
716 #endif /* CFG_CMD_PCMCIA */
719 static int voltage_set(int slot, int vcc, int vpp)
724 static int voltage_set(int slot, int vcc, int vpp)
726 volatile immap_t *immap;
727 volatile pcmconf8xx_t *pcmp;
730 debug ("voltage_set: "
732 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
733 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
735 immap = (immap_t *)CFG_IMMR;
736 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
738 * Disable PCMCIA buffers (isolate the interface)
739 * and assert RESET signal
741 debug ("Disable PCMCIA buffers and assert RESET\n");
742 reg = PCMCIA_PGCRX(slot);
743 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
745 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
747 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
749 PCMCIA_PGCRX(slot) = reg;
753 * Configure Port C pins for
754 * 5 Volts Enable and 3 Volts enable,
757 debug ("PCMCIA power OFF\n");
758 immap->im_ioport.iop_pcpar &= ~(0x0002 | 0x0004);
759 immap->im_ioport.iop_pcso &= ~(0x0002 | 0x0004);
760 immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004);
765 case 33: reg |= 0x0002; break;
766 case 50: reg |= 0x0004; break;
770 /* Checking supported voltages */
772 debug ("PIPR: 0x%x --> %s\n",
774 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
776 immap->im_ioport.iop_pcdat |= reg;
777 immap->im_ioport.iop_pcdir |= (0x0002 | 0x0004);
779 debug ("PCMCIA powered at %sV\n",
780 (reg&0x0004) ? "5.0" : "3.3");
782 debug ("PCMCIA powered down\n");
786 debug ("Enable PCMCIA buffers and stop RESET\n");
787 reg = PCMCIA_PGCRX(slot);
788 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
790 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
792 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
794 PCMCIA_PGCRX(slot) = reg;
797 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
806 /* -------------------------------------------------------------------- */
808 /* -------------------------------------------------------------------- */
810 #if defined(CONFIG_LWMON)
812 #define PCMCIA_BOARD_MSG "LWMON"
814 /* #define's for MAX1604 Power Switch */
815 #define MAX1604_OP_SUS 0x80
816 #define MAX1604_VCCBON 0x40
817 #define MAX1604_VCC_35 0x20
818 #define MAX1604_VCCBHIZ 0x10
819 #define MAX1604_VPPBON 0x08
820 #define MAX1604_VPPBPBPGM 0x04
821 #define MAX1604_VPPBHIZ 0x02
824 static int hardware_enable(int slot)
826 volatile immap_t *immap;
827 volatile cpm8xx_t *cp;
828 volatile pcmconf8xx_t *pcmp;
829 volatile sysconf8xx_t *sysp;
834 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
836 /* Switch on PCMCIA port in PIC register 0x60 */
837 reg = pic_read (0x60);
838 debug ("[%d] PIC read: reg_60 = 0x%02x\n", __LINE__, reg);
840 /* reg |= 0x08; Vpp not needed */
841 pic_write (0x60, reg);
843 reg = pic_read (0x60);
844 printf ("[%d] PIC read: reg_60 = 0x%02x\n", __LINE__, reg);
848 immap = (immap_t *)CFG_IMMR;
849 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
850 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
851 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
854 * Configure SIUMCR to enable PCMCIA port B
855 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
857 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
859 /* clear interrupt state, and disable interrupts */
860 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
861 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
864 * Disable interrupts, DMA, and PCMCIA buffers
865 * (isolate the interface) and assert RESET signal
867 debug ("Disable PCMCIA buffers and assert RESET\n");
869 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
870 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
871 PCMCIA_PGCRX(_slot_) = reg;
875 * Make sure there is a card in the slot, then configure the interface.
878 debug ("[%d] %s: PIPR(%p)=0x%x\n",
879 __LINE__,__FUNCTION__,
880 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
881 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
882 printf (" No Card found\n");
889 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
890 reg = pcmp->pcmc_pipr;
891 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
893 (reg&PCMCIA_VS1(slot))?"n":"ff",
894 (reg&PCMCIA_VS2(slot))?"n":"ff");
895 if ((reg & mask) == mask) {
896 val = 0; /* VCCB3/5 = 0 ==> use Vx = 5.0 V */
897 puts (" 5.0V card found: ");
899 val = MAX1604_VCC_35; /* VCCB3/5 = 1 ==> use Vy = 3.3 V */
900 puts (" 3.3V card found: ");
904 val |= MAX1604_OP_SUS | MAX1604_VCCBON;
905 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
906 i2c_write (CFG_I2C_POWER_A_ADDR, 0, 0, &val, 1);
910 debug ("Enable PCMCIA buffers and stop RESET\n");
911 reg = PCMCIA_PGCRX(_slot_);
912 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
913 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
914 PCMCIA_PGCRX(_slot_) = reg;
916 udelay(250000); /* some cards need >150 ms to come up :-( */
918 debug ("# hardware_enable done\n");
924 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
925 static int hardware_disable(int slot)
927 volatile immap_t *immap;
928 volatile pcmconf8xx_t *pcmp;
932 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
934 immap = (immap_t *)CFG_IMMR;
935 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
937 /* remove all power, put output in high impedance state */
938 val = MAX1604_VCCBHIZ | MAX1604_VPPBHIZ;
939 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
940 i2c_write (CFG_I2C_POWER_A_ADDR, 0, 0, &val, 1);
942 /* Configure PCMCIA General Control Register */
943 debug ("Disable PCMCIA buffers and assert RESET\n");
945 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
946 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
947 PCMCIA_PGCRX(_slot_) = reg;
949 /* Switch off PCMCIA port in PIC register 0x60 */
950 reg = pic_read (0x60);
951 debug ("[%d] PIC read: reg_60 = 0x%02x\n", __LINE__, reg);
954 pic_write (0x60, reg);
956 reg = pic_read (0x60);
957 printf ("[%d] PIC read: reg_60 = 0x%02x\n", __LINE__, reg);
963 #endif /* CFG_CMD_PCMCIA */
966 static int voltage_set(int slot, int vcc, int vpp)
968 volatile immap_t *immap;
969 volatile pcmconf8xx_t *pcmp;
973 debug ("voltage_set: "
975 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
976 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
978 immap = (immap_t *)CFG_IMMR;
979 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
981 * Disable PCMCIA buffers (isolate the interface)
982 * and assert RESET signal
984 debug ("Disable PCMCIA buffers and assert RESET\n");
985 reg = PCMCIA_PGCRX(_slot_);
986 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
987 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
988 PCMCIA_PGCRX(_slot_) = reg;
992 * Turn off all power (switch to high impedance)
994 debug ("PCMCIA power OFF\n");
995 val = MAX1604_VCCBHIZ | MAX1604_VPPBHIZ;
996 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
997 i2c_write (CFG_I2C_POWER_A_ADDR, 0, 0, &val, 1);
1002 case 33: val = MAX1604_VCC_35; break;
1007 /* Checking supported voltages */
1009 debug ("PIPR: 0x%x --> %s\n",
1011 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
1013 i2c_write (CFG_I2C_POWER_A_ADDR, 0, 0, &val, 1);
1015 debug ("PCMCIA powered at %sV\n",
1016 (val & MAX1604_VCC_35) ? "3.3" : "5.0");
1018 debug ("PCMCIA powered down\n");
1022 debug ("Enable PCMCIA buffers and stop RESET\n");
1023 reg = PCMCIA_PGCRX(_slot_);
1024 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1025 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1026 PCMCIA_PGCRX(_slot_) = reg;
1029 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
1036 /* -------------------------------------------------------------------- */
1037 /* GTH board by Corelatus AB */
1038 /* -------------------------------------------------------------------- */
1039 #if defined(CONFIG_GTH)
1041 #define PCMCIA_BOARD_MSG "GTH COMPACT FLASH"
1043 static int voltage_set (int slot, int vcc, int vpp)
1048 static int hardware_enable (int slot)
1050 volatile immap_t *immap;
1051 volatile cpm8xx_t *cp;
1052 volatile pcmconf8xx_t *pcmp;
1053 volatile sysconf8xx_t *sysp;
1056 debug ("hardware_enable: GTH Slot %c\n", 'A' + slot);
1058 immap = (immap_t *) CFG_IMMR;
1059 sysp = (sysconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_siu_conf));
1060 pcmp = (pcmconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_pcmcia));
1061 cp = (cpm8xx_t *) (&(((immap_t *) CFG_IMMR)->im_cpm));
1063 /* clear interrupt state, and disable interrupts */
1064 pcmp->pcmc_pscr = PCMCIA_MASK (_slot_);
1065 pcmp->pcmc_per &= ~PCMCIA_MASK (_slot_);
1068 * Disable interrupts, DMA, and PCMCIA buffers
1069 * (isolate the interface) and assert RESET signal
1071 debug ("Disable PCMCIA buffers and assert RESET\n");
1073 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1074 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1075 PCMCIA_PGCRX (_slot_) = reg;
1079 * Make sure there is a card in the slot,
1080 * then configure the interface.
1083 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1084 __LINE__, __FUNCTION__,
1085 &(pcmp->pcmc_pipr), pcmp->pcmc_pipr);
1086 if (pcmp->pcmc_pipr & 0x98000000) {
1087 printf (" No Card found\n");
1091 mask = PCMCIA_VS1 (slot) | PCMCIA_VS2 (slot);
1092 reg = pcmp->pcmc_pipr;
1093 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
1095 (reg & PCMCIA_VS1 (slot)) ? "n" : "ff",
1096 (reg & PCMCIA_VS2 (slot)) ? "n" : "ff");
1098 debug ("Enable PCMCIA buffers and stop RESET\n");
1099 reg = PCMCIA_PGCRX (_slot_);
1100 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1101 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1102 PCMCIA_PGCRX (_slot_) = reg;
1104 udelay (250000); /* some cards need >150 ms to come up :-( */
1106 debug ("# hardware_enable done\n");
1110 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1111 static int hardware_disable(int slot)
1113 return 0; /* No hardware to disable */
1115 #endif /* CFG_CMD_PCMCIA */
1116 #endif /* CONFIG_GTH */
1118 /* -------------------------------------------------------------------- */
1119 /* ICU862 Boards by Cambridge Broadband Ltd. */
1120 /* -------------------------------------------------------------------- */
1122 #if defined(CONFIG_ICU862)
1124 #define PCMCIA_BOARD_MSG "ICU862"
1126 static void cfg_port_B (void);
1128 static int hardware_enable(int slot)
1130 volatile immap_t *immap;
1131 volatile cpm8xx_t *cp;
1132 volatile pcmconf8xx_t *pcmp;
1133 volatile sysconf8xx_t *sysp;
1134 uint reg, pipr, mask;
1137 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1141 immap = (immap_t *)CFG_IMMR;
1142 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
1143 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1144 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1146 /* Configure Port B for TPS2205 PC-Card Power-Interface Switch */
1150 * Configure SIUMCR to enable PCMCIA port B
1151 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
1153 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
1155 /* clear interrupt state, and disable interrupts */
1156 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
1157 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
1160 * Disable interrupts, DMA, and PCMCIA buffers
1161 * (isolate the interface) and assert RESET signal
1163 debug ("Disable PCMCIA buffers and assert RESET\n");
1165 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1166 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1167 PCMCIA_PGCRX(_slot_) = reg;
1171 * Make sure there is a card in the slot, then configure the interface.
1174 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1175 __LINE__,__FUNCTION__,
1176 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
1177 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
1178 printf (" No Card found\n");
1183 * Power On: Set VAVCC to 3.3V or 5V, set VAVPP to Hi-Z
1185 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
1186 pipr = pcmp->pcmc_pipr;
1187 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
1189 (reg&PCMCIA_VS1(slot))?"n":"ff",
1190 (reg&PCMCIA_VS2(slot))?"n":"ff");
1193 if ((pipr & mask) == mask) {
1194 reg |= (TPS2205_VPP_PGM | TPS2205_VPP_VCC | /* VAVPP => Hi-Z */
1195 TPS2205_VCC3); /* 3V off */
1196 reg &= ~(TPS2205_VCC5); /* 5V on */
1197 puts (" 5.0V card found: ");
1199 reg |= (TPS2205_VPP_PGM | TPS2205_VPP_VCC | /* VAVPP => Hi-Z */
1200 TPS2205_VCC5); /* 5V off */
1201 reg &= ~(TPS2205_VCC3); /* 3V on */
1202 puts (" 3.3V card found: ");
1205 debug ("\nPB DAT: %08x -> 3.3V %s 5.0V %s VPP_PGM %s VPP_VCC %s\n",
1207 (reg & TPS2205_VCC3) ? "off" : "on",
1208 (reg & TPS2205_VCC5) ? "off" : "on",
1209 (reg & TPS2205_VPP_PGM) ? "off" : "on",
1210 (reg & TPS2205_VPP_VCC) ? "off" : "on" );
1214 /* Wait 500 ms; use this to check for over-current */
1215 for (i=0; i<5000; ++i) {
1216 if ((cp->cp_pbdat & TPS2205_OC) == 0) {
1217 printf (" *** Overcurrent - Safety shutdown ***\n");
1218 cp->cp_pbdat &= ~(TPS2205_SHDN);
1224 debug ("Enable PCMCIA buffers and stop RESET\n");
1225 reg = PCMCIA_PGCRX(_slot_);
1226 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1227 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1228 PCMCIA_PGCRX(_slot_) = reg;
1230 udelay(250000); /* some cards need >150 ms to come up :-( */
1232 debug ("# hardware_enable done\n");
1238 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1239 static int hardware_disable(int slot)
1241 volatile immap_t *immap;
1242 volatile cpm8xx_t *cp;
1243 volatile pcmconf8xx_t *pcmp;
1246 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1248 immap = (immap_t *)CFG_IMMR;
1249 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1250 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1253 cp->cp_pbdat &= ~(TPS2205_SHDN);
1255 /* Configure PCMCIA General Control Register */
1256 debug ("Disable PCMCIA buffers and assert RESET\n");
1258 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1259 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1260 PCMCIA_PGCRX(_slot_) = reg;
1266 #endif /* CFG_CMD_PCMCIA */
1269 static int voltage_set(int slot, int vcc, int vpp)
1271 volatile immap_t *immap;
1272 volatile cpm8xx_t *cp;
1273 volatile pcmconf8xx_t *pcmp;
1276 debug ("voltage_set: "
1278 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
1279 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
1281 immap = (immap_t *)CFG_IMMR;
1282 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1283 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1285 * Disable PCMCIA buffers (isolate the interface)
1286 * and assert RESET signal
1288 debug ("Disable PCMCIA buffers and assert RESET\n");
1289 reg = PCMCIA_PGCRX(_slot_);
1290 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1291 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1292 PCMCIA_PGCRX(_slot_) = reg;
1296 * Configure Port C pins for
1297 * 5 Volts Enable and 3 Volts enable,
1298 * Turn all power pins to Hi-Z
1300 debug ("PCMCIA power OFF\n");
1301 cfg_port_B (); /* Enables switch, but all in Hi-Z */
1306 case 0: break; /* Switch off */
1307 case 33: reg &= ~TPS2205_VCC3; break; /* Switch on 3.3V */
1308 case 50: reg &= ~TPS2205_VCC5; break; /* Switch on 5.0V */
1312 /* Checking supported voltages */
1314 debug ("PIPR: 0x%x --> %s\n",
1316 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
1324 if ((reg & TPS2205_VCC3) == 0) {
1326 } else if ((reg & TPS2205_VCC5) == 0) {
1331 printf ("PCMCIA powered %s\n", s);
1336 debug ("Enable PCMCIA buffers and stop RESET\n");
1337 reg = PCMCIA_PGCRX(_slot_);
1338 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1339 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1340 PCMCIA_PGCRX(_slot_) = reg;
1343 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
1348 static void cfg_port_B (void)
1350 volatile immap_t *immap;
1351 volatile cpm8xx_t *cp;
1354 immap = (immap_t *)CFG_IMMR;
1355 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1358 * Configure Port B for TPS2205 PC-Card Power-Interface Switch
1360 * Switch off all voltages, assert shutdown
1363 reg |= (TPS2205_VPP_PGM | TPS2205_VPP_VCC | /* VAVPP => Hi-Z */
1364 TPS2205_VCC3 | TPS2205_VCC5 | /* VAVCC => Hi-Z */
1365 TPS2205_SHDN); /* enable switch */
1368 cp->cp_pbpar &= ~(TPS2205_INPUTS | TPS2205_OUTPUTS);
1370 reg = cp->cp_pbdir & ~(TPS2205_INPUTS);
1371 cp->cp_pbdir = reg | TPS2205_OUTPUTS;
1373 debug ("Set Port B: PAR: %08x DIR: %08x DAT: %08x\n",
1374 cp->cp_pbpar, cp->cp_pbdir, cp->cp_pbdat);
1380 /* -------------------------------------------------------------------- */
1381 /* C2MON Boards by TTTech Computertechnik AG */
1382 /* -------------------------------------------------------------------- */
1384 #if defined(CONFIG_C2MON)
1386 #define PCMCIA_BOARD_MSG "C2MON"
1388 static void cfg_ports (void);
1390 static int hardware_enable(int slot)
1392 volatile immap_t *immap;
1393 volatile cpm8xx_t *cp;
1394 volatile pcmconf8xx_t *pcmp;
1395 volatile sysconf8xx_t *sysp;
1396 uint reg, pipr, mask;
1400 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1404 immap = (immap_t *)CFG_IMMR;
1405 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
1406 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1407 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1409 /* Configure Ports for TPS2211A PC-Card Power-Interface Switch */
1413 * Configure SIUMCR to enable PCMCIA port B
1414 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
1416 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
1418 /* clear interrupt state, and disable interrupts */
1419 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
1420 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
1423 * Disable interrupts, DMA, and PCMCIA buffers
1424 * (isolate the interface) and assert RESET signal
1426 debug ("Disable PCMCIA buffers and assert RESET\n");
1428 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1429 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1430 PCMCIA_PGCRX(_slot_) = reg;
1434 * Make sure there is a card in the slot, then configure the interface.
1437 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1438 __LINE__,__FUNCTION__,
1439 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
1440 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
1441 printf (" No Card found\n");
1446 * Power On: Set VAVCC to 3.3V or 5V, set VAVPP to Hi-Z
1448 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
1449 pipr = pcmp->pcmc_pipr;
1450 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
1452 (reg&PCMCIA_VS1(slot))?"n":"ff",
1453 (reg&PCMCIA_VS2(slot))?"n":"ff");
1455 sreg = immap->im_ioport.iop_pcdat;
1456 if ((pipr & mask) == mask) {
1457 sreg |= (TPS2211_VPPD0 | TPS2211_VPPD1 | /* VAVPP => Hi-Z */
1458 TPS2211_VCCD1); /* 5V on */
1459 sreg &= ~(TPS2211_VCCD0); /* 3V off */
1460 puts (" 5.0V card found: ");
1462 sreg |= (TPS2211_VPPD0 | TPS2211_VPPD1 | /* VAVPP => Hi-Z */
1463 TPS2211_VCCD0); /* 3V on */
1464 sreg &= ~(TPS2211_VCCD1); /* 5V off */
1465 puts (" 3.3V card found: ");
1468 debug ("\nPC DAT: %04x -> 3.3V %s 5.0V %s\n",
1470 ( (sreg & TPS2211_VCCD0) && !(sreg & TPS2211_VCCD1)) ? "on" : "off",
1471 (!(sreg & TPS2211_VCCD0) && (sreg & TPS2211_VCCD1)) ? "on" : "off"
1474 immap->im_ioport.iop_pcdat = sreg;
1476 /* Wait 500 ms; use this to check for over-current */
1477 for (i=0; i<5000; ++i) {
1478 if ((cp->cp_pbdat & TPS2211_OC) == 0) {
1479 printf (" *** Overcurrent - Safety shutdown ***\n");
1480 immap->im_ioport.iop_pcdat &= ~(TPS2211_VCCD0|TPS2211_VCCD1);
1486 debug ("Enable PCMCIA buffers and stop RESET\n");
1487 reg = PCMCIA_PGCRX(_slot_);
1488 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1489 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1490 PCMCIA_PGCRX(_slot_) = reg;
1492 udelay(250000); /* some cards need >150 ms to come up :-( */
1494 debug ("# hardware_enable done\n");
1500 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1501 static int hardware_disable(int slot)
1503 volatile immap_t *immap;
1504 volatile cpm8xx_t *cp;
1505 volatile pcmconf8xx_t *pcmp;
1508 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1510 immap = (immap_t *)CFG_IMMR;
1511 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1513 /* Configure PCMCIA General Control Register */
1514 debug ("Disable PCMCIA buffers and assert RESET\n");
1516 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1517 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1518 PCMCIA_PGCRX(_slot_) = reg;
1520 /* ALl voltages off / Hi-Z */
1521 immap->im_ioport.iop_pcdat |= (TPS2211_VPPD0 | TPS2211_VPPD1 |
1522 TPS2211_VCCD0 | TPS2211_VCCD1 );
1528 #endif /* CFG_CMD_PCMCIA */
1531 static int voltage_set(int slot, int vcc, int vpp)
1533 volatile immap_t *immap;
1534 volatile cpm8xx_t *cp;
1535 volatile pcmconf8xx_t *pcmp;
1539 debug ("voltage_set: "
1541 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
1542 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
1544 immap = (immap_t *)CFG_IMMR;
1545 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1546 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1548 * Disable PCMCIA buffers (isolate the interface)
1549 * and assert RESET signal
1551 debug ("Disable PCMCIA buffers and assert RESET\n");
1552 reg = PCMCIA_PGCRX(_slot_);
1553 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1554 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1555 PCMCIA_PGCRX(_slot_) = reg;
1559 * Configure Port C pins for
1560 * 5 Volts Enable and 3 Volts enable,
1561 * Turn all power pins to Hi-Z
1563 debug ("PCMCIA power OFF\n");
1564 cfg_ports (); /* Enables switch, but all in Hi-Z */
1566 sreg = immap->im_ioport.iop_pcdat;
1567 sreg |= TPS2211_VPPD0 | TPS2211_VPPD1; /* VAVPP always Hi-Z */
1570 case 0: break; /* Switch off */
1571 case 33: sreg |= TPS2211_VCCD0; /* Switch on 3.3V */
1572 sreg &= ~TPS2211_VCCD1;
1574 case 50: sreg &= ~TPS2211_VCCD0; /* Switch on 5.0V */
1575 sreg |= TPS2211_VCCD1;
1580 /* Checking supported voltages */
1582 debug ("PIPR: 0x%x --> %s\n",
1584 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
1586 immap->im_ioport.iop_pcdat = sreg;
1592 if ((sreg & TPS2211_VCCD0) && !(sreg & TPS2211_VCCD1)) {
1594 } else if (!(sreg & TPS2211_VCCD0) && (sreg & TPS2211_VCCD1)) {
1599 printf ("PCMCIA powered %s\n", s);
1604 debug ("Enable PCMCIA buffers and stop RESET\n");
1605 reg = PCMCIA_PGCRX(_slot_);
1606 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1607 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1608 PCMCIA_PGCRX(_slot_) = reg;
1611 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
1616 static void cfg_ports (void)
1618 volatile immap_t *immap;
1619 volatile cpm8xx_t *cp;
1622 immap = (immap_t *)CFG_IMMR;
1623 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1626 * Configure Port C for TPS2211 PC-Card Power-Interface Switch
1628 * Switch off all voltages, assert shutdown
1630 sreg = immap->im_ioport.iop_pcdat;
1631 sreg |= (TPS2211_VPPD0 | TPS2211_VPPD1); /* VAVPP => Hi-Z */
1632 sreg &= ~(TPS2211_VCCD0 | TPS2211_VCCD1); /* 3V and 5V off */
1633 immap->im_ioport.iop_pcdat = sreg;
1635 immap->im_ioport.iop_pcpar &= ~(TPS2211_OUTPUTS);
1636 immap->im_ioport.iop_pcdir |= TPS2211_OUTPUTS;
1638 debug ("Set Port C: PAR: %04x DIR: %04x DAT: %04x\n",
1639 immap->im_ioport.iop_pcpar,
1640 immap->im_ioport.iop_pcdir,
1641 immap->im_ioport.iop_pcdat);
1644 * Configure Port B for TPS2211 PC-Card Power-Interface Switch
1646 * Over-Current Input only
1648 cp->cp_pbpar &= ~(TPS2211_INPUTS);
1649 cp->cp_pbdir &= ~(TPS2211_INPUTS);
1651 debug ("Set Port B: PAR: %08x DIR: %08x DAT: %08x\n",
1652 cp->cp_pbpar, cp->cp_pbdir, cp->cp_pbdat);
1657 /* -------------------------------------------------------------------- */
1658 /* MBX board from Morotola */
1659 /* -------------------------------------------------------------------- */
1661 #if defined( CONFIG_MBX )
1662 #include <../board/mbx8xx/csr.h>
1664 /* A lot of this has been taken from the RPX code in this file it works from me.
1665 I have added the voltage selection for the MBX board. */
1667 /* MBX voltage bit in control register #2 */
1668 #define CR2_VPP12 ((uchar)0x10)
1669 #define CR2_VPPVDD ((uchar)0x20)
1670 #define CR2_VDD5 ((uchar)0x40)
1671 #define CR2_VDD3 ((uchar)0x80)
1673 #define PCMCIA_BOARD_MSG "MBX860"
1675 static int voltage_set (int slot, int vcc, int vpp)
1679 debug ("voltage_set: PCMCIA_BOARD_MSG Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
1680 'A' + slot, vcc / 10, vcc % 10, vpp / 10, vcc % 10);
1713 /* first, turn off all power */
1714 MBX_CSR2 &= ~(CR2_VDDSEL | CR2_VPPSEL);
1716 /* enable new powersettings */
1718 debug ("MBX_CSR2 read = 0x%02x\n", MBX_CSR2);
1723 static int hardware_enable (int slot)
1725 volatile immap_t *immap;
1726 volatile cpm8xx_t *cp;
1727 volatile pcmconf8xx_t *pcmp;
1728 volatile sysconf8xx_t *sysp;
1731 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n",
1736 immap = (immap_t *) CFG_IMMR;
1737 sysp = (sysconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_siu_conf));
1738 pcmp = (pcmconf8xx_t *) (&(((immap_t *) CFG_IMMR)->im_pcmcia));
1739 cp = (cpm8xx_t *) (&(((immap_t *) CFG_IMMR)->im_cpm));
1741 /* clear interrupt state, and disable interrupts */
1742 pcmp->pcmc_pscr = PCMCIA_MASK (_slot_);
1743 pcmp->pcmc_per &= ~PCMCIA_MASK (_slot_);
1746 * Disable interrupts, DMA, and PCMCIA buffers
1747 * (isolate the interface) and assert RESET signal
1749 debug ("Disable PCMCIA buffers and assert RESET\n");
1751 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1752 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1753 PCMCIA_PGCRX (_slot_) = reg;
1756 /* remove all power */
1757 voltage_set (slot, 0, 0);
1759 * Make sure there is a card in the slot, then configure the interface.
1762 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1763 __LINE__,__FUNCTION__,
1764 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
1765 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
1766 printf (" No Card found\n");
1773 mask = PCMCIA_VS1 (_slot_) | PCMCIA_VS2 (_slot_);
1774 reg = pcmp->pcmc_pipr;
1775 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n", reg,
1776 (reg & PCMCIA_VS1 (slot)) ? "n" : "ff",
1777 (reg & PCMCIA_VS2 (slot)) ? "n" : "ff");
1779 if ((reg & mask) == mask) {
1780 voltage_set (_slot_, 50, 0);
1781 printf (" 5.0V card found: ");
1783 voltage_set (_slot_, 33, 0);
1784 printf (" 3.3V card found: ");
1787 debug ("Enable PCMCIA buffers and stop RESET\n");
1788 reg = PCMCIA_PGCRX (_slot_);
1789 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1790 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1791 PCMCIA_PGCRX (_slot_) = reg;
1793 udelay (250000); /* some cards need >150 ms to come up :-( */
1795 debug ("# hardware_enable done\n");
1800 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1801 static int hardware_disable (int slot)
1803 return 0; /* No hardware to disable */
1805 #endif /* CFG_CMD_PCMCIA */
1806 #endif /* CONFIG_MBX */
1807 /* -------------------------------------------------------------------- */
1809 /* -------------------------------------------------------------------- */
1811 #if defined(CONFIG_R360MPI)
1813 #define PCMCIA_BOARD_MSG "R360MPI"
1816 static int hardware_enable(int slot)
1818 volatile immap_t *immap;
1819 volatile cpm8xx_t *cp;
1820 volatile pcmconf8xx_t *pcmp;
1821 volatile sysconf8xx_t *sysp;
1824 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1828 immap = (immap_t *)CFG_IMMR;
1829 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
1830 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1831 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
1834 * Configure SIUMCR to enable PCMCIA port B
1835 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
1837 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
1839 /* clear interrupt state, and disable interrupts */
1840 pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
1841 pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
1844 * Disable interrupts, DMA, and PCMCIA buffers
1845 * (isolate the interface) and assert RESET signal
1847 debug ("Disable PCMCIA buffers and assert RESET\n");
1849 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1850 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1851 PCMCIA_PGCRX(_slot_) = reg;
1855 * Configure Ports A, B & C pins for
1856 * 5 Volts Enable and 3 Volts enable
1858 immap->im_ioport.iop_pcpar &= ~(0x0400);
1859 immap->im_ioport.iop_pcso &= ~(0x0400);/*
1860 immap->im_ioport.iop_pcdir |= 0x0400;*/
1862 immap->im_ioport.iop_papar &= ~(0x0200);/*
1863 immap->im_ioport.iop_padir |= 0x0200;*/
1865 immap->im_ioport.iop_pbpar &= ~(0xC000);
1866 immap->im_ioport.iop_pbdir &= ~(0xC000);
1868 /* remove all power */
1870 immap->im_ioport.iop_pcdat |= 0x0400;
1871 immap->im_ioport.iop_padat |= 0x0200;
1874 * Make sure there is a card in the slot, then configure the interface.
1877 debug ("[%d] %s: PIPR(%p)=0x%x\n",
1878 __LINE__,__FUNCTION__,
1879 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
1880 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
1881 printf (" No Card found\n");
1888 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
1889 reg = pcmp->pcmc_pipr;
1890 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
1892 (reg&PCMCIA_VS1(slot))?"n":"ff",
1893 (reg&PCMCIA_VS2(slot))?"n":"ff");
1894 if ((reg & mask) == mask) {
1895 immap->im_ioport.iop_pcdat &= ~(0x4000);
1896 puts (" 5.0V card found: ");
1898 immap->im_ioport.iop_padat &= ~(0x0002);
1899 puts (" 3.3V card found: ");
1901 immap->im_ioport.iop_pcdir |= 0x0400;
1902 immap->im_ioport.iop_padir |= 0x0200;
1904 /* VCC switch error flag, PCMCIA slot INPACK_ pin */
1905 cp->cp_pbdir &= ~(0x0020 | 0x0010);
1906 cp->cp_pbpar &= ~(0x0020 | 0x0010);
1909 debug ("Enable PCMCIA buffers and stop RESET\n");
1910 reg = PCMCIA_PGCRX(_slot_);
1911 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
1912 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
1913 PCMCIA_PGCRX(_slot_) = reg;
1915 udelay(250000); /* some cards need >150 ms to come up :-( */
1917 debug ("# hardware_enable done\n");
1923 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
1924 static int hardware_disable(int slot)
1926 volatile immap_t *immap;
1927 volatile pcmconf8xx_t *pcmp;
1930 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
1932 immap = (immap_t *)CFG_IMMR;
1933 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1935 /* remove all power */
1936 immap->im_ioport.iop_pcdat |= 0x0400;
1937 immap->im_ioport.iop_padat |= 0x0200;
1939 /* Configure PCMCIA General Control Register */
1940 debug ("Disable PCMCIA buffers and assert RESET\n");
1942 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1943 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1944 PCMCIA_PGCRX(_slot_) = reg;
1950 #endif /* CFG_CMD_PCMCIA */
1953 static int voltage_set(int slot, int vcc, int vpp)
1955 volatile immap_t *immap;
1956 volatile pcmconf8xx_t *pcmp;
1959 debug ("voltage_set: "
1961 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
1962 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
1964 immap = (immap_t *)CFG_IMMR;
1965 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
1967 * Disable PCMCIA buffers (isolate the interface)
1968 * and assert RESET signal
1970 debug ("Disable PCMCIA buffers and assert RESET\n");
1971 reg = PCMCIA_PGCRX(_slot_);
1972 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
1973 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
1974 PCMCIA_PGCRX(_slot_) = reg;
1978 * Configure Ports A & C pins for
1979 * 5 Volts Enable and 3 Volts enable,
1980 * Turn off all power
1982 debug ("PCMCIA power OFF\n");
1983 immap->im_ioport.iop_pcpar &= ~(0x0400);
1984 immap->im_ioport.iop_pcso &= ~(0x0400);/*
1985 immap->im_ioport.iop_pcdir |= 0x0400;*/
1987 immap->im_ioport.iop_papar &= ~(0x0200);/*
1988 immap->im_ioport.iop_padir |= 0x0200;*/
1990 immap->im_ioport.iop_pcdat |= 0x0400;
1991 immap->im_ioport.iop_padat |= 0x0200;
1996 case 33: reg |= 0x0200; break;
1997 case 50: reg |= 0x0400; break;
2001 /* Checking supported voltages */
2003 debug ("PIPR: 0x%x --> %s\n",
2005 (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
2008 immap->im_ioport.iop_pcdat &= !reg;
2010 immap->im_ioport.iop_padat &= !reg;
2011 immap->im_ioport.iop_pcdir |= 0x0200;
2012 immap->im_ioport.iop_padir |= 0x0400;
2014 debug ("PCMCIA powered at %sV\n",
2015 (reg&0x0400) ? "5.0" : "3.3");
2017 debug ("PCMCIA powered down\n");
2021 debug ("Enable PCMCIA buffers and stop RESET\n");
2022 reg = PCMCIA_PGCRX(_slot_);
2023 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2024 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2025 PCMCIA_PGCRX(_slot_) = reg;
2028 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
2033 #endif /* R360MPI */
2035 /* -------------------------------------------------------------------- */
2037 /* -------------------------------------------------------------------- */
2038 #if defined(CONFIG_KUP4K)
2040 #define PCMCIA_BOARD_MSG "KUP4K"
2042 #define KUP4K_PCMCIA_B_3V3 (0x00020000)
2044 static int hardware_enable(int slot)
2046 volatile immap_t *immap;
2047 volatile cpm8xx_t *cp;
2048 volatile pcmconf8xx_t *pcmp;
2049 volatile sysconf8xx_t *sysp;
2052 debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
2056 immap = (immap_t *)CFG_IMMR;
2057 sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
2058 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2059 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
2062 * Configure SIUMCR to enable PCMCIA port B
2063 * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
2065 sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */
2067 /* clear interrupt state, and disable interrupts */
2068 pcmp->pcmc_pscr = PCMCIA_MASK(slot);
2069 pcmp->pcmc_per &= ~PCMCIA_MASK(slot);
2072 * Disable interrupts, DMA, and PCMCIA buffers
2073 * (isolate the interface) and assert RESET signal
2075 debug ("Disable PCMCIA buffers and assert RESET\n");
2077 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2078 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2079 PCMCIA_PGCRX(slot) = reg;
2083 * Configure Port B pins for
2086 if (slot) { /* Slot A is built-in */
2087 cp->cp_pbdir |= KUP4K_PCMCIA_B_3V3;
2088 cp->cp_pbpar &= ~KUP4K_PCMCIA_B_3V3;
2089 /* remove all power */
2090 cp->cp_pbdat |= KUP4K_PCMCIA_B_3V3; /* active low */
2093 * Make sure there is a card in the slot, then configure the interface.
2096 debug ("[%d] %s: PIPR(%p)=0x%x\n",
2097 __LINE__,__FUNCTION__,
2098 &(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
2099 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
2100 printf (" No Card found\n");
2107 printf("%s Slot %c:", slot ? "" : "\n", 'A' + slot);
2108 mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
2109 reg = pcmp->pcmc_pipr;
2110 debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
2112 (reg&PCMCIA_VS1(slot))?"n":"ff",
2113 (reg&PCMCIA_VS2(slot))?"n":"ff");
2114 if ((reg & mask) == mask) {
2115 puts (" 5.0V card found: NOT SUPPORTED !!!\n");
2118 cp->cp_pbdat &= ~KUP4K_PCMCIA_B_3V3;
2119 puts (" 3.3V card found: ");
2122 /* VCC switch error flag, PCMCIA slot INPACK_ pin */
2123 cp->cp_pbdir &= ~(0x0020 | 0x0010);
2124 cp->cp_pbpar &= ~(0x0020 | 0x0010);
2127 debug ("Enable PCMCIA buffers and stop RESET\n");
2128 reg = PCMCIA_PGCRX(slot);
2129 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2130 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2131 PCMCIA_PGCRX(slot) = reg;
2133 udelay(250000); /* some cards need >150 ms to come up :-( */
2135 debug ("# hardware_enable done\n");
2141 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
2142 static int hardware_disable(int slot)
2144 volatile immap_t *immap;
2145 volatile cpm8xx_t *cp;
2146 volatile pcmconf8xx_t *pcmp;
2149 debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
2151 immap = (immap_t *)CFG_IMMR;
2152 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2153 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
2155 /* remove all power */
2157 cp->cp_pbdat |= KUP4K_PCMCIA_B_3V3;
2159 /* Configure PCMCIA General Control Register */
2160 debug ("Disable PCMCIA buffers and assert RESET\n");
2162 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2163 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2164 PCMCIA_PGCRX(slot) = reg;
2170 #endif /* CFG_CMD_PCMCIA */
2173 static int voltage_set(int slot, int vcc, int vpp)
2175 volatile immap_t *immap;
2176 volatile cpm8xx_t *cp;
2177 volatile pcmconf8xx_t *pcmp;
2180 debug ("voltage_set: " \
2182 " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
2183 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
2185 if (!slot) /* Slot A is not configurable */
2188 immap = (immap_t *)CFG_IMMR;
2189 pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
2190 cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
2193 * Disable PCMCIA buffers (isolate the interface)
2194 * and assert RESET signal
2196 debug ("Disable PCMCIA buffers and assert RESET\n");
2197 reg = PCMCIA_PGCRX(slot);
2198 reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
2199 reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
2200 PCMCIA_PGCRX(slot) = reg;
2203 debug ("PCMCIA power OFF\n");
2205 * Configure Port B pins for
2208 cp->cp_pbdir |= KUP4K_PCMCIA_B_3V3;
2209 cp->cp_pbpar &= ~KUP4K_PCMCIA_B_3V3;
2210 /* remove all power */
2211 cp->cp_pbdat |= KUP4K_PCMCIA_B_3V3; /* active low */
2216 cp->cp_pbdat &= ~KUP4K_PCMCIA_B_3V3;
2217 debug ("PCMCIA powered at 3.3V\n");
2220 debug ("PCMCIA: 5Volt vcc not supported\n");
2223 puts("PCMCIA: vcc not supported");
2227 /* Checking supported voltages */
2229 debug ("PIPR: 0x%x --> %s\n",
2231 (pcmp->pcmc_pipr & (0x80000000 >> (slot << 4)))
2232 ? "only 5 V --> NOT SUPPORTED"
2236 debug ("Enable PCMCIA buffers and stop RESET\n");
2237 reg = PCMCIA_PGCRX(slot);
2238 reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
2239 reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
2240 PCMCIA_PGCRX(slot) = reg;
2243 debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
2251 /* -------------------------------------------------------------------- */
2252 /* End of Board Specific Stuff */
2253 /* -------------------------------------------------------------------- */
2256 /* -------------------------------------------------------------------- */
2257 /* MPC8xx Specific Stuff - should go to MPC8xx directory */
2258 /* -------------------------------------------------------------------- */
2261 * Search this table to see if the windowsize is
2265 #define M8XX_SIZES_NO 32
2267 static const u_int m8xx_size_to_gray[M8XX_SIZES_NO] =
2268 { 0x00000001, 0x00000002, 0x00000008, 0x00000004,
2269 0x00000080, 0x00000040, 0x00000010, 0x00000020,
2270 0x00008000, 0x00004000, 0x00001000, 0x00002000,
2271 0x00000100, 0x00000200, 0x00000800, 0x00000400,
2273 0x0fffffff, 0xffffffff, 0xffffffff, 0xffffffff,
2274 0x01000000, 0x02000000, 0xffffffff, 0x04000000,
2275 0x00010000, 0x00020000, 0x00080000, 0x00040000,
2276 0x00800000, 0x00400000, 0x00100000, 0x00200000 };
2279 /* -------------------------------------------------------------------- */
2281 #ifndef CONFIG_I82365
2283 static u_int m8xx_get_graycode(u_int size)
2287 for (k = 0; k < M8XX_SIZES_NO; k++) {
2288 if(m8xx_size_to_gray[k] == size)
2292 if((k == M8XX_SIZES_NO) || (m8xx_size_to_gray[k] == -1))
2298 #endif /* CONFIG_I82365 */
2300 /* -------------------------------------------------------------------- */
2303 static u_int m8xx_get_speed(u_int ns, u_int is_io)
2305 u_int reg, clocks, psst, psl, psht;
2310 * We get called with IO maps setup to 0ns
2311 * if not specified by the user.
2312 * They should be 255ns.
2318 ns = 100; /* fast memory if 0 */
2322 * In PSST, PSL, PSHT fields we tell the controller
2323 * timing parameters in CLKOUT clock cycles.
2324 * CLKOUT is the same as GCLK2_50.
2327 /* how we want to adjust the timing - in percent */
2329 #define ADJ 180 /* 80 % longer accesstime - to be sure */
2331 clocks = ((M8XX_BUSFREQ / 1000) * ns) / 1000;
2332 clocks = (clocks * ADJ) / (100*1000);
2334 if(clocks >= PCMCIA_BMT_LIMIT) {
2335 DEBUG(0, "Max access time limit reached\n");
2336 clocks = PCMCIA_BMT_LIMIT-1;
2339 psst = clocks / 7; /* setup time */
2340 psht = clocks / 7; /* hold time */
2341 psl = (clocks * 5) / 7; /* strobe length */
2343 psst += clocks - (psst + psht + psl);
2353 /* -------------------------------------------------------------------- */
2355 #ifdef CONFIG_IDE_8xx_PCCARD
2356 static void print_funcid (int func)
2360 case CISTPL_FUNCID_MULTI:
2361 puts (" Multi-Function");
2363 case CISTPL_FUNCID_MEMORY:
2366 case CISTPL_FUNCID_SERIAL:
2367 puts (" Serial Port");
2369 case CISTPL_FUNCID_PARALLEL:
2370 puts (" Parallel Port");
2372 case CISTPL_FUNCID_FIXED:
2373 puts (" Fixed Disk");
2375 case CISTPL_FUNCID_VIDEO:
2376 puts (" Video Adapter");
2378 case CISTPL_FUNCID_NETWORK:
2379 puts (" Network Adapter");
2381 case CISTPL_FUNCID_AIMS:
2382 puts (" AIMS Card");
2384 case CISTPL_FUNCID_SCSI:
2385 puts (" SCSI Adapter");
2393 #endif /* CONFIG_IDE_8xx_PCCARD */
2395 /* -------------------------------------------------------------------- */
2397 #ifdef CONFIG_IDE_8xx_PCCARD
2398 static void print_fixed (volatile uchar *p)
2406 case CISTPL_FUNCE_IDE_IFACE:
2407 { uchar iface = *(p+2);
2409 puts ((iface == CISTPL_IDE_INTERFACE) ? " IDE" : " unknown");
2410 puts (" interface ");
2413 case CISTPL_FUNCE_IDE_MASTER:
2414 case CISTPL_FUNCE_IDE_SLAVE:
2415 { uchar f1 = *(p+2);
2418 puts ((f1 & CISTPL_IDE_SILICON) ? " [silicon]" : " [rotating]");
2420 if (f1 & CISTPL_IDE_UNIQUE)
2423 puts ((f1 & CISTPL_IDE_DUAL) ? " [dual]" : " [single]");
2425 if (f2 & CISTPL_IDE_HAS_SLEEP)
2428 if (f2 & CISTPL_IDE_HAS_STANDBY)
2429 puts (" [standby]");
2431 if (f2 & CISTPL_IDE_HAS_IDLE)
2434 if (f2 & CISTPL_IDE_LOW_POWER)
2435 puts (" [low power]");
2437 if (f2 & CISTPL_IDE_REG_INHIBIT)
2438 puts (" [reg inhibit]");
2440 if (f2 & CISTPL_IDE_HAS_INDEX)
2443 if (f2 & CISTPL_IDE_IOIS16)
2451 #endif /* CONFIG_IDE_8xx_PCCARD */
2453 /* -------------------------------------------------------------------- */
2455 #ifdef CONFIG_IDE_8xx_PCCARD
2457 #define MAX_IDENT_CHARS 64
2458 #define MAX_IDENT_FIELDS 4
2460 static uchar *known_cards[] = {
2465 static int identify (volatile uchar *p)
2467 uchar id_str[MAX_IDENT_CHARS];
2474 return (0); /* Don't know */
2479 for (i=0; i<=4 && !done; ++i, p+=2) {
2480 while ((data = *p) != '\0') {
2486 if (t == &id_str[MAX_IDENT_CHARS-1]) {
2496 while (--t > id_str) {
2505 for (card=known_cards; *card; ++card) {
2506 debug ("## Compare against \"%s\"\n", *card);
2507 if (strcmp(*card, id_str) == 0) { /* found! */
2508 debug ("## CARD FOUND ##\n");
2513 return (0); /* don't know */
2515 #endif /* CONFIG_IDE_8xx_PCCARD */
2517 /* -------------------------------------------------------------------- */
2519 #endif /* CFG_CMD_PCMCIA || (CFG_CMD_IDE && CONFIG_IDE_8xx_PCCARD) */
2521 /**************************************************/
2523 #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
2525 pinit, 2, 1, do_pinit,
2526 "pinit - PCMCIA sub-system\n",
2527 "on - power on PCMCIA socket\n"
2528 "pinit off - power off PCMCIA socket\n"