drivers/ufs/host/ufs-exynos.c
Source file repositories/reference/linux-study-clean/drivers/ufs/host/ufs-exynos.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/ufs/host/ufs-exynos.c- Extension
.c- Size
- 69449 bytes
- Lines
- 2351
- Domain
- Driver Families
- Bucket
- drivers/ufs
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/unaligned.hcrypto/aes.hlinux/arm-smccc.hlinux/clk.hlinux/delay.hlinux/module.hlinux/of.hlinux/of_address.hlinux/mfd/syscon.hlinux/phy/phy.hlinux/platform_device.hlinux/regmap.hufs/ufshcd.hufshcd-pltfrm.hufs/ufshci.hufs/unipro.hufs-exynos.h
Detected Declarations
struct fmp_sg_entryenum fmp_crypto_algo_modeenum fmp_crypto_key_lengthfunction exynos_ufs_enable_auto_ctrl_hccfunction exynos_ufs_disable_auto_ctrl_hccfunction exynos_ufs_disable_auto_ctrl_hcc_savefunction exynos_ufs_auto_ctrl_hcc_restorefunction exynos_ufs_gate_clksfunction exynos_ufs_ungate_clksfunction exynos_ufs_shareabilityfunction gs101_ufs_drv_initfunction exynosauto_ufs_drv_initfunction exynosauto_ufs_post_hce_enablefunction exynosauto_ufs_pre_linkfunction for_each_ufs_tx_lanefunction exynosauto_ufs_pre_pwr_changefunction exynosauto_ufs_post_pwr_changefunction exynos7_ufs_pre_linkfunction exynos7_ufs_post_linkfunction exynos7_ufs_pre_pwr_changefunction exynos7_ufs_post_pwr_changefunction exynosautov920_ufs_pre_linkfunction for_each_ufs_rx_lanefunction for_each_ufs_tx_lanefunction exynosautov920_ufs_post_linkfunction exynosautov920_ufs_pre_pwr_changefunction exynos_ufs_auto_ctrl_hccfunction exynos_ufs_ctrl_clkstopfunction exynos_ufs_get_clk_infofunction list_for_each_entryfunction exynos_ufs_set_unipro_pclk_divfunction exynos_ufs_set_pwm_clk_divfunction exynos_ufs_calc_pwm_clk_divfunction exynos_ufs_calc_time_cntrfunction exynos_ufs_specify_phy_time_attrfunction exynos_ufs_config_phy_time_attrfunction for_each_ufs_rx_lanefunction for_each_ufs_tx_lanefunction exynos_ufs_config_phy_cap_attrfunction for_each_ufs_rx_lanefunction for_each_ufs_rx_lanefunction exynos_ufs_establish_conntfunction exynos_ufs_config_smufunction exynos_ufs_config_sync_pattern_maskfunction exynos_ufs_get_hs_gearfunction exynos_ufs_pre_pwr_modefunction exynos_ufs_post_pwr_modefunction exynos_ufs_specify_nexus_t_xfer_req
Annotated Snippet
struct fmp_sg_entry {
struct ufshcd_sg_entry base;
__be64 file_iv[2];
__be64 file_enckey[4];
__be64 file_twkey[4];
__be64 disk_iv[2];
__be64 reserved[2];
};
#define SMC_CMD_FMP_SECURITY \
ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_64, \
ARM_SMCCC_OWNER_SIP, 0x1810)
#define SMC_CMD_SMU \
ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_64, \
ARM_SMCCC_OWNER_SIP, 0x1850)
#define SMC_CMD_FMP_SMU_RESUME \
ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_64, \
ARM_SMCCC_OWNER_SIP, 0x1860)
#define SMU_EMBEDDED 0
#define SMU_INIT 0
#define CFG_DESCTYPE_3 3
static void exynos_ufs_fmp_init(struct ufs_hba *hba, struct exynos_ufs *ufs)
{
struct blk_crypto_profile *profile = &hba->crypto_profile;
struct arm_smccc_res res;
int err;
/*
* Check for the standard crypto support bit, since it's available even
* though the rest of the interface to FMP is nonstandard.
*
* This check should have the effect of preventing the driver from
* trying to use FMP on old Exynos SoCs that don't have FMP.
*/
if (!(ufshcd_readl(hba, REG_CONTROLLER_CAPABILITIES) &
MASK_CRYPTO_SUPPORT))
return;
/*
* The below sequence of SMC calls to enable FMP can be found in the
* downstream driver source for gs101 and other Exynos-based SoCs. It
* is the only way to enable FMP that works on SoCs such as gs101 that
* don't make the FMP registers accessible to Linux. It probably works
* on other Exynos-based SoCs too, and might even still be the only way
* that works. But this hasn't been properly tested, and this code is
* mutually exclusive with exynos_ufs_config_smu(). So for now only
* enable FMP support on SoCs with EXYNOS_UFS_OPT_UFSPR_SECURE.
*/
if (!(ufs->opts & EXYNOS_UFS_OPT_UFSPR_SECURE))
return;
/*
* This call (which sets DESCTYPE to 0x3 in the FMPSECURITY0 register)
* is needed to make the hardware use the larger PRDT entry size.
*/
BUILD_BUG_ON(sizeof(struct fmp_sg_entry) != 128);
arm_smccc_smc(SMC_CMD_FMP_SECURITY, 0, SMU_EMBEDDED, CFG_DESCTYPE_3,
0, 0, 0, 0, &res);
if (res.a0) {
dev_warn(hba->dev,
"SMC_CMD_FMP_SECURITY failed on init: %ld. Disabling FMP support.\n",
res.a0);
return;
}
ufshcd_set_sg_entry_size(hba, sizeof(struct fmp_sg_entry));
/*
* This is needed to initialize FMP. Without it, errors occur when
* inline encryption is used.
*/
arm_smccc_smc(SMC_CMD_SMU, SMU_INIT, SMU_EMBEDDED, 0, 0, 0, 0, 0, &res);
if (res.a0) {
dev_err(hba->dev,
"SMC_CMD_SMU(SMU_INIT) failed: %ld. Disabling FMP support.\n",
res.a0);
return;
}
/* Advertise crypto capabilities to the block layer. */
err = devm_blk_crypto_profile_init(hba->dev, profile, 0);
if (err) {
/* Only ENOMEM should be possible here. */
dev_err(hba->dev, "Failed to initialize crypto profile: %d\n",
err);
return;
}
profile->max_dun_bytes_supported = AES_BLOCK_SIZE;
profile->key_types_supported = BLK_CRYPTO_KEY_TYPE_RAW;
profile->dev = hba->dev;
Annotation
- Immediate include surface: `linux/unaligned.h`, `crypto/aes.h`, `linux/arm-smccc.h`, `linux/clk.h`, `linux/delay.h`, `linux/module.h`, `linux/of.h`, `linux/of_address.h`.
- Detected declarations: `struct fmp_sg_entry`, `enum fmp_crypto_algo_mode`, `enum fmp_crypto_key_length`, `function exynos_ufs_enable_auto_ctrl_hcc`, `function exynos_ufs_disable_auto_ctrl_hcc`, `function exynos_ufs_disable_auto_ctrl_hcc_save`, `function exynos_ufs_auto_ctrl_hcc_restore`, `function exynos_ufs_gate_clks`, `function exynos_ufs_ungate_clks`, `function exynos_ufs_shareability`.
- Atlas domain: Driver Families / drivers/ufs.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.