linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] pinctrl: meson: Add support for TEST_N gpio
@ 2018-08-01 10:00 Neil Armstrong
  2018-08-01 10:00 ` [PATCH 2/5] pinctrl: meson: Add support to set direction with a secure monitor call Neil Armstrong
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Neil Armstrong @ 2018-08-01 10:00 UTC (permalink / raw)
  To: khilman, linus.walleij
  Cc: Neil Armstrong, linux-amlogic, linux-arm-kernel, linux-gpio,
	linux-kernel

The Amlogic Meson GX and AXG SoCs needs to do a Secure Monitor call to
set the TEST_N pin direction.
This patchset :
- adds the Secure Monitor call
- adds support int the pinctrl-meson common code
- adds support for GXBB, GXL and AGX SoCs

Neil Armstrong (5):
  meson_sm: add TEST_N pin direction call
  pinctrl: meson: Add support to set direction with a secure monitor
    call
  meson: pinctrl-gxbb: add support for TEST_N pin
  meson: pinctrl-gxl: add support for TEST_N pin
  meson: pinctrl-axg: add support for TEST_N pin

 drivers/firmware/meson/meson_sm.c          |  1 +
 drivers/pinctrl/meson/Kconfig              |  1 +
 drivers/pinctrl/meson/pinctrl-meson-axg.c  |  4 ++++
 drivers/pinctrl/meson/pinctrl-meson-gxbb.c |  4 ++++
 drivers/pinctrl/meson/pinctrl-meson-gxl.c  |  4 ++++
 drivers/pinctrl/meson/pinctrl-meson.c      | 31 +++++++++++++++++++++++++-----
 drivers/pinctrl/meson/pinctrl-meson.h      | 10 +++++++++-
 include/linux/firmware/meson/meson_sm.h    |  1 +
 8 files changed, 50 insertions(+), 6 deletions(-)

-- 
2.7.4


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

* [PATCH 2/5] pinctrl: meson: Add support to set direction with a secure monitor call
  2018-08-01 10:00 [PATCH 0/5] pinctrl: meson: Add support for TEST_N gpio Neil Armstrong
@ 2018-08-01 10:00 ` Neil Armstrong
  2018-08-01 20:23   ` Martin Blumenstingl
  2018-08-01 10:00 ` [PATCH 3/5] meson: pinctrl-gxbb: add support for TEST_N pin Neil Armstrong
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Neil Armstrong @ 2018-08-01 10:00 UTC (permalink / raw)
  To: khilman, linus.walleij
  Cc: Neil Armstrong, linux-amlogic, linux-arm-kernel, linux-gpio,
	linux-kernel

The Amlogic Meson GX and AXG SoCs needs to do a Secure Monitor call to
set the TEST_N pin direction.
This patch adds a "smc" boolean to the bank structure to differentiate
the TEST_N bank and call the Secure Monitor in the _input/_output functions.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/pinctrl/meson/Kconfig         |  1 +
 drivers/pinctrl/meson/pinctrl-meson.c | 31 ++++++++++++++++++++++++++-----
 drivers/pinctrl/meson/pinctrl-meson.h | 10 +++++++++-
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/meson/Kconfig b/drivers/pinctrl/meson/Kconfig
index c80951d..1b90470 100644
--- a/drivers/pinctrl/meson/Kconfig
+++ b/drivers/pinctrl/meson/Kconfig
@@ -8,6 +8,7 @@ menuconfig PINCTRL_MESON
 	select GPIOLIB
 	select OF_GPIO
 	select REGMAP_MMIO
+	select MESON_SM
 
 if PINCTRL_MESON
 
diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
index 29a458d..8e445aa 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.c
+++ b/drivers/pinctrl/meson/pinctrl-meson.c
@@ -54,6 +54,7 @@
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/seq_file.h>
+#include <linux/firmware/meson/meson_sm.h>
 
 #include "../core.h"
 #include "../pinctrl-utils.h"
