Skip to content

Commit 1132e90

Browse files
Haotien Hsugregkh
authored andcommitted
usb: gadget: tegra-xudc: Add handling for BLCG_COREPLL_PWRDN
The COREPLL_PWRDN bit in the BLCG register must be set when the XUSB device controller is powergated and cleared when it is unpowergated. If this bit is not explicitly controlled, the core PLL may remain in an incorrect power state across suspend/resume or ELPG transitions. Therefore, update the driver to explicitly control this bit during powergate transitions. Fixes: 49db427 ("usb: gadget: Add UDC driver for tegra XUSB device mode controller") Cc: stable <stable@kernel.org> Signed-off-by: Haotien Hsu <haotienh@nvidia.com> Signed-off-by: Wayne Chang <waynec@nvidia.com> Link: https://patch.msgid.link/20260123173121.4093902-1-waynec@nvidia.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8acc379 commit 1132e90

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

drivers/usb/gadget/udc/tegra-xudc.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3392,17 +3392,18 @@ static void tegra_xudc_device_params_init(struct tegra_xudc *xudc)
33923392
{
33933393
u32 val, imod;
33943394

3395+
val = xudc_readl(xudc, BLCG);
33953396
if (xudc->soc->has_ipfs) {
3396-
val = xudc_readl(xudc, BLCG);
33973397
val |= BLCG_ALL;
33983398
val &= ~(BLCG_DFPCI | BLCG_UFPCI | BLCG_FE |
33993399
BLCG_COREPLL_PWRDN);
34003400
val |= BLCG_IOPLL_0_PWRDN;
34013401
val |= BLCG_IOPLL_1_PWRDN;
34023402
val |= BLCG_IOPLL_2_PWRDN;
3403-
3404-
xudc_writel(xudc, val, BLCG);
3403+
} else {
3404+
val &= ~BLCG_COREPLL_PWRDN;
34053405
}
3406+
xudc_writel(xudc, val, BLCG);
34063407

34073408
if (xudc->soc->port_speed_quirk)
34083409
tegra_xudc_limit_port_speed(xudc);
@@ -3953,6 +3954,7 @@ static void tegra_xudc_remove(struct platform_device *pdev)
39533954
static int __maybe_unused tegra_xudc_powergate(struct tegra_xudc *xudc)
39543955
{
39553956
unsigned long flags;
3957+
u32 val;
39563958

39573959
dev_dbg(xudc->dev, "entering ELPG\n");
39583960

@@ -3965,6 +3967,10 @@ static int __maybe_unused tegra_xudc_powergate(struct tegra_xudc *xudc)
39653967

39663968
spin_unlock_irqrestore(&xudc->lock, flags);
39673969

3970+
val = xudc_readl(xudc, BLCG);
3971+
val |= BLCG_COREPLL_PWRDN;
3972+
xudc_writel(xudc, val, BLCG);
3973+
39683974
clk_bulk_disable_unprepare(xudc->soc->num_clks, xudc->clks);
39693975

39703976
regulator_bulk_disable(xudc->soc->num_supplies, xudc->supplies);

0 commit comments

Comments
 (0)