From: Hirokazu Takata This patch updates include/asm-m32r/pgtable.h to add pgprot_noncached(). It is required to fix a problem of an userspace application, which mmaps io registers. This patch also modifies drivers/video/fbmem.c to support noncachable framebuffer access for m32r. In this routine, pgprot_writecombine() is used hopefully, even though the current m32r never does write-combining or write-coalescing... Please apply this. * include/asm-m32r/pgtable.h (pgprot_noncached, pgprot_writecombine): Newly added. * drivers/video/fbmem.c (fb_mmap): Add m32r support. Signed-off-by: Mamoru Sakugawa Signed-off-by: Hirokazu Takata Signed-off-by: Andrew Morton --- 25-akpm/drivers/video/fbmem.c | 3 ++- 25-akpm/include/asm-m32r/pgtable.h | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff -puN drivers/video/fbmem.c~m32r-support-pgprot_noncached drivers/video/fbmem.c --- 25/drivers/video/fbmem.c~m32r-support-pgprot_noncached Thu Dec 16 15:18:27 2004 +++ 25-akpm/drivers/video/fbmem.c Thu Dec 16 15:18:27 2004 @@ -938,7 +938,8 @@ fb_mmap(struct file *file, struct vm_are vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); #elif defined(__hppa__) pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE; -#elif defined(__ia64__) || defined(__arm__) || defined(__sh__) +#elif defined(__ia64__) || defined(__arm__) || defined(__sh__) || \ + defined(__m32r__) vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); #else #warning What do we have to do here?? diff -puN include/asm-m32r/pgtable.h~m32r-support-pgprot_noncached include/asm-m32r/pgtable.h --- 25/include/asm-m32r/pgtable.h~m32r-support-pgprot_noncached Thu Dec 16 15:18:27 2004 +++ 25-akpm/include/asm-m32r/pgtable.h Thu Dec 16 15:18:27 2004 @@ -341,6 +341,19 @@ static __inline__ void ptep_mkdirty(pte_ } /* + * Macro and implementation to make a page protection as uncachable. + */ +static __inline__ pgprot_t pgprot_noncached(pgprot_t _prot) +{ + unsigned long prot = pgprot_val(_prot); + + prot |= _PAGE_NONCACHABLE; + return __pgprot(prot); +} + +#define pgprot_writecombine(prot) pgprot_noncached(prot) + +/* * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ _