diff mbox series

[V3,1/9] pinctrl: imx: Support building SCU pinctrl driver as module

Message ID 1591712485-20609-2-git-send-email-Anson.Huang@nxp.com (mailing list archive)
State New, archived
Headers show
Series Support i.MX8 SoCs pinctrl drivers built as module | expand

Commit Message

Anson Huang June 9, 2020, 2:21 p.m. UTC
Export necessary functions and use "IS_ENABLED" instead of "ifdef"
to support SCU pinctrl driver user and itself to be built as module.

And when PINCTRL_IMX_SCU can be built as module, if PINCTRL_IMX is
built in while PINCTRL_IMX_SCU is built as module, build will fail
due to SCU pinctrl driver's APIs are NOT implemented, to avoid such
common scenario, the config dependency needs to be changed to below:

    - All i.MX platforms pinctrl driver will select PINCTRL_IMX;
    - All i.MX ARM64 platforms will select PINCTRL_IMX_SCU;

However, it introduces a tiny side effect that, for i.MX8M platforms,
although PINCTRL_IMX_SCU is NOT needed, but it will be still selected.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
Changes since V2:
	- change the config dependency of PINCTRL_IMX_SCU to support
	  scenario of building in PINCTRL_IMX while building PINCTRL_IMX_SCU
	  as module.
---
 drivers/pinctrl/freescale/Kconfig       | 10 +++++-----
 drivers/pinctrl/freescale/pinctrl-imx.h |  2 +-
 drivers/pinctrl/freescale/pinctrl-scu.c |  6 ++++++
 3 files changed, 12 insertions(+), 6 deletions(-)

Comments

kernel test robot June 9, 2020, 9:39 p.m. UTC | #1
Hi Anson,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on pinctrl/devel]
[cannot apply to v5.7]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Anson-Huang/Support-i-MX8-SoCs-pinctrl-drivers-built-as-module/20200609-223423
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: arm64-randconfig-r004-20200607 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>, old ones prefixed by <<):

   aarch64-linux-ld: drivers/pinctrl/freescale/pinctrl-scu.o: in function `imx_pinctrl_sc_ipc_init':
>> drivers/pinctrl/freescale/pinctrl-scu.c:43: undefined reference to `imx_scu_get_handle'
   aarch64-linux-ld: drivers/pinctrl/freescale/pinctrl-scu.o: in function `imx_pinconf_get_scu':
>> drivers/pinctrl/freescale/pinctrl-scu.c:62: undefined reference to `imx_scu_call_rpc'
   aarch64-linux-ld: drivers/pinctrl/freescale/pinctrl-scu.o: in function `imx_pinconf_set_scu':
   drivers/pinctrl/freescale/pinctrl-scu.c:100: undefined reference to `imx_scu_call_rpc'

vim +43 drivers/pinctrl/freescale/pinctrl-scu.c

b96eea718bf697 A.s. Dong   2018-10-30  40  
b96eea718bf697 A.s. Dong   2018-10-30  41  int imx_pinctrl_sc_ipc_init(struct platform_device *pdev)
b96eea718bf697 A.s. Dong   2018-10-30  42  {
b96eea718bf697 A.s. Dong   2018-10-30 @43  	return imx_scu_get_handle(&pinctrl_ipc_handle);
b96eea718bf697 A.s. Dong   2018-10-30  44  }
3c8d42d4fdbf10 Anson Huang 2020-06-09  45  EXPORT_SYMBOL_GPL(imx_pinctrl_sc_ipc_init);
b96eea718bf697 A.s. Dong   2018-10-30  46  
b96eea718bf697 A.s. Dong   2018-10-30  47  int imx_pinconf_get_scu(struct pinctrl_dev *pctldev, unsigned pin_id,
b96eea718bf697 A.s. Dong   2018-10-30  48  			unsigned long *config)
b96eea718bf697 A.s. Dong   2018-10-30  49  {
b96eea718bf697 A.s. Dong   2018-10-30  50  	struct imx_sc_msg_req_pad_get msg;
b96eea718bf697 A.s. Dong   2018-10-30  51  	struct imx_sc_msg_resp_pad_get *resp;
b96eea718bf697 A.s. Dong   2018-10-30  52  	struct imx_sc_rpc_msg *hdr = &msg.hdr;
b96eea718bf697 A.s. Dong   2018-10-30  53  	int ret;
b96eea718bf697 A.s. Dong   2018-10-30  54  
b96eea718bf697 A.s. Dong   2018-10-30  55  	hdr->ver = IMX_SC_RPC_VERSION;
b96eea718bf697 A.s. Dong   2018-10-30  56  	hdr->svc = IMX_SC_RPC_SVC_PAD;
b96eea718bf697 A.s. Dong   2018-10-30  57  	hdr->func = IMX_SC_PAD_FUNC_GET;
b96eea718bf697 A.s. Dong   2018-10-30  58  	hdr->size = 2;
b96eea718bf697 A.s. Dong   2018-10-30  59  
b96eea718bf697 A.s. Dong   2018-10-30  60  	msg.pad = pin_id;
b96eea718bf697 A.s. Dong   2018-10-30  61  
b96eea718bf697 A.s. Dong   2018-10-30 @62  	ret = imx_scu_call_rpc(pinctrl_ipc_handle, &msg, true);
b96eea718bf697 A.s. Dong   2018-10-30  63  	if (ret)
b96eea718bf697 A.s. Dong   2018-10-30  64  		return ret;
b96eea718bf697 A.s. Dong   2018-10-30  65  
b96eea718bf697 A.s. Dong   2018-10-30  66  	resp = (struct imx_sc_msg_resp_pad_get *)&msg;
b96eea718bf697 A.s. Dong   2018-10-30  67  	*config = resp->val;
b96eea718bf697 A.s. Dong   2018-10-30  68  
b96eea718bf697 A.s. Dong   2018-10-30  69  	return 0;
b96eea718bf697 A.s. Dong   2018-10-30  70  }
3c8d42d4fdbf10 Anson Huang 2020-06-09  71  EXPORT_SYMBOL_GPL(imx_pinconf_get_scu);
b96eea718bf697 A.s. Dong   2018-10-30  72  

