aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@linux-m68k.org>2018-04-05 09:55:11 -0400
committerGreg Ungerer <gerg@linux-m68k.org>2018-05-27 19:45:27 -0400
commitbe39cbcbd6cc94ed0e6daf3637cc092641254cf3 (patch)
tree95b17fb51ea556553e6a5ae2f37952851f839191
parent4d53037876277fbba10f47de7b90d3a873c5d12b (diff)
m68k: fix ioremapping for internal ColdFire peripherals
The ColdFire SoC internal peripherals are mapped into virtual address space using the ACR registers of the cache control unit. This means we are using a 1:1 physical:virtual mapping for them that does not rely on page table mappings. We can quickly determine if we are accessing an internal peripheral device given the physical or vitrual address using the same range check. The implications of this mapping is that an ioremap should return the physical address as the virtual mapping __iomem cookie as well. So fix ioremap() to deal with this on ColdFire. Of course you need to take care of this in the iounmap() path as well. Reported-by: Angelo Dureghello <angelo@sysam.it> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org> Reviewed-by: Angelo Dureghello <angelo@sysam.it> Tested-by: Angelo Dureghello <angelo@sysam.it>
-rw-r--r--arch/m68k/mm/kmap.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/m68k/mm/kmap.c b/arch/m68k/mm/kmap.c
index c2a38321c96d..411a308a8ac1 100644
--- a/arch/m68k/mm/kmap.c
+++ b/arch/m68k/mm/kmap.c
@@ -125,6 +125,10 @@ void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cachefla
125 return (void __iomem *)physaddr; 125 return (void __iomem *)physaddr;
126 } 126 }
127#endif 127#endif
128#ifdef CONFIG_COLDFIRE
129 if (__cf_internalio(physaddr))
130 return (void __iomem *) physaddr;
131#endif
128 132
129#ifdef DEBUG 133#ifdef DEBUG
130 printk("ioremap: 0x%lx,0x%lx(%d) - ", physaddr, size, cacheflag); 134 printk("ioremap: 0x%lx,0x%lx(%d) - ", physaddr, size, cacheflag);
@@ -235,6 +239,10 @@ void iounmap(void __iomem *addr)
235 ((unsigned long)addr > 0x60000000))) 239 ((unsigned long)addr > 0x60000000)))
236 free_io_area((__force void *)addr); 240 free_io_area((__force void *)addr);
237#else 241#else
242#ifdef CONFIG_COLDFIRE
243 if (cf_internalio(addr))
244 return;
245#endif
238 free_io_area((__force void *)addr); 246 free_io_area((__force void *)addr);
239#endif 247#endif
240} 248}