Lines Matching refs:hba

98 #define ufshcd_is_link_off(hba) ((hba)->uic_link_state == UIC_LINK_OFF_STATE)
99 #define ufshcd_is_link_active(hba) ((hba)->uic_link_state == \
101 #define ufshcd_is_link_hibern8(hba) ((hba)->uic_link_state == \
103 #define ufshcd_is_link_broken(hba) ((hba)->uic_link_state == \
105 #define ufshcd_set_link_off(hba) ((hba)->uic_link_state = UIC_LINK_OFF_STATE)
106 #define ufshcd_set_link_active(hba) ((hba)->uic_link_state = \
108 #define ufshcd_set_link_hibern8(hba) ((hba)->uic_link_state = \
110 #define ufshcd_set_link_broken(hba) ((hba)->uic_link_state = \
226 * @list: list headed by hba->clk_list_head
318 int (*apply_dev_quirks)(struct ufs_hba *hba);
319 void (*fixup_dev_quirks)(struct ufs_hba *hba);
322 void (*dbg_register_dump)(struct ufs_hba *hba);
324 int (*device_reset)(struct ufs_hba *hba);
325 void (*config_scaling_param)(struct ufs_hba *hba,
328 int (*program_key)(struct ufs_hba *hba,
631 * @cmd_queue: Used to allocate command tags from hba->host->tag_set.
676 * @ksm: the keyslot manager tied to this hba
814 static inline bool ufshcd_is_clkgating_allowed(struct ufs_hba *hba)
816 return hba->caps & UFSHCD_CAP_CLK_GATING;
818 static inline bool ufshcd_can_hibern8_during_gating(struct ufs_hba *hba)
820 return hba->caps & UFSHCD_CAP_HIBERN8_WITH_CLK_GATING;
822 static inline int ufshcd_is_clkscaling_supported(struct ufs_hba *hba)
824 return hba->caps & UFSHCD_CAP_CLK_SCALING;
826 static inline bool ufshcd_can_autobkops_during_suspend(struct ufs_hba *hba)
828 return hba->caps & UFSHCD_CAP_AUTO_BKOPS_SUSPEND;
830 static inline bool ufshcd_is_rpm_autosuspend_allowed(struct ufs_hba *hba)
832 return hba->caps & UFSHCD_CAP_RPM_AUTOSUSPEND;
835 static inline bool ufshcd_is_intr_aggr_allowed(struct ufs_hba *hba)
839 if ((hba->caps & UFSHCD_CAP_INTR_AGGR) &&
840 !(hba->quirks & UFSHCD_QUIRK_BROKEN_INTR_AGGR))
849 static inline bool ufshcd_is_auto_hibern8_supported(struct ufs_hba *hba)
851 return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) &&
852 !(hba->quirks & UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8);
855 static inline bool ufshcd_is_auto_hibern8_enabled(struct ufs_hba *hba)
857 return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit) ? true : false;
860 static inline bool ufshcd_is_wb_allowed(struct ufs_hba *hba)
862 return hba->caps & UFSHCD_CAP_WB_EN;
865 #define ufshcd_writel(hba, val, reg) \
866 writel((val), (hba)->mmio_base + (reg))
867 #define ufshcd_readl(hba, reg) \
868 readl((hba)->mmio_base + (reg))
872 * @hba - per adapter instance
877 static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg)
881 tmp = ufshcd_readl(hba, reg);
884 ufshcd_writel(hba, tmp, reg);
889 int ufshcd_hba_enable(struct ufs_hba *hba);
891 int ufshcd_link_recovery(struct ufs_hba *hba);
892 int ufshcd_make_hba_operational(struct ufs_hba *hba);
894 int ufshcd_uic_hibern8_exit(struct ufs_hba *hba);
896 int ufshcd_wait_for_register(struct ufs_hba *hba, u32 reg, u32 mask,
899 void ufshcd_parse_dev_ref_clk_freq(struct ufs_hba *hba, struct clk *refclk);
910 * ufshcd_set_variant - set variant specific data to the hba
911 * @hba - per adapter instance
914 static inline void ufshcd_set_variant(struct ufs_hba *hba, void *variant)
916 BUG_ON(!hba);
917 hba->priv = variant;
921 * ufshcd_get_variant - get variant specific data from the hba
922 * @hba - per adapter instance
924 static inline void *ufshcd_get_variant(struct ufs_hba *hba)
926 BUG_ON(!hba);
927 return hba->priv;
930 struct ufs_hba *hba)
932 return hba->caps & UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND;
935 static inline u8 ufshcd_wb_get_query_index(struct ufs_hba *hba)
937 if (hba->dev_info.b_wb_buffer_type == WB_BUF_MODE_LU_DEDICATED)
938 return hba->dev_info.wb_dedicated_lu;
942 extern int ufshcd_runtime_suspend(struct ufs_hba *hba);
943 extern int ufshcd_runtime_resume(struct ufs_hba *hba);
944 extern int ufshcd_runtime_idle(struct ufs_hba *hba);
945 extern int ufshcd_system_suspend(struct ufs_hba *hba);
946 extern int ufshcd_system_resume(struct ufs_hba *hba);
947 extern int ufshcd_shutdown(struct ufs_hba *hba);
948 extern int ufshcd_dme_set_attr(struct ufs_hba *hba, u32 attr_sel,
950 extern int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel,
952 extern int ufshcd_config_pwr_mode(struct ufs_hba *hba,
961 static inline int ufshcd_dme_set(struct ufs_hba *hba, u32 attr_sel,
964 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_NOR,
968 static inline int ufshcd_dme_st_set(struct ufs_hba *hba, u32 attr_sel,
971 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_ST,
975 static inline int ufshcd_dme_peer_set(struct ufs_hba *hba, u32 attr_sel,
978 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_NOR,
982 static inline int ufshcd_dme_peer_st_set(struct ufs_hba *hba, u32 attr_sel,
985 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_ST,
989 static inline int ufshcd_dme_get(struct ufs_hba *hba,
992 return ufshcd_dme_get_attr(hba, attr_sel, mib_val, DME_LOCAL);
995 static inline int ufshcd_dme_peer_get(struct ufs_hba *hba,
998 return ufshcd_dme_get_attr(hba, attr_sel, mib_val, DME_PEER);
1009 static inline int ufshcd_disable_host_tx_lcc(struct ufs_hba *hba)
1011 return ufshcd_dme_set(hba, UIC_ARG_MIB(PA_LOCAL_TX_LCC_ENABLE), 0);
1015 int ufshcd_query_descriptor_retry(struct ufs_hba *hba,
1020 int ufshcd_read_desc_param(struct ufs_hba *hba,
1026 int ufshcd_query_attr(struct ufs_hba *hba, enum query_opcode opcode,
1028 int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode,
1031 void ufshcd_auto_hibern8_enable(struct ufs_hba *hba);
1032 void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit);
1033 void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, struct ufs_dev_fix *fixups);
1036 int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,
1039 int ufshcd_hold(struct ufs_hba *hba, bool async);
1040 void ufshcd_release(struct ufs_hba *hba);
1042 void ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id,
1045 u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba);
1047 int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd);
1049 int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
1057 static inline const char *ufshcd_get_var_name(struct ufs_hba *hba)
1059 if (hba->vops)
1060 return hba->vops->name;
1064 static inline int ufshcd_vops_init(struct ufs_hba *hba)
1066 if (hba->vops && hba->vops->init)
1067 return hba->vops->init(hba);
1072 static inline void ufshcd_vops_exit(struct ufs_hba *hba)
1074 if (hba->vops && hba->vops->exit)
1075 return hba->vops->exit(hba);
1078 static inline u32 ufshcd_vops_get_ufs_hci_version(struct ufs_hba *hba)
1080 if (hba->vops && hba->vops->get_ufs_hci_version)
1081 return hba->vops->get_ufs_hci_version(hba);
1083 return ufshcd_readl(hba, REG_UFS_VERSION);
1086 static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba,
1089 if (hba->vops && hba->vops->clk_scale_notify)
1090 return hba->vops->clk_scale_notify(hba, up, status);
1094 static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, bool on,
1097 if (hba->vops && hba->vops->setup_clocks)
1098 return hba->vops->setup_clocks(hba, on, status);
1102 static inline int ufshcd_vops_setup_regulators(struct ufs_hba *hba, bool status)
1104 if (hba->vops && hba->vops->setup_regulators)
1105 return hba->vops->setup_regulators(hba, status);
1110 static inline int ufshcd_vops_hce_enable_notify(struct ufs_hba *hba,
1113 if (hba->vops && hba->vops->hce_enable_notify)
1114 return hba->vops->hce_enable_notify(hba, status);
1118 static inline int ufshcd_vops_link_startup_notify(struct ufs_hba *hba,
1121 if (hba->vops && hba->vops->link_startup_notify)
1122 return hba->vops->link_startup_notify(hba, status);
1127 static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba,
1132 if (hba->vops && hba->vops->pwr_change_notify)
1133 return hba->vops->pwr_change_notify(hba, status,
1139 static inline void ufshcd_vops_setup_xfer_req(struct ufs_hba *hba, int tag,
1142 if (hba->vops && hba->vops->setup_xfer_req)
1143 return hba->vops->setup_xfer_req(hba, tag, is_scsi_cmd);
1146 static inline void ufshcd_vops_setup_task_mgmt(struct ufs_hba *hba,
1149 if (hba->vops && hba->vops->setup_task_mgmt)
1150 return hba->vops->setup_task_mgmt(hba, tag, tm_function);
1153 static inline void ufshcd_vops_hibern8_notify(struct ufs_hba *hba,
1157 if (hba->vops && hba->vops->hibern8_notify)
1158 return hba->vops->hibern8_notify(hba, cmd, status);
1161 static inline int ufshcd_vops_apply_dev_quirks(struct ufs_hba *hba)
1163 if (hba->vops && hba->vops->apply_dev_quirks)
1164 return hba->vops->apply_dev_quirks(hba);
1168 static inline void ufshcd_vops_fixup_dev_quirks(struct ufs_hba *hba)
1170 if (hba->vops && hba->vops->fixup_dev_quirks)
1171 hba->vops->fixup_dev_quirks(hba);
1174 static inline int ufshcd_vops_suspend(struct ufs_hba *hba, enum ufs_pm_op op)
1176 if (hba->vops && hba->vops->suspend)
1177 return hba->vops->suspend(hba, op);
1182 static inline int ufshcd_vops_resume(struct ufs_hba *hba, enum ufs_pm_op op)
1184 if (hba->vops && hba->vops->resume)
1185 return hba->vops->resume(hba, op);
1190 static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba)
1192 if (hba->vops && hba->vops->dbg_register_dump)
1193 hba->vops->dbg_register_dump(hba);
1196 static inline void ufshcd_vops_device_reset(struct ufs_hba *hba)
1198 if (hba->vops && hba->vops->device_reset) {
1199 int err = hba->vops->device_reset(hba);
1202 ufshcd_set_ufs_dev_active(hba);
1203 if (ufshcd_is_wb_allowed(hba)) {
1204 hba->wb_enabled = false;
1205 hba->wb_buf_flush_enabled = false;
1209 ufshcd_update_reg_hist(&hba->ufs_stats.dev_reset, err);
1213 static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba,
1217 if (hba->vops && hba->vops->config_scaling_param)
1218 hba->vops->config_scaling_param(hba, profile, data);
1238 int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,