RE: [PATCH v5 3/3] mtd: devices: elm: Low power transition support

2013-07-01 Thread Gupta, Pekon
 
 From: avinash philip avinashphi...@ti.com
 
 ELM is used for locating bit-flip errors in when using BCH ECC scheme.
 This patch adds suspend/resume support for leaf level ELM driver,
 And also provides ELM register context save  restore support, so that
 configurations are preserved across hardware power-off/on transitions.
 
 Signed-off-by: Philip Avinash avinashphi...@ti.com
 Signed-off-by: Pekon Gupta pe...@ti.com
 ---

Hi Artem,

In following series [Patch 1/3] and [Patch 2/3] were picked up by  Tony (for 
GPMC). But this last one is awaits your approval, as it touches ELM driver in 
driver/*mtd*/devices. If everything clean then please pull this one for v3.11 
merge.

Also, request you to please look into 
[PATCH v3 0/4] mtd:nand:omap2: clean-up of supported ECC schemes series, if 
it can be taken for 3.11 merge, as lot of further omap2-nand driver 
enhancements are based on this series.

Thanks ...
with regards, pekon
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 3/3] mtd: devices: elm: Low power transition support

2013-07-01 Thread Artem Bityutskiy
On Tue, 2013-06-18 at 00:16 +0530, Pekon Gupta wrote:
 From: avinash philip avinashphi...@ti.com
 
 ELM is used for locating bit-flip errors in when using BCH ECC scheme.
 This patch adds suspend/resume support for leaf level ELM driver,
 And also provides ELM register context save  restore support, so that
 configurations are preserved across hardware power-off/on transitions.
 
 Signed-off-by: Philip Avinash avinashphi...@ti.com
 Signed-off-by: Pekon Gupta pe...@ti.com

Pushed to l2-mtd.git, thanks!

-- 
Best Regards,
Artem Bityutskiy

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 3/3] mtd: devices: elm: Low power transition support

2013-06-17 Thread Pekon Gupta
From: avinash philip avinashphi...@ti.com

ELM is used for locating bit-flip errors in when using BCH ECC scheme.
This patch adds suspend/resume support for leaf level ELM driver,
And also provides ELM register context save  restore support, so that
configurations are preserved across hardware power-off/on transitions.

Signed-off-by: Philip Avinash avinashphi...@ti.com
Signed-off-by: Pekon Gupta pe...@ti.com
---
 drivers/mtd/devices/elm.c | 117 ++
 1 file changed, 117 insertions(+)

diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c
index dccef9f..e6a7b89 100644
--- a/drivers/mtd/devices/elm.c
+++ b/drivers/mtd/devices/elm.c
@@ -20,14 +20,21 @@
 #include linux/interrupt.h
 #include linux/io.h
 #include linux/of.h
+#include linux/sched.h
 #include linux/pm_runtime.h
 #include linux/platform_data/elm.h
 
+#define ELM_SYSCONFIG  0x010
 #define ELM_IRQSTATUS  0x018
 #define ELM_IRQENABLE  0x01c
 #define ELM_LOCATION_CONFIG0x020
 #define ELM_PAGE_CTRL  0x080
 #define ELM_SYNDROME_FRAGMENT_00x400
+#define ELM_SYNDROME_FRAGMENT_10x404
+#define ELM_SYNDROME_FRAGMENT_20x408
+#define ELM_SYNDROME_FRAGMENT_30x40c
+#define ELM_SYNDROME_FRAGMENT_40x410
+#define ELM_SYNDROME_FRAGMENT_50x414
 #define ELM_SYNDROME_FRAGMENT_60x418
 #define ELM_LOCATION_STATUS0x800
 #define ELM_ERROR_LOCATION_0   0x880
@@ -56,12 +63,27 @@
 #define SYNDROME_FRAGMENT_REG_SIZE 0x40
 #define ERROR_LOCATION_SIZE0x100
 
