static int h3600_dual_sleeve_pcmcia_shutdown( void ) { __iounmap(dual_pcmcia_sleeve[0]); __iounmap(dual_pcmcia_sleeve[1]); return sa1100_h3600_common_pcmcia_shutdown(); }
void tegra_iounmap(volatile void __iomem *addr) { unsigned long virt = (unsigned long)addr; if (virt >= VMALLOC_START && virt < VMALLOC_END) __iounmap(addr); }
void iounmap(volatile void __iomem *token) { if (ppc_md.iounmap) ppc_md.iounmap(token); else __iounmap(token); }
void __iop13xx_iounmap(void __iomem *addr) { extern void __iounmap(volatile void __iomem *addr); if (iop13xx_atue_mem_base) if (addr >= (void __iomem *) iop13xx_atue_mem_base && addr < (void __iomem *) (iop13xx_atue_mem_base + iop13xx_atue_mem_size)) goto skip; if (iop13xx_atux_mem_base) if (addr >= (void __iomem *) iop13xx_atux_mem_base && addr < (void __iomem *) (iop13xx_atux_mem_base + iop13xx_atux_mem_size)) goto skip; switch ((u32) addr) { case IOP13XX_PCIE_LOWER_IO_VA ... IOP13XX_PCIE_UPPER_IO_VA: case IOP13XX_PCIX_LOWER_IO_VA ... IOP13XX_PCIX_UPPER_IO_VA: case IOP13XX_PMMR_VIRT_MEM_BASE ... IOP13XX_PMMR_UPPER_MEM_VA: goto skip; } __iounmap(addr); skip: return; }
// return IRQ if found, or 0 otherwise int detect_rf2(int iobase) { volatile unsigned char *sh; int irq=0; sh = ((volatile unsigned char *) __ioremap(0xEE000000, 4096,0)); if (sh == (volatile unsigned char *)0xEE000000) { printk(KERN_ERR "ide-tsrf2: cannot map 0xEE000000\n"); return 0; } sh += iobase; if (sh[0] == 0x8e) { // found board printk("TS-RF2 detected at I/O address 0x%X, ",iobase); sh[2] = 0xE9; // make sure unused UART is off if (sh[1] & (1 << 6)) { printk("IRQ 6\n"); irq = 64+6; } else if (sh[1] & (1 << 7)) { printk("IRQ 7\n"); irq = 64+7; } else { printk("NO IRQ (ignoring!)\n"); } } __iounmap(sh); return irq; }
// mask off bits 0xFC000 in register 0xE8000038 // this sets C14-C19 on the PC104 bus to GPIO, which is needed for // UART #8 and UART #9 signals to appear on the header. int semioff104(void) { volatile unsigned long *tmp; tmp = ((unsigned long *) __ioremap(0xE8000000, 4096,0)); if (tmp == (unsigned long *)0xE8000000) { printk(KERN_ERR "tsuart1: cannot map 0xE8000000\n"); return 0; } if (tmp[0x38/4] & 0xFC000) { // already set to not GPIO; reject the change __iounmap(tmp); return 0; } else { tmp[0x38/4] &= 0x03FFF; __iounmap(tmp); return 1; } }
static void off104(void) { volatile unsigned long *tmp; tmp = ((unsigned long *) __ioremap(0xE8000000, 4096,0)); if (tmp == (unsigned long *)0xE8000000) { printk(KERN_ERR "tsuart1: cannot map 0xE8000000\n"); return; } tmp[0x30/4] = saved_A; tmp[0x34/4] = saved_B; __iounmap(tmp); }
void __iop3xx_iounmap(void __iomem *addr) { extern void __iounmap(volatile void __iomem *addr); switch ((u32) addr) { case IOP3XX_PCI_LOWER_IO_VA ... IOP3XX_PCI_UPPER_IO_VA: case IOP3XX_PERIPHERAL_VIRT_BASE ... IOP3XX_PERIPHERAL_UPPER_VA: goto skip; } __iounmap(addr); skip: return; }
static inline void free_io_area(void *addr) { struct vm_struct **p, *tmp; if (!addr) return; addr = (void *)((unsigned long)addr & -IO_SIZE); for (p = &iolist ; (tmp = *p) ; p = &tmp->next) { if (tmp->addr == addr) { *p = tmp->next; __iounmap(tmp->addr, tmp->size); kfree(tmp); return; } } }
static void __exit pasemi_dma_cleanup_module(void) { pci_unregister_driver(&pasemi_dma_driver); __iounmap(dma_status); dma_status = NULL; }
static void ixp4xx_iounmap(void __iomem *addr) { if (!is_pci_memory((__force u32)addr)) __iounmap(addr); }
static int __init ixdp2000_ixasdk_init(void) { struct board_config *scratch; scratch = (struct board_config *)__ioremap(PHY_SCRATCH, sizeof(struct board_config), 0); if (!scratch) { printk("Failed to ioremap\n"); goto out; } if (scratch->config_valid != VALID_STRING ) { printk(KERN_WARNING"ixasdk.o: Invalid board config data\n"); printk(KERN_WARNING"ixasdk.o: Need to program I2C data for valid config data.\n"); } sz_info =(struct ixdp2000_sys_info *)kmalloc(sizeof(struct ixdp2000_sys_info), GFP_KERNEL); if (!sz_info) { printk(KERN_WARNING" Cannot allocate memory for struct ixdp2000_sys_info.\n"); return -ENOMEM; } memset(sz_info,0, sizeof(struct ixdp2000_sys_info)); if (scratch->config_valid == VALID_STRING) { sz_info->valid = 1; sz_info->sys_all = scratch->sdram_size; /* total system sdram */ sz_info->sdram = scratch->sdram_size - PHYS_SDRAM_SIZE;/* sdram for uEngines */ sz_info->sys = PHYS_SDRAM_SIZE; sz_info->sram = scratch->qdr_channel_size[0] + scratch->qdr_channel_size[1]; sz_info->sram0 = scratch->qdr_channel_size[0]; sz_info->sram1 = scratch->qdr_channel_size[1]; #if CONFIG_ARCH_IXDP2800 sz_info->sram2 = scratch->qdr_channel_size[2]; sz_info->sram2 = scratch->qdr_channel_size[3]; #endif sz_info->flash = scratch->flash_size; } else { /* take some default values */ sz_info->valid = 0; sz_info->sys_all = 0x20000000; /* total system sdram */ sz_info->sdram = 0x20000000 - PHYS_SDRAM_SIZE;/* sdram for uEngines */ sz_info->sys = PHYS_SDRAM_SIZE; sz_info->sram = 0x800000; sz_info->sram0 = 0x400000; sz_info->sram1 = 0x400000; #if CONFIG_ARCH_IXDP2800 sz_info->sram2 = 0x400000; sz_info->sram2 = 0x400000; #endif sz_info->flash = 0x1000000; } __iounmap(scratch); return 0; out: return -1; }
static int tryInitPort(int offset) { struct tsuart_port *ts; volatile unsigned long *tmp; volatile unsigned short *sh; tmp = ((unsigned long *) __ioremap(0xE8000000, 4096,0)); if (tmp == (unsigned long *)0xE8000000) { printk(KERN_ERR "tsuart1: cannot map 0xE8000000\n"); return -ENOMEM; } if ((*tmp & 0xFFFFFF00) != 0xB48000) { printk(KERN_ERR "TSUART1 magic: %lX\n",*tmp); return -1; } sh = (volatile unsigned short *)tmp; sh[122] = 5208; // 2400 sh[121] = 2604; // 4800 sh[120] = 1302; // 9600 sh[119] = 651; // 19200 sh[118] = 326; // 38400 sh[117] = 217; // 57600 sh[116] = 108; // 115200 __iounmap(tmp); ts = kmalloc(sizeof(struct tsuart_port),GFP_KERNEL); if (!ts) { printk("Unable to allocate memory for tsuart port\n"); return 0; } memset(ts,0,sizeof(struct tsuart_port)); init_tsuart_port(ts); ts->u.iotype = SERIAL_IO_MEM; ts->get = tsuartGetMEM16; ts->put = tsuartPutMEM16; ts->mdmctrl = 0; ts->debugFlags = portDebug; if (offset >= 10) { ts->u.mapbase = 0xE8000050 + 4 * (offset-10); ts->u.irq = 64 + 18 + offset; // to 64+10 } else { ts->u.mapbase = 0xE80000C0 + 4 * offset; ts->u.irq = 64 + 16 + offset; // to 64+25 } //ts->localStatus |= PORT_STATUS_SHIRQ; ts->boardId = BOARD_ID_7800; if (tsuart_register_port(0,ts) != 0) { printk("Failed to register port!\n"); return 0; } old_shutdown = ts->u.ops->shutdown; tsuart_ops_7800 = *(ts->u.ops); tsuart_ops_7800.shutdown = shutdown_7800; ts->u.ops = &tsuart_ops_7800; ts = kmalloc(sizeof(struct tsuart_port),GFP_KERNEL); if (!ts) { printk("Unable to allocate memory for tsuart nine-bit port\n"); return 0; } memset(ts,0,sizeof(struct tsuart_port)); init_tsuart_port(ts); ts->u.iotype = SERIAL_IO_MEM; ts->get = tsuartGetMEM16_9; ts->put = tsuartPutMEM16_9; ts->mdmctrl = 0; ts->debugFlags = portDebug; ts->pstatus |= PORT_STATUS_TXMSB; ts->rxsize = 2; if (offset >= 10) { ts->u.mapbase = 0xE8000050 + 4 * (offset-10); ts->u.irq = 64 + 18 + offset; // to 64+28 } else { ts->u.mapbase = 0xE80000C0 + 4 * offset; ts->u.irq = 64 + 16 + offset; // to 64+25 } //ts->localStatus |= PORT_STATUS_SHIRQ; ts->boardId = BOARD_ID_7800; if (tsuart_register_port(dr9,ts) != 0) { printk("Failed to register 9-bit port!\n"); return 0; } return 1; }