forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'xtensa-for-next-20160111' of git://github.com/jcmvbkbc/lin…
…ux-xtensa Xtensa improvements for 4.5: - control whether perf IRQ is treated as NMI from Kconfig; - implement ioremap for regions outside KIO segment.
- Loading branch information
Showing
7 changed files
with
133 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* ioremap implementation. | ||
* | ||
* Copyright (C) 2015 Cadence Design Systems Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
*/ | ||
|
||
#include <linux/io.h> | ||
#include <linux/vmalloc.h> | ||
#include <asm/cacheflush.h> | ||
#include <asm/io.h> | ||
#include <asm/pgtable.h> | ||
|
||
static void __iomem *xtensa_ioremap(unsigned long paddr, unsigned long size, | ||
pgprot_t prot) | ||
{ | ||
unsigned long offset = paddr & ~PAGE_MASK; | ||
unsigned long pfn = __phys_to_pfn(paddr); | ||
struct vm_struct *area; | ||
unsigned long vaddr; | ||
int err; | ||
|
||
paddr &= PAGE_MASK; | ||
|
||
WARN_ON(pfn_valid(pfn)); | ||
|
||
size = PAGE_ALIGN(offset + size); | ||
|
||
area = get_vm_area(size, VM_IOREMAP); | ||
if (!area) | ||
return NULL; | ||
|
||
vaddr = (unsigned long)area->addr; | ||
area->phys_addr = paddr; | ||
|
||
err = ioremap_page_range(vaddr, vaddr + size, paddr, prot); | ||
|
||
if (err) { | ||
vunmap((void *)vaddr); | ||
return NULL; | ||
} | ||
|
||
flush_cache_vmap(vaddr, vaddr + size); | ||
return (void __iomem *)(offset + vaddr); | ||
} | ||
|
||
void __iomem *xtensa_ioremap_nocache(unsigned long addr, unsigned long size) | ||
{ | ||
return xtensa_ioremap(addr, size, pgprot_noncached(PAGE_KERNEL)); | ||
} | ||
EXPORT_SYMBOL(xtensa_ioremap_nocache); | ||
|
||
void __iomem *xtensa_ioremap_cache(unsigned long addr, unsigned long size) | ||
{ | ||
return xtensa_ioremap(addr, size, PAGE_KERNEL); | ||
} | ||
EXPORT_SYMBOL(xtensa_ioremap_cache); | ||
|
||
void xtensa_iounmap(volatile void __iomem *io_addr) | ||
{ | ||
void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr); | ||
|
||
vunmap(addr); | ||
} | ||
EXPORT_SYMBOL(xtensa_iounmap); |