iio: hid_sensor_hub: Common PM functions
[linux/fpc-iii.git] / arch / frv / mm / cache-page.c
blob8e09dae0ec3f28c4d25666e34e8c4d613e486900
1 /* cache-page.c: whole-page cache wrangling functions for MMU linux
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
11 #include <linux/sched.h>
12 #include <linux/mm.h>
13 #include <linux/highmem.h>
14 #include <linux/module.h>
15 #include <asm/pgalloc.h>
17 /*****************************************************************************/
19 * DCF takes a virtual address and the page may not currently have one
20 * - temporarily hijack a kmap_atomic() slot and attach the page to it
22 void flush_dcache_page(struct page *page)
24 unsigned long dampr2;
25 void *vaddr;
27 dampr2 = __get_DAMPR(2);
29 vaddr = kmap_atomic_primary(page);
31 frv_dcache_writeback((unsigned long) vaddr, (unsigned long) vaddr + PAGE_SIZE);
33 kunmap_atomic_primary(vaddr);
35 if (dampr2) {
36 __set_DAMPR(2, dampr2);
37 __set_IAMPR(2, dampr2);
40 } /* end flush_dcache_page() */
42 EXPORT_SYMBOL(flush_dcache_page);
44 /*****************************************************************************/
46 * ICI takes a virtual address and the page may not currently have one
47 * - so we temporarily attach the page to a bit of virtual space so that is can be flushed
49 void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
50 unsigned long start, unsigned long len)
52 unsigned long dampr2;
53 void *vaddr;
55 dampr2 = __get_DAMPR(2);
57 vaddr = kmap_atomic_primary(page);
59 start = (start & ~PAGE_MASK) | (unsigned long) vaddr;
60 frv_cache_wback_inv(start, start + len);
62 kunmap_atomic_primary(vaddr);
64 if (dampr2) {
65 __set_DAMPR(2, dampr2);
66 __set_IAMPR(2, dampr2);
69 } /* end flush_icache_user_range() */
71 EXPORT_SYMBOL(flush_icache_user_range);