All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix SMC layout register for sama5d2
@ 2017-07-11  7:40 ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  7:40 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel, linux-mtd
  Cc: linux-kernel, lee.jones, nicolas.ferre, alexandre.belloni,
	boris.brezillon, computersforpeace, Ludovic Desroches

Hi,

The offset of some registers of the SMC is different between sama5d3/sama5d4
and sama5d2. An helper function has been added to retrieve the correct layout
with the help of a new compatible string for sama5d2. The atmel-ebi device will
store the register layout to allow the nand controller to setup correctly the
data interface.

Ludovic Desroches (3):
  mfd: syscon: update Atmel SMC binding doc
  mfd: syscon: atmel-smc: add helper to retrieve register layout
  ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC

 .../devicetree/bindings/mfd/atmel-smc.txt          |  1 +
 arch/arm/boot/dts/sama5d2.dtsi                     |  2 +-
 drivers/memory/atmel-ebi.c                         | 13 +++--
 drivers/mfd/atmel-smc.c                            | 67 +++++++++++++++++-----
 drivers/mtd/nand/atmel/nand-controller.c           | 10 +++-
 include/linux/mfd/syscon/atmel-smc.h               | 32 ++++++++---
 6 files changed, 94 insertions(+), 31 deletions(-)

-- 
2.12.2

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

* [PATCH 0/3] Fix SMC layout register for sama5d2
@ 2017-07-11  7:40 ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  7:40 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel, linux-mtd
  Cc: linux-kernel, lee.jones, nicolas.ferre, alexandre.belloni,
	boris.brezillon, computersforpeace, Ludovic Desroches

Hi,

The offset of some registers of the SMC is different between sama5d3/sama5d4
and sama5d2. An helper function has been added to retrieve the correct layout
with the help of a new compatible string for sama5d2. The atmel-ebi device will
store the register layout to allow the nand controller to setup correctly the
data interface.

Ludovic Desroches (3):
  mfd: syscon: update Atmel SMC binding doc
  mfd: syscon: atmel-smc: add helper to retrieve register layout
  ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC

 .../devicetree/bindings/mfd/atmel-smc.txt          |  1 +
 arch/arm/boot/dts/sama5d2.dtsi                     |  2 +-
 drivers/memory/atmel-ebi.c                         | 13 +++--
 drivers/mfd/atmel-smc.c                            | 67 +++++++++++++++++-----
 drivers/mtd/nand/atmel/nand-controller.c           | 10 +++-
 include/linux/mfd/syscon/atmel-smc.h               | 32 ++++++++---
 6 files changed, 94 insertions(+), 31 deletions(-)

-- 
2.12.2

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

* [PATCH 0/3] Fix SMC layout register for sama5d2
@ 2017-07-11  7:40 ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  7:40 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

The offset of some registers of the SMC is different between sama5d3/sama5d4
and sama5d2. An helper function has been added to retrieve the correct layout
with the help of a new compatible string for sama5d2. The atmel-ebi device will
store the register layout to allow the nand controller to setup correctly the
data interface.

Ludovic Desroches (3):
  mfd: syscon: update Atmel SMC binding doc
  mfd: syscon: atmel-smc: add helper to retrieve register layout
  ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC

 .../devicetree/bindings/mfd/atmel-smc.txt          |  1 +
 arch/arm/boot/dts/sama5d2.dtsi                     |  2 +-
 drivers/memory/atmel-ebi.c                         | 13 +++--
 drivers/mfd/atmel-smc.c                            | 67 +++++++++++++++++-----
 drivers/mtd/nand/atmel/nand-controller.c           | 10 +++-
 include/linux/mfd/syscon/atmel-smc.h               | 32 ++++++++---
 6 files changed, 94 insertions(+), 31 deletions(-)

-- 
2.12.2

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

* [PATCH 1/3] mfd: syscon: update Atmel SMC binding doc
@ 2017-07-11  7:40   ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  7:40 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel, linux-mtd
  Cc: linux-kernel, lee.jones, nicolas.ferre, alexandre.belloni,
	boris.brezillon, computersforpeace, Ludovic Desroches

A new compatible string is introduced for SMC on sama5d2 to manage a
different layout of the registers.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
---
 Documentation/devicetree/bindings/mfd/atmel-smc.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/mfd/atmel-smc.txt b/Documentation/devicetree/bindings/mfd/atmel-smc.txt
index 26eeed373934..1103ce2030fb 100644
--- a/Documentation/devicetree/bindings/mfd/atmel-smc.txt
+++ b/Documentation/devicetree/bindings/mfd/atmel-smc.txt
@@ -8,6 +8,7 @@ Required properties:
 - compatible:		Should be one of the following
 			"atmel,at91sam9260-smc", "syscon"
 			"atmel,sama5d3-smc", "syscon"
+			"atmel,sama5d2-smc", "syscon"
 - reg:			Contains offset/length value of the SMC memory
 			region.
 
-- 
2.12.2

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

* [PATCH 1/3] mfd: syscon: update Atmel SMC binding doc
@ 2017-07-11  7:40   ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  7:40 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	nicolas.ferre-UWL1GkI3JZL3oGB3hsPCZA,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	computersforpeace-Re5JQEeQqe8AvxtiuMwx3w, Ludovic Desroches

A new compatible string is introduced for SMC on sama5d2 to manage a
different layout of the registers.

Signed-off-by: Ludovic Desroches <ludovic.desroches-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>
---
 Documentation/devicetree/bindings/mfd/atmel-smc.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/mfd/atmel-smc.txt b/Documentation/devicetree/bindings/mfd/atmel-smc.txt
index 26eeed373934..1103ce2030fb 100644
--- a/Documentation/devicetree/bindings/mfd/atmel-smc.txt
+++ b/Documentation/devicetree/bindings/mfd/atmel-smc.txt
@@ -8,6 +8,7 @@ Required properties:
 - compatible:		Should be one of the following
 			"atmel,at91sam9260-smc", "syscon"
 			"atmel,sama5d3-smc", "syscon"
+			"atmel,sama5d2-smc", "syscon"
 - reg:			Contains offset/length value of the SMC memory
 			region.
 
-- 
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/3] mfd: syscon: update Atmel SMC binding doc
@ 2017-07-11  7:40   ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  7:40 UTC (permalink / raw)
  To: linux-arm-kernel

A new compatible string is introduced for SMC on sama5d2 to manage a
different layout of the registers.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
---
 Documentation/devicetree/bindings/mfd/atmel-smc.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/mfd/atmel-smc.txt b/Documentation/devicetree/bindings/mfd/atmel-smc.txt
index 26eeed373934..1103ce2030fb 100644
--- a/Documentation/devicetree/bindings/mfd/atmel-smc.txt
+++ b/Documentation/devicetree/bindings/mfd/atmel-smc.txt
@@ -8,6 +8,7 @@ Required properties:
 - compatible:		Should be one of the following
 			"atmel,at91sam9260-smc", "syscon"
 			"atmel,sama5d3-smc", "syscon"
+			"atmel,sama5d2-smc", "syscon"
 - reg:			Contains offset/length value of the SMC memory
 			region.
 
-- 
2.12.2

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

* [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
  2017-07-11  7:40 ` Ludovic Desroches
  (?)
@ 2017-07-11  7:40   ` Ludovic Desroches
  -1 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  7:40 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel, linux-mtd
  Cc: linux-kernel, lee.jones, nicolas.ferre, alexandre.belloni,
	boris.brezillon, computersforpeace, Ludovic Desroches

For HSMC controller, the register layout depends on the device i.e. the
offset of setup, pulse, cycle, mode and timings registers is not the
same. An helper is added to provide the correct register layout.

Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
SMC regs manipulation")
Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
---
 drivers/memory/atmel-ebi.c               | 13 +++++--
 drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
 drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
 include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
 4 files changed, 92 insertions(+), 30 deletions(-)

diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
index 99e644cda4d1..63c9e7a76854 100644
--- a/drivers/memory/atmel-ebi.c
+++ b/drivers/memory/atmel-ebi.c
@@ -51,6 +51,7 @@ struct atmel_ebi {
 	struct  {
 		struct regmap *regmap;
 		struct clk *clk;
+		const struct atmel_hsmc_reg_layout *layout;
 	} smc;
 
 	struct device *dev;
@@ -84,8 +85,8 @@ static void at91sam9_ebi_get_config(struct atmel_ebi_dev *ebid,
 static void sama5_ebi_get_config(struct atmel_ebi_dev *ebid,
 				 struct atmel_ebi_dev_config *conf)
 {
-	atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, conf->cs,
-			       &conf->smcconf);
+	atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, ebid->ebi->smc.layout,
+			       conf->cs, &conf->smcconf);
 }
 
 static const struct atmel_smc_timing_xlate timings_xlate_table[] = {
@@ -285,8 +286,8 @@ static void at91sam9_ebi_apply_config(struct atmel_ebi_dev *ebid,
 static void sama5_ebi_apply_config(struct atmel_ebi_dev *ebid,
 				   struct atmel_ebi_dev_config *conf)
 {
-	atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, conf->cs,
-				 &conf->smcconf);
+	atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, ebid->ebi->smc.layout,
+				 conf->cs, &conf->smcconf);
 }
 
 static int atmel_ebi_dev_setup(struct atmel_ebi *ebi, struct device_node *np,
@@ -525,6 +526,10 @@ static int atmel_ebi_probe(struct platform_device *pdev)
 	if (IS_ERR(ebi->smc.regmap))
 		return PTR_ERR(ebi->smc.regmap);
 
+	ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np);
+	if (IS_ERR(ebi->smc.layout))
+		return PTR_ERR(ebi->smc.layout);
+
 	ebi->smc.clk = of_clk_get(smc_np, 0);
 	if (IS_ERR(ebi->smc.clk)) {
 		if (PTR_ERR(ebi->smc.clk) != -ENOENT)
diff --git a/drivers/mfd/atmel-smc.c b/drivers/mfd/atmel-smc.c
index 954cf0f66a31..1ad44e63b511 100644
--- a/drivers/mfd/atmel-smc.c
+++ b/drivers/mfd/atmel-smc.c
@@ -258,19 +258,21 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_apply);
  * atmel_hsmc_cs_conf_apply - apply an SMC CS conf
  * @regmap: the HSMC regmap
  * @cs: the CS id
+ * @layout: the layout of registers
  * @conf the SMC CS conf to apply
  *
  * Applies an SMC CS configuration.
  * Only valid on post-sama5 SoCs.
  */
-void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
-			      const struct atmel_smc_cs_conf *conf)
+void atmel_hsmc_cs_conf_apply(struct regmap *regmap,
+			      const struct atmel_hsmc_reg_layout *layout,
+			      int cs, const struct atmel_smc_cs_conf *conf)
 {
-	regmap_write(regmap, ATMEL_HSMC_SETUP(cs), conf->setup);
-	regmap_write(regmap, ATMEL_HSMC_PULSE(cs), conf->pulse);
-	regmap_write(regmap, ATMEL_HSMC_CYCLE(cs), conf->cycle);
-	regmap_write(regmap, ATMEL_HSMC_TIMINGS(cs), conf->timings);
-	regmap_write(regmap, ATMEL_HSMC_MODE(cs), conf->mode);
+	regmap_write(regmap, ATMEL_HSMC_SETUP(layout, cs), conf->setup);
+	regmap_write(regmap, ATMEL_HSMC_PULSE(layout, cs), conf->pulse);
+	regmap_write(regmap, ATMEL_HSMC_CYCLE(layout, cs), conf->cycle);
+	regmap_write(regmap, ATMEL_HSMC_TIMINGS(layout, cs), conf->timings);
+	regmap_write(regmap, ATMEL_HSMC_MODE(layout, cs), conf->mode);
 }
 EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_apply);
 
@@ -297,18 +299,55 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_get);
  * atmel_hsmc_cs_conf_get - retrieve the current SMC CS conf
  * @regmap: the HSMC regmap
  * @cs: the CS id
+ * @layout: the layout of registers
  * @conf: the SMC CS conf object to store the current conf
  *
  * Retrieve the SMC CS configuration.
  * Only valid on post-sama5 SoCs.
  */
-void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
-			    struct atmel_smc_cs_conf *conf)
+void atmel_hsmc_cs_conf_get(struct regmap *regmap,
+			    const struct atmel_hsmc_reg_layout *layout,
+			    int cs, struct atmel_smc_cs_conf *conf)
 {
-	regmap_read(regmap, ATMEL_HSMC_SETUP(cs), &conf->setup);
-	regmap_read(regmap, ATMEL_HSMC_PULSE(cs), &conf->pulse);
-	regmap_read(regmap, ATMEL_HSMC_CYCLE(cs), &conf->cycle);
-	regmap_read(regmap, ATMEL_HSMC_TIMINGS(cs), &conf->timings);
-	regmap_read(regmap, ATMEL_HSMC_MODE(cs), &conf->mode);
+	regmap_read(regmap, ATMEL_HSMC_SETUP(layout, cs), &conf->setup);
+	regmap_read(regmap, ATMEL_HSMC_PULSE(layout, cs), &conf->pulse);
+	regmap_read(regmap, ATMEL_HSMC_CYCLE(layout, cs), &conf->cycle);
+	regmap_read(regmap, ATMEL_HSMC_TIMINGS(layout, cs), &conf->timings);
+	regmap_read(regmap, ATMEL_HSMC_MODE(layout, cs), &conf->mode);
 }
 EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_get);
+
+static const struct atmel_hsmc_reg_layout sama5d3_reg_layout = {
+	.timing_regs_offset = 0x600,
+};
+
+static const struct atmel_hsmc_reg_layout sama5d2_reg_layout = {
+	.timing_regs_offset = 0x700,
+};
+
+static const struct of_device_id atmel_smc_ids[] = {
+	{ .compatible = "atmel,at91sam9260-smc", .data = NULL },
+	{ .compatible = "atmel,sama5d3-smc", .data = &sama5d3_reg_layout },
+	{ .compatible = "atmel,sama5d2-smc", .data = &sama5d2_reg_layout },
+	{ /* sentinel */ },
+};
+
+/**
+ * atmel_hsmc_get_reg_layout - retrieve the layout of HSMC registers
+ * @np: the HSMC regmap
+ *
+ * Retrieve the layout of HSMC registers.
+ *
+ * Returns NULL in case of SMC, a struct atmel_hsmc_reg_layout pointer
+ * in HSMC case, otherwise ERR_PTR(-EINVAL).
+ */
+const struct atmel_hsmc_reg_layout *
+atmel_hsmc_get_reg_layout(struct device_node *np)
+{
+	const struct of_device_id *match;
+
+	match = of_match_node(atmel_hsmc_ids, np);
+
+	return match ? match->data : ERR_PTR(-EINVAL);
+}
+EXPORT_SYMBOL_GPL(atmel_hsmc_get_reg_layout);
diff --git a/drivers/mtd/nand/atmel/nand-controller.c b/drivers/mtd/nand/atmel/nand-controller.c
index d922a88e407f..29396e618965 100644
--- a/drivers/mtd/nand/atmel/nand-controller.c
+++ b/drivers/mtd/nand/atmel/nand-controller.c
@@ -247,6 +247,7 @@ struct atmel_hsmc_nand_controller {
 		void __iomem *virt;
 		dma_addr_t dma;
 	} sram;
+	const struct atmel_hsmc_reg_layout *hsmc_layout;
 	struct regmap *io;
 	struct atmel_nfc_op op;
 	struct completion complete;
@@ -1431,12 +1432,12 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
 					int csline,
 					const struct nand_data_interface *conf)
 {
-	struct atmel_nand_controller *nc;
+	struct atmel_hsmc_nand_controller *nc;
 	struct atmel_smc_cs_conf smcconf;
 	struct atmel_nand_cs *cs;
 	int ret;
 
-	nc = to_nand_controller(nand->base.controller);
+	nc = to_hsmc_nand_controller(nand->base.controller);
 
 	ret = atmel_smc_nand_prepare_smcconf(nand, conf, &smcconf);
 	if (ret)
@@ -1451,7 +1452,8 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
 	if (cs->rb.type == ATMEL_NAND_NATIVE_RB)
 		cs->smcconf.timings |= ATMEL_HSMC_TIMINGS_RBNSEL(cs->rb.id);
 
-	atmel_hsmc_cs_conf_apply(nc->smc, cs->id, &cs->smcconf);
+	atmel_hsmc_cs_conf_apply(nc->base.smc, nc->hsmc_layout, cs->id,
+				 &cs->smcconf);
 
 	return 0;
 }
@@ -2166,6 +2168,8 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc)
 		return -EINVAL;
 	}
 
+	nc->hsmc_layout = atmel_hsmc_get_reg_layout(np);
+
 	nc->irq = of_irq_get(np, 0);
 	of_node_put(np);
 	if (nc->irq < 0) {
diff --git a/include/linux/mfd/syscon/atmel-smc.h b/include/linux/mfd/syscon/atmel-smc.h
index afa266169800..7a367f34b66a 100644
--- a/include/linux/mfd/syscon/atmel-smc.h
+++ b/include/linux/mfd/syscon/atmel-smc.h
@@ -15,21 +15,26 @@
 #define _LINUX_MFD_SYSCON_ATMEL_SMC_H_
 
 #include <linux/kernel.h>
+#include <linux/of.h>
 #include <linux/regmap.h>
 
 #define ATMEL_SMC_SETUP(cs)			(((cs) * 0x10))
-#define ATMEL_HSMC_SETUP(cs)			(0x600 + ((cs) * 0x14))
+#define ATMEL_HSMC_SETUP(layout, cs)		\
+	((layout)->timing_regs_offset + ((cs) * 0x14))
 #define ATMEL_SMC_PULSE(cs)			(((cs) * 0x10) + 0x4)
-#define ATMEL_HSMC_PULSE(cs)			(0x600 + ((cs) * 0x14) + 0x4)
+#define ATMEL_HSMC_PULSE(layout, cs)		\
+	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x4)
 #define ATMEL_SMC_CYCLE(cs)			(((cs) * 0x10) + 0x8)
-#define ATMEL_HSMC_CYCLE(cs)			(0x600 + ((cs) * 0x14) + 0x8)
+#define ATMEL_HSMC_CYCLE(layout, cs)			\
+	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x8)
 #define ATMEL_SMC_NWE_SHIFT			0
 #define ATMEL_SMC_NCS_WR_SHIFT			8
 #define ATMEL_SMC_NRD_SHIFT			16
 #define ATMEL_SMC_NCS_RD_SHIFT			24
 
 #define ATMEL_SMC_MODE(cs)			(((cs) * 0x10) + 0xc)
-#define ATMEL_HSMC_MODE(cs)			(0x600 + ((cs) * 0x14) + 0x10)
+#define ATMEL_HSMC_MODE(layout, cs)			\
+	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x10)
 #define ATMEL_SMC_MODE_READMODE_MASK		BIT(0)
 #define ATMEL_SMC_MODE_READMODE_NCS		(0 << 0)
 #define ATMEL_SMC_MODE_READMODE_NRD		(1 << 0)
@@ -59,7 +64,8 @@
 #define ATMEL_SMC_MODE_PS_16			(2 << 28)
 #define ATMEL_SMC_MODE_PS_32			(3 << 28)
 
-#define ATMEL_HSMC_TIMINGS(cs)			(0x600 + ((cs) * 0x14) + 0xc)
+#define ATMEL_HSMC_TIMINGS(layout, cs)			\
+	((layout)->timing_regs_offset + ((cs) * 0x14) + 0xc)
 #define ATMEL_HSMC_TIMINGS_OCMS			BIT(12)
 #define ATMEL_HSMC_TIMINGS_RBNSEL(x)		((x) << 28)
 #define ATMEL_HSMC_TIMINGS_NFSEL		BIT(31)
@@ -69,6 +75,10 @@
 #define ATMEL_HSMC_TIMINGS_TRR_SHIFT		16
 #define ATMEL_HSMC_TIMINGS_TWB_SHIFT		24
 
+struct atmel_hsmc_reg_layout {
+	unsigned int timing_regs_offset;
+};
+
 /**
  * struct atmel_smc_cs_conf - SMC CS config as described in the datasheet.
  * @setup: NCS/NWE/NRD setup timings (not applicable to at91rm9200)
@@ -98,11 +108,15 @@ int atmel_smc_cs_conf_set_cycle(struct atmel_smc_cs_conf *conf,
 				unsigned int shift, unsigned int ncycles);
 void atmel_smc_cs_conf_apply(struct regmap *regmap, int cs,
 			     const struct atmel_smc_cs_conf *conf);
-void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
-			      const struct atmel_smc_cs_conf *conf);
+void atmel_hsmc_cs_conf_apply(struct regmap *regmap,
+			      const struct atmel_hsmc_reg_layout *reglayout,
+			      int cs, const struct atmel_smc_cs_conf *conf);
 void atmel_smc_cs_conf_get(struct regmap *regmap, int cs,
 			   struct atmel_smc_cs_conf *conf);
-void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
-			    struct atmel_smc_cs_conf *conf);
+void atmel_hsmc_cs_conf_get(struct regmap *regmap,
+			    const struct atmel_hsmc_reg_layout *reglayout,
+			    int cs, struct atmel_smc_cs_conf *conf);
+const struct atmel_hsmc_reg_layout *
+atmel_hsmc_get_reg_layout(struct device_node *np);
 
 #endif /* _LINUX_MFD_SYSCON_ATMEL_SMC_H_ */
-- 
2.12.2

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

* [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
@ 2017-07-11  7:40   ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  7:40 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel, linux-mtd
  Cc: linux-kernel, lee.jones, nicolas.ferre, alexandre.belloni,
	boris.brezillon, computersforpeace, Ludovic Desroches

For HSMC controller, the register layout depends on the device i.e. the
offset of setup, pulse, cycle, mode and timings registers is not the
same. An helper is added to provide the correct register layout.

Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
SMC regs manipulation")
Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
---
 drivers/memory/atmel-ebi.c               | 13 +++++--
 drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
 drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
 include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
 4 files changed, 92 insertions(+), 30 deletions(-)

diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
index 99e644cda4d1..63c9e7a76854 100644
--- a/drivers/memory/atmel-ebi.c
+++ b/drivers/memory/atmel-ebi.c
@@ -51,6 +51,7 @@ struct atmel_ebi {
 	struct  {
 		struct regmap *regmap;
 		struct clk *clk;
+		const struct atmel_hsmc_reg_layout *layout;
 	} smc;
 
 	struct device *dev;
@@ -84,8 +85,8 @@ static void at91sam9_ebi_get_config(struct atmel_ebi_dev *ebid,
 static void sama5_ebi_get_config(struct atmel_ebi_dev *ebid,
 				 struct atmel_ebi_dev_config *conf)
 {
-	atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, conf->cs,
-			       &conf->smcconf);
+	atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, ebid->ebi->smc.layout,
+			       conf->cs, &conf->smcconf);
 }
 
 static const struct atmel_smc_timing_xlate timings_xlate_table[] = {
@@ -285,8 +286,8 @@ static void at91sam9_ebi_apply_config(struct atmel_ebi_dev *ebid,
 static void sama5_ebi_apply_config(struct atmel_ebi_dev *ebid,
 				   struct atmel_ebi_dev_config *conf)
 {
-	atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, conf->cs,
-				 &conf->smcconf);
+	atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, ebid->ebi->smc.layout,
+				 conf->cs, &conf->smcconf);
 }
 
 static int atmel_ebi_dev_setup(struct atmel_ebi *ebi, struct device_node *np,
@@ -525,6 +526,10 @@ static int atmel_ebi_probe(struct platform_device *pdev)
 	if (IS_ERR(ebi->smc.regmap))
 		return PTR_ERR(ebi->smc.regmap);
 
+	ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np);
+	if (IS_ERR(ebi->smc.layout))
+		return PTR_ERR(ebi->smc.layout);
+
 	ebi->smc.clk = of_clk_get(smc_np, 0);
 	if (IS_ERR(ebi->smc.clk)) {
 		if (PTR_ERR(ebi->smc.clk) != -ENOENT)
diff --git a/drivers/mfd/atmel-smc.c b/drivers/mfd/atmel-smc.c
index 954cf0f66a31..1ad44e63b511 100644
--- a/drivers/mfd/atmel-smc.c
+++ b/drivers/mfd/atmel-smc.c
@@ -258,19 +258,21 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_apply);
  * atmel_hsmc_cs_conf_apply - apply an SMC CS conf
  * @regmap: the HSMC regmap
  * @cs: the CS id
+ * @layout: the layout of registers
  * @conf the SMC CS conf to apply
  *
  * Applies an SMC CS configuration.
  * Only valid on post-sama5 SoCs.
  */
-void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
-			      const struct atmel_smc_cs_conf *conf)
+void atmel_hsmc_cs_conf_apply(struct regmap *regmap,
+			      const struct atmel_hsmc_reg_layout *layout,
+			      int cs, const struct atmel_smc_cs_conf *conf)
 {
-	regmap_write(regmap, ATMEL_HSMC_SETUP(cs), conf->setup);
-	regmap_write(regmap, ATMEL_HSMC_PULSE(cs), conf->pulse);
-	regmap_write(regmap, ATMEL_HSMC_CYCLE(cs), conf->cycle);
-	regmap_write(regmap, ATMEL_HSMC_TIMINGS(cs), conf->timings);
-	regmap_write(regmap, ATMEL_HSMC_MODE(cs), conf->mode);
+	regmap_write(regmap, ATMEL_HSMC_SETUP(layout, cs), conf->setup);
+	regmap_write(regmap, ATMEL_HSMC_PULSE(layout, cs), conf->pulse);
+	regmap_write(regmap, ATMEL_HSMC_CYCLE(layout, cs), conf->cycle);
+	regmap_write(regmap, ATMEL_HSMC_TIMINGS(layout, cs), conf->timings);
+	regmap_write(regmap, ATMEL_HSMC_MODE(layout, cs), conf->mode);
 }
 EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_apply);
 
