Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: samsung-ufs: add support for FSD ufs phy driver

Adds support for Tesla Full Self-Driving (FSD) ufs phy driver.
This SoC has different cdr lock status offset.

Signed-off-by: Bharat Uppal <bharat.uppal@samsung.com>
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Reviewed-by: Chanho Park <chanho61.park@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220610104119.66401-4-alim.akhtar@samsung.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Alim Akhtar and committed by
Vinod Koul
f1b2d06d e313216b

+63
+1
drivers/phy/samsung/Makefile
··· 6 6 phy-exynos-ufs-y += phy-samsung-ufs.o 7 7 phy-exynos-ufs-y += phy-exynos7-ufs.o 8 8 phy-exynos-ufs-y += phy-exynosautov9-ufs.o 9 + phy-exynos-ufs-y += phy-fsd-ufs.o 9 10 obj-$(CONFIG_PHY_SAMSUNG_USB2) += phy-exynos-usb2.o 10 11 phy-exynos-usb2-y += phy-samsung-usb2.o 11 12 phy-exynos-usb2-$(CONFIG_PHY_EXYNOS4210_USB2) += phy-exynos4210-usb2.o
+58
drivers/phy/samsung/phy-fsd-ufs.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * UFS PHY driver data for FSD SoC 4 + * 5 + * Copyright (C) 2022 Samsung Electronics Co., Ltd. 6 + * 7 + */ 8 + #include "phy-samsung-ufs.h" 9 + 10 + #define FSD_EMBEDDED_COMBO_PHY_CTRL 0x724 11 + #define FSD_EMBEDDED_COMBO_PHY_CTRL_MASK 0x1 12 + #define FSD_EMBEDDED_COMBO_PHY_CTRL_EN BIT(0) 13 + #define FSD_EMBEDDED_COMBO_PHY_CDR_LOCK_STATUS 0x6e 14 + 15 + static const struct samsung_ufs_phy_cfg fsd_pre_init_cfg[] = { 16 + PHY_COMN_REG_CFG(0x00f, 0xfa, PWR_MODE_ANY), 17 + PHY_COMN_REG_CFG(0x010, 0x82, PWR_MODE_ANY), 18 + PHY_COMN_REG_CFG(0x011, 0x1e, PWR_MODE_ANY), 19 + PHY_COMN_REG_CFG(0x017, 0x94, PWR_MODE_ANY), 20 + PHY_TRSV_REG_CFG(0x035, 0x58, PWR_MODE_ANY), 21 + PHY_TRSV_REG_CFG(0x036, 0x32, PWR_MODE_ANY), 22 + PHY_TRSV_REG_CFG(0x037, 0x40, PWR_MODE_ANY), 23 + PHY_TRSV_REG_CFG(0x03b, 0x83, PWR_MODE_ANY), 24 + PHY_TRSV_REG_CFG(0x042, 0x88, PWR_MODE_ANY), 25 + PHY_TRSV_REG_CFG(0x043, 0xa6, PWR_MODE_ANY), 26 + PHY_TRSV_REG_CFG(0x048, 0x74, PWR_MODE_ANY), 27 + PHY_TRSV_REG_CFG(0x04c, 0x5b, PWR_MODE_ANY), 28 + PHY_TRSV_REG_CFG(0x04d, 0x83, PWR_MODE_ANY), 29 + PHY_TRSV_REG_CFG(0x05c, 0x14, PWR_MODE_ANY), 30 + END_UFS_PHY_CFG 31 + }; 32 + 33 + /* Calibration for HS mode series A/B */ 34 + static const struct samsung_ufs_phy_cfg fsd_pre_pwr_hs_cfg[] = { 35 + END_UFS_PHY_CFG 36 + }; 37 + 38 + /* Calibration for HS mode series A/B atfer PMC */ 39 + static const struct samsung_ufs_phy_cfg fsd_post_pwr_hs_cfg[] = { 40 + END_UFS_PHY_CFG 41 + }; 42 + 43 + static const struct samsung_ufs_phy_cfg *fsd_ufs_phy_cfgs[CFG_TAG_MAX] = { 44 + [CFG_PRE_INIT] = fsd_pre_init_cfg, 45 + [CFG_PRE_PWR_HS] = fsd_pre_pwr_hs_cfg, 46 + [CFG_POST_PWR_HS] = fsd_post_pwr_hs_cfg, 47 + }; 48 + 49 + const struct samsung_ufs_phy_drvdata fsd_ufs_phy = { 50 + .cfgs = fsd_ufs_phy_cfgs, 51 + .isol = { 52 + .offset = FSD_EMBEDDED_COMBO_PHY_CTRL, 53 + .mask = FSD_EMBEDDED_COMBO_PHY_CTRL_MASK, 54 + .en = FSD_EMBEDDED_COMBO_PHY_CTRL_EN, 55 + }, 56 + .has_symbol_clk = 0, 57 + .cdr_lock_status_offset = FSD_EMBEDDED_COMBO_PHY_CDR_LOCK_STATUS, 58 + };
+3
drivers/phy/samsung/phy-samsung-ufs.c
··· 358 358 }, { 359 359 .compatible = "samsung,exynosautov9-ufs-phy", 360 360 .data = &exynosautov9_ufs_phy, 361 + }, { 362 + .compatible = "tesla,fsd-ufs-phy", 363 + .data = &fsd_ufs_phy, 361 364 }, 362 365 {}, 363 366 };
+1
drivers/phy/samsung/phy-samsung-ufs.h
··· 145 145 146 146 extern const struct samsung_ufs_phy_drvdata exynos7_ufs_phy; 147 147 extern const struct samsung_ufs_phy_drvdata exynosautov9_ufs_phy; 148 + extern const struct samsung_ufs_phy_drvdata fsd_ufs_phy; 148 149 149 150 #endif /* _PHY_SAMSUNG_UFS_ */