linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] pinctrl: ingenic: Fix incorrect pull up/down info
@ 2021-07-17 17:48 Paul Cercueil
  2021-07-17 17:48 ` [PATCH 2/3] pinctrl: ingenic: Fix bias config for X2000(E) Paul Cercueil
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Paul Cercueil @ 2021-07-17 17:48 UTC (permalink / raw)
  To: Linus Walleij
  Cc: 周琰杰,
	linux-mips, linux-gpio, linux-kernel, Paul Cercueil, stable

Fix the pull up/down info for both the JZ4760 and JZ4770 SoCs, as the
previous values sometimes contradicted what's written in the programming
manual.

Fixes: b5c23aa46537 ("pinctrl: add a pinctrl driver for the Ingenic jz47xx SoCs")
Cc: <stable@vger.kernel.org> # v4.12
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/pinctrl/pinctrl-ingenic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index 983ba9865f77..126ca671c3cd 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -710,7 +710,7 @@ static const struct ingenic_chip_info jz4755_chip_info = {
 };
 
 static const u32 jz4760_pull_ups[6] = {
-	0xffffffff, 0xfffcf3ff, 0xffffffff, 0xffffcfff, 0xfffffb7c, 0xfffff00f,
+	0xffffffff, 0xfffcf3ff, 0xffffffff, 0xffffcfff, 0xfffffb7c, 0x0000000f,
 };
 
 static const u32 jz4760_pull_downs[6] = {
@@ -936,11 +936,11 @@ static const struct ingenic_chip_info jz4760_chip_info = {
 };
 
 static const u32 jz4770_pull_ups[6] = {
-	0x3fffffff, 0xfff0030c, 0xffffffff, 0xffff4fff, 0xfffffb7c, 0xffa7f00f,
+	0x3fffffff, 0xfff0f3fc, 0xffffffff, 0xffff4fff, 0xfffffb7c, 0x0024f00f,
 };
 
 static const u32 jz4770_pull_downs[6] = {
-	0x00000000, 0x000f0c03, 0x00000000, 0x0000b000, 0x00000483, 0x00580ff0,
+	0x00000000, 0x000f0c03, 0x00000000, 0x0000b000, 0x00000483, 0x005b0ff0,
 };
 
 static int jz4770_uart0_data_pins[] = { 0xa0, 0xa3, };
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] pinctrl: ingenic: Fix bias config for X2000(E)
  2021-07-17 17:48 [PATCH 1/3] pinctrl: ingenic: Fix incorrect pull up/down info Paul Cercueil
@ 2021-07-17 17:48 ` Paul Cercueil
  2021-07-24  6:42   ` Zhou Yanjie
  2021-08-11  8:25   ` Linus Walleij
  2021-07-17 17:48 ` [PATCH 3/3] pinctrl: ingenic: Add .max_register in regmap_config Paul Cercueil
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Paul Cercueil @ 2021-07-17 17:48 UTC (permalink / raw)
  To: Linus Walleij
  Cc: 周琰杰,
	linux-mips, linux-gpio, linux-kernel, Paul Cercueil, stable

The ingenic_set_bias() function's "bias" argument is not a
"enum pin_config_param", so its value should not be compared against
values of that enum.

This should fix the bias config not working on the X2000(E) SoCs.

Fixes: 943e0da15370 ("pinctrl: Ingenic: Add pinctrl driver for X2000.")
Cc: <stable@vger.kernel.org> # v5.12
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/pinctrl/pinctrl-ingenic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index 126ca671c3cd..263498be8e31 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -3441,17 +3441,17 @@ static void ingenic_set_bias(struct ingenic_pinctrl *jzpc,
 {
 	if (jzpc->info->version >= ID_X2000) {
 		switch (bias) {
-		case PIN_CONFIG_BIAS_PULL_UP:
+		case GPIO_PULL_UP:
 			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPD, false);
 			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPU, true);
 			break;
 
-		case PIN_CONFIG_BIAS_PULL_DOWN:
+		case GPIO_PULL_DOWN:
 			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPU, false);
 			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPD, true);
 			break;
 
-		case PIN_CONFIG_BIAS_DISABLE:
+		case GPIO_PULL_DIS:
 		default:
 			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPU, false);
 			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPD, false);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] pinctrl: ingenic: Add .max_register in regmap_config
  2021-07-17 17:48 [PATCH 1/3] pinctrl: ingenic: Fix incorrect pull up/down info Paul Cercueil
  2021-07-17 17:48 ` [PATCH 2/3] pinctrl: ingenic: Fix bias config for X2000(E) Paul Cercueil
