Lines Matching refs:phy_base
59 static void ddrphy_fifo_reset(void __iomem *phy_base) in ddrphy_fifo_reset() argument
63 tmp = readl(phy_base + MPHY_PGCR0); in ddrphy_fifo_reset()
65 writel(tmp, phy_base + MPHY_PGCR0); in ddrphy_fifo_reset()
70 writel(tmp, phy_base + MPHY_PGCR0); in ddrphy_fifo_reset()
75 static void ddrphy_vt_ctrl(void __iomem *phy_base, int enable) in ddrphy_vt_ctrl() argument
79 tmp = readl(phy_base + MPHY_PGCR1); in ddrphy_vt_ctrl()
86 writel(tmp, phy_base + MPHY_PGCR1); in ddrphy_vt_ctrl()
89 while (!(readl(phy_base + MPHY_PGSR1) & MPHY_PGSR1_VTSTOP)) in ddrphy_vt_ctrl()
94 static void ddrphy_dqs_delay_fixup(void __iomem *phy_base, int nr_dx, int step) in ddrphy_dqs_delay_fixup() argument
98 void __iomem *dx_base = phy_base + MPHY_DX_BASE; in ddrphy_dqs_delay_fixup()
100 ddrphy_vt_ctrl(phy_base, 0); in ddrphy_dqs_delay_fixup()
112 ddrphy_vt_ctrl(phy_base, 1); in ddrphy_dqs_delay_fixup()
115 static int ddrphy_get_system_latency(void __iomem *phy_base, int width) in ddrphy_get_system_latency() argument
117 void __iomem *dx_base = phy_base + MPHY_DX_BASE; in ddrphy_get_system_latency()
143 static void ddrphy_init(void __iomem *phy_base, enum dram_freq freq, int width, in ddrphy_init() argument
153 writel(MPHY_PIR_ZCALBYP, phy_base + MPHY_PIR); in ddrphy_init()
158 writel(0x07d81e37, phy_base + MPHY_PGCR0); in ddrphy_init()
159 writel(0x0200c4e0, phy_base + MPHY_PGCR1); in ddrphy_init()
164 writel(tmp, phy_base + MPHY_PGCR2); in ddrphy_init()
166 writel(ddrphy_ptr0[freq], phy_base + MPHY_PTR0); in ddrphy_init()
167 writel(ddrphy_ptr1[freq], phy_base + MPHY_PTR1); in ddrphy_init()
168 writel(0x00083def, phy_base + MPHY_PTR2); in ddrphy_init()
169 writel(ddrphy_ptr3[freq], phy_base + MPHY_PTR3); in ddrphy_init()
170 writel(ddrphy_ptr4[freq], phy_base + MPHY_PTR4); in ddrphy_init()
172 writel(ddrphy_acbdlr0[ch], phy_base + MPHY_ACBDLR0); in ddrphy_init()
174 writel(0x55555555, phy_base + MPHY_ACIOCR1); in ddrphy_init()
175 writel(0x00000000, phy_base + MPHY_ACIOCR2); in ddrphy_init()
176 writel(0x55555555, phy_base + MPHY_ACIOCR3); in ddrphy_init()
177 writel(0x00000000, phy_base + MPHY_ACIOCR4); in ddrphy_init()
178 writel(0x00000055, phy_base + MPHY_ACIOCR5); in ddrphy_init()
179 writel(0x00181aa4, phy_base + MPHY_DXCCR); in ddrphy_init()
181 writel(0x0024641e, phy_base + MPHY_DSGCR); in ddrphy_init()
182 writel(0x0000040b, phy_base + MPHY_DCR); in ddrphy_init()
183 writel(ddrphy_dtpr0[freq], phy_base + MPHY_DTPR0); in ddrphy_init()
184 writel(ddrphy_dtpr1[freq], phy_base + MPHY_DTPR1); in ddrphy_init()
185 writel(ddrphy_dtpr2[freq], phy_base + MPHY_DTPR2); in ddrphy_init()
186 writel(ddrphy_dtpr3[freq], phy_base + MPHY_DTPR3); in ddrphy_init()
187 writel(ddrphy_mr0[freq], phy_base + MPHY_MR0); in ddrphy_init()
188 writel(0x00000006, phy_base + MPHY_MR1); in ddrphy_init()
189 writel(ddrphy_mr2[freq], phy_base + MPHY_MR2); in ddrphy_init()
190 writel(0x00000000, phy_base + MPHY_MR3); in ddrphy_init()
195 writel(0x90003087 | tmp, phy_base + MPHY_DTCR); in ddrphy_init()
197 writel(0x00000000, phy_base + MPHY_DTAR0); in ddrphy_init()
198 writel(0x00000008, phy_base + MPHY_DTAR1); in ddrphy_init()
199 writel(0x00000010, phy_base + MPHY_DTAR2); in ddrphy_init()
200 writel(0x00000018, phy_base + MPHY_DTAR3); in ddrphy_init()
201 writel(0xdd22ee11, phy_base + MPHY_DTDR0); in ddrphy_init()
202 writel(0x7788bb44, phy_base + MPHY_DTDR1); in ddrphy_init()
205 writel(0x04048900, phy_base + MPHY_ZQCR); in ddrphy_init()
207 zq_base = phy_base + MPHY_ZQ_BASE; in ddrphy_init()
218 dx_base = phy_base + MPHY_DX_BASE; in ddrphy_init()
232 while (!(readl(phy_base + MPHY_PGSR0) & MPHY_PGSR0_IDONE)) in ddrphy_init()
235 ddrphy_dqs_delay_fixup(phy_base, nr_dx, -4); in ddrphy_init()
311 static int __ddrphy_training(void __iomem *phy_base, in __ddrphy_training() argument
330 writel(init_flag, phy_base + MPHY_PIR); in __ddrphy_training()
339 pgsr0 = readl(phy_base + MPHY_PGSR0); in __ddrphy_training()
355 static int ddrphy_impedance_calibration(void __iomem *phy_base) in ddrphy_impedance_calibration() argument
360 ret = __ddrphy_training(phy_base, impedance_calibration_sequence); in ddrphy_impedance_calibration()
372 tmp = readl(phy_base + MPHY_ZQCR); in ddrphy_impedance_calibration()
374 writel(tmp, phy_base + MPHY_ZQCR); in ddrphy_impedance_calibration()
377 writel(tmp, phy_base + MPHY_ZQCR); in ddrphy_impedance_calibration()
382 static int ddrphy_dram_init(void __iomem *phy_base) in ddrphy_dram_init() argument
384 return __ddrphy_training(phy_base, dram_init_sequence); in ddrphy_dram_init()
387 static int ddrphy_training(void __iomem *phy_base) in ddrphy_training() argument
389 return __ddrphy_training(phy_base, training_sequence); in ddrphy_training()
547 void __iomem *phy_base = umc_ch_base + 0x00030000; in umc_ch_init() local
558 ddrphy_init(phy_base, freq, width, ch); in umc_ch_init()
560 ret = ddrphy_impedance_calibration(phy_base); in umc_ch_init()
564 ddrphy_dram_init(phy_base); in umc_ch_init()
574 ret = ddrphy_training(phy_base); in umc_ch_init()
582 ddrphy_get_system_latency(phy_base, width)); in umc_ch_init()
588 ddrphy_fifo_reset(phy_base); in umc_ch_init()