Loading drivers/scsi/ufs/ufs-qcom.c +70 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ static int ufs_qcom_set_dme_vs_core_clk_ctrl_clear_div(struct ufs_hba *hba, static void ufs_qcom_parse_limits(struct ufs_qcom_host *host); static void ufs_qcom_parse_lpm(struct ufs_qcom_host *host); static int ufs_qcom_set_dme_vs_core_clk_ctrl_max_freq_mode(struct ufs_hba *hba); static int ufs_qcom_init_sysfs(struct ufs_hba *hba); static int ufs_qcom_get_pwr_dev_param(struct ufs_qcom_dev_params *qcom_param, struct ufs_pa_layer_attr *dev_max, Loading Loading @@ -2246,6 +2247,8 @@ static int ufs_qcom_init(struct ufs_hba *hba) err = 0; } ufs_qcom_init_sysfs(hba); /* Provide SCSI host ioctl API */ hba->host->hostt->ioctl = (int (*)(struct scsi_device *, unsigned int, void __user *))ufs_qcom_ioctl; Loading Loading @@ -2725,6 +2728,10 @@ static void ufs_qcom_print_utp_hci_testbus(struct ufs_hba *hba) static void ufs_qcom_dump_dbg_regs(struct ufs_hba *hba) { struct ufs_qcom_host *host = ufshcd_get_variant(hba); host->err_occurred = true; ufshcd_dump_regs(hba, REG_UFS_SYS1CLK_1US, 16 * 4, "HCI Vendor Specific Registers "); Loading Loading @@ -2825,6 +2832,69 @@ static const struct ufs_hba_variant_ops ufs_hba_qcom_vops = { .device_reset = ufs_qcom_device_reset, }; /** * QCOM specific sysfs group and nodes */ static ssize_t err_state_show(struct device *dev, struct device_attribute *attr, char *buf) { struct ufs_hba *hba = dev_get_drvdata(dev); struct ufs_qcom_host *host = ufshcd_get_variant(hba); return scnprintf(buf, PAGE_SIZE, "%d\n", !!host->err_occurred); } static DEVICE_ATTR_RO(err_state); static ssize_t power_mode_show(struct device *dev, struct device_attribute *attr, char *buf) { struct ufs_hba *hba = dev_get_drvdata(dev); static const char * const names[] = { "INVALID MODE", "FAST MODE", "SLOW MODE", "INVALID MODE", "FASTAUTO MODE", "SLOWAUTO MODE", "INVALID MODE", }; /* Print current power info */ return scnprintf(buf, PAGE_SIZE, "[Rx,Tx]: Gear[%d,%d], Lane[%d,%d], PWR[%s,%s], Rate-%c\n", hba->pwr_info.gear_rx, hba->pwr_info.gear_tx, hba->pwr_info.lane_rx, hba->pwr_info.lane_tx, names[hba->pwr_info.pwr_rx], names[hba->pwr_info.pwr_tx], hba->pwr_info.hs_rate == PA_HS_MODE_B ? 'B' : 'A'); } static DEVICE_ATTR_RO(power_mode); static struct attribute *ufs_qcom_sysfs_attrs[] = { &dev_attr_err_state.attr, &dev_attr_power_mode.attr, NULL }; static const struct attribute_group ufs_qcom_sysfs_group = { .name = "qcom", .attrs = ufs_qcom_sysfs_attrs, }; static int ufs_qcom_init_sysfs(struct ufs_hba *hba) { int ret; ret = sysfs_create_group(&hba->dev->kobj, &ufs_qcom_sysfs_group); if (ret) dev_err(hba->dev, "%s: Failed to create qcom sysfs group (err = %d)\n", __func__, ret); return ret; } /** * ufs_qcom_probe - probe routine of the driver * @pdev: pointer to Platform device handle Loading drivers/scsi/ufs/ufs-qcom.h +1 −0 Original line number Diff line number Diff line Loading @@ -338,6 +338,7 @@ struct ufs_qcom_host { bool is_phy_pwr_on; /* Protect the usage of is_phy_pwr_on against racing */ struct mutex phy_mutex; bool err_occurred; }; static inline u32 Loading Loading
drivers/scsi/ufs/ufs-qcom.c +70 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ static int ufs_qcom_set_dme_vs_core_clk_ctrl_clear_div(struct ufs_hba *hba, static void ufs_qcom_parse_limits(struct ufs_qcom_host *host); static void ufs_qcom_parse_lpm(struct ufs_qcom_host *host); static int ufs_qcom_set_dme_vs_core_clk_ctrl_max_freq_mode(struct ufs_hba *hba); static int ufs_qcom_init_sysfs(struct ufs_hba *hba); static int ufs_qcom_get_pwr_dev_param(struct ufs_qcom_dev_params *qcom_param, struct ufs_pa_layer_attr *dev_max, Loading Loading @@ -2246,6 +2247,8 @@ static int ufs_qcom_init(struct ufs_hba *hba) err = 0; } ufs_qcom_init_sysfs(hba); /* Provide SCSI host ioctl API */ hba->host->hostt->ioctl = (int (*)(struct scsi_device *, unsigned int, void __user *))ufs_qcom_ioctl; Loading Loading @@ -2725,6 +2728,10 @@ static void ufs_qcom_print_utp_hci_testbus(struct ufs_hba *hba) static void ufs_qcom_dump_dbg_regs(struct ufs_hba *hba) { struct ufs_qcom_host *host = ufshcd_get_variant(hba); host->err_occurred = true; ufshcd_dump_regs(hba, REG_UFS_SYS1CLK_1US, 16 * 4, "HCI Vendor Specific Registers "); Loading Loading @@ -2825,6 +2832,69 @@ static const struct ufs_hba_variant_ops ufs_hba_qcom_vops = { .device_reset = ufs_qcom_device_reset, }; /** * QCOM specific sysfs group and nodes */ static ssize_t err_state_show(struct device *dev, struct device_attribute *attr, char *buf) { struct ufs_hba *hba = dev_get_drvdata(dev); struct ufs_qcom_host *host = ufshcd_get_variant(hba); return scnprintf(buf, PAGE_SIZE, "%d\n", !!host->err_occurred); } static DEVICE_ATTR_RO(err_state); static ssize_t power_mode_show(struct device *dev, struct device_attribute *attr, char *buf) { struct ufs_hba *hba = dev_get_drvdata(dev); static const char * const names[] = { "INVALID MODE", "FAST MODE", "SLOW MODE", "INVALID MODE", "FASTAUTO MODE", "SLOWAUTO MODE", "INVALID MODE", }; /* Print current power info */ return scnprintf(buf, PAGE_SIZE, "[Rx,Tx]: Gear[%d,%d], Lane[%d,%d], PWR[%s,%s], Rate-%c\n", hba->pwr_info.gear_rx, hba->pwr_info.gear_tx, hba->pwr_info.lane_rx, hba->pwr_info.lane_tx, names[hba->pwr_info.pwr_rx], names[hba->pwr_info.pwr_tx], hba->pwr_info.hs_rate == PA_HS_MODE_B ? 'B' : 'A'); } static DEVICE_ATTR_RO(power_mode); static struct attribute *ufs_qcom_sysfs_attrs[] = { &dev_attr_err_state.attr, &dev_attr_power_mode.attr, NULL }; static const struct attribute_group ufs_qcom_sysfs_group = { .name = "qcom", .attrs = ufs_qcom_sysfs_attrs, }; static int ufs_qcom_init_sysfs(struct ufs_hba *hba) { int ret; ret = sysfs_create_group(&hba->dev->kobj, &ufs_qcom_sysfs_group); if (ret) dev_err(hba->dev, "%s: Failed to create qcom sysfs group (err = %d)\n", __func__, ret); return ret; } /** * ufs_qcom_probe - probe routine of the driver * @pdev: pointer to Platform device handle Loading
drivers/scsi/ufs/ufs-qcom.h +1 −0 Original line number Diff line number Diff line Loading @@ -338,6 +338,7 @@ struct ufs_qcom_host { bool is_phy_pwr_on; /* Protect the usage of is_phy_pwr_on against racing */ struct mutex phy_mutex; bool err_occurred; }; static inline u32 Loading