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