Lines Matching full:hba
100 #define ufshcd_is_link_off(hba) ((hba)->uic_link_state == UIC_LINK_OFF_STATE) argument
101 #define ufshcd_is_link_active(hba) ((hba)->uic_link_state == \ argument
103 #define ufshcd_is_link_hibern8(hba) ((hba)->uic_link_state == \ argument
105 #define ufshcd_is_link_broken(hba) ((hba)->uic_link_state == \ argument
107 #define ufshcd_set_link_off(hba) ((hba)->uic_link_state = UIC_LINK_OFF_STATE) argument
108 #define ufshcd_set_link_active(hba) ((hba)->uic_link_state = \ argument
110 #define ufshcd_set_link_hibern8(hba) ((hba)->uic_link_state = \ argument
112 #define ufshcd_set_link_broken(hba) ((hba)->uic_link_state = \ argument
255 * @list: list headed by hba->clk_list_head
360 void (*setup_xfer_req)(struct ufs_hba *hba, int tag,
365 int (*apply_dev_quirks)(struct ufs_hba *hba);
366 void (*fixup_dev_quirks)(struct ufs_hba *hba);
370 void (*dbg_register_dump)(struct ufs_hba *hba);
372 int (*device_reset)(struct ufs_hba *hba);
373 void (*config_scaling_param)(struct ufs_hba *hba,
376 int (*fill_crypto_prdt)(struct ufs_hba *hba,
379 void (*event_notify)(struct ufs_hba *hba,
381 int (*mcq_config_resource)(struct ufs_hba *hba);
382 int (*get_hba_mac)(struct ufs_hba *hba);
383 int (*op_runtime_config)(struct ufs_hba *hba);
384 int (*get_outstanding_cqs)(struct ufs_hba *hba,
386 int (*config_esi)(struct ufs_hba *hba);
388 u32 (*freq_to_gear_speed)(struct ufs_hba *hba, unsigned long freq);
753 * support device hardware reset via the hba->device_reset() callback,
895 * @is_powered: flag to check if HBA is powered
901 * @errors: HBA errors
944 * @crypto_profile: the crypto profile of this hba (if applicable)
1055 /* HBA Errors */
1187 static inline unsigned int ufshcd_mcq_opr_offset(struct ufs_hba *hba, in ufshcd_mcq_opr_offset() argument
1190 return hba->mcq_opr[opr].offset + hba->mcq_opr[opr].stride * idx; in ufshcd_mcq_opr_offset()
1199 static inline size_t ufshcd_sg_entry_size(const struct ufs_hba *hba) in ufshcd_sg_entry_size() argument
1201 return hba->sg_entry_size; in ufshcd_sg_entry_size()
1204 static inline void ufshcd_set_sg_entry_size(struct ufs_hba *hba, size_t sg_entry_size) in ufshcd_set_sg_entry_size() argument
1207 hba->sg_entry_size = sg_entry_size; in ufshcd_set_sg_entry_size()
1210 static inline size_t ufshcd_sg_entry_size(const struct ufs_hba *hba) in ufshcd_sg_entry_size() argument
1215 #define ufshcd_set_sg_entry_size(hba, sg_entry_size) \ argument
1216 ({ (void)(hba); BUILD_BUG_ON(sg_entry_size != sizeof(struct ufshcd_sg_entry)); })
1227 static inline size_t ufshcd_get_ucd_size(const struct ufs_hba *hba) in ufshcd_get_ucd_size() argument
1229 return sizeof(struct utp_transfer_cmd_desc) + SG_ALL * ufshcd_sg_entry_size(hba); in ufshcd_get_ucd_size()
1233 static inline bool ufshcd_is_clkgating_allowed(struct ufs_hba *hba) in ufshcd_is_clkgating_allowed() argument
1235 return hba->caps & UFSHCD_CAP_CLK_GATING; in ufshcd_is_clkgating_allowed()
1237 static inline bool ufshcd_can_hibern8_during_gating(struct ufs_hba *hba) in ufshcd_can_hibern8_during_gating() argument
1239 return hba->caps & UFSHCD_CAP_HIBERN8_WITH_CLK_GATING; in ufshcd_can_hibern8_during_gating()
1241 static inline int ufshcd_is_clkscaling_supported(struct ufs_hba *hba) in ufshcd_is_clkscaling_supported() argument
1243 return hba->caps & UFSHCD_CAP_CLK_SCALING; in ufshcd_is_clkscaling_supported()
1245 static inline bool ufshcd_can_autobkops_during_suspend(struct ufs_hba *hba) in ufshcd_can_autobkops_during_suspend() argument
1247 return hba->caps & UFSHCD_CAP_AUTO_BKOPS_SUSPEND; in ufshcd_can_autobkops_during_suspend()
1249 static inline bool ufshcd_is_rpm_autosuspend_allowed(struct ufs_hba *hba) in ufshcd_is_rpm_autosuspend_allowed() argument
1251 return hba->caps & UFSHCD_CAP_RPM_AUTOSUSPEND; in ufshcd_is_rpm_autosuspend_allowed()
1254 static inline bool ufshcd_is_intr_aggr_allowed(struct ufs_hba *hba) in ufshcd_is_intr_aggr_allowed() argument
1256 return (hba->caps & UFSHCD_CAP_INTR_AGGR) && in ufshcd_is_intr_aggr_allowed()
1257 !(hba->quirks & UFSHCD_QUIRK_BROKEN_INTR_AGGR); in ufshcd_is_intr_aggr_allowed()
1260 static inline bool ufshcd_can_aggressive_pc(struct ufs_hba *hba) in ufshcd_can_aggressive_pc() argument
1262 return !!(ufshcd_is_link_hibern8(hba) && in ufshcd_can_aggressive_pc()
1263 (hba->caps & UFSHCD_CAP_AGGR_POWER_COLLAPSE)); in ufshcd_can_aggressive_pc()
1266 static inline bool ufshcd_is_auto_hibern8_supported(struct ufs_hba *hba) in ufshcd_is_auto_hibern8_supported() argument
1268 return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) && in ufshcd_is_auto_hibern8_supported()
1269 !(hba->quirks & UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8); in ufshcd_is_auto_hibern8_supported()
1272 static inline bool ufshcd_is_auto_hibern8_enabled(struct ufs_hba *hba) in ufshcd_is_auto_hibern8_enabled() argument
1274 return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit); in ufshcd_is_auto_hibern8_enabled()
1277 static inline bool ufshcd_is_wb_allowed(struct ufs_hba *hba) in ufshcd_is_wb_allowed() argument
1279 return hba->caps & UFSHCD_CAP_WB_EN; in ufshcd_is_wb_allowed()
1282 static inline bool ufshcd_enable_wb_if_scaling_up(struct ufs_hba *hba) in ufshcd_enable_wb_if_scaling_up() argument
1284 return hba->caps & UFSHCD_CAP_WB_WITH_CLK_SCALING; in ufshcd_enable_wb_if_scaling_up()
1287 #define ufsmcq_writel(hba, val, reg) \ argument
1288 writel((val), (hba)->mcq_base + (reg))
1289 #define ufsmcq_readl(hba, reg) \ argument
1290 readl((hba)->mcq_base + (reg))
1292 #define ufsmcq_writelx(hba, val, reg) \ argument
1293 writel_relaxed((val), (hba)->mcq_base + (reg))
1294 #define ufsmcq_readlx(hba, reg) \ argument
1295 readl_relaxed((hba)->mcq_base + (reg))
1297 #define ufshcd_writel(hba, val, reg) \ argument
1298 writel((val), (hba)->mmio_base + (reg))
1299 #define ufshcd_readl(hba, reg) \ argument
1300 readl((hba)->mmio_base + (reg))
1304 * @hba: per adapter instance
1309 static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg) in ufshcd_rmwl() argument
1313 tmp = ufshcd_readl(hba, reg); in ufshcd_rmwl()
1316 ufshcd_writel(hba, tmp, reg); in ufshcd_rmwl()
1319 void ufshcd_enable_irq(struct ufs_hba *hba);
1320 void ufshcd_disable_irq(struct ufs_hba *hba);
1322 int ufshcd_hba_enable(struct ufs_hba *hba);
1324 int ufshcd_link_recovery(struct ufs_hba *hba);
1325 int ufshcd_make_hba_operational(struct ufs_hba *hba);
1327 int ufshcd_uic_hibern8_enter(struct ufs_hba *hba);
1328 int ufshcd_uic_hibern8_exit(struct ufs_hba *hba);
1330 void ufshcd_parse_dev_ref_clk_freq(struct ufs_hba *hba, struct clk *refclk);
1331 void ufshcd_update_evt_hist(struct ufs_hba *hba, u32 id, u32 val);
1332 void ufshcd_hba_stop(struct ufs_hba *hba);
1333 void ufshcd_schedule_eh_work(struct ufs_hba *hba);
1334 void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32 max_active_cmds);
1335 unsigned int ufshcd_mcq_queue_cfg_addr(struct ufs_hba *hba);
1336 u32 ufshcd_mcq_read_cqis(struct ufs_hba *hba, int i);
1337 void ufshcd_mcq_write_cqis(struct ufs_hba *hba, u32 val, int i);
1338 unsigned long ufshcd_mcq_poll_cqe_lock(struct ufs_hba *hba,
1340 void ufshcd_mcq_make_queues_operational(struct ufs_hba *hba);
1341 void ufshcd_mcq_enable(struct ufs_hba *hba);
1342 void ufshcd_mcq_enable_esi(struct ufs_hba *hba);
1343 void ufshcd_mcq_config_esi(struct ufs_hba *hba, struct msi_msg *msg);
1349 * ufshcd_set_variant - set variant specific data to the hba
1350 * @hba: per adapter instance
1353 static inline void ufshcd_set_variant(struct ufs_hba *hba, void *variant) in ufshcd_set_variant() argument
1355 BUG_ON(!hba); in ufshcd_set_variant()
1356 hba->priv = variant; in ufshcd_set_variant()
1360 * ufshcd_get_variant - get variant specific data from the hba
1361 * @hba: per adapter instance
1363 static inline void *ufshcd_get_variant(struct ufs_hba *hba) in ufshcd_get_variant() argument
1365 BUG_ON(!hba); in ufshcd_get_variant()
1366 return hba->priv; in ufshcd_get_variant()
1381 extern int ufshcd_dme_reset(struct ufs_hba *hba);
1382 extern int ufshcd_dme_enable(struct ufs_hba *hba);
1383 extern int ufshcd_dme_configure_adapt(struct ufs_hba *hba,
1386 extern int ufshcd_dme_set_attr(struct ufs_hba *hba, u32 attr_sel,
1388 extern int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel,
1390 extern int ufshcd_config_pwr_mode(struct ufs_hba *hba,
1392 extern int ufshcd_uic_change_pwr_mode(struct ufs_hba *hba, u8 mode);
1400 static inline int ufshcd_dme_set(struct ufs_hba *hba, u32 attr_sel, in ufshcd_dme_set() argument
1403 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_NOR, in ufshcd_dme_set()
1407 static inline int ufshcd_dme_st_set(struct ufs_hba *hba, u32 attr_sel, in ufshcd_dme_st_set() argument
1410 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_ST, in ufshcd_dme_st_set()
1414 static inline int ufshcd_dme_peer_set(struct ufs_hba *hba, u32 attr_sel, in ufshcd_dme_peer_set() argument
1417 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_NOR, in ufshcd_dme_peer_set()
1421 static inline int ufshcd_dme_peer_st_set(struct ufs_hba *hba, u32 attr_sel, in ufshcd_dme_peer_st_set() argument
1424 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_ST, in ufshcd_dme_peer_st_set()
1428 static inline int ufshcd_dme_get(struct ufs_hba *hba, in ufshcd_dme_get() argument
1431 return ufshcd_dme_get_attr(hba, attr_sel, mib_val, DME_LOCAL); in ufshcd_dme_get()
1434 static inline int ufshcd_dme_peer_get(struct ufs_hba *hba, in ufshcd_dme_peer_get() argument
1437 return ufshcd_dme_get_attr(hba, attr_sel, mib_val, DME_PEER); in ufshcd_dme_peer_get()
1448 static inline int ufshcd_disable_host_tx_lcc(struct ufs_hba *hba) in ufshcd_disable_host_tx_lcc() argument
1450 return ufshcd_dme_set(hba, UIC_ARG_MIB(PA_LOCAL_TX_LCC_ENABLE), 0); in ufshcd_disable_host_tx_lcc()
1453 void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit);
1454 void ufshcd_fixup_dev_quirks(struct ufs_hba *hba,
1458 int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,
1461 void ufshcd_hold(struct ufs_hba *hba);
1462 void ufshcd_release(struct ufs_hba *hba);
1468 int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd);
1470 int ufshcd_advanced_rpmb_req_handler(struct ufs_hba *hba, struct utp_upiu_req *req_upiu,
1474 int ufshcd_wb_toggle(struct ufs_hba *hba, bool enable);
1475 int ufshcd_wb_toggle_buf_flush(struct ufs_hba *hba, bool enable);
1476 int ufshcd_wb_set_resize_en(struct ufs_hba *hba, enum wb_resize_en en_mode);
1480 bool ufshcd_is_hba_active(struct ufs_hba *hba);
1481 void ufshcd_pm_qos_init(struct ufs_hba *hba);
1482 void ufshcd_pm_qos_exit(struct ufs_hba *hba);
1483 int ufshcd_dme_rmw(struct ufs_hba *hba, u32 mask, u32 val, u32 attr);
1486 static inline int ufshcd_vops_init(struct ufs_hba *hba) in ufshcd_vops_init() argument
1488 if (hba->vops && hba->vops->init) in ufshcd_vops_init()
1489 return hba->vops->init(hba); in ufshcd_vops_init()
1494 static inline int ufshcd_vops_phy_initialization(struct ufs_hba *hba) in ufshcd_vops_phy_initialization() argument
1496 if (hba->vops && hba->vops->phy_initialization) in ufshcd_vops_phy_initialization()
1497 return hba->vops->phy_initialization(hba); in ufshcd_vops_phy_initialization()
1504 int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
1507 int __ufshcd_write_ee_control(struct ufs_hba *hba, u32 ee_ctrl_mask);
1508 int ufshcd_write_ee_control(struct ufs_hba *hba);
1509 int ufshcd_update_ee_control(struct ufs_hba *hba, u16 *mask,