This change adds a new API ufshcd_do_config_device() to write configuration descriptor with the provisioning data. Sysfs support is added in driver to trigger ufs provisioning at runtime. Provisioning data is parsed from vendor specific provisioning file. This parsed data is passed as a buffer via sysfs to provision ufs device. Changes since V1: Added device tree entry to parse reference clock frequency instead of hardcoding 19.2 MHz, as it can vary for different vendors. Also removed setting ref_clk again during runtime provisioning as it will be already set during probe. Used get_unaligned_be*/put_unaligned_be* where applicable. Changes since RFC: Added check to avoid ufs runtime provisioning if Configuration decriptor lock attribute is set to one. Instead of parsing ref_clk frequency via device tree, used correct enum ref_clk_freq value(19.2 Mhz for proviosioning). Added config_descriptor sysfs entry to provision ufs and also updated documentation for its correct usage. Added more protection against bad data handling in sysfs code. Sayali Lokhande (2): scsi: ufs: Add ufs provisioning support scsi: ufs: Add sysfs support for ufs provision Subhash Jadavani (1): scsi: ufs: set the device reference clock setting Documentation/ABI/testing/sysfs-driver-ufs | 16 + .../devicetree/bindings/ufs/ufshcd-pltfrm.txt | 7 + drivers/scsi/ufs/ufs-sysfs.c | 25 ++ drivers/scsi/ufs/ufs.h | 39 +++ drivers/scsi/ufs/ufshcd-pltfrm.c | 24 ++ drivers/scsi/ufs/ufshcd.c | 361 +++++++++++++++++++++ drivers/scsi/ufs/ufshcd.h | 7 + 7 files changed, 479 insertions(+) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project