diff mbox

[v2,1/2] clk: bcm2835: Limit PCM clock to OSC and PLLD_PER

Message ID 8a9ebac4-b299-b887-27b2-86f4f61846fd@raspberrypi.org (mailing list archive)
State Superseded
Headers show

Commit Message

Phil Elwell May 31, 2017, 9:18 a.m. UTC
Restrict clock sources for the PCM peripheral to the oscillator and
PLLD_PER because other source may have varying rates or be switched off.
Prevent other sources from being selected by replacing their names in
the list of potential parents with dummy entries (entry index is
significant).

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
 drivers/clk/bcm/clk-bcm2835.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

Comments

kernel test robot June 1, 2017, 1:41 p.m. UTC | #1
Hi Phil,

[auto build test ERROR on clk/clk-next]
[also build test ERROR on v4.12-rc3 next-20170601]
[cannot apply to linux-rpi/for-rpi-next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Phil-Elwell/clk-bcm2835-Limit-PCM-clock-to-OSC-and-PLLD_PER/20170601-185211
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

All error/warnings (new ones prefixed by >>):

>> drivers/clk//bcm/clk-bcm2835.c:1540:32: error: 'bcm2835_clock_pcm_per_parents' undeclared here (not in a function)
     .num_mux_parents = ARRAY_SIZE(bcm2835_clock_pcm_per_parents), \
                                   ^
   drivers/clk//bcm/clk-bcm2835.c:1473:16: note: in definition of macro '_REGISTER'
           .data = __VA_ARGS__ }
                   ^~~~~~~~~~~
>> drivers/clk//bcm/clk-bcm2835.c:1539:31: note: in expansion of macro 'REGISTER_CLK'
    #define REGISTER_PCM_CLK(...) REGISTER_CLK(    \
                                  ^~~~~~~~~~~~
>> drivers/clk//bcm/clk-bcm2835.c:1540:21: note: in expansion of macro 'ARRAY_SIZE'
     .num_mux_parents = ARRAY_SIZE(bcm2835_clock_pcm_per_parents), \
                        ^~~~~~~~~~
>> drivers/clk//bcm/clk-bcm2835.c:2021:24: note: in expansion of macro 'REGISTER_PCM_CLK'
     [BCM2835_CLOCK_PCM] = REGISTER_PCM_CLK(
                           ^~~~~~~~~~~~~~~~
   include/linux/bug.h:37:45: error: bit-field '<anonymous>' width not an integer constant
    #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
                                                ^
   drivers/clk//bcm/clk-bcm2835.c:1473:16: note: in definition of macro '_REGISTER'
           .data = __VA_ARGS__ }
                   ^~~~~~~~~~~
>> drivers/clk//bcm/clk-bcm2835.c:1539:31: note: in expansion of macro 'REGISTER_CLK'
    #define REGISTER_PCM_CLK(...) REGISTER_CLK(    \
                                  ^~~~~~~~~~~~
   include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
    #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
                               ^~~~~~~~~~~~~~~~~
   include/linux/kernel.h:59:59: note: in expansion of macro '__must_be_array'
    #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
                                                              ^~~~~~~~~~~~~~~
>> drivers/clk//bcm/clk-bcm2835.c:1540:21: note: in expansion of macro 'ARRAY_SIZE'
     .num_mux_parents = ARRAY_SIZE(bcm2835_clock_pcm_per_parents), \
                        ^~~~~~~~~~
>> drivers/clk//bcm/clk-bcm2835.c:2021:24: note: in expansion of macro 'REGISTER_PCM_CLK'
     [BCM2835_CLOCK_PCM] = REGISTER_PCM_CLK(
                           ^~~~~~~~~~~~~~~~

vim +/bcm2835_clock_pcm_per_parents +1540 drivers/clk//bcm/clk-bcm2835.c

  1467		bcm2835_clk_register clk_register;
  1468		const void *data;
  1469	};
  1470	
  1471	/* assignment helper macros for different clock types */
  1472	#define _REGISTER(f, ...) { .clk_register = (bcm2835_clk_register)f, \
