msm: 8625: Remove static mapping for second core
Instead of having a fixed physical address for second core and doing a
memblock_remove, move to randomly allocating a physical address.
As allocation of address can fall in HIGHMEM region and to map
it to kernel address space adding kmap_atomic.
Change-Id: If71c9d816b3ab2923eddcad90efcb296373417da
Signed-off-by: Taniya Das <tdas@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-msm7x27a.c b/arch/arm/mach-msm/board-msm7x27a.c
index b44b03f..91185ea 100644
--- a/arch/arm/mach-msm/board-msm7x27a.c
+++ b/arch/arm/mach-msm/board-msm7x27a.c
@@ -948,7 +948,6 @@
static void __init msm8625_reserve(void)
{
msm7x27a_reserve();
- memblock_remove(MSM8625_SECONDARY_PHYS, SZ_8);
msm_pm_8625_boot_pdata.p_addr = memblock_alloc(SZ_8, SZ_64K);
}
diff --git a/arch/arm/mach-msm/board-qrd7627a.c b/arch/arm/mach-msm/board-qrd7627a.c
index 02916c2..7aee53f 100644
--- a/arch/arm/mach-msm/board-qrd7627a.c
+++ b/arch/arm/mach-msm/board-qrd7627a.c
@@ -775,12 +775,6 @@
msm_reserve();
}
-static void __init msm8625_reserve(void)
-{
- memblock_remove(MSM8625_SECONDARY_PHYS, SZ_8);
- msm7627a_reserve();
-}
-
static void msmqrd_adsp_add_pdev(void)
{
int rc = 0;
@@ -1201,7 +1195,7 @@
MACHINE_START(MSM8625_EVB, "QRD MSM8625 EVB")
.boot_params = PHYS_OFFSET + 0x100,
.map_io = msm8625_map_io,
- .reserve = msm8625_reserve,
+ .reserve = msm7627a_reserve,
.init_irq = msm8625_init_irq,
.init_machine = msm_qrd_init,
.timer = &msm_timer,
diff --git a/arch/arm/mach-msm/devices-msm7x27a.c b/arch/arm/mach-msm/devices-msm7x27a.c
index e1276d6..ff11c7a 100644
--- a/arch/arm/mach-msm/devices-msm7x27a.c
+++ b/arch/arm/mach-msm/devices-msm7x27a.c
@@ -17,6 +17,7 @@
#include <linux/regulator/machine.h>
#include <linux/init.h>
#include <linux/irq.h>
+#include <linux/memblock.h>
#include <mach/irqs.h>
#include <mach/msm_iomap.h>
#include <mach/board.h>
@@ -1590,8 +1591,32 @@
(void *)MSM_QGIC_CPU_BASE);
}
+static phys_addr_t msm8625_phys_base;
+
+static void __init msm_reserve_sdram_memblock(void)
+{
+ phys_addr_t paddr;
+
+ paddr = memblock_alloc(SZ_8, SZ_64K);
+ pr_debug("%s physical address = %x\n", __func__, paddr);
+
+ if (!paddr) {
+ pr_err("%s: failed to reserve SZ_8 bytes\n", __func__);
+ return;
+ }
+
+ msm8625_phys_base = paddr;
+}
+
+phys_addr_t msm8625_get_phys_base(void)
+{
+ return msm8625_phys_base;
+}
+EXPORT_SYMBOL(msm8625_get_phys_base);
+
void __init msm8625_map_io(void)
{
+ msm_reserve_sdram_memblock();
msm_map_msm8625_io();
if (socinfo_init() < 0)
diff --git a/arch/arm/mach-msm/devices-msm7x2xa.h b/arch/arm/mach-msm/devices-msm7x2xa.h
index 3c81ccf..73b58e0 100644
--- a/arch/arm/mach-msm/devices-msm7x2xa.h
+++ b/arch/arm/mach-msm/devices-msm7x2xa.h
@@ -31,4 +31,5 @@
void __init msm8625_map_io(void);
int ar600x_wlan_power(bool on);
void __init msm8x25_spm_device_init(void);
+phys_addr_t msm8625_get_phys_base(void);
#endif
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap.h b/arch/arm/mach-msm/include/mach/msm_iomap.h
index 27965d3..48e3837 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap.h
@@ -93,8 +93,6 @@
0xFB600000 */
#define MSM_STRONGLY_ORDERED_PAGE 0xFA0F0000
-#define MSM8625_SECONDARY_PHYS 0x0FE00000
-
#if defined(CONFIG_ARCH_MSM9615) || defined(CONFIG_ARCH_MSM7X27)
#define MSM_SHARED_RAM_SIZE SZ_1M
diff --git a/arch/arm/mach-msm/platsmp-8625.c b/arch/arm/mach-msm/platsmp-8625.c
index 3c46d0f..92ed764 100644
--- a/arch/arm/mach-msm/platsmp-8625.c
+++ b/arch/arm/mach-msm/platsmp-8625.c
@@ -17,6 +17,7 @@
#include <linux/jiffies.h>
#include <linux/smp.h>
#include <linux/io.h>
+#include <linux/highmem.h>
#include <asm/cacheflush.h>
#include <asm/hardware/gic.h>
@@ -25,7 +26,9 @@
#include <asm/unified.h>
#include <mach/msm_iomap.h>
#include <mach/smp.h>
+
#include "pm.h"
+#include "devices-msm7x2xa.h"
#define MSM_CORE1_RESET 0xA8600590
#define MSM_CORE1_STATUS_MSK 0x02800000
@@ -206,7 +209,8 @@
void __init platform_smp_prepare_cpus(unsigned int max_cpus)
{
int i, value;
- void __iomem *second_ptr;
+ phys_addr_t base;
+ void *vaddr;
/*
* Initialise the present map, which describes the set of CPUs
@@ -221,18 +225,14 @@
* Write the address of secondary startup into the
* boot remapper register. The secondary CPU branches to this address.
*/
- __raw_writel(MSM8625_SECONDARY_PHYS, (MSM_CFG_CTL_BASE + 0x34));
+ base = msm8625_get_phys_base();
+ __raw_writel(base, (MSM_CFG_CTL_BASE + 0x34));
mb();
- second_ptr = ioremap_nocache(MSM8625_SECONDARY_PHYS, SZ_8);
- if (!second_ptr) {
- pr_err("failed to ioremap for secondary core\n");
- return;
- }
+ vaddr = kmap_atomic(phys_to_page(base));
- msm8625_boot_vector_init(second_ptr,
- virt_to_phys(msm_secondary_startup));
- iounmap(second_ptr);
+ msm8625_boot_vector_init(vaddr, virt_to_phys(msm_secondary_startup));
+ kunmap_atomic(vaddr);
/* Enable boot remapper address: bit 26 for core1 */
value = __raw_readl(MSM_CFG_CTL_BASE + 0x30);