@@ -297,18 +299,55 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_get);
  * atmel_hsmc_cs_conf_get - retrieve the current SMC CS conf
  * @regmap: the HSMC regmap
  * @cs: the CS id
+ * @layout: the layout of registers
  * @conf: the SMC CS conf object to store the current conf
  *
  * Retrieve the SMC CS configuration.
  * Only valid on post-sama5 SoCs.
  */
-void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
-			    struct atmel_smc_cs_conf *conf)
+void atmel_hsmc_cs_conf_get(struct regmap *regmap,
+			    const struct atmel_hsmc_reg_layout *layout,
+			    int cs, struct atmel_smc_cs_conf *conf)
 {
-	regmap_read(regmap, ATMEL_HSMC_SETUP(cs), &conf->setup);
-	regmap_read(regmap, ATMEL_HSMC_PULSE(cs), &conf->pulse);
-	regmap_read(regmap, ATMEL_HSMC_CYCLE(cs), &conf->cycle);
-	regmap_read(regmap, ATMEL_HSMC_TIMINGS(cs), &conf->timings);
-	regmap_read(regmap, ATMEL_HSMC_MODE(cs), &conf->mode);
+	regmap_read(regmap, ATMEL_HSMC_SETUP(layout, cs), &conf->setup);
+	regmap_read(regmap, ATMEL_HSMC_PULSE(layout, cs), &conf->pulse);
+	regmap_read(regmap, ATMEL_HSMC_CYCLE(layout, cs), &conf->cycle);
+	regmap_read(regmap, ATMEL_HSMC_TIMINGS(layout, cs), &conf->timings);
+	regmap_read(regmap, ATMEL_HSMC_MODE(layout, cs), &conf->mode);
 }
 EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_get);
+
+static const struct atmel_hsmc_reg_layout sama5d3_reg_layout = {
+	.timing_regs_offset = 0x600,
+};
+
+static const struct atmel_hsmc_reg_layout sama5d2_reg_layout = {
+	.timing_regs_offset = 0x700,
+};
+
+static const struct of_device_id atmel_smc_ids[] = {
+	{ .compatible = "atmel,at91sam9260-smc", .data = NULL },
+	{ .compatible = "atmel,sama5d3-smc", .data = &sama5d3_reg_layout },
+	{ .compatible = "atmel,sama5d2-smc", .data = &sama5d2_reg_layout },
+	{ /* sentinel */ },
+};
+
+/**
+ * atmel_hsmc_get_reg_layout - retrieve the layout of HSMC registers
+ * @np: the HSMC regmap
+ *
+ * Retrieve the layout of HSMC registers.
+ *
+ * Returns NULL in case of SMC, a struct atmel_hsmc_reg_layout pointer
+ * in HSMC case, otherwise ERR_PTR(-EINVAL).
+ */
+const struct atmel_hsmc_reg_layout *
+atmel_hsmc_get_reg_layout(struct device_node *np)
+{
+	const struct of_device_id *match;
+
+	match = of_match_node(atmel_hsmc_ids, np);
+
+	return match ? match->data : ERR_PTR(-EINVAL);
+}
+EXPORT_SYMBOL_GPL(atmel_hsmc_get_reg_layout);
diff --git a/drivers/mtd/nand/atmel/nand-controller.c b/drivers/mtd/nand/atmel/nand-controller.c
index d922a88e407f..29396e618965 100644
--- a/drivers/mtd/nand/atmel/nand-controller.c
+++ b/drivers/mtd/nand/atmel/nand-controller.c
@@ -247,6 +247,7 @@ struct atmel_hsmc_nand_controller {
 		void __iomem *virt;
 		dma_addr_t dma;
 	} sram;
+	const struct atmel_hsmc_reg_layout *hsmc_layout;
 	struct regmap *io;
 	struct atmel_nfc_op op;
 	struct completion complete;
@@ -1431,12 +1432,12 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
 					int csline,
 					const struct nand_data_interface *conf)
 {
-	struct atmel_nand_controller *nc;
+	struct atmel_hsmc_nand_controller *nc;
 	struct atmel_smc_cs_conf smcconf;
 	struct atmel_nand_cs *cs;
 	int ret;
 
-	nc = to_nand_controller(nand->base.controller);
+	nc = to_hsmc_nand_controller(nand->base.controller);
 
 	ret = atmel_smc_nand_prepare_smcconf(nand, conf, &smcconf);
 	if (ret)
@@ -1451,7 +1452,8 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
 	if (cs->rb.type == ATMEL_NAND_NATIVE_RB)
 		cs->smcconf.timings |= ATMEL_HSMC_TIMINGS_RBNSEL(cs->rb.id);
 
-	atmel_hsmc_cs_conf_apply(nc->smc, cs->id, &cs->smcconf);
+	atmel_hsmc_cs_conf_apply(nc->base.smc, nc->hsmc_layout, cs->id,
+				 &cs->smcconf);
 
 	return 0;
 }
@@ -2166,6 +2168,8 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc)
 		return -EINVAL;
 	}
 
+	nc->hsmc_layout = atmel_hsmc_get_reg_layout(np);
+
 	nc->irq = of_irq_get(np, 0);
 	of_node_put(np);
 	if (nc->irq < 0) {
diff --git a/include/linux/mfd/syscon/atmel-smc.h b/include/linux/mfd/syscon/atmel-smc.h
index afa266169800..7a367f34b66a 100644
--- a/include/linux/mfd/syscon/atmel-smc.h
+++ b/include/linux/mfd/syscon/atmel-smc.h
@@ -15,21 +15,26 @@
 #define _LINUX_MFD_SYSCON_ATMEL_SMC_H_
 
 #include <linux/kernel.h>
+#include <linux/of.h>
 #include <linux/regmap.h>
 
 #define ATMEL_SMC_SETUP(cs)			(((cs) * 0x10))
-#define ATMEL_HSMC_SETUP(cs)			(0x600 + ((cs) * 0x14))
+#define ATMEL_HSMC_SETUP(layout, cs)		\
+	((layout)->timing_regs_offset + ((cs) * 0x14))
 #define ATMEL_SMC_PULSE(cs)			(((cs) * 0x10) + 0x4)
-#define ATMEL_HSMC_PULSE(cs)			(0x600 + ((cs) * 0x14) + 0x4)
+#define ATMEL_HSMC_PULSE(layout, cs)		\
+	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x4)
 #define ATMEL_SMC_CYCLE(cs)			(((cs) * 0x10) + 0x8)
-#define ATMEL_HSMC_CYCLE(cs)			(0x600 + ((cs) * 0x14) + 0x8)
+#define ATMEL_HSMC_CYCLE(layout, cs)			\
+	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x8)
 #define ATMEL_SMC_NWE_SHIFT			0
 #define ATMEL_SMC_NCS_WR_SHIFT			8
 #define ATMEL_SMC_NRD_SHIFT			16
 #define ATMEL_SMC_NCS_RD_SHIFT			24
 
 #define ATMEL_SMC_MODE(cs)			(((cs) * 0x10) + 0xc)
-#define ATMEL_HSMC_MODE(cs)			(0x600 + ((cs) * 0x14) + 0x10)
+#define ATMEL_HSMC_MODE(layout, cs)			\
+	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x10)
 #define ATMEL_SMC_MODE_READMODE_MASK		BIT(0)
 #define ATMEL_SMC_MODE_READMODE_NCS		(0 << 0)
 #define ATMEL_SMC_MODE_READMODE_NRD		(1 << 0)
@@ -59,7 +64,8 @@
 #define ATMEL_SMC_MODE_PS_16			(2 << 28)
 #define ATMEL_SMC_MODE_PS_32			(3 << 28)
 
-#define ATMEL_HSMC_TIMINGS(cs)			(0x600 + ((cs) * 0x14) + 0xc)
+#define ATMEL_HSMC_TIMINGS(layout, cs)			\
+	((layout)->timing_regs_offset + ((cs) * 0x14) + 0xc)
 #define ATMEL_HSMC_TIMINGS_OCMS			BIT(12)
 #define ATMEL_HSMC_TIMINGS_RBNSEL(x)		((x) << 28)
 #define ATMEL_HSMC_TIMINGS_NFSEL		BIT(31)
@@ -69,6 +75,10 @@
 #define ATMEL_HSMC_TIMINGS_TRR_SHIFT		16
 #define ATMEL_HSMC_TIMINGS_TWB_SHIFT		24
 
+struct atmel_hsmc_reg_layout {
+	unsigned int timing_regs_offset;
+};
+
 /**
  * struct atmel_smc_cs_conf - SMC CS config as described in the datasheet.
  * @setup: NCS/NWE/NRD setup timings (not applicable to at91rm9200)
@@ -98,11 +108,15 @@ int atmel_smc_cs_conf_set_cycle(struct atmel_smc_cs_conf *conf,
 				unsigned int shift, unsigned int ncycles);
 void atmel_smc_cs_conf_apply(struct regmap *regmap, int cs,
 			     const struct atmel_smc_cs_conf *conf);
-void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
-			      const struct atmel_smc_cs_conf *conf);
+void atmel_hsmc_cs_conf_apply(struct regmap *regmap,
+			      const struct atmel_hsmc_reg_layout *reglayout,
+			      int cs, const struct atmel_smc_cs_conf *conf);
 void atmel_smc_cs_conf_get(struct regmap *regmap, int cs,
 			   struct atmel_smc_cs_conf *conf);
-void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
-			    struct atmel_smc_cs_conf *conf);
+void atmel_hsmc_cs_conf_get(struct regmap *regmap,
+			    const struct atmel_hsmc_reg_layout *reglayout,
+			    int cs, struct atmel_smc_cs_conf *conf);
+const struct atmel_hsmc_reg_layout *
+atmel_hsmc_get_reg_layout(struct device_node *np);
 
 #endif /* _LINUX_MFD_SYSCON_ATMEL_SMC_H_ */
-- 
2.12.2

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

* [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
@ 2017-07-11  7:40   ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  7:40 UTC (permalink / raw)
  To: linux-arm-kernel

For HSMC controller, the register layout depends on the device i.e. the
offset of setup, pulse, cycle, mode and timings registers is not the
same. An helper is added to provide the correct register layout.

Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
SMC regs manipulation")
Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
---
 drivers/memory/atmel-ebi.c               | 13 +++++--
 drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
 drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
 include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
 4 files changed, 92 insertions(+), 30 deletions(-)

diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
index 99e644cda4d1..63c9e7a76854 100644
--- a/drivers/memory/atmel-ebi.c
+++ b/drivers/memory/atmel-ebi.c
@@ -51,6 +51,7 @@ struct atmel_ebi {
 	struct  {
 		struct regmap *regmap;
 		struct clk *clk;
+		const struct atmel_hsmc_reg_layout *layout;
 	} smc;
 
 	struct device *dev;
@@ -84,8 +85,8 @@ static void at91sam9_ebi_get_config(struct atmel_ebi_dev *ebid,
 static void sama5_ebi_get_config(struct atmel_ebi_dev *ebid,
 				 struct atmel_ebi_dev_config *conf)
 {
-	atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, conf->cs,
-			       &conf->smcconf);
+	atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, ebid->ebi->smc.layout,
+			       conf->cs, &conf->smcconf);
 }
 
 static const struct atmel_smc_timing_xlate timings_xlate_table[] = {
@@ -285,8 +286,8 @@ static void at91sam9_ebi_apply_config(struct atmel_ebi_dev *ebid,
 static void sama5_ebi_apply_config(struct atmel_ebi_dev *ebid,
 				   struct atmel_ebi_dev_config *conf)
 {
-	atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, conf->cs,
-				 &conf->smcconf);
+	atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, ebid->ebi->smc.layout,
+				 conf->cs, &conf->smcconf);
 }
 
 static int atmel_ebi_dev_setup(struct atmel_ebi *ebi, struct device_node *np,
@@ -525,6 +526,10 @@ static int atmel_ebi_probe(struct platform_device *pdev)
 	if (IS_ERR(ebi->smc.regmap))
 		return PTR_ERR(ebi->smc.regmap);
 
+	ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np);
+	if (IS_ERR(ebi->smc.layout))
+		return PTR_ERR(ebi->smc.layout);
+
 	ebi->smc.clk = of_clk_get(smc_np, 0);
 	if (IS_ERR(ebi->smc.clk)) {
 		if (PTR_ERR(ebi->smc.clk) != -ENOENT)
diff --git a/drivers/mfd/atmel-smc.c b/drivers/mfd/atmel-smc.c
index 954cf0f66a31..1ad44e63b511 100644
--- a/drivers/mfd/atmel-smc.c
+++ b/drivers/mfd/atmel-smc.c
@@ -258,19 +258,21 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_apply);
  * atmel_hsmc_cs_conf_apply - apply an SMC CS conf
  * @regmap: the HSMC regmap
  * @cs: the CS id
+ * @layout: the layout of registers
  * @conf the SMC CS conf to apply
  *
  * Applies an SMC CS configuration.
  * Only valid on post-sama5 SoCs.
  */
-void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
-			      const struct atmel_smc_cs_conf *conf)
+void atmel_hsmc_cs_conf_apply(struct regmap *regmap,
+			      const struct atmel_hsmc_reg_layout *layout,
+			      int cs, const struct atmel_smc_cs_conf *conf)
 {
-	regmap_write(regmap, ATMEL_HSMC_SETUP(cs), conf->setup);
-	regmap_write(regmap, ATMEL_HSMC_PULSE(cs), conf->pulse);
-	regmap_write(regmap, ATMEL_HSMC_CYCLE(cs), conf->cycle);
-	regmap_write(regmap, ATMEL_HSMC_TIMINGS(cs), conf->timings);
-	regmap_write(regmap, ATMEL_HSMC_MODE(cs), conf->mode);
+	regmap_write(regmap, ATMEL_HSMC_SETUP(layout, cs), conf->setup);
+	regmap_write(regmap, ATMEL_HSMC_PULSE(layout, cs), conf->pulse);
+	regmap_write(regmap, ATMEL_HSMC_CYCLE(layout, cs), conf->cycle);
+	regmap_write(regmap, ATMEL_HSMC_TIMINGS(layout, cs), conf->timings);
+	regmap_write(regmap, ATMEL_HSMC_MODE(layout, cs), conf->mode);
 }
 EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_apply);
 
@@ -297,18 +299,55 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_get);
  * atmel_hsmc_cs_conf_get - retrieve the current SMC CS conf
  * @regmap: the HSMC regmap
  * @cs: the CS id
+ * @layout: the layout of registers
  * @conf: the SMC CS conf object to store the current conf
  *
  * Retrieve the SMC CS configuration.
  * Only valid on post-sama5 SoCs.
  */
-void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
-			    struct atmel_smc_cs_conf *conf)
+void atmel_hsmc_cs_conf_get(struct regmap *regmap,
+			    const struct atmel_hsmc_reg_layout *layout,
+			    int cs, struct atmel_smc_cs_conf *conf)
 {
-	regmap_read(regmap, ATMEL_HSMC_SETUP(cs), &conf->setup);
-	regmap_read(regmap, ATMEL_HSMC_PULSE(cs), &conf->pulse);
-	regmap_read(regmap, ATMEL_HSMC_CYCLE(cs), &conf->cycle);
-	regmap_read(regmap, ATMEL_HSMC_TIMINGS(cs), &conf->timings);
-	regmap_read(regmap, ATMEL_HSMC_MODE(cs), &conf->mode);
+	regmap_read(regmap, ATMEL_HSMC_SETUP(layout, cs), &conf->setup);
+	regmap_read(regmap, ATMEL_HSMC_PULSE(layout, cs), &conf->pulse);
+	regmap_read(regmap, ATMEL_HSMC_CYCLE(layout, cs), &conf->cycle);
+	regmap_read(regmap, ATMEL_HSMC_TIMINGS(layout, cs), &conf->timings);
+	regmap_read(regmap, ATMEL_HSMC_MODE(layout, cs), &conf->mode);
 }
 EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_get);
+
+static const struct atmel_hsmc_reg_layout sama5d3_reg_layout = {
+	.timing_regs_offset = 0x600,
+};
+
+static const struct atmel_hsmc_reg_layout sama5d2_reg_layout = {
+	.timing_regs_offset = 0x700,
+};
+
+static const struct of_device_id atmel_smc_ids[] = {
+	{ .compatible = "atmel,at91sam9260-smc", .data = NULL },
+	{ .compatible = "atmel,sama5d3-smc", .data = &sama5d3_reg_layout },
+	{ .compatible = "atmel,sama5d2-smc", .data = &sama5d2_reg_layout },
+	{ /* sentinel */ },
+};
+
+/**
+ * atmel_hsmc_get_reg_layout - retrieve the layout of HSMC registers
+ * @np: the HSMC regmap
+ *
+ * Retrieve the layout of HSMC registers.
+ *
+ * Returns NULL in case of SMC, a struct atmel_hsmc_reg_layout pointer
+ * in HSMC case, otherwise ERR_PTR(-EINVAL).
+ */
+const struct atmel_hsmc_reg_layout *
+atmel_hsmc_get_reg_layout(struct device_node *np)
+{
+	const struct of_device_id *match;
+
+	match = of_match_node(atmel_hsmc_ids, np);
+
+	return match ? match->data : ERR_PTR(-EINVAL);
+}
+EXPORT_SYMBOL_GPL(atmel_hsmc_get_reg_layout);
diff --git a/drivers/mtd/nand/atmel/nand-controller.c b/drivers/mtd/nand/atmel/nand-controller.c
index d922a88e407f..29396e618965 100644
--- a/drivers/mtd/nand/atmel/nand-controller.c
+++ b/drivers/mtd/nand/atmel/nand-controller.c
@@ -247,6 +247,7 @@ struct atmel_hsmc_nand_controller {
 		void __iomem *virt;
 		dma_addr_t dma;
 	} sram;
+	const struct atmel_hsmc_reg_layout *hsmc_layout;
 	struct regmap *io;
 	struct atmel_nfc_op op;
 	struct completion complete;
@@ -1431,12 +1432,12 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
 					int csline,
 					const struct nand_data_interface *conf)
 {
-	struct atmel_nand_controller *nc;
+	struct atmel_hsmc_nand_controller *nc;
 	struct atmel_smc_cs_conf smcconf;
 	struct atmel_nand_cs *cs;
 	int ret;
 
-	nc = to_nand_controller(nand->base.controller);
+	nc = to_hsmc_nand_controller(nand->base.controller);
 
 	ret = atmel_smc_nand_prepare_smcconf(nand, conf, &smcconf);
 	if (ret)
@@ -1451,7 +1452,8 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
 	if (cs->rb.type == ATMEL_NAND_NATIVE_RB)
 		cs->smcconf.timings |= ATMEL_HSMC_TIMINGS_RBNSEL(cs->rb.id);
 
-	atmel_hsmc_cs_conf_apply(nc->smc, cs->id, &cs->smcconf);
+	atmel_hsmc_cs_conf_apply(nc->base.smc, nc->hsmc_layout, cs->id,
+				 &cs->smcconf);
 
 	return 0;
 }
@@ -2166,6 +2168,8 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc)
 		return -EINVAL;
 	}
 
+	nc->hsmc_layout = atmel_hsmc_get_reg_layout(np);
+
 	nc->irq = of_irq_get(np, 0);
 	of_node_put(np);
 	if (nc->irq < 0) {
diff --git a/include/linux/mfd/syscon/atmel-smc.h b/include/linux/mfd/syscon/atmel-smc.h
index afa266169800..7a367f34b66a 100644
--- a/include/linux/mfd/syscon/atmel-smc.h
+++ b/include/linux/mfd/syscon/atmel-smc.h
@@ -15,21 +15,26 @@
 #define _LINUX_MFD_SYSCON_ATMEL_SMC_H_
 
 #include <linux/kernel.h>
+#include <linux/of.h>
 #include <linux/regmap.h>
 
 #define ATMEL_SMC_SETUP(cs)			(((cs) * 0x10))
-#define ATMEL_HSMC_SETUP(cs)			(0x600 + ((cs) * 0x14))
+#define ATMEL_HSMC_SETUP(layout, cs)		\
+	((layout)->timing_regs_offset + ((cs) * 0x14))
 #define ATMEL_SMC_PULSE(cs)			(((cs) * 0x10) + 0x4)
-#define ATMEL_HSMC_PULSE(cs)			(0x600 + ((cs) * 0x14) + 0x4)
+#define ATMEL_HSMC_PULSE(layout, cs)		\
+	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x4)
 #define ATMEL_SMC_CYCLE(cs)			(((cs) * 0x10) + 0x8)
-#define ATMEL_HSMC_CYCLE(cs)			(0x600 + ((cs) * 0x14) + 0x8)
+#define ATMEL_HSMC_CYCLE(layout, cs)			\
+	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x8)
 #define ATMEL_SMC_NWE_SHIFT			0
 #define ATMEL_SMC_NCS_WR_SHIFT			8
 #define ATMEL_SMC_NRD_SHIFT			16
 #define ATMEL_SMC_NCS_RD_SHIFT			24
 
 #define ATMEL_SMC_MODE(cs)			(((cs) * 0x10) + 0xc)
-#define ATMEL_HSMC_MODE(cs)			(0x600 + ((cs) * 0x14) + 0x10)
+#define ATMEL_HSMC_MODE(layout, cs)			\
+	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x10)
 #define ATMEL_SMC_MODE_READMODE_MASK		BIT(0)
 #define ATMEL_SMC_MODE_READMODE_NCS		(0 << 0)
 #define ATMEL_SMC_MODE_READMODE_NRD		(1 << 0)
@@ -59,7 +64,8 @@
 #define ATMEL_SMC_MODE_PS_16			(2 << 28)
 #define ATMEL_SMC_MODE_PS_32			(3 << 28)
 
-#define ATMEL_HSMC_TIMINGS(cs)			(0x600 + ((cs) * 0x14) + 0xc)
+#define ATMEL_HSMC_TIMINGS(layout, cs)			\
+	((layout)->timing_regs_offset + ((cs) * 0x14) + 0xc)
 #define ATMEL_HSMC_TIMINGS_OCMS			BIT(12)
 #define ATMEL_HSMC_TIMINGS_RBNSEL(x)		((x) << 28)
 #define ATMEL_HSMC_TIMINGS_NFSEL		BIT(31)
@@ -69,6 +75,10 @@
 #define ATMEL_HSMC_TIMINGS_TRR_SHIFT		16
 #define ATMEL_HSMC_TIMINGS_TWB_SHIFT		24
 
+struct atmel_hsmc_reg_layout {
+	unsigned int timing_regs_offset;
+};
+
 /**
  * struct atmel_smc_cs_conf - SMC CS config as described in the datasheet.
  * @setup: NCS/NWE/NRD setup timings (not applicable to at91rm9200)
@@ -98,11 +108,15 @@ int atmel_smc_cs_conf_set_cycle(struct atmel_smc_cs_conf *conf,
 				unsigned int shift, unsigned int ncycles);
 void atmel_smc_cs_conf_apply(struct regmap *regmap, int cs,
 			     const struct atmel_smc_cs_conf *conf);
-void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
-			      const struct atmel_smc_cs_conf *conf);
+void atmel_hsmc_cs_conf_apply(struct regmap *regmap,
+			      const struct atmel_hsmc_reg_layout *reglayout,
+			      int cs, const struct atmel_smc_cs_conf *conf);
 void atmel_smc_cs_conf_get(struct regmap *regmap, int cs,
 			   struct atmel_smc_cs_conf *conf);
-void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
-			    struct atmel_smc_cs_conf *conf);
+void atmel_hsmc_cs_conf_get(struct regmap *regmap,
+			    const struct atmel_hsmc_reg_layout *reglayout,
+			    int cs, struct atmel_smc_cs_conf *conf);
+const struct atmel_hsmc_reg_layout *
+atmel_hsmc_get_reg_layout(struct device_node *np);
 
 #endif /* _LINUX_MFD_SYSCON_ATMEL_SMC_H_ */
-- 
2.12.2

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

