Lines Matching refs:hba

96 #define ufshcd_is_link_off(hba) ((hba)->uic_link_state == UIC_LINK_OFF_STATE)  argument
97 #define ufshcd_is_link_active(hba) ((hba)->uic_link_state == \ argument
99 #define ufshcd_is_link_hibern8(hba) ((hba)->uic_link_state == \ argument
101 #define ufshcd_is_link_broken(hba) ((hba)->uic_link_state == \ argument
103 #define ufshcd_set_link_off(hba) ((hba)->uic_link_state = UIC_LINK_OFF_STATE) argument
104 #define ufshcd_set_link_active(hba) ((hba)->uic_link_state = \ argument
106 #define ufshcd_set_link_hibern8(hba) ((hba)->uic_link_state = \ argument
108 #define ufshcd_set_link_broken(hba) ((hba)->uic_link_state = \ argument
328 void (*setup_xfer_req)(struct ufs_hba *hba, int tag,
333 int (*apply_dev_quirks)(struct ufs_hba *hba);
334 void (*fixup_dev_quirks)(struct ufs_hba *hba);
338 void (*dbg_register_dump)(struct ufs_hba *hba);
340 int (*device_reset)(struct ufs_hba *hba);
341 void (*config_scaling_param)(struct ufs_hba *hba,
344 int (*program_key)(struct ufs_hba *hba,
346 void (*event_notify)(struct ufs_hba *hba,
349 int (*mcq_config_resource)(struct ufs_hba *hba);
350 int (*get_hba_mac)(struct ufs_hba *hba);
351 int (*op_runtime_config)(struct ufs_hba *hba);
352 int (*get_outstanding_cqs)(struct ufs_hba *hba,
354 int (*config_esi)(struct ufs_hba *hba);
1116 static inline bool is_mcq_enabled(struct ufs_hba *hba) in is_mcq_enabled() argument
1118 return hba->mcq_enabled; in is_mcq_enabled()
1122 static inline size_t ufshcd_sg_entry_size(const struct ufs_hba *hba) in ufshcd_sg_entry_size() argument
1124 return hba->sg_entry_size; in ufshcd_sg_entry_size()
1127 static inline void ufshcd_set_sg_entry_size(struct ufs_hba *hba, size_t sg_entry_size) in ufshcd_set_sg_entry_size() argument
1130 hba->sg_entry_size = sg_entry_size; in ufshcd_set_sg_entry_size()
1133 static inline size_t ufshcd_sg_entry_size(const struct ufs_hba *hba) in ufshcd_sg_entry_size() argument
1138 #define ufshcd_set_sg_entry_size(hba, sg_entry_size) \ argument
1139 ({ (void)(hba); BUILD_BUG_ON(sg_entry_size != sizeof(struct ufshcd_sg_entry)); })
1142 static inline size_t sizeof_utp_transfer_cmd_desc(const struct ufs_hba *hba) in sizeof_utp_transfer_cmd_desc() argument
1144 return sizeof(struct utp_transfer_cmd_desc) + SG_ALL * ufshcd_sg_entry_size(hba); in sizeof_utp_transfer_cmd_desc()
1148 static inline bool ufshcd_is_clkgating_allowed(struct ufs_hba *hba) in ufshcd_is_clkgating_allowed() argument
1150 return hba->caps & UFSHCD_CAP_CLK_GATING; in ufshcd_is_clkgating_allowed()
1152 static inline bool ufshcd_can_hibern8_during_gating(struct ufs_hba *hba) in ufshcd_can_hibern8_during_gating() argument
1154 return hba->caps & UFSHCD_CAP_HIBERN8_WITH_CLK_GATING; in ufshcd_can_hibern8_during_gating()
1156 static inline int ufshcd_is_clkscaling_supported(struct ufs_hba *hba) in ufshcd_is_clkscaling_supported() argument
1158 return hba->caps & UFSHCD_CAP_CLK_SCALING; in ufshcd_is_clkscaling_supported()
1160 static inline bool ufshcd_can_autobkops_during_suspend(struct ufs_hba *hba) in ufshcd_can_autobkops_during_suspend() argument
1162 return hba->caps & UFSHCD_CAP_AUTO_BKOPS_SUSPEND; in ufshcd_can_autobkops_during_suspend()
1164 static inline bool ufshcd_is_rpm_autosuspend_allowed(struct ufs_hba *hba) in ufshcd_is_rpm_autosuspend_allowed() argument
1166 return hba->caps & UFSHCD_CAP_RPM_AUTOSUSPEND; in ufshcd_is_rpm_autosuspend_allowed()
1169 static inline bool ufshcd_is_intr_aggr_allowed(struct ufs_hba *hba) in ufshcd_is_intr_aggr_allowed() argument
1171 return (hba->caps & UFSHCD_CAP_INTR_AGGR) && in ufshcd_is_intr_aggr_allowed()
1172 !(hba->quirks & UFSHCD_QUIRK_BROKEN_INTR_AGGR); in ufshcd_is_intr_aggr_allowed()
1175 static inline bool ufshcd_can_aggressive_pc(struct ufs_hba *hba) in ufshcd_can_aggressive_pc() argument
1177 return !!(ufshcd_is_link_hibern8(hba) && in ufshcd_can_aggressive_pc()
1178 (hba->caps & UFSHCD_CAP_AGGR_POWER_COLLAPSE)); in ufshcd_can_aggressive_pc()
1181 static inline bool ufshcd_is_auto_hibern8_supported(struct ufs_hba *hba) in ufshcd_is_auto_hibern8_supported() argument
1183 return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) && in ufshcd_is_auto_hibern8_supported()
1184 !(hba->quirks & UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8); in ufshcd_is_auto_hibern8_supported()
1187 static inline bool ufshcd_is_auto_hibern8_enabled(struct ufs_hba *hba) in ufshcd_is_auto_hibern8_enabled() argument
1189 return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit); in ufshcd_is_auto_hibern8_enabled()
1192 static inline bool ufshcd_is_wb_allowed(struct ufs_hba *hba) in ufshcd_is_wb_allowed() argument
1194 return hba->caps & UFSHCD_CAP_WB_EN; in ufshcd_is_wb_allowed()
1197 static inline bool ufshcd_enable_wb_if_scaling_up(struct ufs_hba *hba) in ufshcd_enable_wb_if_scaling_up() argument
1199 return hba->caps & UFSHCD_CAP_WB_WITH_CLK_SCALING; in ufshcd_enable_wb_if_scaling_up()
1202 #define ufsmcq_writel(hba, val, reg) \ argument
1203 writel((val), (hba)->mcq_base + (reg))
1204 #define ufsmcq_readl(hba, reg) \ argument
1205 readl((hba)->mcq_base + (reg))
1207 #define ufsmcq_writelx(hba, val, reg) \ argument
1208 writel_relaxed((val), (hba)->mcq_base + (reg))
1209 #define ufsmcq_readlx(hba, reg) \ argument
1210 readl_relaxed((hba)->mcq_base + (reg))
1212 #define ufshcd_writel(hba, val, reg) \ argument
1213 writel((val), (hba)->mmio_base + (reg))
1214 #define ufshcd_readl(hba, reg) \ argument
1215 readl((hba)->mmio_base + (reg))
1224 static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg) in ufshcd_rmwl() argument
1228 tmp = ufshcd_readl(hba, reg); in ufshcd_rmwl()
1231 ufshcd_writel(hba, tmp, reg); in ufshcd_rmwl()
1236 int ufshcd_hba_enable(struct ufs_hba *hba);
1238 int ufshcd_link_recovery(struct ufs_hba *hba);
1239 int ufshcd_make_hba_operational(struct ufs_hba *hba);
1241 int ufshcd_uic_hibern8_enter(struct ufs_hba *hba);
1242 int ufshcd_uic_hibern8_exit(struct ufs_hba *hba);
1244 void ufshcd_parse_dev_ref_clk_freq(struct ufs_hba *hba, struct clk *refclk);
1245 void ufshcd_update_evt_hist(struct ufs_hba *hba, u32 id, u32 val);
1246 void ufshcd_hba_stop(struct ufs_hba *hba);
1247 void ufshcd_schedule_eh_work(struct ufs_hba *hba);
1248 void ufshcd_mcq_write_cqis(struct ufs_hba *hba, u32 val, int i);
1249 unsigned long ufshcd_mcq_poll_cqe_nolock(struct ufs_hba *hba,
1251 void ufshcd_mcq_enable_esi(struct ufs_hba *hba);
1252 void ufshcd_mcq_config_esi(struct ufs_hba *hba, struct msi_msg *msg);
1259 static inline void ufshcd_set_variant(struct ufs_hba *hba, void *variant) in ufshcd_set_variant() argument
1261 BUG_ON(!hba); in ufshcd_set_variant()
1262 hba->priv = variant; in ufshcd_set_variant()
1269 static inline void *ufshcd_get_variant(struct ufs_hba *hba) in ufshcd_get_variant() argument
1271 BUG_ON(!hba); in ufshcd_get_variant()
1272 return hba->priv; in ufshcd_get_variant()
1286 extern int ufshcd_shutdown(struct ufs_hba *hba);
1288 extern int ufshcd_dme_configure_adapt(struct ufs_hba *hba,
1291 extern int ufshcd_dme_set_attr(struct ufs_hba *hba, u32 attr_sel,
1293 extern int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel,
1295 extern int ufshcd_config_pwr_mode(struct ufs_hba *hba,
1297 extern int ufshcd_uic_change_pwr_mode(struct ufs_hba *hba, u8 mode);
1305 static inline int ufshcd_dme_set(struct ufs_hba *hba, u32 attr_sel, in ufshcd_dme_set() argument
1308 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_NOR, in ufshcd_dme_set()
1312 static inline int ufshcd_dme_st_set(struct ufs_hba *hba, u32 attr_sel, in ufshcd_dme_st_set() argument
1315 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_ST, in ufshcd_dme_st_set()
1319 static inline int ufshcd_dme_peer_set(struct ufs_hba *hba, u32 attr_sel, in ufshcd_dme_peer_set() argument
1322 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_NOR, in ufshcd_dme_peer_set()
1326 static inline int ufshcd_dme_peer_st_set(struct ufs_hba *hba, u32 attr_sel, in ufshcd_dme_peer_st_set() argument
1329 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_ST, in ufshcd_dme_peer_st_set()
1333 static inline int ufshcd_dme_get(struct ufs_hba *hba, in ufshcd_dme_get() argument
1336 return ufshcd_dme_get_attr(hba, attr_sel, mib_val, DME_LOCAL); in ufshcd_dme_get()
1339 static inline int ufshcd_dme_peer_get(struct ufs_hba *hba, in ufshcd_dme_peer_get() argument
1342 return ufshcd_dme_get_attr(hba, attr_sel, mib_val, DME_PEER); in ufshcd_dme_peer_get()
1353 static inline int ufshcd_disable_host_tx_lcc(struct ufs_hba *hba) in ufshcd_disable_host_tx_lcc() argument
1355 return ufshcd_dme_set(hba, UIC_ARG_MIB(PA_LOCAL_TX_LCC_ENABLE), 0); in ufshcd_disable_host_tx_lcc()
1358 void ufshcd_auto_hibern8_enable(struct ufs_hba *hba);
1359 void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit);
1360 void ufshcd_fixup_dev_quirks(struct ufs_hba *hba,
1364 int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,
1367 int ufshcd_hold(struct ufs_hba *hba, bool async);
1368 void ufshcd_release(struct ufs_hba *hba);
1372 u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba);
1376 int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd);
1378 int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
1384 int ufshcd_advanced_rpmb_req_handler(struct ufs_hba *hba, struct utp_upiu_req *req_upiu,
1388 int ufshcd_wb_toggle(struct ufs_hba *hba, bool enable);
1389 int ufshcd_wb_toggle_buf_flush(struct ufs_hba *hba, bool enable);
1395 static inline int ufshcd_vops_init(struct ufs_hba *hba) in ufshcd_vops_init() argument
1397 if (hba->vops && hba->vops->init) in ufshcd_vops_init()
1398 return hba->vops->init(hba); in ufshcd_vops_init()
1403 static inline int ufshcd_vops_phy_initialization(struct ufs_hba *hba) in ufshcd_vops_phy_initialization() argument
1405 if (hba->vops && hba->vops->phy_initialization) in ufshcd_vops_phy_initialization()
1406 return hba->vops->phy_initialization(hba); in ufshcd_vops_phy_initialization()
1413 int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
1416 int __ufshcd_write_ee_control(struct ufs_hba *hba, u32 ee_ctrl_mask);
1417 int ufshcd_write_ee_control(struct ufs_hba *hba);
1418 int ufshcd_update_ee_control(struct ufs_hba *hba, u16 *mask,