/** * cdns_ufs_set_hclkdiv() - set HCLKDIV register value based on the core_clk. * @hba: host controller instance * * Return: zero for success and non-zero for failure.
*/ staticint cdns_ufs_set_hclkdiv(struct ufs_hba *hba)
{ struct ufs_clk_info *clki; struct list_head *head = &hba->clk_list_head; unsignedlong core_clk_rate = 0;
u32 core_clk_div = 0;
if (list_empty(head)) return 0;
list_for_each_entry(clki, head, list) { if (IS_ERR_OR_NULL(clki->clk)) continue; if (!strcmp(clki->name, "core_clk"))
core_clk_rate = clk_get_rate(clki->clk);
}
if (!core_clk_rate) {
dev_err(hba->dev, "%s: unable to find core_clk rate\n",
__func__); return -EINVAL;
}
core_clk_div = core_clk_rate / USEC_PER_SEC;
ufshcd_writel(hba, core_clk_div, CDNS_UFS_REG_HCLKDIV); /** * Make sure the register was updated, * UniPro layer will not work with an incorrect value.
*/
ufshcd_readl(hba, CDNS_UFS_REG_HCLKDIV);
return 0;
}
/** * cdns_ufs_hce_enable_notify() - set HCLKDIV register * @hba: host controller instance * @status: notify stage (pre, post change) * * Return: zero for success and non-zero for failure.
*/ staticint cdns_ufs_hce_enable_notify(struct ufs_hba *hba, enum ufs_notify_change_status status)
{ if (status != PRE_CHANGE) return 0;
/** * cdns_ufs_link_startup_notify() - handle link startup. * @hba: host controller instance * @status: notify stage (pre, post change) * * Return: zero for success and non-zero for failure.
*/ staticint cdns_ufs_link_startup_notify(struct ufs_hba *hba, enum ufs_notify_change_status status)
{ if (status != PRE_CHANGE) return 0;
/* * Some UFS devices have issues if LCC is enabled. * So we are setting PA_Local_TX_LCC_Enable to 0 * before link startup which will make sure that both host * and device TX LCC are disabled once link startup is * completed.
*/
ufshcd_disable_host_tx_lcc(hba);
/* * Disabling Autohibern8 feature in cadence UFS * to mask unexpected interrupt trigger.
*/
hba->ahit = 0;
return 0;
}
/** * cdns_ufs_init - performs additional ufs initialization * @hba: host controller instance * * Return: status of initialization.
*/ staticint cdns_ufs_init(struct ufs_hba *hba)
{ int status = 0; struct cdns_ufs_host *host; struct device *dev = hba->dev;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.