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

phy: phy-rockchip-inno-usb2: Add RK3128 support

Add registers to support the 2-port usb2 phy found in RK312x SoC familiy.

Signed-off-by: Alex Bee <knaerzche@gmail.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20231119121340.109025-3-knaerzche@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Alex Bee and committed by
Vinod Koul
62ff4101 2fda5909

+57
+57
drivers/phy/rockchip/phy-rockchip-inno-usb2.c
··· 1487 1487 return ret; 1488 1488 } 1489 1489 1490 + static int rk3128_usb2phy_tuning(struct rockchip_usb2phy *rphy) 1491 + { 1492 + /* Turn off differential receiver in suspend mode */ 1493 + return regmap_write_bits(rphy->grf, 0x298, 1494 + BIT(2) << BIT_WRITEABLE_SHIFT | BIT(2), 1495 + BIT(2) << BIT_WRITEABLE_SHIFT | 0); 1496 + } 1497 + 1490 1498 static int rk3588_usb2phy_tuning(struct rockchip_usb2phy *rphy) 1491 1499 { 1492 1500 int ret; ··· 1543 1535 1544 1536 return ret; 1545 1537 } 1538 + 1539 + static const struct rockchip_usb2phy_cfg rk3128_phy_cfgs[] = { 1540 + { 1541 + .reg = 0x17c, 1542 + .num_ports = 2, 1543 + .phy_tuning = rk3128_usb2phy_tuning, 1544 + .clkout_ctl = { 0x0190, 15, 15, 1, 0 }, 1545 + .port_cfgs = { 1546 + [USB2PHY_PORT_OTG] = { 1547 + .phy_sus = { 0x017c, 8, 0, 0, 0x1d1 }, 1548 + .bvalid_det_en = { 0x017c, 14, 14, 0, 1 }, 1549 + .bvalid_det_st = { 0x017c, 15, 15, 0, 1 }, 1550 + .bvalid_det_clr = { 0x017c, 15, 15, 0, 1 }, 1551 + .idfall_det_en = { 0x01a0, 2, 2, 0, 1 }, 1552 + .idfall_det_st = { 0x01a0, 3, 3, 0, 1 }, 1553 + .idfall_det_clr = { 0x01a0, 3, 3, 0, 1 }, 1554 + .idrise_det_en = { 0x01a0, 0, 0, 0, 1 }, 1555 + .idrise_det_st = { 0x01a0, 1, 1, 0, 1 }, 1556 + .idrise_det_clr = { 0x01a0, 1, 1, 0, 1 }, 1557 + .ls_det_en = { 0x017c, 12, 12, 0, 1 }, 1558 + .ls_det_st = { 0x017c, 13, 13, 0, 1 }, 1559 + .ls_det_clr = { 0x017c, 13, 13, 0, 1 }, 1560 + .utmi_bvalid = { 0x014c, 5, 5, 0, 1 }, 1561 + .utmi_id = { 0x014c, 8, 8, 0, 1 }, 1562 + .utmi_ls = { 0x014c, 7, 6, 0, 1 }, 1563 + }, 1564 + [USB2PHY_PORT_HOST] = { 1565 + .phy_sus = { 0x0194, 8, 0, 0, 0x1d1 }, 1566 + .ls_det_en = { 0x0194, 14, 14, 0, 1 }, 1567 + .ls_det_st = { 0x0194, 15, 15, 0, 1 }, 1568 + .ls_det_clr = { 0x0194, 15, 15, 0, 1 } 1569 + } 1570 + }, 1571 + .chg_det = { 1572 + .opmode = { 0x017c, 3, 0, 5, 1 }, 1573 + .cp_det = { 0x02c0, 6, 6, 0, 1 }, 1574 + .dcp_det = { 0x02c0, 5, 5, 0, 1 }, 1575 + .dp_det = { 0x02c0, 7, 7, 0, 1 }, 1576 + .idm_sink_en = { 0x0184, 8, 8, 0, 1 }, 1577 + .idp_sink_en = { 0x0184, 7, 7, 0, 1 }, 1578 + .idp_src_en = { 0x0184, 9, 9, 0, 1 }, 1579 + .rdm_pdwn_en = { 0x0184, 10, 10, 0, 1 }, 1580 + .vdm_src_en = { 0x0184, 12, 12, 0, 1 }, 1581 + .vdp_src_en = { 0x0184, 11, 11, 0, 1 }, 1582 + }, 1583 + }, 1584 + { /* sentinel */ } 1585 + }; 1546 1586 1547 1587 static const struct rockchip_usb2phy_cfg rk3228_phy_cfgs[] = { 1548 1588 { ··· 2087 2031 2088 2032 static const struct of_device_id rockchip_usb2phy_dt_match[] = { 2089 2033 { .compatible = "rockchip,px30-usb2phy", .data = &rk3328_phy_cfgs }, 2034 + { .compatible = "rockchip,rk3128-usb2phy", .data = &rk3128_phy_cfgs }, 2090 2035 { .compatible = "rockchip,rk3228-usb2phy", .data = &rk3228_phy_cfgs }, 2091 2036 { .compatible = "rockchip,rk3308-usb2phy", .data = &rk3308_phy_cfgs }, 2092 2037 { .compatible = "rockchip,rk3328-usb2phy", .data = &rk3328_phy_cfgs },