@ 2021-07-17 17:48 ` Paul Cercueil
  2021-07-24  6:43   ` Zhou Yanjie
  2021-08-11  8:25   ` Linus Walleij
  2021-07-24  6:41 ` [PATCH 1/3] pinctrl: ingenic: Fix incorrect pull up/down info Zhou Yanjie
  2021-08-11  8:24 ` Linus Walleij
  3 siblings, 2 replies; 9+ messages in thread
From: Paul Cercueil @ 2021-07-17 17:48 UTC (permalink / raw)
  To: Linus Walleij
  Cc: 周琰杰,
	linux-mips, linux-gpio, linux-kernel, Paul Cercueil

Compute the max register from the GPIO chip offset and number of GPIO
chips.

This permits to read all registers from debugfs.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/pinctrl/pinctrl-ingenic.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index 263498be8e31..2bbcb8063a16 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -3759,6 +3759,7 @@ static int __init ingenic_pinctrl_probe(struct platform_device *pdev)
 	void __iomem *base;
 	const struct ingenic_chip_info *chip_info;
 	struct device_node *node;
+	struct regmap_config regmap_config;
 	unsigned int i;
 	int err;
 
@@ -3776,8 +3777,10 @@ static int __init ingenic_pinctrl_probe(struct platform_device *pdev)
 	if (IS_ERR(base))
 		return PTR_ERR(base);
 
-	jzpc->map = devm_regmap_init_mmio(dev, base,
-			&ingenic_pinctrl_regmap_config);
+	regmap_config = ingenic_pinctrl_regmap_config;
+	regmap_config.max_register = chip_info->num_chips * chip_info->reg_offset;
+
+	jzpc->map = devm_regmap_init_mmio(dev, base, &regmap_config);
 	if (IS_ERR(jzpc->map)) {
 		dev_err(dev, "Failed to create regmap\n");
 		return PTR_ERR(jzpc->map);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] pinctrl: ingenic: Fix incorrect pull up/down info
  2021-07-17 17:48 [PATCH 1/3] pinctrl: ingenic: Fix incorrect pull up/down info Paul Cercueil
  2021-07-17 17:48 ` [PATCH 2/3] pinctrl: ingenic: Fix bias config for X2000(E) Paul Cercueil
  2021-07-17 17:48 ` [PATCH 3/3] pinctrl: ingenic: Add .max_register in regmap_config Paul Cercueil
@ 2021-07-24  6:41 ` Zhou Yanjie
  2021-08-11  8:24 ` Linus Walleij
  3 siblings, 0 replies; 9+ messages in thread
From: Zhou Yanjie @ 2021-07-24  6:41 UTC (permalink / raw)
  To: Paul Cercueil, Linus Walleij; +Cc: linux-mips, linux-gpio, linux-kernel, stable

Hi Paul,

On 2021/7/18 上午1:48, Paul Cercueil wrote:
> Fix the pull up/down info for both the JZ4760 and JZ4770 SoCs, as the
> previous values sometimes contradicted what's written in the programming
> manual.
>
> Fixes: b5c23aa46537 ("pinctrl: add a pinctrl driver for the Ingenic jz47xx SoCs")
> Cc: <stable@vger.kernel.org> # v4.12
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>   drivers/pinctrl/pinctrl-ingenic.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)


Tested-by: 周琰杰 (Zhou Yanjie)<zhouyanjie@wanyeetech.com>


>
> diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
> index 983ba9865f77..126ca671c3cd 100644
> --- a/drivers/pinctrl/pinctrl-ingenic.c
> +++ b/drivers/pinctrl/pinctrl-ingenic.c
> @@ -710,7 +710,7 @@ static const struct ingenic_chip_info jz4755_chip_info = {
>   };
>   
>   static const u32 jz4760_pull_ups[6] = {
> -	0xffffffff, 0xfffcf3ff, 0xffffffff, 0xffffcfff, 0xfffffb7c, 0xfffff00f,
> +	0xffffffff, 0xfffcf3ff, 0xffffffff, 0xffffcfff, 0xfffffb7c, 0x0000000f,
>   };
>   
>   static const u32 jz4760_pull_downs[6] = {
> @@ -936,11 +936,11 @@ static const struct ingenic_chip_info jz4760_chip_info = {
>   };
>   
>   static const u32 jz4770_pull_ups[6] = {
> -	0x3fffffff, 0xfff0030c, 0xffffffff, 0xffff4fff, 0xfffffb7c, 0xffa7f00f,
> +	0x3fffffff, 0xfff0f3fc, 0xffffffff, 0xffff4fff, 0xfffffb7c, 0x0024f00f,
>   };
>   
>   static const u32 jz4770_pull_downs[6] = {
> -	0x00000000, 0x000f0c03, 0x00000000, 0x0000b000, 0x00000483, 0x00580ff0,
> +	0x00000000, 0x000f0c03, 0x00000000, 0x0000b000, 0x00000483, 0x005b0ff0,
>   };
>   
>   static int jz4770_uart0_data_pins[] = { 0xa0, 0xa3, };

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] pinctrl: ingenic: Fix bias config for X2000(E)
  2021-07-17 17:48 ` [PATCH 2/3] pinctrl: ingenic: Fix bias config for X2000(E) Paul Cercueil
