diff options
author | Icenowy Zheng <icenowy@aosc.xyz> | 2016-10-29 00:27:01 +0800 |
---|---|---|
committer | Kishon Vijay Abraham I <kishon@ti.com> | 2016-11-05 13:45:02 +0530 |
commit | 4320f9d4c1831fd4d244a9de8f81bc27ea67699c (patch) | |
tree | 0ee4d75e4ca929aa749e7a216702576a4cebccbe /drivers/phy | |
parent | 232c260982ab0100cbb29055933e45b928252687 (diff) | |
download | linux-4320f9d4c1831fd4d244a9de8f81bc27ea67699c.tar.bz2 |
phy: sun4i: check PMU presence when poking unknown bit of pmu
Allwinner SoC's PHY 0, when used as OTG controller, have no pmu part.
The code that poke some unknown bit of PMU for H3/A64 didn't check
the PHY, and will cause kernel oops when PHY 0 is used.
This patch will check whether the pmu is not NULL before poking.
Fixes: b3e0d141ca9f (phy: sun4i: add support for A64 usb phy)
Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy')
-rw-r--r-- | drivers/phy/phy-sun4i-usb.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c index b9342a2af7b3..fec34f5213c4 100644 --- a/drivers/phy/phy-sun4i-usb.c +++ b/drivers/phy/phy-sun4i-usb.c @@ -264,7 +264,7 @@ static int sun4i_usb_phy_init(struct phy *_phy) return ret; } - if (data->cfg->enable_pmu_unk1) { + if (phy->pmu && data->cfg->enable_pmu_unk1) { val = readl(phy->pmu + REG_PMU_UNK1); writel(val & ~2, phy->pmu + REG_PMU_UNK1); } |