static void do_lpddr2_init(u32 base, u32 cs) { u32 mr_addr; /* Wait till device auto initialization is complete */ while (get_mr(base, cs, LPDDR2_MR0) & LPDDR2_MR0_DAI_MASK) ; set_mr(base, cs, LPDDR2_MR10, MR10_ZQ_ZQINIT); /* * tZQINIT = 1 us * Enough loops assuming a maximum of 2GHz */ sdelay(2000); set_mr(base, cs, LPDDR2_MR1, MR1_BL_8_BT_SEQ_WRAP_EN_NWR_3); set_mr(base, cs, LPDDR2_MR16, MR16_REF_FULL_ARRAY); /* * Enable refresh along with writing MR2 * Encoding of RL in MR2 is (RL - 2) */ mr_addr = LPDDR2_MR2 | OMAP44XX_REG_REFRESH_EN_MASK; set_mr(base, cs, mr_addr, RL_FINAL - 2); }
/* Compute the delta between 2 resources snapshots. * the ResourceDiff can have dangling pointers in old and nu, so dont clear * them before being done with rd in the processing loop */ static struct ResourceDiff *NewStateDiff(const struct TrackedResources *old, const struct TrackedResources *nu) { /* FIXME */ struct OpenedResourceNode *orn; struct ResourceDiff *rd; rd = get_rd(); if (!rd) return NULL; NEWLIST(&rd->modifiedOpened); for(orn=(struct OpenedResourceNode *)nu->opened.lh_Head; orn->node.ln_Succ!=NULL; orn=(struct OpenedResourceNode *)orn->node.ln_Succ) { struct OpenedResourceNode *other; BOOL seen = FALSE; for(other=(struct OpenedResourceNode *)old->opened.lh_Head; other->node.ln_Succ!=NULL; other=(struct OpenedResourceNode *)other->node.ln_Succ) { if (orn->addr == other->addr) { if (!strcmp(orn->name, other->name)) { seen = TRUE; if (orn->count != other->count) { struct ModifiedResource *mr = get_mr(); if (!mr) return NULL; mr->type = other->type; mr->name = other->name; mr->addr = other->addr; mr->before_count = other->count; mr->after_count = orn->count; Enqueue(&rd->modifiedOpened, (struct Node *)mr); } } } } if (!seen) { struct ModifiedResource *mr = get_mr(); if (!mr) return NULL; mr->type = orn->type; mr->name = orn->name; mr->addr = orn->addr; mr->before_count = 0; mr->after_count = orn->count; Enqueue(&rd->modifiedOpened, (struct Node *)mr); } } rd->memLost = old->freeMem - nu->freeMem; return rd; }