Skip to contentSkip to conversation

pinctrl: imx: Fix mask when SHARE_MUX_CONF_REG is set

PATCH New Peng Fan 2 participants 4 messages Aug 14, 2017 – Aug 23, 2017

Subsystems (4)
lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/2 pinctrl: imx: Fix mask when SHARE_MUX_CONF_REG is set

when using SHARE_MUX_CONF_REG, wrong mask is used for writing config value, which causes mux value is cleared.

Cc Simon Glass <[email protected]>
Cc Stefano Babic <[email protected]>
---
 drivers/pinctrl/nxp/pinctrl-imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/nxp/pinctrl-imx.c +1 -1
index 1b6107f..32cbac9 100644
@@ -158,7 +158,7 @@ static int imx_pinctrl_set_state(struct udevice *dev, struct udevice *config)
 		if (!(config_val & IMX_NO_PAD_CTL)) {
 			if (info->flags & SHARE_MUX_CONF_REG) {
 				clrsetbits_le32(info->base + conf_reg,
-						info->mux_mask, config_val);
+						~info->mux_mask, config_val);
 			} else {
 				writel(config_val, info->base + conf_reg);
 			}
Signature · 1 line
2.6.2
author
#1 lore raw

PATCH 2/2 pinctrl: imx7ulp: Add new info instance for iomuxc1

To i.MX7ULP, we need to create two info instances for iomux0 and iomux1 respectively, otherwise iomuxc0/1 will share one info instance and use one base, because imx_pinctrl_probe will use info to store base address and etc. But iomuxc0/1 actually have different base address.

Cc Simon Glass <[email protected]>
Cc Stefano Babic <[email protected]>
---
 drivers/pinctrl/nxp/pinctrl-imx7ulp.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/pinctrl/nxp/pinctrl-imx7ulp.c +7 -3
index 4a893e5..618ce6a 100644
@@ -12,7 +12,11 @@
 
 #include "pinctrl-imx.h"
 
-static struct imx_pinctrl_soc_info imx7ulp_pinctrl_soc_info = {
+static struct imx_pinctrl_soc_info imx7ulp_pinctrl_soc_info0 = {
+	.flags = ZERO_OFFSET_VALID | SHARE_MUX_CONF_REG | CONFIG_IBE_OBE,
+};
+
+static struct imx_pinctrl_soc_info imx7ulp_pinctrl_soc_info1 = {
 	.flags = ZERO_OFFSET_VALID | SHARE_MUX_CONF_REG | CONFIG_IBE_OBE,
 };
 
@@ -25,8 +29,8 @@ static int imx7ulp_pinctrl_probe(struct udevice *dev)
 }
 
 static const struct udevice_id imx7ulp_pinctrl_match[] = {
-	{ .compatible = "fsl,imx7ulp-iomuxc-0", .data = (ulong)&imx7ulp_pinctrl_soc_info },
-	{ .compatible = "fsl,imx7ulp-iomuxc-1", .data = (ulong)&imx7ulp_pinctrl_soc_info },
+	{ .compatible = "fsl,imx7ulp-iomuxc-0", .data = (ulong)&imx7ulp_pinctrl_soc_info0 },
+	{ .compatible = "fsl,imx7ulp-iomuxc-1", .data = (ulong)&imx7ulp_pinctrl_soc_info1 },
 	{ /* sentinel */ }
 };
 
Signature · 1 line
2.6.2
#2 lore raw

PATCH 2/2 pinctrl: imx7ulp: Add new info instance for iomuxc1

Quoted 32 lines · Peng Fan

To i.MX7ULP, we need to create two info instances for iomux0 and iomux1 respectively, otherwise iomuxc0/1 will share one info instance and use one base, because imx_pinctrl_probe will use info to store base address and etc. But iomuxc0/1 actually have different base address.

Cc Simon Glass <[email protected]>
Cc Stefano Babic <[email protected]>
---
 drivers/pinctrl/nxp/pinctrl-imx7ulp.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/pinctrl/nxp/pinctrl-imx7ulp.c +5 -1
index 4a893e5..618ce6a 100644
@@ -12,7 +12,11 @@
 
 #include "pinctrl-imx.h"
 
-static struct imx_pinctrl_soc_info imx7ulp_pinctrl_soc_info = {
+static struct imx_pinctrl_soc_info imx7ulp_pinctrl_soc_info0 = {
+	.flags = ZERO_OFFSET_VALID | SHARE_MUX_CONF_REG | CONFIG_IBE_OBE,
+};
+
+static struct imx_pinctrl_soc_info imx7ulp_pinctrl_soc_info1 = {
 	.flags = ZERO_OFFSET_VALID | SHARE_MUX_CONF_REG | CONFIG_IBE_OBE,
 };
 

drivers/pinctrl/nxp/pinctrl-imx7ulp.c static int imx7ulp_pinctrl_probe(struct udevice *dev) · line 36

Quoted 10 lines
drivers/pinctrl/nxp/pinctrl-imx7ulp.c +2 -2
@@ -25,8 +29,8 @@ static int imx7ulp_pinctrl_probe(struct udevice *dev)
 }
 
 static const struct udevice_id imx7ulp_pinctrl_match[] = {
-	{ .compatible = "fsl,imx7ulp-iomuxc-0", .data = (ulong)&imx7ulp_pinctrl_soc_info },
-	{ .compatible = "fsl,imx7ulp-iomuxc-1", .data = (ulong)&imx7ulp_pinctrl_soc_info },
+	{ .compatible = "fsl,imx7ulp-iomuxc-0", .data = (ulong)&imx7ulp_pinctrl_soc_info0 },
+	{ .compatible = "fsl,imx7ulp-iomuxc-1", .data = (ulong)&imx7ulp_pinctrl_soc_info1 },
 	{ /* sentinel */ }
 };
 

Applied to u-boot-imx, -master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#3 lore raw

PATCH 1/2 pinctrl: imx: Fix mask when SHARE_MUX_CONF_REG is set

In reply to Peng Fan
Quoted 16 lines · Peng Fan

when using SHARE_MUX_CONF_REG, wrong mask is used for writing config value, which causes mux value is cleared.

Cc Simon Glass <[email protected]>
Cc Stefano Babic <[email protected]>
---
 drivers/pinctrl/nxp/pinctrl-imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/nxp/pinctrl-imx.c +0 -0
index 1b6107f..32cbac9 100644

drivers/pinctrl/nxp/pinctrl-imx.c static int imx_pinctrl_set_state(struct udevice *dev, struct udevice *config) · line 164

Quoted 8 lines
drivers/pinctrl/nxp/pinctrl-imx.c +1 -1
@@ -158,7 +158,7 @@ static int imx_pinctrl_set_state(struct udevice *dev, struct udevice *config)
 		if (!(config_val & IMX_NO_PAD_CTL)) {
 			if (info->flags & SHARE_MUX_CONF_REG) {
 				clrsetbits_le32(info->base + conf_reg,
-						info->mux_mask, config_val);
+						~info->mux_mask, config_val);
 			} else {
 				writel(config_val, info->base + conf_reg);
 			}

Applied to u-boot-imx, -master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================