Skip to content

Commit bfa851b

Browse files
lkundrakbebarino
authored andcommitted
clk: mmp2: add the GPU clocks
MMP2 has a single GC860 core while MMP3 has a GC2000 and a GC300. On both platforms there's an AXI bus interface clock that's common for all GPUs and each GPU core has a separate clock. Meaning of the relevant APMU_GPU bits were gotten from James Cameron's message and [1], the OLPC OS kernel source [2] and Marvell's MMP3 tree. [1] http://lists.laptop.org/pipermail/devel/2019-April/039053.html [2] http://dev.laptop.org/git/olpc-kernel/commit/arch/arm/mach-mmp/mmp2.c?h=arm-3.0-wip&id=8ce9f6122 Signed-off-by: Lubomir Rintel <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent e314222 commit bfa851b

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

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

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#define APMU_CCIC1 0xf4
5757
#define APMU_USBHSIC0 0xf8
5858
#define APMU_USBHSIC1 0xfc
59+
#define APMU_GPU 0xcc
5960

6061
#define MPMU_FCCR 0x8
6162
#define MPMU_POSR 0x10
@@ -245,6 +246,14 @@ static DEFINE_SPINLOCK(ccic0_lock);
245246
static DEFINE_SPINLOCK(ccic1_lock);
246247
static const char * const ccic_parent_names[] = {"pll1_2", "pll1_16", "vctcxo"};
247248

