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

phy: ti: am654: add support for USB super-speed

The SERDES PHY can support USB super-speed lane.
Add support for that.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Link: https://lore.kernel.org/r/20200513131254.10497-3-rogerq@ti.com
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

authored by

Roger Quadros and committed by
Kishon Vijay Abraham I
257d0be3 24dcb6a6

+101 -2
+101 -2
drivers/phy/ti/phy-am654-serdes.c
··· 201 201 return 0; 202 202 } 203 203 204 - static int serdes_am654_init(struct phy *x) 204 + #define SERDES_AM654_CFG(offset, a, b, val) \ 205 + regmap_update_bits(phy->regmap, (offset),\ 206 + GENMASK((a), (b)), (val) << (b)) 207 + 208 + static int serdes_am654_usb3_init(struct serdes_am654 *phy) 205 209 { 206 - struct serdes_am654 *phy = phy_get_drvdata(x); 210 + SERDES_AM654_CFG(0x0000, 31, 24, 0x17); 211 + SERDES_AM654_CFG(0x0004, 15, 8, 0x02); 212 + SERDES_AM654_CFG(0x0004, 7, 0, 0x0e); 213 + SERDES_AM654_CFG(0x0008, 23, 16, 0x2e); 214 + SERDES_AM654_CFG(0x0008, 31, 24, 0x2e); 215 + SERDES_AM654_CFG(0x0060, 7, 0, 0x4b); 216 + SERDES_AM654_CFG(0x0060, 15, 8, 0x98); 217 + SERDES_AM654_CFG(0x0060, 23, 16, 0x60); 218 + SERDES_AM654_CFG(0x00d0, 31, 24, 0x45); 219 + SERDES_AM654_CFG(0x00e8, 15, 8, 0x0e); 220 + SERDES_AM654_CFG(0x0220, 7, 0, 0x34); 221 + SERDES_AM654_CFG(0x0220, 15, 8, 0x34); 222 + SERDES_AM654_CFG(0x0220, 31, 24, 0x37); 223 + SERDES_AM654_CFG(0x0224, 7, 0, 0x37); 224 + SERDES_AM654_CFG(0x0224, 15, 8, 0x37); 225 + SERDES_AM654_CFG(0x0228, 23, 16, 0x37); 226 + SERDES_AM654_CFG(0x0228, 31, 24, 0x37); 227 + SERDES_AM654_CFG(0x022c, 7, 0, 0x37); 228 + SERDES_AM654_CFG(0x022c, 15, 8, 0x37); 229 + SERDES_AM654_CFG(0x0230, 15, 8, 0x2a); 230 + SERDES_AM654_CFG(0x0230, 23, 16, 0x2a); 231 + SERDES_AM654_CFG(0x0240, 23, 16, 0x10); 232 + SERDES_AM654_CFG(0x0240, 31, 24, 0x34); 233 + SERDES_AM654_CFG(0x0244, 7, 0, 0x40); 234 + SERDES_AM654_CFG(0x0244, 23, 16, 0x34); 235 + SERDES_AM654_CFG(0x0248, 15, 8, 0x0d); 236 + SERDES_AM654_CFG(0x0258, 15, 8, 0x16); 237 + SERDES_AM654_CFG(0x0258, 23, 16, 0x84); 238 + SERDES_AM654_CFG(0x0258, 31, 24, 0xf2); 239 + SERDES_AM654_CFG(0x025c, 7, 0, 0x21); 240 + SERDES_AM654_CFG(0x0260, 7, 0, 0x27); 241 + SERDES_AM654_CFG(0x0260, 15, 8, 0x04); 242 + SERDES_AM654_CFG(0x0268, 15, 8, 0x04); 243 + SERDES_AM654_CFG(0x0288, 15, 8, 0x2c); 244 + SERDES_AM654_CFG(0x0330, 31, 24, 0xa0); 245 + SERDES_AM654_CFG(0x0338, 23, 16, 0x03); 246 + SERDES_AM654_CFG(0x0338, 31, 24, 0x00); 247 + SERDES_AM654_CFG(0x033c, 7, 0, 0x00); 248 + SERDES_AM654_CFG(0x0344, 31, 24, 0x18); 249 + SERDES_AM654_CFG(0x034c, 7, 0, 0x18); 250 + SERDES_AM654_CFG(0x039c, 23, 16, 0x3b); 251 + SERDES_AM654_CFG(0x0a04, 7, 0, 0x03); 252 + SERDES_AM654_CFG(0x0a14, 31, 24, 0x3c); 253 + SERDES_AM654_CFG(0x0a18, 15, 8, 0x3c); 254 + SERDES_AM654_CFG(0x0a38, 7, 0, 0x3e); 255 + SERDES_AM654_CFG(0x0a38, 15, 8, 0x3e); 256 + SERDES_AM654_CFG(0x0ae0, 7, 0, 0x07); 257 + SERDES_AM654_CFG(0x0b6c, 23, 16, 0xcd); 258 + SERDES_AM654_CFG(0x0b6c, 31, 24, 0x04); 259 + SERDES_AM654_CFG(0x0b98, 23, 16, 0x03); 260 + SERDES_AM654_CFG(0x1400, 7, 0, 0x3f); 261 + SERDES_AM654_CFG(0x1404, 23, 16, 0x6f); 262 + SERDES_AM654_CFG(0x1404, 31, 24, 0x6f); 263 + SERDES_AM654_CFG(0x140c, 7, 0, 0x6f); 264 + SERDES_AM654_CFG(0x140c, 15, 8, 0x6f); 265 + SERDES_AM654_CFG(0x1410, 15, 8, 0x27); 266 + SERDES_AM654_CFG(0x1414, 7, 0, 0x0c); 267 + SERDES_AM654_CFG(0x1414, 23, 16, 0x07); 268 + SERDES_AM654_CFG(0x1418, 23, 16, 0x40); 269 + SERDES_AM654_CFG(0x141c, 7, 0, 0x00); 270 + SERDES_AM654_CFG(0x141c, 15, 8, 0x1f); 271 + SERDES_AM654_CFG(0x1428, 31, 24, 0x08); 272 + SERDES_AM654_CFG(0x1434, 31, 24, 0x00); 273 + SERDES_AM654_CFG(0x1444, 7, 0, 0x94); 274 + SERDES_AM654_CFG(0x1460, 31, 24, 0x7f); 275 + SERDES_AM654_CFG(0x1464, 7, 0, 0x43); 276 + SERDES_AM654_CFG(0x1464, 23, 16, 0x6f); 277 + SERDES_AM654_CFG(0x1464, 31, 24, 0x43); 278 + SERDES_AM654_CFG(0x1484, 23, 16, 0x8f); 279 + SERDES_AM654_CFG(0x1498, 7, 0, 0x4f); 280 + SERDES_AM654_CFG(0x1498, 23, 16, 0x4f); 281 + SERDES_AM654_CFG(0x007c, 31, 24, 0x0d); 282 + SERDES_AM654_CFG(0x0b90, 15, 8, 0x0f); 283 + 284 + return 0; 285 + } 286 + 287 + static int serdes_am654_pcie_init(struct serdes_am654 *phy) 288 + { 207 289 int ret; 208 290 209 291 ret = regmap_field_write(phy->config_version, VERSION); ··· 303 221 return 0; 304 222 } 305 223 224 + static int serdes_am654_init(struct phy *x) 225 + { 226 + struct serdes_am654 *phy = phy_get_drvdata(x); 227 + 228 + switch (phy->type) { 229 + case PHY_TYPE_PCIE: 230 + return serdes_am654_pcie_init(phy); 231 + case PHY_TYPE_USB3: 232 + return serdes_am654_usb3_init(phy); 233 + default: 234 + return -EINVAL; 235 + } 236 + } 237 + 306 238 static int serdes_am654_reset(struct phy *x) 307 239 { 308 240 struct serdes_am654 *phy = phy_get_drvdata(x); 309 241 int ret; 242 + 243 + serdes_am654_disable_pll(phy); 244 + serdes_am654_disable_txrx(phy); 310 245 311 246 ret = regmap_field_write(phy->por_en, 0x1); 312 247 if (ret)