@@ -99,8 +100,14 @@ static void meson_calc_reg_and_bit(struct meson_bank *bank, unsigned int pin,
 {
 	struct meson_reg_desc *desc = &bank->regs[reg_type];
 
-	*reg = desc->reg * 4;
-	*bit = desc->bit + pin - bank->first;
+	/* TEST_N pin direction needs to be set using a Secure Monitor call */
+	if (reg_type == REG_DIR && bank->smc) {
+		*reg = desc->reg;
+		*bit = desc->bit;
+	} else {
+		*reg = desc->reg * 4;
+		*bit = desc->bit + pin - bank->first;
+	}
 }
 
 static int meson_get_groups_count(struct pinctrl_dev *pcdev)
@@ -342,6 +349,12 @@ static int meson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
 
 	meson_calc_reg_and_bit(bank, gpio, REG_DIR, &reg, &bit);
 
+	/* TEST_N pin direction needs to be set using a Secure Monitor call */
+	if (bank->smc) {
+		u32 smc_ret = 0;
+		return meson_sm_call(reg, &smc_ret, 0, 0, 0, 0, 0);
+	}
+
 	return regmap_update_bits(pc->reg_gpio, reg, BIT(bit), BIT(bit));
 }
 
@@ -358,9 +371,17 @@ static int meson_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
 		return ret;
 
 	meson_calc_reg_and_bit(bank, gpio, REG_DIR, &reg, &bit);
-	ret = regmap_update_bits(pc->reg_gpio, reg, BIT(bit), 0);
-	if (ret)
-		return ret;
+	/* TEST_N pin direction needs to be set using a Secure Monitor call */
+	if (bank->smc) {
+		u32 smc_ret = 0;
+		ret = meson_sm_call(reg, &smc_ret, bit, 0, 0, 0, 0);
+		if (ret)
+			return ret;
+	} else {
+		ret = regmap_update_bits(pc->reg_gpio, reg, BIT(bit), 0);
+		if (ret)
+			return ret;
+	}
 
 	meson_calc_reg_and_bit(bank, gpio, REG_OUT, &reg, &bit);
 	return regmap_update_bits(pc->reg_gpio, reg, BIT(bit),
diff --git a/drivers/pinctrl/meson/pinctrl-meson.h b/drivers/pinctrl/meson/pinctrl-meson.h
index 12a39110..d32e9a9 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.h
+++ b/drivers/pinctrl/meson/pinctrl-meson.h
@@ -92,6 +92,7 @@ struct meson_bank {
 	const char *name;
 	unsigned int first;
 	unsigned int last;
+	bool smc; /* Direction needs to use a Secure Monitor call */
 	int irq_first;
 	int irq_last;
 	struct meson_reg_desc regs[NUM_REG];
@@ -131,11 +132,12 @@ struct meson_pinctrl {
 		.num_groups = ARRAY_SIZE(fn ## _groups),		\
 	}
 
-#define BANK(n, f, l, fi, li, per, peb, pr, pb, dr, db, or, ob, ir, ib)	\
+#define __BANK(n, f, l, sm, fi, li, per, peb, pr, pb, dr, db, or, ob, ir, ib) \
 	{								\
 		.name		= n,					\
 		.first		= f,					\
 		.last		= l,					\
+		.smc		= sm,					\
 		.irq_first	= fi,					\
 		.irq_last	= li,					\
 		.regs = {						\
@@ -147,6 +149,12 @@ struct meson_pinctrl {
 		},							\
 	 }
 
+#define BANK(n, f, l, fi, li, per, peb, pr, pb, dr, db, or, ob, ir, ib) \
+	__BANK(n, f, l, false, fi, li, per, peb, pr, pb, dr, db, or, ob, ir, ib)
+
+#define BANK_SMC(n, f, l, fi, li, per, peb, pr, pb, dr, db, or, ob, ir, ib) \
+	__BANK(n, f, l, true, fi, li, per, peb, pr, pb, dr, db, or, ob, ir, ib)
+
 #define MESON_PIN(x) PINCTRL_PIN(x, #x)
 
 /* Common pmx functions */
-- 
2.7.4


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

* [PATCH 3/5] meson: pinctrl-gxbb: add support for TEST_N pin
  2018-08-01 10:00 [PATCH 0/5] pinctrl: meson: Add support for TEST_N gpio Neil Armstrong
  2018-08-01 10:00 ` [PATCH 2/5] pinctrl: meson: Add support to set direction with a secure monitor call Neil Armstrong
@ 2018-08-01 10:00 ` Neil Armstrong
  2018-08-01 10:00 ` [PATCH 4/5] meson: pinctrl-gxl: " Neil Armstrong
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Neil Armstrong @ 2018-08-01 10:00 UTC (permalink / raw)
  To: khilman, linus.walleij
  Cc: Neil Armstrong, linux-amlogic, linux-arm-kernel, linux-gpio,
	linux-kernel

The Amlogic Meson GXBB SoCs needs a Secure Monitor call to set the TEST_N
direction, add a special bank to support this pin.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/pinctrl/meson/pinctrl-meson-gxbb.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c
index 2c97a2e0..c0954be 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c
@@ -15,6 +15,7 @@
 #include <dt-bindings/gpio/meson-gxbb-gpio.h>
 #include "pinctrl-meson.h"
 #include "pinctrl-meson8-pmx.h"
+#include <linux/firmware/meson/meson_sm.h>
 
 static const struct pinctrl_pin_desc meson_gxbb_periphs_pins[] = {
 	MESON_PIN(GPIOZ_0),
@@ -823,6 +824,9 @@ static struct meson_bank meson_gxbb_periphs_banks[] = {
 static struct meson_bank meson_gxbb_aobus_banks[] = {
 	/*   name    first      last       irq    pullen  pull    dir     out     in  */
 	BANK("AO",   GPIOAO_0,  GPIOAO_13, 0, 13, 0,  0,  0, 16,  0,  0,  0, 16,  1,  0),
+	/* This PIN Direction must be set using a SMC call, so dir reg offset is the sm call */
+	BANK_SMC("TEST", GPIO_TEST_N, GPIO_TEST_N,
+					 -1, -1, 0, 30,  0, 14, SM_TEST_N_DIR, 1, 0, 31, 1, 31),
 };
 
 static struct meson_pinctrl_data meson_gxbb_periphs_pinctrl_data = {
-- 
2.7.4


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

* [PATCH 4/5] meson: pinctrl-gxl: add support for TEST_N pin
  2018-08-01 10:00 [PATCH 0/5] pinctrl: meson: Add support for TEST_N gpio Neil Armstrong
  2018-08-01 10:00 ` [PATCH 2/5] pinctrl: meson: Add support to set direction with a secure monitor call Neil Armstrong
  2018-08-01 10:00 ` [PATCH 3/5] meson: pinctrl-gxbb: add support for TEST_N pin Neil Armstrong
@ 2018-08-01 10:00 ` Neil Armstrong
  2018-08-01 10:00 ` [PATCH 5/5] meson: pinctrl-axg: " Neil Armstrong
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Neil Armstrong @ 2018-08-01 10:00 UTC (permalink / raw)
  To: khilman, linus.walleij
  Cc: Neil Armstrong, linux-amlogic, linux-arm-kernel, linux-gpio,
	linux-kernel

The Amlogic Meson GXL & GXM SoCs needs a Secure Monitor call to set the TEST_N
direction, add a special bank to support this pin.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/pinctrl/meson/pinctrl-meson-gxl.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxl.c b/drivers/pinctrl/meson/pinctrl-meson-gxl.c
index 7dae1d7..d4dc42f 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-gxl.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-gxl.c
@@ -15,6 +15,7 @@
 #include <dt-bindings/gpio/meson-gxl-gpio.h>
 #include "pinctrl-meson.h"
 #include "pinctrl-meson8-pmx.h"
+#include <linux/firmware/meson/meson_sm.h>
 
 static const struct pinctrl_pin_desc meson_gxl_periphs_pins[] = {
 	MESON_PIN(GPIOZ_0),
@@ -808,6 +809,9 @@ static struct meson_bank meson_gxl_periphs_banks[] = {
 static struct meson_bank meson_gxl_aobus_banks[] = {
 	/*   name    first      last      irq	pullen  pull    dir     out     in  */
 	BANK("AO",   GPIOAO_0,  GPIOAO_9, 0, 9, 0,  0,  0, 16,  0,  0,  0, 16,  1,  0),
+	/* This PIN Direction must be set using a SMC call, so dir reg offset is the sm call */
+	BANK_SMC("TEST", GPIO_TEST_N, GPIO_TEST_N,
+					 -1, -1, 0, 30,  0, 14, SM_TEST_N_DIR, 1, 0, 31, 1, 31),
 };
 
 static struct meson_pinctrl_data meson_gxl_periphs_pinctrl_data = {
-- 
2.7.4


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

* [PATCH 5/5] meson: pinctrl-axg: add support for TEST_N pin
  2018-08-01 10:00 [PATCH 0/5] pinctrl: meson: Add support for TEST_N gpio Neil Armstrong
                   ` (2 preceding siblings ...)
  2018-08-01 10:00 ` [PATCH 4/5] meson: pinctrl-gxl: " Neil Armstrong
@ 2018-08-01 10:00 ` Neil Armstrong
  2018-08-01 10:04 ` [PATCH 1/5] meson_sm: add TEST_N pin direction call Neil Armstrong
  2018-08-03 17:10 ` [PATCH 0/5] pinctrl: meson: Add support for TEST_N gpio Linus Walleij
  5 siblings, 0 replies; 13+ messages in thread
From: Neil Armstrong @ 2018-08-01 10:00 UTC (permalink / raw)
  To: khilman, linus.walleij
  Cc: Neil Armstrong, linux-amlogic, linux-arm-kernel, linux-gpio,
	linux-kernel

The Amlogic Meson AXG SoCs needs a Secure Monitor call to set the TEST_N
direction, add a special bank to support this pin.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/pinctrl/meson/pinctrl-meson-axg.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/pinctrl/meson/pinctrl-meson-axg.c b/drivers/pinctrl/meson/pinctrl-meson-axg.c
index 46a0918..12615d8 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-axg.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-axg.c
@@ -10,6 +10,7 @@
 #include <dt-bindings/gpio/meson-axg-gpio.h>
 #include "pinctrl-meson.h"
 #include "pinctrl-meson-axg-pmx.h"
+#include <linux/firmware/meson/meson_sm.h>
 
 static const struct pinctrl_pin_desc meson_axg_periphs_pins[] = {
 	MESON_PIN(GPIOZ_0),
@@ -1006,6 +1007,9 @@ static struct meson_bank meson_axg_periphs_banks[] = {
 static struct meson_bank meson_axg_aobus_banks[] = {
 	/*   name    first      last      irq	pullen  pull    dir     out     in  */
 	BANK("AO",   GPIOAO_0,  GPIOAO_13, 0, 13, 0,  16,  0, 0,  0,  0,  0, 16,  1,  0),
+	/* This PIN Direction must be set using a SMC call, so dir reg offset is the sm call */
+	BANK_SMC("TEST", GPIO_TEST_N, GPIO_TEST_N,
+					 -1, -1, 0, 30,  0, 14, SM_TEST_N_DIR, 1, 0, 31, 1, 31),
 };
 
 static struct meson_pmx_bank meson_axg_periphs_pmx_banks[] = {
-- 
2.7.4


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

* [PATCH 1/5] meson_sm: add TEST_N pin direction call
  2018-08-01 10:00 [PATCH 0/5] pinctrl: meson: Add support for TEST_N gpio Neil Armstrong
                   ` (3 preceding siblings ...)
  2018-08-01 10:00 ` [PATCH 5/5] meson: pinctrl-axg: " Neil Armstrong
@ 2018-08-01 10:04 ` Neil Armstrong
  2018-08-03 17:06   ` Linus Walleij
  2018-08-03 17:10 ` [PATCH 0/5] pinctrl: meson: Add support for TEST_N gpio Linus Walleij
  5 siblings, 1 reply; 13+ messages in thread
From: Neil Armstrong @ 2018-08-01 10:04 UTC (permalink / raw)
  To: khilman, linus.walleij
  Cc: Neil Armstrong, linux-amlogic, linux-arm-kernel, linux-gpio,
	linux-kernel

The Amlogic Meson GX and AXG has a Secure Monitor call to change the
TEST_N pin gpio direction, add it in the supported call list.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/firmware/meson/meson_sm.c       | 1 +
 include/linux/firmware/meson/meson_sm.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
index 0ec2ca8..f407001 100644
--- a/drivers/firmware/meson/meson_sm.c
+++ b/drivers/firmware/meson/meson_sm.c
@@ -48,6 +48,7 @@ struct meson_sm_chip gxbb_chip = {
 		CMD(SM_EFUSE_READ,	0x82000030),
 		CMD(SM_EFUSE_WRITE,	0x82000031),
 		CMD(SM_EFUSE_USER_MAX,	0x82000033),
+		CMD(SM_TEST_N_DIR,	0x82000046),
 		{ /* sentinel */ },
 	},
 };
diff --git a/include/linux/firmware/meson/meson_sm.h b/include/linux/firmware/meson/meson_sm.h
index 37a5eae..133b1c3 100644
--- a/include/linux/firmware/meson/meson_sm.h
+++ b/include/linux/firmware/meson/meson_sm.h
@@ -17,6 +17,7 @@ enum {
 	SM_EFUSE_READ,
 	SM_EFUSE_WRITE,
 	SM_EFUSE_USER_MAX,
+	SM_TEST_N_DIR,
 };
 
 struct meson_sm_firmware;
-- 
2.7.4


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

* Re: [PATCH 2/5] pinctrl: meson: Add support to set direction with a secure monitor call
  2018-08-01 10:00 ` [PATCH 2/5] pinctrl: meson: Add support to set direction with a secure monitor call Neil Armstrong
@ 2018-08-01 20:23   ` Martin Blumenstingl
  2018-08-02  7:52     ` Neil Armstrong
  0 siblings, 1 reply; 13+ messages in thread
From: Martin Blumenstingl @ 2018-08-01 20:23 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: khilman, linus.walleij, linux-amlogic, linux-gpio, linux-kernel,
	linux-arm-kernel

Hi Neil,

On Wed, Aug 1, 2018 at 12:05 PM Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> The Amlogic Meson GX and AXG SoCs needs to do a Secure Monitor call to
> set the TEST_N pin direction.
> This patch adds a "smc" boolean to the bank structure to differentiate
> the TEST_N bank and call the Secure Monitor in the _input/_output functions.
>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  drivers/pinctrl/meson/Kconfig         |  1 +
>  drivers/pinctrl/meson/pinctrl-meson.c | 31 ++++++++++++++++++++++++++-----
>  drivers/pinctrl/meson/pinctrl-meson.h | 10 +++++++++-
>  3 files changed, 36 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pinctrl/meson/Kconfig b/drivers/pinctrl/meson/Kconfig
> index c80951d..1b90470 100644
> --- a/drivers/pinctrl/meson/Kconfig
> +++ b/drivers/pinctrl/meson/Kconfig
> @@ -8,6 +8,7 @@ menuconfig PINCTRL_MESON
>         select GPIOLIB
>         select OF_GPIO
>         select REGMAP_MMIO
> +       select MESON_SM
I wonder why PINCTRL_MESON has to select MESON_SM - shouldn't
PINCTRL_MESON_GXBB, PINCTRL_MESON_GXL and PINCTRL_MESON_AXG select it
instead?
selecting MESON_SM is probably no-op on Meson8 and Meson8b (which
don't have the GX secure monitor), but I haven't tested it yet


Regards
Martin

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

* Re: [PATCH 2/5] pinctrl: meson: Add support to set direction with a secure monitor call
  2018-08-01 20:23   ` Martin Blumenstingl
@ 2018-08-02  7:52     ` Neil Armstrong
  2018-08-02 11:21       ` Jerome Brunet
  0 siblings, 1 reply; 13+ messages in thread
From: Neil Armstrong @ 2018-08-02  7:52 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: khilman, linus.walleij, linux-amlogic, linux-gpio, linux-kernel,
	linux-arm-kernel

On 01/08/2018 22:23, Martin Blumenstingl wrote:
> Hi Neil,
> 
> On Wed, Aug 1, 2018 at 12:05 PM Neil Armstrong <narmstrong@baylibre.com> wrote:
>>
>> The Amlogic Meson GX and AXG SoCs needs to do a Secure Monitor call to
>> set the TEST_N pin direction.
>> This patch adds a "smc" boolean to the bank structure to differentiate
>> the TEST_N bank and call the Secure Monitor in the _input/_output functions.
>>
>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>> ---
>>  drivers/pinctrl/meson/Kconfig         |  1 +
>>  drivers/pinctrl/meson/pinctrl-meson.c | 31 ++++++++++++++++++++++++++-----
>>  drivers/pinctrl/meson/pinctrl-meson.h | 10 +++++++++-
>>  3 files changed, 36 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/pinctrl/meson/Kconfig b/drivers/pinctrl/meson/Kconfig
>> index c80951d..1b90470 100644
>> --- a/drivers/pinctrl/meson/Kconfig
>> +++ b/drivers/pinctrl/meson/Kconfig
>> @@ -8,6 +8,7 @@ menuconfig PINCTRL_MESON
>>         select GPIOLIB
>>         select OF_GPIO
>>         select REGMAP_MMIO
>> +       select MESON_SM
> I wonder why PINCTRL_MESON has to select MESON_SM - shouldn't
> PINCTRL_MESON_GXBB, PINCTRL_MESON_GXL and PINCTRL_MESON_AXG select it
> instead?
> selecting MESON_SM is probably no-op on Meson8 and Meson8b (which
> don't have the GX secure monitor), but I haven't tested it yet

Hi Martin, you are right !

I will fix it on v2..

Neil

> 
> 
> Regards
> Martin
> 


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

* Re: [PATCH 2/5] pinctrl: meson: Add support to set direction with a secure monitor call
  2018-08-02  7:52     ` Neil Armstrong
@ 2018-08-02 11:21       ` Jerome Brunet
  2018-08-02 20:42         ` Martin Blumenstingl
  0 siblings, 1 reply; 13+ messages in thread
From: Jerome Brunet @ 2018-08-02 11:21 UTC (permalink / raw)
  To: Neil Armstrong, Martin Blumenstingl
  Cc: khilman, linus.walleij, linux-amlogic, linux-gpio, linux-kernel,
	linux-arm-kernel

On Thu, 2018-08-02 at 09:52 +0200, Neil Armstrong wrote:
> On 01/08/2018 22:23, Martin Blumenstingl wrote:
> > Hi Neil,
> > 
> > On Wed, Aug 1, 2018 at 12:05 PM Neil Armstrong <narmstrong@baylibre.com> wrote:
> > > 
> > > The Amlogic Meson GX and AXG SoCs needs to do a Secure Monitor call to
> > > set the TEST_N pin direction.
> > > This patch adds a "smc" boolean to the bank structure to differentiate
> > > the TEST_N bank and call the Secure Monitor in the _input/_output functions.
> > > 
> > > Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> > > ---
> > >  drivers/pinctrl/meson/Kconfig         |  1 +
> > >  drivers/pinctrl/meson/pinctrl-meson.c | 31 ++++++++++++++++++++++++++-----
> > >  drivers/pinctrl/meson/pinctrl-meson.h | 10 +++++++++-
> > >  3 files changed, 36 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/drivers/pinctrl/meson/Kconfig b/drivers/pinctrl/meson/Kconfig
> > > index c80951d..1b90470 100644
> > > --- a/drivers/pinctrl/meson/Kconfig
> > > +++ b/drivers/pinctrl/meson/Kconfig
> > > @@ -8,6 +8,7 @@ menuconfig PINCTRL_MESON
> > >         select GPIOLIB
> > >         select OF_GPIO
> > >         select REGMAP_MMIO
> > > +       select MESON_SM
> > 
> > I wonder why PINCTRL_MESON has to select MESON_SM - shouldn't
> > PINCTRL_MESON_GXBB, PINCTRL_MESON_GXL and PINCTRL_MESON_AXG select it
> > instead?
> > selecting MESON_SM is probably no-op on Meson8 and Meson8b (which
> > don't have the GX secure monitor), but I haven't tested it yet

I'm not so sure about that. meson_sm_call() symbol is used in the common pinctrl
code, so it should be selected when compiled even if meson8b is not going to use
it in the end.

> 
> Hi Martin, you are right !
> 
> I will fix it on v2..
> 
> Neil
> 
> > 
> > 
> > Regards
> > Martin
> > 
> 
> 



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

* Re: [PATCH 2/5] pinctrl: meson: Add support to set direction with a secure monitor call
  2018-08-02 11:21       ` Jerome Brunet
@ 2018-08-02 20:42         ` Martin Blumenstingl
  2018-08-03  8:10           ` Neil Armstrong
  0 siblings, 1 reply; 13+ messages in thread
From: Martin Blumenstingl @ 2018-08-02 20:42 UTC (permalink / raw)
  To: jbrunet
  Cc: Neil Armstrong, khilman, linus.walleij, linux-amlogic,
	linux-gpio, linux-kernel, linux-arm-kernel

On Thu, Aug 2, 2018 at 1:21 PM Jerome Brunet <jbrunet@baylibre.com> wrote:
>
> On Thu, 2018-08-02 at 09:52 +0200, Neil Armstrong wrote:
> > On 01/08/2018 22:23, Martin Blumenstingl wrote:
> > > Hi Neil,
> > >
> > > On Wed, Aug 1, 2018 at 12:05 PM Neil Armstrong <narmstrong@baylibre.com> wrote:
> > > >
> > > > The Amlogic Meson GX and AXG SoCs needs to do a Secure Monitor call to
> > > > set the TEST_N pin direction.
> > > > This patch adds a "smc" boolean to the bank structure to differentiate
> > > > the TEST_N bank and call the Secure Monitor in the _input/_output functions.
> > > >
> > > > Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> > > > ---
> > > >  drivers/pinctrl/meson/Kconfig         |  1 +
> > > >  drivers/pinctrl/meson/pinctrl-meson.c | 31 ++++++++++++++++++++++++++-----
> > > >  drivers/pinctrl/meson/pinctrl-meson.h | 10 +++++++++-
> > > >  3 files changed, 36 insertions(+), 6 deletions(-)
> > > >
> > > > diff --git a/drivers/pinctrl/meson/Kconfig b/drivers/pinctrl/meson/Kconfig
> > > > index c80951d..1b90470 100644
> > > > --- a/drivers/pinctrl/meson/Kconfig
> > > > +++ b/drivers/pinctrl/meson/Kconfig
> > > > @@ -8,6 +8,7 @@ menuconfig PINCTRL_MESON
> > > >         select GPIOLIB
> > > >         select OF_GPIO
> > > >         select REGMAP_MMIO
> > > > +       select MESON_SM
> > >
> > > I wonder why PINCTRL_MESON has to select MESON_SM - shouldn't
> > > PINCTRL_MESON_GXBB, PINCTRL_MESON_GXL and PINCTRL_MESON_AXG select it
> > > instead?
> > > selecting MESON_SM is probably no-op on Meson8 and Meson8b (which
> > > don't have the GX secure monitor), but I haven't tested it yet
>
> I'm not so sure about that. meson_sm_call() symbol is used in the common pinctrl
> code, so it should be selected when compiled even if meson8b is not going to use
> it in the end.
unfortunately MESON_SM depends on ARM64_4K_PAGES so it can't be
enabled for the 32-bit SoCs
any ideas how to solve this?


Regards
Martin

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

* Re: [PATCH 2/5] pinctrl: meson: Add support to set direction with a secure monitor call
  2018-08-02 20:42         ` Martin Blumenstingl
@ 2018-08-03  8:10           ` Neil Armstrong
  0 siblings, 0 replies; 13+ messages in thread
From: Neil Armstrong @ 2018-08-03  8:10 UTC (permalink / raw)
  To: Martin Blumenstingl, jbrunet
  Cc: khilman, linus.walleij, linux-amlogic, linux-gpio, linux-kernel,
	linux-arm-kernel

On 02/08/2018 22:42, Martin Blumenstingl wrote:
> On Thu, Aug 2, 2018 at 1:21 PM Jerome Brunet <jbrunet@baylibre.com> wrote:
>>
>> On Thu, 2018-08-02 at 09:52 +0200, Neil Armstrong wrote:
>>> On 01/08/2018 22:23, Martin Blumenstingl wrote:
>>>> Hi Neil,
>>>>
>>>> On Wed, Aug 1, 2018 at 12:05 PM Neil Armstrong <narmstrong@baylibre.com> wrote:
>>>>>
>>>>> The Amlogic Meson GX and AXG SoCs needs to do a Secure Monitor call to
>>>>> set the TEST_N pin direction.
>>>>> This patch adds a "smc" boolean to the bank structure to differentiate
>>>>> the TEST_N bank and call the Secure Monitor in the _input/_output functions.
>>>>>
>>>>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>>>>> ---
>>>>>  drivers/pinctrl/meson/Kconfig         |  1 +
>>>>>  drivers/pinctrl/meson/pinctrl-meson.c | 31 ++++++++++++++++++++++++++-----
>>>>>  drivers/pinctrl/meson/pinctrl-meson.h | 10 +++++++++-
>>>>>  3 files changed, 36 insertions(+), 6 deletions(-)
>>>>>
>>>>> diff --git a/drivers/pinctrl/meson/Kconfig b/drivers/pinctrl/meson/Kconfig
>>>>> index c80951d..1b90470 100644
>>>>> --- a/drivers/pinctrl/meson/Kconfig
>>>>> +++ b/drivers/pinctrl/meson/Kconfig
>>>>> @@ -8,6 +8,7 @@ menuconfig PINCTRL_MESON
>>>>>         select GPIOLIB
>>>>>         select OF_GPIO
>>>>>         select REGMAP_MMIO
>>>>> +       select MESON_SM
>>>>
>>>> I wonder why PINCTRL_MESON has to select MESON_SM - shouldn't
>>>> PINCTRL_MESON_GXBB, PINCTRL_MESON_GXL and PINCTRL_MESON_AXG select it
>>>> instead?
>>>> selecting MESON_SM is probably no-op on Meson8 and Meson8b (which
>>>> don't have the GX secure monitor), but I haven't tested it yet
>>
>> I'm not so sure about that. meson_sm_call() symbol is used in the common pinctrl
>> code, so it should be selected when compiled even if meson8b is not going to use
>> it in the end.
> unfortunately MESON_SM depends on ARM64_4K_PAGES so it can't be
> enabled for the 32-bit SoCs
> any ideas how to solve this?

I think I'll need to wrap the meson_sm calls around a
#if IS_ENABLED(MESON_SM)

and
select MESON_SM if ARM64

in Kconfig

> 
> 
> Regards
> Martin
> 


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

* Re: [PATCH 1/5] meson_sm: add TEST_N pin direction call
  2018-08-01 10:04 ` [PATCH 1/5] meson_sm: add TEST_N pin direction call Neil Armstrong
@ 2018-08-03 17:06   ` Linus Walleij
  0 siblings, 0 replies; 13+ messages in thread
From: Linus Walleij @ 2018-08-03 17:06 UTC (permalink / raw)
  To: Neil Armstrong, Carlo Caione
  Cc: Kevin Hilman, open list:ARM/Amlogic Meson...,
	Linux ARM, open list:GPIO SUBSYSTEM, linux-kernel

On Wed, Aug 1, 2018 at 12:04 PM Neil Armstrong <narmstrong@baylibre.com> wrote:

> The Amlogic Meson GX and AXG has a Secure Monitor call to change the
> TEST_N pin gpio direction, add it in the supported call list.
>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>

Looks fine to me, could we have Carlo's review on this patch?

Yours,
Linus Walleij

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

* Re: [PATCH 0/5] pinctrl: meson: Add support for TEST_N gpio
  2018-08-01 10:00 [PATCH 0/5] pinctrl: meson: Add support for TEST_N gpio Neil Armstrong
                   ` (4 preceding siblings ...)
  2018-08-01 10:04 ` [PATCH 1/5] meson_sm: add TEST_N pin direction call Neil Armstrong
@ 2018-08-03 17:10 ` Linus Walleij
  5 siblings, 0 replies; 13+ messages in thread
From: Linus Walleij @ 2018-08-03 17:10 UTC (permalink / raw)
  To: Neil Armstrong, Carlo Caione
  Cc: Kevin Hilman, open list:ARM/Amlogic Meson...,
	Linux ARM, open list:GPIO SUBSYSTEM, linux-kernel

On Wed, Aug 1, 2018 at 12:00 PM Neil Armstrong <narmstrong@baylibre.com> wrote:

> The Amlogic Meson GX and AXG SoCs needs to do a Secure Monitor call to
> set the TEST_N pin direction.
> This patchset :
> - adds the Secure Monitor call
> - adds support int the pinctrl-meson common code
> - adds support for GXBB, GXL and AGX SoCs

A lot of trouble to access a single GPIO pin (I guess _N means "active low"?)

Is this line used for something especially important? Would be nice to
include in some commit message like patch 1/5 why we invest so much
energy to accessing this pin.

Just curious. If you're just aiming for feature completion, that is a good
reason as well :D

Yours,
Linus Walleij

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

end of thread, other threads:[~2018-08-03 17:10 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-01 10:00 [PATCH 0/5] pinctrl: meson: Add support for TEST_N gpio Neil Armstrong
2018-08-01 10:00 ` [PATCH 2/5] pinctrl: meson: Add support to set direction with a secure monitor call Neil Armstrong
2018-08-01 20:23   ` Martin Blumenstingl
2018-08-02  7:52     ` Neil Armstrong
2018-08-02 11:21       ` Jerome Brunet
2018-08-02 20:42         ` Martin Blumenstingl
2018-08-03  8:10           ` Neil Armstrong
2018-08-01 10:00 ` [PATCH 3/5] meson: pinctrl-gxbb: add support for TEST_N pin Neil Armstrong
2018-08-01 10:00 ` [PATCH 4/5] meson: pinctrl-gxl: " Neil Armstrong
2018-08-01 10:00 ` [PATCH 5/5] meson: pinctrl-axg: " Neil Armstrong
2018-08-01 10:04 ` [PATCH 1/5] meson_sm: add TEST_N pin direction call Neil Armstrong
2018-08-03 17:06   ` Linus Walleij
2018-08-03 17:10 ` [PATCH 0/5] pinctrl: meson: Add support for TEST_N gpio 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).