Merge "msm_shared: bam: Add support for command descriptors."
diff --git a/arch/arm/arch.c b/arch/arm/arch.c
index f17fa09..dc171b4 100644
--- a/arch/arm/arch.c
+++ b/arch/arm/arch.c
@@ -47,7 +47,6 @@
#if ARM_WITH_MMU
arm_mmu_init();
- platform_init_mmu_mappings();
#endif
/* turn the cache back on */
diff --git a/arch/arm/mmu.c b/arch/arm/mmu.c
index 4b51d50..cc74534 100644
--- a/arch/arm/mmu.c
+++ b/arch/arm/mmu.c
@@ -78,6 +78,8 @@
MMU_MEMORY_AP_READ_WRITE);
}
+ platform_init_mmu_mappings();
+
/* set up the translation table base */
arm_write_ttbr((uint32_t)tt);
diff --git a/platform/copper/acpuclock.c b/platform/copper/acpuclock.c
index 8299a7c..3911572 100644
--- a/platform/copper/acpuclock.c
+++ b/platform/copper/acpuclock.c
@@ -126,10 +126,7 @@
}
else if(freq == MMC_CLK_50MHZ)
{
- /* For now, not able to bump the clock to 50MHz
- * so use 20MHz for now.
- */
- ret = clk_get_set_enable(clk_name, 20000000, 1);
+ ret = clk_get_set_enable(clk_name, 50000000, 1);
}
else
{
diff --git a/platform/copper/include/platform/iomap.h b/platform/copper/include/platform/iomap.h
index c498bdc..d48c7c9 100644
--- a/platform/copper/include/platform/iomap.h
+++ b/platform/copper/include/platform/iomap.h
@@ -29,6 +29,9 @@
#ifndef _PLATFORM_MSMCOPPER_IOMAP_H_
#define _PLATFORM_MSMCOPPER_IOMAP_H_
+#define MSM_IOMAP_BASE 0xF9000000
+#define MSM_IOMAP_END 0xFEFFFFFF
+
#define SDRAM_START_ADDR 0x00000000
#define SDRAM_SEC_BANK_START_ADDR 0x10000000
diff --git a/platform/copper/platform.c b/platform/copper/platform.c
index 397bb84..6ccfe2d 100644
--- a/platform/copper/platform.c
+++ b/platform/copper/platform.c
@@ -34,7 +34,27 @@
#include <qgic.h>
#include <qtimer.h>
#include <platform/clock.h>
+#include <mmu.h>
+#include <arch/arm/mmu.h>
+#include <smem.h>
+#define MB (1024*1024)
+
+#define MSM_IOMAP_SIZE ((MSM_IOMAP_END - MSM_IOMAP_BASE)/MB)
+
+/* LK memory - cacheable, write through */
+#define LK_MEMORY (MMU_MEMORY_TYPE_NORMAL_WRITE_THROUGH | \
+ MMU_MEMORY_AP_READ_WRITE)
+
+/* Peripherals - non-shared device */
+#define IOMAP_MEMORY (MMU_MEMORY_TYPE_DEVICE_SHARED | \
+ MMU_MEMORY_AP_READ_WRITE | MMU_MEMORY_XN)
+
+mmu_section_t mmu_section_table[] = {
+/* Physical addr, Virtual addr, Size (in MB), Flags */
+ {MEMBASE, MEMBASE, (MEMSIZE / MB), LK_MEMORY},
+ {MSM_IOMAP_BASE, MSM_IOMAP_BASE, MSM_IOMAP_SIZE, IOMAP_MEMORY},
+};
void platform_early_init(void)
{
@@ -53,3 +73,48 @@
{
qtimer_uninit();
}
+
+/* Setup memory for this platform */
+void platform_init_mmu_mappings(void)
+{
+ struct smem_ram_ptable ram_ptable;
+ uint32_t i;
+ uint32_t sections;
+ uint32_t table_size = ARRAY_SIZE(mmu_section_table);
+
+ ASSERT(smem_ram_ptable_init(&ram_ptable));
+
+ /* Configure the MMU page entries for SDRAM and IMEM memory read
+ from the smem ram table*/
+ for(i = 0; i < ram_ptable.len; i++)
+ { if((ram_ptable.parts[i].category == SDRAM) ||
+ (ram_ptable.parts[i].category == IMEM))
+ {
+ /* Check to ensure that start address is 1MB aligned */
+ ASSERT((ram_ptable.parts[i].start & 0xFFFFF) == 0);
+
+ sections = (ram_ptable.parts[i].size) / MB;
+ while(sections--) {
+ arm_mmu_map_section(ram_ptable.parts[i].start +
+ sections * MB,
+ ram_ptable.parts[i].start +
+ sections * MB,
+ (MMU_MEMORY_TYPE_NORMAL_WRITE_THROUGH | \
+ MMU_MEMORY_AP_READ_WRITE | MMU_MEMORY_XN));
+ }
+ }
+ }
+ /* Configure the MMU page entries for memory read from the
+ mmu_section_table */
+ for (i = 0; i < table_size; i++) {
+ sections = mmu_section_table[i].num_of_sections;
+
+ while (sections--) {
+ arm_mmu_map_section(mmu_section_table[i].paddress +
+ sections * MB,
+ mmu_section_table[i].vaddress +
+ sections * MB,
+ mmu_section_table[i].flags);
+ }
+ }
+}
diff --git a/platform/msm8960/platform.c b/platform/msm8960/platform.c
index 74bedd8..9ad7459 100644
--- a/platform/msm8960/platform.c
+++ b/platform/msm8960/platform.c
@@ -80,7 +80,7 @@
/* Physical addr, Virtual addr, Size (in MB), Flags */
{MEMBASE, MEMBASE, (MEMSIZE / MB), LK_MEMORY},
{BASE_ADDR, BASE_ADDR, 44, KERNEL_MEMORY},
- {SCRATCH_ADDR, SCRATCH_ADDR, 128, SCRATCH_MEMORY},
+ {SCRATCH_ADDR, SCRATCH_ADDR, 768, SCRATCH_MEMORY},
{MSM_IOMAP_BASE, MSM_IOMAP_BASE, MSM_IOMAP_SIZE, IOMAP_MEMORY},
{MSM_IMEM_BASE, MSM_IMEM_BASE, 1, IMEM_MEMORY},
};
diff --git a/platform/msm_shared/include/clock_lib2.h b/platform/msm_shared/include/clock_lib2.h
index 0b6dbae..0a82c51 100644
--- a/platform/msm_shared/include/clock_lib2.h
+++ b/platform/msm_shared/include/clock_lib2.h
@@ -52,7 +52,7 @@
.freq_hz = (f), \
.src_clk = &s##_clk_src.c, \
.m_val = (m), \
- .n_val = ~((n)-(m)), \
+ .n_val = ~((n)-(m)) * !!(n), \
.d_val = ~(n),\
.div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \
| BVAL(10, 8, s##_source_val), \
diff --git a/platform/msm_shared/mmc.c b/platform/msm_shared/mmc.c
index 803a1e2..0f70b53 100644
--- a/platform/msm_shared/mmc.c
+++ b/platform/msm_shared/mmc.c
@@ -2104,6 +2104,7 @@
{
unsigned int mmc_return = MMC_BOOT_E_SUCCESS;
unsigned int status;
+ uint8_t mmc_bus_width = 0;
/* Basic check */
if (host == NULL) {
@@ -2162,8 +2163,9 @@
}
/* enable wide bus */
+ mmc_bus_width = target_mmc_bus_width();
mmc_return =
- mmc_boot_set_bus_width(card, MMC_BOOT_BUS_WIDTH_4_BIT);
+ mmc_boot_set_bus_width(card, mmc_bus_width);
if (mmc_return != MMC_BOOT_E_SUCCESS) {
dprintf(CRITICAL,
"Error No.%d: Failure to set wide bus for Card(RCA:%x)\n",
diff --git a/target/init.c b/target/init.c
index 7d51ea9..fc5c34a 100644
--- a/target/init.c
+++ b/target/init.c
@@ -24,6 +24,7 @@
#include <debug.h>
#include <target.h>
#include <compiler.h>
+#include <mmc.h>
#define EXPAND(NAME) #NAME
#define TARGET(NAME) EXPAND(NAME)
@@ -117,3 +118,9 @@
__WEAK void target_usb_stop(void)
{
}
+
+/* Default target specific function for mmc bus width */
+__WEAK int target_mmc_bus_width()
+{
+ return MMC_BOOT_BUS_WIDTH_4_BIT;
+}
diff --git a/target/msm8960/atags.c b/target/msm8960/atags.c
index 160190d..8142890 100644
--- a/target/msm8960/atags.c
+++ b/target/msm8960/atags.c
@@ -37,6 +37,7 @@
#define SIZE_2M (2 * SIZE_1M)
#define SIZE_256M (256 * SIZE_1M)
#define SIZE_512M (512 * SIZE_1M)
+#define SIZE_768M (768 * SIZE_1M)
#define ATAG_MEM 0x54410002
@@ -208,5 +209,5 @@
unsigned target_get_max_flash_size(void)
{
- return (SIZE_512M);
+ return (SIZE_768M);
}
diff --git a/target/msm8960/init.c b/target/msm8960/init.c
index b7d1548..e1f67e1 100644
--- a/target/msm8960/init.c
+++ b/target/msm8960/init.c
@@ -466,3 +466,8 @@
apq8064_ext_3p3V_enable();
}
}
+
+int target_mmc_bus_width()
+{
+ return MMC_BOOT_BUS_WIDTH_8_BIT;
+}