@ 2021-07-24  6:42   ` Zhou Yanjie
  2021-08-11  8:25   ` Linus Walleij
  1 sibling, 0 replies; 9+ messages in thread
From: Zhou Yanjie @ 2021-07-24  6:42 UTC (permalink / raw)
  To: Paul Cercueil, Linus Walleij; +Cc: linux-mips, linux-gpio, linux-kernel, stable

Hi Paul,

On 2021/7/18 上午1:48, Paul Cercueil wrote:
> The ingenic_set_bias() function's "bias" argument is not a
> "enum pin_config_param", so its value should not be compared against
> values of that enum.
>
> This should fix the bias config not working on the X2000(E) SoCs.
>
> Fixes: 943e0da15370 ("pinctrl: Ingenic: Add pinctrl driver for X2000.")
> Cc: <stable@vger.kernel.org> # v5.12
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>   drivers/pinctrl/pinctrl-ingenic.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)


Tested-by: 周琰杰 (Zhou Yanjie)<zhouyanjie@wanyeetech.com>


> diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
> index 126ca671c3cd..263498be8e31 100644
> --- a/drivers/pinctrl/pinctrl-ingenic.c
> +++ b/drivers/pinctrl/pinctrl-ingenic.c
> @@ -3441,17 +3441,17 @@ static void ingenic_set_bias(struct ingenic_pinctrl *jzpc,
>   {
>   	if (jzpc->info->version >= ID_X2000) {
>   		switch (bias) {
> -		case PIN_CONFIG_BIAS_PULL_UP:
> +		case GPIO_PULL_UP:
>   			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPD, false);
>   			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPU, true);
>   			break;
>   
> -		case PIN_CONFIG_BIAS_PULL_DOWN:
> +		case GPIO_PULL_DOWN:
>   			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPU, false);
>   			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPD, true);
>   			break;
>   
> -		case PIN_CONFIG_BIAS_DISABLE:
> +		case GPIO_PULL_DIS:
>   		default:
>   			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPU, false);
>   			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPD, false);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] pinctrl: ingenic: Add .max_register in regmap_config
  2021-07-17 17:48 ` [PATCH 3/3] pinctrl: ingenic: Add .max_register in regmap_config Paul Cercueil
@ 2021-07-24  6:43   ` Zhou Yanjie
  2021-08-11  8:25   ` Linus Walleij
  1 sibling, 0 replies; 9+ messages in thread
From: Zhou Yanjie @ 2021-07-24  6:43 UTC (permalink / raw)
  To: Paul Cercueil, Linus Walleij; +Cc: linux-mips, linux-gpio, linux-kernel

Hi Paul,

On 2021/7/18 上午1:48, Paul Cercueil wrote:
> Compute the max register from the GPIO chip offset and number of GPIO
> chips.
>
> This permits to read all registers from debugfs.
>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>   drivers/pinctrl/pinctrl-ingenic.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)


Tested-by: 周琰杰 (Zhou Yanjie)<zhouyanjie@wanyeetech.com>


> diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
> index 263498be8e31..2bbcb8063a16 100644
> --- a/drivers/pinctrl/pinctrl-ingenic.c
> +++ b/drivers/pinctrl/pinctrl-ingenic.c
> @@ -3759,6 +3759,7 @@ static int __init ingenic_pinctrl_probe(struct platform_device *pdev)
>   	void __iomem *base;
>   	const struct ingenic_chip_info *chip_info;
>   	struct device_node *node;
> +	struct regmap_config regmap_config;
>   	unsigned int i;
>   	int err;
>   
> @@ -3776,8 +3777,10 @@ static int __init ingenic_pinctrl_probe(struct platform_device *pdev)
>   	if (IS_ERR(base))
>   		return PTR_ERR(base);
>   
> -	jzpc->map = devm_regmap_init_mmio(dev, base,
> -			&ingenic_pinctrl_regmap_config);
> +	regmap_config = ingenic_pinctrl_regmap_config;
> +	regmap_config.max_register = chip_info->num_chips * chip_info->reg_offset;
> +
> +	jzpc->map = devm_regmap_init_mmio(dev, base, &regmap_config);
>   	if (IS_ERR(jzpc->map)) {
>   		dev_err(dev, "Failed to create regmap\n");
>   		return PTR_ERR(jzpc->map);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] pinctrl: ingenic: Fix incorrect pull up/down info
  2021-07-17 17:48 [PATCH 1/3] pinctrl: ingenic: Fix incorrect pull up/down info Paul Cercueil
                   ` (2 preceding siblings ...)
  2021-07-24  6:41 ` [PATCH 1/3] pinctrl: ingenic: Fix incorrect pull up/down info Zhou Yanjie
@ 2021-08-11  8:24 ` Linus Walleij
  3 siblings, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2021-08-11  8:24 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: 周琰杰,
	linux-mips, open list:GPIO SUBSYSTEM, linux-kernel, stable

