phy-exynos7-ufs.c 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * UFS PHY driver data for Samsung EXYNOS7 SoC
  4. *
  5. * Copyright (C) 2020 Samsung Electronics Co., Ltd.
  6. */
  7. #include "phy-samsung-ufs.h"
  8. #define EXYNOS7_EMBEDDED_COMBO_PHY_CTRL 0x720
  9. #define EXYNOS7_EMBEDDED_COMBO_PHY_CTRL_MASK 0x1
  10. #define EXYNOS7_EMBEDDED_COMBO_PHY_CTRL_EN BIT(0)
  11. #define EXYNOS7_EMBEDDED_COMBO_PHY_CDR_LOCK_STATUS 0x5e
  12. /* Calibration for phy initialization */
  13. static const struct samsung_ufs_phy_cfg exynos7_pre_init_cfg[] = {
  14. PHY_COMN_REG_CFG(0x00f, 0xfa, PWR_MODE_ANY),
  15. PHY_COMN_REG_CFG(0x010, 0x82, PWR_MODE_ANY),
  16. PHY_COMN_REG_CFG(0x011, 0x1e, PWR_MODE_ANY),
  17. PHY_COMN_REG_CFG(0x017, 0x84, PWR_MODE_ANY),
  18. PHY_TRSV_REG_CFG(0x035, 0x58, PWR_MODE_ANY),
  19. PHY_TRSV_REG_CFG(0x036, 0x32, PWR_MODE_ANY),
  20. PHY_TRSV_REG_CFG(0x037, 0x40, PWR_MODE_ANY),
  21. PHY_TRSV_REG_CFG(0x03b, 0x83, PWR_MODE_ANY),
  22. PHY_TRSV_REG_CFG(0x042, 0x88, PWR_MODE_ANY),
  23. PHY_TRSV_REG_CFG(0x043, 0xa6, PWR_MODE_ANY),
  24. PHY_TRSV_REG_CFG(0x048, 0x74, PWR_MODE_ANY),
  25. PHY_TRSV_REG_CFG(0x04c, 0x5b, PWR_MODE_ANY),
  26. PHY_TRSV_REG_CFG(0x04d, 0x83, PWR_MODE_ANY),
  27. PHY_TRSV_REG_CFG(0x05c, 0x14, PWR_MODE_ANY),
  28. END_UFS_PHY_CFG
  29. };
  30. /* Calibration for HS mode series A/B */
  31. static const struct samsung_ufs_phy_cfg exynos7_pre_pwr_hs_cfg[] = {
  32. PHY_COMN_REG_CFG(0x00f, 0xfa, PWR_MODE_HS_ANY),
  33. PHY_COMN_REG_CFG(0x010, 0x82, PWR_MODE_HS_ANY),
  34. PHY_COMN_REG_CFG(0x011, 0x1e, PWR_MODE_HS_ANY),
  35. /* Setting order: 1st(0x16, 2nd(0x15) */
  36. PHY_COMN_REG_CFG(0x016, 0xff, PWR_MODE_HS_ANY),
  37. PHY_COMN_REG_CFG(0x015, 0x80, PWR_MODE_HS_ANY),
  38. PHY_COMN_REG_CFG(0x017, 0x94, PWR_MODE_HS_ANY),
  39. PHY_TRSV_REG_CFG(0x036, 0x32, PWR_MODE_HS_ANY),
  40. PHY_TRSV_REG_CFG(0x037, 0x43, PWR_MODE_HS_ANY),
  41. PHY_TRSV_REG_CFG(0x038, 0x3f, PWR_MODE_HS_ANY),
  42. PHY_TRSV_REG_CFG(0x042, 0x88, PWR_MODE_HS_G2_SER_A),
  43. PHY_TRSV_REG_CFG(0x042, 0xbb, PWR_MODE_HS_G2_SER_B),
  44. PHY_TRSV_REG_CFG(0x043, 0xa6, PWR_MODE_HS_ANY),
  45. PHY_TRSV_REG_CFG(0x048, 0x74, PWR_MODE_HS_ANY),
  46. PHY_TRSV_REG_CFG(0x034, 0x35, PWR_MODE_HS_G2_SER_A),
  47. PHY_TRSV_REG_CFG(0x034, 0x36, PWR_MODE_HS_G2_SER_B),
  48. PHY_TRSV_REG_CFG(0x035, 0x5b, PWR_MODE_HS_G2_SER_A),
  49. PHY_TRSV_REG_CFG(0x035, 0x5c, PWR_MODE_HS_G2_SER_B),
  50. END_UFS_PHY_CFG
  51. };
  52. /* Calibration for HS mode series A/B atfer PMC */
  53. static const struct samsung_ufs_phy_cfg exynos7_post_pwr_hs_cfg[] = {
  54. PHY_COMN_REG_CFG(0x015, 0x00, PWR_MODE_HS_ANY),
  55. PHY_TRSV_REG_CFG(0x04d, 0x83, PWR_MODE_HS_ANY),
  56. END_UFS_PHY_CFG
  57. };
  58. static const struct samsung_ufs_phy_cfg *exynos7_ufs_phy_cfgs[CFG_TAG_MAX] = {
  59. [CFG_PRE_INIT] = exynos7_pre_init_cfg,
  60. [CFG_PRE_PWR_HS] = exynos7_pre_pwr_hs_cfg,
  61. [CFG_POST_PWR_HS] = exynos7_post_pwr_hs_cfg,
  62. };
  63. static const char * const exynos7_ufs_phy_clks[] = {
  64. "tx0_symbol_clk", "rx0_symbol_clk", "rx1_symbol_clk", "ref_clk",
  65. };
  66. const struct samsung_ufs_phy_drvdata exynos7_ufs_phy = {
  67. .cfgs = exynos7_ufs_phy_cfgs,
  68. .isol = {
  69. .offset = EXYNOS7_EMBEDDED_COMBO_PHY_CTRL,
  70. .mask = EXYNOS7_EMBEDDED_COMBO_PHY_CTRL_MASK,
  71. .en = EXYNOS7_EMBEDDED_COMBO_PHY_CTRL_EN,
  72. },
  73. .clk_list = exynos7_ufs_phy_clks,
  74. .num_clks = ARRAY_SIZE(exynos7_ufs_phy_clks),
  75. .cdr_lock_status_offset = EXYNOS7_EMBEDDED_COMBO_PHY_CDR_LOCK_STATUS,
  76. };