Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2015-2016 Marvell International Ltd. |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <fdtdec.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 8 | #include <log.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 9 | #include <asm/global_data.h> |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 10 | #include <asm/io.h> |
Grzegorz Jaszczyk | 7928a8e | 2020-10-18 17:11:11 +0300 | [diff] [blame] | 11 | #include <asm/ptrace.h> |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 12 | #include <asm/arch/cpu.h> |
| 13 | #include <asm/arch/soc.h> |
Simon Glass | dbd7954 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 14 | #include <linux/delay.h> |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 15 | |
Marek BehĂșn | 19ce44c | 2018-08-17 12:58:51 +0200 | [diff] [blame] | 16 | #include "comphy_core.h" |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 17 | #include "sata.h" |
| 18 | #include "utmi_phy.h" |
| 19 | |
| 20 | DECLARE_GLOBAL_DATA_PTR; |
| 21 | |
Grzegorz Jaszczyk | 7928a8e | 2020-10-18 17:11:11 +0300 | [diff] [blame] | 22 | /* Firmware related definitions used for SMC calls */ |
| 23 | #define MV_SIP_COMPHY_POWER_ON 0x82000001 |
| 24 | #define MV_SIP_COMPHY_POWER_OFF 0x82000002 |
| 25 | #define MV_SIP_COMPHY_PLL_LOCK 0x82000003 |
Grzegorz Jaszczyk | a8e6b49 | 2018-04-03 16:59:12 +0200 | [diff] [blame] | 26 | #define MV_SIP_COMPHY_XFI_TRAIN 0x82000004 |
Grzegorz Jaszczyk | 7928a8e | 2020-10-18 17:11:11 +0300 | [diff] [blame] | 27 | |
Igal Liberman | 67d1a3f | 2020-10-18 17:11:13 +0300 | [diff] [blame] | 28 | /* Used to distinguish between different possible callers (U-boot/Linux) */ |
| 29 | #define COMPHY_CALLER_UBOOT (0x1 << 21) |
| 30 | |
Grzegorz Jaszczyk | 7928a8e | 2020-10-18 17:11:11 +0300 | [diff] [blame] | 31 | #define COMPHY_FW_MODE_FORMAT(mode) ((mode) << 12) |
| 32 | #define COMPHY_FW_FORMAT(mode, idx, speeds) \ |
| 33 | (((mode) << 12) | ((idx) << 8) | ((speeds) << 2)) |
Grzegorz Jaszczyk | c42b5a3 | 2020-10-18 17:11:12 +0300 | [diff] [blame] | 34 | |
| 35 | #define COMPHY_FW_PCIE_FORMAT(pcie_width, clk_src, mode, speeds) \ |
Igal Liberman | 67d1a3f | 2020-10-18 17:11:13 +0300 | [diff] [blame] | 36 | (COMPHY_CALLER_UBOOT | ((pcie_width) << 18) | \ |
| 37 | ((clk_src) << 17) | COMPHY_FW_FORMAT(mode, 0, speeds)) |
Grzegorz Jaszczyk | c42b5a3 | 2020-10-18 17:11:12 +0300 | [diff] [blame] | 38 | |
Grzegorz Jaszczyk | 7928a8e | 2020-10-18 17:11:11 +0300 | [diff] [blame] | 39 | #define COMPHY_SATA_MODE 0x1 |
| 40 | #define COMPHY_SGMII_MODE 0x2 /* SGMII 1G */ |
| 41 | #define COMPHY_HS_SGMII_MODE 0x3 /* SGMII 2.5G */ |
| 42 | #define COMPHY_USB3H_MODE 0x4 |
| 43 | #define COMPHY_USB3D_MODE 0x5 |
| 44 | #define COMPHY_PCIE_MODE 0x6 |
| 45 | #define COMPHY_RXAUI_MODE 0x7 |
| 46 | #define COMPHY_XFI_MODE 0x8 |
| 47 | #define COMPHY_SFI_MODE 0x9 |
| 48 | #define COMPHY_USB3_MODE 0xa |
| 49 | #define COMPHY_AP_MODE 0xb |
| 50 | |
| 51 | /* Comphy unit index macro */ |
| 52 | #define COMPHY_UNIT_ID0 0 |
| 53 | #define COMPHY_UNIT_ID1 1 |
| 54 | #define COMPHY_UNIT_ID2 2 |
| 55 | #define COMPHY_UNIT_ID3 3 |
| 56 | |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 57 | struct utmi_phy_data { |
| 58 | void __iomem *utmi_base_addr; |
| 59 | void __iomem *usb_cfg_addr; |
| 60 | void __iomem *utmi_cfg_addr; |
| 61 | u32 utmi_phy_port; |
| 62 | }; |
| 63 | |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 64 | static u32 polling_with_timeout(void __iomem *addr, u32 val, |
| 65 | u32 mask, unsigned long usec_timout) |
| 66 | { |
| 67 | u32 data; |
| 68 | |
| 69 | do { |
| 70 | udelay(1); |
| 71 | data = readl(addr) & mask; |
| 72 | } while (data != val && --usec_timout > 0); |
| 73 | |
| 74 | if (usec_timout == 0) |
| 75 | return data; |
| 76 | |
| 77 | return 0; |
| 78 | } |
| 79 | |
Grzegorz Jaszczyk | a8e6b49 | 2018-04-03 16:59:12 +0200 | [diff] [blame] | 80 | static int comphy_smc(u32 function_id, void __iomem *comphy_base_addr, |
| 81 | u32 lane, u32 mode) |
Igal Liberman | 6795a66 | 2021-03-23 11:57:57 +0100 | [diff] [blame] | 82 | { |
Grzegorz Jaszczyk | a8e6b49 | 2018-04-03 16:59:12 +0200 | [diff] [blame] | 83 | struct pt_regs pregs = {0}; |
Igal Liberman | 6795a66 | 2021-03-23 11:57:57 +0100 | [diff] [blame] | 84 | |
Grzegorz Jaszczyk | a8e6b49 | 2018-04-03 16:59:12 +0200 | [diff] [blame] | 85 | pregs.regs[0] = function_id; |
| 86 | pregs.regs[1] = (unsigned long)comphy_base_addr; |
| 87 | pregs.regs[2] = lane; |
| 88 | pregs.regs[3] = mode; |
Igal Liberman | 6795a66 | 2021-03-23 11:57:57 +0100 | [diff] [blame] | 89 | |
Grzegorz Jaszczyk | a8e6b49 | 2018-04-03 16:59:12 +0200 | [diff] [blame] | 90 | smc_call(&pregs); |
Igal Liberman | 6795a66 | 2021-03-23 11:57:57 +0100 | [diff] [blame] | 91 | |
Grzegorz Jaszczyk | a8e6b49 | 2018-04-03 16:59:12 +0200 | [diff] [blame] | 92 | /* |
| 93 | * TODO: Firmware return 0 on success, temporary map it to u-boot |
| 94 | * convention, but after all comphy will be reworked the convention in |
| 95 | * u-boot should be change and this conversion removed |
| 96 | */ |
| 97 | return pregs.regs[0] ? 0 : 1; |
Igal Liberman | 6795a66 | 2021-03-23 11:57:57 +0100 | [diff] [blame] | 98 | } |
| 99 | |
| 100 | /* This function performs RX training for all FFE possible values. |
| 101 | * We get the result for each FFE and eventually the best FFE will |
| 102 | * be used and set to the HW. |
| 103 | * |
| 104 | * Return '1' on succsess. |
| 105 | * Return '0' on failure. |
| 106 | */ |
| 107 | int comphy_cp110_sfi_rx_training(struct chip_serdes_phy_config *ptr_chip_cfg, |
| 108 | u32 lane) |
| 109 | { |
Igal Liberman | 6795a66 | 2021-03-23 11:57:57 +0100 | [diff] [blame] | 110 | int ret; |
| 111 | |
| 112 | debug_enter(); |
| 113 | |
| 114 | if (ptr_chip_cfg->comphy_map_data[lane].type != COMPHY_TYPE_SFI) { |
| 115 | pr_err("Comphy %d isn't configured to SFI\n", lane); |
| 116 | return 0; |
| 117 | } |
| 118 | |
Grzegorz Jaszczyk | a8e6b49 | 2018-04-03 16:59:12 +0200 | [diff] [blame] | 119 | /* Mode is not relevant for xfi training */ |
| 120 | ret = comphy_smc(MV_SIP_COMPHY_XFI_TRAIN, |
| 121 | ptr_chip_cfg->comphy_base_addr, lane, 0); |
Igal Liberman | 6795a66 | 2021-03-23 11:57:57 +0100 | [diff] [blame] | 122 | |
| 123 | debug_exit(); |
| 124 | |
| 125 | return ret; |
| 126 | } |
| 127 | |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 128 | static int comphy_sata_power_up(u32 lane, void __iomem *hpipe_base, |
Grzegorz Jaszczyk | 7928a8e | 2020-10-18 17:11:11 +0300 | [diff] [blame] | 129 | void __iomem *comphy_base_addr, int cp_index, |
| 130 | u32 type) |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 131 | { |
| 132 | u32 mask, data, i, ret = 1; |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 133 | void __iomem *sata_base = NULL; |
| 134 | int sata_node = -1; /* Set to -1 in order to read the first sata node */ |
| 135 | |
| 136 | debug_enter(); |
| 137 | |
| 138 | /* |
| 139 | * Assumption - each CP has only one SATA controller |
| 140 | * Calling fdt_node_offset_by_compatible first time (with sata_node = -1 |
| 141 | * will return the first node always. |
| 142 | * In order to parse each CPs SATA node, fdt_node_offset_by_compatible |
| 143 | * must be called again (according to the CP id) |
| 144 | */ |
Igal Liberman | c8855ce | 2017-04-24 18:45:32 +0300 | [diff] [blame] | 145 | for (i = 0; i < (cp_index + 1); i++) |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 146 | sata_node = fdt_node_offset_by_compatible( |
| 147 | gd->fdt_blob, sata_node, "marvell,armada-8k-ahci"); |
| 148 | |
| 149 | if (sata_node == 0) { |
Masahiro Yamada | 81e1042 | 2017-09-16 14:10:41 +0900 | [diff] [blame] | 150 | pr_err("SATA node not found in FDT\n"); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 151 | return 0; |
| 152 | } |
| 153 | |
| 154 | sata_base = (void __iomem *)fdtdec_get_addr_size_auto_noparent( |
| 155 | gd->fdt_blob, sata_node, "reg", 0, NULL, true); |
| 156 | if (sata_base == NULL) { |
Masahiro Yamada | 81e1042 | 2017-09-16 14:10:41 +0900 | [diff] [blame] | 157 | pr_err("SATA address not found in FDT\n"); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 158 | return 0; |
| 159 | } |
| 160 | |
| 161 | debug("SATA address found in FDT %p\n", sata_base); |
| 162 | |
| 163 | debug("stage: MAC configuration - power down comphy\n"); |
| 164 | /* |
| 165 | * MAC configuration powe down comphy use indirect address for |
| 166 | * vendor spesific SATA control register |
| 167 | */ |
| 168 | reg_set(sata_base + SATA3_VENDOR_ADDRESS, |
| 169 | SATA_CONTROL_REG << SATA3_VENDOR_ADDR_OFSSET, |
| 170 | SATA3_VENDOR_ADDR_MASK); |
| 171 | /* SATA 0 power down */ |
| 172 | mask = SATA3_CTRL_SATA0_PD_MASK; |
| 173 | data = 0x1 << SATA3_CTRL_SATA0_PD_OFFSET; |
| 174 | /* SATA 1 power down */ |
| 175 | mask |= SATA3_CTRL_SATA1_PD_MASK; |
| 176 | data |= 0x1 << SATA3_CTRL_SATA1_PD_OFFSET; |
| 177 | /* SATA SSU disable */ |
| 178 | mask |= SATA3_CTRL_SATA1_ENABLE_MASK; |
| 179 | data |= 0x0 << SATA3_CTRL_SATA1_ENABLE_OFFSET; |
| 180 | /* SATA port 1 disable */ |
| 181 | mask |= SATA3_CTRL_SATA_SSU_MASK; |
| 182 | data |= 0x0 << SATA3_CTRL_SATA_SSU_OFFSET; |
| 183 | reg_set(sata_base + SATA3_VENDOR_DATA, data, mask); |
| 184 | |
Grzegorz Jaszczyk | 7928a8e | 2020-10-18 17:11:11 +0300 | [diff] [blame] | 185 | ret = comphy_smc(MV_SIP_COMPHY_POWER_ON, comphy_base_addr, lane, type); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 186 | |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 187 | /* |
| 188 | * MAC configuration power up comphy - power up PLL/TX/RX |
| 189 | * use indirect address for vendor spesific SATA control register |
| 190 | */ |
| 191 | reg_set(sata_base + SATA3_VENDOR_ADDRESS, |
| 192 | SATA_CONTROL_REG << SATA3_VENDOR_ADDR_OFSSET, |
| 193 | SATA3_VENDOR_ADDR_MASK); |
| 194 | /* SATA 0 power up */ |
| 195 | mask = SATA3_CTRL_SATA0_PD_MASK; |
| 196 | data = 0x0 << SATA3_CTRL_SATA0_PD_OFFSET; |
| 197 | /* SATA 1 power up */ |
| 198 | mask |= SATA3_CTRL_SATA1_PD_MASK; |
| 199 | data |= 0x0 << SATA3_CTRL_SATA1_PD_OFFSET; |
| 200 | /* SATA SSU enable */ |
| 201 | mask |= SATA3_CTRL_SATA1_ENABLE_MASK; |
| 202 | data |= 0x1 << SATA3_CTRL_SATA1_ENABLE_OFFSET; |
| 203 | /* SATA port 1 enable */ |
| 204 | mask |= SATA3_CTRL_SATA_SSU_MASK; |
| 205 | data |= 0x1 << SATA3_CTRL_SATA_SSU_OFFSET; |
| 206 | reg_set(sata_base + SATA3_VENDOR_DATA, data, mask); |
| 207 | |
| 208 | /* MBUS request size and interface select register */ |
| 209 | reg_set(sata_base + SATA3_VENDOR_ADDRESS, |
| 210 | SATA_MBUS_SIZE_SELECT_REG << SATA3_VENDOR_ADDR_OFSSET, |
| 211 | SATA3_VENDOR_ADDR_MASK); |
| 212 | /* Mbus regret enable */ |
| 213 | reg_set(sata_base + SATA3_VENDOR_DATA, |
| 214 | 0x1 << SATA_MBUS_REGRET_EN_OFFSET, SATA_MBUS_REGRET_EN_MASK); |
| 215 | |
Grzegorz Jaszczyk | 7928a8e | 2020-10-18 17:11:11 +0300 | [diff] [blame] | 216 | ret = comphy_smc(MV_SIP_COMPHY_PLL_LOCK, comphy_base_addr, lane, type); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 217 | |
| 218 | debug_exit(); |
| 219 | return ret; |
| 220 | } |
| 221 | |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 222 | static void comphy_utmi_power_down(u32 utmi_index, void __iomem *utmi_base_addr, |
| 223 | void __iomem *usb_cfg_addr, |
| 224 | void __iomem *utmi_cfg_addr, |
| 225 | u32 utmi_phy_port) |
| 226 | { |
| 227 | u32 mask, data; |
| 228 | |
| 229 | debug_enter(); |
| 230 | debug("stage: UTMI %d - Power down transceiver (power down Phy), Power down PLL, and SuspendDM\n", |
| 231 | utmi_index); |
| 232 | /* Power down UTMI PHY */ |
| 233 | reg_set(utmi_cfg_addr, 0x0 << UTMI_PHY_CFG_PU_OFFSET, |
| 234 | UTMI_PHY_CFG_PU_MASK); |
| 235 | |
| 236 | /* |
| 237 | * If UTMI connected to USB Device, configure mux prior to PHY init |
| 238 | * (Device can be connected to UTMI0 or to UTMI1) |
| 239 | */ |
Stefan Roese | b781f57 | 2017-04-24 18:45:23 +0300 | [diff] [blame] | 240 | if (utmi_phy_port == UTMI_PHY_TO_USB3_DEVICE0) { |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 241 | debug("stage: UTMI %d - Enable Device mode and configure UTMI mux\n", |
| 242 | utmi_index); |
| 243 | /* USB3 Device UTMI enable */ |
| 244 | mask = UTMI_USB_CFG_DEVICE_EN_MASK; |
| 245 | data = 0x1 << UTMI_USB_CFG_DEVICE_EN_OFFSET; |
| 246 | /* USB3 Device UTMI MUX */ |
| 247 | mask |= UTMI_USB_CFG_DEVICE_MUX_MASK; |
| 248 | data |= utmi_index << UTMI_USB_CFG_DEVICE_MUX_OFFSET; |
| 249 | reg_set(usb_cfg_addr, data, mask); |
| 250 | } |
| 251 | |
| 252 | /* Set Test suspendm mode */ |
| 253 | mask = UTMI_CTRL_STATUS0_SUSPENDM_MASK; |
| 254 | data = 0x1 << UTMI_CTRL_STATUS0_SUSPENDM_OFFSET; |
| 255 | /* Enable Test UTMI select */ |
| 256 | mask |= UTMI_CTRL_STATUS0_TEST_SEL_MASK; |
| 257 | data |= 0x1 << UTMI_CTRL_STATUS0_TEST_SEL_OFFSET; |
| 258 | reg_set(utmi_base_addr + UTMI_CTRL_STATUS0_REG, data, mask); |
| 259 | |
| 260 | /* Wait for UTMI power down */ |
| 261 | mdelay(1); |
| 262 | |
| 263 | debug_exit(); |
| 264 | return; |
| 265 | } |
| 266 | |
| 267 | static void comphy_utmi_phy_config(u32 utmi_index, void __iomem *utmi_base_addr, |
| 268 | void __iomem *usb_cfg_addr, |
| 269 | void __iomem *utmi_cfg_addr, |
| 270 | u32 utmi_phy_port) |
| 271 | { |
| 272 | u32 mask, data; |
| 273 | |
| 274 | debug_exit(); |
| 275 | debug("stage: Configure UTMI PHY %d registers\n", utmi_index); |
| 276 | /* Reference Clock Divider Select */ |
| 277 | mask = UTMI_PLL_CTRL_REFDIV_MASK; |
| 278 | data = 0x5 << UTMI_PLL_CTRL_REFDIV_OFFSET; |
| 279 | /* Feedback Clock Divider Select - 90 for 25Mhz*/ |
| 280 | mask |= UTMI_PLL_CTRL_FBDIV_MASK; |
| 281 | data |= 0x60 << UTMI_PLL_CTRL_FBDIV_OFFSET; |
| 282 | /* Select LPFR - 0x0 for 25Mhz/5=5Mhz*/ |
| 283 | mask |= UTMI_PLL_CTRL_SEL_LPFR_MASK; |
| 284 | data |= 0x0 << UTMI_PLL_CTRL_SEL_LPFR_OFFSET; |
| 285 | reg_set(utmi_base_addr + UTMI_PLL_CTRL_REG, data, mask); |
| 286 | |
| 287 | /* Impedance Calibration Threshold Setting */ |
| 288 | reg_set(utmi_base_addr + UTMI_CALIB_CTRL_REG, |
Igal Liberman | 32af216 | 2017-04-30 20:16:55 +0300 | [diff] [blame] | 289 | 0x7 << UTMI_CALIB_CTRL_IMPCAL_VTH_OFFSET, |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 290 | UTMI_CALIB_CTRL_IMPCAL_VTH_MASK); |
| 291 | |
| 292 | /* Set LS TX driver strength coarse control */ |
Igal Liberman | 32af216 | 2017-04-30 20:16:55 +0300 | [diff] [blame] | 293 | mask = UTMI_TX_CH_CTRL_AMP_MASK; |
| 294 | data = 0x4 << UTMI_TX_CH_CTRL_AMP_OFFSET; |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 295 | reg_set(utmi_base_addr + UTMI_TX_CH_CTRL_REG, data, mask); |
| 296 | |
| 297 | /* Enable SQ */ |
| 298 | mask = UTMI_RX_CH_CTRL0_SQ_DET_MASK; |
| 299 | data = 0x0 << UTMI_RX_CH_CTRL0_SQ_DET_OFFSET; |
| 300 | /* Enable analog squelch detect */ |
| 301 | mask |= UTMI_RX_CH_CTRL0_SQ_ANA_DTC_MASK; |
| 302 | data |= 0x1 << UTMI_RX_CH_CTRL0_SQ_ANA_DTC_OFFSET; |
| 303 | reg_set(utmi_base_addr + UTMI_RX_CH_CTRL0_REG, data, mask); |
| 304 | |
| 305 | /* Set External squelch calibration number */ |
| 306 | mask = UTMI_RX_CH_CTRL1_SQ_AMP_CAL_MASK; |
| 307 | data = 0x1 << UTMI_RX_CH_CTRL1_SQ_AMP_CAL_OFFSET; |
| 308 | /* Enable the External squelch calibration */ |
| 309 | mask |= UTMI_RX_CH_CTRL1_SQ_AMP_CAL_EN_MASK; |
| 310 | data |= 0x1 << UTMI_RX_CH_CTRL1_SQ_AMP_CAL_EN_OFFSET; |
| 311 | reg_set(utmi_base_addr + UTMI_RX_CH_CTRL1_REG, data, mask); |
| 312 | |
| 313 | /* Set Control VDAT Reference Voltage - 0.325V */ |
| 314 | mask = UTMI_CHGDTC_CTRL_VDAT_MASK; |
| 315 | data = 0x1 << UTMI_CHGDTC_CTRL_VDAT_OFFSET; |
| 316 | /* Set Control VSRC Reference Voltage - 0.6V */ |
| 317 | mask |= UTMI_CHGDTC_CTRL_VSRC_MASK; |
| 318 | data |= 0x1 << UTMI_CHGDTC_CTRL_VSRC_OFFSET; |
| 319 | reg_set(utmi_base_addr + UTMI_CHGDTC_CTRL_REG, data, mask); |
| 320 | |
| 321 | debug_exit(); |
| 322 | return; |
| 323 | } |
| 324 | |
| 325 | static int comphy_utmi_power_up(u32 utmi_index, void __iomem *utmi_base_addr, |
| 326 | void __iomem *usb_cfg_addr, |
| 327 | void __iomem *utmi_cfg_addr, u32 utmi_phy_port) |
| 328 | { |
| 329 | u32 data, mask, ret = 1; |
| 330 | void __iomem *addr; |
| 331 | |
| 332 | debug_enter(); |
| 333 | debug("stage: UTMI %d - Power up transceiver(Power up Phy), and exit SuspendDM\n", |
| 334 | utmi_index); |
| 335 | /* Power UP UTMI PHY */ |
| 336 | reg_set(utmi_cfg_addr, 0x1 << UTMI_PHY_CFG_PU_OFFSET, |
| 337 | UTMI_PHY_CFG_PU_MASK); |
| 338 | /* Disable Test UTMI select */ |
| 339 | reg_set(utmi_base_addr + UTMI_CTRL_STATUS0_REG, |
| 340 | 0x0 << UTMI_CTRL_STATUS0_TEST_SEL_OFFSET, |
| 341 | UTMI_CTRL_STATUS0_TEST_SEL_MASK); |
| 342 | |
| 343 | debug("stage: Polling for PLL and impedance calibration done, and PLL ready done\n"); |
| 344 | addr = utmi_base_addr + UTMI_CALIB_CTRL_REG; |
| 345 | data = UTMI_CALIB_CTRL_IMPCAL_DONE_MASK; |
| 346 | mask = data; |
| 347 | data = polling_with_timeout(addr, data, mask, 100); |
| 348 | if (data != 0) { |
Masahiro Yamada | 81e1042 | 2017-09-16 14:10:41 +0900 | [diff] [blame] | 349 | pr_err("Impedance calibration is not done\n"); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 350 | debug("Read from reg = %p - value = 0x%x\n", addr, data); |
| 351 | ret = 0; |
| 352 | } |
| 353 | |
| 354 | data = UTMI_CALIB_CTRL_PLLCAL_DONE_MASK; |
| 355 | mask = data; |
| 356 | data = polling_with_timeout(addr, data, mask, 100); |
| 357 | if (data != 0) { |
Masahiro Yamada | 81e1042 | 2017-09-16 14:10:41 +0900 | [diff] [blame] | 358 | pr_err("PLL calibration is not done\n"); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 359 | debug("Read from reg = %p - value = 0x%x\n", addr, data); |
| 360 | ret = 0; |
| 361 | } |
| 362 | |
| 363 | addr = utmi_base_addr + UTMI_PLL_CTRL_REG; |
| 364 | data = UTMI_PLL_CTRL_PLL_RDY_MASK; |
| 365 | mask = data; |
| 366 | data = polling_with_timeout(addr, data, mask, 100); |
| 367 | if (data != 0) { |
Masahiro Yamada | 81e1042 | 2017-09-16 14:10:41 +0900 | [diff] [blame] | 368 | pr_err("PLL is not ready\n"); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 369 | debug("Read from reg = %p - value = 0x%x\n", addr, data); |
| 370 | ret = 0; |
| 371 | } |
| 372 | |
| 373 | if (ret) |
| 374 | debug("Passed\n"); |
| 375 | else |
| 376 | debug("\n"); |
| 377 | |
| 378 | debug_exit(); |
| 379 | return ret; |
| 380 | } |
| 381 | |
| 382 | /* |
| 383 | * comphy_utmi_phy_init initialize the UTMI PHY |
| 384 | * the init split in 3 parts: |
| 385 | * 1. Power down transceiver and PLL |
| 386 | * 2. UTMI PHY configure |
Omri Itach | 561930c | 2017-04-06 12:54:16 +0300 | [diff] [blame] | 387 | * 3. Power up transceiver and PLL |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 388 | * Note: - Power down/up should be once for both UTMI PHYs |
| 389 | * - comphy_dedicated_phys_init call this function if at least there is |
| 390 | * one UTMI PHY exists in FDT blob. access to cp110_utmi_data[0] is |
| 391 | * legal |
| 392 | */ |
| 393 | static void comphy_utmi_phy_init(u32 utmi_phy_count, |
| 394 | struct utmi_phy_data *cp110_utmi_data) |
| 395 | { |
| 396 | u32 i; |
| 397 | |
| 398 | debug_enter(); |
| 399 | /* UTMI Power down */ |
| 400 | for (i = 0; i < utmi_phy_count; i++) { |
| 401 | comphy_utmi_power_down(i, cp110_utmi_data[i].utmi_base_addr, |
| 402 | cp110_utmi_data[i].usb_cfg_addr, |
| 403 | cp110_utmi_data[i].utmi_cfg_addr, |
| 404 | cp110_utmi_data[i].utmi_phy_port); |
| 405 | } |
| 406 | /* PLL Power down */ |
| 407 | debug("stage: UTMI PHY power down PLL\n"); |
| 408 | for (i = 0; i < utmi_phy_count; i++) { |
| 409 | reg_set(cp110_utmi_data[i].usb_cfg_addr, |
| 410 | 0x0 << UTMI_USB_CFG_PLL_OFFSET, UTMI_USB_CFG_PLL_MASK); |
| 411 | } |
| 412 | /* UTMI configure */ |
| 413 | for (i = 0; i < utmi_phy_count; i++) { |
| 414 | comphy_utmi_phy_config(i, cp110_utmi_data[i].utmi_base_addr, |
| 415 | cp110_utmi_data[i].usb_cfg_addr, |
| 416 | cp110_utmi_data[i].utmi_cfg_addr, |
| 417 | cp110_utmi_data[i].utmi_phy_port); |
| 418 | } |
| 419 | /* UTMI Power up */ |
| 420 | for (i = 0; i < utmi_phy_count; i++) { |
| 421 | if (!comphy_utmi_power_up(i, cp110_utmi_data[i].utmi_base_addr, |
| 422 | cp110_utmi_data[i].usb_cfg_addr, |
| 423 | cp110_utmi_data[i].utmi_cfg_addr, |
| 424 | cp110_utmi_data[i].utmi_phy_port)) { |
Masahiro Yamada | 81e1042 | 2017-09-16 14:10:41 +0900 | [diff] [blame] | 425 | pr_err("Failed to initialize UTMI PHY %d\n", i); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 426 | continue; |
| 427 | } |
| 428 | printf("UTMI PHY %d initialized to ", i); |
Stefan Roese | b781f57 | 2017-04-24 18:45:23 +0300 | [diff] [blame] | 429 | if (cp110_utmi_data[i].utmi_phy_port == |
| 430 | UTMI_PHY_TO_USB3_DEVICE0) |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 431 | printf("USB Device\n"); |
| 432 | else |
| 433 | printf("USB Host%d\n", |
| 434 | cp110_utmi_data[i].utmi_phy_port); |
| 435 | } |
| 436 | /* PLL Power up */ |
| 437 | debug("stage: UTMI PHY power up PLL\n"); |
| 438 | for (i = 0; i < utmi_phy_count; i++) { |
| 439 | reg_set(cp110_utmi_data[i].usb_cfg_addr, |
| 440 | 0x1 << UTMI_USB_CFG_PLL_OFFSET, UTMI_USB_CFG_PLL_MASK); |
| 441 | } |
| 442 | |
| 443 | debug_exit(); |
| 444 | return; |
| 445 | } |
| 446 | |
| 447 | /* |
| 448 | * comphy_dedicated_phys_init initialize the dedicated PHYs |
| 449 | * - not muxed SerDes lanes e.g. UTMI PHY |
| 450 | */ |
| 451 | void comphy_dedicated_phys_init(void) |
| 452 | { |
| 453 | struct utmi_phy_data cp110_utmi_data[MAX_UTMI_PHY_COUNT]; |
Omri Itach | 561930c | 2017-04-06 12:54:16 +0300 | [diff] [blame] | 454 | int node = -1; |
| 455 | int node_idx; |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 456 | |
| 457 | debug_enter(); |
| 458 | debug("Initialize USB UTMI PHYs\n"); |
| 459 | |
Omri Itach | 561930c | 2017-04-06 12:54:16 +0300 | [diff] [blame] | 460 | for (node_idx = 0; node_idx < MAX_UTMI_PHY_COUNT;) { |
| 461 | /* Find the UTMI phy node in device tree */ |
| 462 | node = fdt_node_offset_by_compatible(gd->fdt_blob, node, |
| 463 | "marvell,mvebu-utmi-2.6.0"); |
| 464 | if (node <= 0) |
| 465 | break; |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 466 | |
Omri Itach | 561930c | 2017-04-06 12:54:16 +0300 | [diff] [blame] | 467 | /* check if node is enabled */ |
| 468 | if (!fdtdec_get_is_enabled(gd->fdt_blob, node)) |
| 469 | continue; |
| 470 | |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 471 | /* get base address of UTMI phy */ |
Omri Itach | 561930c | 2017-04-06 12:54:16 +0300 | [diff] [blame] | 472 | cp110_utmi_data[node_idx].utmi_base_addr = |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 473 | (void __iomem *)fdtdec_get_addr_size_auto_noparent( |
| 474 | gd->fdt_blob, node, "reg", 0, NULL, true); |
Omri Itach | 561930c | 2017-04-06 12:54:16 +0300 | [diff] [blame] | 475 | if (!cp110_utmi_data[node_idx].utmi_base_addr) { |
Masahiro Yamada | 81e1042 | 2017-09-16 14:10:41 +0900 | [diff] [blame] | 476 | pr_err("UTMI PHY base address is invalid\n"); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 477 | continue; |
| 478 | } |
| 479 | |
| 480 | /* get usb config address */ |
Omri Itach | 561930c | 2017-04-06 12:54:16 +0300 | [diff] [blame] | 481 | cp110_utmi_data[node_idx].usb_cfg_addr = |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 482 | (void __iomem *)fdtdec_get_addr_size_auto_noparent( |
| 483 | gd->fdt_blob, node, "reg", 1, NULL, true); |
Omri Itach | 561930c | 2017-04-06 12:54:16 +0300 | [diff] [blame] | 484 | if (!cp110_utmi_data[node_idx].usb_cfg_addr) { |
Masahiro Yamada | 81e1042 | 2017-09-16 14:10:41 +0900 | [diff] [blame] | 485 | pr_err("UTMI PHY base address is invalid\n"); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 486 | continue; |
| 487 | } |
| 488 | |
| 489 | /* get UTMI config address */ |
Omri Itach | 561930c | 2017-04-06 12:54:16 +0300 | [diff] [blame] | 490 | cp110_utmi_data[node_idx].utmi_cfg_addr = |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 491 | (void __iomem *)fdtdec_get_addr_size_auto_noparent( |
| 492 | gd->fdt_blob, node, "reg", 2, NULL, true); |
Omri Itach | 561930c | 2017-04-06 12:54:16 +0300 | [diff] [blame] | 493 | if (!cp110_utmi_data[node_idx].utmi_cfg_addr) { |
Masahiro Yamada | 81e1042 | 2017-09-16 14:10:41 +0900 | [diff] [blame] | 494 | pr_err("UTMI PHY base address is invalid\n"); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 495 | continue; |
| 496 | } |
| 497 | |
| 498 | /* |
| 499 | * get the port number (to check if the utmi connected to |
| 500 | * host/device) |
| 501 | */ |
Omri Itach | 561930c | 2017-04-06 12:54:16 +0300 | [diff] [blame] | 502 | cp110_utmi_data[node_idx].utmi_phy_port = fdtdec_get_int( |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 503 | gd->fdt_blob, node, "utmi-port", UTMI_PHY_INVALID); |
Omri Itach | 561930c | 2017-04-06 12:54:16 +0300 | [diff] [blame] | 504 | if (cp110_utmi_data[node_idx].utmi_phy_port == |
| 505 | UTMI_PHY_INVALID) { |
Masahiro Yamada | 81e1042 | 2017-09-16 14:10:41 +0900 | [diff] [blame] | 506 | pr_err("UTMI PHY port type is invalid\n"); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 507 | continue; |
| 508 | } |
| 509 | |
Omri Itach | 561930c | 2017-04-06 12:54:16 +0300 | [diff] [blame] | 510 | /* count valid UTMI unit */ |
| 511 | node_idx++; |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 512 | } |
| 513 | |
Omri Itach | 561930c | 2017-04-06 12:54:16 +0300 | [diff] [blame] | 514 | if (node_idx > 0) |
| 515 | comphy_utmi_phy_init(node_idx, cp110_utmi_data); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 516 | |
| 517 | debug_exit(); |
| 518 | } |
| 519 | |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 520 | int comphy_cp110_init(struct chip_serdes_phy_config *ptr_chip_cfg, |
| 521 | struct comphy_map *serdes_map) |
| 522 | { |
| 523 | struct comphy_map *ptr_comphy_map; |
| 524 | void __iomem *comphy_base_addr, *hpipe_base_addr; |
Igal Liberman | d009fee | 2018-05-09 18:50:29 +0300 | [diff] [blame] | 525 | u32 comphy_max_count, lane, id, ret = 0; |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 526 | u32 pcie_width = 0; |
Grzegorz Jaszczyk | 7928a8e | 2020-10-18 17:11:11 +0300 | [diff] [blame] | 527 | u32 mode; |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 528 | |
| 529 | debug_enter(); |
| 530 | |
| 531 | comphy_max_count = ptr_chip_cfg->comphy_lanes_count; |
| 532 | comphy_base_addr = ptr_chip_cfg->comphy_base_addr; |
| 533 | hpipe_base_addr = ptr_chip_cfg->hpipe3_base_addr; |
| 534 | |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 535 | /* Check if the first 4 lanes configured as By-4 */ |
| 536 | for (lane = 0, ptr_comphy_map = serdes_map; lane < 4; |
| 537 | lane++, ptr_comphy_map++) { |
Igal Liberman | ffd5d2f | 2017-04-26 15:40:00 +0300 | [diff] [blame] | 538 | if (ptr_comphy_map->type != COMPHY_TYPE_PEX0) |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 539 | break; |
| 540 | pcie_width++; |
| 541 | } |
| 542 | |
| 543 | for (lane = 0, ptr_comphy_map = serdes_map; lane < comphy_max_count; |
| 544 | lane++, ptr_comphy_map++) { |
| 545 | debug("Initialize serdes number %d\n", lane); |
| 546 | debug("Serdes type = 0x%x\n", ptr_comphy_map->type); |
| 547 | if (lane == 4) { |
| 548 | /* |
| 549 | * PCIe lanes above the first 4 lanes, can be only |
| 550 | * by1 |
| 551 | */ |
| 552 | pcie_width = 1; |
| 553 | } |
| 554 | switch (ptr_comphy_map->type) { |
Igal Liberman | ffd5d2f | 2017-04-26 15:40:00 +0300 | [diff] [blame] | 555 | case COMPHY_TYPE_UNCONNECTED: |
Igal Liberman | d622f8e | 2018-11-19 09:58:32 +0200 | [diff] [blame] | 556 | mode = COMPHY_TYPE_UNCONNECTED | COMPHY_CALLER_UBOOT; |
Christine Gharzuzi | c63fa15 | 2018-05-23 12:10:36 +0300 | [diff] [blame] | 557 | ret = comphy_smc(MV_SIP_COMPHY_POWER_OFF, |
| 558 | ptr_chip_cfg->comphy_base_addr, |
Igal Liberman | d622f8e | 2018-11-19 09:58:32 +0200 | [diff] [blame] | 559 | lane, mode); |
Igal Liberman | ffd5d2f | 2017-04-26 15:40:00 +0300 | [diff] [blame] | 560 | case COMPHY_TYPE_IGNORE: |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 561 | continue; |
| 562 | break; |
Igal Liberman | ffd5d2f | 2017-04-26 15:40:00 +0300 | [diff] [blame] | 563 | case COMPHY_TYPE_PEX0: |
| 564 | case COMPHY_TYPE_PEX1: |
| 565 | case COMPHY_TYPE_PEX2: |
| 566 | case COMPHY_TYPE_PEX3: |
Grzegorz Jaszczyk | c42b5a3 | 2020-10-18 17:11:12 +0300 | [diff] [blame] | 567 | mode = COMPHY_FW_PCIE_FORMAT(pcie_width, |
| 568 | ptr_comphy_map->clk_src, |
| 569 | COMPHY_PCIE_MODE, |
| 570 | ptr_comphy_map->speed); |
| 571 | ret = comphy_smc(MV_SIP_COMPHY_POWER_ON, |
| 572 | ptr_chip_cfg->comphy_base_addr, lane, |
| 573 | mode); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 574 | break; |
Igal Liberman | ffd5d2f | 2017-04-26 15:40:00 +0300 | [diff] [blame] | 575 | case COMPHY_TYPE_SATA0: |
| 576 | case COMPHY_TYPE_SATA1: |
Grzegorz Jaszczyk | 7928a8e | 2020-10-18 17:11:11 +0300 | [diff] [blame] | 577 | mode = COMPHY_FW_MODE_FORMAT(COMPHY_SATA_MODE); |
| 578 | ret = comphy_sata_power_up(lane, hpipe_base_addr, |
| 579 | comphy_base_addr, |
| 580 | ptr_chip_cfg->cp_index, |
| 581 | mode); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 582 | break; |
Igal Liberman | ffd5d2f | 2017-04-26 15:40:00 +0300 | [diff] [blame] | 583 | case COMPHY_TYPE_USB3_HOST0: |
| 584 | case COMPHY_TYPE_USB3_HOST1: |
Grzegorz Jaszczyk | e165970 | 2018-03-29 12:30:20 +0200 | [diff] [blame] | 585 | mode = COMPHY_FW_MODE_FORMAT(COMPHY_USB3H_MODE); |
| 586 | ret = comphy_smc(MV_SIP_COMPHY_POWER_ON, |
| 587 | ptr_chip_cfg->comphy_base_addr, lane, |
| 588 | mode); |
| 589 | break; |
Igal Liberman | ffd5d2f | 2017-04-26 15:40:00 +0300 | [diff] [blame] | 590 | case COMPHY_TYPE_USB3_DEVICE: |
Grzegorz Jaszczyk | e165970 | 2018-03-29 12:30:20 +0200 | [diff] [blame] | 591 | mode = COMPHY_FW_MODE_FORMAT(COMPHY_USB3D_MODE); |
| 592 | ret = comphy_smc(MV_SIP_COMPHY_POWER_ON, |
| 593 | ptr_chip_cfg->comphy_base_addr, lane, |
| 594 | mode); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 595 | break; |
Igal Liberman | ffd5d2f | 2017-04-26 15:40:00 +0300 | [diff] [blame] | 596 | case COMPHY_TYPE_SGMII0: |
| 597 | case COMPHY_TYPE_SGMII1: |
Igal Liberman | ffd5d2f | 2017-04-26 15:40:00 +0300 | [diff] [blame] | 598 | case COMPHY_TYPE_SGMII2: |
Igal Liberman | d009fee | 2018-05-09 18:50:29 +0300 | [diff] [blame] | 599 | /* Calculate SGMII ID */ |
| 600 | id = ptr_comphy_map->type - COMPHY_TYPE_SGMII0; |
| 601 | |
Igal Liberman | ffd5d2f | 2017-04-26 15:40:00 +0300 | [diff] [blame] | 602 | if (ptr_comphy_map->speed == COMPHY_SPEED_INVALID) { |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 603 | debug("Warning: SGMII PHY speed in lane %d is invalid, set PHY speed to 1.25G\n", |
| 604 | lane); |
Igal Liberman | ffd5d2f | 2017-04-26 15:40:00 +0300 | [diff] [blame] | 605 | ptr_comphy_map->speed = COMPHY_SPEED_1_25G; |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 606 | } |
Grzegorz Jaszczyk | 7928a8e | 2020-10-18 17:11:11 +0300 | [diff] [blame] | 607 | |
Igal Liberman | d009fee | 2018-05-09 18:50:29 +0300 | [diff] [blame] | 608 | mode = COMPHY_FW_FORMAT(COMPHY_SGMII_MODE, id, |
Grzegorz Jaszczyk | 7928a8e | 2020-10-18 17:11:11 +0300 | [diff] [blame] | 609 | ptr_comphy_map->speed); |
| 610 | ret = comphy_smc(MV_SIP_COMPHY_POWER_ON, |
| 611 | ptr_chip_cfg->comphy_base_addr, lane, |
| 612 | mode); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 613 | break; |
Igal Liberman | ffd5d2f | 2017-04-26 15:40:00 +0300 | [diff] [blame] | 614 | case COMPHY_TYPE_SFI: |
Grzegorz Jaszczyk | 7928a8e | 2020-10-18 17:11:11 +0300 | [diff] [blame] | 615 | mode = COMPHY_FW_FORMAT(COMPHY_SFI_MODE, |
| 616 | COMPHY_UNIT_ID0, |
| 617 | ptr_comphy_map->speed); |
| 618 | ret = comphy_smc(MV_SIP_COMPHY_POWER_ON, |
| 619 | ptr_chip_cfg->comphy_base_addr, lane, |
| 620 | mode); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 621 | break; |
Igal Liberman | ffd5d2f | 2017-04-26 15:40:00 +0300 | [diff] [blame] | 622 | case COMPHY_TYPE_RXAUI0: |
| 623 | case COMPHY_TYPE_RXAUI1: |
Grzegorz Jaszczyk | beb4a91 | 2018-03-27 12:52:24 +0200 | [diff] [blame] | 624 | mode = COMPHY_FW_MODE_FORMAT(COMPHY_RXAUI_MODE); |
| 625 | ret = comphy_smc(MV_SIP_COMPHY_POWER_ON, |
| 626 | ptr_chip_cfg->comphy_base_addr, lane, |
| 627 | mode); |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 628 | break; |
| 629 | default: |
| 630 | debug("Unknown SerDes type, skip initialize SerDes %d\n", |
| 631 | lane); |
| 632 | break; |
| 633 | } |
| 634 | if (ret == 0) { |
| 635 | /* |
Stefan Roese | 4fbca01 | 2017-04-24 18:45:25 +0300 | [diff] [blame] | 636 | * If interface wans't initialized, set the lane to |
Igal Liberman | ffd5d2f | 2017-04-26 15:40:00 +0300 | [diff] [blame] | 637 | * COMPHY_TYPE_UNCONNECTED state. |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 638 | */ |
Igal Liberman | ffd5d2f | 2017-04-26 15:40:00 +0300 | [diff] [blame] | 639 | ptr_comphy_map->type = COMPHY_TYPE_UNCONNECTED; |
Masahiro Yamada | 81e1042 | 2017-09-16 14:10:41 +0900 | [diff] [blame] | 640 | pr_err("PLL is not locked - Failed to initialize lane %d\n", |
Stefan Roese | 648391c | 2016-08-30 16:48:20 +0200 | [diff] [blame] | 641 | lane); |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | debug_exit(); |
| 646 | return 0; |
| 647 | } |