Skip to content

Commit 71d8254

Browse files
lkundrakbebarino
authored andcommitted
clk: mmp2: Add the I2S clocks
A pair of fractional clock sources for PLLs and gates. Signed-off-by: Lubomir Rintel <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 2766c19 commit 71d8254

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

drivers/clk/mmp/clk-of-mmp2.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@
6767
#define MPMU_POSR 0x10
6868
#define MPMU_UART_PLL 0x14
6969
#define MPMU_PLL2_CR 0x34
70+
#define MPMU_I2S0_PLL 0x40
71+
#define MPMU_I2S1_PLL 0x44
72+
#define MPMU_ACGR 0x1024
7073
/* MMP3 specific below */
7174
#define MPMU_PLL3_CR 0x50
7275
#define MPMU_PLL3_CTRL1 0x58
@@ -91,6 +94,7 @@ static struct mmp_param_fixed_rate_clk fixed_rate_clks[] = {
9194
{MMP2_CLK_CLK32, "clk32", NULL, 0, 32768},
9295
{MMP2_CLK_VCTCXO, "vctcxo", NULL, 0, 26000000},
9396
{MMP2_CLK_USB_PLL, "usb_pll", NULL, 0, 480000000},
97+
{0, "i2s_pll", NULL, 0, 99666667},
9498
};
9599

96100
static struct mmp_param_pll_clk pll_clks[] = {
@@ -139,6 +143,34 @@ static struct mmp_clk_factor_tbl uart_factor_tbl[] = {
139143
{.num = 3521, .den = 689}, /*19.23MHZ */
140144
};
141145

146+
static struct mmp_clk_factor_masks i2s_factor_masks = {
147+
.factor = 2,
148+
.num_mask = 0x7fff,
149+
.den_mask = 0x1fff,
150+
.num_shift = 0,
151+
.den_shift = 15,
152+
.enable_mask = 0xd0000000,
153+
};
154+
155+
static struct mmp_clk_factor_tbl i2s_factor_tbl[] = {
156+
{.num = 24868, .den = 511}, /* 2.0480 MHz */
157+
{.num = 28003, .den = 793}, /* 2.8224 MHz */
158+
{.num = 24941, .den = 1025}, /* 4.0960 MHz */
159+
{.num = 28003, .den = 1586}, /* 5.6448 MHz */
160+
{.num = 31158, .den = 2561}, /* 8.1920 MHz */
161+
{.num = 16288, .den = 1845}, /* 11.2896 MHz */
162+
{.num = 20772, .den = 2561}, /* 12.2880 MHz */
163+
{.num = 8144, .den = 1845}, /* 22.5792 MHz */
164+
{.num = 10386, .den = 2561}, /* 24.5760 MHz */
165+
};
166+
167+
static DEFINE_SPINLOCK(acgr_lock);
168+
169+
static struct mmp_param_gate_clk mpmu_gate_clks[] = {
170+
{MMP2_CLK_I2S0, "i2s0_clk", "i2s0_pll", CLK_SET_RATE_PARENT, MPMU_ACGR, 0x200000, 0x200000, 0x0, 0, &acgr_lock},
171+
{MMP2_CLK_I2S1, "i2s1_clk", "i2s1_pll", CLK_SET_RATE_PARENT, MPMU_ACGR, 0x100000, 0x100000, 0x0, 0, &acgr_lock},
172+
};
173+
142174
static void mmp2_main_clk_init(struct mmp2_clk_unit *pxa_unit)
143175
{
144176
struct clk *clk;
@@ -166,6 +198,20 @@ static void mmp2_main_clk_init(struct mmp2_clk_unit *pxa_unit)
166198
&uart_factor_masks, uart_factor_tbl,
167199
ARRAY_SIZE(uart_factor_tbl), NULL);
168200
mmp_clk_add(unit, MMP2_CLK_UART_PLL, clk);
201+
202+
mmp_clk_register_factor("i2s0_pll", "pll1_4",
203+
CLK_SET_RATE_PARENT,
204+
pxa_unit->mpmu_base + MPMU_I2S0_PLL,
205+
&i2s_factor_masks, i2s_factor_tbl,
206+
ARRAY_SIZE(i2s_factor_tbl), NULL);
207+
mmp_clk_register_factor("i2s1_pll", "pll1_4",
208+
CLK_SET_RATE_PARENT,
209+
pxa_unit->mpmu_base + MPMU_I2S1_PLL,
210+
&i2s_factor_masks, i2s_factor_tbl,
211+
ARRAY_SIZE(i2s_factor_tbl), NULL);
212+
213+
mmp_register_gate_clks(unit, mpmu_gate_clks, pxa_unit->mpmu_base,
214+
ARRAY_SIZE(mpmu_gate_clks));
169215
}
170216

171217
static DEFINE_SPINLOCK(uart0_lock);

0 commit comments

Comments
 (0)