Skip to content

Commit 0d35bf8

Browse files
mrajwalgirdwood
authored andcommitted
memory: add support for L1 DRAM
This patch adds support for L1 DRAM memory. If this memory is available bootloader will try to power up as many banks of L1 DRAM memory as the platform supports. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
1 parent 631567d commit 0d35bf8

4 files changed

Lines changed: 43 additions & 0 deletions

File tree

src/include/sof/trace/trace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ struct tr_ctx;
3838
#define TRACE_BOOT_LDR_HPSRAM 0x110
3939
#define TRACE_BOOT_LDR_MANIFEST 0x120
4040
#define TRACE_BOOT_LDR_LPSRAM 0x130
41+
#define TRACE_BOOT_LDR_L1DRAM 0x140
4142
#define TRACE_BOOT_LDR_JUMP 0x150
4243

4344
#define TRACE_BOOT_LDR_PARSE_MODULE 0x210

src/platform/intel/cavs/boot_loader.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,13 @@ void boot_primary_core(void)
229229
true);
230230
#endif
231231

232+
#if CONFIG_L1_DRAM
233+
/* Power ON L1 DRAM memory */
234+
trace_point(TRACE_BOOT_LDR_L1DRAM);
235+
cavs_pm_memory_l1_dram_banks_power_gate(CONFIG_L1_DRAM_MEMORY_BANKS - 1,
236+
0, true);
237+
#endif
238+
232239
/* parse manifest and copy modules */
233240
trace_point(TRACE_BOOT_LDR_MANIFEST);
234241
parse_manifest();

src/platform/intel/cavs/include/cavs/lib/pm_memory.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,31 @@ void cavs_pm_memory_lp_sram_power_gate(void *ptr, uint32_t size, bool enabled);
154154

155155
#endif /* CONFIG_LP_SRAM */
156156

157+
#if CONFIG_L1_DRAM
158+
159+
static inline void cavs_pm_memory_l1_dram_banks_power_gate(
160+
uint32_t start_bank_id, uint32_t ending_bank_id, bool enable)
161+
{
162+
uint32_t mask = MASK(start_bank_id, ending_bank_id);
163+
uint32_t pgctl = io_reg_read(L1_MEM_DRAM_PGCTL);
164+
uint32_t expected = enable ? 0 : mask;
165+
uint32_t delay = 0;
166+
167+
if (enable)
168+
pgctl &= ~mask;
169+
else
170+
pgctl |= mask;
171+
172+
io_reg_write(L1_MEM_DRAM_PGCTL, pgctl);
173+
174+
while ((io_reg_read(L1_MEM_DRAM_PGISTS) & mask) != expected) {
175+
idelay(MEMORY_POWER_CHANGE_DELAY);
176+
delay += MEMORY_POWER_CHANGE_DELAY;
177+
if (delay >= MEMORY_POWER_CHANGE_TIMEOUT)
178+
platform_panic(SOF_IPC_PANIC_MEM);
179+
}
180+
}
181+
182+
#endif /* CONFIG_L1_DRAM */
183+
157184
#endif /* __CAVS_LIB_PM_MEMORY_H__ */

src/platform/tigerlake/include/platform/lib/memory.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,14 @@
449449
#define BOOT_LDR_STACK_BASE HEAP_HP_BUFFER_BASE
450450
#define BOOT_LDR_STACK_SIZE SOF_STACK_TOTAL_SIZE
451451

452+
/* L1 memory */
453+
#define L1_MEM_BASE 0x9F000000
454+
#define L1_DRAM_SIZE (CONFIG_L1_DRAM_BANKS * CONFIG_L1_DRAM_BANK_SIZE)
455+
#define L1_MEM_REG_BASE 0x9F080000
456+
#define L1_MEM_CAP (L1_MEM_REG_BASE + 0x00)
457+
#define L1_MEM_DRAM_PGCTL (L1_MEM_REG_BASE + 0x20)
458+
#define L1_MEM_DRAM_PGISTS (L1_MEM_REG_BASE + 0x28)
459+
452460
/* L1 init */
453461
#define L1CC_ADDR (0x9F080080)
454462
#define CxL1CCAP (L1CC_ADDR + 0x0000)

0 commit comments

Comments
 (0)