| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * arch/arm/mach-dove/addr-map.c | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Address map functions for Marvell Dove 88AP510 SoC | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This file is licensed under the terms of the GNU General Public | 
					
						
							|  |  |  |  * License version 2.  This program is licensed "as is" without any | 
					
						
							|  |  |  |  * warranty of any kind, whether express or implied. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <linux/kernel.h>
 | 
					
						
							|  |  |  | #include <linux/init.h>
 | 
					
						
							|  |  |  | #include <linux/mbus.h>
 | 
					
						
							|  |  |  | #include <linux/io.h>
 | 
					
						
							|  |  |  | #include <asm/mach/arch.h>
 | 
					
						
							|  |  |  | #include <asm/setup.h>
 | 
					
						
							| 
									
										
										
										
											2012-02-29 13:13:53 -06:00
										 |  |  | #include <mach/dove.h>
 | 
					
						
							| 
									
										
										
										
											2011-12-07 21:48:05 +01:00
										 |  |  | #include <plat/addr-map.h>
 | 
					
						
							| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | #include "common.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Generic Address Decode Windows bit settings | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #define TARGET_DDR		0x0
 | 
					
						
							|  |  |  | #define TARGET_BOOTROM		0x1
 | 
					
						
							|  |  |  | #define TARGET_CESA		0x3
 | 
					
						
							|  |  |  | #define TARGET_PCIE0		0x4
 | 
					
						
							|  |  |  | #define TARGET_PCIE1		0x8
 | 
					
						
							|  |  |  | #define TARGET_SCRATCHPAD	0xd
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define ATTR_CESA		0x01
 | 
					
						
							|  |  |  | #define ATTR_BOOTROM		0xfd
 | 
					
						
							|  |  |  | #define ATTR_DEV_SPI0_ROM	0xfe
 | 
					
						
							|  |  |  | #define ATTR_DEV_SPI1_ROM	0xfb
 | 
					
						
							|  |  |  | #define ATTR_PCIE_IO		0xe0
 | 
					
						
							|  |  |  | #define ATTR_PCIE_MEM		0xe8
 | 
					
						
							|  |  |  | #define ATTR_SCRATCHPAD		0x0
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static inline void __iomem *ddr_map_sc(int i) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return (void __iomem *)(DOVE_MC_VIRT_BASE + 0x100 + ((i) << 4)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-07 21:48:05 +01:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Description of the windows needed by the platform code | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static struct __initdata orion_addr_map_cfg addr_map_cfg = { | 
					
						
							|  |  |  | 	.num_wins = 8, | 
					
						
							|  |  |  | 	.remappable_wins = 4, | 
					
						
							|  |  |  | 	.bridge_virt_base = BRIDGE_VIRT_BASE, | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-07 21:48:05 +01:00
										 |  |  | static const struct __initdata orion_addr_map_info addr_map_info[] = { | 
					
						
							| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | 	/*
 | 
					
						
							| 
									
										
										
										
											2011-12-07 21:48:05 +01:00
										 |  |  | 	 * Windows for PCIe IO+MEM space. | 
					
						
							| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2011-12-07 21:48:05 +01:00
										 |  |  | 	{ 0, DOVE_PCIE0_IO_PHYS_BASE, DOVE_PCIE0_IO_SIZE, | 
					
						
							|  |  |  | 	  TARGET_PCIE0, ATTR_PCIE_IO, DOVE_PCIE0_IO_BUS_BASE | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ 1, DOVE_PCIE1_IO_PHYS_BASE, DOVE_PCIE1_IO_SIZE, | 
					
						
							|  |  |  | 	  TARGET_PCIE1, ATTR_PCIE_IO, DOVE_PCIE1_IO_BUS_BASE | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ 2, DOVE_PCIE0_MEM_PHYS_BASE, DOVE_PCIE0_MEM_SIZE, | 
					
						
							|  |  |  | 	  TARGET_PCIE0, ATTR_PCIE_MEM, -1 | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ 3, DOVE_PCIE1_MEM_PHYS_BASE, DOVE_PCIE1_MEM_SIZE, | 
					
						
							|  |  |  | 	  TARGET_PCIE1, ATTR_PCIE_MEM, -1 | 
					
						
							|  |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | 	/*
 | 
					
						
							| 
									
										
										
										
											2011-12-07 21:48:05 +01:00
										 |  |  | 	 * Window for CESA engine. | 
					
						
							| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2011-12-07 21:48:05 +01:00
										 |  |  | 	{ 4, DOVE_CESA_PHYS_BASE, DOVE_CESA_SIZE, | 
					
						
							|  |  |  | 	  TARGET_CESA, ATTR_CESA, -1 | 
					
						
							|  |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | 	/*
 | 
					
						
							| 
									
										
										
										
											2011-12-07 21:48:05 +01:00
										 |  |  | 	 * Window to the BootROM for Standby and Sleep Resume | 
					
						
							| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2011-12-07 21:48:05 +01:00
										 |  |  | 	{ 5, DOVE_BOOTROM_PHYS_BASE, DOVE_BOOTROM_SIZE, | 
					
						
							|  |  |  | 	  TARGET_BOOTROM, ATTR_BOOTROM, -1 | 
					
						
							|  |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | 	/*
 | 
					
						
							| 
									
										
										
										
											2011-12-07 21:48:05 +01:00
										 |  |  | 	 * Window to the PMU Scratch Pad space | 
					
						
							| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2011-12-07 21:48:05 +01:00
										 |  |  | 	{ 6, DOVE_SCRATCHPAD_PHYS_BASE, DOVE_SCRATCHPAD_SIZE, | 
					
						
							|  |  |  | 	  TARGET_SCRATCHPAD, ATTR_SCRATCHPAD, -1 | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	/* End marker */ | 
					
						
							|  |  |  | 	{ -1, 0, 0, 0, 0, 0 } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void __init dove_setup_cpu_mbus(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	int i; | 
					
						
							|  |  |  | 	int cs; | 
					
						
							| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*
 | 
					
						
							| 
									
										
										
										
											2011-12-07 21:48:05 +01:00
										 |  |  | 	 * Disable, clear and configure windows. | 
					
						
							| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2011-12-07 21:48:05 +01:00
										 |  |  | 	orion_config_wins(&addr_map_cfg, addr_map_info); | 
					
						
							| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Setup MBUS dram target info. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2011-12-07 21:48:06 +01:00
										 |  |  | 	orion_mbus_dram_info.mbus_dram_target_id = TARGET_DDR; | 
					
						
							| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	for (i = 0, cs = 0; i < 2; i++) { | 
					
						
							|  |  |  | 		u32 map = readl(ddr_map_sc(i)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * Chip select enabled? | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		if (map & 1) { | 
					
						
							|  |  |  | 			struct mbus_dram_window *w; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-07 21:48:06 +01:00
										 |  |  | 			w = &orion_mbus_dram_info.cs[cs++]; | 
					
						
							| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | 			w->cs_index = i; | 
					
						
							|  |  |  | 			w->mbus_attr = 0; /* CS address decoding done inside */ | 
					
						
							|  |  |  | 					  /* the DDR controller, no need to  */ | 
					
						
							|  |  |  | 					  /* provide attributes */ | 
					
						
							|  |  |  | 			w->base = map & 0xff800000; | 
					
						
							|  |  |  | 			w->size = 0x100000 << (((map & 0x000f0000) >> 16) - 4); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-12-07 21:48:06 +01:00
										 |  |  | 	orion_mbus_dram_info.num_cs = cs; | 
					
						
							| 
									
										
										
										
											2009-08-06 15:12:43 +03:00
										 |  |  | } |