Re: [PATCH RESEND v8 4/4] clk: meson: add sub MMC clock controller driver

2018-12-31 Thread kbuild test robot
Hi Yixun,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on clk/clk-next]
[also build test ERROR on next-20181224]
[cannot apply to v4.20]
[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/Jianxin-Pan/clk-meson-add-a-sub-EMMC-clock-controller-support/20181222-060947
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: i386-randconfig-x079-12301332 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

>> ERROR: "clk_regmap_mux_ops" [drivers/clk/meson/mmc-clkc.ko] undefined!

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


.config.gz
Description: application/gzip


Re: [PATCH RESEND v8 4/4] clk: meson: add sub MMC clock controller driver

2018-12-31 Thread kbuild test robot
Hi Yixun,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on clk/clk-next]
[also build test ERROR on next-20181224]
[cannot apply to v4.20]
[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/Jianxin-Pan/clk-meson-add-a-sub-EMMC-clock-controller-support/20181222-060947
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: i386-randconfig-s0-12301806 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/clk/meson/mmc-clkc.o: In function `mmc_clkc_register_mux':
>> drivers/clk/meson/mmc-clkc.c:182: undefined reference to `clk_regmap_mux_ops'

vim +182 drivers/clk/meson/mmc-clkc.c

   158  
   159  static struct clk_regmap *mmc_clkc_register_mux(struct device *dev,
   160  struct regmap *map)
   161  {
   162  const char *parent_names[MUX_CLK_NUM_PARENTS];
   163  struct clk_init_data init;
   164  struct clk_regmap *mux;
   165  struct clk *clk;
   166  int i;
   167  
   168  for (i = 0; i < MUX_CLK_NUM_PARENTS; i++) {
   169  char name[8];
   170  
   171  snprintf(name, sizeof(name), "clkin%d", i);
   172  clk = devm_clk_get(dev, name);
   173  if (IS_ERR(clk)) {
   174  if (clk != ERR_PTR(-EPROBE_DEFER))
   175  dev_err(dev, "Missing clock %s\n", 
name);
   176  return ERR_CAST(clk);
   177  }
   178  
   179  parent_names[i] = __clk_get_name(clk);
   180  }
   181  
 > 182  init.ops = _regmap_mux_ops;
   183  init.flags = CLK_SET_RATE_PARENT;
   184  init.parent_names = parent_names;
   185  init.num_parents = MUX_CLK_NUM_PARENTS;
   186  
   187  mux = mmc_clkc_register_clk(dev, map, , "mux", 
_clkc_mux_data);
   188  if (IS_ERR(mux))
   189  dev_err(dev, "Mux clock registration failed\n");
   190  
   191  return mux;
   192  }
   193  

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


.config.gz
Description: application/gzip


[PATCH RESEND v8 4/4] clk: meson: add sub MMC clock controller driver

2018-12-19 Thread Jianxin Pan
From: Yixun Lan 

The patch will add a MMC clock controller driver which used by MMC or NAND,
It provide a mux and divider clock, and three phase clocks - core, tx, tx.

Two clocks are provided as the parent of MMC clock controller from
upper layer clock controller - eg "amlogic,axg-clkc" in AXG platform.

To specify which clock the MMC or NAND driver may consume,
the preprocessor macros in the dt-bindings/clock/amlogic,mmc-clkc.h header
can be used in the device tree sources.

Signed-off-by: Yixun Lan 
Signed-off-by: Jianxin Pan 
---
 drivers/clk/meson/Kconfig|   9 ++
 drivers/clk/meson/Makefile   |   1 +
 drivers/clk/meson/mmc-clkc.c | 304 +++
 3 files changed, 314 insertions(+)
 create mode 100644 drivers/clk/meson/mmc-clkc.c

diff --git a/drivers/clk/meson/Kconfig b/drivers/clk/meson/Kconfig
index efaa70f..c84b0f7 100644
--- a/drivers/clk/meson/Kconfig
+++ b/drivers/clk/meson/Kconfig
@@ -15,6 +15,15 @@ config COMMON_CLK_MESON_AO
select COMMON_CLK_REGMAP_MESON
select RESET_CONTROLLER
 
+config COMMON_CLK_MMC_MESON
+   tristate "Meson MMC Sub Clock Controller Driver"
+   select MFD_SYSCON
+   select COMMON_CLK_AMLOGIC
+   help
+ Support for the MMC sub clock controller on Amlogic Meson Platform,
+ which include S905 (GXBB, GXL), A113D/X (AXG) devices.
+ Say Y if you want this clock enabled.
+
 config COMMON_CLK_REGMAP_MESON
bool
select REGMAP
diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile
index d59620d..54416a2 100644
--- a/drivers/clk/meson/Makefile
+++ b/drivers/clk/meson/Makefile
@@ -12,4 +12,5 @@ obj-$(CONFIG_COMMON_CLK_MESON8B) += meson8b.o
 obj-$(CONFIG_COMMON_CLK_GXBB)   += gxbb.o gxbb-aoclk.o gxbb-aoclk-32k.o
 obj-$(CONFIG_COMMON_CLK_AXG)+= axg.o axg-aoclk.o
 obj-$(CONFIG_COMMON_CLK_AXG_AUDIO) += axg-audio.o
+obj-$(CONFIG_COMMON_CLK_MMC_MESON) += mmc-clkc.o
 obj-$(CONFIG_COMMON_CLK_REGMAP_MESON)  += clk-regmap.o
diff --git a/drivers/clk/meson/mmc-clkc.c b/drivers/clk/meson/mmc-clkc.c
new file mode 100644
index 000..2582a98
--- /dev/null
+++ b/drivers/clk/meson/mmc-clkc.c
@@ -0,0 +1,304 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Amlogic Meson MMC Sub Clock Controller Driver
+ *
+ * Copyright (c) 2017 Baylibre SAS.
+ * Author: Jerome Brunet 
+ *
+ * Copyright (c) 2018 Amlogic, inc.
+ * Author: Yixun Lan 
+ * Author: Jianxin Pan 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "clkc.h"
+
+/* clock ID used by internal driver */
+
+#define SD_EMMC_CLOCK  0
+#define CLK_DELAY_STEP_PS  200
+#define MUX_CLK_NUM_PARENTS2
+#define MMC_MAX_CLKS   4
+
+struct mmc_clkc_data {
+   struct meson_clk_phase_delay_data tx;
+   struct meson_clk_phase_delay_data rx;
+};
+
+static struct clk_regmap_mux_data mmc_clkc_mux_data = {
+   .offset = SD_EMMC_CLOCK,
+   .mask   = 0x3,
+   .shift  = 6,
+};
+
+static const struct meson_sclk_div_data mmc_clkc_div_data = {
+   .div = {
+   .reg_off = SD_EMMC_CLOCK,
+   .width   = 6,
+   },
+   .flags = CLK_DIVIDER_ONE_BASED,
+};
+
+static struct meson_clk_phase_data mmc_clkc_core_phase = {
+   .ph = {
+   .reg_off = SD_EMMC_CLOCK,
+   .shift   = 8,
+   .width   = 2,
+   }
+};
+
+static const struct mmc_clkc_data mmc_clkc_gx_data = {
+   .tx = {
+   .phase = {
+   .reg_off = SD_EMMC_CLOCK,
+   .shift   = 10,
+   .width   = 2,
+   },
+   .delay = {
+   .reg_off = SD_EMMC_CLOCK,
+   .shift   = 16,
+   .width   = 4,
+   },
+   .delay_step_ps = CLK_DELAY_STEP_PS,
+   },
+   .rx = {
+   .phase = {
+   .reg_off = SD_EMMC_CLOCK,
+   .shift   = 12,
+   .width   = 2,
+   },
+   .delay = {
+   .reg_off = SD_EMMC_CLOCK,
+   .shift   = 20,
+   .width   = 4,
+   },
+   .delay_step_ps   = CLK_DELAY_STEP_PS,
+   },
+};
+
+static const struct mmc_clkc_data mmc_clkc_axg_data = {
+   .tx = {
+   .phase = {
+   .reg_off = SD_EMMC_CLOCK,
+   .shift   = 10,
+   .width   = 2,
+   },
+   .delay = {
+   .reg_off = SD_EMMC_CLOCK,
+   .shift   = 16,
+   .width   = 6,
+   },
+   .delay_step_ps   = CLK_DELAY_STEP_PS,
+   },
+   .rx = {
+   .phase = {
+   .reg_off = SD_EMMC_CLOCK,
+   .shift   = 12,
+   .width   = 2,
+