* [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
  2017-07-11  7:40 ` Ludovic Desroches
  (?)
@ 2017-07-11  7:40   ` Ludovic Desroches
  -1 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  7:40 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel, linux-mtd
  Cc: linux-kernel, lee.jones, nicolas.ferre, alexandre.belloni,
	boris.brezillon, computersforpeace, Ludovic Desroches

A new compatible string has been introduced for sama5d2 SMC to allow to
manage the registers mapping change.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
---
 arch/arm/boot/dts/sama5d2.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
index 4fcd5bb219e3..60e69aeacbdb 100644
--- a/arch/arm/boot/dts/sama5d2.dtsi
+++ b/arch/arm/boot/dts/sama5d2.dtsi
@@ -1048,7 +1048,7 @@
 			};
 
 			hsmc: hsmc@f8014000 {
-				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
+				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
 				reg = <0xf8014000 0x1000>;
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
 				clocks = <&hsmc_clk>;
-- 
2.12.2

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

* [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-11  7:40   ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  7:40 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel, linux-mtd
  Cc: linux-kernel, lee.jones, nicolas.ferre, alexandre.belloni,
	boris.brezillon, computersforpeace, Ludovic Desroches

A new compatible string has been introduced for sama5d2 SMC to allow to
manage the registers mapping change.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
---
 arch/arm/boot/dts/sama5d2.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
index 4fcd5bb219e3..60e69aeacbdb 100644
--- a/arch/arm/boot/dts/sama5d2.dtsi
+++ b/arch/arm/boot/dts/sama5d2.dtsi
@@ -1048,7 +1048,7 @@
 			};
 
 			hsmc: hsmc@f8014000 {
-				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
+				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
 				reg = <0xf8014000 0x1000>;
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
 				clocks = <&hsmc_clk>;
-- 
2.12.2

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

* [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-11  7:40   ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  7:40 UTC (permalink / raw)
  To: linux-arm-kernel

A new compatible string has been introduced for sama5d2 SMC to allow to
manage the registers mapping change.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
---
 arch/arm/boot/dts/sama5d2.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
index 4fcd5bb219e3..60e69aeacbdb 100644
--- a/arch/arm/boot/dts/sama5d2.dtsi
+++ b/arch/arm/boot/dts/sama5d2.dtsi
@@ -1048,7 +1048,7 @@
 			};
 
 			hsmc: hsmc at f8014000 {
-				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
+				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
 				reg = <0xf8014000 0x1000>;
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
 				clocks = <&hsmc_clk>;
-- 
2.12.2

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

* Re: [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-11  7:52     ` Nicolas Ferre
  0 siblings, 0 replies; 57+ messages in thread
From: Nicolas Ferre @ 2017-07-11  7:52 UTC (permalink / raw)
  To: Ludovic Desroches, devicetree, linux-arm-kernel, linux-mtd
  Cc: linux-kernel, lee.jones, alexandre.belloni, boris.brezillon,
	computersforpeace

On 11/07/2017 at 09:40, Ludovic Desroches wrote:
> A new compatible string has been introduced for sama5d2 SMC to allow to
> manage the registers mapping change.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> ---
>  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> index 4fcd5bb219e3..60e69aeacbdb 100644
> --- a/arch/arm/boot/dts/sama5d2.dtsi
> +++ b/arch/arm/boot/dts/sama5d2.dtsi
> @@ -1048,7 +1048,7 @@
>  			};
>  
>  			hsmc: hsmc@f8014000 {
> -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
> +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";

You'd better use something like:
 compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";

So that this patch is independent from the rest of the series and
we can avoid to having to synchronize with mfd or mtd/nand for this part.

Regards,

>  				reg = <0xf8014000 0x1000>;
>  				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
>  				clocks = <&hsmc_clk>;
> 


-- 
Nicolas Ferre

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

* Re: [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-11  7:52     ` Nicolas Ferre
  0 siblings, 0 replies; 57+ messages in thread
From: Nicolas Ferre @ 2017-07-11  7:52 UTC (permalink / raw)
  To: Ludovic Desroches, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	computersforpeace-Re5JQEeQqe8AvxtiuMwx3w

On 11/07/2017 at 09:40, Ludovic Desroches wrote:
> A new compatible string has been introduced for sama5d2 SMC to allow to
> manage the registers mapping change.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>
> ---
>  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> index 4fcd5bb219e3..60e69aeacbdb 100644
> --- a/arch/arm/boot/dts/sama5d2.dtsi
> +++ b/arch/arm/boot/dts/sama5d2.dtsi
> @@ -1048,7 +1048,7 @@
>  			};
>  
>  			hsmc: hsmc@f8014000 {
> -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
> +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";

You'd better use something like:
 compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";

So that this patch is independent from the rest of the series and
we can avoid to having to synchronize with mfd or mtd/nand for this part.

Regards,

>  				reg = <0xf8014000 0x1000>;
>  				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
>  				clocks = <&hsmc_clk>;
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-11  7:52     ` Nicolas Ferre
  0 siblings, 0 replies; 57+ messages in thread
From: Nicolas Ferre @ 2017-07-11  7:52 UTC (permalink / raw)
  To: linux-arm-kernel

On 11/07/2017 at 09:40, Ludovic Desroches wrote:
> A new compatible string has been introduced for sama5d2 SMC to allow to
> manage the registers mapping change.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> ---
>  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> index 4fcd5bb219e3..60e69aeacbdb 100644
> --- a/arch/arm/boot/dts/sama5d2.dtsi
> +++ b/arch/arm/boot/dts/sama5d2.dtsi
> @@ -1048,7 +1048,7 @@
>  			};
>  
>  			hsmc: hsmc at f8014000 {
> -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
> +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";

You'd better use something like:
 compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";

So that this patch is independent from the rest of the series and
we can avoid to having to synchronize with mfd or mtd/nand for this part.

Regards,

>  				reg = <0xf8014000 0x1000>;
>  				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
>  				clocks = <&hsmc_clk>;
> 


-- 
Nicolas Ferre

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

* Re: [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
  2017-07-11  7:52     ` Nicolas Ferre
  (?)
@ 2017-07-11  7:58       ` Ludovic Desroches
  -1 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  7:58 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Ludovic Desroches, devicetree, linux-arm-kernel, linux-mtd,
	linux-kernel, lee.jones, alexandre.belloni, boris.brezillon,
	computersforpeace

On Tue, Jul 11, 2017 at 09:52:58AM +0200, Nicolas Ferre wrote:
> On 11/07/2017 at 09:40, Ludovic Desroches wrote:
> > A new compatible string has been introduced for sama5d2 SMC to allow to
> > manage the registers mapping change.
> > 
> > Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > ---
> >  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> > index 4fcd5bb219e3..60e69aeacbdb 100644
> > --- a/arch/arm/boot/dts/sama5d2.dtsi
> > +++ b/arch/arm/boot/dts/sama5d2.dtsi
> > @@ -1048,7 +1048,7 @@
> >  			};
> >  
> >  			hsmc: hsmc@f8014000 {
> > -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
> 
> You'd better use something like:
>  compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";

But it's not true, during data interface setup, we will write values in
the wrong place if we fallback on "atmel,sama5d3-smc".

Regards

Ludovic

> 
> So that this patch is independent from the rest of the series and
> we can avoid to having to synchronize with mfd or mtd/nand for this part.
> 
> Regards,
> 
> >  				reg = <0xf8014000 0x1000>;
> >  				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
> >  				clocks = <&hsmc_clk>;
> > 
> 
> 
> -- 
> Nicolas Ferre

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

* Re: [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-11  7:58       ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  7:58 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Ludovic Desroches, devicetree, linux-arm-kernel, linux-mtd,
	linux-kernel, lee.jones, alexandre.belloni, boris.brezillon,
	computersforpeace

On Tue, Jul 11, 2017 at 09:52:58AM +0200, Nicolas Ferre wrote:
> On 11/07/2017 at 09:40, Ludovic Desroches wrote:
> > A new compatible string has been introduced for sama5d2 SMC to allow to
> > manage the registers mapping change.
> > 
> > Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > ---
> >  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> > index 4fcd5bb219e3..60e69aeacbdb 100644
> > --- a/arch/arm/boot/dts/sama5d2.dtsi
> > +++ b/arch/arm/boot/dts/sama5d2.dtsi
> > @@ -1048,7 +1048,7 @@
> >  			};
> >  
> >  			hsmc: hsmc@f8014000 {
> > -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
> 
> You'd better use something like:
>  compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";

But it's not true, during data interface setup, we will write values in
the wrong place if we fallback on "atmel,sama5d3-smc".

Regards

Ludovic

> 
> So that this patch is independent from the rest of the series and
> we can avoid to having to synchronize with mfd or mtd/nand for this part.
> 
> Regards,
> 
> >  				reg = <0xf8014000 0x1000>;
> >  				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
> >  				clocks = <&hsmc_clk>;
> > 
> 
> 
> -- 
> Nicolas Ferre

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

* [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-11  7:58       ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  7:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jul 11, 2017 at 09:52:58AM +0200, Nicolas Ferre wrote:
> On 11/07/2017 at 09:40, Ludovic Desroches wrote:
> > A new compatible string has been introduced for sama5d2 SMC to allow to
> > manage the registers mapping change.
> > 
> > Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > ---
> >  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> > index 4fcd5bb219e3..60e69aeacbdb 100644
> > --- a/arch/arm/boot/dts/sama5d2.dtsi
> > +++ b/arch/arm/boot/dts/sama5d2.dtsi
> > @@ -1048,7 +1048,7 @@
> >  			};
> >  
> >  			hsmc: hsmc at f8014000 {
> > -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
> 
> You'd better use something like:
>  compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";

But it's not true, during data interface setup, we will write values in
the wrong place if we fallback on "atmel,sama5d3-smc".

Regards

Ludovic

> 
> So that this patch is independent from the rest of the series and
> we can avoid to having to synchronize with mfd or mtd/nand for this part.
> 
> Regards,
> 
> >  				reg = <0xf8014000 0x1000>;
> >  				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
> >  				clocks = <&hsmc_clk>;
> > 
> 
> 
> -- 
> Nicolas Ferre

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

* Re: [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-11  8:07         ` Nicolas Ferre
  0 siblings, 0 replies; 57+ messages in thread
From: Nicolas Ferre @ 2017-07-11  8:07 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel, linux-mtd, linux-kernel, lee.jones,
	alexandre.belloni, boris.brezillon, computersforpeace

On 11/07/2017 at 09:58, Ludovic Desroches wrote:
> On Tue, Jul 11, 2017 at 09:52:58AM +0200, Nicolas Ferre wrote:
>> On 11/07/2017 at 09:40, Ludovic Desroches wrote:
>>> A new compatible string has been introduced for sama5d2 SMC to allow to
>>> manage the registers mapping change.
>>>
>>> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
>>> ---
>>>  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
>>> index 4fcd5bb219e3..60e69aeacbdb 100644
>>> --- a/arch/arm/boot/dts/sama5d2.dtsi
>>> +++ b/arch/arm/boot/dts/sama5d2.dtsi
>>> @@ -1048,7 +1048,7 @@
>>>  			};
>>>  
>>>  			hsmc: hsmc@f8014000 {
>>> -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
>>> +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
>>
>> You'd better use something like:
>>  compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";
> 
> But it's not true, during data interface setup, we will write values in
> the wrong place if we fallback on "atmel,sama5d3-smc".

Yes, I wrote too quickly: sorry for the noise ;-)

Bye,


>> So that this patch is independent from the rest of the series and
>> we can avoid to having to synchronize with mfd or mtd/nand for this part.
>>
>> Regards,
>>
>>>  				reg = <0xf8014000 0x1000>;
>>>  				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
>>>  				clocks = <&hsmc_clk>;
>>>
>>
>>
>> -- 
>> Nicolas Ferre
> 


-- 
Nicolas Ferre

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

* Re: [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-11  8:07         ` Nicolas Ferre
  0 siblings, 0 replies; 57+ messages in thread
From: Nicolas Ferre @ 2017-07-11  8:07 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	computersforpeace-Re5JQEeQqe8AvxtiuMwx3w

On 11/07/2017 at 09:58, Ludovic Desroches wrote:
> On Tue, Jul 11, 2017 at 09:52:58AM +0200, Nicolas Ferre wrote:
>> On 11/07/2017 at 09:40, Ludovic Desroches wrote:
>>> A new compatible string has been introduced for sama5d2 SMC to allow to
>>> manage the registers mapping change.
>>>
>>> Signed-off-by: Ludovic Desroches <ludovic.desroches-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>
>>> ---
>>>  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
>>> index 4fcd5bb219e3..60e69aeacbdb 100644
>>> --- a/arch/arm/boot/dts/sama5d2.dtsi
>>> +++ b/arch/arm/boot/dts/sama5d2.dtsi
>>> @@ -1048,7 +1048,7 @@
>>>  			};
>>>  
>>>  			hsmc: hsmc@f8014000 {
>>> -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
>>> +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
>>
>> You'd better use something like:
>>  compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";
> 
> But it's not true, during data interface setup, we will write values in
> the wrong place if we fallback on "atmel,sama5d3-smc".

Yes, I wrote too quickly: sorry for the noise ;-)

Bye,


>> So that this patch is independent from the rest of the series and
>> we can avoid to having to synchronize with mfd or mtd/nand for this part.
>>
>> Regards,
>>
>>>  				reg = <0xf8014000 0x1000>;
>>>  				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
>>>  				clocks = <&hsmc_clk>;
>>>
>>
>>
>> -- 
>> Nicolas Ferre
> 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-11  8:07         ` Nicolas Ferre
  0 siblings, 0 replies; 57+ messages in thread
From: Nicolas Ferre @ 2017-07-11  8:07 UTC (permalink / raw)
  To: linux-arm-kernel

On 11/07/2017 at 09:58, Ludovic Desroches wrote:
> On Tue, Jul 11, 2017 at 09:52:58AM +0200, Nicolas Ferre wrote:
>> On 11/07/2017 at 09:40, Ludovic Desroches wrote:
>>> A new compatible string has been introduced for sama5d2 SMC to allow to
>>> manage the registers mapping change.
>>>
>>> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
>>> ---
>>>  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
>>> index 4fcd5bb219e3..60e69aeacbdb 100644
>>> --- a/arch/arm/boot/dts/sama5d2.dtsi
>>> +++ b/arch/arm/boot/dts/sama5d2.dtsi
>>> @@ -1048,7 +1048,7 @@
>>>  			};
>>>  
>>>  			hsmc: hsmc at f8014000 {
>>> -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
>>> +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
>>
>> You'd better use something like:
>>  compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";
> 
> But it's not true, during data interface setup, we will write values in
> the wrong place if we fallback on "atmel,sama5d3-smc".

Yes, I wrote too quickly: sorry for the noise ;-)

Bye,


>> So that this patch is independent from the rest of the series and
>> we can avoid to having to synchronize with mfd or mtd/nand for this part.
>>
>> Regards,
>>
>>>  				reg = <0xf8014000 0x1000>;
>>>  				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
>>>  				clocks = <&hsmc_clk>;
>>>
>>
>>
>> -- 
>> Nicolas Ferre
> 


-- 
Nicolas Ferre

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

* Re: [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
@ 2017-07-11  8:07     ` Boris Brezillon
  0 siblings, 0 replies; 57+ messages in thread
From: Boris Brezillon @ 2017-07-11  8:07 UTC (permalink / raw)
  To: Ludovic Desroches
  Cc: devicetree, linux-arm-kernel, linux-mtd, linux-kernel, lee.jones,
	nicolas.ferre, alexandre.belloni, computersforpeace

On Tue, 11 Jul 2017 09:40:14 +0200
Ludovic Desroches <ludovic.desroches@microchip.com> wrote:

> For HSMC controller, the register layout depends on the device i.e. the
> offset of setup, pulse, cycle, mode and timings registers is not the
> same. An helper is added to provide the correct register layout.
> 
> Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
> SMC regs manipulation")
> Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> ---
>  drivers/memory/atmel-ebi.c               | 13 +++++--
>  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
>  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
>  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
>  4 files changed, 92 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
> index 99e644cda4d1..63c9e7a76854 100644
> --- a/drivers/memory/atmel-ebi.c
> +++ b/drivers/memory/atmel-ebi.c
> @@ -51,6 +51,7 @@ struct atmel_ebi {
>  	struct  {
>  		struct regmap *regmap;
>  		struct clk *clk;
> +		const struct atmel_hsmc_reg_layout *layout;
>  	} smc;
>  
>  	struct device *dev;
> @@ -84,8 +85,8 @@ static void at91sam9_ebi_get_config(struct atmel_ebi_dev *ebid,
>  static void sama5_ebi_get_config(struct atmel_ebi_dev *ebid,
>  				 struct atmel_ebi_dev_config *conf)
>  {
> -	atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, conf->cs,
> -			       &conf->smcconf);
> +	atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, ebid->ebi->smc.layout,
> +			       conf->cs, &conf->smcconf);
>  }
>  
>  static const struct atmel_smc_timing_xlate timings_xlate_table[] = {
> @@ -285,8 +286,8 @@ static void at91sam9_ebi_apply_config(struct atmel_ebi_dev *ebid,
>  static void sama5_ebi_apply_config(struct atmel_ebi_dev *ebid,
>  				   struct atmel_ebi_dev_config *conf)
>  {
> -	atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, conf->cs,
> -				 &conf->smcconf);
> +	atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, ebid->ebi->smc.layout,
> +				 conf->cs, &conf->smcconf);
>  }
>  
>  static int atmel_ebi_dev_setup(struct atmel_ebi *ebi, struct device_node *np,
> @@ -525,6 +526,10 @@ static int atmel_ebi_probe(struct platform_device *pdev)
>  	if (IS_ERR(ebi->smc.regmap))
>  		return PTR_ERR(ebi->smc.regmap);
>  
> +	ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np);
> +	if (IS_ERR(ebi->smc.layout))
> +		return PTR_ERR(ebi->smc.layout);
> +
>  	ebi->smc.clk = of_clk_get(smc_np, 0);
>  	if (IS_ERR(ebi->smc.clk)) {
>  		if (PTR_ERR(ebi->smc.clk) != -ENOENT)
> diff --git a/drivers/mfd/atmel-smc.c b/drivers/mfd/atmel-smc.c
> index 954cf0f66a31..1ad44e63b511 100644
> --- a/drivers/mfd/atmel-smc.c
> +++ b/drivers/mfd/atmel-smc.c
> @@ -258,19 +258,21 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_apply);
>   * atmel_hsmc_cs_conf_apply - apply an SMC CS conf
>   * @regmap: the HSMC regmap
>   * @cs: the CS id
> + * @layout: the layout of registers
>   * @conf the SMC CS conf to apply
>   *
>   * Applies an SMC CS configuration.
>   * Only valid on post-sama5 SoCs.
>   */
> -void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
> -			      const struct atmel_smc_cs_conf *conf)
> +void atmel_hsmc_cs_conf_apply(struct regmap *regmap,
> +			      const struct atmel_hsmc_reg_layout *layout,
> +			      int cs, const struct atmel_smc_cs_conf *conf)
>  {
> -	regmap_write(regmap, ATMEL_HSMC_SETUP(cs), conf->setup);
> -	regmap_write(regmap, ATMEL_HSMC_PULSE(cs), conf->pulse);
> -	regmap_write(regmap, ATMEL_HSMC_CYCLE(cs), conf->cycle);
> -	regmap_write(regmap, ATMEL_HSMC_TIMINGS(cs), conf->timings);
> -	regmap_write(regmap, ATMEL_HSMC_MODE(cs), conf->mode);
> +	regmap_write(regmap, ATMEL_HSMC_SETUP(layout, cs), conf->setup);
> +	regmap_write(regmap, ATMEL_HSMC_PULSE(layout, cs), conf->pulse);
> +	regmap_write(regmap, ATMEL_HSMC_CYCLE(layout, cs), conf->cycle);
> +	regmap_write(regmap, ATMEL_HSMC_TIMINGS(layout, cs), conf->timings);
> +	regmap_write(regmap, ATMEL_HSMC_MODE(layout, cs), conf->mode);
>  }
>  EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_apply);
>  
> @@ -297,18 +299,55 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_get);
>   * atmel_hsmc_cs_conf_get - retrieve the current SMC CS conf
>   * @regmap: the HSMC regmap
>   * @cs: the CS id
> + * @layout: the layout of registers
>   * @conf: the SMC CS conf object to store the current conf
>   *
>   * Retrieve the SMC CS configuration.
>   * Only valid on post-sama5 SoCs.
>   */
> -void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
> -			    struct atmel_smc_cs_conf *conf)
> +void atmel_hsmc_cs_conf_get(struct regmap *regmap,
> +			    const struct atmel_hsmc_reg_layout *layout,
> +			    int cs, struct atmel_smc_cs_conf *conf)
>  {
> -	regmap_read(regmap, ATMEL_HSMC_SETUP(cs), &conf->setup);
> -	regmap_read(regmap, ATMEL_HSMC_PULSE(cs), &conf->pulse);
> -	regmap_read(regmap, ATMEL_HSMC_CYCLE(cs), &conf->cycle);
> -	regmap_read(regmap, ATMEL_HSMC_TIMINGS(cs), &conf->timings);
> -	regmap_read(regmap, ATMEL_HSMC_MODE(cs), &conf->mode);
> +	regmap_read(regmap, ATMEL_HSMC_SETUP(layout, cs), &conf->setup);
> +	regmap_read(regmap, ATMEL_HSMC_PULSE(layout, cs), &conf->pulse);
> +	regmap_read(regmap, ATMEL_HSMC_CYCLE(layout, cs), &conf->cycle);
> +	regmap_read(regmap, ATMEL_HSMC_TIMINGS(layout, cs), &conf->timings);
> +	regmap_read(regmap, ATMEL_HSMC_MODE(layout, cs), &conf->mode);
>  }
>  EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_get);
> +
> +static const struct atmel_hsmc_reg_layout sama5d3_reg_layout = {
> +	.timing_regs_offset = 0x600,
> +};
> +
> +static const struct atmel_hsmc_reg_layout sama5d2_reg_layout = {
> +	.timing_regs_offset = 0x700,
> +};
> +
> +static const struct of_device_id atmel_smc_ids[] = {
> +	{ .compatible = "atmel,at91sam9260-smc", .data = NULL },
> +	{ .compatible = "atmel,sama5d3-smc", .data = &sama5d3_reg_layout },
> +	{ .compatible = "atmel,sama5d2-smc", .data = &sama5d2_reg_layout },
> +	{ /* sentinel */ },
> +};
> +
> +/**
> + * atmel_hsmc_get_reg_layout - retrieve the layout of HSMC registers
> + * @np: the HSMC regmap
> + *
> + * Retrieve the layout of HSMC registers.
> + *
> + * Returns NULL in case of SMC, a struct atmel_hsmc_reg_layout pointer
> + * in HSMC case, otherwise ERR_PTR(-EINVAL).
> + */
> +const struct atmel_hsmc_reg_layout *
> +atmel_hsmc_get_reg_layout(struct device_node *np)
> +{
> +	const struct of_device_id *match;
> +
> +	match = of_match_node(atmel_hsmc_ids, np);
> +
> +	return match ? match->data : ERR_PTR(-EINVAL);
> +}
> +EXPORT_SYMBOL_GPL(atmel_hsmc_get_reg_layout);
> diff --git a/drivers/mtd/nand/atmel/nand-controller.c b/drivers/mtd/nand/atmel/nand-controller.c
> index d922a88e407f..29396e618965 100644
> --- a/drivers/mtd/nand/atmel/nand-controller.c
> +++ b/drivers/mtd/nand/atmel/nand-controller.c
> @@ -247,6 +247,7 @@ struct atmel_hsmc_nand_controller {
>  		void __iomem *virt;
>  		dma_addr_t dma;
>  	} sram;
> +	const struct atmel_hsmc_reg_layout *hsmc_layout;
>  	struct regmap *io;
>  	struct atmel_nfc_op op;
>  	struct completion complete;
> @@ -1431,12 +1432,12 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
>  					int csline,
>  					const struct nand_data_interface *conf)
>  {
> -	struct atmel_nand_controller *nc;
> +	struct atmel_hsmc_nand_controller *nc;
>  	struct atmel_smc_cs_conf smcconf;
>  	struct atmel_nand_cs *cs;
>  	int ret;
>  
> -	nc = to_nand_controller(nand->base.controller);
> +	nc = to_hsmc_nand_controller(nand->base.controller);
>  
>  	ret = atmel_smc_nand_prepare_smcconf(nand, conf, &smcconf);
>  	if (ret)
> @@ -1451,7 +1452,8 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
>  	if (cs->rb.type == ATMEL_NAND_NATIVE_RB)
>  		cs->smcconf.timings |= ATMEL_HSMC_TIMINGS_RBNSEL(cs->rb.id);
>  
> -	atmel_hsmc_cs_conf_apply(nc->smc, cs->id, &cs->smcconf);
> +	atmel_hsmc_cs_conf_apply(nc->base.smc, nc->hsmc_layout, cs->id,
> +				 &cs->smcconf);
>  
>  	return 0;
>  }
> @@ -2166,6 +2168,8 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc)
>  		return -EINVAL;
>  	}
>  
> +	nc->hsmc_layout = atmel_hsmc_get_reg_layout(np);
> +
>  	nc->irq = of_irq_get(np, 0);
>  	of_node_put(np);
>  	if (nc->irq < 0) {
> diff --git a/include/linux/mfd/syscon/atmel-smc.h b/include/linux/mfd/syscon/atmel-smc.h
> index afa266169800..7a367f34b66a 100644
> --- a/include/linux/mfd/syscon/atmel-smc.h
> +++ b/include/linux/mfd/syscon/atmel-smc.h
> @@ -15,21 +15,26 @@
>  #define _LINUX_MFD_SYSCON_ATMEL_SMC_H_
>  
>  #include <linux/kernel.h>
> +#include <linux/of.h>
>  #include <linux/regmap.h>
>  
>  #define ATMEL_SMC_SETUP(cs)			(((cs) * 0x10))
> -#define ATMEL_HSMC_SETUP(cs)			(0x600 + ((cs) * 0x14))
> +#define ATMEL_HSMC_SETUP(layout, cs)		\
> +	((layout)->timing_regs_offset + ((cs) * 0x14))
>  #define ATMEL_SMC_PULSE(cs)			(((cs) * 0x10) + 0x4)
> -#define ATMEL_HSMC_PULSE(cs)			(0x600 + ((cs) * 0x14) + 0x4)
> +#define ATMEL_HSMC_PULSE(layout, cs)		\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x4)
>  #define ATMEL_SMC_CYCLE(cs)			(((cs) * 0x10) + 0x8)
> -#define ATMEL_HSMC_CYCLE(cs)			(0x600 + ((cs) * 0x14) + 0x8)
> +#define ATMEL_HSMC_CYCLE(layout, cs)			\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x8)
>  #define ATMEL_SMC_NWE_SHIFT			0
>  #define ATMEL_SMC_NCS_WR_SHIFT			8
>  #define ATMEL_SMC_NRD_SHIFT			16
>  #define ATMEL_SMC_NCS_RD_SHIFT			24
>  
>  #define ATMEL_SMC_MODE(cs)			(((cs) * 0x10) + 0xc)
> -#define ATMEL_HSMC_MODE(cs)			(0x600 + ((cs) * 0x14) + 0x10)
> +#define ATMEL_HSMC_MODE(layout, cs)			\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x10)
>  #define ATMEL_SMC_MODE_READMODE_MASK		BIT(0)
>  #define ATMEL_SMC_MODE_READMODE_NCS		(0 << 0)
>  #define ATMEL_SMC_MODE_READMODE_NRD		(1 << 0)
> @@ -59,7 +64,8 @@
>  #define ATMEL_SMC_MODE_PS_16			(2 << 28)
>  #define ATMEL_SMC_MODE_PS_32			(3 << 28)
>  
> -#define ATMEL_HSMC_TIMINGS(cs)			(0x600 + ((cs) * 0x14) + 0xc)
> +#define ATMEL_HSMC_TIMINGS(layout, cs)			\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0xc)
>  #define ATMEL_HSMC_TIMINGS_OCMS			BIT(12)
>  #define ATMEL_HSMC_TIMINGS_RBNSEL(x)		((x) << 28)
>  #define ATMEL_HSMC_TIMINGS_NFSEL		BIT(31)
> @@ -69,6 +75,10 @@
>  #define ATMEL_HSMC_TIMINGS_TRR_SHIFT		16
>  #define ATMEL_HSMC_TIMINGS_TWB_SHIFT		24
>  
> +struct atmel_hsmc_reg_layout {
> +	unsigned int timing_regs_offset;
> +};
> +
>  /**
>   * struct atmel_smc_cs_conf - SMC CS config as described in the datasheet.
>   * @setup: NCS/NWE/NRD setup timings (not applicable to at91rm9200)
> @@ -98,11 +108,15 @@ int atmel_smc_cs_conf_set_cycle(struct atmel_smc_cs_conf *conf,
>  				unsigned int shift, unsigned int ncycles);
>  void atmel_smc_cs_conf_apply(struct regmap *regmap, int cs,
>  			     const struct atmel_smc_cs_conf *conf);
> -void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
> -			      const struct atmel_smc_cs_conf *conf);
> +void atmel_hsmc_cs_conf_apply(struct regmap *regmap,
> +			      const struct atmel_hsmc_reg_layout *reglayout,
> +			      int cs, const struct atmel_smc_cs_conf *conf);
>  void atmel_smc_cs_conf_get(struct regmap *regmap, int cs,
>  			   struct atmel_smc_cs_conf *conf);
> -void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
> -			    struct atmel_smc_cs_conf *conf);
> +void atmel_hsmc_cs_conf_get(struct regmap *regmap,
> +			    const struct atmel_hsmc_reg_layout *reglayout,
> +			    int cs, struct atmel_smc_cs_conf *conf);
> +const struct atmel_hsmc_reg_layout *
> +atmel_hsmc_get_reg_layout(struct device_node *np);
>  
>  #endif /* _LINUX_MFD_SYSCON_ATMEL_SMC_H_ */

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

* Re: [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
@ 2017-07-11  8:07     ` Boris Brezillon
  0 siblings, 0 replies; 57+ messages in thread
From: Boris Brezillon @ 2017-07-11  8:07 UTC (permalink / raw)
  To: Ludovic Desroches
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	nicolas.ferre-UWL1GkI3JZL3oGB3hsPCZA,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	computersforpeace-Re5JQEeQqe8AvxtiuMwx3w

On Tue, 11 Jul 2017 09:40:14 +0200
Ludovic Desroches <ludovic.desroches-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org> wrote:

> For HSMC controller, the register layout depends on the device i.e. the
> offset of setup, pulse, cycle, mode and timings registers is not the
> same. An helper is added to provide the correct register layout.
> 
> Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
> SMC regs manipulation")
> Suggested-by: Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> Signed-off-by: Ludovic Desroches <ludovic.desroches-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>

Acked-by: Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

> ---
>  drivers/memory/atmel-ebi.c               | 13 +++++--
>  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
>  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
>  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
>  4 files changed, 92 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
> index 99e644cda4d1..63c9e7a76854 100644
> --- a/drivers/memory/atmel-ebi.c
> +++ b/drivers/memory/atmel-ebi.c
> @@ -51,6 +51,7 @@ struct atmel_ebi {
>  	struct  {
>  		struct regmap *regmap;
>  		struct clk *clk;
> +		const struct atmel_hsmc_reg_layout *layout;
>  	} smc;
>  
>  	struct device *dev;
> @@ -84,8 +85,8 @@ static void at91sam9_ebi_get_config(struct atmel_ebi_dev *ebid,
>  static void sama5_ebi_get_config(struct atmel_ebi_dev *ebid,
>  				 struct atmel_ebi_dev_config *conf)
>  {
> -	atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, conf->cs,
> -			       &conf->smcconf);
> +	atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, ebid->ebi->smc.layout,
> +			       conf->cs, &conf->smcconf);
>  }
>  
>  static const struct atmel_smc_timing_xlate timings_xlate_table[] = {
> @@ -285,8 +286,8 @@ static void at91sam9_ebi_apply_config(struct atmel_ebi_dev *ebid,
>  static void sama5_ebi_apply_config(struct atmel_ebi_dev *ebid,
>  				   struct atmel_ebi_dev_config *conf)
>  {
> -	atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, conf->cs,
> -				 &conf->smcconf);
> +	atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, ebid->ebi->smc.layout,
> +				 conf->cs, &conf->smcconf);
>  }
>  
>  static int atmel_ebi_dev_setup(struct atmel_ebi *ebi, struct device_node *np,
> @@ -525,6 +526,10 @@ static int atmel_ebi_probe(struct platform_device *pdev)
>  	if (IS_ERR(ebi->smc.regmap))
>  		return PTR_ERR(ebi->smc.regmap);
>  
> +	ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np);
> +	if (IS_ERR(ebi->smc.layout))
> +		return PTR_ERR(ebi->smc.layout);
> +
>  	ebi->smc.clk = of_clk_get(smc_np, 0);
>  	if (IS_ERR(ebi->smc.clk)) {
>  		if (PTR_ERR(ebi->smc.clk) != -ENOENT)
> diff --git a/drivers/mfd/atmel-smc.c b/drivers/mfd/atmel-smc.c
> index 954cf0f66a31..1ad44e63b511 100644
> --- a/drivers/mfd/atmel-smc.c
> +++ b/drivers/mfd/atmel-smc.c
> @@ -258,19 +258,21 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_apply);
>   * atmel_hsmc_cs_conf_apply - apply an SMC CS conf
>   * @regmap: the HSMC regmap
>   * @cs: the CS id
> + * @layout: the layout of registers
>   * @conf the SMC CS conf to apply
>   *
>   * Applies an SMC CS configuration.
>   * Only valid on post-sama5 SoCs.
>   */
> -void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
> -			      const struct atmel_smc_cs_conf *conf)
> +void atmel_hsmc_cs_conf_apply(struct regmap *regmap,
> +			      const struct atmel_hsmc_reg_layout *layout,
> +			      int cs, const struct atmel_smc_cs_conf *conf)
>  {
> -	regmap_write(regmap, ATMEL_HSMC_SETUP(cs), conf->setup);
> -	regmap_write(regmap, ATMEL_HSMC_PULSE(cs), conf->pulse);
> -	regmap_write(regmap, ATMEL_HSMC_CYCLE(cs), conf->cycle);
> -	regmap_write(regmap, ATMEL_HSMC_TIMINGS(cs), conf->timings);
> -	regmap_write(regmap, ATMEL_HSMC_MODE(cs), conf->mode);
> +	regmap_write(regmap, ATMEL_HSMC_SETUP(layout, cs), conf->setup);
> +	regmap_write(regmap, ATMEL_HSMC_PULSE(layout, cs), conf->pulse);
> +	regmap_write(regmap, ATMEL_HSMC_CYCLE(layout, cs), conf->cycle);
> +	regmap_write(regmap, ATMEL_HSMC_TIMINGS(layout, cs), conf->timings);
> +	regmap_write(regmap, ATMEL_HSMC_MODE(layout, cs), conf->mode);
>  }
>  EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_apply);
>  
> @@ -297,18 +299,55 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_get);
>   * atmel_hsmc_cs_conf_get - retrieve the current SMC CS conf
>   * @regmap: the HSMC regmap
>   * @cs: the CS id
> + * @layout: the layout of registers
>   * @conf: the SMC CS conf object to store the current conf
>   *
>   * Retrieve the SMC CS configuration.
>   * Only valid on post-sama5 SoCs.
>   */
> -void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
> -			    struct atmel_smc_cs_conf *conf)
> +void atmel_hsmc_cs_conf_get(struct regmap *regmap,
> +			    const struct atmel_hsmc_reg_layout *layout,
> +			    int cs, struct atmel_smc_cs_conf *conf)
>  {
> -	regmap_read(regmap, ATMEL_HSMC_SETUP(cs), &conf->setup);
> -	regmap_read(regmap, ATMEL_HSMC_PULSE(cs), &conf->pulse);
> -	regmap_read(regmap, ATMEL_HSMC_CYCLE(cs), &conf->cycle);
> -	regmap_read(regmap, ATMEL_HSMC_TIMINGS(cs), &conf->timings);
> -	regmap_read(regmap, ATMEL_HSMC_MODE(cs), &conf->mode);
> +	regmap_read(regmap, ATMEL_HSMC_SETUP(layout, cs), &conf->setup);
> +	regmap_read(regmap, ATMEL_HSMC_PULSE(layout, cs), &conf->pulse);
> +	regmap_read(regmap, ATMEL_HSMC_CYCLE(layout, cs), &conf->cycle);
> +	regmap_read(regmap, ATMEL_HSMC_TIMINGS(layout, cs), &conf->timings);
> +	regmap_read(regmap, ATMEL_HSMC_MODE(layout, cs), &conf->mode);
>  }
>  EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_get);
> +
> +static const struct atmel_hsmc_reg_layout sama5d3_reg_layout = {
> +	.timing_regs_offset = 0x600,
> +};
> +
> +static const struct atmel_hsmc_reg_layout sama5d2_reg_layout = {
> +	.timing_regs_offset = 0x700,
> +};
> +
> +static const struct of_device_id atmel_smc_ids[] = {
> +	{ .compatible = "atmel,at91sam9260-smc", .data = NULL },
> +	{ .compatible = "atmel,sama5d3-smc", .data = &sama5d3_reg_layout },
> +	{ .compatible = "atmel,sama5d2-smc", .data = &sama5d2_reg_layout },
> +	{ /* sentinel */ },
> +};
> +
> +/**
> + * atmel_hsmc_get_reg_layout - retrieve the layout of HSMC registers
> + * @np: the HSMC regmap
> + *
> + * Retrieve the layout of HSMC registers.
> + *
> + * Returns NULL in case of SMC, a struct atmel_hsmc_reg_layout pointer
> + * in HSMC case, otherwise ERR_PTR(-EINVAL).
> + */
> +const struct atmel_hsmc_reg_layout *
> +atmel_hsmc_get_reg_layout(struct device_node *np)
> +{
> +	const struct of_device_id *match;
> +
> +	match = of_match_node(atmel_hsmc_ids, np);
> +
> +	return match ? match->data : ERR_PTR(-EINVAL);
> +}
> +EXPORT_SYMBOL_GPL(atmel_hsmc_get_reg_layout);
> diff --git a/drivers/mtd/nand/atmel/nand-controller.c b/drivers/mtd/nand/atmel/nand-controller.c
> index d922a88e407f..29396e618965 100644
> --- a/drivers/mtd/nand/atmel/nand-controller.c
> +++ b/drivers/mtd/nand/atmel/nand-controller.c
> @@ -247,6 +247,7 @@ struct atmel_hsmc_nand_controller {
>  		void __iomem *virt;
>  		dma_addr_t dma;
>  	} sram;
> +	const struct atmel_hsmc_reg_layout *hsmc_layout;
>  	struct regmap *io;
>  	struct atmel_nfc_op op;
>  	struct completion complete;
> @@ -1431,12 +1432,12 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
>  					int csline,
>  					const struct nand_data_interface *conf)
>  {
> -	struct atmel_nand_controller *nc;
> +	struct atmel_hsmc_nand_controller *nc;
>  	struct atmel_smc_cs_conf smcconf;
>  	struct atmel_nand_cs *cs;
>  	int ret;
>  
> -	nc = to_nand_controller(nand->base.controller);
> +	nc = to_hsmc_nand_controller(nand->base.controller);
>  
>  	ret = atmel_smc_nand_prepare_smcconf(nand, conf, &smcconf);
>  	if (ret)
> @@ -1451,7 +1452,8 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
>  	if (cs->rb.type == ATMEL_NAND_NATIVE_RB)
>  		cs->smcconf.timings |= ATMEL_HSMC_TIMINGS_RBNSEL(cs->rb.id);
>  
> -	atmel_hsmc_cs_conf_apply(nc->smc, cs->id, &cs->smcconf);
> +	atmel_hsmc_cs_conf_apply(nc->base.smc, nc->hsmc_layout, cs->id,
> +				 &cs->smcconf);
>  
>  	return 0;
>  }
> @@ -2166,6 +2168,8 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc)
>  		return -EINVAL;
>  	}
>  
> +	nc->hsmc_layout = atmel_hsmc_get_reg_layout(np);
> +
>  	nc->irq = of_irq_get(np, 0);
>  	of_node_put(np);
>  	if (nc->irq < 0) {
> diff --git a/include/linux/mfd/syscon/atmel-smc.h b/include/linux/mfd/syscon/atmel-smc.h
> index afa266169800..7a367f34b66a 100644
> --- a/include/linux/mfd/syscon/atmel-smc.h
> +++ b/include/linux/mfd/syscon/atmel-smc.h
> @@ -15,21 +15,26 @@
>  #define _LINUX_MFD_SYSCON_ATMEL_SMC_H_
>  
>  #include <linux/kernel.h>
> +#include <linux/of.h>
>  #include <linux/regmap.h>
>  
>  #define ATMEL_SMC_SETUP(cs)			(((cs) * 0x10))
> -#define ATMEL_HSMC_SETUP(cs)			(0x600 + ((cs) * 0x14))
> +#define ATMEL_HSMC_SETUP(layout, cs)		\
> +	((layout)->timing_regs_offset + ((cs) * 0x14))
>  #define ATMEL_SMC_PULSE(cs)			(((cs) * 0x10) + 0x4)
> -#define ATMEL_HSMC_PULSE(cs)			(0x600 + ((cs) * 0x14) + 0x4)
> +#define ATMEL_HSMC_PULSE(layout, cs)		\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x4)
>  #define ATMEL_SMC_CYCLE(cs)			(((cs) * 0x10) + 0x8)
> -#define ATMEL_HSMC_CYCLE(cs)			(0x600 + ((cs) * 0x14) + 0x8)
> +#define ATMEL_HSMC_CYCLE(layout, cs)			\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x8)
>  #define ATMEL_SMC_NWE_SHIFT			0
>  #define ATMEL_SMC_NCS_WR_SHIFT			8
>  #define ATMEL_SMC_NRD_SHIFT			16
>  #define ATMEL_SMC_NCS_RD_SHIFT			24
>  
>  #define ATMEL_SMC_MODE(cs)			(((cs) * 0x10) + 0xc)
> -#define ATMEL_HSMC_MODE(cs)			(0x600 + ((cs) * 0x14) + 0x10)
> +#define ATMEL_HSMC_MODE(layout, cs)			\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x10)
>  #define ATMEL_SMC_MODE_READMODE_MASK		BIT(0)
>  #define ATMEL_SMC_MODE_READMODE_NCS		(0 << 0)
>  #define ATMEL_SMC_MODE_READMODE_NRD		(1 << 0)
> @@ -59,7 +64,8 @@
>  #define ATMEL_SMC_MODE_PS_16			(2 << 28)
>  #define ATMEL_SMC_MODE_PS_32			(3 << 28)
>  
> -#define ATMEL_HSMC_TIMINGS(cs)			(0x600 + ((cs) * 0x14) + 0xc)
> +#define ATMEL_HSMC_TIMINGS(layout, cs)			\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0xc)
>  #define ATMEL_HSMC_TIMINGS_OCMS			BIT(12)
>  #define ATMEL_HSMC_TIMINGS_RBNSEL(x)		((x) << 28)
>  #define ATMEL_HSMC_TIMINGS_NFSEL		BIT(31)
> @@ -69,6 +75,10 @@
>  #define ATMEL_HSMC_TIMINGS_TRR_SHIFT		16
>  #define ATMEL_HSMC_TIMINGS_TWB_SHIFT		24
>  
> +struct atmel_hsmc_reg_layout {
> +	unsigned int timing_regs_offset;
> +};
> +
>  /**
>   * struct atmel_smc_cs_conf - SMC CS config as described in the datasheet.
>   * @setup: NCS/NWE/NRD setup timings (not applicable to at91rm9200)
> @@ -98,11 +108,15 @@ int atmel_smc_cs_conf_set_cycle(struct atmel_smc_cs_conf *conf,
>  				unsigned int shift, unsigned int ncycles);
>  void atmel_smc_cs_conf_apply(struct regmap *regmap, int cs,
>  			     const struct atmel_smc_cs_conf *conf);
> -void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
> -			      const struct atmel_smc_cs_conf *conf);
> +void atmel_hsmc_cs_conf_apply(struct regmap *regmap,
> +			      const struct atmel_hsmc_reg_layout *reglayout,
> +			      int cs, const struct atmel_smc_cs_conf *conf);
>  void atmel_smc_cs_conf_get(struct regmap *regmap, int cs,
>  			   struct atmel_smc_cs_conf *conf);
> -void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
> -			    struct atmel_smc_cs_conf *conf);
> +void atmel_hsmc_cs_conf_get(struct regmap *regmap,
> +			    const struct atmel_hsmc_reg_layout *reglayout,
> +			    int cs, struct atmel_smc_cs_conf *conf);
> +const struct atmel_hsmc_reg_layout *
> +atmel_hsmc_get_reg_layout(struct device_node *np);
>  
>  #endif /* _LINUX_MFD_SYSCON_ATMEL_SMC_H_ */

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
@ 2017-07-11  8:07     ` Boris Brezillon
  0 siblings, 0 replies; 57+ messages in thread
From: Boris Brezillon @ 2017-07-11  8:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 11 Jul 2017 09:40:14 +0200
Ludovic Desroches <ludovic.desroches@microchip.com> wrote:

> For HSMC controller, the register layout depends on the device i.e. the
> offset of setup, pulse, cycle, mode and timings registers is not the
> same. An helper is added to provide the correct register layout.
> 
> Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
> SMC regs manipulation")
> Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> ---
>  drivers/memory/atmel-ebi.c               | 13 +++++--
>  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
>  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
>  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
>  4 files changed, 92 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
> index 99e644cda4d1..63c9e7a76854 100644
> --- a/drivers/memory/atmel-ebi.c
> +++ b/drivers/memory/atmel-ebi.c
> @@ -51,6 +51,7 @@ struct atmel_ebi {
>  	struct  {
>  		struct regmap *regmap;
>  		struct clk *clk;
> +		const struct atmel_hsmc_reg_layout *layout;
>  	} smc;
>  
>  	struct device *dev;
> @@ -84,8 +85,8 @@ static void at91sam9_ebi_get_config(struct atmel_ebi_dev *ebid,
>  static void sama5_ebi_get_config(struct atmel_ebi_dev *ebid,
>  				 struct atmel_ebi_dev_config *conf)
>  {
> -	atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, conf->cs,
> -			       &conf->smcconf);
> +	atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, ebid->ebi->smc.layout,
> +			       conf->cs, &conf->smcconf);
>  }
>  
>  static const struct atmel_smc_timing_xlate timings_xlate_table[] = {
> @@ -285,8 +286,8 @@ static void at91sam9_ebi_apply_config(struct atmel_ebi_dev *ebid,
>  static void sama5_ebi_apply_config(struct atmel_ebi_dev *ebid,
>  				   struct atmel_ebi_dev_config *conf)
>  {
> -	atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, conf->cs,
> -				 &conf->smcconf);
> +	atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, ebid->ebi->smc.layout,
> +				 conf->cs, &conf->smcconf);
>  }
>  
>  static int atmel_ebi_dev_setup(struct atmel_ebi *ebi, struct device_node *np,
> @@ -525,6 +526,10 @@ static int atmel_ebi_probe(struct platform_device *pdev)
>  	if (IS_ERR(ebi->smc.regmap))
>  		return PTR_ERR(ebi->smc.regmap);
>  
> +	ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np);
> +	if (IS_ERR(ebi->smc.layout))
> +		return PTR_ERR(ebi->smc.layout);
> +
>  	ebi->smc.clk = of_clk_get(smc_np, 0);
>  	if (IS_ERR(ebi->smc.clk)) {
>  		if (PTR_ERR(ebi->smc.clk) != -ENOENT)
> diff --git a/drivers/mfd/atmel-smc.c b/drivers/mfd/atmel-smc.c
> index 954cf0f66a31..1ad44e63b511 100644
> --- a/drivers/mfd/atmel-smc.c
> +++ b/drivers/mfd/atmel-smc.c
> @@ -258,19 +258,21 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_apply);
>   * atmel_hsmc_cs_conf_apply - apply an SMC CS conf
>   * @regmap: the HSMC regmap
>   * @cs: the CS id
> + * @layout: the layout of registers
>   * @conf the SMC CS conf to apply
>   *
>   * Applies an SMC CS configuration.
>   * Only valid on post-sama5 SoCs.
>   */
> -void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
> -			      const struct atmel_smc_cs_conf *conf)
> +void atmel_hsmc_cs_conf_apply(struct regmap *regmap,
> +			      const struct atmel_hsmc_reg_layout *layout,
> +			      int cs, const struct atmel_smc_cs_conf *conf)
>  {
> -	regmap_write(regmap, ATMEL_HSMC_SETUP(cs), conf->setup);
> -	regmap_write(regmap, ATMEL_HSMC_PULSE(cs), conf->pulse);
> -	regmap_write(regmap, ATMEL_HSMC_CYCLE(cs), conf->cycle);
> -	regmap_write(regmap, ATMEL_HSMC_TIMINGS(cs), conf->timings);
> -	regmap_write(regmap, ATMEL_HSMC_MODE(cs), conf->mode);
> +	regmap_write(regmap, ATMEL_HSMC_SETUP(layout, cs), conf->setup);
> +	regmap_write(regmap, ATMEL_HSMC_PULSE(layout, cs), conf->pulse);
> +	regmap_write(regmap, ATMEL_HSMC_CYCLE(layout, cs), conf->cycle);
> +	regmap_write(regmap, ATMEL_HSMC_TIMINGS(layout, cs), conf->timings);
> +	regmap_write(regmap, ATMEL_HSMC_MODE(layout, cs), conf->mode);
>  }
>  EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_apply);
>  
> @@ -297,18 +299,55 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_get);
>   * atmel_hsmc_cs_conf_get - retrieve the current SMC CS conf
>   * @regmap: the HSMC regmap
>   * @cs: the CS id
> + * @layout: the layout of registers
>   * @conf: the SMC CS conf object to store the current conf
>   *
>   * Retrieve the SMC CS configuration.
>   * Only valid on post-sama5 SoCs.
>   */
> -void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
> -			    struct atmel_smc_cs_conf *conf)
> +void atmel_hsmc_cs_conf_get(struct regmap *regmap,
> +			    const struct atmel_hsmc_reg_layout *layout,
> +			    int cs, struct atmel_smc_cs_conf *conf)
>  {
> -	regmap_read(regmap, ATMEL_HSMC_SETUP(cs), &conf->setup);
> -	regmap_read(regmap, ATMEL_HSMC_PULSE(cs), &conf->pulse);
> -	regmap_read(regmap, ATMEL_HSMC_CYCLE(cs), &conf->cycle);
> -	regmap_read(regmap, ATMEL_HSMC_TIMINGS(cs), &conf->timings);
> -	regmap_read(regmap, ATMEL_HSMC_MODE(cs), &conf->mode);
> +	regmap_read(regmap, ATMEL_HSMC_SETUP(layout, cs), &conf->setup);
> +	regmap_read(regmap, ATMEL_HSMC_PULSE(layout, cs), &conf->pulse);
> +	regmap_read(regmap, ATMEL_HSMC_CYCLE(layout, cs), &conf->cycle);
> +	regmap_read(regmap, ATMEL_HSMC_TIMINGS(layout, cs), &conf->timings);
> +	regmap_read(regmap, ATMEL_HSMC_MODE(layout, cs), &conf->mode);
>  }
>  EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_get);
> +
> +static const struct atmel_hsmc_reg_layout sama5d3_reg_layout = {
> +	.timing_regs_offset = 0x600,
> +};
> +
> +static const struct atmel_hsmc_reg_layout sama5d2_reg_layout = {
> +	.timing_regs_offset = 0x700,
> +};
> +
> +static const struct of_device_id atmel_smc_ids[] = {
> +	{ .compatible = "atmel,at91sam9260-smc", .data = NULL },
> +	{ .compatible = "atmel,sama5d3-smc", .data = &sama5d3_reg_layout },
> +	{ .compatible = "atmel,sama5d2-smc", .data = &sama5d2_reg_layout },
> +	{ /* sentinel */ },
> +};
> +
> +/**
> + * atmel_hsmc_get_reg_layout - retrieve the layout of HSMC registers
> + * @np: the HSMC regmap
> + *
> + * Retrieve the layout of HSMC registers.
> + *
> + * Returns NULL in case of SMC, a struct atmel_hsmc_reg_layout pointer
> + * in HSMC case, otherwise ERR_PTR(-EINVAL).
> + */
> +const struct atmel_hsmc_reg_layout *
> +atmel_hsmc_get_reg_layout(struct device_node *np)
> +{
> +	const struct of_device_id *match;
> +
> +	match = of_match_node(atmel_hsmc_ids, np);
> +
> +	return match ? match->data : ERR_PTR(-EINVAL);
> +}
> +EXPORT_SYMBOL_GPL(atmel_hsmc_get_reg_layout);
> diff --git a/drivers/mtd/nand/atmel/nand-controller.c b/drivers/mtd/nand/atmel/nand-controller.c
> index d922a88e407f..29396e618965 100644
> --- a/drivers/mtd/nand/atmel/nand-controller.c
> +++ b/drivers/mtd/nand/atmel/nand-controller.c
> @@ -247,6 +247,7 @@ struct atmel_hsmc_nand_controller {
>  		void __iomem *virt;
>  		dma_addr_t dma;
>  	} sram;
> +	const struct atmel_hsmc_reg_layout *hsmc_layout;
>  	struct regmap *io;
>  	struct atmel_nfc_op op;
>  	struct completion complete;
> @@ -1431,12 +1432,12 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
>  					int csline,
>  					const struct nand_data_interface *conf)
>  {
> -	struct atmel_nand_controller *nc;
> +	struct atmel_hsmc_nand_controller *nc;
>  	struct atmel_smc_cs_conf smcconf;
>  	struct atmel_nand_cs *cs;
>  	int ret;
>  
> -	nc = to_nand_controller(nand->base.controller);
> +	nc = to_hsmc_nand_controller(nand->base.controller);
>  
>  	ret = atmel_smc_nand_prepare_smcconf(nand, conf, &smcconf);
>  	if (ret)
> @@ -1451,7 +1452,8 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
>  	if (cs->rb.type == ATMEL_NAND_NATIVE_RB)
>  		cs->smcconf.timings |= ATMEL_HSMC_TIMINGS_RBNSEL(cs->rb.id);
>  
> -	atmel_hsmc_cs_conf_apply(nc->smc, cs->id, &cs->smcconf);
> +	atmel_hsmc_cs_conf_apply(nc->base.smc, nc->hsmc_layout, cs->id,
> +				 &cs->smcconf);
>  
>  	return 0;
>  }
> @@ -2166,6 +2168,8 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc)
>  		return -EINVAL;
>  	}
>  
> +	nc->hsmc_layout = atmel_hsmc_get_reg_layout(np);
> +
>  	nc->irq = of_irq_get(np, 0);
>  	of_node_put(np);
>  	if (nc->irq < 0) {
> diff --git a/include/linux/mfd/syscon/atmel-smc.h b/include/linux/mfd/syscon/atmel-smc.h
> index afa266169800..7a367f34b66a 100644
> --- a/include/linux/mfd/syscon/atmel-smc.h
> +++ b/include/linux/mfd/syscon/atmel-smc.h
> @@ -15,21 +15,26 @@
>  #define _LINUX_MFD_SYSCON_ATMEL_SMC_H_
>  
>  #include <linux/kernel.h>
> +#include <linux/of.h>
>  #include <linux/regmap.h>
>  
>  #define ATMEL_SMC_SETUP(cs)			(((cs) * 0x10))
> -#define ATMEL_HSMC_SETUP(cs)			(0x600 + ((cs) * 0x14))
> +#define ATMEL_HSMC_SETUP(layout, cs)		\
> +	((layout)->timing_regs_offset + ((cs) * 0x14))
>  #define ATMEL_SMC_PULSE(cs)			(((cs) * 0x10) + 0x4)
> -#define ATMEL_HSMC_PULSE(cs)			(0x600 + ((cs) * 0x14) + 0x4)
> +#define ATMEL_HSMC_PULSE(layout, cs)		\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x4)
>  #define ATMEL_SMC_CYCLE(cs)			(((cs) * 0x10) + 0x8)
> -#define ATMEL_HSMC_CYCLE(cs)			(0x600 + ((cs) * 0x14) + 0x8)
> +#define ATMEL_HSMC_CYCLE(layout, cs)			\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x8)
>  #define ATMEL_SMC_NWE_SHIFT			0
>  #define ATMEL_SMC_NCS_WR_SHIFT			8
>  #define ATMEL_SMC_NRD_SHIFT			16
>  #define ATMEL_SMC_NCS_RD_SHIFT			24
>  
>  #define ATMEL_SMC_MODE(cs)			(((cs) * 0x10) + 0xc)
> -#define ATMEL_HSMC_MODE(cs)			(0x600 + ((cs) * 0x14) + 0x10)
> +#define ATMEL_HSMC_MODE(layout, cs)			\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x10)
>  #define ATMEL_SMC_MODE_READMODE_MASK		BIT(0)
>  #define ATMEL_SMC_MODE_READMODE_NCS		(0 << 0)
>  #define ATMEL_SMC_MODE_READMODE_NRD		(1 << 0)
> @@ -59,7 +64,8 @@
>  #define ATMEL_SMC_MODE_PS_16			(2 << 28)
>  #define ATMEL_SMC_MODE_PS_32			(3 << 28)
>  
> -#define ATMEL_HSMC_TIMINGS(cs)			(0x600 + ((cs) * 0x14) + 0xc)
> +#define ATMEL_HSMC_TIMINGS(layout, cs)			\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0xc)
>  #define ATMEL_HSMC_TIMINGS_OCMS			BIT(12)
>  #define ATMEL_HSMC_TIMINGS_RBNSEL(x)		((x) << 28)
>  #define ATMEL_HSMC_TIMINGS_NFSEL		BIT(31)
> @@ -69,6 +75,10 @@
>  #define ATMEL_HSMC_TIMINGS_TRR_SHIFT		16
>  #define ATMEL_HSMC_TIMINGS_TWB_SHIFT		24
>  
> +struct atmel_hsmc_reg_layout {
> +	unsigned int timing_regs_offset;
> +};
> +
>  /**
>   * struct atmel_smc_cs_conf - SMC CS config as described in the datasheet.
>   * @setup: NCS/NWE/NRD setup timings (not applicable to at91rm9200)
> @@ -98,11 +108,15 @@ int atmel_smc_cs_conf_set_cycle(struct atmel_smc_cs_conf *conf,
>  				unsigned int shift, unsigned int ncycles);
>  void atmel_smc_cs_conf_apply(struct regmap *regmap, int cs,
>  			     const struct atmel_smc_cs_conf *conf);
> -void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
> -			      const struct atmel_smc_cs_conf *conf);
> +void atmel_hsmc_cs_conf_apply(struct regmap *regmap,
> +			      const struct atmel_hsmc_reg_layout *reglayout,
> +			      int cs, const struct atmel_smc_cs_conf *conf);
>  void atmel_smc_cs_conf_get(struct regmap *regmap, int cs,
>  			   struct atmel_smc_cs_conf *conf);
> -void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
> -			    struct atmel_smc_cs_conf *conf);
> +void atmel_hsmc_cs_conf_get(struct regmap *regmap,
> +			    const struct atmel_hsmc_reg_layout *reglayout,
> +			    int cs, struct atmel_smc_cs_conf *conf);
> +const struct atmel_hsmc_reg_layout *
> +atmel_hsmc_get_reg_layout(struct device_node *np);
>  
>  #endif /* _LINUX_MFD_SYSCON_ATMEL_SMC_H_ */

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

* Re: [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-11  8:08         ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  8:08 UTC (permalink / raw)
  To: Nicolas Ferre, devicetree, linux-arm-kernel, linux-mtd,
	linux-kernel, lee.jones, alexandre.belloni, boris.brezillon,
	computersforpeace

On Tue, Jul 11, 2017 at 09:58:29AM +0200, Ludovic Desroches wrote:
> On Tue, Jul 11, 2017 at 09:52:58AM +0200, Nicolas Ferre wrote:
> > On 11/07/2017 at 09:40, Ludovic Desroches wrote:
> > > A new compatible string has been introduced for sama5d2 SMC to allow to
> > > manage the registers mapping change.
> > > 
> > > Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > > ---
> > >  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> > > index 4fcd5bb219e3..60e69aeacbdb 100644
> > > --- a/arch/arm/boot/dts/sama5d2.dtsi
> > > +++ b/arch/arm/boot/dts/sama5d2.dtsi
> > > @@ -1048,7 +1048,7 @@
> > >  			};
> > >  
> > >  			hsmc: hsmc@f8014000 {
> > > -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > > +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
> > 
> > You'd better use something like:
> >  compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";
> 
> But it's not true, during data interface setup, we will write values in
> the wrong place if we fallback on "atmel,sama5d3-smc".
> 
> Regards
> 
> Ludovic
> 
> > 
> > So that this patch is independent from the rest of the series and
> > we can avoid to having to synchronize with mfd or mtd/nand for this part.

If Lee and Boris agree, maybe the series can go through AT91.

Regards

Ludovic

> > 
> > Regards,
> > 
> > >  				reg = <0xf8014000 0x1000>;
> > >  				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
> > >  				clocks = <&hsmc_clk>;
> > > 
> > 
> > 
> > -- 
> > Nicolas Ferre

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

* Re: [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-11  8:08         ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  8:08 UTC (permalink / raw)
  To: Nicolas Ferre, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	computersforpeace-Re5JQEeQqe8AvxtiuMwx3w

On Tue, Jul 11, 2017 at 09:58:29AM +0200, Ludovic Desroches wrote:
> On Tue, Jul 11, 2017 at 09:52:58AM +0200, Nicolas Ferre wrote:
> > On 11/07/2017 at 09:40, Ludovic Desroches wrote:
> > > A new compatible string has been introduced for sama5d2 SMC to allow to
> > > manage the registers mapping change.
> > > 
> > > Signed-off-by: Ludovic Desroches <ludovic.desroches-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>
> > > ---
> > >  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> > > index 4fcd5bb219e3..60e69aeacbdb 100644
> > > --- a/arch/arm/boot/dts/sama5d2.dtsi
> > > +++ b/arch/arm/boot/dts/sama5d2.dtsi
> > > @@ -1048,7 +1048,7 @@
> > >  			};
> > >  
> > >  			hsmc: hsmc@f8014000 {
> > > -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > > +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
> > 
> > You'd better use something like:
> >  compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";
> 
> But it's not true, during data interface setup, we will write values in
> the wrong place if we fallback on "atmel,sama5d3-smc".
> 
> Regards
> 
> Ludovic
> 
> > 
> > So that this patch is independent from the rest of the series and
> > we can avoid to having to synchronize with mfd or mtd/nand for this part.

If Lee and Boris agree, maybe the series can go through AT91.

Regards

Ludovic

> > 
> > Regards,
> > 
> > >  				reg = <0xf8014000 0x1000>;
> > >  				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
> > >  				clocks = <&hsmc_clk>;
> > > 
> > 
> > 
> > -- 
> > Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-11  8:08         ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-11  8:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jul 11, 2017 at 09:58:29AM +0200, Ludovic Desroches wrote:
> On Tue, Jul 11, 2017 at 09:52:58AM +0200, Nicolas Ferre wrote:
> > On 11/07/2017 at 09:40, Ludovic Desroches wrote:
> > > A new compatible string has been introduced for sama5d2 SMC to allow to
> > > manage the registers mapping change.
> > > 
> > > Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > > ---
> > >  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> > > index 4fcd5bb219e3..60e69aeacbdb 100644
> > > --- a/arch/arm/boot/dts/sama5d2.dtsi
> > > +++ b/arch/arm/boot/dts/sama5d2.dtsi
> > > @@ -1048,7 +1048,7 @@
> > >  			};
> > >  
> > >  			hsmc: hsmc at f8014000 {
> > > -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > > +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
> > 
> > You'd better use something like:
> >  compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";
> 
> But it's not true, during data interface setup, we will write values in
> the wrong place if we fallback on "atmel,sama5d3-smc".
> 
> Regards
> 
> Ludovic
> 
> > 
> > So that this patch is independent from the rest of the series and
> > we can avoid to having to synchronize with mfd or mtd/nand for this part.

If Lee and Boris agree, maybe the series can go through AT91.

Regards

Ludovic

> > 
> > Regards,
> > 
> > >  				reg = <0xf8014000 0x1000>;
> > >  				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
> > >  				clocks = <&hsmc_clk>;
> > > 
> > 
> > 
> > -- 
> > Nicolas Ferre

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

* Re: [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-11  9:25           ` Lee Jones
  0 siblings, 0 replies; 57+ messages in thread
From: Lee Jones @ 2017-07-11  9:25 UTC (permalink / raw)
  To: Nicolas Ferre, devicetree, linux-arm-kernel, linux-mtd,
	linux-kernel, alexandre.belloni, boris.brezillon,
	computersforpeace

On Tue, 11 Jul 2017, Ludovic Desroches wrote:

> On Tue, Jul 11, 2017 at 09:58:29AM +0200, Ludovic Desroches wrote:
> > On Tue, Jul 11, 2017 at 09:52:58AM +0200, Nicolas Ferre wrote:
> > > On 11/07/2017 at 09:40, Ludovic Desroches wrote:
> > > > A new compatible string has been introduced for sama5d2 SMC to allow to
> > > > manage the registers mapping change.
> > > > 
> > > > Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > > > ---
> > > >  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> > > > index 4fcd5bb219e3..60e69aeacbdb 100644
> > > > --- a/arch/arm/boot/dts/sama5d2.dtsi
> > > > +++ b/arch/arm/boot/dts/sama5d2.dtsi
> > > > @@ -1048,7 +1048,7 @@
> > > >  			};
> > > >  
> > > >  			hsmc: hsmc@f8014000 {
> > > > -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > > > +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
> > > 
> > > You'd better use something like:
> > >  compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > 
> > But it's not true, during data interface setup, we will write values in
> > the wrong place if we fallback on "atmel,sama5d3-smc".
> > 
> > Regards
> > 
> > Ludovic
> > 
> > > 
> > > So that this patch is independent from the rest of the series and
> > > we can avoid to having to synchronize with mfd or mtd/nand for this part.
> 
> If Lee and Boris agree, maybe the series can go through AT91.

That's fine, but if the series goes though another tree, I will
require a pull-request.

I am also happy to carry though the MFD tree (and will of course send
out a PR to the other affected Maintainers).

> > > Regards,
> > > 
> > > >  				reg = <0xf8014000 0x1000>;
> > > >  				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
> > > >  				clocks = <&hsmc_clk>;
> > > > 
> > > 
> > > 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-11  9:25           ` Lee Jones
  0 siblings, 0 replies; 57+ messages in thread
From: Lee Jones @ 2017-07-11  9:25 UTC (permalink / raw)
  To: Nicolas Ferre, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	computersforpeace-Re5JQEeQqe8AvxtiuMwx3w

On Tue, 11 Jul 2017, Ludovic Desroches wrote:

> On Tue, Jul 11, 2017 at 09:58:29AM +0200, Ludovic Desroches wrote:
> > On Tue, Jul 11, 2017 at 09:52:58AM +0200, Nicolas Ferre wrote:
> > > On 11/07/2017 at 09:40, Ludovic Desroches wrote:
> > > > A new compatible string has been introduced for sama5d2 SMC to allow to
> > > > manage the registers mapping change.
> > > > 
> > > > Signed-off-by: Ludovic Desroches <ludovic.desroches-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>
> > > > ---
> > > >  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> > > > index 4fcd5bb219e3..60e69aeacbdb 100644
> > > > --- a/arch/arm/boot/dts/sama5d2.dtsi
> > > > +++ b/arch/arm/boot/dts/sama5d2.dtsi
> > > > @@ -1048,7 +1048,7 @@
> > > >  			};
> > > >  
> > > >  			hsmc: hsmc@f8014000 {
> > > > -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > > > +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
> > > 
> > > You'd better use something like:
> > >  compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > 
> > But it's not true, during data interface setup, we will write values in
> > the wrong place if we fallback on "atmel,sama5d3-smc".
> > 
> > Regards
> > 
> > Ludovic
> > 
> > > 
> > > So that this patch is independent from the rest of the series and
> > > we can avoid to having to synchronize with mfd or mtd/nand for this part.
> 
> If Lee and Boris agree, maybe the series can go through AT91.

That's fine, but if the series goes though another tree, I will
require a pull-request.

I am also happy to carry though the MFD tree (and will of course send
out a PR to the other affected Maintainers).

> > > Regards,
> > > 
> > > >  				reg = <0xf8014000 0x1000>;
> > > >  				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
> > > >  				clocks = <&hsmc_clk>;
> > > > 
> > > 
> > > 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-11  9:25           ` Lee Jones
  0 siblings, 0 replies; 57+ messages in thread
From: Lee Jones @ 2017-07-11  9:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 11 Jul 2017, Ludovic Desroches wrote:

> On Tue, Jul 11, 2017 at 09:58:29AM +0200, Ludovic Desroches wrote:
> > On Tue, Jul 11, 2017 at 09:52:58AM +0200, Nicolas Ferre wrote:
> > > On 11/07/2017 at 09:40, Ludovic Desroches wrote:
> > > > A new compatible string has been introduced for sama5d2 SMC to allow to
> > > > manage the registers mapping change.
> > > > 
> > > > Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > > > ---
> > > >  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> > > > index 4fcd5bb219e3..60e69aeacbdb 100644
> > > > --- a/arch/arm/boot/dts/sama5d2.dtsi
> > > > +++ b/arch/arm/boot/dts/sama5d2.dtsi
> > > > @@ -1048,7 +1048,7 @@
> > > >  			};
> > > >  
> > > >  			hsmc: hsmc at f8014000 {
> > > > -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > > > +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
> > > 
> > > You'd better use something like:
> > >  compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > 
> > But it's not true, during data interface setup, we will write values in
> > the wrong place if we fallback on "atmel,sama5d3-smc".
> > 
> > Regards
> > 
> > Ludovic
> > 
> > > 
> > > So that this patch is independent from the rest of the series and
> > > we can avoid to having to synchronize with mfd or mtd/nand for this part.
> 
> If Lee and Boris agree, maybe the series can go through AT91.

That's fine, but if the series goes though another tree, I will
require a pull-request.

I am also happy to carry though the MFD tree (and will of course send
out a PR to the other affected Maintainers).

> > > Regards,
> > > 
> > > >  				reg = <0xf8014000 0x1000>;
> > > >  				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
> > > >  				clocks = <&hsmc_clk>;
> > > > 
> > > 
> > > 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
  2017-07-11  9:25           ` Lee Jones
@ 2017-07-12 13:59             ` Alexandre Belloni
  -1 siblings, 0 replies; 57+ messages in thread
From: Alexandre Belloni @ 2017-07-12 13:59 UTC (permalink / raw)
  To: Lee Jones
  Cc: Nicolas Ferre, devicetree, linux-arm-kernel, linux-mtd,
	linux-kernel, boris.brezillon, computersforpeace

On 11/07/2017 at 10:25:56 +0100, Lee Jones wrote:
> On Tue, 11 Jul 2017, Ludovic Desroches wrote:
> 
> > On Tue, Jul 11, 2017 at 09:58:29AM +0200, Ludovic Desroches wrote:
> > > On Tue, Jul 11, 2017 at 09:52:58AM +0200, Nicolas Ferre wrote:
> > > > On 11/07/2017 at 09:40, Ludovic Desroches wrote:
> > > > > A new compatible string has been introduced for sama5d2 SMC to allow to
> > > > > manage the registers mapping change.
> > > > > 
> > > > > Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > > > > ---
> > > > >  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> > > > > index 4fcd5bb219e3..60e69aeacbdb 100644
> > > > > --- a/arch/arm/boot/dts/sama5d2.dtsi
> > > > > +++ b/arch/arm/boot/dts/sama5d2.dtsi
> > > > > @@ -1048,7 +1048,7 @@
> > > > >  			};
> > > > >  
> > > > >  			hsmc: hsmc@f8014000 {
> > > > > -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > > > > +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
> > > > 
> > > > You'd better use something like:
> > > >  compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > > 
> > > But it's not true, during data interface setup, we will write values in
> > > the wrong place if we fallback on "atmel,sama5d3-smc".
> > > 
> > > Regards
> > > 
> > > Ludovic
> > > 
> > > > 
> > > > So that this patch is independent from the rest of the series and
> > > > we can avoid to having to synchronize with mfd or mtd/nand for this part.
> > 
> > If Lee and Boris agree, maybe the series can go through AT91.
> 
> That's fine, but if the series goes though another tree, I will
> require a pull-request.
> 
> I am also happy to carry though the MFD tree (and will of course send
> out a PR to the other affected Maintainers).
> 

I think the easiest is that you take the first two patches through mfd
and I'll take the third one through at91.

Our plan is to get everything fixed for the final 4.13 (I'll send the DT
as a fix, on top of 4.13-rc1). Is that OK for you ?


-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-12 13:59             ` Alexandre Belloni
  0 siblings, 0 replies; 57+ messages in thread
From: Alexandre Belloni @ 2017-07-12 13:59 UTC (permalink / raw)
  To: linux-arm-kernel

On 11/07/2017 at 10:25:56 +0100, Lee Jones wrote:
> On Tue, 11 Jul 2017, Ludovic Desroches wrote:
> 
> > On Tue, Jul 11, 2017 at 09:58:29AM +0200, Ludovic Desroches wrote:
> > > On Tue, Jul 11, 2017 at 09:52:58AM +0200, Nicolas Ferre wrote:
> > > > On 11/07/2017 at 09:40, Ludovic Desroches wrote:
> > > > > A new compatible string has been introduced for sama5d2 SMC to allow to
> > > > > manage the registers mapping change.
> > > > > 
> > > > > Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > > > > ---
> > > > >  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> > > > > index 4fcd5bb219e3..60e69aeacbdb 100644
> > > > > --- a/arch/arm/boot/dts/sama5d2.dtsi
> > > > > +++ b/arch/arm/boot/dts/sama5d2.dtsi
> > > > > @@ -1048,7 +1048,7 @@
> > > > >  			};
> > > > >  
> > > > >  			hsmc: hsmc at f8014000 {
> > > > > -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > > > > +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
> > > > 
> > > > You'd better use something like:
> > > >  compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > > 
> > > But it's not true, during data interface setup, we will write values in
> > > the wrong place if we fallback on "atmel,sama5d3-smc".
> > > 
> > > Regards
> > > 
> > > Ludovic
> > > 
> > > > 
> > > > So that this patch is independent from the rest of the series and
> > > > we can avoid to having to synchronize with mfd or mtd/nand for this part.
> > 
> > If Lee and Boris agree, maybe the series can go through AT91.
> 
> That's fine, but if the series goes though another tree, I will
> require a pull-request.
> 
> I am also happy to carry though the MFD tree (and will of course send
> out a PR to the other affected Maintainers).
> 

I think the easiest is that you take the first two patches through mfd
and I'll take the third one through at91.

Our plan is to get everything fixed for the final 4.13 (I'll send the DT
as a fix, on top of 4.13-rc1). Is that OK for you ?


-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* Re: [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
  2017-07-12 13:59             ` Alexandre Belloni
@ 2017-07-13  7:59               ` Lee Jones
  -1 siblings, 0 replies; 57+ messages in thread
From: Lee Jones @ 2017-07-13  7:59 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolas Ferre, devicetree, linux-arm-kernel, linux-mtd,
	linux-kernel, boris.brezillon, computersforpeace

On Wed, 12 Jul 2017, Alexandre Belloni wrote:

> On 11/07/2017 at 10:25:56 +0100, Lee Jones wrote:
> > On Tue, 11 Jul 2017, Ludovic Desroches wrote:
> > 
> > > On Tue, Jul 11, 2017 at 09:58:29AM +0200, Ludovic Desroches wrote:
> > > > On Tue, Jul 11, 2017 at 09:52:58AM +0200, Nicolas Ferre wrote:
> > > > > On 11/07/2017 at 09:40, Ludovic Desroches wrote:
> > > > > > A new compatible string has been introduced for sama5d2 SMC to allow to
> > > > > > manage the registers mapping change.
> > > > > > 
> > > > > > Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > > > > > ---
> > > > > >  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
> > > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > > 
> > > > > > diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> > > > > > index 4fcd5bb219e3..60e69aeacbdb 100644
> > > > > > --- a/arch/arm/boot/dts/sama5d2.dtsi
> > > > > > +++ b/arch/arm/boot/dts/sama5d2.dtsi
> > > > > > @@ -1048,7 +1048,7 @@
> > > > > >  			};
> > > > > >  
> > > > > >  			hsmc: hsmc@f8014000 {
> > > > > > -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > > > > > +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
> > > > > 
> > > > > You'd better use something like:
> > > > >  compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > > > 
> > > > But it's not true, during data interface setup, we will write values in
> > > > the wrong place if we fallback on "atmel,sama5d3-smc".
> > > > 
> > > > Regards
> > > > 
> > > > Ludovic
> > > > 
> > > > > 
> > > > > So that this patch is independent from the rest of the series and
> > > > > we can avoid to having to synchronize with mfd or mtd/nand for this part.
> > > 
> > > If Lee and Boris agree, maybe the series can go through AT91.
> > 
> > That's fine, but if the series goes though another tree, I will
> > require a pull-request.
> > 
> > I am also happy to carry though the MFD tree (and will of course send
> > out a PR to the other affected Maintainers).
> > 
> 
> I think the easiest is that you take the first two patches through mfd
> and I'll take the third one through at91.
> 
> Our plan is to get everything fixed for the final 4.13 (I'll send the DT
> as a fix, on top of 4.13-rc1). Is that OK for you ?

Perfect.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-13  7:59               ` Lee Jones
  0 siblings, 0 replies; 57+ messages in thread
From: Lee Jones @ 2017-07-13  7:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 12 Jul 2017, Alexandre Belloni wrote:

> On 11/07/2017 at 10:25:56 +0100, Lee Jones wrote:
> > On Tue, 11 Jul 2017, Ludovic Desroches wrote:
> > 
> > > On Tue, Jul 11, 2017 at 09:58:29AM +0200, Ludovic Desroches wrote:
> > > > On Tue, Jul 11, 2017 at 09:52:58AM +0200, Nicolas Ferre wrote:
> > > > > On 11/07/2017 at 09:40, Ludovic Desroches wrote:
> > > > > > A new compatible string has been introduced for sama5d2 SMC to allow to
> > > > > > manage the registers mapping change.
> > > > > > 
> > > > > > Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > > > > > ---
> > > > > >  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
> > > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > > 
> > > > > > diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> > > > > > index 4fcd5bb219e3..60e69aeacbdb 100644
> > > > > > --- a/arch/arm/boot/dts/sama5d2.dtsi
> > > > > > +++ b/arch/arm/boot/dts/sama5d2.dtsi
> > > > > > @@ -1048,7 +1048,7 @@
> > > > > >  			};
> > > > > >  
> > > > > >  			hsmc: hsmc at f8014000 {
> > > > > > -				compatible = "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > > > > > +				compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
> > > > > 
> > > > > You'd better use something like:
> > > > >  compatible = "atmel,sama5d2-smc", "atmel,sama5d3-smc", "syscon", "simple-mfd";
> > > > 
> > > > But it's not true, during data interface setup, we will write values in
> > > > the wrong place if we fallback on "atmel,sama5d3-smc".
> > > > 
> > > > Regards
> > > > 
> > > > Ludovic
> > > > 
> > > > > 
> > > > > So that this patch is independent from the rest of the series and
> > > > > we can avoid to having to synchronize with mfd or mtd/nand for this part.
> > > 
> > > If Lee and Boris agree, maybe the series can go through AT91.
> > 
> > That's fine, but if the series goes though another tree, I will
> > require a pull-request.
> > 
> > I am also happy to carry though the MFD tree (and will of course send
> > out a PR to the other affected Maintainers).
> > 
> 
> I think the easiest is that you take the first two patches through mfd
> and I'll take the third one through at91.
> 
> Our plan is to get everything fixed for the final 4.13 (I'll send the DT
> as a fix, on top of 4.13-rc1). Is that OK for you ?

Perfect.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 1/3] mfd: syscon: update Atmel SMC binding doc
@ 2017-07-14 16:06     ` Rob Herring
  0 siblings, 0 replies; 57+ messages in thread
From: Rob Herring @ 2017-07-14 16:06 UTC (permalink / raw)
  To: Ludovic Desroches
  Cc: devicetree, linux-arm-kernel, linux-mtd, linux-kernel, lee.jones,
	nicolas.ferre, alexandre.belloni, boris.brezillon,
	computersforpeace

On Tue, Jul 11, 2017 at 09:40:13AM +0200, Ludovic Desroches wrote:
> A new compatible string is introduced for SMC on sama5d2 to manage a
> different layout of the registers.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> ---
>  Documentation/devicetree/bindings/mfd/atmel-smc.txt | 1 +
>  1 file changed, 1 insertion(+)

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH 1/3] mfd: syscon: update Atmel SMC binding doc
@ 2017-07-14 16:06     ` Rob Herring
  0 siblings, 0 replies; 57+ messages in thread
