mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 21:21:41 +00:00
Merge patch series "Multiple cleanup patches for the UFS driver"
Bart Van Assche <bvanassche@acm.org> says: Hi Martin, This patch includes the following changes, none of which should change the functionality of the UFS host controller driver: - Improve the kernel-doc headers further. - Fix multiple W=2 compiler warnings. - Simplify ufshcd_abort_all(). - Simplify the code for creating and parsing UFS Transport Protocol (UTP) headers. Please consider this patch series for the next merge window. Thanks, Bart. Link: https://lore.kernel.org/r/20230727194457.3152309-1-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
commit
6cae9a3910
@ -127,7 +127,8 @@ static int ufs_hwmon_write(struct device *dev, enum hwmon_sensor_types type, u32
|
||||
return err;
|
||||
}
|
||||
|
||||
static umode_t ufs_hwmon_is_visible(const void *_data, enum hwmon_sensor_types type, u32 attr,
|
||||
static umode_t ufs_hwmon_is_visible(const void *data,
|
||||
enum hwmon_sensor_types type, u32 attr,
|
||||
int channel)
|
||||
{
|
||||
if (type != hwmon_temp)
|
||||
|
@ -105,7 +105,7 @@ EXPORT_SYMBOL_GPL(ufshcd_mcq_config_mac);
|
||||
* @hba: per adapter instance
|
||||
* @req: pointer to the request to be issued
|
||||
*
|
||||
* Returns the hardware queue instance on which the request would
|
||||
* Return: the hardware queue instance on which the request would
|
||||
* be queued.
|
||||
*/
|
||||
struct ufs_hw_queue *ufshcd_mcq_req_to_hwq(struct ufs_hba *hba,
|
||||
@ -121,7 +121,7 @@ struct ufs_hw_queue *ufshcd_mcq_req_to_hwq(struct ufs_hba *hba,
|
||||
* ufshcd_mcq_decide_queue_depth - decide the queue depth
|
||||
* @hba: per adapter instance
|
||||
*
|
||||
* Returns queue-depth on success, non-zero on error
|
||||
* Return: queue-depth on success, non-zero on error
|
||||
*
|
||||
* MAC - Max. Active Command of the Host Controller (HC)
|
||||
* HC wouldn't send more than this commands to the device.
|
||||
@ -493,7 +493,7 @@ static int ufshcd_mcq_sq_start(struct ufs_hba *hba, struct ufs_hw_queue *hwq)
|
||||
* @hba: per adapter instance.
|
||||
* @task_tag: The command's task tag.
|
||||
*
|
||||
* Returns 0 for success; error code otherwise.
|
||||
* Return: 0 for success; error code otherwise.
|
||||
*/
|
||||
int ufshcd_mcq_sq_cleanup(struct ufs_hba *hba, int task_tag)
|
||||
{
|
||||
@ -558,12 +558,7 @@ unlock:
|
||||
*/
|
||||
static void ufshcd_mcq_nullify_sqe(struct utp_transfer_req_desc *utrd)
|
||||
{
|
||||
u32 dword_0;
|
||||
|
||||
dword_0 = le32_to_cpu(utrd->header.dword_0);
|
||||
dword_0 &= ~UPIU_COMMAND_TYPE_MASK;
|
||||
dword_0 |= FIELD_PREP(UPIU_COMMAND_TYPE_MASK, 0xF);
|
||||
utrd->header.dword_0 = cpu_to_le32(dword_0);
|
||||
utrd->header.command_type = 0xf;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -575,7 +570,7 @@ static void ufshcd_mcq_nullify_sqe(struct utp_transfer_req_desc *utrd)
|
||||
* @hwq: Hardware Queue to be searched.
|
||||
* @task_tag: The command's task tag.
|
||||
*
|
||||
* Returns true if the SQE containing the command is present in the SQ
|
||||
* Return: true if the SQE containing the command is present in the SQ
|
||||
* (not fetched by the controller); returns false if the SQE is not in the SQ.
|
||||
*/
|
||||
static bool ufshcd_mcq_sqe_search(struct ufs_hba *hba,
|
||||
@ -624,7 +619,7 @@ out:
|
||||
* ufshcd_mcq_abort - Abort the command in MCQ.
|
||||
* @cmd: The command to be aborted.
|
||||
*
|
||||
* Returns SUCCESS or FAILED error codes
|
||||
* Return: SUCCESS or FAILED error codes
|
||||
*/
|
||||
int ufshcd_mcq_abort(struct scsi_cmnd *cmd)
|
||||
{
|
||||
|
@ -232,6 +232,8 @@ static inline void ufs_bsg_node_release(struct device *dev)
|
||||
* @hba: per adapter object
|
||||
*
|
||||
* Called during initial loading of the driver, and before scsi_scan_host.
|
||||
*
|
||||
* Returns: 0 (success).
|
||||
*/
|
||||
int ufs_bsg_probe(struct ufs_hba *hba)
|
||||
{
|
||||
|
@ -26,15 +26,15 @@ static inline void ufshcd_prepare_lrbp_crypto(struct request *rq,
|
||||
}
|
||||
|
||||
static inline void
|
||||
ufshcd_prepare_req_desc_hdr_crypto(struct ufshcd_lrb *lrbp, u32 *dword_0,
|
||||
u32 *dword_1, u32 *dword_3)
|
||||
ufshcd_prepare_req_desc_hdr_crypto(struct ufshcd_lrb *lrbp,
|
||||
struct request_desc_header *h)
|
||||
{
|
||||
if (lrbp->crypto_key_slot >= 0) {
|
||||
*dword_0 |= UTP_REQ_DESC_CRYPTO_ENABLE_CMD;
|
||||
*dword_0 |= lrbp->crypto_key_slot;
|
||||
*dword_1 = lower_32_bits(lrbp->data_unit_num);
|
||||
*dword_3 = upper_32_bits(lrbp->data_unit_num);
|
||||
}
|
||||
if (lrbp->crypto_key_slot < 0)
|
||||
return;
|
||||
h->enable_crypto = 1;
|
||||
h->cci = lrbp->crypto_key_slot;
|
||||
h->dunl = cpu_to_le32(lower_32_bits(lrbp->data_unit_num));
|
||||
h->dunu = cpu_to_le32(upper_32_bits(lrbp->data_unit_num));
|
||||
}
|
||||
|
||||
bool ufshcd_crypto_enable(struct ufs_hba *hba);
|
||||
@ -51,8 +51,8 @@ static inline void ufshcd_prepare_lrbp_crypto(struct request *rq,
|
||||
struct ufshcd_lrb *lrbp) { }
|
||||
|
||||
static inline void
|
||||
ufshcd_prepare_req_desc_hdr_crypto(struct ufshcd_lrb *lrbp, u32 *dword_0,
|
||||
u32 *dword_1, u32 *dword_3) { }
|
||||
ufshcd_prepare_req_desc_hdr_crypto(struct ufshcd_lrb *lrbp,
|
||||
struct request_desc_header *h) { }
|
||||
|
||||
static inline bool ufshcd_crypto_enable(struct ufs_hba *hba)
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd);
|
||||
int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
|
||||
struct utp_upiu_req *req_upiu,
|
||||
struct utp_upiu_req *rsp_upiu,
|
||||
int msgcode,
|
||||
enum upiu_request_transaction msgcode,
|
||||
u8 *desc_buff, int *buff_len,
|
||||
enum query_opcode desc_op);
|
||||
|
||||
@ -294,7 +294,7 @@ extern const struct ufs_pm_lvl_states ufs_pm_lvl_states[];
|
||||
* ufshcd_scsi_to_upiu_lun - maps scsi LUN to UPIU LUN
|
||||
* @scsi_lun: scsi LUN id
|
||||
*
|
||||
* Returns UPIU LUN id
|
||||
* Return: UPIU LUN id
|
||||
*/
|
||||
static inline u8 ufshcd_scsi_to_upiu_lun(unsigned int scsi_lun)
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -101,11 +101,10 @@ static void cdns_ufs_set_l4_attr(struct ufs_hba *hba)
|
||||
}
|
||||
|
||||
/**
|
||||
* cdns_ufs_set_hclkdiv()
|
||||
* Sets HCLKDIV register value based on the core_clk
|
||||
* cdns_ufs_set_hclkdiv() - set HCLKDIV register value based on the core_clk.
|
||||
* @hba: host controller instance
|
||||
*
|
||||
* Return zero for success and non-zero for failure
|
||||
* Return: zero for success and non-zero for failure.
|
||||
*/
|
||||
static int cdns_ufs_set_hclkdiv(struct ufs_hba *hba)
|
||||
{
|
||||
@ -143,12 +142,11 @@ static int cdns_ufs_set_hclkdiv(struct ufs_hba *hba)
|
||||
}
|
||||
|
||||
/**
|
||||
* cdns_ufs_hce_enable_notify()
|
||||
* Called before and after HCE enable bit is set.
|
||||
* cdns_ufs_hce_enable_notify() - set HCLKDIV register
|
||||
* @hba: host controller instance
|
||||
* @status: notify stage (pre, post change)
|
||||
*
|
||||
* Return zero for success and non-zero for failure
|
||||
* Return: zero for success and non-zero for failure.
|
||||
*/
|
||||
static int cdns_ufs_hce_enable_notify(struct ufs_hba *hba,
|
||||
enum ufs_notify_change_status status)
|
||||
@ -160,12 +158,10 @@ static int cdns_ufs_hce_enable_notify(struct ufs_hba *hba,
|
||||
}
|
||||
|
||||
/**
|
||||
* cdns_ufs_hibern8_notify()
|
||||
* Called around hibern8 enter/exit.
|
||||
* cdns_ufs_hibern8_notify() - save and restore L4 attributes.
|
||||
* @hba: host controller instance
|
||||
* @cmd: UIC Command
|
||||
* @status: notify stage (pre, post change)
|
||||
*
|
||||
*/
|
||||
static void cdns_ufs_hibern8_notify(struct ufs_hba *hba, enum uic_cmd_dme cmd,
|
||||
enum ufs_notify_change_status status)
|
||||
@ -177,12 +173,11 @@ static void cdns_ufs_hibern8_notify(struct ufs_hba *hba, enum uic_cmd_dme cmd,
|
||||
}
|
||||
|
||||
/**
|
||||
* cdns_ufs_link_startup_notify()
|
||||
* Called before and after Link startup is carried out.
|
||||
* cdns_ufs_link_startup_notify() - handle link startup.
|
||||
* @hba: host controller instance
|
||||
* @status: notify stage (pre, post change)
|
||||
*
|
||||
* Return zero for success and non-zero for failure
|
||||
* Return: zero for success and non-zero for failure.
|
||||
*/
|
||||
static int cdns_ufs_link_startup_notify(struct ufs_hba *hba,
|
||||
enum ufs_notify_change_status status)
|
||||
@ -212,7 +207,7 @@ static int cdns_ufs_link_startup_notify(struct ufs_hba *hba,
|
||||
* cdns_ufs_init - performs additional ufs initialization
|
||||
* @hba: host controller instance
|
||||
*
|
||||
* Returns status of initialization
|
||||
* Return: status of initialization.
|
||||
*/
|
||||
static int cdns_ufs_init(struct ufs_hba *hba)
|
||||
{
|
||||
@ -235,7 +230,7 @@ static int cdns_ufs_init(struct ufs_hba *hba)
|
||||
* cdns_ufs_m31_16nm_phy_initialization - performs m31 phy initialization
|
||||
* @hba: host controller instance
|
||||
*
|
||||
* Always returns 0
|
||||
* Return: 0 (success).
|
||||
*/
|
||||
static int cdns_ufs_m31_16nm_phy_initialization(struct ufs_hba *hba)
|
||||
{
|
||||
@ -284,7 +279,7 @@ MODULE_DEVICE_TABLE(of, cdns_ufs_of_match);
|
||||
* cdns_ufs_pltfrm_probe - probe routine of the driver
|
||||
* @pdev: pointer to platform device handle
|
||||
*
|
||||
* Return zero for success and non-zero for failure
|
||||
* Return: zero for success and non-zero for failure.
|
||||
*/
|
||||
static int cdns_ufs_pltfrm_probe(struct platform_device *pdev)
|
||||
{
|
||||
@ -308,7 +303,7 @@ static int cdns_ufs_pltfrm_probe(struct platform_device *pdev)
|
||||
* cdns_ufs_pltfrm_remove - removes the ufs driver
|
||||
* @pdev: pointer to platform device handle
|
||||
*
|
||||
* Always returns 0
|
||||
* Return: 0 (success).
|
||||
*/
|
||||
static int cdns_ufs_pltfrm_remove(struct platform_device *pdev)
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ static void tc_dwc_g210_pci_remove(struct pci_dev *pdev)
|
||||
* @pdev: pointer to PCI device handle
|
||||
* @id: PCI device id
|
||||
*
|
||||
* Returns 0 on success, non-zero value on failure
|
||||
* Return: 0 on success, non-zero value on failure.
|
||||
*/
|
||||
static int
|
||||
tc_dwc_g210_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
|
@ -17,11 +17,10 @@
|
||||
#include "tc-dwc-g210.h"
|
||||
|
||||
/**
|
||||
* tc_dwc_g210_setup_40bit_rmmi()
|
||||
* This function configures Synopsys TC specific atributes (40-bit RMMI)
|
||||
* tc_dwc_g210_setup_40bit_rmmi() - configure 40-bit RMMI.
|
||||
* @hba: Pointer to drivers structure
|
||||
*
|
||||
* Returns 0 on success or non-zero value on failure
|
||||
* Return: 0 on success or non-zero value on failure.
|
||||
*/
|
||||
static int tc_dwc_g210_setup_40bit_rmmi(struct ufs_hba *hba)
|
||||
{
|
||||
@ -81,11 +80,10 @@ static int tc_dwc_g210_setup_40bit_rmmi(struct ufs_hba *hba)
|
||||
}
|
||||
|
||||
/**
|
||||
* tc_dwc_g210_setup_20bit_rmmi_lane0()
|
||||
* This function configures Synopsys TC 20-bit RMMI Lane 0
|
||||
* tc_dwc_g210_setup_20bit_rmmi_lane0() - configure 20-bit RMMI Lane 0.
|
||||
* @hba: Pointer to drivers structure
|
||||
*
|
||||
* Returns 0 on success or non-zero value on failure
|
||||
* Return: 0 on success or non-zero value on failure.
|
||||
*/
|
||||
static int tc_dwc_g210_setup_20bit_rmmi_lane0(struct ufs_hba *hba)
|
||||
{
|
||||
@ -134,11 +132,10 @@ static int tc_dwc_g210_setup_20bit_rmmi_lane0(struct ufs_hba *hba)
|
||||
}
|
||||
|
||||
/**
|
||||
* tc_dwc_g210_setup_20bit_rmmi_lane1()
|
||||
* This function configures Synopsys TC 20-bit RMMI Lane 1
|
||||
* tc_dwc_g210_setup_20bit_rmmi_lane1() - configure 20-bit RMMI Lane 1.
|
||||
* @hba: Pointer to drivers structure
|
||||
*
|
||||
* Returns 0 on success or non-zero value on failure
|
||||
* Return: 0 on success or non-zero value on failure.
|
||||
*/
|
||||
static int tc_dwc_g210_setup_20bit_rmmi_lane1(struct ufs_hba *hba)
|
||||
{
|
||||
@ -211,11 +208,10 @@ out:
|
||||
}
|
||||
|
||||
/**
|
||||
* tc_dwc_g210_setup_20bit_rmmi()
|
||||
* This function configures Synopsys TC specific atributes (20-bit RMMI)
|
||||
* tc_dwc_g210_setup_20bit_rmmi() - configure 20-bit RMMI.
|
||||
* @hba: Pointer to drivers structure
|
||||
*
|
||||
* Returns 0 on success or non-zero value on failure
|
||||
* Return: 0 on success or non-zero value on failure.
|
||||
*/
|
||||
static int tc_dwc_g210_setup_20bit_rmmi(struct ufs_hba *hba)
|
||||
{
|
||||
@ -251,12 +247,10 @@ out:
|
||||
}
|
||||
|
||||
/**
|
||||
* tc_dwc_g210_config_40_bit()
|
||||
* This function configures Local (host) Synopsys 40-bit TC specific attributes
|
||||
*
|
||||
* tc_dwc_g210_config_40_bit() - configure 40-bit TC specific attributes.
|
||||
* @hba: Pointer to drivers structure
|
||||
*
|
||||
* Returns 0 on success non-zero value on failure
|
||||
* Return: 0 on success non-zero value on failure.
|
||||
*/
|
||||
int tc_dwc_g210_config_40_bit(struct ufs_hba *hba)
|
||||
{
|
||||
@ -283,12 +277,10 @@ out:
|
||||
EXPORT_SYMBOL(tc_dwc_g210_config_40_bit);
|
||||
|
||||
/**
|
||||
* tc_dwc_g210_config_20_bit()
|
||||
* This function configures Local (host) Synopsys 20-bit TC specific attributes
|
||||
*
|
||||
* tc_dwc_g210_config_20_bit() - configure 20-bit TC specific attributes.
|
||||
* @hba: Pointer to drivers structure
|
||||
*
|
||||
* Returns 0 on success non-zero value on failure
|
||||
* Return: 0 on success non-zero value on failure.
|
||||
*/
|
||||
int tc_dwc_g210_config_20_bit(struct ufs_hba *hba)
|
||||
{
|
||||
|
@ -666,7 +666,7 @@ static void ufs_mtk_pwr_ctrl(struct ufs_hba *hba, bool on)
|
||||
* @on: If true, enable clocks else disable them.
|
||||
* @status: PRE_CHANGE or POST_CHANGE notify
|
||||
*
|
||||
* Returns 0 on success, non-zero on failure.
|
||||
* Return: 0 on success, non-zero on failure.
|
||||
*/
|
||||
static int ufs_mtk_setup_clocks(struct ufs_hba *hba, bool on,
|
||||
enum ufs_notify_change_status status)
|
||||
@ -885,7 +885,7 @@ failed:
|
||||
* Binds PHY with controller and powers up PHY enabling clocks
|
||||
* and regulators.
|
||||
*
|
||||
* Returns -EPROBE_DEFER if binding fails, returns negative error
|
||||
* Return: -EPROBE_DEFER if binding fails, returns negative error
|
||||
* on phy power up failure and returns zero on success.
|
||||
*/
|
||||
static int ufs_mtk_init(struct ufs_hba *hba)
|
||||
@ -1696,7 +1696,7 @@ static const struct ufs_hba_variant_ops ufs_hba_mtk_vops = {
|
||||
* ufs_mtk_probe - probe routine of the driver
|
||||
* @pdev: pointer to Platform device handle
|
||||
*
|
||||
* Return zero for success and non-zero for failure
|
||||
* Return: zero for success and non-zero for failure.
|
||||
*/
|
||||
static int ufs_mtk_probe(struct platform_device *pdev)
|
||||
{
|
||||
|
@ -529,7 +529,7 @@ static int ufs_qcom_hce_enable_notify(struct ufs_hba *hba,
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns zero for success and non-zero in case of a failure
|
||||
* Return: zero for success and non-zero in case of a failure.
|
||||
*/
|
||||
static int ufs_qcom_cfg_timers(struct ufs_hba *hba, u32 gear,
|
||||
u32 hs, u32 rate, bool update_link_startup_timer)
|
||||
@ -1055,7 +1055,7 @@ static void ufs_qcom_set_caps(struct ufs_hba *hba)
|
||||
* @on: If true, enable clocks else disable them.
|
||||
* @status: PRE_CHANGE or POST_CHANGE notify
|
||||
*
|
||||
* Returns 0 on success, non-zero on failure.
|
||||
* Return: 0 on success, non-zero on failure.
|
||||
*/
|
||||
static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on,
|
||||
enum ufs_notify_change_status status)
|
||||
@ -1162,7 +1162,7 @@ static int ufs_qcom_icc_init(struct ufs_qcom_host *host)
|
||||
* Binds PHY with controller and powers up PHY enabling clocks
|
||||
* and regulators.
|
||||
*
|
||||
* Returns -EPROBE_DEFER if binding fails, returns negative error
|
||||
* Return: -EPROBE_DEFER if binding fails, returns negative error
|
||||
* on phy power up failure and returns zero on success.
|
||||
*/
|
||||
static int ufs_qcom_init(struct ufs_hba *hba)
|
||||
@ -1885,7 +1885,7 @@ static const struct ufs_hba_variant_ops ufs_hba_qcom_vops = {
|
||||
* ufs_qcom_probe - probe routine of the driver
|
||||
* @pdev: pointer to Platform device handle
|
||||
*
|
||||
* Return zero for success and non-zero for failure
|
||||
* Return: zero for success and non-zero for failure.
|
||||
*/
|
||||
static int ufs_qcom_probe(struct platform_device *pdev)
|
||||
{
|
||||
|
@ -34,9 +34,7 @@ int ufshcd_dwc_dme_set_attrs(struct ufs_hba *hba,
|
||||
EXPORT_SYMBOL(ufshcd_dwc_dme_set_attrs);
|
||||
|
||||
/**
|
||||
* ufshcd_dwc_program_clk_div()
|
||||
* This function programs the clk divider value. This value is needed to
|
||||
* provide 1 microsecond tick to unipro layer.
|
||||
* ufshcd_dwc_program_clk_div() - program clock divider.
|
||||
* @hba: Private Structure pointer
|
||||
* @divider_val: clock divider value to be programmed
|
||||
*
|
||||
@ -47,11 +45,10 @@ static void ufshcd_dwc_program_clk_div(struct ufs_hba *hba, u32 divider_val)
|
||||
}
|
||||
|
||||
/**
|
||||
* ufshcd_dwc_link_is_up()
|
||||
* Check if link is up
|
||||
* ufshcd_dwc_link_is_up() - check if link is up.
|
||||
* @hba: private structure pointer
|
||||
*
|
||||
* Returns 0 on success, non-zero value on failure
|
||||
* Return: 0 on success, non-zero value on failure.
|
||||
*/
|
||||
static int ufshcd_dwc_link_is_up(struct ufs_hba *hba)
|
||||
{
|
||||
@ -68,7 +65,9 @@ static int ufshcd_dwc_link_is_up(struct ufs_hba *hba)
|
||||
}
|
||||
|
||||
/**
|
||||
* ufshcd_dwc_connection_setup()
|
||||
* ufshcd_dwc_connection_setup() - configure unipro attributes.
|
||||
* @hba: pointer to drivers private data
|
||||
*
|
||||
* This function configures both the local side (host) and the peer side
|
||||
* (device) unipro attributes to establish the connection to application/
|
||||
* cport.
|
||||
@ -76,9 +75,7 @@ static int ufshcd_dwc_link_is_up(struct ufs_hba *hba)
|
||||
* have this connection setup on reset. But invoking this function does no
|
||||
* harm and should be fine even working with any ufs device.
|
||||
*
|
||||
* @hba: pointer to drivers private data
|
||||
*
|
||||
* Returns 0 on success non-zero value on failure
|
||||
* Return: 0 on success non-zero value on failure.
|
||||
*/
|
||||
static int ufshcd_dwc_connection_setup(struct ufs_hba *hba)
|
||||
{
|
||||
@ -107,12 +104,11 @@ static int ufshcd_dwc_connection_setup(struct ufs_hba *hba)
|
||||
}
|
||||
|
||||
/**
|
||||
* ufshcd_dwc_link_startup_notify()
|
||||
* UFS Host DWC specific link startup sequence
|
||||
* ufshcd_dwc_link_startup_notify() - program clock divider.
|
||||
* @hba: private structure pointer
|
||||
* @status: Callback notify status
|
||||
*
|
||||
* Returns 0 on success, non-zero value on failure
|
||||
* Return: 0 on success, non-zero value on failure.
|
||||
*/
|
||||
int ufshcd_dwc_link_startup_notify(struct ufs_hba *hba,
|
||||
enum ufs_notify_change_status status)
|
||||
|
@ -524,7 +524,7 @@ static void ufshcd_pci_remove(struct pci_dev *pdev)
|
||||
* @pdev: pointer to PCI device handle
|
||||
* @id: PCI device id
|
||||
*
|
||||
* Returns 0 on success, non-zero value on failure
|
||||
* Return: 0 on success, non-zero value on failure.
|
||||
*/
|
||||
static int
|
||||
ufshcd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
|
@ -166,6 +166,8 @@ EXPORT_SYMBOL_GPL(ufshcd_populate_vreg);
|
||||
* If any of the supplies are not defined it is assumed that they are always-on
|
||||
* and hence return zero. If the property is defined but parsing is failed
|
||||
* then return corresponding error.
|
||||
*
|
||||
* Return: 0 upon success; < 0 upon failure.
|
||||
*/
|
||||
static int ufshcd_parse_regulator_info(struct ufs_hba *hba)
|
||||
{
|
||||
@ -212,7 +214,7 @@ static void ufshcd_init_lanes_per_dir(struct ufs_hba *hba)
|
||||
* @dev_max: pointer to device attributes
|
||||
* @agreed_pwr: returned agreed attributes
|
||||
*
|
||||
* Returns 0 on success, non-zero value on failure
|
||||
* Return: 0 on success, non-zero value on failure.
|
||||
*/
|
||||
int ufshcd_get_pwr_dev_param(const struct ufs_dev_params *pltfrm_param,
|
||||
const struct ufs_pa_layer_attr *dev_max,
|
||||
@ -326,7 +328,7 @@ EXPORT_SYMBOL_GPL(ufshcd_init_pwr_dev_param);
|
||||
* @pdev: pointer to Platform device handle
|
||||
* @vops: pointer to variant ops
|
||||
*
|
||||
* Returns 0 on success, non-zero value on failure
|
||||
* Return: 0 on success, non-zero value on failure.
|
||||
*/
|
||||
int ufshcd_pltfrm_init(struct platform_device *pdev,
|
||||
const struct ufs_hba_variant_ops *vops)
|
||||
|
@ -8,6 +8,7 @@
|
||||
#ifndef SCSI_BSG_UFS_H
|
||||
#define SCSI_BSG_UFS_H
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
#include <linux/types.h>
|
||||
/*
|
||||
* This file intended to be included by both kernel and user space
|
||||
@ -40,11 +41,56 @@ enum ufs_rpmb_op_type {
|
||||
* @dword_0: UPIU header DW-0
|
||||
* @dword_1: UPIU header DW-1
|
||||
* @dword_2: UPIU header DW-2
|
||||
*
|
||||
* @transaction_code: Type of request or response. See also enum
|
||||
* upiu_request_transaction and enum upiu_response_transaction.
|
||||
* @flags: UPIU flags. The meaning of individual flags depends on the
|
||||
* transaction code.
|
||||
* @lun: Logical unit number.
|
||||
* @task_tag: Task tag.
|
||||
* @iid: Initiator ID.
|
||||
* @command_set_type: 0 for SCSI command set; 1 for UFS specific.
|
||||
* @tm_function: Task management function in case of a task management request
|
||||
* UPIU.
|
||||
* @query_function: Query function in case of a query request UPIU.
|
||||
* @response: 0 for success; 1 for failure.
|
||||
* @status: SCSI status if this is the header of a response to a SCSI command.
|
||||
* @ehs_length: EHS length in units of 32 bytes.
|
||||
* @device_information:
|
||||
* @data_segment_length: data segment length.
|
||||
*/
|
||||
struct utp_upiu_header {
|
||||
__be32 dword_0;
|
||||
__be32 dword_1;
|
||||
__be32 dword_2;
|
||||
union {
|
||||
struct {
|
||||
__be32 dword_0;
|
||||
__be32 dword_1;
|
||||
__be32 dword_2;
|
||||
};
|
||||
struct {
|
||||
__u8 transaction_code;
|
||||
__u8 flags;
|
||||
__u8 lun;
|
||||
__u8 task_tag;
|
||||
#if defined(__BIG_ENDIAN)
|
||||
__u8 iid: 4;
|
||||
__u8 command_set_type: 4;
|
||||
#elif defined(__LITTLE_ENDIAN)
|
||||
__u8 command_set_type: 4;
|
||||
__u8 iid: 4;
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
union {
|
||||
__u8 tm_function;
|
||||
__u8 query_function;
|
||||
};
|
||||
__u8 response;
|
||||
__u8 status;
|
||||
__u8 ehs_length;
|
||||
__u8 device_information;
|
||||
__be16 data_segment_length;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -11,10 +11,16 @@
|
||||
#ifndef _UFS_H
|
||||
#define _UFS_H
|
||||
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/types.h>
|
||||
#include <uapi/scsi/scsi_bsg_ufs.h>
|
||||
|
||||
/*
|
||||
* Using static_assert() is not allowed in UAPI header files. Hence the check
|
||||
* in this header file of the size of struct utp_upiu_header.
|
||||
*/
|
||||
static_assert(sizeof(struct utp_upiu_header) == 12);
|
||||
|
||||
#define GENERAL_UPIU_REQUEST_SIZE (sizeof(struct utp_upiu_req))
|
||||
#define QUERY_DESC_MAX_SIZE 255
|
||||
#define QUERY_DESC_MIN_SIZE 2
|
||||
@ -23,11 +29,6 @@
|
||||
(sizeof(struct utp_upiu_header)))
|
||||
#define UFS_SENSE_SIZE 18
|
||||
|
||||
static inline __be32 upiu_header_dword(u8 byte3, u8 byte2, u8 byte1, u8 byte0)
|
||||
{
|
||||
return cpu_to_be32(byte3 << 24 | byte2 << 16 | byte1 << 8 | byte0);
|
||||
}
|
||||
|
||||
/*
|
||||
* UFS device may have standard LUs and LUN id could be from 0x00 to
|
||||
* 0x7F. Standard LUs use "Peripheral Device Addressing Format".
|
||||
@ -78,7 +79,7 @@ enum {
|
||||
};
|
||||
|
||||
/* UTP UPIU Transaction Codes Initiator to Target */
|
||||
enum {
|
||||
enum upiu_request_transaction {
|
||||
UPIU_TRANSACTION_NOP_OUT = 0x00,
|
||||
UPIU_TRANSACTION_COMMAND = 0x01,
|
||||
UPIU_TRANSACTION_DATA_OUT = 0x02,
|
||||
@ -87,7 +88,7 @@ enum {
|
||||
};
|
||||
|
||||
/* UTP UPIU Transaction Codes Target to Initiator */
|
||||
enum {
|
||||
enum upiu_response_transaction {
|
||||
UPIU_TRANSACTION_NOP_IN = 0x20,
|
||||
UPIU_TRANSACTION_RESPONSE = 0x21,
|
||||
UPIU_TRANSACTION_DATA_IN = 0x22,
|
||||
@ -473,21 +474,11 @@ enum {
|
||||
UPIU_COMMAND_SET_TYPE_QUERY = 0x2,
|
||||
};
|
||||
|
||||
/* UTP Transfer Request Command Offset */
|
||||
#define UPIU_COMMAND_TYPE_OFFSET 28
|
||||
|
||||
/* Offset of the response code in the UPIU header */
|
||||
#define UPIU_RSP_CODE_OFFSET 8
|
||||
|
||||
enum {
|
||||
MASK_SCSI_STATUS = 0xFF,
|
||||
MASK_TASK_RESPONSE = 0xFF00,
|
||||
MASK_RSP_UPIU_RESULT = 0xFFFF,
|
||||
MASK_QUERY_DATA_SEG_LEN = 0xFFFF,
|
||||
MASK_RSP_UPIU_DATA_SEG_LEN = 0xFFFF,
|
||||
MASK_RSP_EXCEPTION_EVENT = 0x10000,
|
||||
MASK_TM_SERVICE_RESP = 0xFF,
|
||||
MASK_TM_FUNC = 0xFF,
|
||||
};
|
||||
|
||||
/* Task management service response */
|
||||
@ -537,26 +528,6 @@ struct utp_upiu_rsp {
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ufs_query_req - parameters for building a query request
|
||||
* @query_func: UPIU header query function
|
||||
* @upiu_req: the query request data
|
||||
*/
|
||||
struct ufs_query_req {
|
||||
u8 query_func;
|
||||
struct utp_upiu_query upiu_req;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ufs_query_resp - UPIU QUERY
|
||||
* @response: device response code
|
||||
* @upiu_res: query response data
|
||||
*/
|
||||
struct ufs_query_res {
|
||||
u8 response;
|
||||
struct utp_upiu_query upiu_res;
|
||||
};
|
||||
|
||||
/*
|
||||
* VCCQ & VCCQ2 current requirement when UFS device is in sleep state
|
||||
* and link is in Hibern8 state.
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/dma-direction.h>
|
||||
#include <scsi/scsi_device.h>
|
||||
#include <scsi/scsi_host.h>
|
||||
#include <ufs/unipro.h>
|
||||
#include <ufs/ufs.h>
|
||||
#include <ufs/ufs_quirks.h>
|
||||
@ -201,6 +202,25 @@ struct ufshcd_lrb {
|
||||
bool req_abort_skip;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ufs_query_req - parameters for building a query request
|
||||
* @query_func: UPIU header query function
|
||||
* @upiu_req: the query request data
|
||||
*/
|
||||
struct ufs_query_req {
|
||||
u8 query_func;
|
||||
struct utp_upiu_query upiu_req;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ufs_query_resp - UPIU QUERY
|
||||
* @response: device response code
|
||||
* @upiu_res: query response data
|
||||
*/
|
||||
struct ufs_query_res {
|
||||
struct utp_upiu_query upiu_res;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ufs_query - holds relevant data structures for query request
|
||||
* @request: request upiu and function
|
||||
@ -1356,12 +1376,6 @@ int ufshcd_get_vreg(struct device *dev, struct ufs_vreg *vreg);
|
||||
|
||||
int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd);
|
||||
|
||||
int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
|
||||
struct utp_upiu_req *req_upiu,
|
||||
struct utp_upiu_req *rsp_upiu,
|
||||
int msgcode,
|
||||
u8 *desc_buff, int *buff_len,
|
||||
enum query_opcode desc_op);
|
||||
int ufshcd_advanced_rpmb_req_handler(struct ufs_hba *hba, struct utp_upiu_req *req_upiu,
|
||||
struct utp_upiu_req *rsp_upiu, struct ufs_ehs *ehs_req,
|
||||
struct ufs_ehs *ehs_rsp, int sg_cnt,
|
||||
|
@ -11,7 +11,8 @@
|
||||
#ifndef _UFSHCI_H
|
||||
#define _UFSHCI_H
|
||||
|
||||
#include <scsi/scsi_host.h>
|
||||
#include <linux/types.h>
|
||||
#include <ufs/ufs.h>
|
||||
|
||||
enum {
|
||||
TASK_REQ_UPIU_SIZE_DWORDS = 8,
|
||||
@ -126,7 +127,6 @@ enum {
|
||||
};
|
||||
|
||||
#define SQ_ICU_ERR_CODE_MASK GENMASK(7, 4)
|
||||
#define UPIU_COMMAND_TYPE_MASK GENMASK(31, 28)
|
||||
#define UFS_MASK(mask, offset) ((mask) << (offset))
|
||||
|
||||
/* UFS Version 08h */
|
||||
@ -438,15 +438,13 @@ enum {
|
||||
UTP_SCSI_COMMAND = 0x00000000,
|
||||
UTP_NATIVE_UFS_COMMAND = 0x10000000,
|
||||
UTP_DEVICE_MANAGEMENT_FUNCTION = 0x20000000,
|
||||
UTP_REQ_DESC_INT_CMD = 0x01000000,
|
||||
UTP_REQ_DESC_CRYPTO_ENABLE_CMD = 0x00800000,
|
||||
};
|
||||
|
||||
/* UTP Transfer Request Data Direction (DD) */
|
||||
enum {
|
||||
UTP_NO_DATA_TRANSFER = 0x00000000,
|
||||
UTP_HOST_TO_DEVICE = 0x02000000,
|
||||
UTP_DEVICE_TO_HOST = 0x04000000,
|
||||
enum utp_data_direction {
|
||||
UTP_NO_DATA_TRANSFER = 0,
|
||||
UTP_HOST_TO_DEVICE = 1,
|
||||
UTP_DEVICE_TO_HOST = 2,
|
||||
};
|
||||
|
||||
/* Overall command status values */
|
||||
@ -505,18 +503,39 @@ struct utp_transfer_cmd_desc {
|
||||
|
||||
/**
|
||||
* struct request_desc_header - Descriptor Header common to both UTRD and UTMRD
|
||||
* @dword0: Descriptor Header DW0
|
||||
* @dword1: Descriptor Header DW1
|
||||
* @dword2: Descriptor Header DW2
|
||||
* @dword3: Descriptor Header DW3
|
||||
*/
|
||||
struct request_desc_header {
|
||||
__le32 dword_0;
|
||||
__le32 dword_1;
|
||||
__le32 dword_2;
|
||||
__le32 dword_3;
|
||||
u8 cci;
|
||||
u8 ehs_length;
|
||||
#if defined(__BIG_ENDIAN)
|
||||
u8 enable_crypto:1;
|
||||
u8 reserved2:7;
|
||||
|
||||
u8 command_type:4;
|
||||
u8 reserved1:1;
|
||||
u8 data_direction:2;
|
||||
u8 interrupt:1;
|
||||
#elif defined(__LITTLE_ENDIAN)
|
||||
u8 reserved2:7;
|
||||
u8 enable_crypto:1;
|
||||
|
||||
u8 interrupt:1;
|
||||
u8 data_direction:2;
|
||||
u8 reserved1:1;
|
||||
u8 command_type:4;
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
|
||||
__le32 dunl;
|
||||
u8 ocs;
|
||||
u8 cds;
|
||||
__le16 ldbc;
|
||||
__le32 dunu;
|
||||
};
|
||||
|
||||
static_assert(sizeof(struct request_desc_header) == 16);
|
||||
|
||||
/**
|
||||
* struct utp_transfer_req_desc - UTP Transfer Request Descriptor (UTRD)
|
||||
* @header: UTRD header DW-0 to DW-3
|
||||
|
Loading…
Reference in New Issue
Block a user