Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: ufs: Remove support for old UFSHCI versions

UFS spec version 2.1 was published more than 10 years ago. It is
vanishingly unlikely that even there are out there platforms that uses
earlier host controllers, let alone that those ancient platforms will ever
run a V6.10 kernel. To be extra cautious, leave out removal of UFSHCI 2.0
support from this patch, and just remove support of host controllers prior
to UFS2.0.

This patch removes some legacy tuning calls that no longer apply.

Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20240410183720.908-2-avri.altman@wdc.com
Acked-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Avri Altman and committed by
Martin K. Petersen
a33a502d e63350da

+15 -161
+13 -145
drivers/ufs/core/ufshcd.c
··· 748 748 */ 749 749 static inline u32 ufshcd_get_intr_mask(struct ufs_hba *hba) 750 750 { 751 - if (hba->ufs_version == ufshci_version(1, 0)) 752 - return INTERRUPT_MASK_ALL_VER_10; 753 751 if (hba->ufs_version <= ufshci_version(2, 0)) 754 752 return INTERRUPT_MASK_ALL_VER_11; 755 753 ··· 987 989 return ufshcd_readl(hba, REG_CONTROLLER_ENABLE) & CONTROLLER_ENABLE; 988 990 } 989 991 EXPORT_SYMBOL_GPL(ufshcd_is_hba_active); 990 - 991 - u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba) 992 - { 993 - /* HCI version 1.0 and 1.1 supports UniPro 1.41 */ 994 - if (hba->ufs_version <= ufshci_version(1, 1)) 995 - return UFS_UNIPRO_VER_1_41; 996 - else 997 - return UFS_UNIPRO_VER_1_6; 998 - } 999 - EXPORT_SYMBOL(ufshcd_get_local_unipro_ver); 1000 - 1001 - static bool ufshcd_is_unipro_pa_params_tuning_req(struct ufs_hba *hba) 1002 - { 1003 - /* 1004 - * If both host and device support UniPro ver1.6 or later, PA layer 1005 - * parameters tuning happens during link startup itself. 1006 - * 1007 - * We can manually tune PA layer parameters if either host or device 1008 - * doesn't support UniPro ver 1.6 or later. But to keep manual tuning 1009 - * logic simple, we will only do manual tuning if local unipro version 1010 - * doesn't support ver1.6 or later. 1011 - */ 1012 - return ufshcd_get_local_unipro_ver(hba) < UFS_UNIPRO_VER_1_6; 1013 - } 1014 992 1015 993 /** 1016 994 * ufshcd_pm_qos_init - initialize PM QoS request ··· 2648 2674 { 2649 2675 u32 set = ufshcd_readl(hba, REG_INTERRUPT_ENABLE); 2650 2676 2651 - if (hba->ufs_version == ufshci_version(1, 0)) { 2652 - u32 rw; 2653 - rw = set & INTERRUPT_MASK_RW_VER_10; 2654 - set = rw | ((set ^ intrs) & intrs); 2655 - } else { 2656 - set |= intrs; 2657 - } 2658 - 2677 + set |= intrs; 2659 2678 ufshcd_writel(hba, set, REG_INTERRUPT_ENABLE); 2660 2679 } 2661 2680 ··· 2661 2694 { 2662 2695 u32 set = ufshcd_readl(hba, REG_INTERRUPT_ENABLE); 2663 2696 2664 - if (hba->ufs_version == ufshci_version(1, 0)) { 2665 - u32 rw; 2666 - rw = (set & INTERRUPT_MASK_RW_VER_10) & 2667 - ~(intrs & INTERRUPT_MASK_RW_VER_10); 2668 - set = rw | ((set & intrs) & ~INTERRUPT_MASK_RW_VER_10); 2669 - 2670 - } else { 2671 - set &= ~intrs; 2672 - } 2673 - 2697 + set &= ~intrs; 2674 2698 ufshcd_writel(hba, set, REG_INTERRUPT_ENABLE); 2675 2699 } 2676 2700 ··· 2673 2715 * @upiu_flags: flags required in the header 2674 2716 * @cmd_dir: requests data direction 2675 2717 * @ehs_length: Total EHS Length (in 32‐bytes units of all Extra Header Segments) 2676 - * @legacy_type: UTP_CMD_TYPE_SCSI or UTP_CMD_TYPE_DEV_MANAGE 2677 2718 */ 2678 2719 static void 2679 2720 ufshcd_prepare_req_desc_hdr(struct ufs_hba *hba, struct ufshcd_lrb *lrbp, 2680 2721 u8 *upiu_flags, enum dma_data_direction cmd_dir, 2681 - int ehs_length, enum utp_cmd_type legacy_type) 2722 + int ehs_length) 2682 2723 { 2683 2724 struct utp_transfer_req_desc *req_desc = lrbp->utr_descriptor_ptr; 2684 2725 struct request_desc_header *h = &req_desc->header; 2685 2726 enum utp_data_direction data_direction; 2686 2727 2687 - if (hba->ufs_version <= ufshci_version(1, 1)) 2688 - lrbp->command_type = legacy_type; 2689 - else 2690 - lrbp->command_type = UTP_CMD_TYPE_UFS_STORAGE; 2728 + lrbp->command_type = UTP_CMD_TYPE_UFS_STORAGE; 2691 2729 2692 2730 *h = (typeof(*h)){ }; 2693 2731 ··· 2817 2863 u8 upiu_flags; 2818 2864 int ret = 0; 2819 2865 2820 - ufshcd_prepare_req_desc_hdr(hba, lrbp, &upiu_flags, DMA_NONE, 0, UTP_CMD_TYPE_DEV_MANAGE); 2866 + ufshcd_prepare_req_desc_hdr(hba, lrbp, &upiu_flags, DMA_NONE, 0); 2821 2867 2822 2868 if (hba->dev_cmd.type == DEV_CMD_TYPE_QUERY) 2823 2869 ufshcd_prepare_utp_query_req_upiu(hba, lrbp, upiu_flags); ··· 2841 2887 unsigned int ioprio_class = IOPRIO_PRIO_CLASS(req_get_ioprio(rq)); 2842 2888 u8 upiu_flags; 2843 2889 2844 - ufshcd_prepare_req_desc_hdr(hba, lrbp, &upiu_flags, 2845 - lrbp->cmd->sc_data_direction, 0, UTP_CMD_TYPE_SCSI); 2890 + ufshcd_prepare_req_desc_hdr(hba, lrbp, &upiu_flags, lrbp->cmd->sc_data_direction, 0); 2846 2891 if (ioprio_class == IOPRIO_CLASS_RT) 2847 2892 upiu_flags |= UPIU_CMD_FLAGS_CP; 2848 2893 ufshcd_prepare_utp_scsi_cmd_upiu(lrbp, upiu_flags); ··· 5512 5559 ufshcd_release_scsi_cmd(hba, lrbp); 5513 5560 /* Do not touch lrbp after scsi done */ 5514 5561 scsi_done(cmd); 5515 - } else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE || 5516 - lrbp->command_type == UTP_CMD_TYPE_UFS_STORAGE) { 5517 - if (hba->dev_cmd.complete) { 5518 - if (cqe) { 5519 - ocs = le32_to_cpu(cqe->status) & MASK_OCS; 5520 - lrbp->utr_descriptor_ptr->header.ocs = ocs; 5521 - } 5522 - complete(hba->dev_cmd.complete); 5562 + } else if (hba->dev_cmd.complete) { 5563 + if (cqe) { 5564 + ocs = le32_to_cpu(cqe->status) & MASK_OCS; 5565 + lrbp->utr_descriptor_ptr->header.ocs = ocs; 5523 5566 } 5567 + complete(hba->dev_cmd.complete); 5524 5568 } 5525 5569 } 5526 5570 ··· 7170 7220 7171 7221 ufshcd_setup_dev_cmd(hba, lrbp, cmd_type, 0, tag); 7172 7222 7173 - ufshcd_prepare_req_desc_hdr(hba, lrbp, &upiu_flags, DMA_NONE, 0, UTP_CMD_TYPE_DEV_MANAGE); 7223 + ufshcd_prepare_req_desc_hdr(hba, lrbp, &upiu_flags, DMA_NONE, 0); 7174 7224 7175 7225 /* update the task tag in the request upiu */ 7176 7226 req_upiu->header.task_tag = tag; ··· 7322 7372 7323 7373 ufshcd_setup_dev_cmd(hba, lrbp, DEV_CMD_TYPE_RPMB, UFS_UPIU_RPMB_WLUN, tag); 7324 7374 7325 - ufshcd_prepare_req_desc_hdr(hba, lrbp, &upiu_flags, DMA_NONE, ehs, UTP_CMD_TYPE_DEV_MANAGE); 7375 + ufshcd_prepare_req_desc_hdr(hba, lrbp, &upiu_flags, DMA_NONE, ehs); 7326 7376 7327 7377 /* update the task tag */ 7328 7378 req_upiu->header.task_tag = tag; ··· 8310 8360 } 8311 8361 8312 8362 /** 8313 - * ufshcd_tune_pa_tactivate - Tunes PA_TActivate of local UniPro 8314 - * @hba: per-adapter instance 8315 - * 8316 - * PA_TActivate parameter can be tuned manually if UniPro version is less than 8317 - * 1.61. PA_TActivate needs to be greater than or equal to peerM-PHY's 8318 - * RX_MIN_ACTIVATETIME_CAPABILITY attribute. This optimal value can help reduce 8319 - * the hibern8 exit latency. 8320 - * 8321 - * Return: zero on success, non-zero error value on failure. 8322 - */ 8323 - static int ufshcd_tune_pa_tactivate(struct ufs_hba *hba) 8324 - { 8325 - int ret = 0; 8326 - u32 peer_rx_min_activatetime = 0, tuned_pa_tactivate; 8327 - 8328 - ret = ufshcd_dme_peer_get(hba, 8329 - UIC_ARG_MIB_SEL( 8330 - RX_MIN_ACTIVATETIME_CAPABILITY, 8331 - UIC_ARG_MPHY_RX_GEN_SEL_INDEX(0)), 8332 - &peer_rx_min_activatetime); 8333 - if (ret) 8334 - goto out; 8335 - 8336 - /* make sure proper unit conversion is applied */ 8337 - tuned_pa_tactivate = 8338 - ((peer_rx_min_activatetime * RX_MIN_ACTIVATETIME_UNIT_US) 8339 - / PA_TACTIVATE_TIME_UNIT_US); 8340 - ret = ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TACTIVATE), 8341 - tuned_pa_tactivate); 8342 - 8343 - out: 8344 - return ret; 8345 - } 8346 - 8347 - /** 8348 - * ufshcd_tune_pa_hibern8time - Tunes PA_Hibern8Time of local UniPro 8349 - * @hba: per-adapter instance 8350 - * 8351 - * PA_Hibern8Time parameter can be tuned manually if UniPro version is less than 8352 - * 1.61. PA_Hibern8Time needs to be maximum of local M-PHY's 8353 - * TX_HIBERN8TIME_CAPABILITY & peer M-PHY's RX_HIBERN8TIME_CAPABILITY. 8354 - * This optimal value can help reduce the hibern8 exit latency. 8355 - * 8356 - * Return: zero on success, non-zero error value on failure. 8357 - */ 8358 - static int ufshcd_tune_pa_hibern8time(struct ufs_hba *hba) 8359 - { 8360 - int ret = 0; 8361 - u32 local_tx_hibern8_time_cap = 0, peer_rx_hibern8_time_cap = 0; 8362 - u32 max_hibern8_time, tuned_pa_hibern8time; 8363 - 8364 - ret = ufshcd_dme_get(hba, 8365 - UIC_ARG_MIB_SEL(TX_HIBERN8TIME_CAPABILITY, 8366 - UIC_ARG_MPHY_TX_GEN_SEL_INDEX(0)), 8367 - &local_tx_hibern8_time_cap); 8368 - if (ret) 8369 - goto out; 8370 - 8371 - ret = ufshcd_dme_peer_get(hba, 8372 - UIC_ARG_MIB_SEL(RX_HIBERN8TIME_CAPABILITY, 8373 - UIC_ARG_MPHY_RX_GEN_SEL_INDEX(0)), 8374 - &peer_rx_hibern8_time_cap); 8375 - if (ret) 8376 - goto out; 8377 - 8378 - max_hibern8_time = max(local_tx_hibern8_time_cap, 8379 - peer_rx_hibern8_time_cap); 8380 - /* make sure proper unit conversion is applied */ 8381 - tuned_pa_hibern8time = ((max_hibern8_time * HIBERN8TIME_UNIT_US) 8382 - / PA_HIBERN8_TIME_UNIT_US); 8383 - ret = ufshcd_dme_set(hba, UIC_ARG_MIB(PA_HIBERN8TIME), 8384 - tuned_pa_hibern8time); 8385 - out: 8386 - return ret; 8387 - } 8388 - 8389 - /** 8390 8363 * ufshcd_quirk_tune_host_pa_tactivate - Ensures that host PA_TACTIVATE is 8391 8364 * less than device PA_TACTIVATE time. 8392 8365 * @hba: per-adapter instance ··· 8381 8508 8382 8509 static void ufshcd_tune_unipro_params(struct ufs_hba *hba) 8383 8510 { 8384 - if (ufshcd_is_unipro_pa_params_tuning_req(hba)) { 8385 - ufshcd_tune_pa_tactivate(hba); 8386 - ufshcd_tune_pa_hibern8time(hba); 8387 - } 8388 - 8389 8511 ufshcd_vops_apply_dev_quirks(hba); 8390 8512 8391 8513 if (hba->dev_quirks & UFS_DEVICE_QUIRK_PA_TACTIVATE)
+1 -2
drivers/ufs/host/ufs-qcom.c
··· 528 528 * and device TX LCC are disabled once link startup is 529 529 * completed. 530 530 */ 531 - if (ufshcd_get_local_unipro_ver(hba) != UFS_UNIPRO_VER_1_41) 532 - err = ufshcd_disable_host_tx_lcc(hba); 531 + err = ufshcd_disable_host_tx_lcc(hba); 533 532 534 533 break; 535 534 default:
-2
include/ufs/ufshcd.h
··· 1390 1390 1391 1391 void ufshcd_clkgate_delay_set(struct device *dev, unsigned long value); 1392 1392 1393 - u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba); 1394 - 1395 1393 int ufshcd_get_vreg(struct device *dev, struct ufs_vreg *vreg); 1396 1394 1397 1395 int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd);
+1 -12
include/ufs/ufshci.h
··· 355 355 356 356 /* Interrupt disable masks */ 357 357 enum { 358 - /* Interrupt disable mask for UFSHCI v1.0 */ 359 - INTERRUPT_MASK_ALL_VER_10 = 0x30FFF, 360 - INTERRUPT_MASK_RW_VER_10 = 0x30000, 361 - 362 358 /* Interrupt disable mask for UFSHCI v1.1 */ 363 - INTERRUPT_MASK_ALL_VER_11 = 0x31FFF, 359 + INTERRUPT_MASK_ALL_VER_11 = 0x31FFF, 364 360 365 361 /* Interrupt disable mask for UFSHCI v2.1 */ 366 362 INTERRUPT_MASK_ALL_VER_21 = 0x71FFF, ··· 420 424 /* 421 425 * Request Descriptor Definitions 422 426 */ 423 - 424 - /* Transfer request command type */ 425 - enum utp_cmd_type { 426 - UTP_CMD_TYPE_SCSI = 0x0, 427 - UTP_CMD_TYPE_UFS = 0x1, 428 - UTP_CMD_TYPE_DEV_MANAGE = 0x2, 429 - }; 430 427 431 428 /* To accommodate UFS2.0 required Command type */ 432 429 enum {