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

clk: qoriq: provide constants for the type

To avoid future mistakes in the device tree for the clockgen module, add
constants for the clockgen subtype as well as a macro for the PLL
divider.

Signed-off-by: Michael Walle <michael@walle.cc>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20201108185113.31377-4-michael@walle.cc
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Michael Walle and committed by
Stephen Boyd
4cb15934 fb871515

+22 -6
+7 -6
drivers/clk/clk-qoriq.c
··· 7 7 8 8 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 9 9 10 + #include <dt-bindings/clock/fsl,qoriq-clockgen.h> 10 11 #include <linux/clk.h> 11 12 #include <linux/clk-provider.h> 12 13 #include <linux/clkdev.h> ··· 1369 1368 idx = clkspec->args[1]; 1370 1369 1371 1370 switch (type) { 1372 - case 0: 1371 + case QORIQ_CLK_SYSCLK: 1373 1372 if (idx != 0) 1374 1373 goto bad_args; 1375 1374 clk = cg->sysclk; 1376 1375 break; 1377 - case 1: 1376 + case QORIQ_CLK_CMUX: 1378 1377 if (idx >= ARRAY_SIZE(cg->cmux)) 1379 1378 goto bad_args; 1380 1379 clk = cg->cmux[idx]; 1381 1380 break; 1382 - case 2: 1381 + case QORIQ_CLK_HWACCEL: 1383 1382 if (idx >= ARRAY_SIZE(cg->hwaccel)) 1384 1383 goto bad_args; 1385 1384 clk = cg->hwaccel[idx]; 1386 1385 break; 1387 - case 3: 1386 + case QORIQ_CLK_FMAN: 1388 1387 if (idx >= ARRAY_SIZE(cg->fman)) 1389 1388 goto bad_args; 1390 1389 clk = cg->fman[idx]; 1391 1390 break; 1392 - case 4: 1391 + case QORIQ_CLK_PLATFORM_PLL: 1393 1392 pll = &cg->pll[PLATFORM_PLL]; 1394 1393 if (idx >= ARRAY_SIZE(pll->div)) 1395 1394 goto bad_args; 1396 1395 clk = pll->div[idx].clk; 1397 1396 break; 1398 - case 5: 1397 + case QORIQ_CLK_CORECLK: 1399 1398 if (idx != 0) 1400 1399 goto bad_args; 1401 1400 clk = cg->coreclk;
+15
include/dt-bindings/clock/fsl,qoriq-clockgen.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + 3 + #ifndef DT_CLOCK_FSL_QORIQ_CLOCKGEN_H 4 + #define DT_CLOCK_FSL_QORIQ_CLOCKGEN_H 5 + 6 + #define QORIQ_CLK_SYSCLK 0 7 + #define QORIQ_CLK_CMUX 1 8 + #define QORIQ_CLK_HWACCEL 2 9 + #define QORIQ_CLK_FMAN 3 10 + #define QORIQ_CLK_PLATFORM_PLL 4 11 + #define QORIQ_CLK_CORECLK 5 12 + 13 + #define QORIQ_CLK_PLL_DIV(x) ((x) - 1) 14 + 15 + #endif /* DT_CLOCK_FSL_QORIQ_CLOCKGEN_H */