+struct elm_registers {
+   u32 elm_irqenable;
+   u32 elm_sysconfig;
+   u32 elm_location_config;
+   u32 elm_page_ctrl;
+   u32 elm_syndrome_fragment_6[ERROR_VECTOR_MAX];
+   u32 elm_syndrome_fragment_5[ERROR_VECTOR_MAX];
+   u32 elm_syndrome_fragment_4[ERROR_VECTOR_MAX];
+   u32 elm_syndrome_fragment_3[ERROR_VECTOR_MAX];
+   u32 elm_syndrome_fragment_2[ERROR_VECTOR_MAX];
+   u32 elm_syndrome_fragment_1[ERROR_VECTOR_MAX];
+   u32 elm_syndrome_fragment_0[ERROR_VECTOR_MAX];
+};
+
 struct elm_info {
struct device *dev;
void __iomem *elm_base;
struct completion elm_completion;
struct list_head list;
enum bch_ecc bch_type;
+   struct elm_registers elm_regs;
 };
 
 static LIST_HEAD(elm_devices);
@@ -385,6 +407,100 @@ static int elm_remove(struct platform_device *pdev)
return 0;
 }
 
+/**
+ * elm_context_save
+ * saves ELM configurations to preserve them across Hardware powered-down
+ */
+static int elm_context_save(struct elm_info *info)
+{
+   struct elm_registers *regs = info-elm_regs;
+   enum bch_ecc bch_type = info-bch_type;
+   u32 offset = 0, i;
+
+   regs-elm_irqenable   = elm_read_reg(info, ELM_IRQENABLE);
+   regs-elm_sysconfig   = elm_read_reg(info, ELM_SYSCONFIG);
+   regs-elm_location_config = elm_read_reg(info, ELM_LOCATION_CONFIG);
+   regs-elm_page_ctrl   = elm_read_reg(info, ELM_PAGE_CTRL);
+   for (i = 0; i  ERROR_VECTOR_MAX; i++) {
+   offset = i * SYNDROME_FRAGMENT_REG_SIZE;
+   switch (bch_type) {
+   case BCH8_ECC:
+   regs-elm_syndrome_fragment_3[i] = elm_read_reg(info,
+   ELM_SYNDROME_FRAGMENT_3 + offset);
+   regs-elm_syndrome_fragment_2[i] = elm_read_reg(info,
+   ELM_SYNDROME_FRAGMENT_2 + offset);
+   case BCH4_ECC:
+   regs-elm_syndrome_fragment_1[i] = elm_read_reg(info,
+   ELM_SYNDROME_FRAGMENT_1 + offset);
+   regs-elm_syndrome_fragment_0[i] = elm_read_reg(info,
+   ELM_SYNDROME_FRAGMENT_0 + offset);
+   default:
+   return -EINVAL;
+   }
+   /* ELM SYNDROME_VALID bit in SYNDROME_FRAGMENT_6[] needs
+* to be saved for all BCH schemes*/
+   regs-elm_syndrome_fragment_6[i] = elm_read_reg(info,
+   ELM_SYNDROME_FRAGMENT_6 + offset);
+   }
+   return 0;
+}
+
+/**
+ * elm_context_restore
+ * writes configurations saved duing power-down back into ELM registers
+ */
+static int elm_context_restore(struct elm_info *info)
+{
+   struct elm_registers *regs = info-elm_regs;
+   enum bch_ecc bch_type = info-bch_type;
+   u32 offset = 0, i;
+
+   elm_write_reg(info, ELM_IRQENABLE,   regs-elm_irqenable);
+   elm_write_reg(info, ELM_SYSCONFIG,   regs-elm_sysconfig);
+   elm_write_reg(info, ELM_LOCATION_CONFIG, regs-elm_location_config);
+   elm_write_reg(info, ELM_PAGE_CTRL,   regs-elm_page_ctrl);
+   for (i = 0; i  ERROR_VECTOR_MAX; i++) {
+   offset =