From: Rob Herring @ 2017-07-14 16:06 UTC (permalink / raw)
  To: Ludovic Desroches
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	nicolas.ferre-UWL1GkI3JZL3oGB3hsPCZA,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	computersforpeace-Re5JQEeQqe8AvxtiuMwx3w

On Tue, Jul 11, 2017 at 09:40:13AM +0200, Ludovic Desroches wrote:
> A new compatible string is introduced for SMC on sama5d2 to manage a
> different layout of the registers.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/mfd/atmel-smc.txt | 1 +
>  1 file changed, 1 insertion(+)

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/3] mfd: syscon: update Atmel SMC binding doc
@ 2017-07-14 16:06     ` Rob Herring
  0 siblings, 0 replies; 57+ messages in thread
From: Rob Herring @ 2017-07-14 16:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jul 11, 2017 at 09:40:13AM +0200, Ludovic Desroches wrote:
> A new compatible string is introduced for SMC on sama5d2 to manage a
> different layout of the registers.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> ---
>  Documentation/devicetree/bindings/mfd/atmel-smc.txt | 1 +
>  1 file changed, 1 insertion(+)

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
  2017-07-11  7:40   ` Ludovic Desroches
@ 2017-07-17  9:17     ` Alexandre Belloni
  -1 siblings, 0 replies; 57+ messages in thread
From: Alexandre Belloni @ 2017-07-17  9:17 UTC (permalink / raw)
  To: Ludovic Desroches
  Cc: devicetree, linux-arm-kernel, linux-mtd, linux-kernel, lee.jones,
	nicolas.ferre, boris.brezillon, computersforpeace

On 11/07/2017 at 09:40:15 +0200, Ludovic Desroches wrote:
> A new compatible string has been introduced for sama5d2 SMC to allow to
> manage the registers mapping change.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> ---
>  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
@ 2017-07-17  9:17     ` Alexandre Belloni
  0 siblings, 0 replies; 57+ messages in thread
