Lines Matching refs:hba

97 #define ufshcd_is_link_off(hba) ((hba)->uic_link_state == UIC_LINK_OFF_STATE)  argument
98 #define ufshcd_is_link_active(hba) ((hba)->uic_link_state == \ argument
100 #define ufshcd_is_link_hibern8(hba) ((hba)->uic_link_state == \ argument
102 #define ufshcd_is_link_broken(hba) ((hba)->uic_link_state == \ argument
104 #define ufshcd_set_link_off(hba) ((hba)->uic_link_state = UIC_LINK_OFF_STATE) argument
105 #define ufshcd_set_link_active(hba) ((hba)->uic_link_state = \ argument
107 #define ufshcd_set_link_hibern8(hba) ((hba)->uic_link_state = \ argument
109 #define ufshcd_set_link_broken(hba) ((hba)->uic_link_state = \ argument
347 void (*setup_xfer_req)(struct ufs_hba *hba, int tag,
352 int (*apply_dev_quirks)(struct ufs_hba *hba);
353 void (*fixup_dev_quirks)(struct ufs_hba *hba);
357 void (*dbg_register_dump)(struct ufs_hba *hba);
359 int (*device_reset)(struct ufs_hba *hba);
360 void (*config_scaling_param)(struct ufs_hba *hba,
363 int (*program_key)(struct ufs_hba *hba,
365 void (*event_notify)(struct ufs_hba *hba,
368 int (*mcq_config_resource)(struct ufs_hba *hba);
369 int (*get_hba_mac)(struct ufs_hba *hba);
370 int (*op_runtime_config)(struct ufs_hba *hba);
371 int (*get_outstanding_cqs)(struct ufs_hba *hba,
373 int (*config_esi)(struct ufs_hba *hba);
1115 static inline bool is_mcq_enabled(struct ufs_hba *hba) in is_mcq_enabled() argument
1117 return hba->mcq_enabled; in is_mcq_enabled()
1121 static inline size_t ufshcd_sg_entry_size(const struct ufs_hba *hba) in ufshcd_sg_entry_size() argument
1123 return hba->sg_entry_size; in ufshcd_sg_entry_size()
1126 static inline void ufshcd_set_sg_entry_size(struct ufs_hba *hba, size_t sg_entry_size) in ufshcd_set_sg_entry_size() argument
1129 hba->sg_entry_size = sg_entry_size; in ufshcd_set_sg_entry_size()
1132 static inline size_t ufshcd_sg_entry_size(const struct ufs_hba *hba) in ufshcd_sg_entry_size() argument
1137 #define ufshcd_set_sg_entry_size(hba, sg_entry_size) \ argument
1138 ({ (void)(hba); BUILD_BUG_ON(sg_entry_size != sizeof(struct ufshcd_sg_entry)); })
1141 static inline size_t ufshcd_get_ucd_size(const struct ufs_hba *hba) in ufshcd_get_ucd_size() argument
1143 return sizeof(struct utp_transfer_cmd_desc) + SG_ALL * ufshcd_sg_entry_size(hba); in ufshcd_get_ucd_size()
1147 static inline bool ufshcd_is_clkgating_allowed(struct ufs_hba *hba) in ufshcd_is_clkgating_allowed() argument
1149 return hba->caps & UFSHCD_CAP_CLK_GATING; in ufshcd_is_clkgating_allowed()
1151 static inline bool ufshcd_can_hibern8_during_gating(struct ufs_hba *hba) in ufshcd_can_hibern8_during_gating() argument
1153 return hba->caps & UFSHCD_CAP_HIBERN8_WITH_CLK_GATING; in ufshcd_can_hibern8_during_gating()
1155 static inline int ufshcd_is_clkscaling_supported(struct ufs_hba *hba) in ufshcd_is_clkscaling_supported() argument
1157 return hba->caps & UFSHCD_CAP_CLK_SCALING; in ufshcd_is_clkscaling_supported()
1159 static inline bool ufshcd_can_autobkops_during_suspend(struct ufs_hba *hba) in ufshcd_can_autobkops_during_suspend() argument
1161 return hba->caps & UFSHCD_CAP_AUTO_BKOPS_SUSPEND; in ufshcd_can_autobkops_during_suspend()
1163 static inline bool ufshcd_is_rpm_autosuspend_allowed(struct ufs_hba *hba) in ufshcd_is_rpm_autosuspend_allowed() argument
1165 return hba->caps & UFSHCD_CAP_RPM_AUTOSUSPEND; in ufshcd_is_rpm_autosuspend_allowed()
1168 static inline bool ufshcd_is_intr_aggr_allowed(struct ufs_hba *hba) in ufshcd_is_intr_aggr_allowed() argument
1170 return (hba->caps & UFSHCD_CAP_INTR_AGGR) && in ufshcd_is_intr_aggr_allowed()
1171 !(hba->quirks & UFSHCD_QUIRK_BROKEN_INTR_AGGR); in ufshcd_is_intr_aggr_allowed()
1174 static inline bool ufshcd_can_aggressive_pc(struct ufs_hba *hba) in ufshcd_can_aggressive_pc() argument
1176 return !!(ufshcd_is_link_hibern8(hba) && in ufshcd_can_aggressive_pc()
1177 (hba->caps & UFSHCD_CAP_AGGR_POWER_COLLAPSE)); in ufshcd_can_aggressive_pc()
1180 static inline bool ufshcd_is_auto_hibern8_supported(struct ufs_hba *hba) in ufshcd_is_auto_hibern8_supported() argument
1182 return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) && in ufshcd_is_auto_hibern8_supported()
1183 !(hba->quirks & UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8); in ufshcd_is_auto_hibern8_supported()
1186 static inline bool ufshcd_is_auto_hibern8_enabled(struct ufs_hba *hba) in ufshcd_is_auto_hibern8_enabled() argument
1188 return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit); in ufshcd_is_auto_hibern8_enabled()
1191 static inline bool ufshcd_is_wb_allowed(struct ufs_hba *hba) in ufshcd_is_wb_allowed() argument
1193 return hba->caps & UFSHCD_CAP_WB_EN; in ufshcd_is_wb_allowed()
1196 static inline bool ufshcd_enable_wb_if_scaling_up(struct ufs_hba *hba) in ufshcd_enable_wb_if_scaling_up() argument
1198 return hba->caps & UFSHCD_CAP_WB_WITH_CLK_SCALING; in ufshcd_enable_wb_if_scaling_up()
1201 #define ufsmcq_writel(hba, val, reg) \ argument
1202 writel((val), (hba)->mcq_base + (reg))
1203 #define ufsmcq_readl(hba, reg) \ argument
1204 readl((hba)->mcq_base + (reg))
1206 #define ufsmcq_writelx(hba, val, reg) \ argument
1207 writel_relaxed((val), (hba)->mcq_base + (reg))
1208 #define ufsmcq_readlx(hba, reg) \ argument
1209 readl_relaxed((hba)->mcq_base + (reg))
1211 #define ufshcd_writel(hba, val, reg) \ argument
1212 writel((val), (hba)->mmio_base + (reg))
1213 #define ufshcd_readl(hba, reg) \ argument
1214 readl((hba)->mmio_base + (reg))
1223 static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg) in ufshcd_rmwl() argument
1227 tmp = ufshcd_readl(hba, reg); in ufshcd_rmwl()
1230 ufshcd_writel(hba, tmp, reg); in ufshcd_rmwl()
1235 int ufshcd_hba_enable(struct ufs_hba *hba);
1237 int ufshcd_link_recovery(struct ufs_hba *hba);
1238 int ufshcd_make_hba_operational(struct ufs_hba *hba);
1240 int ufshcd_uic_hibern8_enter(struct ufs_hba *hba);
1241 int ufshcd_uic_hibern8_exit(struct ufs_hba *hba);
1243 void ufshcd_parse_dev_ref_clk_freq(struct ufs_hba *hba, struct clk *refclk);
1244 void ufshcd_update_evt_hist(struct ufs_hba *hba, u32 id, u32 val);
1245 void ufshcd_hba_stop(struct ufs_hba *hba);
1246 void ufshcd_schedule_eh_work(struct ufs_hba *hba);
1247 void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32 max_active_cmds);
1248 u32 ufshcd_mcq_read_cqis(struct ufs_hba *hba, int i);
1249 void ufshcd_mcq_write_cqis(struct ufs_hba *hba, u32 val, int i);
1250 unsigned long ufshcd_mcq_poll_cqe_lock(struct ufs_hba *hba,
1252 void ufshcd_mcq_make_queues_operational(struct ufs_hba *hba);
1253 void ufshcd_mcq_enable_esi(struct ufs_hba *hba);
1254 void ufshcd_mcq_config_esi(struct ufs_hba *hba, struct msi_msg *msg);
1261 static inline void ufshcd_set_variant(struct ufs_hba *hba, void *variant) in ufshcd_set_variant() argument
1263 BUG_ON(!hba); in ufshcd_set_variant()
1264 hba->priv = variant; in ufshcd_set_variant()
1271 static inline void *ufshcd_get_variant(struct ufs_hba *hba) in ufshcd_get_variant() argument
1273 BUG_ON(!hba); in ufshcd_get_variant()
1274 return hba->priv; in ufshcd_get_variant()
1289 extern int ufshcd_dme_configure_adapt(struct ufs_hba *hba,
1292 extern int ufshcd_dme_set_attr(struct ufs_hba *hba, u32 attr_sel,
1294 extern int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel,
1296 extern int ufshcd_config_pwr_mode(struct ufs_hba *hba,
1298 extern int ufshcd_uic_change_pwr_mode(struct ufs_hba *hba, u8 mode);
1306 static inline int ufshcd_dme_set(struct ufs_hba *hba, u32 attr_sel, in ufshcd_dme_set() argument
1309 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_NOR, in ufshcd_dme_set()
1313 static inline int ufshcd_dme_st_set(struct ufs_hba *hba, u32 attr_sel, in ufshcd_dme_st_set() argument
1316 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_ST, in ufshcd_dme_st_set()
1320 static inline int ufshcd_dme_peer_set(struct ufs_hba *hba, u32 attr_sel, in ufshcd_dme_peer_set() argument
1323 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_NOR, in ufshcd_dme_peer_set()
1327 static inline int ufshcd_dme_peer_st_set(struct ufs_hba *hba, u32 attr_sel, in ufshcd_dme_peer_st_set() argument
1330 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_ST, in ufshcd_dme_peer_st_set()
1334 static inline int ufshcd_dme_get(struct ufs_hba *hba, in ufshcd_dme_get() argument
1337 return ufshcd_dme_get_attr(hba, attr_sel, mib_val, DME_LOCAL); in ufshcd_dme_get()
1340 static inline int ufshcd_dme_peer_get(struct ufs_hba *hba, in ufshcd_dme_peer_get() argument
1343 return ufshcd_dme_get_attr(hba, attr_sel, mib_val, DME_PEER); in ufshcd_dme_peer_get()
1354 static inline int ufshcd_disable_host_tx_lcc(struct ufs_hba *hba) in ufshcd_disable_host_tx_lcc() argument
1356 return ufshcd_dme_set(hba, UIC_ARG_MIB(PA_LOCAL_TX_LCC_ENABLE), 0); in ufshcd_disable_host_tx_lcc()
1359 void ufshcd_auto_hibern8_enable(struct ufs_hba *hba);
1360 void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit);
1361 void ufshcd_fixup_dev_quirks(struct ufs_hba *hba,
1365 int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,
1368 void ufshcd_hold(struct ufs_hba *hba);
1369 void ufshcd_release(struct ufs_hba *hba);
1373 u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba);
1377 int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd);
1379 int ufshcd_advanced_rpmb_req_handler(struct ufs_hba *hba, struct utp_upiu_req *req_upiu,
1383 int ufshcd_wb_toggle(struct ufs_hba *hba, bool enable);
1384 int ufshcd_wb_toggle_buf_flush(struct ufs_hba *hba, bool enable);
1388 bool ufshcd_is_hba_active(struct ufs_hba *hba);
1391 static inline int ufshcd_vops_init(struct ufs_hba *hba) in ufshcd_vops_init() argument
1393 if (hba->vops && hba->vops->init) in ufshcd_vops_init()
1394 return hba->vops->init(hba); in ufshcd_vops_init()
1399 static inline int ufshcd_vops_phy_initialization(struct ufs_hba *hba) in ufshcd_vops_phy_initialization() argument
1401 if (hba->vops && hba->vops->phy_initialization) in ufshcd_vops_phy_initialization()
1402 return hba->vops->phy_initialization(hba); in ufshcd_vops_phy_initialization()
1409 int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
1412 int __ufshcd_write_ee_control(struct ufs_hba *hba, u32 ee_ctrl_mask);
1413 int ufshcd_write_ee_control(struct ufs_hba *hba);
1414 int ufshcd_update_ee_control(struct ufs_hba *hba, u16 *mask,