:::::: The code at line 43 was first introduced by commit
:::::: b96eea718bf697e4a490c2fabfb89995b9193c21 pinctrl: fsl: add scu based pinctrl support

:::::: TO: A.s. Dong <aisheng.dong@nxp.com>
:::::: CC: Linus Walleij <linus.walleij@linaro.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig
index 4ca44dd..f6c00d5 100644
--- a/drivers/pinctrl/freescale/Kconfig
+++ b/drivers/pinctrl/freescale/Kconfig
@@ -5,11 +5,11 @@  config PINCTRL_IMX
 	select GENERIC_PINMUX_FUNCTIONS
 	select GENERIC_PINCONF
 	select REGMAP
+	select PINCTRL_IMX_SCU if (ARCH_MXC && ARM64)
 
 config PINCTRL_IMX_SCU
-	bool
+	tristate "IMX SCU pinctrl driver"
 	depends on IMX_SCU
-	select PINCTRL_IMX
 
 config PINCTRL_IMX1_CORE
 	bool
@@ -154,21 +154,21 @@  config PINCTRL_IMX8MQ
 config PINCTRL_IMX8QM
 	bool "IMX8QM pinctrl driver"
 	depends on IMX_SCU && ARCH_MXC && ARM64
-	select PINCTRL_IMX_SCU
+	select PINCTRL_IMX
 	help
 	  Say Y here to enable the imx8qm pinctrl driver
 
 config PINCTRL_IMX8QXP
 	bool "IMX8QXP pinctrl driver"
 	depends on IMX_SCU && ARCH_MXC && ARM64
-	select PINCTRL_IMX_SCU
+	select PINCTRL_IMX
 	help
 	  Say Y here to enable the imx8qxp pinctrl driver
 
 config PINCTRL_IMX8DXL
 	bool "IMX8DXL pinctrl driver"
 	depends on IMX_SCU && ARCH_MXC && ARM64
-	select PINCTRL_IMX_SCU
+	select PINCTRL_IMX
 	help
 	  Say Y here to enable the imx8dxl pinctrl driver
 
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.h b/drivers/pinctrl/freescale/pinctrl-imx.h
index 333d32b..4e93f12 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.h
+++ b/drivers/pinctrl/freescale/pinctrl-imx.h
@@ -137,7 +137,7 @@  struct imx_pinctrl {
 int imx_pinctrl_probe(struct platform_device *pdev,
 			const struct imx_pinctrl_soc_info *info);
 
-#ifdef CONFIG_PINCTRL_IMX_SCU
+#if IS_ENABLED(CONFIG_PINCTRL_IMX_SCU)
 #define BM_PAD_CTL_GP_ENABLE		BIT(30)
 #define BM_PAD_CTL_IFMUX_ENABLE		BIT(31)
 #define BP_PAD_CTL_IFMUX		27
diff --git a/drivers/pinctrl/freescale/pinctrl-scu.c b/drivers/pinctrl/freescale/pinctrl-scu.c
index 23cf04b..35efd5c 100644
--- a/drivers/pinctrl/freescale/pinctrl-scu.c
+++ b/drivers/pinctrl/freescale/pinctrl-scu.c
@@ -7,6 +7,7 @@ 
 
 #include <linux/err.h>
 #include <linux/firmware/imx/sci.h>
+#include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/pinctrl/pinctrl.h>
 #include <linux/platform_device.h>
@@ -41,6 +42,7 @@  int imx_pinctrl_sc_ipc_init(struct platform_device *pdev)
 {
 	return imx_scu_get_handle(&pinctrl_ipc_handle);
 }
+EXPORT_SYMBOL_GPL(imx_pinctrl_sc_ipc_init);
 
 int imx_pinconf_get_scu(struct pinctrl_dev *pctldev, unsigned pin_id,
 			unsigned long *config)
@@ -66,6 +68,7 @@  int imx_pinconf_get_scu(struct pinctrl_dev *pctldev, unsigned pin_id,
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(imx_pinconf_get_scu);
 
 int imx_pinconf_set_scu(struct pinctrl_dev *pctldev, unsigned pin_id,
 			unsigned long *configs, unsigned num_configs)
@@ -101,6 +104,7 @@  int imx_pinconf_set_scu(struct pinctrl_dev *pctldev, unsigned pin_id,
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(imx_pinconf_set_scu);
 
 void imx_pinctrl_parse_pin_scu(struct imx_pinctrl *ipctl,
 			       unsigned int *pin_id, struct imx_pin *pin,
@@ -119,3 +123,5 @@  void imx_pinctrl_parse_pin_scu(struct imx_pinctrl *ipctl,
 	dev_dbg(ipctl->dev, "%s: 0x%x 0x%08lx", info->pins[pin->pin].name,
 		pin_scu->mux_mode, pin_scu->config);
 }
+EXPORT_SYMBOL_GPL(imx_pinctrl_parse_pin_scu);
+MODULE_LICENSE("GPL v2");