From: Alexandre Belloni @ 2017-07-17  9:17 UTC (permalink / raw)
  To: linux-arm-kernel

On 11/07/2017 at 09:40:15 +0200, Ludovic Desroches wrote:
> A new compatible string has been introduced for sama5d2 SMC to allow to
> manage the registers mapping change.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> ---
>  arch/arm/boot/dts/sama5d2.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* Re: [PATCH 1/3] mfd: syscon: update Atmel SMC binding doc
@ 2017-07-18  8:10     ` Lee Jones
  0 siblings, 0 replies; 57+ messages in thread
From: Lee Jones @ 2017-07-18  8:10 UTC (permalink / raw)
  To: Ludovic Desroches
  Cc: devicetree, linux-arm-kernel, linux-mtd, linux-kernel,
	nicolas.ferre, alexandre.belloni, boris.brezillon,
	computersforpeace

On Tue, 11 Jul 2017, Ludovic Desroches wrote:

> A new compatible string is introduced for SMC on sama5d2 to manage a
> different layout of the registers.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> ---
>  Documentation/devicetree/bindings/mfd/atmel-smc.txt | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks.

> diff --git a/Documentation/devicetree/bindings/mfd/atmel-smc.txt b/Documentation/devicetree/bindings/mfd/atmel-smc.txt
> index 26eeed373934..1103ce2030fb 100644
> --- a/Documentation/devicetree/bindings/mfd/atmel-smc.txt
> +++ b/Documentation/devicetree/bindings/mfd/atmel-smc.txt
> @@ -8,6 +8,7 @@ Required properties:
>  - compatible:		Should be one of the following
>  			"atmel,at91sam9260-smc", "syscon"
>  			"atmel,sama5d3-smc", "syscon"
> +			"atmel,sama5d2-smc", "syscon"
>  - reg:			Contains offset/length value of the SMC memory
>  			region.
>  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 1/3] mfd: syscon: update Atmel SMC binding doc
@ 2017-07-18  8:10     ` Lee Jones
  0 siblings, 0 replies; 57+ messages in thread
From: Lee Jones @ 2017-07-18  8:10 UTC (permalink / raw)
  To: Ludovic Desroches
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	nicolas.ferre-UWL1GkI3JZL3oGB3hsPCZA,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	computersforpeace-Re5JQEeQqe8AvxtiuMwx3w

On Tue, 11 Jul 2017, Ludovic Desroches wrote:

> A new compatible string is introduced for SMC on sama5d2 to manage a
> different layout of the registers.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/mfd/atmel-smc.txt | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks.

> diff --git a/Documentation/devicetree/bindings/mfd/atmel-smc.txt b/Documentation/devicetree/bindings/mfd/atmel-smc.txt
> index 26eeed373934..1103ce2030fb 100644
> --- a/Documentation/devicetree/bindings/mfd/atmel-smc.txt
> +++ b/Documentation/devicetree/bindings/mfd/atmel-smc.txt
> @@ -8,6 +8,7 @@ Required properties:
>  - compatible:		Should be one of the following
>  			"atmel,at91sam9260-smc", "syscon"
>  			"atmel,sama5d3-smc", "syscon"
> +			"atmel,sama5d2-smc", "syscon"
>  - reg:			Contains offset/length value of the SMC memory
>  			region.
>  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/3] mfd: syscon: update Atmel SMC binding doc
@ 2017-07-18  8:10     ` Lee Jones
  0 siblings, 0 replies; 57+ messages in thread
From: Lee Jones @ 2017-07-18  8:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 11 Jul 2017, Ludovic Desroches wrote:

> A new compatible string is introduced for SMC on sama5d2 to manage a
> different layout of the registers.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> ---
>  Documentation/devicetree/bindings/mfd/atmel-smc.txt | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks.

> diff --git a/Documentation/devicetree/bindings/mfd/atmel-smc.txt b/Documentation/devicetree/bindings/mfd/atmel-smc.txt
> index 26eeed373934..1103ce2030fb 100644
> --- a/Documentation/devicetree/bindings/mfd/atmel-smc.txt
> +++ b/Documentation/devicetree/bindings/mfd/atmel-smc.txt
> @@ -8,6 +8,7 @@ Required properties:
>  - compatible:		Should be one of the following
>  			"atmel,at91sam9260-smc", "syscon"
>  			"atmel,sama5d3-smc", "syscon"
> +			"atmel,sama5d2-smc", "syscon"
>  - reg:			Contains offset/length value of the SMC memory
>  			region.
>  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
  2017-07-11  7:40   ` Ludovic Desroches
@ 2017-07-18  8:15     ` Lee Jones
  -1 siblings, 0 replies; 57+ messages in thread
From: Lee Jones @ 2017-07-18  8:15 UTC (permalink / raw)
  To: Ludovic Desroches
  Cc: devicetree, linux-arm-kernel, linux-mtd, linux-kernel,
	nicolas.ferre, alexandre.belloni, boris.brezillon,
	computersforpeace

On Tue, 11 Jul 2017, Ludovic Desroches wrote:

> For HSMC controller, the register layout depends on the device i.e. the
> offset of setup, pulse, cycle, mode and timings registers is not the
> same. An helper is added to provide the correct register layout.
> 
> Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
> SMC regs manipulation")
> Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> ---
>  drivers/memory/atmel-ebi.c               | 13 +++++--
>  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
>  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
>  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
>  4 files changed, 92 insertions(+), 30 deletions(-)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
@ 2017-07-18  8:15     ` Lee Jones
  0 siblings, 0 replies; 57+ messages in thread
From: Lee Jones @ 2017-07-18  8:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 11 Jul 2017, Ludovic Desroches wrote:

> For HSMC controller, the register layout depends on the device i.e. the
> offset of setup, pulse, cycle, mode and timings registers is not the
> same. An helper is added to provide the correct register layout.
> 
> Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
> SMC regs manipulation")
> Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> ---
>  drivers/memory/atmel-ebi.c               | 13 +++++--
>  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
>  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
>  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
>  4 files changed, 92 insertions(+), 30 deletions(-)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
  2017-07-18  8:15     ` Lee Jones
@ 2017-07-18  9:12       ` Lee Jones
  -1 siblings, 0 replies; 57+ messages in thread
From: Lee Jones @ 2017-07-18  9:12 UTC (permalink / raw)
  To: Ludovic Desroches
  Cc: devicetree, linux-arm-kernel, linux-mtd, linux-kernel,
	nicolas.ferre, alexandre.belloni, boris.brezillon,
	computersforpeace

On Tue, 18 Jul 2017, Lee Jones wrote:

> On Tue, 11 Jul 2017, Ludovic Desroches wrote:
> 
> > For HSMC controller, the register layout depends on the device i.e. the
> > offset of setup, pulse, cycle, mode and timings registers is not the
> > same. An helper is added to provide the correct register layout.
> > 
> > Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
> > SMC regs manipulation")
> > Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > ---
> >  drivers/memory/atmel-ebi.c               | 13 +++++--
> >  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
> >  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
> >  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
> >  4 files changed, 92 insertions(+), 30 deletions(-)
> 
> Applied, thanks.

Apologies, it looks like this needs 2 more Acks before I can even
consider taking it.

Unapplied.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
@ 2017-07-18  9:12       ` Lee Jones
  0 siblings, 0 replies; 57+ messages in thread
From: Lee Jones @ 2017-07-18  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 18 Jul 2017, Lee Jones wrote:

> On Tue, 11 Jul 2017, Ludovic Desroches wrote:
> 
> > For HSMC controller, the register layout depends on the device i.e. the
> > offset of setup, pulse, cycle, mode and timings registers is not the
> > same. An helper is added to provide the correct register layout.
> > 
> > Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
> > SMC regs manipulation")
> > Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > ---
> >  drivers/memory/atmel-ebi.c               | 13 +++++--
> >  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
> >  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
> >  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
> >  4 files changed, 92 insertions(+), 30 deletions(-)
> 
> Applied, thanks.

Apologies, it looks like this needs 2 more Acks before I can even
consider taking it.

Unapplied.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
  2017-07-18  9:12       ` Lee Jones
  (?)
@ 2017-07-18  9:23         ` Nicolas Ferre
  -1 siblings, 0 replies; 57+ messages in thread
From: Nicolas Ferre @ 2017-07-18  9:23 UTC (permalink / raw)
  To: Lee Jones, Ludovic Desroches
  Cc: devicetree, linux-arm-kernel, linux-mtd, linux-kernel,
	alexandre.belloni, boris.brezillon, computersforpeace

On 18/07/2017 at 11:12, Lee Jones wrote:
> On Tue, 18 Jul 2017, Lee Jones wrote:
> 
>> On Tue, 11 Jul 2017, Ludovic Desroches wrote:
>>
>>> For HSMC controller, the register layout depends on the device i.e. the
>>> offset of setup, pulse, cycle, mode and timings registers is not the
>>> same. An helper is added to provide the correct register layout.
>>>
>>> Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
>>> SMC regs manipulation")
>>> Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
>>> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
>>> ---
>>>  drivers/memory/atmel-ebi.c               | 13 +++++--
>>>  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
>>>  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
>>>  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
>>>  4 files changed, 92 insertions(+), 30 deletions(-)
>>
>> Applied, thanks.
> 
> Apologies, it looks like this needs 2 more Acks before I can even
> consider taking it.
> 
> Unapplied.

If mine is missing, here it is:

For the whole series:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

And I think that Alexandre seemed okay by discussing the path those
patches should take...


Thanks, bye,
-- 
Nicolas Ferre

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

* Re: [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
@ 2017-07-18  9:23         ` Nicolas Ferre
  0 siblings, 0 replies; 57+ messages in thread
