Lines Matching full:hba
25 static int ufs_hisi_check_hibern8(struct ufs_hba *hba) in ufs_hisi_check_hibern8() argument
33 err = ufshcd_dme_get(hba, UIC_ARG_MIB_SEL(MPHY_TX_FSM_STATE, 0), in ufs_hisi_check_hibern8()
35 err |= ufshcd_dme_get(hba, in ufs_hisi_check_hibern8()
50 err = ufshcd_dme_get(hba, UIC_ARG_MIB_SEL(MPHY_TX_FSM_STATE, 0), in ufs_hisi_check_hibern8()
52 err |= ufshcd_dme_get(hba, in ufs_hisi_check_hibern8()
57 dev_err(hba->dev, "%s: unable to get TX_FSM_STATE, err %d\n", in ufs_hisi_check_hibern8()
62 dev_err(hba->dev, "%s: invalid TX_FSM_STATE, lane0 = %d, lane1 = %d\n", in ufs_hisi_check_hibern8()
69 static void ufs_hisi_clk_init(struct ufs_hba *hba) in ufs_hisi_clk_init() argument
71 struct ufs_hisi_host *host = ufshcd_get_variant(hba); in ufs_hisi_clk_init()
83 static void ufs_hisi_soc_init(struct ufs_hba *hba) in ufs_hisi_soc_init() argument
85 struct ufs_hisi_host *host = ufshcd_get_variant(hba); in ufs_hisi_soc_init()
140 static int ufs_hisi_link_startup_pre_change(struct ufs_hba *hba) in ufs_hisi_link_startup_pre_change() argument
142 struct ufs_hisi_host *host = ufshcd_get_variant(hba); in ufs_hisi_link_startup_pre_change()
148 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0xD0C1, 0x0), 0x1); in ufs_hisi_link_startup_pre_change()
150 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x156A, 0x0), 0x2); in ufs_hisi_link_startup_pre_change()
152 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x8114, 0x0), 0x1); in ufs_hisi_link_startup_pre_change()
154 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x8121, 0x0), 0x2D); in ufs_hisi_link_startup_pre_change()
156 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x8122, 0x0), 0x1); in ufs_hisi_link_startup_pre_change()
160 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x8127, 0x0), 0x98); in ufs_hisi_link_startup_pre_change()
162 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x8128, 0x0), 0x1); in ufs_hisi_link_startup_pre_change()
166 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0xD085, 0x0), 0x1); in ufs_hisi_link_startup_pre_change()
168 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x800D, 0x4), 0x58); in ufs_hisi_link_startup_pre_change()
170 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x800D, 0x5), 0x58); in ufs_hisi_link_startup_pre_change()
172 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x800E, 0x4), 0xB); in ufs_hisi_link_startup_pre_change()
174 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x800E, 0x5), 0xB); in ufs_hisi_link_startup_pre_change()
176 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x8009, 0x4), 0x1); in ufs_hisi_link_startup_pre_change()
178 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x8009, 0x5), 0x1); in ufs_hisi_link_startup_pre_change()
180 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0xD085, 0x0), 0x1); in ufs_hisi_link_startup_pre_change()
182 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x8113, 0x0), 0x1); in ufs_hisi_link_startup_pre_change()
183 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0xD085, 0x0), 0x1); in ufs_hisi_link_startup_pre_change()
187 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x0092, 0x4), 0xA); in ufs_hisi_link_startup_pre_change()
189 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x0092, 0x5), 0xA); in ufs_hisi_link_startup_pre_change()
191 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x008f, 0x4), 0xA); in ufs_hisi_link_startup_pre_change()
193 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x008f, 0x5), 0xA); in ufs_hisi_link_startup_pre_change()
196 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x008F, 0x4), 0x7); in ufs_hisi_link_startup_pre_change()
198 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x008F, 0x5), 0x7); in ufs_hisi_link_startup_pre_change()
202 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x0095, 0x4), 0x4F); in ufs_hisi_link_startup_pre_change()
204 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x0095, 0x5), 0x4F); in ufs_hisi_link_startup_pre_change()
206 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x0094, 0x4), 0x4F); in ufs_hisi_link_startup_pre_change()
208 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x0094, 0x5), 0x4F); in ufs_hisi_link_startup_pre_change()
210 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x008B, 0x4), 0x4F); in ufs_hisi_link_startup_pre_change()
212 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x008B, 0x5), 0x4F); in ufs_hisi_link_startup_pre_change()
214 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x000F, 0x0), 0x5); in ufs_hisi_link_startup_pre_change()
216 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x000F, 0x1), 0x5); in ufs_hisi_link_startup_pre_change()
218 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0xD085, 0x0), 0x1); in ufs_hisi_link_startup_pre_change()
220 ufshcd_dme_get(hba, UIC_ARG_MIB_SEL(0xD0C1, 0x0), &value); in ufs_hisi_link_startup_pre_change()
222 dev_info(hba->dev, in ufs_hisi_link_startup_pre_change()
226 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0xD0C1, 0x0), 0x0); in ufs_hisi_link_startup_pre_change()
227 err = ufs_hisi_check_hibern8(hba); in ufs_hisi_link_startup_pre_change()
229 dev_err(hba->dev, "ufs_hisi_check_hibern8 error\n"); in ufs_hisi_link_startup_pre_change()
232 ufshcd_writel(hba, UFS_HCLKDIV_NORMAL_VALUE, UFS_REG_HCLKDIV); in ufs_hisi_link_startup_pre_change()
235 reg = ufshcd_readl(hba, REG_AUTO_HIBERNATE_IDLE_TIMER); in ufs_hisi_link_startup_pre_change()
237 ufshcd_writel(hba, reg, REG_AUTO_HIBERNATE_IDLE_TIMER); in ufs_hisi_link_startup_pre_change()
240 ufshcd_disable_host_tx_lcc(hba); in ufs_hisi_link_startup_pre_change()
242 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0xD0AB, 0x0), 0x0); in ufs_hisi_link_startup_pre_change()
243 ufshcd_dme_get(hba, UIC_ARG_MIB_SEL(0xD0AB, 0x0), &value); in ufs_hisi_link_startup_pre_change()
246 dev_info(hba->dev, "WARN: close VS_Mk2ExtnSupport failed\n"); in ufs_hisi_link_startup_pre_change()
252 static int ufs_hisi_link_startup_post_change(struct ufs_hba *hba) in ufs_hisi_link_startup_post_change() argument
254 struct ufs_hisi_host *host = ufshcd_get_variant(hba); in ufs_hisi_link_startup_post_change()
257 ufshcd_dme_set(hba, UIC_ARG_MIB(0x2044), 0x0); in ufs_hisi_link_startup_post_change()
259 ufshcd_dme_set(hba, UIC_ARG_MIB(0x2045), 0x0); in ufs_hisi_link_startup_post_change()
261 ufshcd_dme_set(hba, UIC_ARG_MIB(0x2040), 0x9); in ufs_hisi_link_startup_post_change()
270 ufshcd_dme_set(hba, UIC_ARG_MIB(0xd09a), 0x80000000); in ufs_hisi_link_startup_post_change()
272 ufshcd_dme_set(hba, UIC_ARG_MIB(0xd09c), 0x00000005); in ufs_hisi_link_startup_post_change()
277 static int ufs_hisi_link_startup_notify(struct ufs_hba *hba, in ufs_hisi_link_startup_notify() argument
284 err = ufs_hisi_link_startup_pre_change(hba); in ufs_hisi_link_startup_notify()
287 err = ufs_hisi_link_startup_post_change(hba); in ufs_hisi_link_startup_notify()
301 static void ufs_hisi_pwr_change_pre_change(struct ufs_hba *hba) in ufs_hisi_pwr_change_pre_change() argument
303 struct ufs_hisi_host *host = ufshcd_get_variant(hba); in ufs_hisi_pwr_change_pre_change()
311 ufshcd_dme_set(hba, UIC_ARG_MIB((u32)0xD0A0), 0x13); in ufs_hisi_pwr_change_pre_change()
313 ufshcd_dme_set(hba, UIC_ARG_MIB((u32)0x1552), 0x4f); in ufs_hisi_pwr_change_pre_change()
315 ufshcd_dme_set(hba, UIC_ARG_MIB((u32)0x1554), 0x4f); in ufs_hisi_pwr_change_pre_change()
317 ufshcd_dme_set(hba, UIC_ARG_MIB((u32)0x1556), 0x4f); in ufs_hisi_pwr_change_pre_change()
319 ufshcd_dme_set(hba, UIC_ARG_MIB((u32)0x15a7), 0xA); in ufs_hisi_pwr_change_pre_change()
321 ufshcd_dme_set(hba, UIC_ARG_MIB((u32)0x15a8), 0xA); in ufs_hisi_pwr_change_pre_change()
322 ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0xd085, 0x0), 0x01); in ufs_hisi_pwr_change_pre_change()
325 if (hba->dev_quirks & UFS_DEVICE_QUIRK_HOST_VS_DEBUGSAVECONFIGTIME) { in ufs_hisi_pwr_change_pre_change()
328 ufshcd_dme_set(hba, UIC_ARG_MIB(0xD0A0), 0x10); in ufs_hisi_pwr_change_pre_change()
330 ufshcd_dme_set(hba, UIC_ARG_MIB(0x1556), 0x48); in ufs_hisi_pwr_change_pre_change()
334 ufshcd_dme_set(hba, UIC_ARG_MIB(0x15A8), 0x1); in ufs_hisi_pwr_change_pre_change()
336 ufshcd_dme_set(hba, UIC_ARG_MIB(0x155c), 0x0); in ufs_hisi_pwr_change_pre_change()
338 ufshcd_dme_set(hba, UIC_ARG_MIB(0x15b0), 8191); in ufs_hisi_pwr_change_pre_change()
340 ufshcd_dme_set(hba, UIC_ARG_MIB(0x15b1), 65535); in ufs_hisi_pwr_change_pre_change()
342 ufshcd_dme_set(hba, UIC_ARG_MIB(0x15b2), 32767); in ufs_hisi_pwr_change_pre_change()
344 ufshcd_dme_set(hba, UIC_ARG_MIB(0xd041), 8191); in ufs_hisi_pwr_change_pre_change()
346 ufshcd_dme_set(hba, UIC_ARG_MIB(0xd042), 65535); in ufs_hisi_pwr_change_pre_change()
348 ufshcd_dme_set(hba, UIC_ARG_MIB(0xd043), 32767); in ufs_hisi_pwr_change_pre_change()
350 ufshcd_dme_set(hba, UIC_ARG_MIB(0x15b3), 8191); in ufs_hisi_pwr_change_pre_change()
352 ufshcd_dme_set(hba, UIC_ARG_MIB(0x15b4), 65535); in ufs_hisi_pwr_change_pre_change()
354 ufshcd_dme_set(hba, UIC_ARG_MIB(0x15b5), 32767); in ufs_hisi_pwr_change_pre_change()
356 ufshcd_dme_set(hba, UIC_ARG_MIB(0xd044), 8191); in ufs_hisi_pwr_change_pre_change()
358 ufshcd_dme_set(hba, UIC_ARG_MIB(0xd045), 65535); in ufs_hisi_pwr_change_pre_change()
360 ufshcd_dme_set(hba, UIC_ARG_MIB(0xd046), 32767); in ufs_hisi_pwr_change_pre_change()
363 static int ufs_hisi_pwr_change_notify(struct ufs_hba *hba, in ufs_hisi_pwr_change_notify() argument
372 dev_err(hba->dev, in ufs_hisi_pwr_change_notify()
384 dev_err(hba->dev, in ufs_hisi_pwr_change_notify()
389 ufs_hisi_pwr_change_pre_change(hba); in ufs_hisi_pwr_change_notify()
407 static int ufs_hisi_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op, in ufs_hisi_suspend() argument
410 struct ufs_hisi_host *host = ufshcd_get_variant(hba); in ufs_hisi_suspend()
433 static int ufs_hisi_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) in ufs_hisi_resume() argument
435 struct ufs_hisi_host *host = ufshcd_get_variant(hba); in ufs_hisi_resume()
451 struct device *dev = host->hba->dev; in ufs_hisi_get_resource()
459 static void ufs_hisi_set_pm_lvl(struct ufs_hba *hba) in ufs_hisi_set_pm_lvl() argument
461 hba->rpm_lvl = UFS_PM_LVL_1; in ufs_hisi_set_pm_lvl()
462 hba->spm_lvl = UFS_PM_LVL_3; in ufs_hisi_set_pm_lvl()
467 * @hba: host controller instance
469 static int ufs_hisi_init_common(struct ufs_hba *hba) in ufs_hisi_init_common() argument
472 struct device *dev = hba->dev; in ufs_hisi_init_common()
479 host->hba = hba; in ufs_hisi_init_common()
480 ufshcd_set_variant(hba, host); in ufs_hisi_init_common()
489 ufs_hisi_set_pm_lvl(hba); in ufs_hisi_init_common()
498 ufshcd_set_variant(hba, NULL); in ufs_hisi_init_common()
502 static int ufs_hi3660_init(struct ufs_hba *hba) in ufs_hi3660_init() argument
505 struct device *dev = hba->dev; in ufs_hi3660_init()
507 ret = ufs_hisi_init_common(hba); in ufs_hi3660_init()
513 ufs_hisi_clk_init(hba); in ufs_hi3660_init()
515 ufs_hisi_soc_init(hba); in ufs_hi3660_init()
520 static int ufs_hi3670_init(struct ufs_hba *hba) in ufs_hi3670_init() argument
523 struct device *dev = hba->dev; in ufs_hi3670_init()
526 ret = ufs_hisi_init_common(hba); in ufs_hi3670_init()
532 ufs_hisi_clk_init(hba); in ufs_hi3670_init()
534 ufs_hisi_soc_init(hba); in ufs_hi3670_init()
537 host = ufshcd_get_variant(hba); in ufs_hi3670_init()
580 struct ufs_hba *hba = platform_get_drvdata(pdev); in ufs_hisi_remove() local
582 ufshcd_remove(hba); in ufs_hisi_remove()