Lines Matching full:hba

24 	void (*late_init)(struct ufs_hba *hba);
97 static int ufs_intel_hce_enable_notify(struct ufs_hba *hba, in ufs_intel_hce_enable_notify() argument
101 if (status == POST_CHANGE && hba->caps & UFSHCD_CAP_CRYPTO) { in ufs_intel_hce_enable_notify()
102 u32 hce = ufshcd_readl(hba, REG_CONTROLLER_ENABLE); in ufs_intel_hce_enable_notify()
105 ufshcd_writel(hba, hce, REG_CONTROLLER_ENABLE); in ufs_intel_hce_enable_notify()
111 static int ufs_intel_disable_lcc(struct ufs_hba *hba) in ufs_intel_disable_lcc() argument
116 ufshcd_dme_get(hba, attr, &lcc_enable); in ufs_intel_disable_lcc()
118 ufshcd_disable_host_tx_lcc(hba); in ufs_intel_disable_lcc()
123 static int ufs_intel_link_startup_notify(struct ufs_hba *hba, in ufs_intel_link_startup_notify() argument
130 err = ufs_intel_disable_lcc(hba); in ufs_intel_link_startup_notify()
141 static int ufs_intel_set_lanes(struct ufs_hba *hba, u32 lanes) in ufs_intel_set_lanes() argument
143 struct ufs_pa_layer_attr pwr_info = hba->pwr_info; in ufs_intel_set_lanes()
148 ret = ufshcd_config_pwr_mode(hba, &pwr_info); in ufs_intel_set_lanes()
150 dev_err(hba->dev, "%s: Setting %u lanes, err = %d\n", in ufs_intel_set_lanes()
155 static int ufs_intel_lkf_pwr_change_notify(struct ufs_hba *hba, in ufs_intel_lkf_pwr_change_notify() argument
165 (hba->pwr_info.lane_rx != 2 || hba->pwr_info.lane_tx != 2)) in ufs_intel_lkf_pwr_change_notify()
166 ufs_intel_set_lanes(hba, 2); in ufs_intel_lkf_pwr_change_notify()
174 err = ufshcd_dme_peer_get(hba, UIC_ARG_MIB(PA_GRANULARITY), in ufs_intel_lkf_pwr_change_notify()
185 static int ufs_intel_lkf_apply_dev_quirks(struct ufs_hba *hba) in ufs_intel_lkf_apply_dev_quirks() argument
191 ret = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_GRANULARITY), &granularity); in ufs_intel_lkf_apply_dev_quirks()
195 ret = ufshcd_dme_peer_get(hba, UIC_ARG_MIB(PA_GRANULARITY), &peer_granularity); in ufs_intel_lkf_apply_dev_quirks()
199 ret = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_TACTIVATE), &pa_tactivate); in ufs_intel_lkf_apply_dev_quirks()
203 ret = ufshcd_dme_peer_get(hba, UIC_ARG_MIB(PA_TACTIVATE), &peer_pa_tactivate); in ufs_intel_lkf_apply_dev_quirks()
210 ret = ufshcd_dme_peer_set(hba, UIC_ARG_MIB(PA_TACTIVATE), new_peer_pa_tactivate); in ufs_intel_lkf_apply_dev_quirks()
225 static void intel_cache_ltr(struct ufs_hba *hba) in intel_cache_ltr() argument
227 struct intel_host *host = ufshcd_get_variant(hba); in intel_cache_ltr()
229 host->active_ltr = readl(hba->mmio_base + INTEL_ACTIVELTR); in intel_cache_ltr()
230 host->idle_ltr = readl(hba->mmio_base + INTEL_IDLELTR); in intel_cache_ltr()
235 struct ufs_hba *hba = dev_get_drvdata(dev); in intel_ltr_set() local
236 struct intel_host *host = ufshcd_get_variant(hba); in intel_ltr_set()
246 ltr = readl(hba->mmio_base + INTEL_ACTIVELTR); in intel_ltr_set()
268 writel(ltr, hba->mmio_base + INTEL_ACTIVELTR); in intel_ltr_set()
269 writel(ltr, hba->mmio_base + INTEL_IDLELTR); in intel_ltr_set()
272 intel_cache_ltr(hba); in intel_ltr_set()
289 static void intel_add_debugfs(struct ufs_hba *hba) in intel_add_debugfs() argument
291 struct dentry *dir = debugfs_create_dir(dev_name(hba->dev), NULL); in intel_add_debugfs()
292 struct intel_host *host = ufshcd_get_variant(hba); in intel_add_debugfs()
294 intel_cache_ltr(hba); in intel_add_debugfs()
301 static void intel_remove_debugfs(struct ufs_hba *hba) in intel_remove_debugfs() argument
303 struct intel_host *host = ufshcd_get_variant(hba); in intel_remove_debugfs()
308 static int ufs_intel_device_reset(struct ufs_hba *hba) in ufs_intel_device_reset() argument
310 struct intel_host *host = ufshcd_get_variant(hba); in ufs_intel_device_reset()
316 err = intel_dsm(host, hba->dev, INTEL_DSM_RESET, &result); in ufs_intel_device_reset()
320 dev_err(hba->dev, "%s: DSM error %d result %u\n", in ufs_intel_device_reset()
343 static int ufs_intel_common_init(struct ufs_hba *hba) in ufs_intel_common_init() argument
347 hba->caps |= UFSHCD_CAP_RPM_AUTOSUSPEND; in ufs_intel_common_init()
349 host = devm_kzalloc(hba->dev, sizeof(*host), GFP_KERNEL); in ufs_intel_common_init()
352 ufshcd_set_variant(hba, host); in ufs_intel_common_init()
353 intel_dsm_init(host, hba->dev); in ufs_intel_common_init()
355 if (hba->vops->device_reset) in ufs_intel_common_init()
356 hba->caps |= UFSHCD_CAP_DEEPSLEEP; in ufs_intel_common_init()
358 if (hba->vops->device_reset) in ufs_intel_common_init()
359 host->reset_gpio = ufs_intel_get_reset_gpio(hba->dev); in ufs_intel_common_init()
361 dev_err(hba->dev, "%s: failed to get reset GPIO, error %ld\n", in ufs_intel_common_init()
367 hba->caps |= UFSHCD_CAP_DEEPSLEEP; in ufs_intel_common_init()
370 intel_ltr_expose(hba->dev); in ufs_intel_common_init()
371 intel_add_debugfs(hba); in ufs_intel_common_init()
375 static void ufs_intel_common_exit(struct ufs_hba *hba) in ufs_intel_common_exit() argument
377 intel_remove_debugfs(hba); in ufs_intel_common_exit()
378 intel_ltr_hide(hba->dev); in ufs_intel_common_exit()
381 static int ufs_intel_resume(struct ufs_hba *hba, enum ufs_pm_op op) in ufs_intel_resume() argument
383 if (ufshcd_is_link_hibern8(hba)) { in ufs_intel_resume()
384 int ret = ufshcd_uic_hibern8_exit(hba); in ufs_intel_resume()
387 ufshcd_set_link_active(hba); in ufs_intel_resume()
389 dev_err(hba->dev, "%s: hibern8 exit failed %d\n", in ufs_intel_resume()
395 ufshcd_set_link_off(hba); in ufs_intel_resume()
402 static int ufs_intel_ehl_init(struct ufs_hba *hba) in ufs_intel_ehl_init() argument
404 hba->quirks |= UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8; in ufs_intel_ehl_init()
405 return ufs_intel_common_init(hba); in ufs_intel_ehl_init()
408 static void ufs_intel_lkf_late_init(struct ufs_hba *hba) in ufs_intel_lkf_late_init() argument
411 if (hba->caps & UFSHCD_CAP_DEEPSLEEP) { in ufs_intel_lkf_late_init()
412 hba->spm_lvl = UFS_PM_LVL_6; in ufs_intel_lkf_late_init()
413 hba->rpm_lvl = UFS_PM_LVL_6; in ufs_intel_lkf_late_init()
415 hba->spm_lvl = UFS_PM_LVL_5; in ufs_intel_lkf_late_init()
416 hba->rpm_lvl = UFS_PM_LVL_5; in ufs_intel_lkf_late_init()
420 static int ufs_intel_lkf_init(struct ufs_hba *hba) in ufs_intel_lkf_init() argument
425 hba->nop_out_timeout = 200; in ufs_intel_lkf_init()
426 hba->quirks |= UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8; in ufs_intel_lkf_init()
427 hba->caps |= UFSHCD_CAP_CRYPTO; in ufs_intel_lkf_init()
428 err = ufs_intel_common_init(hba); in ufs_intel_lkf_init()
429 ufs_host = ufshcd_get_variant(hba); in ufs_intel_lkf_init()
434 static int ufs_intel_adl_init(struct ufs_hba *hba) in ufs_intel_adl_init() argument
436 hba->nop_out_timeout = 200; in ufs_intel_adl_init()
437 hba->quirks |= UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8; in ufs_intel_adl_init()
438 hba->caps |= UFSHCD_CAP_WB_EN; in ufs_intel_adl_init()
439 return ufs_intel_common_init(hba); in ufs_intel_adl_init()
442 static int ufs_intel_mtl_init(struct ufs_hba *hba) in ufs_intel_mtl_init() argument
444 hba->caps |= UFSHCD_CAP_CRYPTO | UFSHCD_CAP_WB_EN; in ufs_intel_mtl_init()
445 return ufs_intel_common_init(hba); in ufs_intel_mtl_init()
498 struct ufs_hba *hba = dev_get_drvdata(dev); in ufshcd_pci_restore() local
501 ufshcd_set_link_off(hba); in ufshcd_pci_restore()
523 struct ufs_hba *hba = pci_get_drvdata(pdev); in ufshcd_pci_remove() local
527 ufshcd_remove(hba); in ufshcd_pci_remove()
528 ufshcd_dealloc_host(hba); in ufshcd_pci_remove()
542 struct ufs_hba *hba; in ufshcd_pci_probe() local
562 err = ufshcd_alloc_host(&pdev->dev, &hba); in ufshcd_pci_probe()
568 hba->vops = (struct ufs_hba_variant_ops *)id->driver_data; in ufshcd_pci_probe()
570 err = ufshcd_init(hba, mmio_base, pdev->irq); in ufshcd_pci_probe()
573 ufshcd_dealloc_host(hba); in ufshcd_pci_probe()
577 ufs_host = ufshcd_get_variant(hba); in ufshcd_pci_probe()
579 ufs_host->late_init(hba); in ufshcd_pci_probe()