err = devm_add_action_or_reset(base->dev, rockchip_usb_phy_action,
rk_phy); if (err) return err;
rk_phy->phy = devm_phy_create(base->dev, child, &ops); if (IS_ERR(rk_phy->phy)) {
dev_err(base->dev, "failed to create PHY\n"); return PTR_ERR(rk_phy->phy);
}
phy_set_drvdata(rk_phy->phy, rk_phy);
rk_phy->vbus = devm_regulator_get_optional(&rk_phy->phy->dev, "vbus"); if (IS_ERR(rk_phy->vbus)) { if (PTR_ERR(rk_phy->vbus) == -EPROBE_DEFER) return PTR_ERR(rk_phy->vbus);
rk_phy->vbus = NULL;
}
/* * When acting as uart-pipe, just keep clock on otherwise * only power up usb phy when it use, so disable it when init
*/ if (rk_phy->uart_enabled) return clk_prepare_enable(rk_phy->clk); else return rockchip_usb_phy_power(rk_phy, 1);
err_clk_prov: if (!rk_phy->uart_enabled)
clk_unregister(rk_phy->clk480m);
err_clk: if (rk_phy->clk)
clk_put(rk_phy->clk); return err;
}
staticint __init rockchip_init_usb_uart_common(struct regmap *grf, conststruct rockchip_usb_phy_pdata *pdata)
{ int regoffs = pdata->phys[pdata->usb_uart_phy].reg; int ret;
u32 val;
/* * COMMON_ON and DISABLE settings are described in the TRM, * but were not present in the original code. * Also disable the analog phy components to save power.
*/
val = HIWORD_UPDATE(UOC_CON0_COMMON_ON_N
| UOC_CON0_DISABLE
| UOC_CON0_SIDDQ,
UOC_CON0_COMMON_ON_N
| UOC_CON0_DISABLE
| UOC_CON0_SIDDQ);
ret = regmap_write(grf, regoffs + UOC_CON0, val); if (ret) return ret;
val = HIWORD_UPDATE(UOC_CON2_SOFT_CON_SEL,
UOC_CON2_SOFT_CON_SEL);
ret = regmap_write(grf, regoffs + UOC_CON2, val); if (ret) return ret;
val = HIWORD_UPDATE(UOC_CON3_UTMI_OPMODE_NODRIVING
| UOC_CON3_UTMI_XCVRSEELCT_FSTRANSC
| UOC_CON3_UTMI_TERMSEL_FULLSPEED,
UOC_CON3_UTMI_SUSPENDN
| UOC_CON3_UTMI_OPMODE_MASK
| UOC_CON3_UTMI_XCVRSEELCT_MASK
| UOC_CON3_UTMI_TERMSEL_FULLSPEED);
ret = regmap_write(grf, UOC_CON3, val); if (ret) return ret;
/* * Enable the bypass of uart2 data through the otg usb phy. * See description of rk3288-variant for details.
*/ staticint __init rk3188_init_usb_uart(struct regmap *grf, conststruct rockchip_usb_phy_pdata *pdata)
{
u32 val; int ret;
ret = rockchip_init_usb_uart_common(grf, pdata); if (ret) return ret;
val = HIWORD_UPDATE(RK3188_UOC0_CON0_BYPASSSEL
| RK3188_UOC0_CON0_BYPASSDMEN,
RK3188_UOC0_CON0_BYPASSSEL
| RK3188_UOC0_CON0_BYPASSDMEN);
ret = regmap_write(grf, RK3188_UOC0_CON0, val); if (ret) return ret;
/* * Enable the bypass of uart2 data through the otg usb phy. * Original description in the TRM. * 1. Disable the OTG block by setting OTGDISABLE0 to 1’b1. * 2. Disable the pull-up resistance on the D+ line by setting * OPMODE0[1:0] to 2’b01. * 3. To ensure that the XO, Bias, and PLL blocks are powered down in Suspend * mode, set COMMONONN to 1’b1. * 4. Place the USB PHY in Suspend mode by setting SUSPENDM0 to 1’b0. * 5. Set BYPASSSEL0 to 1’b1. * 6. To transmit data, controls BYPASSDMEN0, and BYPASSDMDATA0. * To receive data, monitor FSVPLUS0. * * The actual code in the vendor kernel does some things differently.
*/ staticint __init rk3288_init_usb_uart(struct regmap *grf, conststruct rockchip_usb_phy_pdata *pdata)
{
u32 val; int ret;
ret = rockchip_init_usb_uart_common(grf, pdata); if (ret) return ret;
val = HIWORD_UPDATE(RK3288_UOC0_CON3_BYPASSSEL
| RK3288_UOC0_CON3_BYPASSDMEN,
RK3288_UOC0_CON3_BYPASSSEL
| RK3288_UOC0_CON3_BYPASSDMEN);
ret = regmap_write(grf, RK3288_UOC0_CON3, val); if (ret) return ret;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.