Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: xhci-mtk: add an optional xhci_ck clock

Some SoCs may have an optional clock xhci_ck (125M or 200M), it
usually uses the same PLL as sys_ck, so support it.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Link: https://lore.kernel.org/r/1566542425-20082-2-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Chunfeng Yun and committed by
Greg Kroah-Hartman
b2fcb285 e74e8bbf

+14
+13
drivers/usb/host/xhci-mtk.c
··· 216 216 return PTR_ERR(mtk->sys_clk); 217 217 } 218 218 219 + mtk->xhci_clk = devm_clk_get_optional(dev, "xhci_ck"); 220 + if (IS_ERR(mtk->xhci_clk)) 221 + return PTR_ERR(mtk->xhci_clk); 222 + 219 223 mtk->ref_clk = devm_clk_get_optional(dev, "ref_ck"); 220 224 if (IS_ERR(mtk->ref_clk)) 221 225 return PTR_ERR(mtk->ref_clk); ··· 248 244 goto sys_clk_err; 249 245 } 250 246 247 + ret = clk_prepare_enable(mtk->xhci_clk); 248 + if (ret) { 249 + dev_err(mtk->dev, "failed to enable xhci_clk\n"); 250 + goto xhci_clk_err; 251 + } 252 + 251 253 ret = clk_prepare_enable(mtk->mcu_clk); 252 254 if (ret) { 253 255 dev_err(mtk->dev, "failed to enable mcu_clk\n"); ··· 271 261 dma_clk_err: 272 262 clk_disable_unprepare(mtk->mcu_clk); 273 263 mcu_clk_err: 264 + clk_disable_unprepare(mtk->xhci_clk); 265 + xhci_clk_err: 274 266 clk_disable_unprepare(mtk->sys_clk); 275 267 sys_clk_err: 276 268 clk_disable_unprepare(mtk->ref_clk); ··· 284 272 { 285 273 clk_disable_unprepare(mtk->dma_clk); 286 274 clk_disable_unprepare(mtk->mcu_clk); 275 + clk_disable_unprepare(mtk->xhci_clk); 287 276 clk_disable_unprepare(mtk->sys_clk); 288 277 clk_disable_unprepare(mtk->ref_clk); 289 278 }
+1
drivers/usb/host/xhci-mtk.h
··· 139 139 struct regulator *vusb33; 140 140 struct regulator *vbus; 141 141 struct clk *sys_clk; /* sys and mac clock */ 142 + struct clk *xhci_clk; 142 143 struct clk *ref_clk; 143 144 struct clk *mcu_clk; 144 145 struct clk *dma_clk;