gjdwebserver-overlay/sys-kernel/pinephone-sources/files/0103-ccu-sun50i-a64-reparent-clocks-to-lower-speed-oscillator.patch

51 lines
1.4 KiB
Diff

diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
index 149cfde817cb..0399d8714fd0 100644
--- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
+++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
@@ -984,6 +984,8 @@ static int sun50i_a64_ccu_probe(struct p
if (IS_ERR(reg))
return PTR_ERR(reg);
+ platform_set_drvdata(pdev, reg);
+
/* Force the pll-audio variable divider to 3 */
val = readl(reg + SUN50I_A64_PLL_AUDIO_REG);
val &= ~GENMASK(19, 16);
@@ -1031,12 +1031,36 @@ static const struct of_device_id sun50i_
{ }
};
+#define USBPHY_CFG_REG 0x0cc
+
+static int sun50i_a64_ccu_suspend(struct device *dev)
+{
+ void __iomem *reg = dev_get_drvdata(dev);
+
+ writel(readl(reg + USBPHY_CFG_REG) | 0xa00000, reg + USBPHY_CFG_REG);
+
+ return 0;
+}
+
+static int sun50i_a64_ccu_resume(struct device *dev)
+{
+ void __iomem *reg = dev_get_drvdata(dev);
+
+ writel(readl(reg + USBPHY_CFG_REG) & ~0xa00000, reg + USBPHY_CFG_REG);
+
+ return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(sun50i_a64_ccu_pm_ops,
+ sun50i_a64_ccu_suspend, sun50i_a64_ccu_resume);
+
static struct platform_driver sun50i_a64_ccu_driver = {
.probe = sun50i_a64_ccu_probe,
.driver = {
.name = "sun50i-a64-ccu",
.suppress_bind_attrs = true,
.of_match_table = sun50i_a64_ccu_ids,
+ .pm = &sun50i_a64_ccu_pm_ops,
},
};
builtin_platform_driver(sun50i_a64_ccu_driver);