Loading drivers/scsi/ufs/ufshcd.c +21 −12 Original line number Diff line number Diff line Loading @@ -4339,7 +4339,6 @@ out: static void ufshcd_init_icc_levels(struct ufs_hba *hba) { u32 icc_level; int ret; int buff_len = QUERY_DESC_POWER_MAX_SIZE; u8 desc_buf[QUERY_DESC_POWER_MAX_SIZE]; Loading @@ -4353,16 +4352,21 @@ static void ufshcd_init_icc_levels(struct ufs_hba *hba) return; } icc_level = ufshcd_find_max_sup_active_icc_level(hba, desc_buf, buff_len); hba->init_prefetch_data.icc_level = ufshcd_find_max_sup_active_icc_level(hba, desc_buf, buff_len); dev_dbg(hba->dev, "%s: setting icc_level 0x%x", __func__, hba->init_prefetch_data.icc_level); ret = ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_WRITE_ATTR, QUERY_ATTR_IDN_ACTIVE_ICC_LVL, 0, 0, &icc_level); QUERY_ATTR_IDN_ACTIVE_ICC_LVL, 0, 0, &hba->init_prefetch_data.icc_level); if (ret) dev_err(hba->dev, "%s: Failed configuring bActiveICCLevel = %d ret = %d", __func__, icc_level , ret); __func__, hba->init_prefetch_data.icc_level , ret); } /** Loading Loading @@ -4421,6 +4425,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) if (ret) goto out; if (!hba->is_init_prefetch) { ret = ufshcd_get_device_ref_clk(hba); if (ret) { dev_err(hba->dev, Loading @@ -4428,6 +4433,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) __func__); ret = 0; } } /* UFS device is also active now */ ufshcd_set_ufs_dev_active(hba); Loading @@ -4451,14 +4457,17 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) if (!ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_READ_FLAG, QUERY_FLAG_IDN_PWR_ON_WPE, &flag)) hba->dev_info.f_power_on_wp_en = flag; if (!hba->is_init_prefetch) ufshcd_init_icc_levels(hba); scsi_scan_host(hba->host); pm_runtime_put_sync(hba->dev); } /* Resume devfreq after UFS device is detected */ if (ufshcd_is_clkscaling_enabled(hba)) devfreq_resume_device(hba->devfreq); if (!hba->is_init_prefetch) hba->is_init_prefetch = true; out: /* * If we failed to initialize the device or the device is not Loading drivers/scsi/ufs/ufshcd.h +13 −0 Original line number Diff line number Diff line Loading @@ -341,6 +341,15 @@ struct ufs_clk_scaling { unsigned long window_start_t; }; /** * struct ufs_init_prefetch - contains data that is pre-fetched once during * initialization * @icc_level: icc level which was read during initialization */ struct ufs_init_prefetch { u32 icc_level; }; /** * struct ufs_hba - per adapter private structure * @mmio_base: UFSHCI base register address Loading Loading @@ -375,6 +384,8 @@ struct ufs_clk_scaling { * @intr_mask: Interrupt Mask Bits * @ee_ctrl_mask: Exception event control mask * @is_powered: flag to check if HBA is powered * @is_init_prefetch: flag to check if data was pre-fetched in initialization * @init_prefetch_data: data pre-fetched during initialization * @eh_work: Worker to handle UFS errors that require s/w attention * @eeh_work: Worker to handle exception events * @errors: HBA errors Loading Loading @@ -484,6 +495,8 @@ struct ufs_hba { u32 intr_mask; u16 ee_ctrl_mask; bool is_powered; bool is_init_prefetch; struct ufs_init_prefetch init_prefetch_data; /* Work Queues */ struct work_struct eh_work; Loading Loading
drivers/scsi/ufs/ufshcd.c +21 −12 Original line number Diff line number Diff line Loading @@ -4339,7 +4339,6 @@ out: static void ufshcd_init_icc_levels(struct ufs_hba *hba) { u32 icc_level; int ret; int buff_len = QUERY_DESC_POWER_MAX_SIZE; u8 desc_buf[QUERY_DESC_POWER_MAX_SIZE]; Loading @@ -4353,16 +4352,21 @@ static void ufshcd_init_icc_levels(struct ufs_hba *hba) return; } icc_level = ufshcd_find_max_sup_active_icc_level(hba, desc_buf, buff_len); hba->init_prefetch_data.icc_level = ufshcd_find_max_sup_active_icc_level(hba, desc_buf, buff_len); dev_dbg(hba->dev, "%s: setting icc_level 0x%x", __func__, hba->init_prefetch_data.icc_level); ret = ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_WRITE_ATTR, QUERY_ATTR_IDN_ACTIVE_ICC_LVL, 0, 0, &icc_level); QUERY_ATTR_IDN_ACTIVE_ICC_LVL, 0, 0, &hba->init_prefetch_data.icc_level); if (ret) dev_err(hba->dev, "%s: Failed configuring bActiveICCLevel = %d ret = %d", __func__, icc_level , ret); __func__, hba->init_prefetch_data.icc_level , ret); } /** Loading Loading @@ -4421,6 +4425,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) if (ret) goto out; if (!hba->is_init_prefetch) { ret = ufshcd_get_device_ref_clk(hba); if (ret) { dev_err(hba->dev, Loading @@ -4428,6 +4433,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) __func__); ret = 0; } } /* UFS device is also active now */ ufshcd_set_ufs_dev_active(hba); Loading @@ -4451,14 +4457,17 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) if (!ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_READ_FLAG, QUERY_FLAG_IDN_PWR_ON_WPE, &flag)) hba->dev_info.f_power_on_wp_en = flag; if (!hba->is_init_prefetch) ufshcd_init_icc_levels(hba); scsi_scan_host(hba->host); pm_runtime_put_sync(hba->dev); } /* Resume devfreq after UFS device is detected */ if (ufshcd_is_clkscaling_enabled(hba)) devfreq_resume_device(hba->devfreq); if (!hba->is_init_prefetch) hba->is_init_prefetch = true; out: /* * If we failed to initialize the device or the device is not Loading
drivers/scsi/ufs/ufshcd.h +13 −0 Original line number Diff line number Diff line Loading @@ -341,6 +341,15 @@ struct ufs_clk_scaling { unsigned long window_start_t; }; /** * struct ufs_init_prefetch - contains data that is pre-fetched once during * initialization * @icc_level: icc level which was read during initialization */ struct ufs_init_prefetch { u32 icc_level; }; /** * struct ufs_hba - per adapter private structure * @mmio_base: UFSHCI base register address Loading Loading @@ -375,6 +384,8 @@ struct ufs_clk_scaling { * @intr_mask: Interrupt Mask Bits * @ee_ctrl_mask: Exception event control mask * @is_powered: flag to check if HBA is powered * @is_init_prefetch: flag to check if data was pre-fetched in initialization * @init_prefetch_data: data pre-fetched during initialization * @eh_work: Worker to handle UFS errors that require s/w attention * @eeh_work: Worker to handle exception events * @errors: HBA errors Loading Loading @@ -484,6 +495,8 @@ struct ufs_hba { u32 intr_mask; u16 ee_ctrl_mask; bool is_powered; bool is_init_prefetch; struct ufs_init_prefetch init_prefetch_data; /* Work Queues */ struct work_struct eh_work; Loading