Re: [PATCH 09/12] pinctrl: sunxi: Prepare for alternative bias voltage setting methods

2019-04-09 Thread Ondřej Jirman
Hi Linus,

On Mon, Apr 08, 2019 at 02:53:58PM +0200, Linus Walleij wrote:
> On Sat, Apr 6, 2019 at 1:45 AM  wrote:
> 
> > From: Ondrej Jirman 
> >
> > H6 has a different I/O voltage bias setting method than A80. Prepare
> > existing code for using alternative bias voltage setting methods.
> >
> > Signed-off-by: Ondrej Jirman 
> > ---
> >  drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c |  2 +-
> >  drivers/pinctrl/sunxi/pinctrl-sunxi.c | 38 ---
> >  drivers/pinctrl/sunxi/pinctrl-sunxi.h |  4 ++-
> 
> I need Maxime's ACK on these patches to merge.
> 
> Can the pinctrl parts be applied independently of the rest
> of the changes when Maxime is happy with the patches?

Yes, the two pinctrl patches are independent of the rest of the series.

thank you,
Ondrej

> Yours,
> Linus Walleij
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 09/12] pinctrl: sunxi: Prepare for alternative bias voltage setting methods

2019-04-08 Thread Linus Walleij
On Sat, Apr 6, 2019 at 1:45 AM  wrote:

> From: Ondrej Jirman 
>
> H6 has a different I/O voltage bias setting method than A80. Prepare
> existing code for using alternative bias voltage setting methods.
>
> Signed-off-by: Ondrej Jirman 
> ---
>  drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c |  2 +-
>  drivers/pinctrl/sunxi/pinctrl-sunxi.c | 38 ---
>  drivers/pinctrl/sunxi/pinctrl-sunxi.h |  4 ++-

I need Maxime's ACK on these patches to merge.

Can the pinctrl parts be applied independently of the rest
of the changes when Maxime is happy with the patches?

Yours,
Linus Walleij
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 09/12] pinctrl: sunxi: Prepare for alternative bias voltage setting methods

2019-04-08 Thread megous
From: Ondrej Jirman 

H6 has a different I/O voltage bias setting method than A80. Prepare
existing code for using alternative bias voltage setting methods.

Signed-off-by: Ondrej Jirman 
---
 drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c |  2 +-
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 38 ---
 drivers/pinctrl/sunxi/pinctrl-sunxi.h |  4 ++-
 3 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c 
b/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
index da37d594a13d..3aa210079b18 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
@@ -722,7 +722,7 @@ static const struct sunxi_pinctrl_desc 
sun9i_a80_pinctrl_data = {
.npins = ARRAY_SIZE(sun9i_a80_pins),
.irq_banks = 5,
.disable_strict_mode = true,
-   .has_io_bias_cfg = true,
+   .io_bias_cfg_variant = IO_BIAS_CFG_V1,
 };
 
 static int sun9i_a80_pinctrl_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c 
b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 8dd25caea2cf..9f329fec77cf 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -610,7 +610,7 @@ static int sunxi_pinctrl_set_io_bias_cfg(struct 
sunxi_pinctrl *pctl,
u32 val, reg;
int uV;
 
-   if (!pctl->desc->has_io_bias_cfg)
+   if (!pctl->desc->io_bias_cfg_variant)
return 0;
 
uV = regulator_get_voltage(supply);
@@ -621,23 +621,25 @@ static int sunxi_pinctrl_set_io_bias_cfg(struct 
sunxi_pinctrl *pctl,
if (uV == 0)
return 0;
 
-   /* Configured value must be equal or greater to actual voltage */
-   if (uV <= 180)
-   val = 0x0; /* 1.8V */
-   else if (uV <= 250)
-   val = 0x6; /* 2.5V */
-   else if (uV <= 280)
-   val = 0x9; /* 2.8V */
-   else if (uV <= 300)
-   val = 0xA; /* 3.0V */
-   else
-   val = 0xD; /* 3.3V */
-
-   pin -= pctl->desc->pin_base;
-
-   reg = readl(pctl->membase + sunxi_grp_config_reg(pin));
-   reg &= ~IO_BIAS_MASK;
-   writel(reg | val, pctl->membase + sunxi_grp_config_reg(pin));
+   if (pctl->desc->io_bias_cfg_variant == IO_BIAS_CFG_V1) {
+   /* Configured value must be equal or greater to actual voltage 
*/
+   if (uV <= 180)
+   val = 0x0; /* 1.8V */
+   else if (uV <= 250)
+   val = 0x6; /* 2.5V */
+   else if (uV <= 280)
+   val = 0x9; /* 2.8V */
+   else if (uV <= 300)
+   val = 0xA; /* 3.0V */
+   else
+   val = 0xD; /* 3.3V */
+
+   pin -= pctl->desc->pin_base;
+
+   reg = readl(pctl->membase + sunxi_grp_config_reg(pin));
+   reg &= ~IO_BIAS_MASK;
+   writel(reg | val, pctl->membase + sunxi_grp_config_reg(pin));
+   }
 
return 0;
 }
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h 
b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
index ee15ab067b5f..476772f91dba 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
@@ -95,6 +95,8 @@
 #define PINCTRL_SUN7I_A20  BIT(7)
 #define PINCTRL_SUN8I_R40  BIT(8)
 
+#define IO_BIAS_CFG_V1 1
+
 struct sunxi_desc_function {
unsigned long   variant;
const char  *name;
@@ -117,7 +119,7 @@ struct sunxi_pinctrl_desc {
const unsigned int  *irq_bank_map;
boolirq_read_needs_mux;
booldisable_strict_mode;
-   boolhas_io_bias_cfg;
+   int io_bias_cfg_variant;
 };
 
 struct sunxi_pinctrl_function {
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel