phy: rockchip: inno-usb2: support rk3308bs tuning

Tuning pre-emphasis and other properties for RK3308BS SoCs.

Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Change-Id: If7bb89c04a487c54bcca81d2cdaa9ee9bb26533f
This commit is contained in:
Frank Wang
2022-05-16 15:06:25 +08:00
committed by Tao Huang
parent aa9b5f923d
commit 6f8289384d

View File

@@ -26,6 +26,7 @@
#include <linux/power_supply.h>
#include <linux/regmap.h>
#include <linux/reset.h>
#include <linux/rockchip/cpu.h>
#include <linux/mfd/syscon.h>
#include <linux/usb/of.h>
#include <linux/usb/otg.h>
@@ -2425,20 +2426,55 @@ static int rk3308_usb2phy_tuning(struct rockchip_usb2phy *rphy)
{
int ret;
/* Open pre-emphasize in non-chirp state for otg port */
ret = regmap_write(rphy->grf, 0x0, 0x00070004);
if (ret)
return ret;
if (soc_is_rk3308bs()) {
/* Turn off differential receiver in suspend mode */
ret = regmap_update_bits(rphy->grf, 0x30, BIT(2), 0);
if (ret)
return ret;
/* Open pre-emphasize in non-chirp state for host port */
ret = regmap_write(rphy->grf, 0x30, 0x00070004);
if (ret)
return ret;
/* Enable otg port pre-emphasis during non-chirp phase */
ret = regmap_update_bits(rphy->grf, 0, GENMASK(2, 0), BIT(2));
if (ret)
return ret;
/* Turn off differential receiver in suspend mode */
ret = regmap_write(rphy->grf, 0x18, 0x00040000);
if (ret)
return ret;
/* Set otg port squelch trigger point configure to 100mv */
ret = regmap_update_bits(rphy->grf, 0x004, GENMASK(7, 5), 0x40);
if (ret)
return ret;
ret = regmap_update_bits(rphy->grf, 0x008, BIT(0), 0x1);
if (ret)
return ret;
/* Enable host port pre-emphasis during non-chirp phase */
ret = regmap_update_bits(rphy->grf, 0x400, GENMASK(2, 0), BIT(2));
if (ret)
return ret;
/* Set host port squelch trigger point configure to 100mv */
ret = regmap_update_bits(rphy->grf, 0x404, GENMASK(7, 5), 0x40);
if (ret)
return ret;
ret = regmap_update_bits(rphy->grf, 0x408, BIT(0), 0x1);
if (ret)
return ret;
} else {
/* Open pre-emphasize in non-chirp state for otg port */
ret = regmap_write(rphy->grf, 0x0, 0x00070004);
if (ret)
return ret;
/* Open pre-emphasize in non-chirp state for host port */
ret = regmap_write(rphy->grf, 0x30, 0x00070004);
if (ret)
return ret;
/* Turn off differential receiver in suspend mode */
ret = regmap_write(rphy->grf, 0x18, 0x00040000);
if (ret)
return ret;
}
return 0;
}