Skip to content

Commit c72396f

Browse files
digetxthierryreding
authored andcommitted
memory: tegra: Pre-configure debug register on Tegra20
The driver expects certain debug features to be disabled in order to work properly. Let's disable them explicitly for consistency and to not rely on a boot state. Acked-by: Peter De Schrijver <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent d039cf2 commit c72396f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

drivers/memory/tegra/tegra20-emc.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#define EMC_INTSTATUS 0x000
2424
#define EMC_INTMASK 0x004
25+
#define EMC_DBG 0x008
2526
#define EMC_TIMING_CONTROL 0x028
2627
#define EMC_RC 0x02c
2728
#define EMC_RFC 0x030
@@ -80,6 +81,12 @@
8081
#define EMC_REFRESH_OVERFLOW_INT BIT(3)
8182
#define EMC_CLKCHANGE_COMPLETE_INT BIT(4)
8283

84+
#define EMC_DBG_READ_MUX_ASSEMBLY BIT(0)
85+
#define EMC_DBG_WRITE_MUX_ACTIVE BIT(1)
86+
#define EMC_DBG_FORCE_UPDATE BIT(2)
87+
#define EMC_DBG_READ_DQM_CTRL BIT(9)
88+
#define EMC_DBG_CFG_PRIORITY BIT(24)
89+
8390
static const u16 emc_timing_registers[] = {
8491
EMC_RC,
8592
EMC_RFC,
@@ -396,7 +403,7 @@ tegra_emc_find_node_by_ram_code(struct device *dev)
396403
static int emc_setup_hw(struct tegra_emc *emc)
397404
{
398405
u32 intmask = EMC_REFRESH_OVERFLOW_INT | EMC_CLKCHANGE_COMPLETE_INT;
399-
u32 emc_cfg;
406+
u32 emc_cfg, emc_dbg;
400407

401408
emc_cfg = readl_relaxed(emc->regs + EMC_CFG_2);
402409

@@ -419,6 +426,14 @@ static int emc_setup_hw(struct tegra_emc *emc)
419426
writel_relaxed(intmask, emc->regs + EMC_INTMASK);
420427
writel_relaxed(intmask, emc->regs + EMC_INTSTATUS);
421428

429+
/* ensure that unwanted debug features are disabled */
430+
emc_dbg = readl_relaxed(emc->regs + EMC_DBG);
431+
emc_dbg |= EMC_DBG_CFG_PRIORITY;
432+
emc_dbg &= ~EMC_DBG_READ_MUX_ASSEMBLY;
433+
emc_dbg &= ~EMC_DBG_WRITE_MUX_ACTIVE;
434+
emc_dbg &= ~EMC_DBG_FORCE_UPDATE;
435+
writel_relaxed(emc_dbg, emc->regs + EMC_DBG);
436+
422437
return 0;
423438
}
424439

0 commit comments

Comments
 (0)