> 1473				    .data = __VA_ARGS__ }
  1474	#define REGISTER_PLL(...)	_REGISTER(&bcm2835_register_pll,	\
  1475						  &(struct bcm2835_pll_data)	\
  1476						  {__VA_ARGS__})
  1477	#define REGISTER_PLL_DIV(...)	_REGISTER(&bcm2835_register_pll_divider, \
  1478						  &(struct bcm2835_pll_divider_data) \
  1479						  {__VA_ARGS__})
  1480	#define REGISTER_CLK(...)	_REGISTER(&bcm2835_register_clock,	\
  1481						  &(struct bcm2835_clock_data)	\
  1482						  {__VA_ARGS__})
  1483	#define REGISTER_GATE(...)	_REGISTER(&bcm2835_register_gate,	\
  1484						  &(struct bcm2835_gate_data)	\
  1485						  {__VA_ARGS__})
  1486	
  1487	/* parent mux arrays plus helper macros */
  1488	
  1489	/* main oscillator parent mux */
  1490	static const char *const bcm2835_clock_osc_parents[] = {
  1491		"gnd",
  1492		"xosc",
  1493		"testdebug0",
  1494		"testdebug1"
  1495	};
  1496	
  1497	#define REGISTER_OSC_CLK(...)	REGISTER_CLK(				\
  1498		.num_mux_parents = ARRAY_SIZE(bcm2835_clock_osc_parents),	\
  1499		.parents = bcm2835_clock_osc_parents,				\
  1500		__VA_ARGS__)
  1501	
  1502	/* main peripherial parent mux */
  1503	static const char *const bcm2835_clock_per_parents[] = {
  1504		"gnd",
  1505		"xosc",
  1506		"testdebug0",
  1507		"testdebug1",
  1508		"plla_per",
  1509		"pllc_per",
  1510		"plld_per",
  1511		"pllh_aux",
  1512	};
  1513	
  1514	#define REGISTER_PER_CLK(...)	REGISTER_CLK(				\
  1515		.num_mux_parents = ARRAY_SIZE(bcm2835_clock_per_parents),	\
  1516		.parents = bcm2835_clock_per_parents,				\
  1517		__VA_ARGS__)
  1518	
  1519	/*
  1520	 * Restrict clock sources for the PCM peripheral to the oscillator and
  1521	 * PLLD_PER because other source may have varying rates or be switched
  1522	 * off.
  1523	 *
  1524	 * Prevent other sources from being selected by replacing their names in
  1525	 * the list of potential parents with dummy entries (entry index is
  1526	 * significant).
  1527	 */
  1528	static const char *const bcm2835_pcm_per_parents[] = {
  1529		"-",
  1530		"xosc",
  1531		"-",
  1532		"-",
  1533		"-",
  1534		"-",
  1535		"plld_per",
  1536		"-",
  1537	};
  1538	
> 1539	#define REGISTER_PCM_CLK(...)	REGISTER_CLK(				\
> 1540		.num_mux_parents = ARRAY_SIZE(bcm2835_clock_pcm_per_parents),	\
  1541		.parents = bcm2835_clock_pcm_per_parents,			\
  1542		__VA_ARGS__)
  1543	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index 0258538..81ecd4c 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -1516,6 +1516,31 @@  struct bcm2835_clk_desc {
 	.parents = bcm2835_clock_per_parents,				\
 	__VA_ARGS__)
 
+/*
+ * Restrict clock sources for the PCM peripheral to the oscillator and
+ * PLLD_PER because other source may have varying rates or be switched
+ * off.
+ *
+ * Prevent other sources from being selected by replacing their names in
+ * the list of potential parents with dummy entries (entry index is
+ * significant).
+ */
+static const char *const bcm2835_pcm_per_parents[] = {
+	"-",
+	"xosc",
+	"-",
+	"-",
+	"-",
+	"-",
+	"plld_per",
+	"-",
+};
+
+#define REGISTER_PCM_CLK(...)	REGISTER_CLK(				\
+	.num_mux_parents = ARRAY_SIZE(bcm2835_clock_pcm_per_parents),	\
+	.parents = bcm2835_clock_pcm_per_parents,			\
+	__VA_ARGS__)
+
 /* main vpu parent mux */
 static const char *const bcm2835_clock_vpu_parents[] = {
 	"gnd",
@@ -1993,7 +2018,7 @@  struct bcm2835_clk_desc {
 		.int_bits = 4,
 		.frac_bits = 8,
 		.tcnt_mux = 22),
-	[BCM2835_CLOCK_PCM]	= REGISTER_PER_CLK(
+	[BCM2835_CLOCK_PCM]	= REGISTER_PCM_CLK(
 		.name = "pcm",
 		.ctl_reg = CM_PCMCTL,
 		.div_reg = CM_PCMDIV,