mirror of
				https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
				synced 2025-10-31 22:26:12 +00:00 
			
		
		
		
	 2f47f44790
			
		
	
	
		2f47f44790
		
	
	
	
	
		
			
			This provides a method for supporting fixed PMB mappings inherited from the bootloader, as an alternative to the dynamic PMB mapping currently used by the kernel. In the future these methods will be combined. P1/P2 area is handled like a regular 29-bit physical address, and local bus device are assigned P3 area addresses. Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
		
			
				
	
	
		
			46 lines
		
	
	
		
			913 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			913 B
		
	
	
	
		
			C
		
	
	
	
	
	
| /*
 | |
|  * arch/sh/mm/fixed_pmb.c
 | |
|  *
 | |
|  * Copyright (C) 2009  Renesas Solutions Corp.
 | |
|  *
 | |
|  * This file is subject to the terms and conditions of the GNU General Public
 | |
|  * License.  See the file "COPYING" in the main directory of this archive
 | |
|  * for more details.
 | |
|  */
 | |
| #include <linux/init.h>
 | |
| #include <linux/mm.h>
 | |
| #include <linux/io.h>
 | |
| #include <asm/mmu.h>
 | |
| #include <asm/mmu_context.h>
 | |
| 
 | |
| static int __uses_jump_to_uncached fixed_pmb_init(void)
 | |
| {
 | |
| 	int i;
 | |
| 	unsigned long addr, data;
 | |
| 
 | |
| 	jump_to_uncached();
 | |
| 
 | |
| 	for (i = 0; i < PMB_ENTRY_MAX; i++) {
 | |
| 		addr = PMB_DATA + (i << PMB_E_SHIFT);
 | |
| 		data = ctrl_inl(addr);
 | |
| 		if (!(data & PMB_V))
 | |
| 			continue;
 | |
| 
 | |
| 		if (data & PMB_C) {
 | |
| #if defined(CONFIG_CACHE_WRITETHROUGH)
 | |
| 			data |= PMB_WT;
 | |
| #elif defined(CONFIG_CACHE_WRITEBACK)
 | |
| 			data &= ~PMB_WT;
 | |
| #else
 | |
| 			data &= ~(PMB_C | PMB_WT);
 | |
| #endif
 | |
| 		}
 | |
| 		ctrl_outl(data, addr);
 | |
| 	}
 | |
| 
 | |
| 	back_to_cached();
 | |
| 
 | |
| 	return 0;
 | |
| }
 | |
| arch_initcall(fixed_pmb_init);
 |