/* * (C) Copyright 2000-2002 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * (C) Copyright 2002 * Daniel Engström, Omicron Ceti AB * * SPDX-License-Identifier: GPL-2.0+ * ******************************************************************** * * Lots of code copied from: * * m8xx_pcmcia.c - Linux PCMCIA socket driver for the mpc8xx series. * (C) 1999-2000 Magnus Damm * * "The ExCA standard specifies that socket controllers should provide * two IO and five memory windows per socket, which can be independently * configured and positioned in the host address space and mapped to * arbitrary segments of card address space. " - David A Hinds. 1999 * * This controller does _not_ meet the ExCA standard. * * m8xx pcmcia controller brief info: * + 8 windows (attrib, mem, i/o) * + up to two slots (SLOT_A and SLOT_B) * + inputpins, outputpins, event and mask registers. * - no offset register. sigh. * * Because of the lacking offset register we must map the whole card. * We assign each memory window PCMCIA_MEM_WIN_SIZE address space. * Make sure there is (PCMCIA_MEM_WIN_SIZE * PCMCIA_MEM_WIN_NO * * PCMCIA_SOCKETS_NO) bytes at PCMCIA_MEM_WIN_BASE. * The i/o windows are dynamically allocated at PCMCIA_IO_WIN_BASE. * They are maximum 64KByte each... */ #undef DEBUG /**/ /* * PCMCIA support */ #include #include #include #include #include #include #if defined(CONFIG_CMD_PCMCIA) int pcmcia_on(int ide_base_bus); static int hardware_disable(int slot); static int hardware_enable(int slot); static int voltage_set(int slot, int vcc, int vpp); static void print_funcid(int func); static void print_fixed(volatile char *p); static int identify(volatile char *p); static int check_ide_device(int slot, int ide_base_bus); /* ------------------------------------------------------------------------- */ const char *indent = "\t "; /* ------------------------------------------------------------------------- */ static struct pci_device_id supported[] = { { PCI_VENDOR_ID_TI, 0xac50 }, /* Ti PCI1410A */ { PCI_VENDOR_ID_TI, 0xac56 }, /* Ti PCI1510 */ { } }; static pci_dev_t devbusfn; static u32 socket_base; static u32 pcmcia_cis_ptr; 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 = CONFIG_SYS_PCMCIA_CIS_WIN; cis_len = CONFIG_SYS_PCMCIA_CIS_WIN_SIZE; io_base = CONFIG_SYS_PCMCIA_IO_WIN; io_len = CONFIG_SYS_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
#include "../lib/libfdt/fdt_rw.c"