Lines Matching full:hba

95 static int ufs_intel_hce_enable_notify(struct ufs_hba *hba,  in ufs_intel_hce_enable_notify()  argument
99 if (status == POST_CHANGE && hba->caps & UFSHCD_CAP_CRYPTO) { in ufs_intel_hce_enable_notify()
100 u32 hce = ufshcd_readl(hba, REG_CONTROLLER_ENABLE); in ufs_intel_hce_enable_notify()
103 ufshcd_writel(hba, hce, REG_CONTROLLER_ENABLE); in ufs_intel_hce_enable_notify()
109 static int ufs_intel_disable_lcc(struct ufs_hba *hba) in ufs_intel_disable_lcc() argument
114 ufshcd_dme_get(hba, attr, &lcc_enable); in ufs_intel_disable_lcc()
116 ufshcd_disable_host_tx_lcc(hba); in ufs_intel_disable_lcc()
121 static int ufs_intel_link_startup_notify(struct ufs_hba *hba, in ufs_intel_link_startup_notify() argument
128 err = ufs_intel_disable_lcc(hba); in ufs_intel_link_startup_notify()
139 static int ufs_intel_set_lanes(struct ufs_hba *hba, u32 lanes) in ufs_intel_set_lanes() argument
141 struct ufs_pa_layer_attr pwr_info = hba->pwr_info; in ufs_intel_set_lanes()
146 ret = ufshcd_config_pwr_mode(hba, &pwr_info); in ufs_intel_set_lanes()
148 dev_err(hba->dev, "%s: Setting %u lanes, err = %d\n", in ufs_intel_set_lanes()
153 static int ufs_intel_lkf_pwr_change_notify(struct ufs_hba *hba, in ufs_intel_lkf_pwr_change_notify() argument
163 (hba->pwr_info.lane_rx != 2 || hba->pwr_info.lane_tx != 2)) in ufs_intel_lkf_pwr_change_notify()
164 ufs_intel_set_lanes(hba, 2); in ufs_intel_lkf_pwr_change_notify()
172 err = ufshcd_dme_peer_get(hba, UIC_ARG_MIB(PA_GRANULARITY), in ufs_intel_lkf_pwr_change_notify()
183 static int ufs_intel_lkf_apply_dev_quirks(struct ufs_hba *hba) in ufs_intel_lkf_apply_dev_quirks() argument
189 ret = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_GRANULARITY), &granularity); in ufs_intel_lkf_apply_dev_quirks()
193 ret = ufshcd_dme_peer_get(hba, UIC_ARG_MIB(PA_GRANULARITY), &peer_granularity); in ufs_intel_lkf_apply_dev_quirks()
197 ret = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_TACTIVATE), &pa_tactivate); in ufs_intel_lkf_apply_dev_quirks()
201 ret = ufshcd_dme_peer_get(hba, UIC_ARG_MIB(PA_TACTIVATE), &peer_pa_tactivate); in ufs_intel_lkf_apply_dev_quirks()
208 ret = ufshcd_dme_peer_set(hba, UIC_ARG_MIB(PA_TACTIVATE), new_peer_pa_tactivate); in ufs_intel_lkf_apply_dev_quirks()
223 static void intel_cache_ltr(struct ufs_hba *hba) in intel_cache_ltr() argument
225 struct intel_host *host = ufshcd_get_variant(hba); in intel_cache_ltr()
227 host->active_ltr = readl(hba->mmio_base + INTEL_ACTIVELTR); in intel_cache_ltr()
228 host->idle_ltr = readl(hba->mmio_base + INTEL_IDLELTR); in intel_cache_ltr()
233 struct ufs_hba *hba = dev_get_drvdata(dev); in intel_ltr_set() local
234 struct intel_host *host = ufshcd_get_variant(hba); in intel_ltr_set()
244 ltr = readl(hba->mmio_base + INTEL_ACTIVELTR); in intel_ltr_set()
266 writel(ltr, hba->mmio_base + INTEL_ACTIVELTR); in intel_ltr_set()
267 writel(ltr, hba->mmio_base + INTEL_IDLELTR); in intel_ltr_set()
270 intel_cache_ltr(hba); in intel_ltr_set()
287 static void intel_add_debugfs(struct ufs_hba *hba) in intel_add_debugfs() argument
289 struct dentry *dir = debugfs_create_dir(dev_name(hba->dev), NULL); in intel_add_debugfs()
290 struct intel_host *host = ufshcd_get_variant(hba); in intel_add_debugfs()
292 intel_cache_ltr(hba); in intel_add_debugfs()
299 static void intel_remove_debugfs(struct ufs_hba *hba) in intel_remove_debugfs() argument
301 struct intel_host *host = ufshcd_get_variant(hba); in intel_remove_debugfs()
306 static int ufs_intel_device_reset(struct ufs_hba *hba) in ufs_intel_device_reset() argument
308 struct intel_host *host = ufshcd_get_variant(hba); in ufs_intel_device_reset()
314 err = intel_dsm(host, hba->dev, INTEL_DSM_RESET, &result); in ufs_intel_device_reset()
318 dev_err(hba->dev, "%s: DSM error %d result %u\n", in ufs_intel_device_reset()
341 static int ufs_intel_common_init(struct ufs_hba *hba) in ufs_intel_common_init() argument
345 hba->caps |= UFSHCD_CAP_RPM_AUTOSUSPEND; in ufs_intel_common_init()
347 host = devm_kzalloc(hba->dev, sizeof(*host), GFP_KERNEL); in ufs_intel_common_init()
350 ufshcd_set_variant(hba, host); in ufs_intel_common_init()
351 intel_dsm_init(host, hba->dev); in ufs_intel_common_init()
353 if (hba->vops->device_reset) in ufs_intel_common_init()
354 hba->caps |= UFSHCD_CAP_DEEPSLEEP; in ufs_intel_common_init()
356 if (hba->vops->device_reset) in ufs_intel_common_init()
357 host->reset_gpio = ufs_intel_get_reset_gpio(hba->dev); in ufs_intel_common_init()
359 dev_err(hba->dev, "%s: failed to get reset GPIO, error %ld\n", in ufs_intel_common_init()
365 hba->caps |= UFSHCD_CAP_DEEPSLEEP; in ufs_intel_common_init()
368 intel_ltr_expose(hba->dev); in ufs_intel_common_init()
369 intel_add_debugfs(hba); in ufs_intel_common_init()
373 static void ufs_intel_common_exit(struct ufs_hba *hba) in ufs_intel_common_exit() argument
375 intel_remove_debugfs(hba); in ufs_intel_common_exit()
376 intel_ltr_hide(hba->dev); in ufs_intel_common_exit()
379 static int ufs_intel_resume(struct ufs_hba *hba, enum ufs_pm_op op) in ufs_intel_resume() argument
381 if (ufshcd_is_link_hibern8(hba)) { in ufs_intel_resume()
382 int ret = ufshcd_uic_hibern8_exit(hba); in ufs_intel_resume()
385 ufshcd_set_link_active(hba); in ufs_intel_resume()
387 dev_err(hba->dev, "%s: hibern8 exit failed %d\n", in ufs_intel_resume()
393 ufshcd_set_link_off(hba); in ufs_intel_resume()
400 static int ufs_intel_ehl_init(struct ufs_hba *hba) in ufs_intel_ehl_init() argument
402 hba->quirks |= UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8; in ufs_intel_ehl_init()
403 return ufs_intel_common_init(hba); in ufs_intel_ehl_init()
406 static int ufs_intel_lkf_init(struct ufs_hba *hba) in ufs_intel_lkf_init() argument
410 hba->nop_out_timeout = 200; in ufs_intel_lkf_init()
411 hba->quirks |= UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8; in ufs_intel_lkf_init()
412 hba->caps |= UFSHCD_CAP_CRYPTO; in ufs_intel_lkf_init()
413 err = ufs_intel_common_init(hba); in ufs_intel_lkf_init()
415 if (hba->caps & UFSHCD_CAP_DEEPSLEEP) { in ufs_intel_lkf_init()
416 hba->spm_lvl = UFS_PM_LVL_6; in ufs_intel_lkf_init()
417 hba->rpm_lvl = UFS_PM_LVL_6; in ufs_intel_lkf_init()
419 hba->spm_lvl = UFS_PM_LVL_5; in ufs_intel_lkf_init()
420 hba->rpm_lvl = UFS_PM_LVL_5; in ufs_intel_lkf_init()
425 static int ufs_intel_adl_init(struct ufs_hba *hba) in ufs_intel_adl_init() argument
427 hba->nop_out_timeout = 200; in ufs_intel_adl_init()
428 hba->quirks |= UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8; in ufs_intel_adl_init()
429 hba->caps |= UFSHCD_CAP_WB_EN; in ufs_intel_adl_init()
430 return ufs_intel_common_init(hba); in ufs_intel_adl_init()
433 static int ufs_intel_mtl_init(struct ufs_hba *hba) in ufs_intel_mtl_init() argument
435 hba->rpm_lvl = UFS_PM_LVL_2; in ufs_intel_mtl_init()
436 hba->spm_lvl = UFS_PM_LVL_2; in ufs_intel_mtl_init()
437 hba->caps |= UFSHCD_CAP_CRYPTO | UFSHCD_CAP_WB_EN; in ufs_intel_mtl_init()
438 return ufs_intel_common_init(hba); in ufs_intel_mtl_init()
441 static int ufs_qemu_get_hba_mac(struct ufs_hba *hba) in ufs_qemu_get_hba_mac() argument
446 static int ufs_qemu_mcq_config_resource(struct ufs_hba *hba) in ufs_qemu_mcq_config_resource() argument
448 hba->mcq_base = hba->mmio_base + ufshcd_mcq_queue_cfg_addr(hba); in ufs_qemu_mcq_config_resource()
453 static int ufs_qemu_op_runtime_config(struct ufs_hba *hba) in ufs_qemu_op_runtime_config() argument
458 u32 sqdao = ufsmcq_readl(hba, ufshcd_mcq_cfg_offset(REG_SQDAO, 0)); in ufs_qemu_op_runtime_config()
459 u32 sqisao = ufsmcq_readl(hba, ufshcd_mcq_cfg_offset(REG_SQISAO, 0)); in ufs_qemu_op_runtime_config()
460 u32 cqdao = ufsmcq_readl(hba, ufshcd_mcq_cfg_offset(REG_CQDAO, 0)); in ufs_qemu_op_runtime_config()
461 u32 cqisao = ufsmcq_readl(hba, ufshcd_mcq_cfg_offset(REG_CQISAO, 0)); in ufs_qemu_op_runtime_config()
463 hba->mcq_opr[OPR_SQD].offset = sqdao; in ufs_qemu_op_runtime_config()
464 hba->mcq_opr[OPR_SQIS].offset = sqisao; in ufs_qemu_op_runtime_config()
465 hba->mcq_opr[OPR_CQD].offset = cqdao; in ufs_qemu_op_runtime_config()
466 hba->mcq_opr[OPR_CQIS].offset = cqisao; in ufs_qemu_op_runtime_config()
469 opr = &hba->mcq_opr[i]; in ufs_qemu_op_runtime_config()
471 opr->base = hba->mmio_base + opr->offset; in ufs_qemu_op_runtime_config()
534 struct ufs_hba *hba = dev_get_drvdata(dev); in ufshcd_pci_restore() local
537 ufshcd_set_link_off(hba); in ufshcd_pci_restore()
550 struct ufs_hba *hba = pci_get_drvdata(pdev); in ufshcd_pci_remove() local
554 ufshcd_remove(hba); in ufshcd_pci_remove()
567 struct ufs_hba *hba; in ufshcd_pci_probe() local
585 err = ufshcd_alloc_host(&pdev->dev, &hba); in ufshcd_pci_probe()
591 hba->vops = (struct ufs_hba_variant_ops *)id->driver_data; in ufshcd_pci_probe()
593 err = ufshcd_init(hba, mmio_base, pdev->irq); in ufshcd_pci_probe()