int __init cf_init(void) { pgprot_t prot; unsigned long paddrbase, psize; /* open I/O area window */ paddrbase = virt_to_phys((void *)(PA_AREA5_IO+0x00000800)); psize = PAGE_SIZE; prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_COM16); area5_io_base = p3_ioremap(paddrbase, psize, prot.pgprot); if (!area5_io_base) { printk("allocate_cf_area : can't open CF I/O window!\n"); return -ENOMEM; } /* XXX : do we need attribute and common-memory area also? */ paddrbase = virt_to_phys((void *)PA_AREA6_IO); psize = PAGE_SIZE; prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_COM16); area6_io_base = p3_ioremap(paddrbase, psize, prot.pgprot); if (!area6_io_base) { printk("allocate_cf_area : can't open Extention Bus window!\n"); return -ENOMEM; } return 0; }
static int __init landisk_cf_init(void) { pgprot_t prot; unsigned long paddrbase, psize; /* open I/O area window */ paddrbase = virt_to_phys((void *)PA_AREA5_IO); psize = PAGE_SIZE; prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16); area5_io_base = p3_ioremap(paddrbase, psize, prot.pgprot); if (!area5_io_base) { printk("allocate_cf_area : can't open CF I/O window!\n"); return -ENOMEM; } paddrbase = virt_to_phys((void *)PA_AREA6_IO); psize = PAGE_SIZE; prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO16); area6_io_base = p3_ioremap(paddrbase, psize, prot.pgprot); if (!area6_io_base) { printk("allocate_cf_area : can't open HDD I/O window!\n"); return -ENOMEM; } printk(KERN_INFO "Allocate Area5/6 success.\n"); /* XXX : do we need attribute and common-memory area also? */ return 0; }
static int __init lboxre2_devices_setup(void) { u32 cf0_io_base; /* Boot CF base address */ pgprot_t prot; unsigned long paddrbase, psize; /* open I/O area window */ paddrbase = virt_to_phys((void*)PA_AREA5_IO); psize = PAGE_SIZE; prot = PAGE_KERNEL_PCC( 1 , _PAGE_PCC_IO16); cf0_io_base = (u32)p3_ioremap(paddrbase, psize, prot.pgprot); if (!cf0_io_base) { printk(KERN_ERR "%s : can't open CF I/O window!\n" , __func__ ); return -ENOMEM; } cf_ide_resources[0].start += cf0_io_base ; cf_ide_resources[0].end += cf0_io_base ; cf_ide_resources[1].start += cf0_io_base ; cf_ide_resources[1].end += cf0_io_base ; return platform_add_devices(lboxre2_devices, ARRAY_SIZE(lboxre2_devices)); }
static int __init landisk_devices_setup(void) { pgprot_t prot; unsigned long paddrbase; void *cf_ide_base; /* open I/O area window */ paddrbase = virt_to_phys((void *)PA_AREA5_IO); prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16); cf_ide_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot); if (!cf_ide_base) { printk("allocate_cf_area : can't open CF I/O window!\n"); return -ENOMEM; } /* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */ cf_ide_resources[0].start = (unsigned long)cf_ide_base + 0x40; cf_ide_resources[0].end = (unsigned long)cf_ide_base + 0x40 + 0x0f; cf_ide_resources[0].flags = IORESOURCE_IO; cf_ide_resources[1].start = (unsigned long)cf_ide_base + 0x2c; cf_ide_resources[1].end = (unsigned long)cf_ide_base + 0x2c + 0x03; cf_ide_resources[1].flags = IORESOURCE_IO; cf_ide_resources[2].start = IRQ_FATA; cf_ide_resources[2].flags = IORESOURCE_IRQ; return platform_add_devices(landisk_devices, ARRAY_SIZE(landisk_devices)); }
int __init cf_init(void) { pgprot_t prot; unsigned long paddrbase, psize; /* open I/O area window */ paddrbase = virt_to_phys((void *)(PA_AREA5_IO+0x00000800)); psize = PAGE_SIZE; prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_COM16); area5_io16_base = p3_ioremap(paddrbase, psize, prot.pgprot); if (!area5_io16_base) { printk("allocate_cf_area : can't open CF I/O window!\n"); return -ENOMEM; } /* XXX : do we need attribute and common-memory area also? */ paddrbase = virt_to_phys((void *)PA_AREA6_IO); psize = PAGE_SIZE; #if defined(CONFIG_HS7751RVOIP_CODEC) prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_COM8); #else prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO8); #endif area6_io8_base = p3_ioremap(paddrbase, psize, prot.pgprot); if (!area6_io8_base) { printk("allocate_cf_area : can't open CODEC I/O 8bit window!\n"); return -ENOMEM; } prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO16); area6_io16_base = p3_ioremap(paddrbase, psize, prot.pgprot); if (!area6_io16_base) { printk("allocate_cf_area : can't open CODEC I/O 16bit window!\n"); return -ENOMEM; } return 0; }
static int __init allocate_cf_area(void) { pgprot_t prot; unsigned long paddrbase, psize; /* open I/O area window */ paddrbase = virt_to_phys((void*)CONFIG_CF_BASE_ADDR); psize = PAGE_SIZE; prot = PAGE_KERNEL_PCC(slot_no, _PAGE_PCC_IO16); cf_io_base = p3_ioremap(paddrbase, psize, prot.pgprot); if (!cf_io_base) { printk("allocate_cf_area : can't open CF I/O window!\n"); return -ENOMEM; } /* printk("p3_ioremap(paddr=0x%08lx, psize=0x%08lx, prot=0x%08lx)=0x%08lx\n", paddrbase, psize, prot.pgprot, cf_io_base);*/ /* XXX : do we need attribute and common-memory area also? */ return 0; }
static int __init sh03_devices_setup(void) { pgprot_t prot; unsigned long paddrbase; void *cf_ide_base; /* open I/O area window */ paddrbase = virt_to_phys((void *)PA_AREA5_IO); prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16); cf_ide_base = ioremap_prot(paddrbase, PAGE_SIZE, pgprot_val(prot)); if (!cf_ide_base) { printk("allocate_cf_area : can't open CF I/O window!\n"); return -ENOMEM; } /* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */ cf_ide_resources[0].start += (unsigned long)cf_ide_base; cf_ide_resources[0].end += (unsigned long)cf_ide_base; cf_ide_resources[1].start += (unsigned long)cf_ide_base; cf_ide_resources[1].end += (unsigned long)cf_ide_base; return platform_add_devices(sh03_devices, ARRAY_SIZE(sh03_devices)); }
static int hs_set_io_map(unsigned int sock, struct pccard_io_map *io) { hs_socket_t *sp = &hs_sockets[sock]; int map = io->map; struct pccard_io_map *sio; pgprot_t prot; DPRINTK("hs_set_io_map(sock=%d, map=%d, flags=0x%x, speed=%dns, start=0x%04x, stop=0x%04x)\n", sock, map, io->flags, io->speed, io->start, io->stop); if (map >= MAX_IO_WIN) return -EINVAL; sio = &sp->io_maps[map]; /* check for null changes */ if (io->flags == sio->flags && io->start == sio->start && io->stop == sio->stop) return 0; if (io->flags & MAP_AUTOSZ) prot = PAGE_KERNEL_PCC(sock, _PAGE_PCC_IODYN); else if (io->flags & MAP_16BIT) prot = PAGE_KERNEL_PCC(sock, _PAGE_PCC_IO16); else prot = PAGE_KERNEL_PCC(sock, _PAGE_PCC_IO8); /* TODO: handle MAP_USE_WAIT */ if (io->flags & MAP_USE_WAIT) printk(KERN_INFO MODNAME ": MAP_USE_WAIT unimplemented\n"); /* TODO: handle MAP_PREFETCH */ if (io->flags & MAP_PREFETCH) printk(KERN_INFO MODNAME ": MAP_PREFETCH unimplemented\n"); /* TODO: handle MAP_WRPROT */ if (io->flags & MAP_WRPROT) printk(KERN_INFO MODNAME ": MAP_WRPROT unimplemented\n"); /* TODO: handle MAP_0WS */ if (io->flags & MAP_0WS) printk(KERN_INFO MODNAME ": MAP_0WS unimplemented\n"); if (io->flags & MAP_ACTIVE) { unsigned long pstart, psize, paddrbase, vaddrbase; paddrbase = virt_to_phys((void*)(sp->mem_base + 2 * HD64465_PCC_WINDOW)); #ifndef CONFIG_SH_KEYWEST vaddrbase = (unsigned long)sp->io_vma->addr; pstart = io->start & PAGE_MASK; psize = ((io->stop + PAGE_SIZE) & PAGE_MASK) - pstart; /* * Change PTEs in only that portion of the mapping requested * by the caller. This means that most of the time, most of * the PTEs in the io_vma will be unmapped and only the bottom * page will be mapped. But the code allows for weird cards * that might want IO ports > 4K. */ DPRINTK("remap_page_range(vaddr=0x%08lx, paddr=0x%08lx, size=0x%08lxx)\n", vaddrbase + pstart, paddrbase + pstart, psize); remap_page_range(vaddrbase + pstart, paddrbase + pstart, psize, prot); #else vaddrbase = paddrbase | 0xa0000000; #endif /* * Change the mapping used by inb() outb() etc */ mach_port_map(io->start, io->stop - io->start + 1, vaddrbase + io->start, 0); } else { mach_port_unmap(sio->start, sio->stop - sio->start + 1); /* TODO: remap_page_range() to mark pages not present ? */ } *sio = *io; return 0; }