mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
Merge patch series "ufs: Add callback for vendor-specific RTT capability"
ed.tsai@mediatek.com says: The first patch adds the get_hba_nortt() callback to the UFS core layer, allowing vendor drivers to provide dynamic, platform-specific RTT capability handling. The second patch implements this callback in the MediaTek UFS driver, distinguishing between legacy platforms (which require the RTT to be limited to 2) and newer MT6995 B0+ platforms (which can use the value from the capability register directly). The third patch removes the max_num_rtt field from ufs_hba_variant_ops as it is now replaced by the get_hba_nortt() callback. Link: https://patch.msgid.link/20260615055802.105479-1-ed.tsai@mediatek.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
commit
35457edc5b
|
|
@ -2506,7 +2506,10 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)
|
|||
hba->nutmrs =
|
||||
((hba->capabilities & MASK_TASK_MANAGEMENT_REQUEST_SLOTS) >> 16) + 1;
|
||||
|
||||
hba->nortt = FIELD_GET(MASK_NUMBER_OUTSTANDING_RTT, hba->capabilities) + 1;
|
||||
if (hba->vops && hba->vops->get_hba_nortt)
|
||||
hba->nortt = hba->vops->get_hba_nortt(hba);
|
||||
else
|
||||
hba->nortt = FIELD_GET(MASK_NUMBER_OUTSTANDING_RTT, hba->capabilities) + 1;
|
||||
|
||||
/* Read crypto capabilities */
|
||||
err = ufshcd_hba_init_crypto_capabilities(hba);
|
||||
|
|
@ -8611,8 +8614,6 @@ static void ufshcd_set_rtt(struct ufs_hba *hba)
|
|||
struct ufs_dev_info *dev_info = &hba->dev_info;
|
||||
u32 rtt = 0;
|
||||
u32 dev_rtt = 0;
|
||||
int host_rtt_cap = hba->vops && hba->vops->max_num_rtt ?
|
||||
hba->vops->max_num_rtt : hba->nortt;
|
||||
|
||||
/* RTT override makes sense only for UFS-4.0 and above */
|
||||
if (dev_info->wspecversion < 0x400)
|
||||
|
|
@ -8628,7 +8629,7 @@ static void ufshcd_set_rtt(struct ufs_hba *hba)
|
|||
if (dev_rtt != DEFAULT_MAX_NUM_RTT)
|
||||
return;
|
||||
|
||||
rtt = min_t(int, dev_info->rtt_cap, host_rtt_cap);
|
||||
rtt = min_t(int, dev_info->rtt_cap, hba->nortt);
|
||||
|
||||
if (rtt == dev_rtt)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -2183,6 +2183,16 @@ static int ufs_mtk_clk_scale_notify(struct ufs_hba *hba, bool scale_up,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ufs_mtk_get_hba_nortt(struct ufs_hba *hba)
|
||||
{
|
||||
struct ufs_mtk_host *host = ufshcd_get_variant(hba);
|
||||
|
||||
if (host->legacy_ip_ver || host->ip_ver < IP_VER_MT6995_B0)
|
||||
return MTK_MAX_NUM_RTT_LEGACY;
|
||||
|
||||
return FIELD_GET(MASK_NUMBER_OUTSTANDING_RTT, hba->capabilities) + 1;
|
||||
}
|
||||
|
||||
static int ufs_mtk_get_hba_mac(struct ufs_hba *hba)
|
||||
{
|
||||
struct ufs_mtk_host *host = ufshcd_get_variant(hba);
|
||||
|
|
@ -2322,7 +2332,6 @@ static void ufs_mtk_config_scsi_dev(struct scsi_device *sdev)
|
|||
*/
|
||||
static const struct ufs_hba_variant_ops ufs_hba_mtk_vops = {
|
||||
.name = "mediatek.ufshci",
|
||||
.max_num_rtt = MTK_MAX_NUM_RTT,
|
||||
.init = ufs_mtk_init,
|
||||
.get_ufs_hci_version = ufs_mtk_get_ufs_hci_version,
|
||||
.setup_clocks = ufs_mtk_setup_clocks,
|
||||
|
|
@ -2339,6 +2348,7 @@ static const struct ufs_hba_variant_ops ufs_hba_mtk_vops = {
|
|||
.event_notify = ufs_mtk_event_notify,
|
||||
.config_scaling_param = ufs_mtk_config_scaling_param,
|
||||
.clk_scale_notify = ufs_mtk_clk_scale_notify,
|
||||
.get_hba_nortt = ufs_mtk_get_hba_nortt,
|
||||
/* mcq vops */
|
||||
.get_hba_mac = ufs_mtk_get_hba_mac,
|
||||
.op_runtime_config = ufs_mtk_op_runtime_config,
|
||||
|
|
|
|||
|
|
@ -203,8 +203,8 @@ struct ufs_mtk_host {
|
|||
/* MTK delay of autosuspend: 500 ms */
|
||||
#define MTK_RPM_AUTOSUSPEND_DELAY_MS 500
|
||||
|
||||
/* MTK RTT support number */
|
||||
#define MTK_MAX_NUM_RTT 2
|
||||
/* MTK RTT support number for platforms before MT6995 B0 */
|
||||
#define MTK_MAX_NUM_RTT_LEGACY 2
|
||||
|
||||
/* UFSHCI MTK ip version value */
|
||||
enum {
|
||||
|
|
|
|||
|
|
@ -374,7 +374,6 @@ struct ufshcd_tx_eq_params {
|
|||
/**
|
||||
* struct ufs_hba_variant_ops - variant specific callbacks
|
||||
* @name: variant name
|
||||
* @max_num_rtt: maximum RTT supported by the host
|
||||
* @init: called when the driver is initialized
|
||||
* @exit: called to cleanup everything done in init
|
||||
* @set_dma_mask: For setting another DMA mask than indicated by the 64AS
|
||||
|
|
@ -419,10 +418,11 @@ struct ufshcd_tx_eq_params {
|
|||
* @get_rx_fom: called to get Figure of Merit (FOM) value.
|
||||
* @tx_eqtr_notify: called before and after TX Equalization Training procedure
|
||||
* to allow platform vendor specific configs to take place.
|
||||
* @get_hba_nortt: called to get maximum number of outstanding RTTs supported by
|
||||
* the controller.
|
||||
*/
|
||||
struct ufs_hba_variant_ops {
|
||||
const char *name;
|
||||
int max_num_rtt;
|
||||
int (*init)(struct ufs_hba *);
|
||||
void (*exit)(struct ufs_hba *);
|
||||
u32 (*get_ufs_hci_version)(struct ufs_hba *);
|
||||
|
|
@ -481,6 +481,7 @@ struct ufs_hba_variant_ops {
|
|||
int (*tx_eqtr_notify)(struct ufs_hba *hba,
|
||||
enum ufs_notify_change_status status,
|
||||
struct ufs_pa_layer_attr *pwr_mode);
|
||||
int (*get_hba_nortt)(struct ufs_hba *hba);
|
||||
};
|
||||
|
||||
/* clock gating state */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user