From: Nicolas Ferre @ 2017-07-18  9:23 UTC (permalink / raw)
  To: Lee Jones, Ludovic Desroches
  Cc: devicetree, boris.brezillon, linux-kernel, alexandre.belloni,
	linux-mtd, computersforpeace, linux-arm-kernel

On 18/07/2017 at 11:12, Lee Jones wrote:
> On Tue, 18 Jul 2017, Lee Jones wrote:
> 
>> On Tue, 11 Jul 2017, Ludovic Desroches wrote:
>>
>>> For HSMC controller, the register layout depends on the device i.e. the
>>> offset of setup, pulse, cycle, mode and timings registers is not the
>>> same. An helper is added to provide the correct register layout.
>>>
>>> Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
>>> SMC regs manipulation")
>>> Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
>>> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
>>> ---
>>>  drivers/memory/atmel-ebi.c               | 13 +++++--
>>>  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
>>>  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
>>>  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
>>>  4 files changed, 92 insertions(+), 30 deletions(-)
>>
>> Applied, thanks.
> 
> Apologies, it looks like this needs 2 more Acks before I can even
> consider taking it.
> 
> Unapplied.

If mine is missing, here it is:

For the whole series:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

And I think that Alexandre seemed okay by discussing the path those
patches should take...


Thanks, bye,
-- 
Nicolas Ferre

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

