1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * Samsung Exynos5 SoC series USB DRD PHY driver 4 * 5 * Phy provider for USB 3.0 DRD controller on Exynos5 SoC series 6 * 7 * Copyright (C) 2014 Samsung Electronics Co., Ltd. 8 * Author: Vivek Gautam <gautam.vivek@samsung.com> 9 */ 10 11 #include <linux/bitfield.h> 12 #include <linux/clk.h> 13 #include <linux/delay.h> 14 #include <linux/io.h> 15 #include <linux/kernel.h> 16 #include <linux/module.h> 17 #include <linux/of.h> 18 #include <linux/iopoll.h> 19 #include <linux/phy/phy.h> 20 #include <linux/platform_device.h> 21 #include <linux/mutex.h> 22 #include <linux/mfd/syscon.h> 23 #include <linux/regmap.h> 24 #include <linux/regulator/consumer.h> 25 #include <linux/soc/samsung/exynos-regs-pmu.h> 26 #include <linux/usb/typec.h> 27 #include <linux/usb/typec_mux.h> 28 29 /* Exynos USB PHY registers */ 30 #define EXYNOS5_FSEL_9MHZ6 0x0 31 #define EXYNOS5_FSEL_10MHZ 0x1 32 #define EXYNOS5_FSEL_12MHZ 0x2 33 #define EXYNOS5_FSEL_19MHZ2 0x3 34 #define EXYNOS5_FSEL_20MHZ 0x4 35 #define EXYNOS5_FSEL_24MHZ 0x5 36 #define EXYNOS5_FSEL_26MHZ 0x6 37 #define EXYNOS5_FSEL_50MHZ 0x7 38 39 /* Exynos5: USB 3.0 DRD PHY registers */ 40 #define EXYNOS5_DRD_LINKSYSTEM 0x04 41 #define LINKSYSTEM_XHCI_VERSION_CONTROL BIT(27) 42 #define LINKSYSTEM_FLADJ_MASK (0x3f << 1) 43 #define LINKSYSTEM_FLADJ(_x) ((_x) << 1) 44 45 #define EXYNOS5_DRD_PHYUTMI 0x08 46 #define PHYUTMI_OTGDISABLE BIT(6) 47 #define PHYUTMI_FORCESUSPEND BIT(1) 48 #define PHYUTMI_FORCESLEEP BIT(0) 49 50 #define EXYNOS5_DRD_PHYPIPE 0x0c 51 52 #define EXYNOS5_DRD_PHYCLKRST 0x10 53 #define PHYCLKRST_EN_UTMISUSPEND BIT(31) 54 #define PHYCLKRST_SSC_REFCLKSEL_MASK (0xff << 23) 55 #define PHYCLKRST_SSC_REFCLKSEL(_x) ((_x) << 23) 56 #define PHYCLKRST_SSC_RANGE_MASK (0x03 << 21) 57 #define PHYCLKRST_SSC_RANGE(_x) ((_x) << 21) 58 #define PHYCLKRST_SSC_EN BIT(20) 59 #define PHYCLKRST_REF_SSP_EN BIT(19) 60 #define PHYCLKRST_REF_CLKDIV2 BIT(18) 61 #define PHYCLKRST_MPLL_MULTIPLIER_MASK (0x7f << 11) 62 #define PHYCLKRST_MPLL_MULTIPLIER_100MHZ_REF (0x19 << 11) 63 #define PHYCLKRST_MPLL_MULTIPLIER_50M_REF (0x32 << 11) 64 #define PHYCLKRST_MPLL_MULTIPLIER_24MHZ_REF (0x68 << 11) 65 #define PHYCLKRST_MPLL_MULTIPLIER_20MHZ_REF (0x7d << 11) 66 #define PHYCLKRST_MPLL_MULTIPLIER_19200KHZ_REF (0x02 << 11) 67 #define PHYCLKRST_FSEL_PIPE_MASK (0x7 << 8) 68 #define PHYCLKRST_FSEL_UTMI_MASK (0x7 << 5) 69 #define PHYCLKRST_FSEL(_x) ((_x) << 5) 70 #define PHYCLKRST_FSEL_PAD_100MHZ (0x27 << 5) 71 #define PHYCLKRST_FSEL_PAD_24MHZ (0x2a << 5) 72 #define PHYCLKRST_FSEL_PAD_20MHZ (0x31 << 5) 73 #define PHYCLKRST_FSEL_PAD_19_2MHZ (0x38 << 5) 74 #define PHYCLKRST_RETENABLEN BIT(4) 75 #define PHYCLKRST_REFCLKSEL_MASK (0x03 << 2) 76 #define PHYCLKRST_REFCLKSEL_PAD_REFCLK (0x2 << 2) 77 #define PHYCLKRST_REFCLKSEL_EXT_REFCLK (0x3 << 2) 78 #define PHYCLKRST_PORTRESET BIT(1) 79 #define PHYCLKRST_COMMONONN BIT(0) 80 81 #define EXYNOS5_DRD_PHYREG0 0x14 82 #define PHYREG0_SSC_REF_CLK_SEL BIT(21) 83 #define PHYREG0_SSC_RANGE BIT(20) 84 #define PHYREG0_CR_WRITE BIT(19) 85 #define PHYREG0_CR_READ BIT(18) 86 #define PHYREG0_CR_DATA_IN(_x) ((_x) << 2) 87 #define PHYREG0_CR_CAP_DATA BIT(1) 88 #define PHYREG0_CR_CAP_ADDR BIT(0) 89 90 #define EXYNOS5_DRD_PHYREG1 0x18 91 #define PHYREG1_CR_DATA_OUT(_x) ((_x) << 1) 92 #define PHYREG1_CR_ACK BIT(0) 93 94 #define EXYNOS5_DRD_PHYPARAM0 0x1c 95 #define PHYPARAM0_REF_USE_PAD BIT(31) 96 #define PHYPARAM0_REF_LOSLEVEL_MASK (0x1f << 26) 97 #define PHYPARAM0_REF_LOSLEVEL (0x9 << 26) 98 99 #define EXYNOS5_DRD_PHYPARAM1 0x20 100 #define PHYPARAM1_PCS_TXDEEMPH_MASK (0x1f << 0) 101 #define PHYPARAM1_PCS_TXDEEMPH (0x1c) 102 103 #define EXYNOS5_DRD_PHYTERM 0x24 104 105 #define EXYNOS5_DRD_PHYTEST 0x28 106 #define PHYTEST_POWERDOWN_SSP BIT(3) 107 #define PHYTEST_POWERDOWN_HSP BIT(2) 108 109 #define EXYNOS5_DRD_PHYADP 0x2c 110 111 #define EXYNOS5_DRD_PHYUTMICLKSEL 0x30 112 #define PHYUTMICLKSEL_UTMI_CLKSEL BIT(2) 113 114 #define EXYNOS5_DRD_PHYRESUME 0x34 115 116 #define EXYNOS5_DRD_LINKPORT 0x44 117 118 /* USB 3.0 DRD PHY SS Function Control Reg; accessed by CR_PORT */ 119 #define EXYNOS5_DRD_PHYSS_LOSLEVEL_OVRD_IN (0x15) 120 #define LOSLEVEL_OVRD_IN_LOS_BIAS_5420 (0x5 << 13) 121 #define LOSLEVEL_OVRD_IN_LOS_BIAS_DEFAULT (0x0 << 13) 122 #define LOSLEVEL_OVRD_IN_EN (0x1 << 10) 123 #define LOSLEVEL_OVRD_IN_LOS_LEVEL_DEFAULT (0x9 << 0) 124 125 #define EXYNOS5_DRD_PHYSS_TX_VBOOSTLEVEL_OVRD_IN (0x12) 126 #define TX_VBOOSTLEVEL_OVRD_IN_VBOOST_5420 (0x5 << 13) 127 #define TX_VBOOSTLEVEL_OVRD_IN_VBOOST_DEFAULT (0x4 << 13) 128 129 #define EXYNOS5_DRD_PHYSS_LANE0_TX_DEBUG (0x1010) 130 #define LANE0_TX_DEBUG_RXDET_MEAS_TIME_19M2_20M (0x4 << 4) 131 #define LANE0_TX_DEBUG_RXDET_MEAS_TIME_24M (0x8 << 4) 132 #define LANE0_TX_DEBUG_RXDET_MEAS_TIME_25M_26M (0x8 << 4) 133 #define LANE0_TX_DEBUG_RXDET_MEAS_TIME_48M_50M_52M (0x20 << 4) 134 #define LANE0_TX_DEBUG_RXDET_MEAS_TIME_62M5 (0x20 << 4) 135 #define LANE0_TX_DEBUG_RXDET_MEAS_TIME_96M_100M (0x40 << 4) 136 137 /* Exynos850: USB DRD PHY registers */ 138 #define EXYNOS850_DRD_LINKCTRL 0x04 139 #define LINKCTRL_FORCE_RXELECIDLE BIT(18) 140 #define LINKCTRL_FORCE_PHYSTATUS BIT(17) 141 #define LINKCTRL_FORCE_PIPE_EN BIT(16) 142 #define LINKCTRL_FORCE_QACT BIT(8) 143 #define LINKCTRL_BUS_FILTER_BYPASS(_x) ((_x) << 4) 144 145 #define EXYNOS850_DRD_LINKPORT 0x08 146 #define LINKPORT_HOST_NUM_U3 GENMASK(19, 16) 147 #define LINKPORT_HOST_NUM_U2 GENMASK(15, 12) 148 149 #define EXYNOS850_DRD_CLKRST 0x20 150 /* 151 * On versions without SS ports (like E850), bit 3 is for the 2.0 phy (HS), 152 * while on versions with (like gs101), bits 2 and 3 are for the 3.0 phy (SS) 153 * and bits 12 & 13 for the 2.0 phy. 154 */ 155 #define CLKRST_PHY20_SW_POR BIT(13) 156 #define CLKRST_PHY20_SW_POR_SEL BIT(12) 157 #define CLKRST_LINK_PCLK_SEL BIT(7) 158 #define CLKRST_PHY_SW_RST BIT(3) 159 #define CLKRST_PHY_RESET_SEL BIT(2) 160 #define CLKRST_PORT_RST BIT(1) 161 #define CLKRST_LINK_SW_RST BIT(0) 162 163 #define EXYNOS850_DRD_SSPPLLCTL 0x30 164 #define SSPPLLCTL_FSEL GENMASK(2, 0) 165 166 #define EXYNOS850_DRD_UTMI 0x50 167 #define UTMI_FORCE_VBUSVALID BIT(5) 168 #define UTMI_FORCE_BVALID BIT(4) 169 #define UTMI_DP_PULLDOWN BIT(3) 170 #define UTMI_DM_PULLDOWN BIT(2) 171 #define UTMI_FORCE_SUSPEND BIT(1) 172 #define UTMI_FORCE_SLEEP BIT(0) 173 174 #define EXYNOS850_DRD_HSP 0x54 175 #define HSP_FSV_OUT_EN BIT(24) 176 #define HSP_VBUSVLDEXTSEL BIT(13) 177 #define HSP_VBUSVLDEXT BIT(12) 178 #define HSP_EN_UTMISUSPEND BIT(9) 179 #define HSP_COMMONONN BIT(8) 180 181 #define EXYNOS850_DRD_HSPPARACON 0x58 182 #define HSPPARACON_TXVREF GENMASK(31, 28) 183 #define HSPPARACON_TXRISE GENMASK(25, 24) 184 #define HSPPARACON_TXRES GENMASK(22, 21) 185 #define HSPPARACON_TXPREEMPPULSE BIT(20) 186 #define HSPPARACON_TXPREEMPAMP GENMASK(19, 18) 187 #define HSPPARACON_TXHSXV GENMASK(17, 16) 188 #define HSPPARACON_TXFSLS GENMASK(15, 12) 189 #define HSPPARACON_SQRX GENMASK(10, 8) 190 #define HSPPARACON_OTG GENMASK(6, 4) 191 #define HSPPARACON_COMPDIS GENMASK(2, 0) 192 193 #define EXYNOS850_DRD_HSP_TEST 0x5c 194 #define HSP_TEST_SIDDQ BIT(24) 195 196 /* Exynos9 - GS101 */ 197 #define EXYNOS850_DRD_SECPMACTL 0x48 198 #define SECPMACTL_PMA_ROPLL_REF_CLK_SEL GENMASK(13, 12) 199 #define SECPMACTL_PMA_LCPLL_REF_CLK_SEL GENMASK(11, 10) 200 #define SECPMACTL_PMA_REF_FREQ_SEL GENMASK(9, 8) 201 #define SECPMACTL_PMA_LOW_PWR BIT(4) 202 #define SECPMACTL_PMA_TRSV_SW_RST BIT(3) 203 #define SECPMACTL_PMA_CMN_SW_RST BIT(2) 204 #define SECPMACTL_PMA_INIT_SW_RST BIT(1) 205 #define SECPMACTL_PMA_APB_SW_RST BIT(0) 206 207 /* PMA registers */ 208 #define EXYNOS9_PMA_USBDP_CMN_REG0008 0x0020 209 #define CMN_REG0008_OVRD_AUX_EN BIT(3) 210 #define CMN_REG0008_AUX_EN BIT(2) 211 212 #define EXYNOS9_PMA_USBDP_CMN_REG00B8 0x02e0 213 #define CMN_REG00B8_LANE_MUX_SEL_DP GENMASK(3, 0) 214 #define CMN_REG00B8_LANE_MUX_SEL_DP_LANE3 BIT(3) 215 #define CMN_REG00B8_LANE_MUX_SEL_DP_LANE2 BIT(2) 216 #define CMN_REG00B8_LANE_MUX_SEL_DP_LANE1 BIT(1) 217 #define CMN_REG00B8_LANE_MUX_SEL_DP_LANE0 BIT(0) 218 219 #define EXYNOS9_PMA_USBDP_CMN_REG01C0 0x0700 220 #define CMN_REG01C0_ANA_LCPLL_LOCK_DONE BIT(7) 221 #define CMN_REG01C0_ANA_LCPLL_AFC_DONE BIT(6) 222 223 /* these have similar register layout, for lanes 0 and 2 */ 224 #define EXYNOS9_PMA_USBDP_TRSV_REG03C3 0x0f0c 225 #define EXYNOS9_PMA_USBDP_TRSV_REG07C3 0x1f0c 226 #define TRSV_REG03C3_LN0_MON_RX_CDR_AFC_DONE BIT(3) 227 #define TRSV_REG03C3_LN0_MON_RX_CDR_CAL_DONE BIT(2) 228 #define TRSV_REG03C3_LN0_MON_RX_CDR_FLD_PLL_MODE_DONE BIT(1) 229 #define TRSV_REG03C3_LN0_MON_RX_CDR_LOCK_DONE BIT(0) 230 231 /* TRSV_REG0413 and TRSV_REG0813 have similar register layout */ 232 #define EXYNOS9_PMA_USBDP_TRSV_REG0413 0x104c 233 #define TRSV_REG0413_OVRD_LN1_TX_RXD_COMP_EN BIT(7) 234 #define TRSV_REG0413_OVRD_LN1_TX_RXD_EN BIT(5) 235 236 #define EXYNOS9_PMA_USBDP_TRSV_REG0813 0x204c 237 #define TRSV_REG0813_OVRD_LN3_TX_RXD_COMP_EN BIT(7) 238 #define TRSV_REG0813_OVRD_LN3_TX_RXD_EN BIT(5) 239 240 /* PCS registers */ 241 #define EXYNOS9_PCS_NS_VEC_PS1_N1 0x010c 242 #define EXYNOS9_PCS_NS_VEC_PS2_N0 0x0110 243 #define EXYNOS9_PCS_NS_VEC_PS3_N0 0x0118 244 #define NS_VEC_NS_REQ GENMASK(31, 24) 245 #define NS_VEC_ENABLE_TIMER BIT(22) 246 #define NS_VEC_SEL_TIMEOUT GENMASK(21, 20) 247 #define NS_VEC_INV_MASK GENMASK(19, 16) 248 #define NS_VEC_COND_MASK GENMASK(11, 8) 249 #define NS_VEC_EXP_COND GENMASK(3, 0) 250 251 #define EXYNOS9_PCS_OUT_VEC_2 0x014c 252 #define EXYNOS9_PCS_OUT_VEC_3 0x0150 253 #define PCS_OUT_VEC_B9_DYNAMIC BIT(19) 254 #define PCS_OUT_VEC_B9_SEL_OUT BIT(18) 255 #define PCS_OUT_VEC_B8_DYNAMIC BIT(17) 256 #define PCS_OUT_VEC_B8_SEL_OUT BIT(16) 257 #define PCS_OUT_VEC_B7_DYNAMIC BIT(15) 258 #define PCS_OUT_VEC_B7_SEL_OUT BIT(14) 259 #define PCS_OUT_VEC_B6_DYNAMIC BIT(13) 260 #define PCS_OUT_VEC_B6_SEL_OUT BIT(12) 261 #define PCS_OUT_VEC_B5_DYNAMIC BIT(11) 262 #define PCS_OUT_VEC_B5_SEL_OUT BIT(10) 263 #define PCS_OUT_VEC_B4_DYNAMIC BIT(9) 264 #define PCS_OUT_VEC_B4_SEL_OUT BIT(8) 265 #define PCS_OUT_VEC_B3_DYNAMIC BIT(7) 266 #define PCS_OUT_VEC_B3_SEL_OUT BIT(6) 267 #define PCS_OUT_VEC_B2_DYNAMIC BIT(5) 268 #define PCS_OUT_VEC_B2_SEL_OUT BIT(4) 269 #define PCS_OUT_VEC_B1_DYNAMIC BIT(3) 270 #define PCS_OUT_VEC_B1_SEL_OUT BIT(2) 271 #define PCS_OUT_VEC_B0_DYNAMIC BIT(1) 272 #define PCS_OUT_VEC_B0_SEL_OUT BIT(0) 273 274 #define EXYNOS9_PCS_TIMEOUT_0 0x0170 275 276 #define EXYNOS9_PCS_TIMEOUT_3 0x017c 277 278 #define EXYNOS9_PCS_EBUF_PARAM 0x0304 279 #define EBUF_PARAM_SKP_REMOVE_TH_EMPTY_MODE GENMASK(29, 24) 280 281 #define EXYNOS9_PCS_BACK_END_MODE_VEC 0x030c 282 #define BACK_END_MODE_VEC_FORCE_EBUF_EMPTY_MODE BIT(1) 283 #define BACK_END_MODE_VEC_DISABLE_DATA_MASK BIT(0) 284 285 #define EXYNOS9_PCS_RX_CONTROL 0x03f0 286 #define RX_CONTROL_EN_BLOCK_ALIGNER_TYPE_B BIT(22) 287 288 #define EXYNOS9_PCS_RX_CONTROL_DEBUG 0x03f4 289 #define RX_CONTROL_DEBUG_EN_TS_CHECK BIT(5) 290 #define RX_CONTROL_DEBUG_NUM_COM_FOUND GENMASK(3, 0) 291 292 #define EXYNOS9_PCS_LOCAL_COEF 0x040c 293 #define LOCAL_COEF_PMA_CENTER_COEF GENMASK(21, 16) 294 #define LOCAL_COEF_LF GENMASK(13, 8) 295 #define LOCAL_COEF_FS GENMASK(5, 0) 296 297 #define EXYNOS9_PCS_HS_TX_COEF_MAP_0 0x0410 298 #define HS_TX_COEF_MAP_0_SSTX_DEEMP GENMASK(17, 12) 299 #define HS_TX_COEF_MAP_0_SSTX_LEVEL GENMASK(11, 6) 300 #define HS_TX_COEF_MAP_0_SSTX_PRE_SHOOT GENMASK(5, 0) 301 302 303 #define KHZ 1000 304 #define MHZ (KHZ * KHZ) 305 306 #define PHY_TUNING_ENTRY_PHY(o, m, v) { \ 307 .off = (o), \ 308 .mask = (m), \ 309 .val = (v), \ 310 .region = PTR_PHY \ 311 } 312 313 #define PHY_TUNING_ENTRY_PCS(o, m, v) { \ 314 .off = (o), \ 315 .mask = (m), \ 316 .val = (v), \ 317 .region = PTR_PCS \ 318 } 319 320 #define PHY_TUNING_ENTRY_PMA(o, m, v) { \ 321 .off = (o), \ 322 .mask = (m), \ 323 .val = (v), \ 324 .region = PTR_PMA, \ 325 } 326 327 #define PHY_TUNING_ENTRY_LAST { .region = PTR_INVALID } 328 329 #define for_each_phy_tune(tune) \ 330 for (; (tune)->region != PTR_INVALID; ++(tune)) 331 332 struct exynos5_usbdrd_phy_tuning { 333 u32 off; 334 u32 mask; 335 u32 val; 336 char region; 337 #define PTR_INVALID 0 338 #define PTR_PHY 1 339 #define PTR_PCS 2 340 #define PTR_PMA 3 341 }; 342 343 enum exynos5_usbdrd_phy_tuning_state { 344 PTS_UTMI_POSTINIT, 345 PTS_PIPE3_PREINIT, 346 PTS_PIPE3_INIT, 347 PTS_PIPE3_POSTINIT, 348 PTS_PIPE3_POSTLOCK, 349 PTS_MAX, 350 }; 351 352 enum exynos5_usbdrd_phy_id { 353 EXYNOS5_DRDPHY_UTMI, 354 EXYNOS5_DRDPHY_PIPE3, 355 EXYNOS5_DRDPHYS_NUM, 356 }; 357 358 struct phy_usb_instance; 359 struct exynos5_usbdrd_phy; 360 361 struct exynos5_usbdrd_phy_config { 362 u32 id; 363 void (*phy_isol)(struct phy_usb_instance *inst, bool isolate); 364 void (*phy_init)(struct exynos5_usbdrd_phy *phy_drd); 365 unsigned int (*set_refclk)(struct phy_usb_instance *inst); 366 }; 367 368 struct exynos5_usbdrd_phy_drvdata { 369 const struct exynos5_usbdrd_phy_config *phy_cfg; 370 const struct exynos5_usbdrd_phy_tuning **phy_tunes; 371 const struct phy_ops *phy_ops; 372 const char * const *clk_names; 373 int n_clks; 374 const char * const *core_clk_names; 375 int n_core_clks; 376 const char * const *regulator_names; 377 int n_regulators; 378 u32 pmu_offset_usbdrd0_phy; 379 u32 pmu_offset_usbdrd0_phy_ss; 380 u32 pmu_offset_usbdrd1_phy; 381 }; 382 383 /** 384 * struct exynos5_usbdrd_phy - driver data for USB 3.0 PHY 385 * @dev: pointer to device instance of this platform device 386 * @reg_phy: usb phy controller register memory base 387 * @reg_pcs: usb phy physical coding sublayer register memory base 388 * @reg_pma: usb phy physical media attachment register memory base 389 * @clks: clocks for register access 390 * @core_clks: core clocks for phy (ref, pipe3, utmi+, ITP, etc. as required) 391 * @drv_data: pointer to SoC level driver data structure 392 * @phy_mutex: mutex protecting phy_init/exit & TCPC callbacks 393 * @phys: array for 'EXYNOS5_DRDPHYS_NUM' number of PHY 394 * instances each with its 'phy' and 'phy_cfg'. 395 * @extrefclk: frequency select settings when using 'separate 396 * reference clocks' for SS and HS operations 397 * @regulators: regulators for phy 398 * @sw: TypeC orientation switch handle 399 * @orientation: TypeC connector orientation - normal or flipped 400 */ 401 struct exynos5_usbdrd_phy { 402 struct device *dev; 403 void __iomem *reg_phy; 404 void __iomem *reg_pcs; 405 void __iomem *reg_pma; 406 struct clk_bulk_data *clks; 407 struct clk_bulk_data *core_clks; 408 const struct exynos5_usbdrd_phy_drvdata *drv_data; 409 struct mutex phy_mutex; 410 struct phy_usb_instance { 411 struct phy *phy; 412 u32 index; 413 struct regmap *reg_pmu; 414 u32 pmu_offset; 415 const struct exynos5_usbdrd_phy_config *phy_cfg; 416 } phys[EXYNOS5_DRDPHYS_NUM]; 417 u32 extrefclk; 418 struct regulator_bulk_data *regulators; 419 420 struct typec_switch_dev *sw; 421 enum typec_orientation orientation; 422 }; 423 424 static inline 425 struct exynos5_usbdrd_phy *to_usbdrd_phy(struct phy_usb_instance *inst) 426 { 427 return container_of((inst), struct exynos5_usbdrd_phy, 428 phys[(inst)->index]); 429 } 430 431 /* 432 * exynos5_rate_to_clk() converts the supplied clock rate to the value that 433 * can be written to the phy register. 434 */ 435 static unsigned int exynos5_rate_to_clk(unsigned long rate, u32 *reg) 436 { 437 /* EXYNOS5_FSEL_MASK */ 438 439 switch (rate) { 440 case 9600 * KHZ: 441 *reg = EXYNOS5_FSEL_9MHZ6; 442 break; 443 case 10 * MHZ: 444 *reg = EXYNOS5_FSEL_10MHZ; 445 break; 446 case 12 * MHZ: 447 *reg = EXYNOS5_FSEL_12MHZ; 448 break; 449 case 19200 * KHZ: 450 *reg = EXYNOS5_FSEL_19MHZ2; 451 break; 452 case 20 * MHZ: 453 *reg = EXYNOS5_FSEL_20MHZ; 454 break; 455 case 24 * MHZ: 456 *reg = EXYNOS5_FSEL_24MHZ; 457 break; 458 case 26 * MHZ: 459 *reg = EXYNOS5_FSEL_26MHZ; 460 break; 461 case 50 * MHZ: 462 *reg = EXYNOS5_FSEL_50MHZ; 463 break; 464 default: 465 return -EINVAL; 466 } 467 468 return 0; 469 } 470 471 static void exynos5_usbdrd_phy_isol(struct phy_usb_instance *inst, 472 bool isolate) 473 { 474 unsigned int val; 475 476 if (!inst->reg_pmu) 477 return; 478 479 val = isolate ? 0 : EXYNOS4_PHY_ENABLE; 480 481 regmap_update_bits(inst->reg_pmu, inst->pmu_offset, 482 EXYNOS4_PHY_ENABLE, val); 483 } 484 485 /* 486 * Sets the pipe3 phy's clk as EXTREFCLK (XXTI) which is internal clock 487 * from clock core. Further sets multiplier values and spread spectrum 488 * clock settings for SuperSpeed operations. 489 */ 490 static unsigned int 491 exynos5_usbdrd_pipe3_set_refclk(struct phy_usb_instance *inst) 492 { 493 u32 reg; 494 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); 495 496 /* restore any previous reference clock settings */ 497 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYCLKRST); 498 499 /* Use EXTREFCLK as ref clock */ 500 reg &= ~PHYCLKRST_REFCLKSEL_MASK; 501 reg |= PHYCLKRST_REFCLKSEL_EXT_REFCLK; 502 503 /* FSEL settings corresponding to reference clock */ 504 reg &= ~(PHYCLKRST_FSEL_PIPE_MASK | 505 PHYCLKRST_MPLL_MULTIPLIER_MASK | 506 PHYCLKRST_SSC_REFCLKSEL_MASK); 507 switch (phy_drd->extrefclk) { 508 case EXYNOS5_FSEL_50MHZ: 509 reg |= (PHYCLKRST_MPLL_MULTIPLIER_50M_REF | 510 PHYCLKRST_SSC_REFCLKSEL(0x00)); 511 break; 512 case EXYNOS5_FSEL_24MHZ: 513 reg |= (PHYCLKRST_MPLL_MULTIPLIER_24MHZ_REF | 514 PHYCLKRST_SSC_REFCLKSEL(0x88)); 515 break; 516 case EXYNOS5_FSEL_20MHZ: 517 reg |= (PHYCLKRST_MPLL_MULTIPLIER_20MHZ_REF | 518 PHYCLKRST_SSC_REFCLKSEL(0x00)); 519 break; 520 case EXYNOS5_FSEL_19MHZ2: 521 reg |= (PHYCLKRST_MPLL_MULTIPLIER_19200KHZ_REF | 522 PHYCLKRST_SSC_REFCLKSEL(0x88)); 523 break; 524 default: 525 dev_dbg(phy_drd->dev, "unsupported ref clk\n"); 526 break; 527 } 528 529 return reg; 530 } 531 532 /* 533 * Sets the utmi phy's clk as EXTREFCLK (XXTI) which is internal clock 534 * from clock core. Further sets the FSEL values for HighSpeed operations. 535 */ 536 static unsigned int 537 exynos5_usbdrd_utmi_set_refclk(struct phy_usb_instance *inst) 538 { 539 u32 reg; 540 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); 541 542 /* restore any previous reference clock settings */ 543 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYCLKRST); 544 545 reg &= ~PHYCLKRST_REFCLKSEL_MASK; 546 reg |= PHYCLKRST_REFCLKSEL_EXT_REFCLK; 547 548 reg &= ~(PHYCLKRST_FSEL_UTMI_MASK | 549 PHYCLKRST_MPLL_MULTIPLIER_MASK | 550 PHYCLKRST_SSC_REFCLKSEL_MASK); 551 reg |= PHYCLKRST_FSEL(phy_drd->extrefclk); 552 553 return reg; 554 } 555 556 static void 557 exynos5_usbdrd_apply_phy_tunes(struct exynos5_usbdrd_phy *phy_drd, 558 enum exynos5_usbdrd_phy_tuning_state state) 559 { 560 const struct exynos5_usbdrd_phy_tuning *tune; 561 562 tune = phy_drd->drv_data->phy_tunes[state]; 563 if (!tune) 564 return; 565 566 for_each_phy_tune(tune) { 567 void __iomem *reg_base; 568 u32 reg = 0; 569 570 switch (tune->region) { 571 case PTR_PHY: 572 reg_base = phy_drd->reg_phy; 573 break; 574 case PTR_PCS: 575 reg_base = phy_drd->reg_pcs; 576 break; 577 case PTR_PMA: 578 reg_base = phy_drd->reg_pma; 579 break; 580 default: 581 dev_warn_once(phy_drd->dev, 582 "unknown phy region %d\n", tune->region); 583 continue; 584 } 585 586 if (~tune->mask) { 587 reg = readl(reg_base + tune->off); 588 reg &= ~tune->mask; 589 } 590 reg |= tune->val; 591 writel(reg, reg_base + tune->off); 592 } 593 } 594 595 static void exynos5_usbdrd_pipe3_init(struct exynos5_usbdrd_phy *phy_drd) 596 { 597 u32 reg; 598 599 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM1); 600 /* Set Tx De-Emphasis level */ 601 reg &= ~PHYPARAM1_PCS_TXDEEMPH_MASK; 602 reg |= PHYPARAM1_PCS_TXDEEMPH; 603 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM1); 604 605 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYTEST); 606 reg &= ~PHYTEST_POWERDOWN_SSP; 607 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYTEST); 608 } 609 610 static void 611 exynos5_usbdrd_usbdp_g2_v4_ctrl_pma_ready(struct exynos5_usbdrd_phy *phy_drd) 612 { 613 void __iomem *regs_base = phy_drd->reg_phy; 614 u32 reg; 615 616 /* link pipe_clock selection to pclk of PMA */ 617 reg = readl(regs_base + EXYNOS850_DRD_CLKRST); 618 reg |= CLKRST_LINK_PCLK_SEL; 619 writel(reg, regs_base + EXYNOS850_DRD_CLKRST); 620 621 reg = readl(regs_base + EXYNOS850_DRD_SECPMACTL); 622 reg &= ~SECPMACTL_PMA_REF_FREQ_SEL; 623 reg |= FIELD_PREP(SECPMACTL_PMA_REF_FREQ_SEL, 1); 624 /* SFR reset */ 625 reg |= (SECPMACTL_PMA_LOW_PWR | SECPMACTL_PMA_APB_SW_RST); 626 reg &= ~(SECPMACTL_PMA_ROPLL_REF_CLK_SEL | 627 SECPMACTL_PMA_LCPLL_REF_CLK_SEL); 628 /* PMA power off */ 629 reg |= (SECPMACTL_PMA_TRSV_SW_RST | SECPMACTL_PMA_CMN_SW_RST | 630 SECPMACTL_PMA_INIT_SW_RST); 631 writel(reg, regs_base + EXYNOS850_DRD_SECPMACTL); 632 633 udelay(1); 634 635 reg = readl(regs_base + EXYNOS850_DRD_SECPMACTL); 636 reg &= ~SECPMACTL_PMA_LOW_PWR; 637 writel(reg, regs_base + EXYNOS850_DRD_SECPMACTL); 638 639 udelay(1); 640 641 /* release override */ 642 reg = readl(regs_base + EXYNOS850_DRD_LINKCTRL); 643 reg &= ~LINKCTRL_FORCE_PIPE_EN; 644 writel(reg, regs_base + EXYNOS850_DRD_LINKCTRL); 645 646 udelay(1); 647 648 /* APB enable */ 649 reg = readl(regs_base + EXYNOS850_DRD_SECPMACTL); 650 reg &= ~SECPMACTL_PMA_APB_SW_RST; 651 writel(reg, regs_base + EXYNOS850_DRD_SECPMACTL); 652 } 653 654 static void 655 exynos5_usbdrd_usbdp_g2_v4_pma_lane_mux_sel(struct exynos5_usbdrd_phy *phy_drd) 656 { 657 void __iomem *regs_base = phy_drd->reg_pma; 658 u32 reg; 659 660 /* lane configuration: USB on all lanes */ 661 reg = readl(regs_base + EXYNOS9_PMA_USBDP_CMN_REG00B8); 662 reg &= ~CMN_REG00B8_LANE_MUX_SEL_DP; 663 /* 664 * USB on lanes 0 & 1 in normal mode, or 2 & 3 if reversed, DP on the 665 * other ones. 666 */ 667 reg |= FIELD_PREP(CMN_REG00B8_LANE_MUX_SEL_DP, 668 ((phy_drd->orientation == TYPEC_ORIENTATION_NORMAL) 669 ? (CMN_REG00B8_LANE_MUX_SEL_DP_LANE3 670 | CMN_REG00B8_LANE_MUX_SEL_DP_LANE2) 671 : (CMN_REG00B8_LANE_MUX_SEL_DP_LANE1 672 | CMN_REG00B8_LANE_MUX_SEL_DP_LANE0))); 673 writel(reg, regs_base + EXYNOS9_PMA_USBDP_CMN_REG00B8); 674 675 /* override of TX receiver detector and comparator: lane 1 */ 676 reg = readl(regs_base + EXYNOS9_PMA_USBDP_TRSV_REG0413); 677 if (phy_drd->orientation == TYPEC_ORIENTATION_NORMAL) { 678 reg &= ~TRSV_REG0413_OVRD_LN1_TX_RXD_COMP_EN; 679 reg &= ~TRSV_REG0413_OVRD_LN1_TX_RXD_EN; 680 } else { 681 reg |= TRSV_REG0413_OVRD_LN1_TX_RXD_COMP_EN; 682 reg |= TRSV_REG0413_OVRD_LN1_TX_RXD_EN; 683 } 684 writel(reg, regs_base + EXYNOS9_PMA_USBDP_TRSV_REG0413); 685 686 /* lane 3 */ 687 reg = readl(regs_base + EXYNOS9_PMA_USBDP_TRSV_REG0813); 688 if (phy_drd->orientation == TYPEC_ORIENTATION_NORMAL) { 689 reg |= TRSV_REG0813_OVRD_LN3_TX_RXD_COMP_EN; 690 reg |= TRSV_REG0813_OVRD_LN3_TX_RXD_EN; 691 } else { 692 reg &= ~TRSV_REG0813_OVRD_LN3_TX_RXD_COMP_EN; 693 reg &= ~TRSV_REG0813_OVRD_LN3_TX_RXD_EN; 694 } 695 writel(reg, regs_base + EXYNOS9_PMA_USBDP_TRSV_REG0813); 696 } 697 698 static int 699 exynos5_usbdrd_usbdp_g2_v4_pma_check_pll_lock(struct exynos5_usbdrd_phy *phy_drd) 700 { 701 static const unsigned int timeout_us = 40000; 702 static const unsigned int sleep_us = 40; 703 static const u32 locked = (CMN_REG01C0_ANA_LCPLL_LOCK_DONE | 704 CMN_REG01C0_ANA_LCPLL_AFC_DONE); 705 u32 reg; 706 int err; 707 708 err = readl_poll_timeout( 709 phy_drd->reg_pma + EXYNOS9_PMA_USBDP_CMN_REG01C0, 710 reg, (reg & locked) == locked, sleep_us, timeout_us); 711 if (err) 712 dev_err(phy_drd->dev, 713 "timed out waiting for PLL lock: %#.8x\n", reg); 714 715 return err; 716 } 717 718 static void 719 exynos5_usbdrd_usbdp_g2_v4_pma_check_cdr_lock(struct exynos5_usbdrd_phy *phy_drd) 720 { 721 static const unsigned int timeout_us = 40000; 722 static const unsigned int sleep_us = 40; 723 static const u32 locked = 724 (TRSV_REG03C3_LN0_MON_RX_CDR_AFC_DONE 725 | TRSV_REG03C3_LN0_MON_RX_CDR_CAL_DONE 726 | TRSV_REG03C3_LN0_MON_RX_CDR_FLD_PLL_MODE_DONE 727 | TRSV_REG03C3_LN0_MON_RX_CDR_LOCK_DONE); 728 u32 reg; 729 int err; 730 731 err = readl_poll_timeout( 732 /* lane depends on cable orientation */ 733 (phy_drd->reg_pma 734 + ((phy_drd->orientation == TYPEC_ORIENTATION_NORMAL) 735 ? EXYNOS9_PMA_USBDP_TRSV_REG03C3 736 : EXYNOS9_PMA_USBDP_TRSV_REG07C3)), 737 reg, (reg & locked) == locked, sleep_us, timeout_us); 738 if (err) 739 dev_err(phy_drd->dev, 740 "timed out waiting for CDR(l%d) lock: %#.8x\n", 741 ((phy_drd->orientation == TYPEC_ORIENTATION_NORMAL) 742 ? 0 743 : 2), reg); 744 } 745 746 static void exynos5_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd) 747 { 748 u32 reg; 749 750 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM0); 751 /* Set Loss-of-Signal Detector sensitivity */ 752 reg &= ~PHYPARAM0_REF_LOSLEVEL_MASK; 753 reg |= PHYPARAM0_REF_LOSLEVEL; 754 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM0); 755 756 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM1); 757 /* Set Tx De-Emphasis level */ 758 reg &= ~PHYPARAM1_PCS_TXDEEMPH_MASK; 759 reg |= PHYPARAM1_PCS_TXDEEMPH; 760 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM1); 761 762 /* UTMI Power Control */ 763 writel(PHYUTMI_OTGDISABLE, phy_drd->reg_phy + EXYNOS5_DRD_PHYUTMI); 764 765 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYTEST); 766 reg &= ~PHYTEST_POWERDOWN_HSP; 767 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYTEST); 768 } 769 770 static int exynos5_usbdrd_phy_init(struct phy *phy) 771 { 772 int ret; 773 u32 reg; 774 struct phy_usb_instance *inst = phy_get_drvdata(phy); 775 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); 776 777 ret = clk_bulk_prepare_enable(phy_drd->drv_data->n_clks, phy_drd->clks); 778 if (ret) 779 return ret; 780 781 /* Reset USB 3.0 PHY */ 782 writel(0x0, phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0); 783 writel(0x0, phy_drd->reg_phy + EXYNOS5_DRD_PHYRESUME); 784 785 /* 786 * Setting the Frame length Adj value[6:1] to default 0x20 787 * See xHCI 1.0 spec, 5.2.4 788 */ 789 reg = LINKSYSTEM_XHCI_VERSION_CONTROL | 790 LINKSYSTEM_FLADJ(0x20); 791 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_LINKSYSTEM); 792 793 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM0); 794 /* Select PHY CLK source */ 795 reg &= ~PHYPARAM0_REF_USE_PAD; 796 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM0); 797 798 /* This bit must be set for both HS and SS operations */ 799 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYUTMICLKSEL); 800 reg |= PHYUTMICLKSEL_UTMI_CLKSEL; 801 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYUTMICLKSEL); 802 803 /* UTMI or PIPE3 specific init */ 804 inst->phy_cfg->phy_init(phy_drd); 805 806 /* reference clock settings */ 807 reg = inst->phy_cfg->set_refclk(inst); 808 809 /* Digital power supply in normal operating mode */ 810 reg |= PHYCLKRST_RETENABLEN | 811 /* Enable ref clock for SS function */ 812 PHYCLKRST_REF_SSP_EN | 813 /* Enable spread spectrum */ 814 PHYCLKRST_SSC_EN | 815 /* Power down HS Bias and PLL blocks in suspend mode */ 816 PHYCLKRST_COMMONONN | 817 /* Reset the port */ 818 PHYCLKRST_PORTRESET; 819 820 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYCLKRST); 821 822 fsleep(10); 823 824 reg &= ~PHYCLKRST_PORTRESET; 825 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYCLKRST); 826 827 clk_bulk_disable_unprepare(phy_drd->drv_data->n_clks, phy_drd->clks); 828 829 return 0; 830 } 831 832 static int exynos5_usbdrd_phy_exit(struct phy *phy) 833 { 834 int ret; 835 u32 reg; 836 struct phy_usb_instance *inst = phy_get_drvdata(phy); 837 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); 838 839 ret = clk_bulk_prepare_enable(phy_drd->drv_data->n_clks, phy_drd->clks); 840 if (ret) 841 return ret; 842 843 reg = PHYUTMI_OTGDISABLE | 844 PHYUTMI_FORCESUSPEND | 845 PHYUTMI_FORCESLEEP; 846 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYUTMI); 847 848 /* Resetting the PHYCLKRST enable bits to reduce leakage current */ 849 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYCLKRST); 850 reg &= ~(PHYCLKRST_REF_SSP_EN | 851 PHYCLKRST_SSC_EN | 852 PHYCLKRST_COMMONONN); 853 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYCLKRST); 854 855 /* Control PHYTEST to remove leakage current */ 856 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYTEST); 857 reg |= PHYTEST_POWERDOWN_SSP | 858 PHYTEST_POWERDOWN_HSP; 859 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYTEST); 860 861 clk_bulk_disable_unprepare(phy_drd->drv_data->n_clks, phy_drd->clks); 862 863 return 0; 864 } 865 866 static int exynos5_usbdrd_phy_power_on(struct phy *phy) 867 { 868 int ret; 869 struct phy_usb_instance *inst = phy_get_drvdata(phy); 870 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); 871 872 dev_dbg(phy_drd->dev, "Request to power_on usbdrd_phy phy\n"); 873 874 ret = clk_bulk_prepare_enable(phy_drd->drv_data->n_core_clks, 875 phy_drd->core_clks); 876 if (ret) 877 return ret; 878 879 /* Enable VBUS supply */ 880 ret = regulator_bulk_enable(phy_drd->drv_data->n_regulators, 881 phy_drd->regulators); 882 if (ret) { 883 dev_err(phy_drd->dev, "Failed to enable PHY regulator(s)\n"); 884 goto fail_vbus; 885 } 886 887 /* Power-on PHY */ 888 inst->phy_cfg->phy_isol(inst, false); 889 890 return 0; 891 892 fail_vbus: 893 clk_bulk_disable_unprepare(phy_drd->drv_data->n_core_clks, 894 phy_drd->core_clks); 895 896 return ret; 897 } 898 899 static int exynos5_usbdrd_phy_power_off(struct phy *phy) 900 { 901 struct phy_usb_instance *inst = phy_get_drvdata(phy); 902 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); 903 904 dev_dbg(phy_drd->dev, "Request to power_off usbdrd_phy phy\n"); 905 906 /* Power-off the PHY */ 907 inst->phy_cfg->phy_isol(inst, true); 908 909 /* Disable VBUS supply */ 910 regulator_bulk_disable(phy_drd->drv_data->n_regulators, 911 phy_drd->regulators); 912 913 clk_bulk_disable_unprepare(phy_drd->drv_data->n_core_clks, 914 phy_drd->core_clks); 915 916 return 0; 917 } 918 919 static int crport_handshake(struct exynos5_usbdrd_phy *phy_drd, 920 u32 val, u32 cmd) 921 { 922 unsigned int result; 923 int err; 924 925 writel(val | cmd, phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0); 926 927 err = readl_poll_timeout(phy_drd->reg_phy + EXYNOS5_DRD_PHYREG1, 928 result, (result & PHYREG1_CR_ACK), 1, 100); 929 if (err == -ETIMEDOUT) { 930 dev_err(phy_drd->dev, "CRPORT handshake timeout1 (0x%08x)\n", val); 931 return err; 932 } 933 934 writel(val, phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0); 935 936 err = readl_poll_timeout(phy_drd->reg_phy + EXYNOS5_DRD_PHYREG1, 937 result, !(result & PHYREG1_CR_ACK), 1, 100); 938 if (err == -ETIMEDOUT) { 939 dev_err(phy_drd->dev, "CRPORT handshake timeout2 (0x%08x)\n", val); 940 return err; 941 } 942 943 return 0; 944 } 945 946 static int crport_ctrl_write(struct exynos5_usbdrd_phy *phy_drd, 947 u32 addr, u32 data) 948 { 949 int ret; 950 951 /* Write Address */ 952 writel(PHYREG0_CR_DATA_IN(addr), 953 phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0); 954 ret = crport_handshake(phy_drd, PHYREG0_CR_DATA_IN(addr), 955 PHYREG0_CR_CAP_ADDR); 956 if (ret) 957 return ret; 958 959 /* Write Data */ 960 writel(PHYREG0_CR_DATA_IN(data), 961 phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0); 962 ret = crport_handshake(phy_drd, PHYREG0_CR_DATA_IN(data), 963 PHYREG0_CR_CAP_DATA); 964 if (ret) 965 return ret; 966 967 ret = crport_handshake(phy_drd, PHYREG0_CR_DATA_IN(data), 968 PHYREG0_CR_WRITE); 969 970 return ret; 971 } 972 973 /* 974 * Calibrate few PHY parameters using CR_PORT register to meet 975 * SuperSpeed requirements on Exynos5420 and Exynos5800 systems, 976 * which have 28nm USB 3.0 DRD PHY. 977 */ 978 static int exynos5420_usbdrd_phy_calibrate(struct exynos5_usbdrd_phy *phy_drd) 979 { 980 unsigned int temp; 981 int ret = 0; 982 983 /* 984 * Change los_bias to (0x5) for 28nm PHY from a 985 * default value (0x0); los_level is set as default 986 * (0x9) as also reflected in los_level[30:26] bits 987 * of PHYPARAM0 register. 988 */ 989 temp = LOSLEVEL_OVRD_IN_LOS_BIAS_5420 | 990 LOSLEVEL_OVRD_IN_EN | 991 LOSLEVEL_OVRD_IN_LOS_LEVEL_DEFAULT; 992 ret = crport_ctrl_write(phy_drd, 993 EXYNOS5_DRD_PHYSS_LOSLEVEL_OVRD_IN, 994 temp); 995 if (ret) { 996 dev_err(phy_drd->dev, 997 "Failed setting Loss-of-Signal level for SuperSpeed\n"); 998 return ret; 999 } 1000 1001 /* 1002 * Set tx_vboost_lvl to (0x5) for 28nm PHY Tuning, 1003 * to raise Tx signal level from its default value of (0x4) 1004 */ 1005 temp = TX_VBOOSTLEVEL_OVRD_IN_VBOOST_5420; 1006 ret = crport_ctrl_write(phy_drd, 1007 EXYNOS5_DRD_PHYSS_TX_VBOOSTLEVEL_OVRD_IN, 1008 temp); 1009 if (ret) { 1010 dev_err(phy_drd->dev, 1011 "Failed setting Tx-Vboost-Level for SuperSpeed\n"); 1012 return ret; 1013 } 1014 1015 /* 1016 * Set proper time to wait for RxDetect measurement, for 1017 * desired reference clock of PHY, by tuning the CR_PORT 1018 * register LANE0.TX_DEBUG which is internal to PHY. 1019 * This fixes issue with few USB 3.0 devices, which are 1020 * not detected (not even generate interrupts on the bus 1021 * on insertion) without this change. 1022 * e.g. Samsung SUM-TSB16S 3.0 USB drive. 1023 */ 1024 switch (phy_drd->extrefclk) { 1025 case EXYNOS5_FSEL_50MHZ: 1026 temp = LANE0_TX_DEBUG_RXDET_MEAS_TIME_48M_50M_52M; 1027 break; 1028 case EXYNOS5_FSEL_20MHZ: 1029 case EXYNOS5_FSEL_19MHZ2: 1030 temp = LANE0_TX_DEBUG_RXDET_MEAS_TIME_19M2_20M; 1031 break; 1032 case EXYNOS5_FSEL_24MHZ: 1033 default: 1034 temp = LANE0_TX_DEBUG_RXDET_MEAS_TIME_24M; 1035 break; 1036 } 1037 1038 ret = crport_ctrl_write(phy_drd, 1039 EXYNOS5_DRD_PHYSS_LANE0_TX_DEBUG, 1040 temp); 1041 if (ret) 1042 dev_err(phy_drd->dev, 1043 "Fail to set RxDet measurement time for SuperSpeed\n"); 1044 1045 return ret; 1046 } 1047 1048 static struct phy *exynos5_usbdrd_phy_xlate(struct device *dev, 1049 const struct of_phandle_args *args) 1050 { 1051 struct exynos5_usbdrd_phy *phy_drd = dev_get_drvdata(dev); 1052 1053 if (WARN_ON(args->args[0] >= EXYNOS5_DRDPHYS_NUM)) 1054 return ERR_PTR(-ENODEV); 1055 1056 return phy_drd->phys[args->args[0]].phy; 1057 } 1058 1059 static int exynos5_usbdrd_phy_calibrate(struct phy *phy) 1060 { 1061 struct phy_usb_instance *inst = phy_get_drvdata(phy); 1062 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); 1063 1064 if (inst->phy_cfg->id == EXYNOS5_DRDPHY_UTMI) 1065 return exynos5420_usbdrd_phy_calibrate(phy_drd); 1066 return 0; 1067 } 1068 1069 static const struct phy_ops exynos5_usbdrd_phy_ops = { 1070 .init = exynos5_usbdrd_phy_init, 1071 .exit = exynos5_usbdrd_phy_exit, 1072 .power_on = exynos5_usbdrd_phy_power_on, 1073 .power_off = exynos5_usbdrd_phy_power_off, 1074 .calibrate = exynos5_usbdrd_phy_calibrate, 1075 .owner = THIS_MODULE, 1076 }; 1077 1078 static void 1079 exynos5_usbdrd_usb_v3p1_pipe_override(struct exynos5_usbdrd_phy *phy_drd) 1080 { 1081 void __iomem *regs_base = phy_drd->reg_phy; 1082 u32 reg; 1083 1084 /* force pipe3 signal for link */ 1085 reg = readl(regs_base + EXYNOS850_DRD_LINKCTRL); 1086 reg &= ~LINKCTRL_FORCE_PHYSTATUS; 1087 reg |= LINKCTRL_FORCE_PIPE_EN | LINKCTRL_FORCE_RXELECIDLE; 1088 writel(reg, regs_base + EXYNOS850_DRD_LINKCTRL); 1089 1090 /* PMA disable */ 1091 reg = readl(regs_base + EXYNOS850_DRD_SECPMACTL); 1092 reg |= SECPMACTL_PMA_LOW_PWR; 1093 writel(reg, regs_base + EXYNOS850_DRD_SECPMACTL); 1094 } 1095 1096 static void exynos850_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd) 1097 { 1098 void __iomem *regs_base = phy_drd->reg_phy; 1099 u32 reg; 1100 u32 ss_ports; 1101 1102 /* 1103 * Disable HWACG (hardware auto clock gating control). This will force 1104 * QACTIVE signal in Q-Channel interface to HIGH level, to make sure 1105 * the PHY clock is not gated by the hardware. 1106 */ 1107 reg = readl(regs_base + EXYNOS850_DRD_LINKCTRL); 1108 reg |= LINKCTRL_FORCE_QACT; 1109 writel(reg, regs_base + EXYNOS850_DRD_LINKCTRL); 1110 1111 reg = readl(regs_base + EXYNOS850_DRD_LINKPORT); 1112 ss_ports = FIELD_GET(LINKPORT_HOST_NUM_U3, reg); 1113 1114 /* Start PHY Reset (POR=high) */ 1115 reg = readl(regs_base + EXYNOS850_DRD_CLKRST); 1116 if (ss_ports) { 1117 reg |= CLKRST_PHY20_SW_POR; 1118 reg |= CLKRST_PHY20_SW_POR_SEL; 1119 reg |= CLKRST_PHY_RESET_SEL; 1120 } 1121 reg |= CLKRST_PHY_SW_RST; 1122 writel(reg, regs_base + EXYNOS850_DRD_CLKRST); 1123 1124 /* Enable UTMI+ */ 1125 reg = readl(regs_base + EXYNOS850_DRD_UTMI); 1126 reg &= ~(UTMI_FORCE_SUSPEND | UTMI_FORCE_SLEEP | UTMI_DP_PULLDOWN | 1127 UTMI_DM_PULLDOWN); 1128 writel(reg, regs_base + EXYNOS850_DRD_UTMI); 1129 1130 /* Set PHY clock and control HS PHY */ 1131 reg = readl(regs_base + EXYNOS850_DRD_HSP); 1132 reg |= HSP_EN_UTMISUSPEND | HSP_COMMONONN; 1133 writel(reg, regs_base + EXYNOS850_DRD_HSP); 1134 1135 /* Set VBUS Valid and D+ pull-up control by VBUS pad usage */ 1136 reg = readl(regs_base + EXYNOS850_DRD_LINKCTRL); 1137 reg |= LINKCTRL_BUS_FILTER_BYPASS(0xf); 1138 writel(reg, regs_base + EXYNOS850_DRD_LINKCTRL); 1139 1140 if (!phy_drd->sw) { 1141 reg = readl(regs_base + EXYNOS850_DRD_UTMI); 1142 reg |= UTMI_FORCE_BVALID | UTMI_FORCE_VBUSVALID; 1143 writel(reg, regs_base + EXYNOS850_DRD_UTMI); 1144 1145 reg = readl(regs_base + EXYNOS850_DRD_HSP); 1146 reg |= HSP_VBUSVLDEXT | HSP_VBUSVLDEXTSEL; 1147 writel(reg, regs_base + EXYNOS850_DRD_HSP); 1148 } 1149 1150 reg = readl(regs_base + EXYNOS850_DRD_SSPPLLCTL); 1151 reg &= ~SSPPLLCTL_FSEL; 1152 switch (phy_drd->extrefclk) { 1153 case EXYNOS5_FSEL_50MHZ: 1154 reg |= FIELD_PREP(SSPPLLCTL_FSEL, 7); 1155 break; 1156 case EXYNOS5_FSEL_26MHZ: 1157 reg |= FIELD_PREP(SSPPLLCTL_FSEL, 6); 1158 break; 1159 case EXYNOS5_FSEL_24MHZ: 1160 reg |= FIELD_PREP(SSPPLLCTL_FSEL, 2); 1161 break; 1162 case EXYNOS5_FSEL_20MHZ: 1163 reg |= FIELD_PREP(SSPPLLCTL_FSEL, 1); 1164 break; 1165 case EXYNOS5_FSEL_19MHZ2: 1166 reg |= FIELD_PREP(SSPPLLCTL_FSEL, 0); 1167 break; 1168 default: 1169 dev_warn(phy_drd->dev, "unsupported ref clk: %#.2x\n", 1170 phy_drd->extrefclk); 1171 break; 1172 } 1173 writel(reg, regs_base + EXYNOS850_DRD_SSPPLLCTL); 1174 1175 if (phy_drd->drv_data->phy_tunes) 1176 exynos5_usbdrd_apply_phy_tunes(phy_drd, 1177 PTS_UTMI_POSTINIT); 1178 1179 /* Power up PHY analog blocks */ 1180 reg = readl(regs_base + EXYNOS850_DRD_HSP_TEST); 1181 reg &= ~HSP_TEST_SIDDQ; 1182 writel(reg, regs_base + EXYNOS850_DRD_HSP_TEST); 1183 1184 /* Finish PHY reset (POR=low) */ 1185 fsleep(10); /* required before doing POR=low */ 1186 reg = readl(regs_base + EXYNOS850_DRD_CLKRST); 1187 if (ss_ports) { 1188 reg |= CLKRST_PHY20_SW_POR_SEL; 1189 reg &= ~CLKRST_PHY20_SW_POR; 1190 } 1191 reg &= ~(CLKRST_PHY_SW_RST | CLKRST_PORT_RST); 1192 writel(reg, regs_base + EXYNOS850_DRD_CLKRST); 1193 fsleep(75); /* required after POR=low for guaranteed PHY clock */ 1194 1195 /* Disable single ended signal out */ 1196 reg = readl(regs_base + EXYNOS850_DRD_HSP); 1197 reg &= ~HSP_FSV_OUT_EN; 1198 writel(reg, regs_base + EXYNOS850_DRD_HSP); 1199 1200 if (ss_ports) 1201 exynos5_usbdrd_usb_v3p1_pipe_override(phy_drd); 1202 } 1203 1204 static int exynos850_usbdrd_phy_init(struct phy *phy) 1205 { 1206 struct phy_usb_instance *inst = phy_get_drvdata(phy); 1207 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); 1208 int ret; 1209 1210 ret = clk_bulk_prepare_enable(phy_drd->drv_data->n_clks, phy_drd->clks); 1211 if (ret) 1212 return ret; 1213 1214 /* UTMI or PIPE3 specific init */ 1215 scoped_guard(mutex, &phy_drd->phy_mutex) 1216 inst->phy_cfg->phy_init(phy_drd); 1217 1218 clk_bulk_disable_unprepare(phy_drd->drv_data->n_clks, phy_drd->clks); 1219 1220 return 0; 1221 } 1222 1223 static int exynos850_usbdrd_phy_exit(struct phy *phy) 1224 { 1225 struct phy_usb_instance *inst = phy_get_drvdata(phy); 1226 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); 1227 void __iomem *regs_base = phy_drd->reg_phy; 1228 u32 reg; 1229 int ret; 1230 1231 ret = clk_bulk_prepare_enable(phy_drd->drv_data->n_clks, phy_drd->clks); 1232 if (ret) 1233 return ret; 1234 1235 guard(mutex)(&phy_drd->phy_mutex); 1236 1237 /* Set PHY clock and control HS PHY */ 1238 reg = readl(regs_base + EXYNOS850_DRD_UTMI); 1239 reg &= ~(UTMI_DP_PULLDOWN | UTMI_DM_PULLDOWN); 1240 reg |= UTMI_FORCE_SUSPEND | UTMI_FORCE_SLEEP; 1241 writel(reg, regs_base + EXYNOS850_DRD_UTMI); 1242 1243 /* Power down PHY analog blocks */ 1244 reg = readl(regs_base + EXYNOS850_DRD_HSP_TEST); 1245 reg |= HSP_TEST_SIDDQ; 1246 writel(reg, regs_base + EXYNOS850_DRD_HSP_TEST); 1247 1248 /* Link reset */ 1249 reg = readl(regs_base + EXYNOS850_DRD_CLKRST); 1250 reg |= CLKRST_LINK_SW_RST; 1251 writel(reg, regs_base + EXYNOS850_DRD_CLKRST); 1252 fsleep(10); /* required before doing POR=low */ 1253 reg &= ~CLKRST_LINK_SW_RST; 1254 writel(reg, regs_base + EXYNOS850_DRD_CLKRST); 1255 1256 clk_bulk_disable_unprepare(phy_drd->drv_data->n_clks, phy_drd->clks); 1257 1258 return 0; 1259 } 1260 1261 static const struct phy_ops exynos850_usbdrd_phy_ops = { 1262 .init = exynos850_usbdrd_phy_init, 1263 .exit = exynos850_usbdrd_phy_exit, 1264 .power_on = exynos5_usbdrd_phy_power_on, 1265 .power_off = exynos5_usbdrd_phy_power_off, 1266 .owner = THIS_MODULE, 1267 }; 1268 1269 static void exynos5_usbdrd_gs101_pipe3_init(struct exynos5_usbdrd_phy *phy_drd) 1270 { 1271 void __iomem *regs_pma = phy_drd->reg_pma; 1272 void __iomem *regs_phy = phy_drd->reg_phy; 1273 u32 reg; 1274 1275 exynos5_usbdrd_usbdp_g2_v4_ctrl_pma_ready(phy_drd); 1276 1277 /* force aux off */ 1278 reg = readl(regs_pma + EXYNOS9_PMA_USBDP_CMN_REG0008); 1279 reg &= ~CMN_REG0008_AUX_EN; 1280 reg |= CMN_REG0008_OVRD_AUX_EN; 1281 writel(reg, regs_pma + EXYNOS9_PMA_USBDP_CMN_REG0008); 1282 1283 exynos5_usbdrd_apply_phy_tunes(phy_drd, PTS_PIPE3_PREINIT); 1284 exynos5_usbdrd_apply_phy_tunes(phy_drd, PTS_PIPE3_INIT); 1285 exynos5_usbdrd_apply_phy_tunes(phy_drd, PTS_PIPE3_POSTINIT); 1286 1287 exynos5_usbdrd_usbdp_g2_v4_pma_lane_mux_sel(phy_drd); 1288 1289 /* reset release from port */ 1290 reg = readl(regs_phy + EXYNOS850_DRD_SECPMACTL); 1291 reg &= ~(SECPMACTL_PMA_TRSV_SW_RST | SECPMACTL_PMA_CMN_SW_RST | 1292 SECPMACTL_PMA_INIT_SW_RST); 1293 writel(reg, regs_phy + EXYNOS850_DRD_SECPMACTL); 1294 1295 if (!exynos5_usbdrd_usbdp_g2_v4_pma_check_pll_lock(phy_drd)) 1296 exynos5_usbdrd_usbdp_g2_v4_pma_check_cdr_lock(phy_drd); 1297 } 1298 1299 static int exynos5_usbdrd_gs101_phy_init(struct phy *phy) 1300 { 1301 struct phy_usb_instance *inst = phy_get_drvdata(phy); 1302 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); 1303 int ret; 1304 1305 if (inst->phy_cfg->id == EXYNOS5_DRDPHY_UTMI) { 1306 /* Power-on PHY ... */ 1307 ret = regulator_bulk_enable(phy_drd->drv_data->n_regulators, 1308 phy_drd->regulators); 1309 if (ret) { 1310 dev_err(phy_drd->dev, 1311 "Failed to enable PHY regulator(s)\n"); 1312 return ret; 1313 } 1314 } 1315 /* 1316 * ... and ungate power via PMU. Without this here, we get an SError 1317 * trying to access PMA registers 1318 */ 1319 exynos5_usbdrd_phy_isol(inst, false); 1320 1321 return exynos850_usbdrd_phy_init(phy); 1322 } 1323 1324 static int exynos5_usbdrd_gs101_phy_exit(struct phy *phy) 1325 { 1326 struct phy_usb_instance *inst = phy_get_drvdata(phy); 1327 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); 1328 int ret; 1329 1330 if (inst->phy_cfg->id == EXYNOS5_DRDPHY_UTMI) { 1331 ret = exynos850_usbdrd_phy_exit(phy); 1332 if (ret) 1333 return ret; 1334 } 1335 1336 exynos5_usbdrd_phy_isol(inst, true); 1337 1338 if (inst->phy_cfg->id != EXYNOS5_DRDPHY_UTMI) 1339 return 0; 1340 1341 return regulator_bulk_disable(phy_drd->drv_data->n_regulators, 1342 phy_drd->regulators); 1343 } 1344 1345 static const struct phy_ops gs101_usbdrd_phy_ops = { 1346 .init = exynos5_usbdrd_gs101_phy_init, 1347 .exit = exynos5_usbdrd_gs101_phy_exit, 1348 .owner = THIS_MODULE, 1349 }; 1350 1351 static int exynos5_usbdrd_phy_clk_handle(struct exynos5_usbdrd_phy *phy_drd) 1352 { 1353 int ret; 1354 struct clk *ref_clk; 1355 unsigned long ref_rate; 1356 1357 phy_drd->clks = devm_kcalloc(phy_drd->dev, phy_drd->drv_data->n_clks, 1358 sizeof(*phy_drd->clks), GFP_KERNEL); 1359 if (!phy_drd->clks) 1360 return -ENOMEM; 1361 1362 for (int i = 0; i < phy_drd->drv_data->n_clks; ++i) 1363 phy_drd->clks[i].id = phy_drd->drv_data->clk_names[i]; 1364 1365 ret = devm_clk_bulk_get(phy_drd->dev, phy_drd->drv_data->n_clks, 1366 phy_drd->clks); 1367 if (ret) 1368 return dev_err_probe(phy_drd->dev, ret, 1369 "failed to get phy clock(s)\n"); 1370 1371 phy_drd->core_clks = devm_kcalloc(phy_drd->dev, 1372 phy_drd->drv_data->n_core_clks, 1373 sizeof(*phy_drd->core_clks), 1374 GFP_KERNEL); 1375 if (!phy_drd->core_clks) 1376 return -ENOMEM; 1377 1378 for (int i = 0; i < phy_drd->drv_data->n_core_clks; ++i) 1379 phy_drd->core_clks[i].id = phy_drd->drv_data->core_clk_names[i]; 1380 1381 ret = devm_clk_bulk_get(phy_drd->dev, phy_drd->drv_data->n_core_clks, 1382 phy_drd->core_clks); 1383 if (ret) 1384 return dev_err_probe(phy_drd->dev, ret, 1385 "failed to get phy core clock(s)\n"); 1386 1387 ref_clk = NULL; 1388 for (int i = 0; i < phy_drd->drv_data->n_core_clks; ++i) { 1389 if (!strcmp(phy_drd->core_clks[i].id, "ref")) { 1390 ref_clk = phy_drd->core_clks[i].clk; 1391 break; 1392 } 1393 } 1394 if (!ref_clk) 1395 return dev_err_probe(phy_drd->dev, -ENODEV, 1396 "failed to find phy reference clock\n"); 1397 1398 ref_rate = clk_get_rate(ref_clk); 1399 ret = exynos5_rate_to_clk(ref_rate, &phy_drd->extrefclk); 1400 if (ret) 1401 return dev_err_probe(phy_drd->dev, ret, 1402 "clock rate (%ld) not supported\n", 1403 ref_rate); 1404 1405 return 0; 1406 } 1407 1408 static int exynos5_usbdrd_orien_sw_set(struct typec_switch_dev *sw, 1409 enum typec_orientation orientation) 1410 { 1411 struct exynos5_usbdrd_phy *phy_drd = typec_switch_get_drvdata(sw); 1412 int ret; 1413 1414 ret = clk_bulk_prepare_enable(phy_drd->drv_data->n_clks, phy_drd->clks); 1415 if (ret) { 1416 dev_err(phy_drd->dev, "Failed to enable PHY clocks(s)\n"); 1417 return ret; 1418 } 1419 1420 scoped_guard(mutex, &phy_drd->phy_mutex) { 1421 void __iomem * const regs_base = phy_drd->reg_phy; 1422 unsigned int reg; 1423 1424 if (orientation == TYPEC_ORIENTATION_NONE) { 1425 reg = readl(regs_base + EXYNOS850_DRD_UTMI); 1426 reg &= ~(UTMI_FORCE_VBUSVALID | UTMI_FORCE_BVALID); 1427 writel(reg, regs_base + EXYNOS850_DRD_UTMI); 1428 1429 reg = readl(regs_base + EXYNOS850_DRD_HSP); 1430 reg |= HSP_VBUSVLDEXTSEL; 1431 reg &= ~HSP_VBUSVLDEXT; 1432 writel(reg, regs_base + EXYNOS850_DRD_HSP); 1433 } else { 1434 reg = readl(regs_base + EXYNOS850_DRD_UTMI); 1435 reg |= UTMI_FORCE_VBUSVALID | UTMI_FORCE_BVALID; 1436 writel(reg, regs_base + EXYNOS850_DRD_UTMI); 1437 1438 reg = readl(regs_base + EXYNOS850_DRD_HSP); 1439 reg |= HSP_VBUSVLDEXTSEL | HSP_VBUSVLDEXT; 1440 writel(reg, regs_base + EXYNOS850_DRD_HSP); 1441 } 1442 1443 phy_drd->orientation = orientation; 1444 } 1445 1446 clk_bulk_disable(phy_drd->drv_data->n_clks, phy_drd->clks); 1447 1448 return 0; 1449 } 1450 1451 static void exynos5_usbdrd_orien_switch_unregister(void *data) 1452 { 1453 struct exynos5_usbdrd_phy *phy_drd = data; 1454 1455 typec_switch_unregister(phy_drd->sw); 1456 } 1457 1458 static int exynos5_usbdrd_setup_notifiers(struct exynos5_usbdrd_phy *phy_drd) 1459 { 1460 int ret; 1461 1462 if (!IS_ENABLED(CONFIG_TYPEC)) 1463 return 0; 1464 1465 if (device_property_present(phy_drd->dev, "orientation-switch")) { 1466 struct typec_switch_desc sw_desc = { }; 1467 1468 sw_desc.drvdata = phy_drd; 1469 sw_desc.fwnode = dev_fwnode(phy_drd->dev); 1470 sw_desc.set = exynos5_usbdrd_orien_sw_set; 1471 1472 phy_drd->sw = typec_switch_register(phy_drd->dev, &sw_desc); 1473 if (IS_ERR(phy_drd->sw)) 1474 return dev_err_probe(phy_drd->dev, 1475 PTR_ERR(phy_drd->sw), 1476 "Failed to register TypeC orientation switch\n"); 1477 1478 ret = devm_add_action_or_reset(phy_drd->dev, 1479 exynos5_usbdrd_orien_switch_unregister, 1480 phy_drd); 1481 if (ret) 1482 return dev_err_probe(phy_drd->dev, ret, 1483 "Failed to register TypeC orientation devm action\n"); 1484 } 1485 1486 return 0; 1487 } 1488 1489 static const struct exynos5_usbdrd_phy_config phy_cfg_exynos5[] = { 1490 { 1491 .id = EXYNOS5_DRDPHY_UTMI, 1492 .phy_isol = exynos5_usbdrd_phy_isol, 1493 .phy_init = exynos5_usbdrd_utmi_init, 1494 .set_refclk = exynos5_usbdrd_utmi_set_refclk, 1495 }, 1496 { 1497 .id = EXYNOS5_DRDPHY_PIPE3, 1498 .phy_isol = exynos5_usbdrd_phy_isol, 1499 .phy_init = exynos5_usbdrd_pipe3_init, 1500 .set_refclk = exynos5_usbdrd_pipe3_set_refclk, 1501 }, 1502 }; 1503 1504 static const struct exynos5_usbdrd_phy_config phy_cfg_exynos850[] = { 1505 { 1506 .id = EXYNOS5_DRDPHY_UTMI, 1507 .phy_isol = exynos5_usbdrd_phy_isol, 1508 .phy_init = exynos850_usbdrd_utmi_init, 1509 }, 1510 }; 1511 1512 static const char * const exynos5_clk_names[] = { 1513 "phy", 1514 }; 1515 1516 static const char * const exynos5_core_clk_names[] = { 1517 "ref", 1518 }; 1519 1520 static const char * const exynos5433_core_clk_names[] = { 1521 "ref", "phy_pipe", "phy_utmi", "itp", 1522 }; 1523 1524 static const char * const exynos5_regulator_names[] = { 1525 "vbus", "vbus-boost", 1526 }; 1527 1528 static const struct exynos5_usbdrd_phy_drvdata exynos5420_usbdrd_phy = { 1529 .phy_cfg = phy_cfg_exynos5, 1530 .phy_ops = &exynos5_usbdrd_phy_ops, 1531 .pmu_offset_usbdrd0_phy = EXYNOS5_USBDRD_PHY_CONTROL, 1532 .pmu_offset_usbdrd1_phy = EXYNOS5420_USBDRD1_PHY_CONTROL, 1533 .clk_names = exynos5_clk_names, 1534 .n_clks = ARRAY_SIZE(exynos5_clk_names), 1535 .core_clk_names = exynos5_core_clk_names, 1536 .n_core_clks = ARRAY_SIZE(exynos5_core_clk_names), 1537 .regulator_names = exynos5_regulator_names, 1538 .n_regulators = ARRAY_SIZE(exynos5_regulator_names), 1539 }; 1540 1541 static const struct exynos5_usbdrd_phy_drvdata exynos5250_usbdrd_phy = { 1542 .phy_cfg = phy_cfg_exynos5, 1543 .phy_ops = &exynos5_usbdrd_phy_ops, 1544 .pmu_offset_usbdrd0_phy = EXYNOS5_USBDRD_PHY_CONTROL, 1545 .clk_names = exynos5_clk_names, 1546 .n_clks = ARRAY_SIZE(exynos5_clk_names), 1547 .core_clk_names = exynos5_core_clk_names, 1548 .n_core_clks = ARRAY_SIZE(exynos5_core_clk_names), 1549 .regulator_names = exynos5_regulator_names, 1550 .n_regulators = ARRAY_SIZE(exynos5_regulator_names), 1551 }; 1552 1553 static const struct exynos5_usbdrd_phy_drvdata exynos5433_usbdrd_phy = { 1554 .phy_cfg = phy_cfg_exynos5, 1555 .phy_ops = &exynos5_usbdrd_phy_ops, 1556 .pmu_offset_usbdrd0_phy = EXYNOS5_USBDRD_PHY_CONTROL, 1557 .pmu_offset_usbdrd1_phy = EXYNOS5433_USBHOST30_PHY_CONTROL, 1558 .clk_names = exynos5_clk_names, 1559 .n_clks = ARRAY_SIZE(exynos5_clk_names), 1560 .core_clk_names = exynos5433_core_clk_names, 1561 .n_core_clks = ARRAY_SIZE(exynos5433_core_clk_names), 1562 .regulator_names = exynos5_regulator_names, 1563 .n_regulators = ARRAY_SIZE(exynos5_regulator_names), 1564 }; 1565 1566 static const struct exynos5_usbdrd_phy_drvdata exynos7_usbdrd_phy = { 1567 .phy_cfg = phy_cfg_exynos5, 1568 .phy_ops = &exynos5_usbdrd_phy_ops, 1569 .pmu_offset_usbdrd0_phy = EXYNOS5_USBDRD_PHY_CONTROL, 1570 .clk_names = exynos5_clk_names, 1571 .n_clks = ARRAY_SIZE(exynos5_clk_names), 1572 .core_clk_names = exynos5433_core_clk_names, 1573 .n_core_clks = ARRAY_SIZE(exynos5433_core_clk_names), 1574 .regulator_names = exynos5_regulator_names, 1575 .n_regulators = ARRAY_SIZE(exynos5_regulator_names), 1576 }; 1577 1578 static const struct exynos5_usbdrd_phy_drvdata exynos850_usbdrd_phy = { 1579 .phy_cfg = phy_cfg_exynos850, 1580 .phy_ops = &exynos850_usbdrd_phy_ops, 1581 .pmu_offset_usbdrd0_phy = EXYNOS5_USBDRD_PHY_CONTROL, 1582 .clk_names = exynos5_clk_names, 1583 .n_clks = ARRAY_SIZE(exynos5_clk_names), 1584 .core_clk_names = exynos5_core_clk_names, 1585 .n_core_clks = ARRAY_SIZE(exynos5_core_clk_names), 1586 .regulator_names = exynos5_regulator_names, 1587 .n_regulators = ARRAY_SIZE(exynos5_regulator_names), 1588 }; 1589 1590 static const struct exynos5_usbdrd_phy_config phy_cfg_gs101[] = { 1591 { 1592 .id = EXYNOS5_DRDPHY_UTMI, 1593 .phy_isol = exynos5_usbdrd_phy_isol, 1594 .phy_init = exynos850_usbdrd_utmi_init, 1595 }, 1596 { 1597 .id = EXYNOS5_DRDPHY_PIPE3, 1598 .phy_isol = exynos5_usbdrd_phy_isol, 1599 .phy_init = exynos5_usbdrd_gs101_pipe3_init, 1600 }, 1601 }; 1602 1603 static const struct exynos5_usbdrd_phy_tuning gs101_tunes_utmi_postinit[] = { 1604 PHY_TUNING_ENTRY_PHY(EXYNOS850_DRD_HSPPARACON, 1605 (HSPPARACON_TXVREF | HSPPARACON_TXRES | 1606 HSPPARACON_TXPREEMPAMP | HSPPARACON_SQRX | 1607 HSPPARACON_COMPDIS), 1608 (FIELD_PREP_CONST(HSPPARACON_TXVREF, 6) | 1609 FIELD_PREP_CONST(HSPPARACON_TXRES, 1) | 1610 FIELD_PREP_CONST(HSPPARACON_TXPREEMPAMP, 3) | 1611 FIELD_PREP_CONST(HSPPARACON_SQRX, 5) | 1612 FIELD_PREP_CONST(HSPPARACON_COMPDIS, 7))), 1613 PHY_TUNING_ENTRY_LAST 1614 }; 1615 1616 static const struct exynos5_usbdrd_phy_tuning gs101_tunes_pipe3_preinit[] = { 1617 /* preinit */ 1618 /* CDR data mode exit GEN1 ON / GEN2 OFF */ 1619 PHY_TUNING_ENTRY_PMA(0x0c8c, -1, 0xff), 1620 PHY_TUNING_ENTRY_PMA(0x1c8c, -1, 0xff), 1621 PHY_TUNING_ENTRY_PMA(0x0c9c, -1, 0x7d), 1622 PHY_TUNING_ENTRY_PMA(0x1c9c, -1, 0x7d), 1623 /* improve EDS distribution */ 1624 PHY_TUNING_ENTRY_PMA(0x0e7c, -1, 0x06), 1625 PHY_TUNING_ENTRY_PMA(0x09e0, -1, 0x00), 1626 PHY_TUNING_ENTRY_PMA(0x09e4, -1, 0x36), 1627 PHY_TUNING_ENTRY_PMA(0x1e7c, -1, 0x06), 1628 PHY_TUNING_ENTRY_PMA(0x19e0, -1, 0x00), 1629 PHY_TUNING_ENTRY_PMA(0x19e4, -1, 0x36), 1630 /* fix bootloader bug */ 1631 PHY_TUNING_ENTRY_PMA(0x1e90, -1, 0x02), 1632 PHY_TUNING_ENTRY_PMA(0x1e94, -1, 0x0b), 1633 /* improve LVCC */ 1634 PHY_TUNING_ENTRY_PMA(0x08f0, -1, 0x30), 1635 PHY_TUNING_ENTRY_PMA(0x18f0, -1, 0x30), 1636 /* LFPS RX VIH shmoo hole */ 1637 PHY_TUNING_ENTRY_PMA(0x0a08, -1, 0x0c), 1638 PHY_TUNING_ENTRY_PMA(0x1a08, -1, 0x0c), 1639 /* remove unrelated option for v4 phy */ 1640 PHY_TUNING_ENTRY_PMA(0x0a0c, -1, 0x05), 1641 PHY_TUNING_ENTRY_PMA(0x1a0c, -1, 0x05), 1642 /* improve Gen2 LVCC */ 1643 PHY_TUNING_ENTRY_PMA(0x00f8, -1, 0x1c), 1644 PHY_TUNING_ENTRY_PMA(0x00fc, -1, 0x54), 1645 /* Change Vth of RCV_DET because of TD 7.40 Polling Retry Test */ 1646 PHY_TUNING_ENTRY_PMA(0x104c, -1, 0x07), 1647 PHY_TUNING_ENTRY_PMA(0x204c, -1, 0x07), 1648 /* reduce Ux Exit time, assuming 26MHz clock */ 1649 /* Gen1 */ 1650 PHY_TUNING_ENTRY_PMA(0x0ca8, -1, 0x00), 1651 PHY_TUNING_ENTRY_PMA(0x0cac, -1, 0x04), 1652 PHY_TUNING_ENTRY_PMA(0x1ca8, -1, 0x00), 1653 PHY_TUNING_ENTRY_PMA(0x1cac, -1, 0x04), 1654 /* Gen2 */ 1655 PHY_TUNING_ENTRY_PMA(0x0cb8, -1, 0x00), 1656 PHY_TUNING_ENTRY_PMA(0x0cbc, -1, 0x04), 1657 PHY_TUNING_ENTRY_PMA(0x1cb8, -1, 0x00), 1658 PHY_TUNING_ENTRY_PMA(0x1cbc, -1, 0x04), 1659 /* RX impedance setting */ 1660 PHY_TUNING_ENTRY_PMA(0x0bb0, 0x03, 0x01), 1661 PHY_TUNING_ENTRY_PMA(0x0bb4, 0xf0, 0xa0), 1662 PHY_TUNING_ENTRY_PMA(0x1bb0, 0x03, 0x01), 1663 PHY_TUNING_ENTRY_PMA(0x1bb4, 0xf0, 0xa0), 1664 1665 PHY_TUNING_ENTRY_LAST 1666 }; 1667 1668 static const struct exynos5_usbdrd_phy_tuning gs101_tunes_pipe3_init[] = { 1669 /* init */ 1670 /* abnormal common pattern mask */ 1671 PHY_TUNING_ENTRY_PCS(EXYNOS9_PCS_BACK_END_MODE_VEC, 1672 BACK_END_MODE_VEC_DISABLE_DATA_MASK, 0), 1673 /* de-serializer enabled when U2 */ 1674 PHY_TUNING_ENTRY_PCS(EXYNOS9_PCS_OUT_VEC_2, PCS_OUT_VEC_B4_DYNAMIC, 1675 PCS_OUT_VEC_B4_SEL_OUT), 1676 /* TX Keeper Disable, Squelch on when U3 */ 1677 PHY_TUNING_ENTRY_PCS(EXYNOS9_PCS_OUT_VEC_3, PCS_OUT_VEC_B7_DYNAMIC, 1678 PCS_OUT_VEC_B7_SEL_OUT | PCS_OUT_VEC_B2_SEL_OUT), 1679 PHY_TUNING_ENTRY_PCS(EXYNOS9_PCS_NS_VEC_PS1_N1, -1, 1680 (FIELD_PREP_CONST(NS_VEC_NS_REQ, 5) | 1681 NS_VEC_ENABLE_TIMER | 1682 FIELD_PREP_CONST(NS_VEC_SEL_TIMEOUT, 3))), 1683 PHY_TUNING_ENTRY_PCS(EXYNOS9_PCS_NS_VEC_PS2_N0, -1, 1684 (FIELD_PREP_CONST(NS_VEC_NS_REQ, 1) | 1685 NS_VEC_ENABLE_TIMER | 1686 FIELD_PREP_CONST(NS_VEC_SEL_TIMEOUT, 3) | 1687 FIELD_PREP_CONST(NS_VEC_COND_MASK, 2) | 1688 FIELD_PREP_CONST(NS_VEC_EXP_COND, 2))), 1689 PHY_TUNING_ENTRY_PCS(EXYNOS9_PCS_NS_VEC_PS3_N0, -1, 1690 (FIELD_PREP_CONST(NS_VEC_NS_REQ, 1) | 1691 NS_VEC_ENABLE_TIMER | 1692 FIELD_PREP_CONST(NS_VEC_SEL_TIMEOUT, 3) | 1693 FIELD_PREP_CONST(NS_VEC_COND_MASK, 7) | 1694 FIELD_PREP_CONST(NS_VEC_EXP_COND, 7))), 1695 PHY_TUNING_ENTRY_PCS(EXYNOS9_PCS_TIMEOUT_0, -1, 112), 1696 /* Block Aligner Type B */ 1697 PHY_TUNING_ENTRY_PCS(EXYNOS9_PCS_RX_CONTROL, 0, 1698 RX_CONTROL_EN_BLOCK_ALIGNER_TYPE_B), 1699 /* Block align at TS1/TS2 for Gen2 stability (Gen2 only) */ 1700 PHY_TUNING_ENTRY_PCS(EXYNOS9_PCS_RX_CONTROL_DEBUG, 1701 RX_CONTROL_DEBUG_NUM_COM_FOUND, 1702 (RX_CONTROL_DEBUG_EN_TS_CHECK | 1703 /* 1704 * increase pcs ts1 adding packet-cnt 1 --> 4 1705 * lnx_rx_valid_rstn_delay_rise_sp/ssp : 1706 * 19.6us(0x200) -> 15.3us(0x4) 1707 */ 1708 FIELD_PREP_CONST(RX_CONTROL_DEBUG_NUM_COM_FOUND, 4))), 1709 /* Gen1 Tx DRIVER pre-shoot, de-emphasis, level ctrl */ 1710 PHY_TUNING_ENTRY_PCS(EXYNOS9_PCS_HS_TX_COEF_MAP_0, 1711 (HS_TX_COEF_MAP_0_SSTX_DEEMP | HS_TX_COEF_MAP_0_SSTX_LEVEL | 1712 HS_TX_COEF_MAP_0_SSTX_PRE_SHOOT), 1713 (FIELD_PREP_CONST(HS_TX_COEF_MAP_0_SSTX_DEEMP, 8) | 1714 FIELD_PREP_CONST(HS_TX_COEF_MAP_0_SSTX_LEVEL, 0xb) | 1715 FIELD_PREP_CONST(HS_TX_COEF_MAP_0_SSTX_PRE_SHOOT, 0))), 1716 /* Gen2 Tx DRIVER level ctrl */ 1717 PHY_TUNING_ENTRY_PCS(EXYNOS9_PCS_LOCAL_COEF, 1718 LOCAL_COEF_PMA_CENTER_COEF, 1719 FIELD_PREP_CONST(LOCAL_COEF_PMA_CENTER_COEF, 0xb)), 1720 /* Gen2 U1 exit LFPS duration : 900ns ~ 1.2us */ 1721 PHY_TUNING_ENTRY_PCS(EXYNOS9_PCS_TIMEOUT_3, -1, 4096), 1722 /* set skp_remove_th 0x2 -> 0x7 for avoiding retry problem. */ 1723 PHY_TUNING_ENTRY_PCS(EXYNOS9_PCS_EBUF_PARAM, 1724 EBUF_PARAM_SKP_REMOVE_TH_EMPTY_MODE, 1725 FIELD_PREP_CONST(EBUF_PARAM_SKP_REMOVE_TH_EMPTY_MODE, 0x7)), 1726 1727 PHY_TUNING_ENTRY_LAST 1728 }; 1729 1730 static const struct exynos5_usbdrd_phy_tuning gs101_tunes_pipe3_postlock[] = { 1731 /* Squelch off when U3 */ 1732 PHY_TUNING_ENTRY_PCS(EXYNOS9_PCS_OUT_VEC_3, PCS_OUT_VEC_B2_SEL_OUT, 0), 1733 1734 PHY_TUNING_ENTRY_LAST 1735 }; 1736 1737 static const struct exynos5_usbdrd_phy_tuning *gs101_tunes[PTS_MAX] = { 1738 [PTS_UTMI_POSTINIT] = gs101_tunes_utmi_postinit, 1739 [PTS_PIPE3_PREINIT] = gs101_tunes_pipe3_preinit, 1740 [PTS_PIPE3_INIT] = gs101_tunes_pipe3_init, 1741 [PTS_PIPE3_POSTLOCK] = gs101_tunes_pipe3_postlock, 1742 }; 1743 1744 static const char * const gs101_clk_names[] = { 1745 "phy", "ctrl_aclk", "ctrl_pclk", "scl_pclk", 1746 }; 1747 1748 static const char * const gs101_regulator_names[] = { 1749 "pll", 1750 "dvdd-usb20", "vddh-usb20", "vdd33-usb20", 1751 "vdda-usbdp", "vddh-usbdp", 1752 }; 1753 1754 static const struct exynos5_usbdrd_phy_drvdata gs101_usbd31rd_phy = { 1755 .phy_cfg = phy_cfg_gs101, 1756 .phy_tunes = gs101_tunes, 1757 .phy_ops = &gs101_usbdrd_phy_ops, 1758 .pmu_offset_usbdrd0_phy = GS101_PHY_CTRL_USB20, 1759 .pmu_offset_usbdrd0_phy_ss = GS101_PHY_CTRL_USBDP, 1760 .clk_names = gs101_clk_names, 1761 .n_clks = ARRAY_SIZE(gs101_clk_names), 1762 .core_clk_names = exynos5_core_clk_names, 1763 .n_core_clks = ARRAY_SIZE(exynos5_core_clk_names), 1764 .regulator_names = gs101_regulator_names, 1765 .n_regulators = ARRAY_SIZE(gs101_regulator_names), 1766 }; 1767 1768 static const struct of_device_id exynos5_usbdrd_phy_of_match[] = { 1769 { 1770 .compatible = "google,gs101-usb31drd-phy", 1771 .data = &gs101_usbd31rd_phy 1772 }, { 1773 .compatible = "samsung,exynos5250-usbdrd-phy", 1774 .data = &exynos5250_usbdrd_phy 1775 }, { 1776 .compatible = "samsung,exynos5420-usbdrd-phy", 1777 .data = &exynos5420_usbdrd_phy 1778 }, { 1779 .compatible = "samsung,exynos5433-usbdrd-phy", 1780 .data = &exynos5433_usbdrd_phy 1781 }, { 1782 .compatible = "samsung,exynos7-usbdrd-phy", 1783 .data = &exynos7_usbdrd_phy 1784 }, { 1785 .compatible = "samsung,exynos850-usbdrd-phy", 1786 .data = &exynos850_usbdrd_phy 1787 }, 1788 { }, 1789 }; 1790 MODULE_DEVICE_TABLE(of, exynos5_usbdrd_phy_of_match); 1791 1792 static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) 1793 { 1794 struct device *dev = &pdev->dev; 1795 struct device_node *node = dev->of_node; 1796 struct exynos5_usbdrd_phy *phy_drd; 1797 struct phy_provider *phy_provider; 1798 const struct exynos5_usbdrd_phy_drvdata *drv_data; 1799 struct regmap *reg_pmu; 1800 u32 pmu_offset; 1801 int i, ret; 1802 int channel; 1803 1804 phy_drd = devm_kzalloc(dev, sizeof(*phy_drd), GFP_KERNEL); 1805 if (!phy_drd) 1806 return -ENOMEM; 1807 1808 dev_set_drvdata(dev, phy_drd); 1809 phy_drd->dev = dev; 1810 1811 drv_data = of_device_get_match_data(dev); 1812 if (!drv_data) 1813 return -EINVAL; 1814 phy_drd->drv_data = drv_data; 1815 1816 ret = devm_mutex_init(dev, &phy_drd->phy_mutex); 1817 if (ret) 1818 return ret; 1819 1820 if (of_property_present(dev->of_node, "reg-names")) { 1821 void __iomem *reg; 1822 1823 reg = devm_platform_ioremap_resource_byname(pdev, "phy"); 1824 if (IS_ERR(reg)) 1825 return PTR_ERR(reg); 1826 phy_drd->reg_phy = reg; 1827 1828 reg = devm_platform_ioremap_resource_byname(pdev, "pcs"); 1829 if (IS_ERR(reg)) 1830 return PTR_ERR(reg); 1831 phy_drd->reg_pcs = reg; 1832 1833 reg = devm_platform_ioremap_resource_byname(pdev, "pma"); 1834 if (IS_ERR(reg)) 1835 return PTR_ERR(reg); 1836 phy_drd->reg_pma = reg; 1837 } else { 1838 /* DTB with just a single region */ 1839 phy_drd->reg_phy = devm_platform_ioremap_resource(pdev, 0); 1840 if (IS_ERR(phy_drd->reg_phy)) 1841 return PTR_ERR(phy_drd->reg_phy); 1842 } 1843 1844 ret = exynos5_usbdrd_phy_clk_handle(phy_drd); 1845 if (ret) 1846 return ret; 1847 1848 reg_pmu = syscon_regmap_lookup_by_phandle(dev->of_node, 1849 "samsung,pmu-syscon"); 1850 if (IS_ERR(reg_pmu)) 1851 return dev_err_probe(dev, PTR_ERR(reg_pmu), 1852 "Failed to lookup PMU regmap\n"); 1853 1854 /* 1855 * Exynos5420 SoC has multiple channels for USB 3.0 PHY, with 1856 * each having separate power control registers. 1857 * 'channel' facilitates to set such registers. 1858 */ 1859 channel = of_alias_get_id(node, "usbdrdphy"); 1860 if (channel < 0) 1861 dev_dbg(dev, "Not a multi-controller usbdrd phy\n"); 1862 1863 /* Get regulators */ 1864 phy_drd->regulators = devm_kcalloc(dev, 1865 drv_data->n_regulators, 1866 sizeof(*phy_drd->regulators), 1867 GFP_KERNEL); 1868 if (!phy_drd->regulators) 1869 return -ENOMEM; 1870 regulator_bulk_set_supply_names(phy_drd->regulators, 1871 drv_data->regulator_names, 1872 drv_data->n_regulators); 1873 ret = devm_regulator_bulk_get(dev, drv_data->n_regulators, 1874 phy_drd->regulators); 1875 if (ret) 1876 return dev_err_probe(dev, ret, "failed to get regulators\n"); 1877 1878 ret = exynos5_usbdrd_setup_notifiers(phy_drd); 1879 if (ret) 1880 return ret; 1881 1882 dev_vdbg(dev, "Creating usbdrd_phy phy\n"); 1883 1884 for (i = 0; i < EXYNOS5_DRDPHYS_NUM; i++) { 1885 struct phy *phy = devm_phy_create(dev, NULL, drv_data->phy_ops); 1886 1887 if (IS_ERR(phy)) 1888 return dev_err_probe(dev, PTR_ERR(phy), 1889 "Failed to create usbdrd_phy phy\n"); 1890 1891 phy_drd->phys[i].phy = phy; 1892 phy_drd->phys[i].index = i; 1893 phy_drd->phys[i].reg_pmu = reg_pmu; 1894 switch (channel) { 1895 case 1: 1896 pmu_offset = drv_data->pmu_offset_usbdrd1_phy; 1897 break; 1898 case 0: 1899 default: 1900 pmu_offset = drv_data->pmu_offset_usbdrd0_phy; 1901 if (i == EXYNOS5_DRDPHY_PIPE3 && drv_data 1902 ->pmu_offset_usbdrd0_phy_ss) 1903 pmu_offset = drv_data->pmu_offset_usbdrd0_phy_ss; 1904 break; 1905 } 1906 phy_drd->phys[i].pmu_offset = pmu_offset; 1907 phy_drd->phys[i].phy_cfg = &drv_data->phy_cfg[i]; 1908 phy_set_drvdata(phy, &phy_drd->phys[i]); 1909 } 1910 1911 phy_provider = devm_of_phy_provider_register(dev, 1912 exynos5_usbdrd_phy_xlate); 1913 if (IS_ERR(phy_provider)) 1914 return dev_err_probe(phy_drd->dev, PTR_ERR(phy_provider), 1915 "Failed to register phy provider\n"); 1916 1917 return 0; 1918 } 1919 1920 static struct platform_driver exynos5_usb3drd_phy = { 1921 .probe = exynos5_usbdrd_phy_probe, 1922 .driver = { 1923 .of_match_table = exynos5_usbdrd_phy_of_match, 1924 .name = "exynos5_usb3drd_phy", 1925 .suppress_bind_attrs = true, 1926 } 1927 }; 1928 1929 module_platform_driver(exynos5_usb3drd_phy); 1930 MODULE_DESCRIPTION("Samsung Exynos5 SoCs USB 3.0 DRD controller PHY driver"); 1931 MODULE_AUTHOR("Vivek Gautam <gautam.vivek@samsung.com>"); 1932 MODULE_LICENSE("GPL v2"); 1933 MODULE_ALIAS("platform:exynos5_usb3drd_phy"); 1934