MLK-20886-9 pinctrl-scu: Check the pad partition before set pinmux
authorYe Li <ye.li@nxp.com>
Thu, 31 Jan 2019 06:34:48 +0000 (22:34 -0800)
committerYe Li <ye.li@nxp.com>
Fri, 24 May 2019 11:28:16 +0000 (04:28 -0700)
If a pad is not owned by current partition we should not set its
pinmux.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 547636514f8ae8b456f2351bc84cb7fb7b5fa3f3)

drivers/pinctrl/nxp/pinctrl-scu.c

index aa11075..c032be7 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * Copyright 2018 NXP
+ * Copyright 2018-2019 NXP
  */
 
 #include <common.h>
@@ -29,6 +29,11 @@ static int imx_pinconf_scu_set(struct imx_pinctrl_soc_info *info, u32 pad,
         * to handle that in scfw, so config it in pad conf func
         */
 
+       if (!sc_rm_is_pad_owned(-1, pad)) {
+               debug("Pad[%u] is not owned by curr partition\n", pad);
+               return -EPERM;
+       }
+
        val |= PADRING_IFMUX_EN_MASK;
        val |= PADRING_GP_EN_MASK;
        val |= (mux << PADRING_IFMUX_SHIFT) & PADRING_IFMUX_MASK;
@@ -57,7 +62,7 @@ int imx_pinctrl_scu_conf_pins(struct imx_pinctrl_soc_info *info, u32 *pin_data,
                config_val = pin_data[j++];
 
                ret = imx_pinconf_scu_set(info, pin_id, mux, config_val);
-               if (ret)
+               if (ret && ret != -EPERM)
                        printf("Set pin %d, mux %d, val %d, error\n", pin_id,
                               mux, config_val);
        }