int pcmcia_on (void) { PCMCIA_DEBUG ("Enable PCMCIA " PCMCIA_SLOT_MSG "\n"); /* turn off voltage */ if (voltage_set(_slot_, 0, 0)) return (1); /* Enable external hardware */ if (hardware_enable(_slot_)) return (1); #ifdef CONFIG_IDE_PCCARD if (check_ide_device()) return (1); #endif return (0); }
int pcmcia_on (void) { u_long reg, base; pcmcia_win_t *win; u_int slotbit; u_int rc, slot; int i; debug ("Enable PCMCIA " PCMCIA_SLOT_MSG "\n"); /* intialize the fixed memory windows */ win = (pcmcia_win_t *)(&((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pbr0); base = CFG_PCMCIA_MEM_ADDR; if((reg = m8xx_get_graycode(CFG_PCMCIA_MEM_SIZE)) == -1) { printf ("Cannot set window size to 0x%08x\n", CFG_PCMCIA_MEM_SIZE); return (1); } slotbit = PCMCIA_SLOT_x; for (i=0; i<PCMCIA_MEM_WIN_NO; ++i) { win->br = base; #if (PCMCIA_SOCKETS_NO == 2) if (i == 4) /* Another slot starting from win 4 */ slotbit = (slotbit ? PCMCIA_PSLOT_A : PCMCIA_PSLOT_B); #endif switch (i) { #ifdef CONFIG_IDE_8xx_PCCARD case 4: #ifdef CONFIG_HMI10 { /* map FRAM area */ win->or = ( PCMCIA_BSIZE_256K | PCMCIA_PPS_8 | PCMCIA_PRS_ATTR | slotbit | PCMCIA_PV | HMI10_FRAM_TIMING ); break; } #endif case 0: { /* map attribute memory */ win->or = ( PCMCIA_BSIZE_64M | PCMCIA_PPS_8 | PCMCIA_PRS_ATTR | slotbit | PCMCIA_PV | CFG_PCMCIA_TIMING ); break; } case 5: case 1: { /* map I/O window for data reg */ win->or = ( PCMCIA_BSIZE_1K | PCMCIA_PPS_16 | PCMCIA_PRS_IO | slotbit | PCMCIA_PV | CFG_PCMCIA_TIMING ); break; } case 6: case 2: { /* map I/O window for cmd/ctrl reg block */ win->or = ( PCMCIA_BSIZE_1K | PCMCIA_PPS_8 | PCMCIA_PRS_IO | slotbit | PCMCIA_PV | CFG_PCMCIA_TIMING ); break; } #endif /* CONFIG_IDE_8xx_PCCARD */ #ifdef CONFIG_HMI10 case 3: { /* map I/O window for 4xUART data/ctrl */ win->br += 0x40000; win->or = ( PCMCIA_BSIZE_256K | PCMCIA_PPS_8 | PCMCIA_PRS_IO | slotbit | PCMCIA_PV | CFG_PCMCIA_TIMING ); break; } #endif /* CONFIG_HMI10 */ default: /* set to not valid */ win->or = 0; break; } debug ("MemWin %d: PBR 0x%08lX POR %08lX\n", i, win->br, win->or); base += CFG_PCMCIA_MEM_SIZE; ++win; } for (i=0, rc=0, slot=_slot_; i<PCMCIA_SOCKETS_NO; i++, slot = !slot) { /* turn off voltage */ if ((rc = pcmcia_voltage_set(slot, 0, 0))) continue; /* Enable external hardware */ if ((rc = pcmcia_hardware_enable(slot))) continue; #ifdef CONFIG_IDE_8xx_PCCARD if ((rc = check_ide_device(i))) continue; #endif } return rc; }
int pcmcia_on(int ide_base_bus) { u16 dev_id; u32 socket_status; int slot = 0; int cis_len; u16 io_base; u16 io_len; /* * Find the CardBus PCI device(s). */ if ((devbusfn = pci_find_devices(supported, 0)) < 0) { printf("Ti CardBus: not found\n"); return 1; } pci_read_config_word(devbusfn, PCI_DEVICE_ID, &dev_id); if (dev_id == 0xac56) { debug("Enable PCMCIA Ti PCI1510\n"); } else { debug("Enable PCMCIA Ti PCI1410A\n"); } pcmcia_cis_ptr = CFG_PCMCIA_CIS_WIN; cis_len = CFG_PCMCIA_CIS_WIN_SIZE; io_base = CFG_PCMCIA_IO_WIN; io_len = CFG_PCMCIA_IO_WIN_SIZE; /* * Setup the PCI device. */ pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_0, &socket_base); socket_base &= ~0xf; socket_status = readl(socket_base+8); if ((socket_status & 6) == 0) { printf("Card Present: "); switch (socket_status & 0x3c00) { case 0x400: printf("5V "); break; case 0x800: printf("3.3V "); break; case 0xc00: printf("3.3/5V "); break; default: printf("unsupported Vcc "); break; } switch (socket_status & 0x30) { case 0x10: printf("16bit PC-Card\n"); break; case 0x20: printf("32bit CardBus Card\n"); break; default: printf("8bit PC-Card\n"); break; } } writeb(0x41, socket_base + 0x806); /* Enable I/O window 0 and memory window 0 */ writeb(0x0e, socket_base + 0x807); /* Reset I/O window options */ /* Careful: the linux yenta driver do not seem to reset the offset * in the i/o windows, so leaving them non-zero is a problem */ writeb(io_base & 0xff, socket_base + 0x808); /* I/O window 0 base address */ writeb(io_base>>8, socket_base + 0x809); writeb((io_base + io_len - 1) & 0xff, socket_base + 0x80a); /* I/O window 0 end address */ writeb((io_base + io_len - 1)>>8, socket_base + 0x80b); writeb(0x00, socket_base + 0x836); /* I/O window 0 offset address 0x000 */ writeb(0x00, socket_base + 0x837); writeb((pcmcia_cis_ptr&0x000ff000) >> 12, socket_base + 0x810); /* Memory window 0 start address bits 19-12 */ writeb((pcmcia_cis_ptr&0x00f00000) >> 20, socket_base + 0x811); /* Memory window 0 start address bits 23-20 */ writeb(((pcmcia_cis_ptr+cis_len-1) & 0x000ff000) >> 12, socket_base + 0x812); /* Memory window 0 end address bits 19-12*/ writeb(((pcmcia_cis_ptr+cis_len-1) & 0x00f00000) >> 20, socket_base + 0x813); /* Memory window 0 end address bits 23-20*/ writeb(0x00, socket_base + 0x814); /* Memory window 0 offset bits 19-12 */ writeb(0x40, socket_base + 0x815); /* Memory window 0 offset bits 23-20 and * options (read/write, attribute access) */ writeb(0x00, socket_base + 0x816); /* ExCA card-detect and general control */ writeb(0x00, socket_base + 0x81e); /* ExCA global control (interrupt modes) */ writeb((pcmcia_cis_ptr & 0xff000000) >> 24, socket_base + 0x840); /* Memory window address bits 31-24 */ /* turn off voltage */ if (voltage_set(slot, 0, 0)) { return 1; } /* Enable external hardware */ if (hardware_enable(slot)) { return 1; } if (check_ide_device(slot, ide_base_bus)) { return 1; } return 0; }
int pcmcia_on (void) { unsigned int reg_arr[] = { 0x48000028, CFG_MCMEM0_VAL, 0x4800002c, CFG_MCMEM1_VAL, 0x48000030, CFG_MCATT0_VAL, 0x48000034, CFG_MCATT1_VAL, 0x48000038, CFG_MCIO0_VAL, 0x4800003c, CFG_MCIO1_VAL, 0, 0 }; int i, rc; #ifdef CONFIG_EXADRON1 int cardDetect; volatile unsigned int *v_pBCRReg = (volatile unsigned int *) 0x08000000; #endif debug ("%s\n", __FUNCTION__); i = 0; while (reg_arr[i]) { (*(volatile unsigned int *) reg_arr[i]) |= reg_arr[i + 1]; i += 2; } udelay (1000); debug ("%s: programmed mem controller \n", __FUNCTION__); #ifdef CONFIG_EXADRON1 /*define useful BCR masks */ #define BCR_CF_INIT_VAL 0x00007230 #define BCR_CF_PWRON_BUSOFF_RESETOFF_VAL 0x00007231 #define BCR_CF_PWRON_BUSOFF_RESETON_VAL 0x00007233 #define BCR_CF_PWRON_BUSON_RESETON_VAL 0x00007213 #define BCR_CF_PWRON_BUSON_RESETOFF_VAL 0x00007211 /* we see from the GPIO bit if the card is present */ cardDetect = !(GPLR0 & GPIO_bit (14)); if (cardDetect) { printf ("No PCMCIA card found!\n"); } /* reset the card via the BCR line */ *v_pBCRReg = (unsigned) BCR_CF_INIT_VAL; msWait (500); *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSOFF_RESETOFF_VAL; msWait (500); *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSOFF_RESETON_VAL; msWait (500); *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSON_RESETON_VAL; msWait (500); *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSON_RESETOFF_VAL; msWait (1500); /* enable address bus */ GPCR1 = 0x01; /* and the first CF slot */ MECR = 0x00000002; #endif /* EXADRON 1 */ rc = check_ide_device (0); /* use just slot 0 */ return rc; }