* [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
@ 2017-07-18  9:23         ` Nicolas Ferre
  0 siblings, 0 replies; 57+ messages in thread
From: Nicolas Ferre @ 2017-07-18  9:23 UTC (permalink / raw)
  To: linux-arm-kernel

On 18/07/2017 at 11:12, Lee Jones wrote:
> On Tue, 18 Jul 2017, Lee Jones wrote:
> 
>> On Tue, 11 Jul 2017, Ludovic Desroches wrote:
>>
>>> For HSMC controller, the register layout depends on the device i.e. the
>>> offset of setup, pulse, cycle, mode and timings registers is not the
>>> same. An helper is added to provide the correct register layout.
>>>
>>> Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
>>> SMC regs manipulation")
>>> Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
>>> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
>>> ---
>>>  drivers/memory/atmel-ebi.c               | 13 +++++--
>>>  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
>>>  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
>>>  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
>>>  4 files changed, 92 insertions(+), 30 deletions(-)
>>
>> Applied, thanks.
> 
> Apologies, it looks like this needs 2 more Acks before I can even
> consider taking it.
> 
> Unapplied.

If mine is missing, here it is:

For the whole series:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

And I think that Alexandre seemed okay by discussing the path those
patches should take...


Thanks, bye,
-- 
Nicolas Ferre

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

* Re: [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
  2017-07-11  7:40   ` Ludovic Desroches
@ 2017-07-18  9:24     ` Alexandre Belloni
  -1 siblings, 0 replies; 57+ messages in thread
From: Alexandre Belloni @ 2017-07-18  9:24 UTC (permalink / raw)
  To: Ludovic Desroches
  Cc: devicetree, linux-arm-kernel, linux-mtd, linux-kernel, lee.jones,
	nicolas.ferre, boris.brezillon, computersforpeace

On 11/07/2017 at 09:40:14 +0200, Ludovic Desroches wrote:
> For HSMC controller, the register layout depends on the device i.e. the
> offset of setup, pulse, cycle, mode and timings registers is not the
> same. An helper is added to provide the correct register layout.
> 
> Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
> SMC regs manipulation")
> Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
>  drivers/memory/atmel-ebi.c               | 13 +++++--
>  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
>  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
>  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
>  4 files changed, 92 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
> index 99e644cda4d1..63c9e7a76854 100644
> --- a/drivers/memory/atmel-ebi.c
> +++ b/drivers/memory/atmel-ebi.c
> @@ -51,6 +51,7 @@ struct atmel_ebi {
>  	struct  {
>  		struct regmap *regmap;
>  		struct clk *clk;
> +		const struct atmel_hsmc_reg_layout *layout;
>  	} smc;
>  
>  	struct device *dev;
> @@ -84,8 +85,8 @@ static void at91sam9_ebi_get_config(struct atmel_ebi_dev *ebid,
>  static void sama5_ebi_get_config(struct atmel_ebi_dev *ebid,
>  				 struct atmel_ebi_dev_config *conf)
>  {
> -	atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, conf->cs,
> -			       &conf->smcconf);
> +	atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, ebid->ebi->smc.layout,
> +			       conf->cs, &conf->smcconf);
>  }
>  
>  static const struct atmel_smc_timing_xlate timings_xlate_table[] = {
> @@ -285,8 +286,8 @@ static void at91sam9_ebi_apply_config(struct atmel_ebi_dev *ebid,
>  static void sama5_ebi_apply_config(struct atmel_ebi_dev *ebid,
>  				   struct atmel_ebi_dev_config *conf)
>  {
> -	atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, conf->cs,
> -				 &conf->smcconf);
> +	atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, ebid->ebi->smc.layout,
> +				 conf->cs, &conf->smcconf);
>  }
>  
>  static int atmel_ebi_dev_setup(struct atmel_ebi *ebi, struct device_node *np,
> @@ -525,6 +526,10 @@ static int atmel_ebi_probe(struct platform_device *pdev)
>  	if (IS_ERR(ebi->smc.regmap))
>  		return PTR_ERR(ebi->smc.regmap);
>  
> +	ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np);
> +	if (IS_ERR(ebi->smc.layout))
> +		return PTR_ERR(ebi->smc.layout);
> +
>  	ebi->smc.clk = of_clk_get(smc_np, 0);
>  	if (IS_ERR(ebi->smc.clk)) {
>  		if (PTR_ERR(ebi->smc.clk) != -ENOENT)
> diff --git a/drivers/mfd/atmel-smc.c b/drivers/mfd/atmel-smc.c
> index 954cf0f66a31..1ad44e63b511 100644
> --- a/drivers/mfd/atmel-smc.c
> +++ b/drivers/mfd/atmel-smc.c
> @@ -258,19 +258,21 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_apply);
>   * atmel_hsmc_cs_conf_apply - apply an SMC CS conf
>   * @regmap: the HSMC regmap
>   * @cs: the CS id
> + * @layout: the layout of registers
>   * @conf the SMC CS conf to apply
>   *
>   * Applies an SMC CS configuration.
>   * Only valid on post-sama5 SoCs.
>   */
> -void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
> -			      const struct atmel_smc_cs_conf *conf)
> +void atmel_hsmc_cs_conf_apply(struct regmap *regmap,
> +			      const struct atmel_hsmc_reg_layout *layout,
> +			      int cs, const struct atmel_smc_cs_conf *conf)
>  {
> -	regmap_write(regmap, ATMEL_HSMC_SETUP(cs), conf->setup);
> -	regmap_write(regmap, ATMEL_HSMC_PULSE(cs), conf->pulse);
> -	regmap_write(regmap, ATMEL_HSMC_CYCLE(cs), conf->cycle);
> -	regmap_write(regmap, ATMEL_HSMC_TIMINGS(cs), conf->timings);
> -	regmap_write(regmap, ATMEL_HSMC_MODE(cs), conf->mode);
> +	regmap_write(regmap, ATMEL_HSMC_SETUP(layout, cs), conf->setup);
> +	regmap_write(regmap, ATMEL_HSMC_PULSE(layout, cs), conf->pulse);
> +	regmap_write(regmap, ATMEL_HSMC_CYCLE(layout, cs), conf->cycle);
> +	regmap_write(regmap, ATMEL_HSMC_TIMINGS(layout, cs), conf->timings);
> +	regmap_write(regmap, ATMEL_HSMC_MODE(layout, cs), conf->mode);
>  }
>  EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_apply);
>  
> @@ -297,18 +299,55 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_get);
>   * atmel_hsmc_cs_conf_get - retrieve the current SMC CS conf
>   * @regmap: the HSMC regmap
>   * @cs: the CS id
> + * @layout: the layout of registers
>   * @conf: the SMC CS conf object to store the current conf
>   *
>   * Retrieve the SMC CS configuration.
>   * Only valid on post-sama5 SoCs.
>   */
> -void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
> -			    struct atmel_smc_cs_conf *conf)
> +void atmel_hsmc_cs_conf_get(struct regmap *regmap,
> +			    const struct atmel_hsmc_reg_layout *layout,
> +			    int cs, struct atmel_smc_cs_conf *conf)
>  {
> -	regmap_read(regmap, ATMEL_HSMC_SETUP(cs), &conf->setup);
> -	regmap_read(regmap, ATMEL_HSMC_PULSE(cs), &conf->pulse);
> -	regmap_read(regmap, ATMEL_HSMC_CYCLE(cs), &conf->cycle);
> -	regmap_read(regmap, ATMEL_HSMC_TIMINGS(cs), &conf->timings);
> -	regmap_read(regmap, ATMEL_HSMC_MODE(cs), &conf->mode);
> +	regmap_read(regmap, ATMEL_HSMC_SETUP(layout, cs), &conf->setup);
> +	regmap_read(regmap, ATMEL_HSMC_PULSE(layout, cs), &conf->pulse);
> +	regmap_read(regmap, ATMEL_HSMC_CYCLE(layout, cs), &conf->cycle);
> +	regmap_read(regmap, ATMEL_HSMC_TIMINGS(layout, cs), &conf->timings);
> +	regmap_read(regmap, ATMEL_HSMC_MODE(layout, cs), &conf->mode);
>  }
>  EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_get);
> +
> +static const struct atmel_hsmc_reg_layout sama5d3_reg_layout = {
> +	.timing_regs_offset = 0x600,
> +};
> +
> +static const struct atmel_hsmc_reg_layout sama5d2_reg_layout = {
> +	.timing_regs_offset = 0x700,
> +};
> +
> +static const struct of_device_id atmel_smc_ids[] = {
> +	{ .compatible = "atmel,at91sam9260-smc", .data = NULL },
> +	{ .compatible = "atmel,sama5d3-smc", .data = &sama5d3_reg_layout },
> +	{ .compatible = "atmel,sama5d2-smc", .data = &sama5d2_reg_layout },
> +	{ /* sentinel */ },
> +};
> +
> +/**
> + * atmel_hsmc_get_reg_layout - retrieve the layout of HSMC registers
> + * @np: the HSMC regmap
> + *
> + * Retrieve the layout of HSMC registers.
> + *
> + * Returns NULL in case of SMC, a struct atmel_hsmc_reg_layout pointer
> + * in HSMC case, otherwise ERR_PTR(-EINVAL).
> + */
> +const struct atmel_hsmc_reg_layout *
> +atmel_hsmc_get_reg_layout(struct device_node *np)
> +{
> +	const struct of_device_id *match;
> +
> +	match = of_match_node(atmel_hsmc_ids, np);
> +
> +	return match ? match->data : ERR_PTR(-EINVAL);
> +}
> +EXPORT_SYMBOL_GPL(atmel_hsmc_get_reg_layout);
> diff --git a/drivers/mtd/nand/atmel/nand-controller.c b/drivers/mtd/nand/atmel/nand-controller.c
> index d922a88e407f..29396e618965 100644
> --- a/drivers/mtd/nand/atmel/nand-controller.c
> +++ b/drivers/mtd/nand/atmel/nand-controller.c
> @@ -247,6 +247,7 @@ struct atmel_hsmc_nand_controller {
>  		void __iomem *virt;
>  		dma_addr_t dma;
>  	} sram;
> +	const struct atmel_hsmc_reg_layout *hsmc_layout;
>  	struct regmap *io;
>  	struct atmel_nfc_op op;
>  	struct completion complete;
> @@ -1431,12 +1432,12 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
>  					int csline,
>  					const struct nand_data_interface *conf)
>  {
> -	struct atmel_nand_controller *nc;
> +	struct atmel_hsmc_nand_controller *nc;
>  	struct atmel_smc_cs_conf smcconf;
>  	struct atmel_nand_cs *cs;
>  	int ret;
>  
> -	nc = to_nand_controller(nand->base.controller);
> +	nc = to_hsmc_nand_controller(nand->base.controller);
>  
>  	ret = atmel_smc_nand_prepare_smcconf(nand, conf, &smcconf);
>  	if (ret)
> @@ -1451,7 +1452,8 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
>  	if (cs->rb.type == ATMEL_NAND_NATIVE_RB)
>  		cs->smcconf.timings |= ATMEL_HSMC_TIMINGS_RBNSEL(cs->rb.id);
>  
> -	atmel_hsmc_cs_conf_apply(nc->smc, cs->id, &cs->smcconf);
> +	atmel_hsmc_cs_conf_apply(nc->base.smc, nc->hsmc_layout, cs->id,
> +				 &cs->smcconf);
>  
>  	return 0;
>  }
> @@ -2166,6 +2168,8 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc)
>  		return -EINVAL;
>  	}
>  
> +	nc->hsmc_layout = atmel_hsmc_get_reg_layout(np);
> +
>  	nc->irq = of_irq_get(np, 0);
>  	of_node_put(np);
>  	if (nc->irq < 0) {
> diff --git a/include/linux/mfd/syscon/atmel-smc.h b/include/linux/mfd/syscon/atmel-smc.h
> index afa266169800..7a367f34b66a 100644
> --- a/include/linux/mfd/syscon/atmel-smc.h
> +++ b/include/linux/mfd/syscon/atmel-smc.h
> @@ -15,21 +15,26 @@
>  #define _LINUX_MFD_SYSCON_ATMEL_SMC_H_
>  
>  #include <linux/kernel.h>
> +#include <linux/of.h>
>  #include <linux/regmap.h>
>  
>  #define ATMEL_SMC_SETUP(cs)			(((cs) * 0x10))
> -#define ATMEL_HSMC_SETUP(cs)			(0x600 + ((cs) * 0x14))
> +#define ATMEL_HSMC_SETUP(layout, cs)		\
> +	((layout)->timing_regs_offset + ((cs) * 0x14))
>  #define ATMEL_SMC_PULSE(cs)			(((cs) * 0x10) + 0x4)
> -#define ATMEL_HSMC_PULSE(cs)			(0x600 + ((cs) * 0x14) + 0x4)
> +#define ATMEL_HSMC_PULSE(layout, cs)		\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x4)
>  #define ATMEL_SMC_CYCLE(cs)			(((cs) * 0x10) + 0x8)
> -#define ATMEL_HSMC_CYCLE(cs)			(0x600 + ((cs) * 0x14) + 0x8)
> +#define ATMEL_HSMC_CYCLE(layout, cs)			\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x8)
>  #define ATMEL_SMC_NWE_SHIFT			0
>  #define ATMEL_SMC_NCS_WR_SHIFT			8
>  #define ATMEL_SMC_NRD_SHIFT			16
>  #define ATMEL_SMC_NCS_RD_SHIFT			24
>  
>  #define ATMEL_SMC_MODE(cs)			(((cs) * 0x10) + 0xc)
> -#define ATMEL_HSMC_MODE(cs)			(0x600 + ((cs) * 0x14) + 0x10)
> +#define ATMEL_HSMC_MODE(layout, cs)			\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x10)
>  #define ATMEL_SMC_MODE_READMODE_MASK		BIT(0)
>  #define ATMEL_SMC_MODE_READMODE_NCS		(0 << 0)
>  #define ATMEL_SMC_MODE_READMODE_NRD		(1 << 0)
> @@ -59,7 +64,8 @@
>  #define ATMEL_SMC_MODE_PS_16			(2 << 28)
>  #define ATMEL_SMC_MODE_PS_32			(3 << 28)
>  
> -#define ATMEL_HSMC_TIMINGS(cs)			(0x600 + ((cs) * 0x14) + 0xc)
> +#define ATMEL_HSMC_TIMINGS(layout, cs)			\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0xc)
>  #define ATMEL_HSMC_TIMINGS_OCMS			BIT(12)
>  #define ATMEL_HSMC_TIMINGS_RBNSEL(x)		((x) << 28)
>  #define ATMEL_HSMC_TIMINGS_NFSEL		BIT(31)
> @@ -69,6 +75,10 @@
>  #define ATMEL_HSMC_TIMINGS_TRR_SHIFT		16
>  #define ATMEL_HSMC_TIMINGS_TWB_SHIFT		24
>  
> +struct atmel_hsmc_reg_layout {
> +	unsigned int timing_regs_offset;
> +};
> +
>  /**
>   * struct atmel_smc_cs_conf - SMC CS config as described in the datasheet.
>   * @setup: NCS/NWE/NRD setup timings (not applicable to at91rm9200)
> @@ -98,11 +108,15 @@ int atmel_smc_cs_conf_set_cycle(struct atmel_smc_cs_conf *conf,
>  				unsigned int shift, unsigned int ncycles);
>  void atmel_smc_cs_conf_apply(struct regmap *regmap, int cs,
>  			     const struct atmel_smc_cs_conf *conf);
> -void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
> -			      const struct atmel_smc_cs_conf *conf);
> +void atmel_hsmc_cs_conf_apply(struct regmap *regmap,
> +			      const struct atmel_hsmc_reg_layout *reglayout,
> +			      int cs, const struct atmel_smc_cs_conf *conf);
>  void atmel_smc_cs_conf_get(struct regmap *regmap, int cs,
>  			   struct atmel_smc_cs_conf *conf);
> -void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
> -			    struct atmel_smc_cs_conf *conf);
> +void atmel_hsmc_cs_conf_get(struct regmap *regmap,
> +			    const struct atmel_hsmc_reg_layout *reglayout,
> +			    int cs, struct atmel_smc_cs_conf *conf);
> +const struct atmel_hsmc_reg_layout *
> +atmel_hsmc_get_reg_layout(struct device_node *np);
>  
>  #endif /* _LINUX_MFD_SYSCON_ATMEL_SMC_H_ */
> -- 
> 2.12.2
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
@ 2017-07-18  9:24     ` Alexandre Belloni
  0 siblings, 0 replies; 57+ messages in thread
From: Alexandre Belloni @ 2017-07-18  9:24 UTC (permalink / raw)
  To: linux-arm-kernel

On 11/07/2017 at 09:40:14 +0200, Ludovic Desroches wrote:
> For HSMC controller, the register layout depends on the device i.e. the
> offset of setup, pulse, cycle, mode and timings registers is not the
> same. An helper is added to provide the correct register layout.
> 
> Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
> SMC regs manipulation")
> Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
>  drivers/memory/atmel-ebi.c               | 13 +++++--
>  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
>  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
>  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
>  4 files changed, 92 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
> index 99e644cda4d1..63c9e7a76854 100644
> --- a/drivers/memory/atmel-ebi.c
> +++ b/drivers/memory/atmel-ebi.c
> @@ -51,6 +51,7 @@ struct atmel_ebi {
>  	struct  {
>  		struct regmap *regmap;
>  		struct clk *clk;
> +		const struct atmel_hsmc_reg_layout *layout;
>  	} smc;
>  
>  	struct device *dev;
> @@ -84,8 +85,8 @@ static void at91sam9_ebi_get_config(struct atmel_ebi_dev *ebid,
>  static void sama5_ebi_get_config(struct atmel_ebi_dev *ebid,
>  				 struct atmel_ebi_dev_config *conf)
>  {
> -	atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, conf->cs,
> -			       &conf->smcconf);
> +	atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, ebid->ebi->smc.layout,
> +			       conf->cs, &conf->smcconf);
>  }
>  
>  static const struct atmel_smc_timing_xlate timings_xlate_table[] = {
> @@ -285,8 +286,8 @@ static void at91sam9_ebi_apply_config(struct atmel_ebi_dev *ebid,
>  static void sama5_ebi_apply_config(struct atmel_ebi_dev *ebid,
>  				   struct atmel_ebi_dev_config *conf)
>  {
> -	atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, conf->cs,
> -				 &conf->smcconf);
> +	atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, ebid->ebi->smc.layout,
> +				 conf->cs, &conf->smcconf);
>  }
>  
>  static int atmel_ebi_dev_setup(struct atmel_ebi *ebi, struct device_node *np,
> @@ -525,6 +526,10 @@ static int atmel_ebi_probe(struct platform_device *pdev)
>  	if (IS_ERR(ebi->smc.regmap))
>  		return PTR_ERR(ebi->smc.regmap);
>  
> +	ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np);
> +	if (IS_ERR(ebi->smc.layout))
> +		return PTR_ERR(ebi->smc.layout);
> +
>  	ebi->smc.clk = of_clk_get(smc_np, 0);
>  	if (IS_ERR(ebi->smc.clk)) {
>  		if (PTR_ERR(ebi->smc.clk) != -ENOENT)
> diff --git a/drivers/mfd/atmel-smc.c b/drivers/mfd/atmel-smc.c
> index 954cf0f66a31..1ad44e63b511 100644
> --- a/drivers/mfd/atmel-smc.c
> +++ b/drivers/mfd/atmel-smc.c
> @@ -258,19 +258,21 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_apply);
>   * atmel_hsmc_cs_conf_apply - apply an SMC CS conf
>   * @regmap: the HSMC regmap
>   * @cs: the CS id
> + * @layout: the layout of registers
>   * @conf the SMC CS conf to apply
>   *
>   * Applies an SMC CS configuration.
>   * Only valid on post-sama5 SoCs.
>   */
> -void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
> -			      const struct atmel_smc_cs_conf *conf)
> +void atmel_hsmc_cs_conf_apply(struct regmap *regmap,
> +			      const struct atmel_hsmc_reg_layout *layout,
> +			      int cs, const struct atmel_smc_cs_conf *conf)
>  {
> -	regmap_write(regmap, ATMEL_HSMC_SETUP(cs), conf->setup);
> -	regmap_write(regmap, ATMEL_HSMC_PULSE(cs), conf->pulse);
> -	regmap_write(regmap, ATMEL_HSMC_CYCLE(cs), conf->cycle);
> -	regmap_write(regmap, ATMEL_HSMC_TIMINGS(cs), conf->timings);
> -	regmap_write(regmap, ATMEL_HSMC_MODE(cs), conf->mode);
> +	regmap_write(regmap, ATMEL_HSMC_SETUP(layout, cs), conf->setup);
> +	regmap_write(regmap, ATMEL_HSMC_PULSE(layout, cs), conf->pulse);
> +	regmap_write(regmap, ATMEL_HSMC_CYCLE(layout, cs), conf->cycle);
> +	regmap_write(regmap, ATMEL_HSMC_TIMINGS(layout, cs), conf->timings);
> +	regmap_write(regmap, ATMEL_HSMC_MODE(layout, cs), conf->mode);
>  }
>  EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_apply);
>  
> @@ -297,18 +299,55 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_get);
>   * atmel_hsmc_cs_conf_get - retrieve the current SMC CS conf
>   * @regmap: the HSMC regmap
>   * @cs: the CS id
> + * @layout: the layout of registers
>   * @conf: the SMC CS conf object to store the current conf
>   *
>   * Retrieve the SMC CS configuration.
>   * Only valid on post-sama5 SoCs.
>   */
> -void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
> -			    struct atmel_smc_cs_conf *conf)
> +void atmel_hsmc_cs_conf_get(struct regmap *regmap,
> +			    const struct atmel_hsmc_reg_layout *layout,
> +			    int cs, struct atmel_smc_cs_conf *conf)
>  {
> -	regmap_read(regmap, ATMEL_HSMC_SETUP(cs), &conf->setup);
> -	regmap_read(regmap, ATMEL_HSMC_PULSE(cs), &conf->pulse);
> -	regmap_read(regmap, ATMEL_HSMC_CYCLE(cs), &conf->cycle);
> -	regmap_read(regmap, ATMEL_HSMC_TIMINGS(cs), &conf->timings);
> -	regmap_read(regmap, ATMEL_HSMC_MODE(cs), &conf->mode);
> +	regmap_read(regmap, ATMEL_HSMC_SETUP(layout, cs), &conf->setup);
> +	regmap_read(regmap, ATMEL_HSMC_PULSE(layout, cs), &conf->pulse);
> +	regmap_read(regmap, ATMEL_HSMC_CYCLE(layout, cs), &conf->cycle);
> +	regmap_read(regmap, ATMEL_HSMC_TIMINGS(layout, cs), &conf->timings);
> +	regmap_read(regmap, ATMEL_HSMC_MODE(layout, cs), &conf->mode);
>  }
>  EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_get);
> +
> +static const struct atmel_hsmc_reg_layout sama5d3_reg_layout = {
> +	.timing_regs_offset = 0x600,
> +};
> +
> +static const struct atmel_hsmc_reg_layout sama5d2_reg_layout = {
> +	.timing_regs_offset = 0x700,
> +};
> +
> +static const struct of_device_id atmel_smc_ids[] = {
> +	{ .compatible = "atmel,at91sam9260-smc", .data = NULL },
> +	{ .compatible = "atmel,sama5d3-smc", .data = &sama5d3_reg_layout },
> +	{ .compatible = "atmel,sama5d2-smc", .data = &sama5d2_reg_layout },
> +	{ /* sentinel */ },
> +};
> +
> +/**
> + * atmel_hsmc_get_reg_layout - retrieve the layout of HSMC registers
> + * @np: the HSMC regmap
> + *
> + * Retrieve the layout of HSMC registers.
> + *
> + * Returns NULL in case of SMC, a struct atmel_hsmc_reg_layout pointer
> + * in HSMC case, otherwise ERR_PTR(-EINVAL).
> + */
> +const struct atmel_hsmc_reg_layout *
> +atmel_hsmc_get_reg_layout(struct device_node *np)
> +{
> +	const struct of_device_id *match;
> +
> +	match = of_match_node(atmel_hsmc_ids, np);
> +
> +	return match ? match->data : ERR_PTR(-EINVAL);
> +}
> +EXPORT_SYMBOL_GPL(atmel_hsmc_get_reg_layout);
> diff --git a/drivers/mtd/nand/atmel/nand-controller.c b/drivers/mtd/nand/atmel/nand-controller.c
> index d922a88e407f..29396e618965 100644
> --- a/drivers/mtd/nand/atmel/nand-controller.c
> +++ b/drivers/mtd/nand/atmel/nand-controller.c
> @@ -247,6 +247,7 @@ struct atmel_hsmc_nand_controller {
>  		void __iomem *virt;
>  		dma_addr_t dma;
>  	} sram;
> +	const struct atmel_hsmc_reg_layout *hsmc_layout;
>  	struct regmap *io;
>  	struct atmel_nfc_op op;
>  	struct completion complete;
> @@ -1431,12 +1432,12 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
>  					int csline,
>  					const struct nand_data_interface *conf)
>  {
> -	struct atmel_nand_controller *nc;
> +	struct atmel_hsmc_nand_controller *nc;
>  	struct atmel_smc_cs_conf smcconf;
>  	struct atmel_nand_cs *cs;
>  	int ret;
>  
> -	nc = to_nand_controller(nand->base.controller);
> +	nc = to_hsmc_nand_controller(nand->base.controller);
>  
>  	ret = atmel_smc_nand_prepare_smcconf(nand, conf, &smcconf);
>  	if (ret)
> @@ -1451,7 +1452,8 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
>  	if (cs->rb.type == ATMEL_NAND_NATIVE_RB)
>  		cs->smcconf.timings |= ATMEL_HSMC_TIMINGS_RBNSEL(cs->rb.id);
>  
> -	atmel_hsmc_cs_conf_apply(nc->smc, cs->id, &cs->smcconf);
> +	atmel_hsmc_cs_conf_apply(nc->base.smc, nc->hsmc_layout, cs->id,
> +				 &cs->smcconf);
>  
>  	return 0;
>  }
> @@ -2166,6 +2168,8 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc)
>  		return -EINVAL;
>  	}
>  
> +	nc->hsmc_layout = atmel_hsmc_get_reg_layout(np);
> +
>  	nc->irq = of_irq_get(np, 0);
>  	of_node_put(np);
>  	if (nc->irq < 0) {
> diff --git a/include/linux/mfd/syscon/atmel-smc.h b/include/linux/mfd/syscon/atmel-smc.h
> index afa266169800..7a367f34b66a 100644
> --- a/include/linux/mfd/syscon/atmel-smc.h
> +++ b/include/linux/mfd/syscon/atmel-smc.h
> @@ -15,21 +15,26 @@
>  #define _LINUX_MFD_SYSCON_ATMEL_SMC_H_
>  
>  #include <linux/kernel.h>
> +#include <linux/of.h>
>  #include <linux/regmap.h>
>  
>  #define ATMEL_SMC_SETUP(cs)			(((cs) * 0x10))
> -#define ATMEL_HSMC_SETUP(cs)			(0x600 + ((cs) * 0x14))
> +#define ATMEL_HSMC_SETUP(layout, cs)		\
> +	((layout)->timing_regs_offset + ((cs) * 0x14))
>  #define ATMEL_SMC_PULSE(cs)			(((cs) * 0x10) + 0x4)
> -#define ATMEL_HSMC_PULSE(cs)			(0x600 + ((cs) * 0x14) + 0x4)
> +#define ATMEL_HSMC_PULSE(layout, cs)		\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x4)
>  #define ATMEL_SMC_CYCLE(cs)			(((cs) * 0x10) + 0x8)
> -#define ATMEL_HSMC_CYCLE(cs)			(0x600 + ((cs) * 0x14) + 0x8)
> +#define ATMEL_HSMC_CYCLE(layout, cs)			\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x8)
>  #define ATMEL_SMC_NWE_SHIFT			0
>  #define ATMEL_SMC_NCS_WR_SHIFT			8
>  #define ATMEL_SMC_NRD_SHIFT			16
>  #define ATMEL_SMC_NCS_RD_SHIFT			24
>  
>  #define ATMEL_SMC_MODE(cs)			(((cs) * 0x10) + 0xc)
> -#define ATMEL_HSMC_MODE(cs)			(0x600 + ((cs) * 0x14) + 0x10)
> +#define ATMEL_HSMC_MODE(layout, cs)			\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0x10)
>  #define ATMEL_SMC_MODE_READMODE_MASK		BIT(0)
>  #define ATMEL_SMC_MODE_READMODE_NCS		(0 << 0)
>  #define ATMEL_SMC_MODE_READMODE_NRD		(1 << 0)
> @@ -59,7 +64,8 @@
>  #define ATMEL_SMC_MODE_PS_16			(2 << 28)
>  #define ATMEL_SMC_MODE_PS_32			(3 << 28)
>  
> -#define ATMEL_HSMC_TIMINGS(cs)			(0x600 + ((cs) * 0x14) + 0xc)
> +#define ATMEL_HSMC_TIMINGS(layout, cs)			\
> +	((layout)->timing_regs_offset + ((cs) * 0x14) + 0xc)
>  #define ATMEL_HSMC_TIMINGS_OCMS			BIT(12)
>  #define ATMEL_HSMC_TIMINGS_RBNSEL(x)		((x) << 28)
>  #define ATMEL_HSMC_TIMINGS_NFSEL		BIT(31)
> @@ -69,6 +75,10 @@
>  #define ATMEL_HSMC_TIMINGS_TRR_SHIFT		16
>  #define ATMEL_HSMC_TIMINGS_TWB_SHIFT		24
>  
> +struct atmel_hsmc_reg_layout {
> +	unsigned int timing_regs_offset;
> +};
> +
>  /**
>   * struct atmel_smc_cs_conf - SMC CS config as described in the datasheet.
>   * @setup: NCS/NWE/NRD setup timings (not applicable to at91rm9200)
> @@ -98,11 +108,15 @@ int atmel_smc_cs_conf_set_cycle(struct atmel_smc_cs_conf *conf,
>  				unsigned int shift, unsigned int ncycles);
>  void atmel_smc_cs_conf_apply(struct regmap *regmap, int cs,
>  			     const struct atmel_smc_cs_conf *conf);
> -void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
> -			      const struct atmel_smc_cs_conf *conf);
> +void atmel_hsmc_cs_conf_apply(struct regmap *regmap,
> +			      const struct atmel_hsmc_reg_layout *reglayout,
> +			      int cs, const struct atmel_smc_cs_conf *conf);
>  void atmel_smc_cs_conf_get(struct regmap *regmap, int cs,
>  			   struct atmel_smc_cs_conf *conf);
> -void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
> -			    struct atmel_smc_cs_conf *conf);
> +void atmel_hsmc_cs_conf_get(struct regmap *regmap,
> +			    const struct atmel_hsmc_reg_layout *reglayout,
> +			    int cs, struct atmel_smc_cs_conf *conf);
> +const struct atmel_hsmc_reg_layout *
> +atmel_hsmc_get_reg_layout(struct device_node *np);
>  
>  #endif /* _LINUX_MFD_SYSCON_ATMEL_SMC_H_ */
> -- 
> 2.12.2
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* Re: [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
@ 2017-07-18  9:37           ` Lee Jones
  0 siblings, 0 replies; 57+ messages in thread
From: Lee Jones @ 2017-07-18  9:37 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Ludovic Desroches, devicetree, linux-arm-kernel, linux-mtd,
	linux-kernel, alexandre.belloni, boris.brezillon,
	computersforpeace

On Tue, 18 Jul 2017, Nicolas Ferre wrote:

> On 18/07/2017 at 11:12, Lee Jones wrote:
> > On Tue, 18 Jul 2017, Lee Jones wrote:
> > 
> >> On Tue, 11 Jul 2017, Ludovic Desroches wrote:
> >>
> >>> For HSMC controller, the register layout depends on the device i.e. the
> >>> offset of setup, pulse, cycle, mode and timings registers is not the
> >>> same. An helper is added to provide the correct register layout.
> >>>
> >>> Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
> >>> SMC regs manipulation")
> >>> Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> >>> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> >>> ---
> >>>  drivers/memory/atmel-ebi.c               | 13 +++++--
> >>>  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
> >>>  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
> >>>  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
> >>>  4 files changed, 92 insertions(+), 30 deletions(-)
> >>
> >> Applied, thanks.
> > 
> > Apologies, it looks like this needs 2 more Acks before I can even
> > consider taking it.
> > 
> > Unapplied.
> 
> If mine is missing, here it is:
> 
> For the whole series:
> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> 
> And I think that Alexandre seemed okay by discussing the path those
> patches should take...

Thanks Anlexadre and Nicolas.

Patch does not apply to v4.13-rc1 however.

Ludovic,

Could you please rebase this patch and apply the 2 new Acks please?

Please also apply my:

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

... and I'll get it applied ASAP.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
@ 2017-07-18  9:37           ` Lee Jones
  0 siblings, 0 replies; 57+ messages in thread
From: Lee Jones @ 2017-07-18  9:37 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Ludovic Desroches, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	computersforpeace-Re5JQEeQqe8AvxtiuMwx3w

On Tue, 18 Jul 2017, Nicolas Ferre wrote:

> On 18/07/2017 at 11:12, Lee Jones wrote:
> > On Tue, 18 Jul 2017, Lee Jones wrote:
> > 
> >> On Tue, 11 Jul 2017, Ludovic Desroches wrote:
> >>
> >>> For HSMC controller, the register layout depends on the device i.e. the
> >>> offset of setup, pulse, cycle, mode and timings registers is not the
> >>> same. An helper is added to provide the correct register layout.
> >>>
> >>> Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
> >>> SMC regs manipulation")
> >>> Suggested-by: Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> >>> Signed-off-by: Ludovic Desroches <ludovic.desroches-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>
> >>> ---
> >>>  drivers/memory/atmel-ebi.c               | 13 +++++--
> >>>  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
> >>>  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
> >>>  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
> >>>  4 files changed, 92 insertions(+), 30 deletions(-)
> >>
> >> Applied, thanks.
> > 
> > Apologies, it looks like this needs 2 more Acks before I can even
> > consider taking it.
> > 
> > Unapplied.
> 
> If mine is missing, here it is:
> 
> For the whole series:
> Acked-by: Nicolas Ferre <nicolas.ferre-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>
> 
> And I think that Alexandre seemed okay by discussing the path those
> patches should take...

Thanks Anlexadre and Nicolas.

Patch does not apply to v4.13-rc1 however.

Ludovic,

Could you please rebase this patch and apply the 2 new Acks please?

Please also apply my:

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

... and I'll get it applied ASAP.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
@ 2017-07-18  9:37           ` Lee Jones
  0 siblings, 0 replies; 57+ messages in thread
From: Lee Jones @ 2017-07-18  9:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 18 Jul 2017, Nicolas Ferre wrote:

> On 18/07/2017 at 11:12, Lee Jones wrote:
> > On Tue, 18 Jul 2017, Lee Jones wrote:
> > 
> >> On Tue, 11 Jul 2017, Ludovic Desroches wrote:
> >>
> >>> For HSMC controller, the register layout depends on the device i.e. the
> >>> offset of setup, pulse, cycle, mode and timings registers is not the
> >>> same. An helper is added to provide the correct register layout.
> >>>
> >>> Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
> >>> SMC regs manipulation")
> >>> Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> >>> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> >>> ---
> >>>  drivers/memory/atmel-ebi.c               | 13 +++++--
> >>>  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
> >>>  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
> >>>  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
> >>>  4 files changed, 92 insertions(+), 30 deletions(-)
> >>
> >> Applied, thanks.
> > 
> > Apologies, it looks like this needs 2 more Acks before I can even
> > consider taking it.
> > 
> > Unapplied.
> 
> If mine is missing, here it is:
> 
> For the whole series:
> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> 
> And I think that Alexandre seemed okay by discussing the path those
> patches should take...

Thanks Anlexadre and Nicolas.

Patch does not apply to v4.13-rc1 however.

Ludovic,

Could you please rebase this patch and apply the 2 new Acks please?

Please also apply my:

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

... and I'll get it applied ASAP.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
  2017-07-18  9:37           ` Lee Jones
  (?)
@ 2017-07-18  9:56             ` Ludovic Desroches
  -1 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-18  9:56 UTC (permalink / raw)
  To: Lee Jones
  Cc: Nicolas Ferre, Ludovic Desroches, devicetree, linux-arm-kernel,
	linux-mtd, linux-kernel, alexandre.belloni, boris.brezillon,
	computersforpeace

On Tue, Jul 18, 2017 at 10:37:13AM +0100, Lee Jones wrote:
> On Tue, 18 Jul 2017, Nicolas Ferre wrote:
> 
> > On 18/07/2017 at 11:12, Lee Jones wrote:
> > > On Tue, 18 Jul 2017, Lee Jones wrote:
> > > 
> > >> On Tue, 11 Jul 2017, Ludovic Desroches wrote:
> > >>
> > >>> For HSMC controller, the register layout depends on the device i.e. the
> > >>> offset of setup, pulse, cycle, mode and timings registers is not the
> > >>> same. An helper is added to provide the correct register layout.
> > >>>
> > >>> Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
> > >>> SMC regs manipulation")
> > >>> Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > >>> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > >>> ---
> > >>>  drivers/memory/atmel-ebi.c               | 13 +++++--
> > >>>  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
> > >>>  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
> > >>>  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
> > >>>  4 files changed, 92 insertions(+), 30 deletions(-)
> > >>
> > >> Applied, thanks.
> > > 
> > > Apologies, it looks like this needs 2 more Acks before I can even
> > > consider taking it.
> > > 
> > > Unapplied.
> > 
> > If mine is missing, here it is:
> > 
> > For the whole series:
> > Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> > 
> > And I think that Alexandre seemed okay by discussing the path those
> > patches should take...
> 
> Thanks Anlexadre and Nicolas.
> 
> Patch does not apply to v4.13-rc1 however.
> 
> Ludovic,
> 
> Could you please rebase this patch and apply the 2 new Acks please?
> 
> Please also apply my:
> 
> For my own reference:
>   Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
> 

Ok, I'll rebase the patch on top of v4.13-rc1 and resend it.

Ludovic

> ... and I'll get it applied ASAP.
> 
> -- 
> Lee Jones
> Linaro STMicroelectronics Landing Team Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
@ 2017-07-18  9:56             ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-18  9:56 UTC (permalink / raw)
  To: Lee Jones
  Cc: Nicolas Ferre, Ludovic Desroches, devicetree, linux-arm-kernel,
	linux-mtd, linux-kernel, alexandre.belloni, boris.brezillon,
	computersforpeace

On Tue, Jul 18, 2017 at 10:37:13AM +0100, Lee Jones wrote:
> On Tue, 18 Jul 2017, Nicolas Ferre wrote:
> 
> > On 18/07/2017 at 11:12, Lee Jones wrote:
> > > On Tue, 18 Jul 2017, Lee Jones wrote:
> > > 
> > >> On Tue, 11 Jul 2017, Ludovic Desroches wrote:
> > >>
> > >>> For HSMC controller, the register layout depends on the device i.e. the
> > >>> offset of setup, pulse, cycle, mode and timings registers is not the
> > >>> same. An helper is added to provide the correct register layout.
> > >>>
> > >>> Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
> > >>> SMC regs manipulation")
> > >>> Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > >>> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > >>> ---
> > >>>  drivers/memory/atmel-ebi.c               | 13 +++++--
> > >>>  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
> > >>>  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
> > >>>  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
> > >>>  4 files changed, 92 insertions(+), 30 deletions(-)
> > >>
> > >> Applied, thanks.
> > > 
> > > Apologies, it looks like this needs 2 more Acks before I can even
> > > consider taking it.
> > > 
> > > Unapplied.
> > 
> > If mine is missing, here it is:
> > 
> > For the whole series:
> > Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> > 
> > And I think that Alexandre seemed okay by discussing the path those
> > patches should take...
> 
> Thanks Anlexadre and Nicolas.
> 
> Patch does not apply to v4.13-rc1 however.
> 
> Ludovic,
> 
> Could you please rebase this patch and apply the 2 new Acks please?
> 
> Please also apply my:
> 
> For my own reference:
>   Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
> 

Ok, I'll rebase the patch on top of v4.13-rc1 and resend it.

Ludovic

> ... and I'll get it applied ASAP.
> 
> -- 
> Lee Jones
> Linaro STMicroelectronics Landing Team Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout
@ 2017-07-18  9:56             ` Ludovic Desroches
  0 siblings, 0 replies; 57+ messages in thread
From: Ludovic Desroches @ 2017-07-18  9:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jul 18, 2017 at 10:37:13AM +0100, Lee Jones wrote:
> On Tue, 18 Jul 2017, Nicolas Ferre wrote:
> 
> > On 18/07/2017 at 11:12, Lee Jones wrote:
> > > On Tue, 18 Jul 2017, Lee Jones wrote:
> > > 
> > >> On Tue, 11 Jul 2017, Ludovic Desroches wrote:
> > >>
> > >>> For HSMC controller, the register layout depends on the device i.e. the
> > >>> offset of setup, pulse, cycle, mode and timings registers is not the
> > >>> same. An helper is added to provide the correct register layout.
> > >>>
> > >>> Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease
> > >>> SMC regs manipulation")
> > >>> Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > >>> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > >>> ---
> > >>>  drivers/memory/atmel-ebi.c               | 13 +++++--
> > >>>  drivers/mfd/atmel-smc.c                  | 67 +++++++++++++++++++++++++-------
> > >>>  drivers/mtd/nand/atmel/nand-controller.c | 10 +++--
> > >>>  include/linux/mfd/syscon/atmel-smc.h     | 32 ++++++++++-----
> > >>>  4 files changed, 92 insertions(+), 30 deletions(-)
> > >>
> > >> Applied, thanks.
> > > 
> > > Apologies, it looks like this needs 2 more Acks before I can even
> > > consider taking it.
> > > 
> > > Unapplied.
> > 
> > If mine is missing, here it is:
> > 
> > For the whole series:
> > Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> > 
> > And I think that Alexandre seemed okay by discussing the path those
> > patches should take...
> 
> Thanks Anlexadre and Nicolas.
> 
> Patch does not apply to v4.13-rc1 however.
> 
> Ludovic,
> 
> Could you please rebase this patch and apply the 2 new Acks please?
> 
> Please also apply my:
> 
> For my own reference:
>   Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
> 

Ok, I'll rebase the patch on top of v4.13-rc1 and resend it.

Ludovic

> ... and I'll get it applied ASAP.
> 
> -- 
> Lee Jones
> Linaro STMicroelectronics Landing Team Lead
> Linaro.org ? Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2017-07-18  9:57 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-11  7:40 [PATCH 0/3] Fix SMC layout register for sama5d2 Ludovic Desroches
2017-07-11  7:40 ` Ludovic Desroches
2017-07-11  7:40 ` Ludovic Desroches
2017-07-11  7:40 ` [PATCH 1/3] mfd: syscon: update Atmel SMC binding doc Ludovic Desroches
2017-07-11  7:40   ` Ludovic Desroches
2017-07-11  7:40   ` Ludovic Desroches
2017-07-14 16:06   ` Rob Herring
2017-07-14 16:06     ` Rob Herring
2017-07-14 16:06     ` Rob Herring
2017-07-18  8:10   ` Lee Jones
2017-07-18  8:10     ` Lee Jones
2017-07-18  8:10     ` Lee Jones
2017-07-11  7:40 ` [PATCH 2/3] mfd: syscon: atmel-smc: add helper to retrieve register layout Ludovic Desroches
2017-07-11  7:40   ` Ludovic Desroches
2017-07-11  7:40   ` Ludovic Desroches
2017-07-11  8:07   ` Boris Brezillon
2017-07-11  8:07     ` Boris Brezillon
2017-07-11  8:07     ` Boris Brezillon
2017-07-18  8:15   ` Lee Jones
2017-07-18  8:15     ` Lee Jones
2017-07-18  9:12     ` Lee Jones
2017-07-18  9:12       ` Lee Jones
2017-07-18  9:23       ` Nicolas Ferre
2017-07-18  9:23         ` Nicolas Ferre
2017-07-18  9:23         ` Nicolas Ferre
2017-07-18  9:37         ` Lee Jones
2017-07-18  9:37           ` Lee Jones
2017-07-18  9:37           ` Lee Jones
2017-07-18  9:56           ` Ludovic Desroches
2017-07-18  9:56             ` Ludovic Desroches
2017-07-18  9:56             ` Ludovic Desroches
2017-07-18  9:24   ` Alexandre Belloni
2017-07-18  9:24     ` Alexandre Belloni
2017-07-11  7:40 ` [PATCH 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC Ludovic Desroches
2017-07-11  7:40   ` Ludovic Desroches
2017-07-11  7:40   ` Ludovic Desroches
2017-07-11  7:52   ` Nicolas Ferre
2017-07-11  7:52     ` Nicolas Ferre
2017-07-11  7:52     ` Nicolas Ferre
2017-07-11  7:58     ` Ludovic Desroches
2017-07-11  7:58       ` Ludovic Desroches
2017-07-11  7:58       ` Ludovic Desroches
2017-07-11  8:07       ` Nicolas Ferre
2017-07-11  8:07         ` Nicolas Ferre
2017-07-11  8:07         ` Nicolas Ferre
2017-07-11  8:08       ` Ludovic Desroches
2017-07-11  8:08         ` Ludovic Desroches
2017-07-11  8:08         ` Ludovic Desroches
2017-07-11  9:25         ` Lee Jones
2017-07-11  9:25           ` Lee Jones
2017-07-11  9:25           ` Lee Jones
2017-07-12 13:59           ` Alexandre Belloni
2017-07-12 13:59             ` Alexandre Belloni
2017-07-13  7:59             ` Lee Jones
2017-07-13  7:59               ` Lee Jones
2017-07-17  9:17   ` Alexandre Belloni
2017-07-17  9:17     ` Alexandre Belloni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.