Merge "scsi: ufs: Unblock UFS while ICE HW configuration"
This commit is contained in:
commit
40f83efeab
3 changed files with 15 additions and 31 deletions
|
@ -125,6 +125,9 @@ static int qti_ice_setting_config(struct request *req,
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!setting)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
if ((short)(crypto_data->key_index) >= 0) {
|
if ((short)(crypto_data->key_index) >= 0) {
|
||||||
|
|
||||||
memcpy(&setting->crypto_data, crypto_data,
|
memcpy(&setting->crypto_data, crypto_data,
|
||||||
|
|
|
@ -170,17 +170,15 @@ out:
|
||||||
static void ufs_qcom_ice_cfg_work(struct work_struct *work)
|
static void ufs_qcom_ice_cfg_work(struct work_struct *work)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
struct ice_data_setting ice_set;
|
|
||||||
struct ufs_qcom_host *qcom_host =
|
struct ufs_qcom_host *qcom_host =
|
||||||
container_of(work, struct ufs_qcom_host, ice_cfg_work);
|
container_of(work, struct ufs_qcom_host, ice_cfg_work);
|
||||||
struct request *req_pending = NULL;
|
|
||||||
|
|
||||||
if (!qcom_host->ice.vops->config_start)
|
if (!qcom_host->ice.vops->config_start)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
spin_lock_irqsave(&qcom_host->ice_work_lock, flags);
|
spin_lock_irqsave(&qcom_host->ice_work_lock, flags);
|
||||||
req_pending = qcom_host->req_pending;
|
if (!qcom_host->req_pending) {
|
||||||
if (!req_pending) {
|
qcom_host->work_pending = false;
|
||||||
spin_unlock_irqrestore(&qcom_host->ice_work_lock, flags);
|
spin_unlock_irqrestore(&qcom_host->ice_work_lock, flags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -189,24 +187,15 @@ static void ufs_qcom_ice_cfg_work(struct work_struct *work)
|
||||||
/*
|
/*
|
||||||
* config_start is called again as previous attempt returned -EAGAIN,
|
* config_start is called again as previous attempt returned -EAGAIN,
|
||||||
* this call shall now take care of the necessary key setup.
|
* this call shall now take care of the necessary key setup.
|
||||||
* 'ice_set' will not actually be used, instead the next call to
|
|
||||||
* config_start() for this request, in the normal call flow, will
|
|
||||||
* succeed as the key has now been setup.
|
|
||||||
*/
|
*/
|
||||||
qcom_host->ice.vops->config_start(qcom_host->ice.pdev,
|
qcom_host->ice.vops->config_start(qcom_host->ice.pdev,
|
||||||
qcom_host->req_pending, &ice_set, false);
|
qcom_host->req_pending, NULL, false);
|
||||||
|
|
||||||
spin_lock_irqsave(&qcom_host->ice_work_lock, flags);
|
spin_lock_irqsave(&qcom_host->ice_work_lock, flags);
|
||||||
qcom_host->req_pending = NULL;
|
qcom_host->req_pending = NULL;
|
||||||
|
qcom_host->work_pending = false;
|
||||||
spin_unlock_irqrestore(&qcom_host->ice_work_lock, flags);
|
spin_unlock_irqrestore(&qcom_host->ice_work_lock, flags);
|
||||||
|
|
||||||
/*
|
|
||||||
* Resume with requests processing. We assume config_start has been
|
|
||||||
* successful, but even if it wasn't we still must resume in order to
|
|
||||||
* allow for the request to be retried.
|
|
||||||
*/
|
|
||||||
ufshcd_scsi_unblock_requests(qcom_host->hba);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -285,18 +274,14 @@ int ufs_qcom_ice_req_setup(struct ufs_qcom_host *qcom_host,
|
||||||
* requires a non-atomic context, this means we should
|
* requires a non-atomic context, this means we should
|
||||||
* call the function again from the worker thread to do
|
* call the function again from the worker thread to do
|
||||||
* the configuration. For this request the error will
|
* the configuration. For this request the error will
|
||||||
* propagate so it will be re-queued and until the
|
* propagate so it will be re-queued.
|
||||||
* configuration is is completed we block further
|
|
||||||
* request processing.
|
|
||||||
*/
|
*/
|
||||||
if (err == -EAGAIN) {
|
if (err == -EAGAIN) {
|
||||||
dev_dbg(qcom_host->hba->dev,
|
dev_dbg(qcom_host->hba->dev,
|
||||||
"%s: scheduling task for ice setup\n",
|
"%s: scheduling task for ice setup\n",
|
||||||
__func__);
|
__func__);
|
||||||
|
|
||||||
if (!qcom_host->req_pending) {
|
if (!qcom_host->work_pending) {
|
||||||
ufshcd_scsi_block_requests(
|
|
||||||
qcom_host->hba);
|
|
||||||
qcom_host->req_pending = cmd->request;
|
qcom_host->req_pending = cmd->request;
|
||||||
|
|
||||||
if (!schedule_work(
|
if (!schedule_work(
|
||||||
|
@ -307,10 +292,9 @@ int ufs_qcom_ice_req_setup(struct ufs_qcom_host *qcom_host,
|
||||||
&qcom_host->ice_work_lock,
|
&qcom_host->ice_work_lock,
|
||||||
flags);
|
flags);
|
||||||
|
|
||||||
ufshcd_scsi_unblock_requests(
|
|
||||||
qcom_host->hba);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
qcom_host->work_pending = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -409,9 +393,7 @@ int ufs_qcom_ice_cfg_start(struct ufs_qcom_host *qcom_host,
|
||||||
* requires a non-atomic context, this means we should
|
* requires a non-atomic context, this means we should
|
||||||
* call the function again from the worker thread to do
|
* call the function again from the worker thread to do
|
||||||
* the configuration. For this request the error will
|
* the configuration. For this request the error will
|
||||||
* propagate so it will be re-queued and until the
|
* propagate so it will be re-queued.
|
||||||
* configuration is is completed we block further
|
|
||||||
* request processing.
|
|
||||||
*/
|
*/
|
||||||
if (err == -EAGAIN) {
|
if (err == -EAGAIN) {
|
||||||
|
|
||||||
|
@ -419,9 +401,8 @@ int ufs_qcom_ice_cfg_start(struct ufs_qcom_host *qcom_host,
|
||||||
"%s: scheduling task for ice setup\n",
|
"%s: scheduling task for ice setup\n",
|
||||||
__func__);
|
__func__);
|
||||||
|
|
||||||
if (!qcom_host->req_pending) {
|
if (!qcom_host->work_pending) {
|
||||||
ufshcd_scsi_block_requests(
|
|
||||||
qcom_host->hba);
|
|
||||||
qcom_host->req_pending = cmd->request;
|
qcom_host->req_pending = cmd->request;
|
||||||
if (!schedule_work(
|
if (!schedule_work(
|
||||||
&qcom_host->ice_cfg_work)) {
|
&qcom_host->ice_cfg_work)) {
|
||||||
|
@ -431,10 +412,9 @@ int ufs_qcom_ice_cfg_start(struct ufs_qcom_host *qcom_host,
|
||||||
&qcom_host->ice_work_lock,
|
&qcom_host->ice_work_lock,
|
||||||
flags);
|
flags);
|
||||||
|
|
||||||
ufshcd_scsi_unblock_requests(
|
|
||||||
qcom_host->hba);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
qcom_host->work_pending = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -374,6 +374,7 @@ struct ufs_qcom_host {
|
||||||
struct work_struct ice_cfg_work;
|
struct work_struct ice_cfg_work;
|
||||||
struct request *req_pending;
|
struct request *req_pending;
|
||||||
struct ufs_vreg *vddp_ref_clk;
|
struct ufs_vreg *vddp_ref_clk;
|
||||||
|
bool work_pending;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline u32
|
static inline u32
|
||||||
|
|
Loading…
Add table
Reference in a new issue