249+
static DEFINE_SPINLOCK(gpu_lock);
250+
static const char * const mmp2_gpu_gc_parent_names[] = {"pll1_2", "pll1_3", "pll2_2", "pll2_3", "pll2", "usb_pll"};
251+
static u32 mmp2_gpu_gc_parent_table[] = { 0x0000, 0x0040, 0x0080, 0x00c0, 0x1000, 0x1040 };
252+
static const char * const mmp2_gpu_bus_parent_names[] = {"pll1_4", "pll2", "pll2_2", "usb_pll"};
253+
static u32 mmp2_gpu_bus_parent_table[] = { 0x0000, 0x0020, 0x0030, 0x4020 };
254+
static const char * const mmp3_gpu_bus_parent_names[] = {"pll1_4", "pll1_6", "pll1_2", "pll2_2"};
255+
static const char * const mmp3_gpu_gc_parent_names[] = {"pll1", "pll2", "pll1_p", "pll2_p"};
256+
248257
static struct mmp_clk_mix_config ccic0_mix_config = {
249258
.reg_info = DEFINE_MIX_REG_INFO(4, 17, 2, 6, 32),
250259
};
@@ -257,6 +266,15 @@ static struct mmp_param_mux_clk apmu_mux_clks[] = {
257266
{MMP2_CLK_DISP1_MUX, "disp1_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP1, 6, 2, 0, &disp1_lock},
258267
};
259268

269+
static struct mmp_param_mux_clk mmp3_apmu_mux_clks[] = {
270+
{0, "gpu_bus_mux", mmp3_gpu_bus_parent_names, ARRAY_SIZE(mmp3_gpu_bus_parent_names),
271+
CLK_SET_RATE_PARENT, APMU_GPU, 4, 2, 0, &gpu_lock},
272+
{0, "gpu_3d_mux", mmp3_gpu_gc_parent_names, ARRAY_SIZE(mmp3_gpu_gc_parent_names),
273+
CLK_SET_RATE_PARENT, APMU_GPU, 6, 2, 0, &gpu_lock},
274+
{0, "gpu_2d_mux", mmp3_gpu_gc_parent_names, ARRAY_SIZE(mmp3_gpu_gc_parent_names),
275+
CLK_SET_RATE_PARENT, APMU_GPU, 12, 2, 0, &gpu_lock},
276+
};
277+
260278
static struct mmp_param_div_clk apmu_div_clks[] = {
261279
{0, "disp0_div", "disp0_mux", CLK_SET_RATE_PARENT, APMU_DISP0, 8, 4, 0, &disp0_lock},
262280
{0, "disp0_sphy_div", "disp0_mux", CLK_SET_RATE_PARENT, APMU_DISP0, 15, 5, 0, &disp0_lock},
@@ -265,6 +283,11 @@ static struct mmp_param_div_clk apmu_div_clks[] = {
265283
{0, "ccic1_sphy_div", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 10, 5, 0, &ccic1_lock},
266284
};
267285

286+
static struct mmp_param_div_clk mmp3_apmu_div_clks[] = {
287+
{0, "gpu_3d_div", "gpu_3d_mux", CLK_SET_RATE_PARENT, APMU_GPU, 24, 4, 0, &gpu_lock},
288+
{0, "gpu_2d_div", "gpu_2d_mux", CLK_SET_RATE_PARENT, APMU_GPU, 28, 4, 0, &gpu_lock},
289+
};
290+
268291
static struct mmp_param_gate_clk apmu_gate_clks[] = {
269292
{MMP2_CLK_USB, "usb_clk", "usb_pll", 0, APMU_USB, 0x9, 0x9, 0x0, 0, &usb_lock},
270293
{MMP2_CLK_USBHSIC0, "usbhsic0_clk", "usb_pll", 0, APMU_USBHSIC0, 0x1b, 0x1b, 0x0, 0, &usbhsic0_lock},
@@ -285,6 +308,16 @@ static struct mmp_param_gate_clk apmu_gate_clks[] = {
285308
{MMP2_CLK_CCIC1, "ccic1_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x1b, 0x1b, 0x0, 0, &ccic1_lock},
286309
{MMP2_CLK_CCIC1_PHY, "ccic1_phy_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x24, 0x24, 0x0, 0, &ccic1_lock},
287310
{MMP2_CLK_CCIC1_SPHY, "ccic1_sphy_clk", "ccic1_sphy_div", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x300, 0x300, 0x0, 0, &ccic1_lock},
311+
{MMP2_CLK_GPU_BUS, "gpu_bus_clk", "gpu_bus_mux", CLK_SET_RATE_PARENT, APMU_GPU, 0xa, 0xa, 0x0, MMP_CLK_GATE_NEED_DELAY, &gpu_lock},
312+
};
313+
314+
static struct mmp_param_gate_clk mmp2_apmu_gate_clks[] = {
315+
{MMP2_CLK_GPU_3D, "gpu_3d_clk", "gpu_3d_mux", CLK_SET_RATE_PARENT, APMU_GPU, 0x5, 0x5, 0x0, MMP_CLK_GATE_NEED_DELAY, &gpu_lock},
316+
};
317+
318+
static struct mmp_param_gate_clk mmp3_apmu_gate_clks[] = {
319+
{MMP3_CLK_GPU_3D, "gpu_3d_clk", "gpu_3d_div", CLK_SET_RATE_PARENT, APMU_GPU, 0x5, 0x5, 0x0, MMP_CLK_GATE_NEED_DELAY, &gpu_lock},
320+
{MMP3_CLK_GPU_2D, "gpu_2d_clk", "gpu_2d_div", CLK_SET_RATE_PARENT, APMU_GPU, 0x1c0000, 0x1c0000, 0x0, MMP_CLK_GATE_NEED_DELAY, &gpu_lock},
288321
};
289322

290323
static void mmp2_axi_periph_clk_init(struct mmp2_clk_unit *pxa_unit)
@@ -320,6 +353,34 @@ static void mmp2_axi_periph_clk_init(struct mmp2_clk_unit *pxa_unit)
320353

321354
mmp_register_gate_clks(unit, apmu_gate_clks, pxa_unit->apmu_base,
322355
ARRAY_SIZE(apmu_gate_clks));
356+
357+
if (pxa_unit->model == CLK_MODEL_MMP3) {
358+
mmp_register_mux_clks(unit, mmp3_apmu_mux_clks, pxa_unit->apmu_base,
359+
ARRAY_SIZE(mmp3_apmu_mux_clks));
360+
361+
mmp_register_div_clks(unit, mmp3_apmu_div_clks, pxa_unit->apmu_base,
362+
ARRAY_SIZE(mmp3_apmu_div_clks));
363+
364+
mmp_register_gate_clks(unit, mmp3_apmu_gate_clks, pxa_unit->apmu_base,
365+
ARRAY_SIZE(mmp3_apmu_gate_clks));
366+
} else {
367+
clk_register_mux_table(NULL, "gpu_3d_mux", mmp2_gpu_gc_parent_names,
368+
ARRAY_SIZE(mmp2_gpu_gc_parent_names),
369+
CLK_SET_RATE_PARENT,
370+
pxa_unit->apmu_base + APMU_GPU,
371+
0, 0x10c0, 0,
372+
mmp2_gpu_gc_parent_table, &gpu_lock);
373+
374+
clk_register_mux_table(NULL, "gpu_bus_mux", mmp2_gpu_bus_parent_names,
375+
ARRAY_SIZE(mmp2_gpu_bus_parent_names),
376+
CLK_SET_RATE_PARENT,
377+
pxa_unit->apmu_base + APMU_GPU,
378+
0, 0x4030, 0,
379+
mmp2_gpu_bus_parent_table, &gpu_lock);
380+
381+
mmp_register_gate_clks(unit, mmp2_apmu_gate_clks, pxa_unit->apmu_base,
382+
ARRAY_SIZE(mmp2_apmu_gate_clks));
383+
}
323384
}
324385

325386
static void mmp2_clk_reset_init(struct device_node *np,

0 commit comments

Comments
 (0)