ufs: add some vendor specific operations
PATCH 1/8 ufs: add some vendor specific operations
Some UFS host controller may need to require some sequences before used clocks are turned on or off.
e.g) control internal gates in UFS host
--- drivers/scsi/ufs/ufshcd.c | 15 +++++++++++++-- drivers/scsi/ufs/ufshcd.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +13 -2
@@ -1474,6 +1474,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)/* issue command to the controller */ spin_lock_irqsave (hba->host->host_lock, flags); +ufshcd_vops_set_nexus_t_xfer_req (hba, tag, lrbp->cmd);ufshcd_send_command (hba, tag); out_unlock:spin_unlock_irqrestore (hba->host->host_lock, flags);
@@ -1683,6 +1684,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,/* Make sure descriptors are ready before ringing the doorbell */ wmb ();spin_lock_irqsave (hba->host->host_lock, flags); +ufshcd_vops_set_nexus_t_xfer_req (hba, tag, lrbp->cmd);ufshcd_send_command (hba, tag);spin_unlock_irqrestore (hba->host->host_lock, flags);
@@ -2651,6 +2653,8 @@ static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba)int ret;struct uic_command uic_cmd = {0 }; +ufshcd_vops_hibern8_notify (hba, true,PRE_CHANGE ); + uic_cmd.command =UIC_CMD_DME_HIBER_ENTER ; ret =ufshcd_uic_pwr_ctrl (hba, &uic_cmd);
@@ -2664,7 +2668,8 @@ static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba)*/ if (ufshcd_link_recovery (hba)) ret = -ENOLINK ; - } + }else +ufshcd_vops_hibern8_notify (hba, true,POST_CHANGE );return ret; }
@@ -2687,13 +2692,16 @@ static int ufshcd_uic_hibern8_exit(struct ufs_hba *hba)struct uic_command uic_cmd = {0 };int ret; +ufshcd_vops_hibern8_notify (hba, false,PRE_CHANGE ); + uic_cmd.command =UIC_CMD_DME_HIBER_EXIT ; ret =ufshcd_uic_pwr_ctrl (hba, &uic_cmd);if (ret) {dev_err (hba->dev,"%s: hibern8 exit failed. ret = %d\n" , __func__, ret); ret =ufshcd_link_recovery (hba); - } + }else +ufshcd_vops_hibern8_notify (hba, false,POST_CHANGE );return ret; }
@@ -4312,6 +4320,7 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id, task_req_upiup->input_param2 =cpu_to_be32 (task_id);/* send command to the controller */ +ufshcd_vops_set_nexus_t_task_mgmt (hba, free_slot, tm_function);__set_bit (free_slot, &hba->outstanding_tasks);/* Make sure descriptors are ready before ringing the task doorbell */
@@ -5389,6 +5398,8 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on,if (!head ||list_empty (head)) goto out; +ufshcd_vops_pre_setup_clocks (hba, on); +list_for_each_entry (clki, head, list) {if (!IS_ERR_OR_NULL (clki->clk)) {if (skip_ref_clk && !strcmp (clki->name,"ref_clk" ))
drivers/scsi/ufs/ufshcd.h +37 -0
@@ -252,6 +252,7 @@ struct ufs_pwr_mode_info {* @exit: called to cleanup everything done in init * @get_ufs_hci_version: called to get UFS HCI version * @clk_scale_notify: notifies that clks are scaled up/down +* @pre_setup_clocks: called before controlling used clocks * @setup_clocks: called before touching any of the controller registers * @setup_regulators: called before accessing the host controller * @hce_enable_notify: called before and after HCE enable bit is set to allow
@@ -261,6 +262,9 @@ struct ufs_pwr_mode_info {* @pwr_change_notify: called before and after a power mode change * is carried out to allow vendor spesific capabilities * to be set. +* @set_nexus_t_xfer_req: +* @set_nexus_t_task_mgmt: +* @hibern8_notify: * @suspend: called during host controller PM callback * @resume: called during host controller PM callback * @dbg_register_dump: used to dump controller debug information
@@ -273,6 +277,7 @@ struct ufs_hba_variant_ops {u32 (*get_ufs_hci_version)(struct ufs_hba *);int (*clk_scale_notify)(struct ufs_hba *,bool ,enum ufs_notify_change_status ); +int (*pre_setup_clocks)(struct ufs_hba *,bool );int (*setup_clocks)(struct ufs_hba *,bool );int (*setup_regulators)(struct ufs_hba *,bool ); int (*hce_enable_notify)(struct ufs_hba *,
@@ -283,6 +288,10 @@ struct ufs_hba_variant_ops {enum ufs_notify_change_status status, struct ufs_pa_layer_attr *, struct ufs_pa_layer_attr *); +void (*set_nexus_t_xfer_req)(struct ufs_hba *, +int ,struct scsi_cmnd *); +void (*set_nexus_t_task_mgmt)(struct ufs_hba *,int ,u8 ); +void (*hibern8_notify)(struct ufs_hba *,u8 ,bool );int (*suspend)(struct ufs_hba *,enum ufs_pm_op );int (*resume)(struct ufs_hba *,enum ufs_pm_op );void (*dbg_register_dump)(struct ufs_hba *hba);
@@ -755,6 +764,13 @@ static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba,return 0 ; } +static inline int ufshcd_vops_pre_setup_clocks (struct ufs_hba *hba,bool on) +{ +if (hba->vops && hba->vops->pre_setup_clocks) +return hba->vops->pre_setup_clocks (hba, on); +return 0 ; +} +static inline int ufshcd_vops_setup_clocks (struct ufs_hba *hba,bool on) {if (hba->vops && hba->vops->setup_clocks)
@@ -799,6 +815,27 @@ static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba,return -ENOTSUPP ; } +static inline void ufshcd_vops_set_nexus_t_xfer_req (struct ufs_hba *hba, +int tag,struct scsi_cmnd *cmd) +{ +if (hba->vops && hba->vops->set_nexus_t_xfer_req) +return hba->vops->set_nexus_t_xfer_req (hba, tag, cmd); +} + +static inline void ufshcd_vops_set_nexus_t_task_mgmt (struct ufs_hba *hba, +int tag,u8 tm_function) +{ +if (hba->vops && hba->vops->set_nexus_t_task_mgmt) +return hba->vops->set_nexus_t_task_mgmt (hba, tag, tm_function); +} + +static inline void ufshcd_vops_hibern8_notify (struct ufs_hba *hba, +u8 enter,bool notify) +{ +if (hba->vops && hba->vops->hibern8_notify) +return hba->vops->hibern8_notify (hba, enter, notify); +} +static inline int ufshcd_vops_suspend (struct ufs_hba *hba,enum ufs_pm_op op) {if (hba->vops && hba->vops->suspend)
Signature · 1 line
1.7.9.5
Hi Kim,
Quoted 3 lines · Kiwoong Kim
Some UFS host controller may need to require some sequences before used clocks are turned on or off.
e.g) control internal gates in UFS host
I believe we are doing couple of other things as well other than clock control in this patch, such as hibern8 notify, *nexus_t* notify. You might want to separate each in different patches. Also, please find more additional below.
Quoted 21 lines
Signed-off-by Kiwoong Kim <[email protected]>--- drivers/scsi/ufs/ufshcd.c | 15 +++++++++++++-- drivers/scsi/ufs/ufshcd.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-)drivers/scsi/ufs/ufshcd.c +1
-0@@ -1474,6 +1474,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)/* issue command to the controller */ spin_lock_irqsave (hba->host->host_lock, flags); +ufshcd_vops_set_nexus_t_xfer_req (hba, tag, lrbp->cmd);ufshcd_send_command (hba, tag); out_unlock:drivers/scsi/ufs/ufshcd.c +0
-0spin_unlock_irqrestore (hba->host->host_lock, flags);
drivers/scsi/ufs/ufshcd.c static int ufshcd_exec_dev_cmd(struct ufs_hba · line 1688
Quoted 5 lines
drivers/scsi/ufs/ufshcd.c +1
-0@@ -1683,6 +1684,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,/* Make sure descriptors are ready before ringing the doorbell */ wmb ();spin_lock_irqsave (hba->host->host_lock, flags); +ufshcd_vops_set_nexus_t_xfer_req (hba, tag, lrbp->cmd);
what does "next_t_xfer_req" means? why do we need this? and do you think it may be useful/needed for non-exynos UFS host controllers as well?
Quoted 44 lines
drivers/scsi/ufs/ufshcd.c +4
-1ufshcd_send_command (hba, tag);spin_unlock_irqrestore (hba->host->host_lock, flags);@@ -2651,6 +2653,8 @@ static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba)int ret;struct uic_command uic_cmd = {0 }; +ufshcd_vops_hibern8_notify (hba, true,PRE_CHANGE ); + uic_cmd.command =UIC_CMD_DME_HIBER_ENTER ; ret =ufshcd_uic_pwr_ctrl (hba, &uic_cmd);@@ -2664,7 +2668,8 @@ static int __ufshcd_uic_hibern8_enter(structufs_hba *hba) */ if (ufshcd_link_recovery (hba)) ret = -ENOLINK ; - } + }else +ufshcd_vops_hibern8_notify (hba, true,POST_CHANGE );return ret;}
drivers/scsi/ufs/ufshcd.c +4
-1@@ -2687,13 +2692,16 @@ static int ufshcd_uic_hibern8_exit(struct ufs_hba *hba)struct uic_command uic_cmd = {0 };int ret; +ufshcd_vops_hibern8_notify (hba, false,PRE_CHANGE ); + uic_cmd.command =UIC_CMD_DME_HIBER_EXIT ; ret =ufshcd_uic_pwr_ctrl (hba, &uic_cmd);if (ret) {dev_err (hba->dev,"%s: hibern8 exit failed. ret = %d\n" , __func__, ret); ret =ufshcd_link_recovery (hba); - } + }else +ufshcd_vops_hibern8_notify (hba, false,POST_CHANGE );return ret;}
drivers/scsi/ufs/ufshcd.c static int ufshcd_issue_tm_cmd(struct ufs_hba · line 4324
Quoted 5 lines
drivers/scsi/ufs/ufshcd.c +1
-0@@ -4312,6 +4320,7 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id, task_req_upiup->input_param2 =cpu_to_be32 (task_id);/* send command to the controller */ +ufshcd_vops_set_nexus_t_task_mgmt (hba, free_slot, tm_function);
Same question as "next_t_xfer_req". what does "next_t_task_mgmt" means? why do we need this? and do you think it may be useful/needed for non-exynos UFS host controllers as well?
drivers/scsi/ufs/ufshcd.c static int __ufshcd_setup_clocks(struct ufs_hba · line 5403
Quoted 11 lines
drivers/scsi/ufs/ufshcd.c +0
-0__set_bit (free_slot, &hba->outstanding_tasks);/* Make sure descriptors are ready before ringing the task doorbell
*/drivers/scsi/ufs/ufshcd.c +2
-0@@ -5389,6 +5398,8 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, if (!head || list_empty(head)) goto out; +ufshcd_vops_pre_setup_clocks (hba, on); +
I don't think we need a different op for this, we can simply use the existing op and add one more argument to it to indicate PRE_CHANGE/POST_CHANGE. If you agree with my response to "[PATCH v2] scsi: ufshcd: fix possible unclocked register access" patch, i can update send out v3 of my patch and then you can rebase your patch series on top of my patch.
Quoted 95 lines
drivers/scsi/ufs/ufshcd.c +0
-0list_for_each_entry (clki, head, list) {if (!IS_ERR_OR_NULL (clki->clk)) {drivers/scsi/ufs/ufshcd.c +0
-0if (skip_ref_clk && !strcmp (clki->name,"ref_clk" ))drivers/scsi/ufs/ufshcd.h +1
-0@@ -252,6 +252,7 @@ struct ufs_pwr_mode_info {* @exit: called to cleanup everything done in init * @get_ufs_hci_version: called to get UFS HCI version * @clk_scale_notify: notifies that clks are scaled up/down +* @pre_setup_clocks: called before controlling used clocks * @setup_clocks: called before touching any of the controller registers
* @setup_regulators: called before accessing the host controller
* @hce_enable_notify: called before and after HCE enable bit is set
to allowdrivers/scsi/ufs/ufshcd.h +15
-0@@ -261,6 +262,9 @@ struct ufs_pwr_mode_info {* @pwr_change_notify: called before and after a power mode change * is carried out to allow vendor spesific capabilities * to be set. +* @set_nexus_t_xfer_req: +* @set_nexus_t_task_mgmt: +* @hibern8_notify: * @suspend: called during host controller PM callback * @resume: called during host controller PM callback * @dbg_register_dump: used to dump controller debug information @@ -273,6 +277,7 @@ struct ufs_hba_variant_ops {u32 (*get_ufs_hci_version)(struct ufs_hba *);int (*clk_scale_notify)(struct ufs_hba *,bool ,enum ufs_notify_change_status ); +int (*pre_setup_clocks)(struct ufs_hba *,bool );int (*setup_clocks)(struct ufs_hba *,bool );int (*setup_regulators)(struct ufs_hba *,bool ); int (*hce_enable_notify)(struct ufs_hba *,@@ -283,6 +288,10 @@ struct ufs_hba_variant_ops {enum ufs_notify_change_status status, struct ufs_pa_layer_attr *, struct ufs_pa_layer_attr *); +void (*set_nexus_t_xfer_req)(struct ufs_hba *, +int ,struct scsi_cmnd *); +void (*set_nexus_t_task_mgmt)(struct ufs_hba *,int ,u8 ); +void (*hibern8_notify)(struct ufs_hba *,u8 ,bool );int (*suspend)(struct ufs_hba *,enum ufs_pm_op );int (*resume)(struct ufs_hba *,enum ufs_pm_op );void (*dbg_register_dump)(struct ufs_hba *hba);@@ -755,6 +764,13 @@ static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba, return 0; } +static inline int ufshcd_vops_pre_setup_clocks (struct ufs_hba *hba,bool on) +{ +if (hba->vops && hba->vops->pre_setup_clocks) +return hba->vops->pre_setup_clocks (hba, on); +return 0 ; +} + static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, boolon)
{drivers/scsi/ufs/ufshcd.h +21
-0if (hba->vops && hba->vops->setup_clocks)@@ -799,6 +815,27 @@ static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba, return -ENOTSUPP; } +static inline void ufshcd_vops_set_nexus_t_xfer_req (struct ufs_hba *hba, +int tag,struct scsi_cmnd *cmd) +{ +if (hba->vops && hba->vops->set_nexus_t_xfer_req) +return hba->vops->set_nexus_t_xfer_req (hba, tag, cmd); +} + +static inline void ufshcd_vops_set_nexus_t_task_mgmt (struct ufs_hba *hba, +int tag,u8 tm_function) +{ +if (hba->vops && hba->vops->set_nexus_t_task_mgmt) +return hba->vops->set_nexus_t_task_mgmt (hba, tag, tm_function); +} + +static inline void ufshcd_vops_hibern8_notify (struct ufs_hba *hba, +u8 enter,bool notify) +{ +if (hba->vops && hba->vops->hibern8_notify) +return hba->vops->hibern8_notify (hba, enter, notify); +} +static inline int ufshcd_vops_suspend(struct
ufs_hba*hba, enumufs_pm_opop)
{
if (hba->vops&&hba->vops->suspend)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Hi, Subhash.
Thank for your comments.
I added my opinions below.
Regards
Quoted 28 lines
Hi Kim,
Quoted 3 lines · Kiwoong Kim
Some UFS host controller may need to require some sequences before used clocks are turned on or off.
e.g) control internal gates in UFS hostI believe we are doing couple of other things as well other than clock control in this patch, such as hibern8 notify, *nexus_t* notify. You might want to separate each in different patches. Also, please find more additional below.
Quoted 14 lines
Signed-off-by Kiwoong Kim <[email protected]>--- drivers/scsi/ufs/ufshcd.c | 15 +++++++++++++-- drivers/scsi/ufs/ufshcd.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-)drivers/scsi/ufs/ufshcd.c +0
-0@@ -1474,6 +1474,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
Quoted 15 lines
drivers/scsi/ufs/ufshcd.c static int ufshcd_exec_dev_cmd(struct ufs_hba · line 1688
Quoted 12 lines
drivers/scsi/ufs/ufshcd.c +1
-0/* issue command to the controller */ spin_lock_irqsave (hba->host->host_lock, flags); +ufshcd_vops_set_nexus_t_xfer_req (hba, tag, lrbp->cmd);ufshcd_send_command (hba, tag); out_unlock:drivers/scsi/ufs/ufshcd.c +1
-0spin_unlock_irqrestore (hba->host->host_lock, flags);@@ -1683,6 +1684,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,/* Make sure descriptors are ready before ringing the doorbell */ wmb ();spin_lock_irqsave (hba->host->host_lock, flags); +ufshcd_vops_set_nexus_t_xfer_req (hba, tag, lrbp->cmd);what does "
next_t_xfer_req" means? why do we need this? and do you think it may be useful/needed for non-exynos UFS host controllers as well?
Exynos UFS controller has a logic to determine which slot owns received UPIU,
to handle it properly.
This only run when software set a exynos-specific SFR to bitwise-1. If the controller sends non-dependent request, such as NOP, software would set the SFR to 0 because it don't need to determine.
An answer of your question depends on whether other controllers has a logic to function that.
Quoted 50 lines
Quoted 50 lines
drivers/scsi/ufs/ufshcd.c +4
-1ufshcd_send_command (hba, tag);spin_unlock_irqrestore (hba->host->host_lock, flags);@@ -2651,6 +2653,8 @@ static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba)int ret;struct uic_command uic_cmd = {0 }; +ufshcd_vops_hibern8_notify (hba, true,PRE_CHANGE ); + uic_cmd.command =UIC_CMD_DME_HIBER_ENTER ; ret =ufshcd_uic_pwr_ctrl (hba, &uic_cmd);@@ -2664,7 +2668,8 @@ static int __ufshcd_uic_hibern8_enter(structufs_hba *hba) */ if (ufshcd_link_recovery (hba)) ret = -ENOLINK ; - } + }else +ufshcd_vops_hibern8_notify (hba, true,POST_CHANGE );return ret;}
drivers/scsi/ufs/ufshcd.c +4
-1@@ -2687,13 +2692,16 @@ static int ufshcd_uic_hibern8_exit(struct ufs_hba *hba)struct uic_command uic_cmd = {0 };int ret; +ufshcd_vops_hibern8_notify (hba, false,PRE_CHANGE ); + uic_cmd.command =UIC_CMD_DME_HIBER_EXIT ; ret =ufshcd_uic_pwr_ctrl (hba, &uic_cmd);if (ret) {dev_err (hba->dev,"%s: hibern8 exit failed. ret = %d\n" , __func__, ret); ret =ufshcd_link_recovery (hba); - } + }else +ufshcd_vops_hibern8_notify (hba, false,POST_CHANGE );return ret;}
drivers/scsi/ufs/ufshcd.c +0
-0@@ -4312,6 +4320,7 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id, task_req_upiup->input_param2 =cpu_to_be32 (task_id);
Quoted 7 lines
drivers/scsi/ufs/ufshcd.c static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id, · line 4323
Quoted 2 lines
drivers/scsi/ufs/ufshcd.c +1
-0/* send command to the controller */ +ufshcd_vops_set_nexus_t_task_mgmt (hba, free_slot, tm_function);Same question as "
next_t_xfer_req". what does "next_t_task_mgmt" means? why do we need this? and do you think it may be useful/needed for non-exynos UFS host controllers as well?
Please refer to what I mentioned above.
Quoted 11 lines
Quoted 11 lines
drivers/scsi/ufs/ufshcd.c +0
-0__set_bit (free_slot, &hba->outstanding_tasks);/* Make sure descriptors are ready before ringing the task doorbell
*/drivers/scsi/ufs/ufshcd.c +0
-0@@ -5389,6 +5398,8 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, if (!head || list_empty(head)) goto out;
Quoted 9 lines
drivers/scsi/ufs/ufshcd.c static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, · line 5402
Quoted 2 lines
drivers/scsi/ufs/ufshcd.c +2
-0+ufshcd_vops_pre_setup_clocks (hba, on); +I don't think we need a different op for this, we can simply use the existing op and add one more argument to it to indicate PRE_CHANGE/POST_CHANGE. If you agree with my response to "[PATCH v2]
scsi: ufshcd: fix possible unclocked register access" patch, i can update send out v3 of my patch and then you can rebase your patch series on top of my patch.
Okay, I agree with you. Then I assume that you would do that and will change the patch.
Quoted 31 lines
Quoted 31 lines
drivers/scsi/ufs/ufshcd.c +0
-0list_for_each_entry (clki, head, list) {if (!IS_ERR_OR_NULL (clki->clk)) {drivers/scsi/ufs/ufshcd.c +0
-0if (skip_ref_clk && !strcmp (clki->name,"ref_clk" ))drivers/scsi/ufs/ufshcd.h +1
-0@@ -252,6 +252,7 @@ struct ufs_pwr_mode_info {* @exit: called to cleanup everything done in init * @get_ufs_hci_version: called to get UFS HCI version * @clk_scale_notify: notifies that clks are scaled up/down +* @pre_setup_clocks: called before controlling used clocks * @setup_clocks: called before touching any of the controller registers
* @setup_regulators: called before accessing the host controller
* @hce_enable_notify: called before and after HCE enable bit is set
to allowdrivers/scsi/ufs/ufshcd.h +3
-0@@ -261,6 +262,9 @@ struct ufs_pwr_mode_info {* @pwr_change_notify: called before and after a power mode change * is carried out to allow vendor spesific capabilities * to be set. +* @set_nexus_t_xfer_req: +* @set_nexus_t_task_mgmt: +* @hibern8_notify: * @suspend: called during host controller PM callback * @resume: called during host controller PM callback * @dbg_register_dump: used to dump controller debug information @@ -273,6 +277,7 @@ struct ufs_hba_variant_ops {u32 (*get_ufs_hci_version)(struct ufs_hba *);
Quoted 8 lines
drivers/scsi/ufs/ufshcd.h struct ufs_hba_variant_ops { · line 288
Quoted 8 lines
drivers/scsi/ufs/ufshcd.h +1
-0int (*clk_scale_notify)(struct ufs_hba *,bool ,enum ufs_notify_change_status ); +int (*pre_setup_clocks)(struct ufs_hba *,bool );int (*setup_clocks)(struct ufs_hba *,bool );int (*setup_regulators)(struct ufs_hba *,bool ); int (*hce_enable_notify)(struct ufs_hba *,@@ -283,6 +288,10 @@ struct ufs_hba_variant_ops {enum ufs_notify_change_status
status,
Quoted 67 lines
Quoted 35 lines
drivers/scsi/ufs/ufshcd.h +11
-0struct ufs_pa_layer_attr *, struct ufs_pa_layer_attr *); +void (*set_nexus_t_xfer_req)(struct ufs_hba *, +int ,struct scsi_cmnd *); +void (*set_nexus_t_task_mgmt)(struct ufs_hba *,int ,u8 ); +void (*hibern8_notify)(struct ufs_hba *,u8 ,bool );int (*suspend)(struct ufs_hba *,enum ufs_pm_op );int (*resume)(struct ufs_hba *,enum ufs_pm_op );void (*dbg_register_dump)(struct ufs_hba *hba);@@ -755,6 +764,13 @@ static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba, return 0; } +static inline int ufshcd_vops_pre_setup_clocks (struct ufs_hba *hba,bool on) +{ +if (hba->vops && hba->vops->pre_setup_clocks) +return hba->vops->pre_setup_clocks (hba, on); +return 0 ; +} + static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, boolon)
{drivers/scsi/ufs/ufshcd.h +3
-0if (hba->vops && hba->vops->setup_clocks)@@ -799,6 +815,27 @@ static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba, return -ENOTSUPP; } +static inline void ufshcd_vops_set_nexus_t_xfer_req (struct ufs_hba *hba, +int tag,struct scsi_cmnd *cmd) +{drivers/scsi/ufs/ufshcd.h static inline int · line 832
Quoted 10 lines
drivers/scsi/ufs/ufshcd.h +9
-0+if (hba->vops && hba->vops->set_nexus_t_xfer_req) +return hba->vops->set_nexus_t_xfer_req (hba, tag, cmd); +} + +static inline void ufshcd_vops_set_nexus_t_task_mgmt (struct ufs_hba *hba, +int tag,u8 tm_function) +{ +if (hba->vops && hba->vops->set_nexus_t_task_mgmt) + return hba->vops->set_nexus_t_task_mgmt(hba, tag,
tm_function);Quoted 9 lines
drivers/scsi/ufs/ufshcd.h +9
-0+} + +static inline void ufshcd_vops_hibern8_notify (struct ufs_hba *hba, +u8 enter,bool notify) +{ +if (hba->vops && hba->vops->hibern8_notify) +return hba->vops->hibern8_notify (hba, enter, notify); +} +Quoted 4 lines
static inline int ufshcd_vops_suspend(struct
ufs_hba*hba, enumufs_pm_opop)
{
if (hba->vops&&hba->vops->suspend)--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Kim,
Quoted 19 lines · Kiwoong Kim
Hi, Subhash.
Thank for your comments.
I added my opinions below.Regards
Quoted 12 lines
Hi Kim,
Quoted 3 lines · Kiwoong Kim
Some UFS host controller may need to require some sequences before used clocks are turned on or off.
e.g) control internal gates in UFS hostI believe we are doing couple of other things as well other than clock control in this patch, such as hibern8 notify, *nexus_t* notify. You might want to separate each in different patches. Also, please find more
are you going to divide this patch?
Quoted 32 lines
Quoted 16 lines
additional below.
Quoted 14 lines
Signed-off-by Kiwoong Kim <[email protected]>--- drivers/scsi/ufs/ufshcd.c | 15 +++++++++++++-- drivers/scsi/ufs/ufshcd.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-)drivers/scsi/ufs/ufshcd.c +0
-0@@ -1474,6 +1474,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)Quoted 15 lines
drivers/scsi/ufs/ufshcd.c static int ufshcd_exec_dev_cmd(struct ufs_hba · line 1688
Quoted 12 lines
drivers/scsi/ufs/ufshcd.c +1
-0/* issue command to the controller */ spin_lock_irqsave (hba->host->host_lock, flags); +ufshcd_vops_set_nexus_t_xfer_req (hba, tag, lrbp->cmd);ufshcd_send_command (hba, tag); out_unlock:drivers/scsi/ufs/ufshcd.c +1
-0spin_unlock_irqrestore (hba->host->host_lock, flags);@@ -1683,6 +1684,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,/* Make sure descriptors are ready before ringing the doorbell */ wmb ();spin_lock_irqsave (hba->host->host_lock, flags); +ufshcd_vops_set_nexus_t_xfer_req (hba, tag, lrbp->cmd);what does "
next_t_xfer_req" means? why do we need this? and do you think it may be useful/needed for non-exynos UFS host controllers as well?
Quoted 6 lines
Exynos UFS controller has a logic to determine which slot owns received UPIU,
to handle it properly.
This only run when software set a exynos-specific SFR to bitwise-1. If the controller sends non-dependent request, such as NOP, software would set the SFR to 0 because it don't need to determine.
Ok, this is very specific to your controller. But i guess still the callback names should be generic enough so that it may be used by other host controller drivers if required in future. Can we think of different name? something like notify_cmd_issue?
Also, why do we need to pass whole pointer to pass scsi command pointer? what all scsi cmnd parameters will be used by exynos driver? may be your full patch series might give more idea?
Quoted 48 lines
An answer of your question depends on whether other controllers has a logic to function that.
Quoted 44 lines
Quoted 44 lines
drivers/scsi/ufs/ufshcd.c +4
-1ufshcd_send_command (hba, tag);spin_unlock_irqrestore (hba->host->host_lock, flags);@@ -2651,6 +2653,8 @@ static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba)int ret;struct uic_command uic_cmd = {0 }; +ufshcd_vops_hibern8_notify (hba, true,PRE_CHANGE ); + uic_cmd.command =UIC_CMD_DME_HIBER_ENTER ; ret =ufshcd_uic_pwr_ctrl (hba, &uic_cmd);@@ -2664,7 +2668,8 @@ static int __ufshcd_uic_hibern8_enter(structufs_hba *hba) */ if (ufshcd_link_recovery (hba)) ret = -ENOLINK ; - } + }else +ufshcd_vops_hibern8_notify (hba, true,POST_CHANGE );return ret;}
drivers/scsi/ufs/ufshcd.c +4
-1@@ -2687,13 +2692,16 @@ static int ufshcd_uic_hibern8_exit(struct ufs_hba *hba)struct uic_command uic_cmd = {0 };int ret; +ufshcd_vops_hibern8_notify (hba, false,PRE_CHANGE ); + uic_cmd.command =UIC_CMD_DME_HIBER_EXIT ; ret =ufshcd_uic_pwr_ctrl (hba, &uic_cmd);if (ret) {dev_err (hba->dev,"%s: hibern8 exit failed. ret = %d\n" , __func__, ret); ret =ufshcd_link_recovery (hba); - } + }else +ufshcd_vops_hibern8_notify (hba, false,POST_CHANGE );
Quoted 8 lines
Quoted 8 lines
drivers/scsi/ufs/ufshcd.c static int ufshcd_issue_tm_cmd(struct ufs_hba · line 4324
Quoted 8 lines
drivers/scsi/ufs/ufshcd.c +0
-0return ret;}
drivers/scsi/ufs/ufshcd.c +1
-0@@ -4312,6 +4320,7 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id, task_req_upiup->input_param2 =cpu_to_be32 (task_id);/* send command to the controller */ +ufshcd_vops_set_nexus_t_task_mgmt (hba, free_slot, tm_function);
Same as above, we need to think of more generic name?
Thanks,
Subhash
Quoted 139 lines
Quoted 5 lines
Same question as "
next_t_xfer_req". what does "next_t_task_mgmt" means? why do we need this? and do you think it may be useful/needed for non-exynos UFS host controllers as well?Please refer to what I mentioned above.
Quoted 11 lines
Quoted 11 lines
drivers/scsi/ufs/ufshcd.c +0
-0__set_bit (free_slot, &hba->outstanding_tasks);/* Make sure descriptors are ready before ringing the task doorbell
*/drivers/scsi/ufs/ufshcd.c +0
-0@@ -5389,6 +5398,8 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, if (!head || list_empty(head)) goto out;Quoted 9 lines
drivers/scsi/ufs/ufshcd.c static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, · line 5402
Quoted 2 lines
drivers/scsi/ufs/ufshcd.c +2
-0+ufshcd_vops_pre_setup_clocks (hba, on); +I don't think we need a different op for this, we can simply use the existing op and add one more argument to it to indicate PRE_CHANGE/POST_CHANGE. If you agree with my response to "[PATCH v2]
scsi: ufshcd: fix possible unclocked register access" patch, i can update send out v3 of my patch and then you can rebase your patch series on top of my patch.Okay, I agree with you. Then I assume that you would do that and will change the patch.
Quoted 31 lines
Quoted 31 lines
drivers/scsi/ufs/ufshcd.c +0
-0list_for_each_entry (clki, head, list) {if (!IS_ERR_OR_NULL (clki->clk)) {drivers/scsi/ufs/ufshcd.c +0
-0if (skip_ref_clk && !strcmp (clki->name,"ref_clk" ))drivers/scsi/ufs/ufshcd.h +1
-0@@ -252,6 +252,7 @@ struct ufs_pwr_mode_info {* @exit: called to cleanup everything done in init * @get_ufs_hci_version: called to get UFS HCI version * @clk_scale_notify: notifies that clks are scaled up/down +* @pre_setup_clocks: called before controlling used clocks * @setup_clocks: called before touching any of the controller registers
* @setup_regulators: called before accessing the host controller
* @hce_enable_notify: called before and after HCE enable bit is set
to allowdrivers/scsi/ufs/ufshcd.h +3
-0@@ -261,6 +262,9 @@ struct ufs_pwr_mode_info {* @pwr_change_notify: called before and after a power mode change * is carried out to allow vendor spesific capabilities * to be set. +* @set_nexus_t_xfer_req: +* @set_nexus_t_task_mgmt: +* @hibern8_notify: * @suspend: called during host controller PM callback * @resume: called during host controller PM callback * @dbg_register_dump: used to dump controller debug information @@ -273,6 +277,7 @@ struct ufs_hba_variant_ops {u32 (*get_ufs_hci_version)(struct ufs_hba *);Quoted 8 lines
drivers/scsi/ufs/ufshcd.h struct ufs_hba_variant_ops { · line 288
Quoted 8 lines
drivers/scsi/ufs/ufshcd.h +1
-0int (*clk_scale_notify)(struct ufs_hba *,bool ,enum ufs_notify_change_status ); +int (*pre_setup_clocks)(struct ufs_hba *,bool );int (*setup_clocks)(struct ufs_hba *,bool );int (*setup_regulators)(struct ufs_hba *,bool ); int (*hce_enable_notify)(struct ufs_hba *,@@ -283,6 +288,10 @@ struct ufs_hba_variant_ops {enum ufs_notify_change_status status,
Quoted 67 lines
Quoted 35 lines
drivers/scsi/ufs/ufshcd.h +11
-0struct ufs_pa_layer_attr *, struct ufs_pa_layer_attr *); +void (*set_nexus_t_xfer_req)(struct ufs_hba *, +int ,struct scsi_cmnd *); +void (*set_nexus_t_task_mgmt)(struct ufs_hba *,int ,u8 ); +void (*hibern8_notify)(struct ufs_hba *,u8 ,bool );int (*suspend)(struct ufs_hba *,enum ufs_pm_op );int (*resume)(struct ufs_hba *,enum ufs_pm_op );void (*dbg_register_dump)(struct ufs_hba *hba);@@ -755,6 +764,13 @@ static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba, return 0; } +static inline int ufshcd_vops_pre_setup_clocks (struct ufs_hba *hba,bool on) +{ +if (hba->vops && hba->vops->pre_setup_clocks) +return hba->vops->pre_setup_clocks (hba, on); +return 0 ; +} + static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, boolon)
{drivers/scsi/ufs/ufshcd.h +3
-0if (hba->vops && hba->vops->setup_clocks)@@ -799,6 +815,27 @@ static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba, return -ENOTSUPP; } +static inline void ufshcd_vops_set_nexus_t_xfer_req (struct ufs_hba *hba, +int tag,struct scsi_cmnd *cmd) +{drivers/scsi/ufs/ufshcd.h static inline int · line 832
Quoted 10 lines
drivers/scsi/ufs/ufshcd.h +9
-0+if (hba->vops && hba->vops->set_nexus_t_xfer_req) +return hba->vops->set_nexus_t_xfer_req (hba, tag, cmd); +} + +static inline void ufshcd_vops_set_nexus_t_task_mgmt (struct ufs_hba *hba, +int tag,u8 tm_function) +{ +if (hba->vops && hba->vops->set_nexus_t_task_mgmt) + return hba->vops->set_nexus_t_task_mgmt(hba, tag,
tm_function);Quoted 9 lines
drivers/scsi/ufs/ufshcd.h +9
-0+} + +static inline void ufshcd_vops_hibern8_notify (struct ufs_hba *hba, +u8 enter,bool notify) +{ +if (hba->vops && hba->vops->hibern8_notify) +return hba->vops->hibern8_notify (hba, enter, notify); +} +Quoted 4 lines
static inline int ufshcd_vops_suspend(struct
ufs_hba*hba, enumufs_pm_opop)
{
if (hba->vops&&hba->vops->suspend)--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Hi, Subhash.
Quoted 19 lines
Hi Kim,
Quoted 16 lines · Kiwoong Kim
Hi, Subhash.
Thank for your comments.
I added my opinions below.Regards
Quoted 9 lines
Hi Kim,
Quoted 3 lines · Kiwoong Kim
Some UFS host controller may need to require some sequences before used clocks are turned on or off.
e.g) control internal gates in UFS host
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
I believe we are doing couple of other things as well other than clock control in this patch, such as hibern8 notify, *nexus_t* notify. You might want to separate each in different patches. Also, please find more
are you going to divide this patch?
Yes.
Quoted 18 lines
Quoted 8 lines
Quoted 8 lines
additional below.
Quoted 5 lines
Signed-off-by Kiwoong Kim <[email protected]>--- drivers/scsi/ufs/ufshcd.c | 15 +++++++++++++-- drivers/scsi/ufs/ufshcd.h | 37+++++++++++++++++++++++++++++++++++++
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
2 files changed, 50 insertions(+), 2 deletions(-)drivers/scsi/ufs/ufshcd.c +0
-0@@ -1474,6 +1474,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/scsi/ufs/ufshcd.c +1
-0/* issue command to the controller */ spin_lock_irqsave (hba->host->host_lock, flags); +ufshcd_vops_set_nexus_t_xfer_req (hba, tag, lrbp->cmd);ufshcd_send_command (hba, tag); out_unlock:
spin_unlock_irqrestore(hba->host->host_lock, flags); @@
-1683,6
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+1684,7 @@ static int ufshcd_exec_dev_cmd(struct
ufs_hba*hba,
/* Make sure descriptors are ready before ringing the
doorbell */
Quoted 16 lines
Quoted 8 lines
Quoted 7 lines
drivers/scsi/ufs/ufshcd.c static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, · line 1687
Quoted 3 lines
drivers/scsi/ufs/ufshcd.c +1
-0wmb ();spin_lock_irqsave (hba->host->host_lock, flags); +ufshcd_vops_set_nexus_t_xfer_req (hba, tag, lrbp->cmd);what does "
next_t_xfer_req" means? why do we need this? and do you think
it may be useful/needed for non-exynos UFS host controllers as well?Quoted 7 lines
Exynos UFS controller has a logic to determine which slot owns received
UPIU,
to handle it properly.
This only run when software set a exynos-specific SFR to bitwise-1. If the controller sends non-dependent request, such as NOP, software would set the SFR to 0 because it don't need to determine.
Quoted 4 lines
Ok, this is very specific to your controller. But i guess still the callback names should be generic enough so that it may be used by other host controller drivers if required in future.
Can we think of different name? something likenotify_cmd_issue?
Okay, that's good.
Quoted 3 lines
Also, why do we need to pass whole pointer to pass scsi command pointer? what all scsi cmnd parameters will be used by exynos driver? may be your full patch series might give more idea?
I get it. How about using (void *) type pointer as an additional argument To pass anything away to platform-specific driver ?
Thank you
Regards
Quoted 38 lines
Quoted 38 lines
An answer of your question depends on whether other controllers has a logic to function that.
Quoted 32 lines
Quoted 32 lines
drivers/scsi/ufs/ufshcd.c +4
-1ufshcd_send_command (hba, tag);spin_unlock_irqrestore (hba->host->host_lock, flags);@@ -2651,6 +2653,8 @@ static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba)int ret;struct uic_command uic_cmd = {0 }; +ufshcd_vops_hibern8_notify (hba, true,PRE_CHANGE ); + uic_cmd.command =UIC_CMD_DME_HIBER_ENTER ; ret =ufshcd_uic_pwr_ctrl (hba, &uic_cmd);@@ -2664,7 +2668,8 @@ static int __ufshcd_uic_hibern8_enter(structufs_hba *hba) */ if (ufshcd_link_recovery (hba)) ret = -ENOLINK ; - } + }else +ufshcd_vops_hibern8_notify (hba, true,POST_CHANGE );return ret;}
drivers/scsi/ufs/ufshcd.c +0
-0@@ -2687,13 +2692,16 @@ static int ufshcd_uic_hibern8_exit(struct ufs_hba *hba)struct uic_command uic_cmd = {0 };int ret;
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/scsi/ufs/ufshcd.c static int ufshcd_uic_hibern8_exit(struct ufs_hba *hba)
Quoted 6 lines
drivers/scsi/ufs/ufshcd.c +2
-0+ufshcd_vops_hibern8_notify (hba, false,PRE_CHANGE ); + uic_cmd.command =UIC_CMD_DME_HIBER_EXIT ; ret =ufshcd_uic_pwr_ctrl (hba, &uic_cmd);if (ret) { dev_err(hba->dev, "%s: hibern8 exit failed. ret =
%d\n",
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/scsi/ufs/ufshcd.c +2
-1__func__, ret); ret =ufshcd_link_recovery (hba); - } + }else +ufshcd_vops_hibern8_notify (hba, false,POST_CHANGE );
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/scsi/ufs/ufshcd.c static int ufshcd_issue_tm_cmd(struct ufs_hba · line 4324
Quoted 8 lines
drivers/scsi/ufs/ufshcd.c +0
-0return ret;}
drivers/scsi/ufs/ufshcd.c +1
-0@@ -4312,6 +4320,7 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id, task_req_upiup->input_param2 =cpu_to_be32 (task_id);/* send command to the controller */ + ufshcd_vops_set_nexus_t_task_mgmt(hba, free_slot,
tm_function);
Quoted 22 lines
Same as above, we need to think of more generic name?
Thanks,
SubhashQuoted 14 lines
Quoted 6 lines
Same question as "
next_t_xfer_req". what does "next_t_task_mgmt" means?
why do we need this? and do you think it may be useful/needed for non-exynos UFS host controllers as well?Please refer to what I mentioned above.
Quoted 5 lines
Quoted 5 lines
drivers/scsi/ufs/ufshcd.c +0
-0__set_bit (free_slot, &hba->outstanding_tasks);/* Make sure descriptors are ready before ringing the task
doorbell
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
drivers/scsi/ufs/ufshcd.c static int __ufshcd_setup_clocks(struct ufs_hba · line 5403
Quoted 8 lines
*/
drivers/scsi/ufs/ufshcd.c +2
-0@@ -5389,6 +5398,8 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, if (!head || list_empty(head)) goto out; +ufshcd_vops_pre_setup_clocks (hba, on); +I don't think we need a different op for this, we can simply use the existing op and add one more argument to it to indicate PRE_CHANGE/POST_CHANGE. If you agree with my response to "[PATCH v2]
scsi: ufshcd: fix possible unclocked register access" patch, i can update send out v3 of my patch and then you can rebase your patch series
on top of my patch.
Quoted 8 lines
Quoted 8 lines
Okay, I agree with you. Then I assume that you would do that and will change the patch.
Quoted 5 lines
Quoted 5 lines
drivers/scsi/ufs/ufshcd.c +0
-0list_for_each_entry (clki, head, list) {if (!IS_ERR_OR_NULL (clki->clk)) {if (
skip_ref_clk&& !strcmp(clki->name,
"ref_clk"))
Quoted 27 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/scsi/ufs/ufshcd.h +1
-0@@ -252,6 +252,7 @@ struct ufs_pwr_mode_info {* @exit: called to cleanup everything done in init * @get_ufs_hci_version: called to get UFS HCI version * @clk_scale_notify: notifies that clks are scaled up/down +* @pre_setup_clocks: called before controlling used clocks Quoted 8 lines
Quoted 8 lines
drivers/scsi/ufs/ufshcd.h struct ufs_pwr_mode_info { · line 263
Quoted 8 lines
drivers/scsi/ufs/ufshcd.h +0
-0* @setup_clocks: called before touching any of the controller registers
* @setup_regulators: called before accessing the host controller
* @hce_enable_notify: called before and after HCE enable bit is set
to allowdrivers/scsi/ufs/ufshcd.h +0
-0@@ -261,6 +262,9 @@ struct ufs_pwr_mode_info {* @pwr_change_notify: called before and after a power mode change * is carried out to allow vendor spesific capabilities
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/scsi/ufs/ufshcd.h +3
-0* to be set. +* @set_nexus_t_xfer_req: +* @set_nexus_t_task_mgmt: +* @hibern8_notify: * @suspend: called during host controller PM callback * @resume: called during host controller PM callback * @dbg_register_dump: used to dump controller debug information @@ -273,6 +277,7 @@ struct ufs_hba_variant_ops {u32 (*get_ufs_hci_version)(struct ufs_hba *);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/scsi/ufs/ufshcd.h struct ufs_hba_variant_ops { · line 288
Quoted 8 lines
drivers/scsi/ufs/ufshcd.h +1
-0int (*clk_scale_notify)(struct ufs_hba *,bool ,enum ufs_notify_change_status ); +int (*pre_setup_clocks)(struct ufs_hba *,bool );int (*setup_clocks)(struct ufs_hba *,bool );int (*setup_regulators)(struct ufs_hba *,bool ); int (*hce_enable_notify)(struct ufs_hba *,@@ -283,6 +288,10 @@ struct ufs_hba_variant_ops { enum
ufs_notify_change_status
Quoted 32 lines
Quoted 32 lines
status,
Quoted 31 lines
Quoted 31 lines
drivers/scsi/ufs/ufshcd.h +11
-0struct ufs_pa_layer_attr *, struct ufs_pa_layer_attr *); +void (*set_nexus_t_xfer_req)(struct ufs_hba *, +int ,struct scsi_cmnd *); +void (*set_nexus_t_task_mgmt)(struct ufs_hba *,int ,u8 ); +void (*hibern8_notify)(struct ufs_hba *,u8 ,bool );int (*suspend)(struct ufs_hba *,enum ufs_pm_op );int (*resume)(struct ufs_hba *,enum ufs_pm_op );void (*dbg_register_dump)(struct ufs_hba *hba);@@ -755,6 +764,13 @@ static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba, return 0; } +static inline int ufshcd_vops_pre_setup_clocks (struct ufs_hba *hba,bool on) +{ +if (hba->vops && hba->vops->pre_setup_clocks) +return hba->vops->pre_setup_clocks (hba, on); +return 0 ; +} + static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, boolon)
{drivers/scsi/ufs/ufshcd.h +0
-0if (hba->vops && hba->vops->setup_clocks)@@ -799,6 +815,27 @@ static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba, return -ENOTSUPP; }
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/scsi/ufs/ufshcd.h static inline int · line 821
Quoted 3 lines
drivers/scsi/ufs/ufshcd.h +2
-0+static inline void ufshcd_vops_set_nexus_t_xfer_req (struct ufs_hba *hba, + int tag, struct scsi_cmnd
*cmd)
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/scsi/ufs/ufshcd.h static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba,
Quoted 3 lines
drivers/scsi/ufs/ufshcd.h +3
-0+{ +if (hba->vops && hba->vops->set_nexus_t_xfer_req) + return hba->vops->set_nexus_t_xfer_req(hba, tag,
cmd);
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/scsi/ufs/ufshcd.h static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba,
Quoted 8 lines
drivers/scsi/ufs/ufshcd.h +7
-0+} + +static inline void ufshcd_vops_set_nexus_t_task_mgmt (struct ufs_hba *hba, +int tag,u8 tm_function) +{ +if (hba->vops && hba->vops->set_nexus_t_task_mgmt) + return hba->vops->set_nexus_t_task_mgmt(hba, tag,
tm_function);
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/scsi/ufs/ufshcd.h static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba,
Quoted 7 lines
drivers/scsi/ufs/ufshcd.h +7
-0+} + +static inline void ufshcd_vops_hibern8_notify (struct ufs_hba *hba, +u8 enter,bool notify) +{ +if (hba->vops && hba->vops->hibern8_notify) + return hba->vops->hibern8_notify(hba, enter,
notify);
Quoted 23 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
drivers/scsi/ufs/ufshcd.h +2
-0+} +static inline int ufshcd_vops_suspend(struct
ufs_hba*hba, enumufs_pm_opop)
{
if (hba->vops&&hba->vops->suspend)Quoted 8 lines
Quoted 8 lines
--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 79 lines · Kiwoong Kim
Hi, Subhash.
Quoted 19 lines
Hi Kim,
Quoted 16 lines · Kiwoong Kim
Hi, Subhash.
Thank for your comments.
I added my opinions below.Regards
Quoted 9 lines
Hi Kim,
Quoted 3 lines · Kiwoong Kim
Some UFS host controller may need to require some sequences before used clocks are turned on or off.
e.g) control internal gates in UFS hostQuoted 6 lines
Quoted 4 lines
Quoted 4 lines
I believe we are doing couple of other things as well other than clock control in this patch, such as hibern8 notify, *nexus_t* notify. You might want to separate each in different patches. Also, please find more
are you going to divide this patch?
Yes.
Quoted 18 lines
Quoted 8 lines
Quoted 8 lines
additional below.
Quoted 5 lines
Signed-off-by Kiwoong Kim <[email protected]>--- drivers/scsi/ufs/ufshcd.c | 15 +++++++++++++-- drivers/scsi/ufs/ufshcd.h | 37+++++++++++++++++++++++++++++++++++++
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
2 files changed, 50 insertions(+), 2 deletions(-)drivers/scsi/ufs/ufshcd.c +0
-0@@ -1474,6 +1474,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/scsi/ufs/ufshcd.c +1
-0/* issue command to the controller */ spin_lock_irqsave (hba->host->host_lock, flags); +ufshcd_vops_set_nexus_t_xfer_req (hba, tag, lrbp->cmd);ufshcd_send_command (hba, tag); out_unlock:
spin_unlock_irqrestore(hba->host->host_lock, flags); @@-1683,6
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+1684,7 @@ static int ufshcd_exec_dev_cmd(struct
ufs_hba*hba,
/* Make sure descriptors are ready before ringing thedoorbell */
Quoted 16 lines
Quoted 8 lines
Quoted 7 lines
drivers/scsi/ufs/ufshcd.c static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, · line 1687
Quoted 3 lines
drivers/scsi/ufs/ufshcd.c +1
-0wmb ();spin_lock_irqsave (hba->host->host_lock, flags); +ufshcd_vops_set_nexus_t_xfer_req (hba, tag, lrbp->cmd);what does "
next_t_xfer_req" means? why do we need this? and do you think
it may be useful/needed for non-exynos UFS host controllers as well?Quoted 7 lines
Exynos UFS controller has a logic to determine which slot owns received
UPIU,
to handle it properly.
This only run when software set a exynos-specific SFR to bitwise-1. If the controller sends non-dependent request, such as NOP, software would set the SFR to 0 because it don't need to determine.Quoted 4 lines
Ok, this is very specific to your controller. But i guess still the callback names should be generic enough so that it may be used by other host controller drivers if required in future.
Can we think of different name? something likenotify_cmd_issue?
Quoted 8 lines
Okay, that's good.
Quoted 3 lines
Also, why do we need to pass whole pointer to pass scsi command pointer? what all scsi cmnd parameters will be used by exynos driver? may be your full patch series might give more idea?
I get it. How about using (void *) type pointer as an additional argument To pass anything away to platform-specific driver ?
Should be ok.
Quoted 235 lines
Thank you
RegardsQuoted 38 lines
Quoted 38 lines
An answer of your question depends on whether other controllers has a logic to function that.
Quoted 32 lines
Quoted 32 lines
drivers/scsi/ufs/ufshcd.c +4
-1ufshcd_send_command (hba, tag);spin_unlock_irqrestore (hba->host->host_lock, flags);@@ -2651,6 +2653,8 @@ static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba)int ret;struct uic_command uic_cmd = {0 }; +ufshcd_vops_hibern8_notify (hba, true,PRE_CHANGE ); + uic_cmd.command =UIC_CMD_DME_HIBER_ENTER ; ret =ufshcd_uic_pwr_ctrl (hba, &uic_cmd);@@ -2664,7 +2668,8 @@ static int __ufshcd_uic_hibern8_enter(structufs_hba *hba) */ if (ufshcd_link_recovery (hba)) ret = -ENOLINK ; - } + }else +ufshcd_vops_hibern8_notify (hba, true,POST_CHANGE );return ret;}
drivers/scsi/ufs/ufshcd.c +0
-0@@ -2687,13 +2692,16 @@ static int ufshcd_uic_hibern8_exit(struct ufs_hba *hba)struct uic_command uic_cmd = {0 };int ret;Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/scsi/ufs/ufshcd.c static int ufshcd_uic_hibern8_exit(struct ufs_hba *hba)
Quoted 6 lines
drivers/scsi/ufs/ufshcd.c +2
-0+ufshcd_vops_hibern8_notify (hba, false,PRE_CHANGE ); + uic_cmd.command =UIC_CMD_DME_HIBER_EXIT ; ret =ufshcd_uic_pwr_ctrl (hba, &uic_cmd);if (ret) { dev_err(hba->dev, "%s: hibern8 exit failed. ret =%d\n",
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/scsi/ufs/ufshcd.c +2
-1__func__, ret); ret =ufshcd_link_recovery (hba); - } + }else +ufshcd_vops_hibern8_notify (hba, false,POST_CHANGE );Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/scsi/ufs/ufshcd.c static int ufshcd_issue_tm_cmd(struct ufs_hba · line 4324
Quoted 8 lines
drivers/scsi/ufs/ufshcd.c +0
-0return ret;}
drivers/scsi/ufs/ufshcd.c +1
-0@@ -4312,6 +4320,7 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id, task_req_upiup->input_param2 =cpu_to_be32 (task_id);/* send command to the controller */ + ufshcd_vops_set_nexus_t_task_mgmt(hba, free_slot,
tm_function);Quoted 22 lines
Same as above, we need to think of more generic name?
Thanks,
SubhashQuoted 14 lines
Quoted 6 lines
Same question as "
next_t_xfer_req". what does "next_t_task_mgmt" means?
why do we need this? and do you think it may be useful/needed for non-exynos UFS host controllers as well?Please refer to what I mentioned above.
Quoted 5 lines
Quoted 5 lines
drivers/scsi/ufs/ufshcd.c +0
-0__set_bit (free_slot, &hba->outstanding_tasks);/* Make sure descriptors are ready before ringing the task
doorbell
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
drivers/scsi/ufs/ufshcd.c static int __ufshcd_setup_clocks(struct ufs_hba · line 5403
Quoted 8 lines
*/
drivers/scsi/ufs/ufshcd.c +2
-0@@ -5389,6 +5398,8 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, if (!head || list_empty(head)) goto out; +ufshcd_vops_pre_setup_clocks (hba, on); +I don't think we need a different op for this, we can simply use the existing op and add one more argument to it to indicate PRE_CHANGE/POST_CHANGE. If you agree with my response to "[PATCH v2]
scsi: ufshcd: fix possible unclocked register access" patch, i can update send out v3 of my patch and then you can rebase your patch series
on top of my patch.Quoted 8 lines
Quoted 8 lines
Okay, I agree with you. Then I assume that you would do that and will change the patch.
Quoted 5 lines
Quoted 5 lines
drivers/scsi/ufs/ufshcd.c +0
-0list_for_each_entry (clki, head, list) {if (!IS_ERR_OR_NULL (clki->clk)) {if (
skip_ref_clk&& !strcmp(clki->name,"
ref_clk"))Quoted 27 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/scsi/ufs/ufshcd.h +1
-0@@ -252,6 +252,7 @@ struct ufs_pwr_mode_info {* @exit: called to cleanup everything done in init * @get_ufs_hci_version: called to get UFS HCI version * @clk_scale_notify: notifies that clks are scaled up/down +* @pre_setup_clocks: called before controlling used clocks Quoted 8 lines
Quoted 8 lines
drivers/scsi/ufs/ufshcd.h struct ufs_pwr_mode_info { · line 263
Quoted 8 lines
drivers/scsi/ufs/ufshcd.h +0
-0* @setup_clocks: called before touching any of the controller registers
* @setup_regulators: called before accessing the host controller
* @hce_enable_notify: called before and after HCE enable bit is set
to allowdrivers/scsi/ufs/ufshcd.h +0
-0@@ -261,6 +262,9 @@ struct ufs_pwr_mode_info {* @pwr_change_notify: called before and after a power mode change * is carried out to allow vendor spesific capabilities
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/scsi/ufs/ufshcd.h +3
-0* to be set. +* @set_nexus_t_xfer_req: +* @set_nexus_t_task_mgmt: +* @hibern8_notify: * @suspend: called during host controller PM callback * @resume: called during host controller PM callback * @dbg_register_dump: used to dump controller debug information @@ -273,6 +277,7 @@ struct ufs_hba_variant_ops {u32 (*get_ufs_hci_version)(struct ufs_hba *);Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/scsi/ufs/ufshcd.h struct ufs_hba_variant_ops { · line 288
Quoted 8 lines
drivers/scsi/ufs/ufshcd.h +1
-0int (*clk_scale_notify)(struct ufs_hba *,bool ,enum ufs_notify_change_status ); +int (*pre_setup_clocks)(struct ufs_hba *,bool );int (*setup_clocks)(struct ufs_hba *,bool );int (*setup_regulators)(struct ufs_hba *,bool ); int (*hce_enable_notify)(struct ufs_hba *,@@ -283,6 +288,10 @@ struct ufs_hba_variant_ops { enum
ufs_notify_change_statusQuoted 32 lines
Quoted 32 lines
status,
Quoted 31 lines
Quoted 31 lines
drivers/scsi/ufs/ufshcd.h +11
-0struct ufs_pa_layer_attr *, struct ufs_pa_layer_attr *); +void (*set_nexus_t_xfer_req)(struct ufs_hba *, +int ,struct scsi_cmnd *); +void (*set_nexus_t_task_mgmt)(struct ufs_hba *,int ,u8 ); +void (*hibern8_notify)(struct ufs_hba *,u8 ,bool );int (*suspend)(struct ufs_hba *,enum ufs_pm_op );int (*resume)(struct ufs_hba *,enum ufs_pm_op );void (*dbg_register_dump)(struct ufs_hba *hba);@@ -755,6 +764,13 @@ static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba, return 0; } +static inline int ufshcd_vops_pre_setup_clocks (struct ufs_hba *hba,bool on) +{ +if (hba->vops && hba->vops->pre_setup_clocks) +return hba->vops->pre_setup_clocks (hba, on); +return 0 ; +} + static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, boolon)
{drivers/scsi/ufs/ufshcd.h +0
-0if (hba->vops && hba->vops->setup_clocks)@@ -799,6 +815,27 @@ static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba, return -ENOTSUPP; }Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/scsi/ufs/ufshcd.h static inline int · line 821
Quoted 3 lines
drivers/scsi/ufs/ufshcd.h +2
-0+static inline void ufshcd_vops_set_nexus_t_xfer_req (struct ufs_hba *hba, + int tag, struct scsi_cmnd*cmd)
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/scsi/ufs/ufshcd.h static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba,
Quoted 3 lines
drivers/scsi/ufs/ufshcd.h +3
-0+{ +if (hba->vops && hba->vops->set_nexus_t_xfer_req) + return hba->vops->set_nexus_t_xfer_req(hba, tag,cmd);
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/scsi/ufs/ufshcd.h static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba,
Quoted 8 lines
drivers/scsi/ufs/ufshcd.h +7
-0+} + +static inline void ufshcd_vops_set_nexus_t_task_mgmt (struct ufs_hba *hba, +int tag,u8 tm_function) +{ +if (hba->vops && hba->vops->set_nexus_t_task_mgmt) + return hba->vops->set_nexus_t_task_mgmt(hba, tag,
tm_function);Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/scsi/ufs/ufshcd.h static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba,
Quoted 7 lines
drivers/scsi/ufs/ufshcd.h +7
-0+} + +static inline void ufshcd_vops_hibern8_notify (struct ufs_hba *hba, +u8 enter,bool notify) +{ +if (hba->vops && hba->vops->hibern8_notify) + return hba->vops->hibern8_notify(hba, enter,notify);
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
drivers/scsi/ufs/ufshcd.h +2
-0+} +static inline int ufshcd_vops_suspend(struct
ufs_hba*hba, enumufs_pm_opop)
{
if (hba->vops&&hba->vops->suspend)Quoted 8 lines
Quoted 8 lines
--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlQuoted 7 lines
--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project