Lines Matching +full:apb +full:- +full:base

1 // SPDX-License-Identifier: GPL-2.0-only
3 * mmp APB clock operation source file
17 /* Common APB clock register bit definitions */
18 #define APBC_APBCLK (1 << 0) /* APB Bus Clock Enable */
26 void __iomem *base; member
42 if (apbc->lock) in clk_apbc_prepare()
43 spin_lock_irqsave(apbc->lock, flags); in clk_apbc_prepare()
45 data = readl_relaxed(apbc->base); in clk_apbc_prepare()
46 if (apbc->flags & APBC_POWER_CTRL) in clk_apbc_prepare()
49 writel_relaxed(data, apbc->base); in clk_apbc_prepare()
51 if (apbc->lock) in clk_apbc_prepare()
52 spin_unlock_irqrestore(apbc->lock, flags); in clk_apbc_prepare()
54 udelay(apbc->delay); in clk_apbc_prepare()
56 if (apbc->lock) in clk_apbc_prepare()
57 spin_lock_irqsave(apbc->lock, flags); in clk_apbc_prepare()
59 data = readl_relaxed(apbc->base); in clk_apbc_prepare()
61 writel_relaxed(data, apbc->base); in clk_apbc_prepare()
63 if (apbc->lock) in clk_apbc_prepare()
64 spin_unlock_irqrestore(apbc->lock, flags); in clk_apbc_prepare()
66 udelay(apbc->delay); in clk_apbc_prepare()
68 if (!(apbc->flags & APBC_NO_BUS_CTRL)) { in clk_apbc_prepare()
69 if (apbc->lock) in clk_apbc_prepare()
70 spin_lock_irqsave(apbc->lock, flags); in clk_apbc_prepare()
72 data = readl_relaxed(apbc->base); in clk_apbc_prepare()
74 writel_relaxed(data, apbc->base); in clk_apbc_prepare()
76 if (apbc->lock) in clk_apbc_prepare()
77 spin_unlock_irqrestore(apbc->lock, flags); in clk_apbc_prepare()
89 if (apbc->lock) in clk_apbc_unprepare()
90 spin_lock_irqsave(apbc->lock, flags); in clk_apbc_unprepare()
92 data = readl_relaxed(apbc->base); in clk_apbc_unprepare()
93 if (apbc->flags & APBC_POWER_CTRL) in clk_apbc_unprepare()
96 writel_relaxed(data, apbc->base); in clk_apbc_unprepare()
98 if (apbc->lock) in clk_apbc_unprepare()
99 spin_unlock_irqrestore(apbc->lock, flags); in clk_apbc_unprepare()
103 if (apbc->lock) in clk_apbc_unprepare()
104 spin_lock_irqsave(apbc->lock, flags); in clk_apbc_unprepare()
106 data = readl_relaxed(apbc->base); in clk_apbc_unprepare()
108 writel_relaxed(data, apbc->base); in clk_apbc_unprepare()
110 if (apbc->lock) in clk_apbc_unprepare()
111 spin_unlock_irqrestore(apbc->lock, flags); in clk_apbc_unprepare()
120 void __iomem *base, unsigned int delay, in mmp_clk_register_apbc() argument
137 apbc->base = base; in mmp_clk_register_apbc()
138 apbc->delay = delay; in mmp_clk_register_apbc()
139 apbc->flags = apbc_flags; in mmp_clk_register_apbc()
140 apbc->lock = lock; in mmp_clk_register_apbc()
141 apbc->hw.init = &init; in mmp_clk_register_apbc()
143 clk = clk_register(NULL, &apbc->hw); in mmp_clk_register_apbc()