On Sat, Jul 17, 2021 at 7:48 PM Paul Cercueil <paul@crapouillou.net> wrote:

> Fix the pull up/down info for both the JZ4760 and JZ4770 SoCs, as the
> previous values sometimes contradicted what's written in the programming
> manual.
>
> Fixes: b5c23aa46537 ("pinctrl: add a pinctrl driver for the Ingenic jz47xx SoCs")
> Cc: <stable@vger.kernel.org> # v4.12
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Patch applied!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] pinctrl: ingenic: Fix bias config for X2000(E)
  2021-07-17 17:48 ` [PATCH 2/3] pinctrl: ingenic: Fix bias config for X2000(E) Paul Cercueil
  2021-07-24  6:42   ` Zhou Yanjie
@ 2021-08-11  8:25   ` Linus Walleij
  1 sibling, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2021-08-11  8:25 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: 周琰杰,
	linux-mips, open list:GPIO SUBSYSTEM, linux-kernel, stable

On Sat, Jul 17, 2021 at 7:48 PM Paul Cercueil <paul@crapouillou.net> wrote:

> The ingenic_set_bias() function's "bias" argument is not a
> "enum pin_config_param", so its value should not be compared against
> values of that enum.
>
> This should fix the bias config not working on the X2000(E) SoCs.
>
> Fixes: 943e0da15370 ("pinctrl: Ingenic: Add pinctrl driver for X2000.")
> Cc: <stable@vger.kernel.org> # v5.12
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Patch applied!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] pinctrl: ingenic: Add .max_register in regmap_config
  2021-07-17 17:48 ` [PATCH 3/3] pinctrl: ingenic: Add .max_register in regmap_config Paul Cercueil
  2021-07-24  6:43   ` Zhou Yanjie
@ 2021-08-11  8:25   ` Linus Walleij
  1 sibling, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2021-08-11  8:25 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: 周琰杰,
	linux-mips, open list:GPIO SUBSYSTEM, linux-kernel

On Sat, Jul 17, 2021 at 7:48 PM Paul Cercueil <paul@crapouillou.net> wrote:

> Compute the max register from the GPIO chip offset and number of GPIO
> chips.
>
> This permits to read all registers from debugfs.
>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Patch applied!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-08-11  8:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-17 17:48 [PATCH 1/3] pinctrl: ingenic: Fix incorrect pull up/down info Paul Cercueil
2021-07-17 17:48 ` [PATCH 2/3] pinctrl: ingenic: Fix bias config for X2000(E) Paul Cercueil
2021-07-24  6:42   ` Zhou Yanjie
2021-08-11  8:25   ` Linus Walleij
2021-07-17 17:48 ` [PATCH 3/3] pinctrl: ingenic: Add .max_register in regmap_config Paul Cercueil
2021-07-24  6:43   ` Zhou Yanjie
2021-08-11  8:25   ` Linus Walleij
2021-07-24  6:41 ` [PATCH 1/3] pinctrl: ingenic: Fix incorrect pull up/down info Zhou Yanjie
2021-08-11  8:24 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).