Skip to contentSkip to conversation

memory: omap-gpmc: mtd: nand: Support GPMC NAND on non-OMAP platforms

PATCH In review Roger Quadros 4 participants 47 messages Apr 7, 2016 – Apr 20, 2016

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

v6 cover memory: omap-gpmc: mtd: nand: Support GPMC NAND on non-OMAP platforms

Hi,

As this series has cross dependency between omap and mtd subsystems, I'll set up a immutable branch which omap-soc and l2-mtd must merge in together to avoid any conflicts/breakage during integration.

Brian has acked all mtd patches. Tony needs to give his Ack for the gpmc driver part and then I can provide the immutable branch.

Patches based on v4.6-rc1 and tested on:
dra-evm, am437x-gp-evm, beagleboard-c4, beagleboard-c4-legacyboot.

Summary:

We do a couple of things in this series which result in cleaner device tree implementation, faster perfomance and multi-platform support. As an added bonus we get to use the GPMC_WAIT pins as GPI/Interrupts.

- Establish a custom interface between NAND and GPMC driver. This is needed because all of the NAND registers sit in the GPMC register space.

- Clean up device tree support so that omap-gpmc IP and the omap2 NAND driver can be used on non-OMAP platforms. e.g. Keystone.

- Implement GPIOCHIP for the GPMC WAITPINS. SoCs can contain
2 to 4 of these and most of them would be unused otherwise. It also allows a cleaner implementation of NAND Ready pin status for the NAND driver.

- Implement GPMC IRQ domain to proivde the 2 NAND events and GPMC WAITPIN edge interrupts.

- Implement GPIOlib based NAND ready pin checking for OMAP NAND driver. On dra7-evm, Read speed increases from 13768 KiB/ to 17246 KiB/s. Write speed was unchanged at 7123 KiB/s.

Changelog:
v6:
-addressed review comments.
-re-orderd patches so that functionality isn't broken at any point. -rebased to v4.6-rc1.

v5:
-changed ready/busy# GPIO DT binding from "ready-gpio" to "rb-gpios". -use irqdomain for gpmc NAND interrupts: fifoevent and termcount.

v4:
-Warn if using older incompatible DT i.e. compatible property not present in nand node.
-Applied Tony's patch to fix broken ethernet on torpedo.

v3:
-Fixed and tested NAND using legacy boot on omap3-beagle. -Support rising and falling edge interrupts on WAITpins. -Update DT node of all gpmc users.

--
cheers,
-roger

Roger Quadros (17):
ARM: OMAP2+: gpmc: Add platform data
ARM: OMAP2+: gpmc: Add gpmc timings and settings to platform data
memory: omap-gpmc: Introduce GPMC to NAND interface
memory: omap-gpmc: Add GPMC-NAND ops to get writebufferempty status
memory: omap-gpmc: Implement IRQ domain for NAND IRQs
mtd: nand: omap: Use gpmc_omap_get_nand_ops() to get NAND registers
mtd: nand: omap: Switch to using GPMC-NAND ops for writebuffer empty
check
mtd: nand: omap: Copy platform data parameters to omap_nand_info data
mtd: nand: omap: Clean up device tree support
mtd: nand: omap: Update DT binding documentation
memory: omap-gpmc: Prevent mapping into 1st 16MB
memory: omap-gpmc: Move device tree binding to correct location
memory: omap-gpmc: Support general purpose input for WAITPINs
memory: omap-gpmc: Reserve WAITPIN if needed for WAIT monitoring
memory: omap-gpmc: Support WAIT pin edge interrupts
memory: omap-gpmc: Prevent GPMC_STATUS from being accessed via
gpmc_regs
mtd: nand: omap2: Implement NAND ready using gpiolib

 .../omap-gpmc.txt}                                 |  17 +
 .../devicetree/bindings/mtd/gpmc-nand.txt          |  19 +-
 arch/arm/mach-omap2/gpmc-nand.c                    |   7 +-
 drivers/memory/Kconfig                             |   1 +
 drivers/memory/omap-gpmc.c                         | 655 +++++++++++++--------
 drivers/mtd/nand/omap2.c                           | 194 ++++--
 include/linux/omap-gpmc.h                          | 172 +-----
 .../{omap-gpmc.h => platform_data/gpmc-omap.h}     | 101 ++--
 include/linux/platform_data/mtd-nand-omap2.h       |  12 +-
 9 files changed, 679 insertions(+), 499 deletions(-)
 rename Documentation/devicetree/bindings/{bus/ti-gpmc.txt => memory-controllers/omap-gpmc.txt} (89%)
 copy include/linux/{omap-gpmc.h => platform_data/gpmc-omap.h} (71%)
Signature · 1 line
2.5.0
#1 lore raw

PATCH v6 1/17 ARM: OMAP2+: gpmc: Add platform data

Add a platform data structure for GPMC. It contains all the necessary platform information that needs to be passed from platform init code to GPMC driver.

---
 include/linux/omap-gpmc.h               |  3 +--
 include/linux/platform_data/gpmc-omap.h | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 2 deletions(-)
 create mode 100644 include/linux/platform_data/gpmc-omap.h
include/linux/omap-gpmc.h +1 -2
index d833eb4..45d9075 100644
@@ -7,8 +7,7 @@
  *  option) any later version.
  */
 
-/* Maximum Number of Chip Selects */
-#define GPMC_CS_NUM		8
+#include <linux/platform_data/gpmc-omap.h>
 
 #define GPMC_CONFIG_WP		0x00000005
 
include/linux/platform_data/gpmc-omap.h new file +30 -0
new file mode 100644
index 0000000..6804a8b
@@ -0,0 +1,30 @@
+/*
+ * OMAP GPMC Platform data
+ *
+ * Copyright (C) 2014 Texas Instruments, Inc. - http://www.ti.com
+ *	Roger Quadros <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+
+#ifndef _GPMC_OMAP_H_
+#define _GPMC_OMAP_H_
+
+/* Maximum Number of Chip Selects */
+#define GPMC_CS_NUM		8
+
+/* Data for each chip select */
+struct gpmc_omap_cs_data {
+	bool valid;			/* data is valid */
+	bool is_nand;			/* device within this CS is NAND */
+	struct platform_device *pdev;	/* device within this CS region */
+	unsigned int pdata_size;
+};
+
+struct gpmc_omap_platform_data {
+	struct gpmc_omap_cs_data cs[GPMC_CS_NUM];
+};
+
+#endif /* _GPMC_OMAP_H */
Signature · 1 line
2.5.0
#2 lore raw

PATCH v6 2/17 ARM: OMAP2+: gpmc: Add gpmc timings and settings to platform data

In reply to Roger Quadros

Add device_timings, gpmc_timings and gpmc_setting to gpmc platform data.

---
 include/linux/omap-gpmc.h               | 139 -------------------------------
 include/linux/platform_data/gpmc-omap.h | 142 ++++++++++++++++++++++++++++++++
 2 files changed, 142 insertions(+), 139 deletions(-)
include/linux/omap-gpmc.h +0 -139
index 45d9075..2dcef1c 100644
@@ -14,145 +14,6 @@
 #define GPMC_IRQ_FIFOEVENTENABLE	0x01
 #define GPMC_IRQ_COUNT_EVENT		0x02
 
-#define GPMC_BURST_4			4	/* 4 word burst */
-#define GPMC_BURST_8			8	/* 8 word burst */
-#define GPMC_BURST_16			16	/* 16 word burst */
-#define GPMC_DEVWIDTH_8BIT		1	/* 8-bit device width */
-#define GPMC_DEVWIDTH_16BIT		2	/* 16-bit device width */
-#define GPMC_MUX_AAD			1	/* Addr-Addr-Data multiplex */
-#define GPMC_MUX_AD			2	/* Addr-Data multiplex */
-
-/* bool type time settings */
-struct gpmc_bool_timings {
-	bool cycle2cyclediffcsen;
-	bool cycle2cyclesamecsen;
-	bool we_extra_delay;
-	bool oe_extra_delay;
-	bool adv_extra_delay;
-	bool cs_extra_delay;
-	bool time_para_granularity;
-};
-
-/*
- * Note that all values in this struct are in nanoseconds except sync_clk
- * (which is in picoseconds), while the register values are in gpmc_fck cycles.
- */
-struct gpmc_timings {
-	/* Minimum clock period for synchronous mode (in picoseconds) */
-	u32 sync_clk;
-
-	/* Chip-select signal timings corresponding to GPMC_CS_CONFIG2 */
-	u32 cs_on;		/* Assertion time */
-	u32 cs_rd_off;		/* Read deassertion time */
-	u32 cs_wr_off;		/* Write deassertion time */
-
-	/* ADV signal timings corresponding to GPMC_CONFIG3 */
-	u32 adv_on;		/* Assertion time */
-	u32 adv_rd_off;		/* Read deassertion time */
-	u32 adv_wr_off;		/* Write deassertion time */
-	u32 adv_aad_mux_on;	/* ADV assertion time for AAD */
-	u32 adv_aad_mux_rd_off;	/* ADV read deassertion time for AAD */
-	u32 adv_aad_mux_wr_off;	/* ADV write deassertion time for AAD */
-
-	/* WE signals timings corresponding to GPMC_CONFIG4 */
-	u32 we_on;		/* WE assertion time */
-	u32 we_off;		/* WE deassertion time */
-
-	/* OE signals timings corresponding to GPMC_CONFIG4 */
-	u32 oe_on;		/* OE assertion time */
-	u32 oe_off;		/* OE deassertion time */
-	u32 oe_aad_mux_on;	/* OE assertion time for AAD */
-	u32 oe_aad_mux_off;	/* OE deassertion time for AAD */
-
-	/* Access time and cycle time timings corresponding to GPMC_CONFIG5 */
-	u32 page_burst_access;	/* Multiple access word delay */
-	u32 access;		/* Start-cycle to first data valid delay */
-	u32 rd_cycle;		/* Total read cycle time */
-	u32 wr_cycle;		/* Total write cycle time */
-
-	u32 bus_turnaround;
-	u32 cycle2cycle_delay;
-
-	u32 wait_monitoring;
-	u32 clk_activation;
-
-	/* The following are only on OMAP3430 */
-	u32 wr_access;		/* WRACCESSTIME */
-	u32 wr_data_mux_bus;	/* WRDATAONADMUXBUS */
-
-	struct gpmc_bool_timings bool_timings;
-};
-
-/* Device timings in picoseconds */
-struct gpmc_device_timings {
-	u32 t_ceasu;	/* address setup to CS valid */
-	u32 t_avdasu;	/* address setup to ADV valid */
-	/* XXX: try to combine t_avdp_r & t_avdp_w. Issue is
-	 * of tusb using these timings even for sync whilst
-	 * ideally for adv_rd/(wr)_off it should have considered
-	 * t_avdh instead. This indirectly necessitates r/w
-	 * variations of t_avdp as it is possible to have one
-	 * sync & other async
-	 */
-	u32 t_avdp_r;	/* ADV low time (what about t_cer ?) */
-	u32 t_avdp_w;
-	u32 t_aavdh;	/* address hold time */
-	u32 t_oeasu;	/* address setup to OE valid */
-	u32 t_aa;	/* access time from ADV assertion */
-	u32 t_iaa;	/* initial access time */
-	u32 t_oe;	/* access time from OE assertion */
-	u32 t_ce;	/* access time from CS asertion */
-	u32 t_rd_cycle;	/* read cycle time */
-	u32 t_cez_r;	/* read CS deassertion to high Z */
-	u32 t_cez_w;	/* write CS deassertion to high Z */
-	u32 t_oez;	/* OE deassertion to high Z */
-	u32 t_weasu;	/* address setup to WE valid */
-	u32 t_wpl;	/* write assertion time */
-	u32 t_wph;	/* write deassertion time */
-	u32 t_wr_cycle;	/* write cycle time */
-
-	u32 clk;
-	u32 t_bacc;	/* burst access valid clock to output delay */
-	u32 t_ces;	/* CS setup time to clk */
-	u32 t_avds;	/* ADV setup time to clk */
-	u32 t_avdh;	/* ADV hold time from clk */
-	u32 t_ach;	/* address hold time from clk */
-	u32 t_rdyo;	/* clk to ready valid */
-
-	u32 t_ce_rdyz;	/* XXX: description ?, or use t_cez instead */
-	u32 t_ce_avd;	/* CS on to ADV on delay */
-
-	/* XXX: check the possibility of combining
-	 * cyc_aavhd_oe & cyc_aavdh_we
-	 */
-	u8 cyc_aavdh_oe;/* read address hold time in cycles */
-	u8 cyc_aavdh_we;/* write address hold time in cycles */
-	u8 cyc_oe;	/* access time from OE assertion in cycles */
-	u8 cyc_wpl;	/* write deassertion time in cycles */
-	u32 cyc_iaa;	/* initial access time in cycles */
-
-	/* extra delays */
-	bool ce_xdelay;
-	bool avd_xdelay;
-	bool oe_xdelay;
-	bool we_xdelay;
-};
-
-struct gpmc_settings {
-	bool burst_wrap;	/* enables wrap bursting */
-	bool burst_read;	/* enables read page/burst mode */
-	bool burst_write;	/* enables write page/burst mode */
-	bool device_nand;	/* device is NAND */
-	bool sync_read;		/* enables synchronous reads */
-	bool sync_write;	/* enables synchronous writes */
-	bool wait_on_read;	/* monitor wait on reads */
-	bool wait_on_write;	/* monitor wait on writes */
-	u32 burst_len;		/* page/burst length */
-	u32 device_width;	/* device bus width (8 or 16 bit) */
-	u32 mux_add_data;	/* multiplex address & data */
-	u32 wait_pin;		/* wait-pin to be used */
-};
-
 extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t,
 			     struct gpmc_settings *gpmc_s,
 			     struct gpmc_device_timings *dev_t);
include/linux/platform_data/gpmc-omap.h +142 -0

152 lines not on this page · raw message

Signature · 1 line
2.5.0
#3 lore raw

PATCH v6 3/17 memory: omap-gpmc: Introduce GPMC to NAND interface

In reply to Roger Quadros

The OMAP GPMC module has certain registers dedicated for NAND access and some NAND bits mixed with other GPMC functionality.

For the NAND dedicated registers we have the struct gpmc_nand_regs.

The NAND driver needs to access NAND specific bits from the following non-dedicated registers
- EMPTYWRITEBUFFERSTATUS from GPMC_STATUS

For accessing these bits we introduce the struct gpmc_nand_ops.

Add gpmc_omap_get_nand_ops() that returns the gpmc_nand_ops along with updating the gpmc_nand_regs. This API will be called by the OMAP NAND driver to access the necessary bits in GPMC register space.

---
 drivers/memory/omap-gpmc.c | 21 +++++++++++++++++++++
 include/linux/omap-gpmc.h  | 35 +++++++++++++++++++++++++++++++++--
 2 files changed, 54 insertions(+), 2 deletions(-)
drivers/memory/omap-gpmc.c +21 -0
index 21825dd..0b62afd 100644
@@ -1118,6 +1118,27 @@ void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
 	}
 }
 
+static struct gpmc_nand_ops nand_ops;
+
+/**
+ * gpmc_omap_get_nand_ops - Get the GPMC NAND interface
+ * @regs: the GPMC NAND register map exclusive for NAND use.
+ * @cs: GPMC chip select number on which the NAND sits. The
+ *      register map returned will be specific to this chip select.
+ *
+ * Returns NULL on error e.g. invalid cs.
+ */
+struct gpmc_nand_ops *gpmc_omap_get_nand_ops(struct gpmc_nand_regs *reg, int cs)
+{
+	if (cs >= gpmc_cs_num)
+		return NULL;
+
+	gpmc_update_nand_reg(reg, cs);
+
+	return &nand_ops;
+}
+EXPORT_SYMBOL_GPL(gpmc_omap_get_nand_ops);
+
 int gpmc_get_client_irq(unsigned irq_config)
 {
 	int i;
include/linux/omap-gpmc.h +33 -2
index 2dcef1c..dc2ada6 100644
@@ -14,14 +14,45 @@
 #define GPMC_IRQ_FIFOEVENTENABLE	0x01
 #define GPMC_IRQ_COUNT_EVENT		0x02
 
+/**
+ * gpmc_nand_ops - Interface between NAND and GPMC
+ * @nand_write_buffer_empty: get the NAND write buffer empty status.
+ */
+struct gpmc_nand_ops {
+	bool (*nand_writebuffer_empty)(void);
+};
+
+struct gpmc_nand_regs;
+
+#if IS_ENABLED(CONFIG_OMAP_GPMC)
+struct gpmc_nand_ops *gpmc_omap_get_nand_ops(struct gpmc_nand_regs *regs,
+					     int cs);
+#else
+static inline gpmc_nand_ops *gpmc_omap_get_nand_ops(struct gpmc_nand_regs *regs,
+						    int cs)
+{
+	return NULL;
+}
+#endif /* CONFIG_OMAP_GPMC */
+
+/*--------------------------------*/
+
+/* deprecated APIs */
+#if IS_ENABLED(CONFIG_OMAP_GPMC)
+void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs);
+#else
+static inline void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
+{
+}
+#endif /* CONFIG_OMAP_GPMC */
+/*--------------------------------*/
+
 extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t,
 			     struct gpmc_settings *gpmc_s,
 			     struct gpmc_device_timings *dev_t);
 
-struct gpmc_nand_regs;
 struct device_node;
 
-extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs);
 extern int gpmc_get_client_irq(unsigned irq_config);
 
 extern unsigned int gpmc_ticks_to_ns(unsigned int ticks);
Signature · 6 lines
2.5.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#4 lore raw

PATCH v6 4/17 memory: omap-gpmc: Add GPMC-NAND ops to get writebufferempty status

In reply to Roger Quadros

This is needed by OMAP NAND driver to poll the empty status of the writebuffer.

---
 drivers/memory/omap-gpmc.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/memory/omap-gpmc.c +13 -1
index 0b62afd..90dfba5 100644
@@ -81,6 +81,8 @@
 
 #define GPMC_CONFIG_LIMITEDADDRESS		BIT(1)
 
+#define GPMC_STATUS_EMPTYWRITEBUFFERSTATUS	BIT(0)
+
 #define	GPMC_CONFIG2_CSEXTRADELAY		BIT(7)
 #define	GPMC_CONFIG3_ADVEXTRADELAY		BIT(7)
 #define	GPMC_CONFIG4_OEEXTRADELAY		BIT(7)
@@ -1118,7 +1120,17 @@ void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
 	}
 }
 
-static struct gpmc_nand_ops nand_ops;
+static bool gpmc_nand_writebuffer_empty(void)
+{
+	if (gpmc_read_reg(GPMC_STATUS) & GPMC_STATUS_EMPTYWRITEBUFFERSTATUS)
+		return true;
+
+	return false;
+}
+
+static struct gpmc_nand_ops nand_ops = {
+	.nand_writebuffer_empty = gpmc_nand_writebuffer_empty,
+};
 
 /**
  * gpmc_omap_get_nand_ops - Get the GPMC NAND interface
Signature · 6 lines
2.5.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#5 lore raw

PATCH v6 5/17 memory: omap-gpmc: Implement IRQ domain for NAND IRQs

In reply to Roger Quadros

GPMC provides 2 interrupts for NAND use. i.e. fifoevent and termcount. Use IRQ domain for this. NAND device tree node can then
get the necessary interrupts by using gpmc as the interrupt parent.

Legacy boot uses gpmc_get_client_irq to get the NAND interrupts from the GPMC IRQ domain.
Get rid of custom bitmasks and use IRQ domain for that as well.

---
 Documentation/devicetree/bindings/bus/ti-gpmc.txt |   8 +
 drivers/memory/omap-gpmc.c                        | 246 ++++++++++++----------
 include/linux/omap-gpmc.h                         |   5 +-
 3 files changed, 144 insertions(+), 115 deletions(-)
Documentation/devicetree/bindings/bus/ti-gpmc.txt +8 -0
index 0168370..13f1378 100644
@@ -32,6 +32,12 @@ Required properties:
 			bootloader) are used for the physical address decoding.
 			As this will change in the future, filling correct
 			values here is a requirement.
+ - interrupt-controller: The GPMC driver implements and interrupt controller for
+			the NAND events "fifoevent" and "termcount".
+			The interrupt number mapping is as follows
+			0 - NAND_fifoevent
+			1 - NAND_termcount
+ - interrupt-cells:	Must be set to 2
 
 Timing properties for child nodes. All are optional and default to 0.
 
@@ -130,6 +136,8 @@ Example for an AM33xx board:
 		#address-cells = <2>;
 		#size-cells = <1>;
 		ranges = <0 0 0x08000000 0x10000000>; /* CS0 @addr 0x8000000, size 0x10000000 */
+		interrupt-controller;
+		#interrupt-cells = <2>;
 
 		/* child nodes go here */
 	};
drivers/memory/omap-gpmc.c +133 -113

391 lines not on this page · raw message

include/linux/omap-gpmc.h +3 -2
index dc2ada6..9e9d79e 100644
@@ -11,8 +11,9 @@
 
 #define GPMC_CONFIG_WP		0x00000005
 
-#define GPMC_IRQ_FIFOEVENTENABLE	0x01
-#define GPMC_IRQ_COUNT_EVENT		0x02
+/* IRQ numbers in GPMC IRQ domain for legacy boot use */
+#define GPMC_IRQ_FIFOEVENTENABLE	0
+#define GPMC_IRQ_COUNT_EVENT		1
 
 /**
  * gpmc_nand_ops - Interface between NAND and GPMC
Signature · 1 line
2.5.0
maintainer Acked-by on v6 5/17
#6 lore raw

Re: [PATCH v6 05/17] memory: omap-gpmc: Implement IRQ domain for NAND IRQs

Quoted 4 lines · Roger Quadros

GPMC provides 2 interrupts for NAND use. i.e. fifoevent and termcount. Use IRQ domain for this. NAND device tree node can then
get the necessary interrupts by using gpmc as the interrupt parent.

Quoted 8 lines

Legacy boot uses gpmc_get_client_irq to get the NAND interrupts from the GPMC IRQ domain.
Get rid of custom bitmasks and use IRQ domain for that as well.

---
 Documentation/devicetree/bindings/bus/ti-gpmc.txt |   8 +
Quoted 3 lines
 drivers/memory/omap-gpmc.c                        | 246 ++++++++++++----------
 include/linux/omap-gpmc.h                         |   5 +-
 3 files changed, 144 insertions(+), 115 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

PATCH v6 6/17 mtd: nand: omap: Use gpmc_omap_get_nand_ops() to get NAND registers

In reply to Roger Quadros

Deprecate nand register passing via platform data and use gpmc_omap_get_nand_ops() instead.

---
 arch/arm/mach-omap2/gpmc-nand.c              | 2 --
 drivers/mtd/nand/omap2.c                     | 9 ++++++++-
 include/linux/platform_data/mtd-nand-omap2.h | 4 +++-
 3 files changed, 11 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/gpmc-nand.c +0 -2
index 72918c4..04e6998 100644
@@ -121,8 +121,6 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
 	if (err < 0)
 		goto out_free_cs;
 
-	gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs);
-
 	if (!gpmc_hwecc_bch_capable(gpmc_nand_data->ecc_opt)) {
 		pr_err("omap2-nand: Unsupported NAND ECC scheme selected\n");
 		err = -EINVAL;
drivers/mtd/nand/omap2.c +8 -1
index 0749ca1..cba9bf0 100644
@@ -28,6 +28,7 @@
 #include <linux/mtd/nand_bch.h>
 #include <linux/platform_data/elm.h>
 
+#include <linux/omap-gpmc.h>
 #include <linux/platform_data/mtd-nand-omap2.h>
 
 #define	DRIVER_NAME	"omap2-nand"
@@ -168,7 +169,9 @@ struct omap_nand_info {
 	} iomode;
 	u_char				*buf;
 	int					buf_len;
+	/* Interface to GPMC */
 	struct gpmc_nand_regs		reg;
+	struct gpmc_nand_ops		*ops;
 	/* generated at runtime depending on ECC algorithm and layout selected */
 	struct nand_ecclayout		oobinfo;
 	/* fields specific for BCHx_HW ECC scheme */
@@ -1665,9 +1668,13 @@ static int omap_nand_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, info);
 
+	info->ops = gpmc_omap_get_nand_ops(&info->reg, info->gpmc_cs);
+	if (!info->ops) {
+		dev_err(&pdev->dev, "Failed to get GPMC->NAND interface\n");
+		return -ENODEV;
+	}
 	info->pdev		= pdev;
 	info->gpmc_cs		= pdata->cs;
-	info->reg		= pdata->reg;
 	info->of_node		= pdata->of_node;
 	info->ecc_opt		= pdata->ecc_opt;
 	nand_chip		= &info->nand;
include/linux/platform_data/mtd-nand-omap2.h +3 -1
index 090bbab..a067f58 100644
@@ -75,10 +75,12 @@ struct omap_nand_platform_data {
 	enum nand_io		xfer_type;
 	int			devsize;
 	enum omap_ecc           ecc_opt;
-	struct gpmc_nand_regs	reg;
 
 	/* for passing the partitions */
 	struct device_node	*of_node;
 	struct device_node	*elm_of_node;
+
+	/* deprecated */
+	struct gpmc_nand_regs	reg;
 };
 #endif
Signature · 6 lines
2.5.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#8 lore raw

PATCH v6 7/17 mtd: nand: omap: Switch to using GPMC-NAND ops for writebuffer empty check

In reply to Roger Quadros

Instead of accessing the gpmc_status register directly start using the gpmc_nand_ops->nand_writebuffer_empty() helper to check write buffer empty status.

---
 drivers/mtd/nand/omap2.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/mtd/nand/omap2.c +4 -6
index cba9bf0..98023d5 100644
@@ -291,14 +291,13 @@ static void omap_write_buf8(struct mtd_info *mtd, const u_char *buf, int len)
 {
 	struct omap_nand_info *info = mtd_to_omap(mtd);
 	u_char *p = (u_char *)buf;
-	u32	status = 0;
+	bool status;
 
 	while (len--) {
 		iowrite8(*p++, info->nand.IO_ADDR_W);
 		/* wait until buffer is available for write */
 		do {
-			status = readl(info->reg.gpmc_status) &
-					STATUS_BUFF_EMPTY;
+			status = info->ops->nand_writebuffer_empty();
 		} while (!status);
 	}
 }
@@ -326,7 +325,7 @@ static void omap_write_buf16(struct mtd_info *mtd, const u_char * buf, int len)
 {
 	struct omap_nand_info *info = mtd_to_omap(mtd);
 	u16 *p = (u16 *) buf;
-	u32	status = 0;
+	bool status;
 	/* FIXME try bursts of writesw() or DMA ... */
 	len >>= 1;
 
@@ -334,8 +333,7 @@ static void omap_write_buf16(struct mtd_info *mtd, const u_char * buf, int len)
 		iowrite16(*p++, info->nand.IO_ADDR_W);
 		/* wait until buffer is available for write */
 		do {
-			status = readl(info->reg.gpmc_status) &
-					STATUS_BUFF_EMPTY;
+			status = info->ops->nand_writebuffer_empty();
 		} while (!status);
 	}
 }
Signature · 6 lines
2.5.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#9 lore raw

PATCH v6 8/17 mtd: nand: omap: Copy platform data parameters to omap_nand_info data

In reply to Roger Quadros

Copy all the platform data parameters to the driver's local data structure 'omap_nand_info' and use it in the entire driver. This will make it easer for device tree migration.

---
 drivers/mtd/nand/omap2.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)
drivers/mtd/nand/omap2.c +18 -8
index 98023d5..7e4e263 100644
@@ -152,13 +152,17 @@ static struct nand_hw_control omap_gpmc_controller = {
 };
 
 struct omap_nand_info {
-	struct omap_nand_platform_data	*pdata;
 	struct nand_chip		nand;
 	struct platform_device		*pdev;
 
 	int				gpmc_cs;
-	unsigned long			phys_base;
+	bool				dev_ready;
+	enum nand_io			xfer_type;
+	int				devsize;
 	enum omap_ecc			ecc_opt;
+	struct device_node		*elm_of_node;
+
+	unsigned long			phys_base;
 	struct completion		comp;
 	struct dma_chan			*dma;
 	int				gpmc_irq_fifo;
@@ -1631,7 +1635,7 @@ static bool omap2_nand_ecc_check(struct omap_nand_info *info,
 			"CONFIG_MTD_NAND_OMAP_BCH not enabled\n");
 		return false;
 	}
-	if (ecc_needs_elm && !is_elm_present(info, pdata->elm_of_node)) {
+	if (ecc_needs_elm && !is_elm_present(info, info->elm_of_node)) {
 		dev_err(&info->pdev->dev, "ELM not available\n");
 		return false;
 	}
@@ -1675,6 +1679,11 @@ static int omap_nand_probe(struct platform_device *pdev)
 	info->gpmc_cs		= pdata->cs;
 	info->of_node		= pdata->of_node;
 	info->ecc_opt		= pdata->ecc_opt;
+	info->dev_ready	= pdata->dev_ready;
+	info->xfer_type = pdata->xfer_type;
+	info->devsize = pdata->devsize;
+	info->elm_of_node = pdata->elm_of_node;
+
 	nand_chip		= &info->nand;
 	mtd			= nand_to_mtd(nand_chip);
 	mtd->dev.parent		= &pdev->dev;
@@ -1700,7 +1709,7 @@ static int omap_nand_probe(struct platform_device *pdev)
 	 * chip delay which is slightly more than tR (AC Timing) of the NAND
 	 * device and read status register until you get a failure or success
 	 */
-	if (pdata->dev_ready) {
+	if (info->dev_ready) {
 		nand_chip->dev_ready = omap_dev_ready;
 		nand_chip->chip_delay = 0;
 	} else {
@@ -1714,15 +1723,16 @@ static int omap_nand_probe(struct platform_device *pdev)
 		nand_chip->options |= NAND_SKIP_BBTSCAN;
 
 	/* scan NAND device connected to chip controller */
-	nand_chip->options |= pdata->devsize & NAND_BUSWIDTH_16;
+	nand_chip->options |= info->devsize & NAND_BUSWIDTH_16;
 	if (nand_scan_ident(mtd, 1, NULL)) {
-		dev_err(&info->pdev->dev, "scan failed, may be bus-width mismatch\n");
+		dev_err(&info->pdev->dev,
+			"scan failed, may be bus-width mismatch\n");
 		err = -ENXIO;
 		goto return_error;
 	}
 
 	/* re-populate low-level callbacks based on xfer modes */
-	switch (pdata->xfer_type) {
+	switch (info->xfer_type) {
 	case NAND_OMAP_PREFETCH_POLLED:
 		nand_chip->read_buf   = omap_read_buf_pref;
 		nand_chip->write_buf  = omap_write_buf_pref;
@@ -1802,7 +1812,7 @@ static int omap_nand_probe(struct platform_device *pdev)
 
 	default:
 		dev_err(&pdev->dev,
-			"xfer_type(%d) not supported!\n", pdata->xfer_type);
+			"xfer_type(%d) not supported!\n", info->xfer_type);
 		err = -EINVAL;
 		goto return_error;
 	}
Signature · 6 lines
2.5.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#10 lore raw

PATCH v6 9/17 mtd: nand: omap: Clean up device tree support

In reply to Roger Quadros

Move NAND specific device tree parsing to NAND driver.

The NAND controller node must have a compatible id, register space resource and interrupt resource.

---
 arch/arm/mach-omap2/gpmc-nand.c              |   5 +-
 drivers/memory/omap-gpmc.c                   | 143 +++++++--------------------
 drivers/mtd/nand/omap2.c                     | 134 +++++++++++++++++++++----
 include/linux/platform_data/mtd-nand-omap2.h |   3 +-
 4 files changed, 153 insertions(+), 132 deletions(-)
arch/arm/mach-omap2/gpmc-nand.c +1 -4
index 04e6998..f6ac027 100644
@@ -97,10 +97,7 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
 	gpmc_nand_res[2].start = gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT);
 
 	memset(&s, 0, sizeof(struct gpmc_settings));
-	if (gpmc_nand_data->of_node)
-		gpmc_read_settings_dt(gpmc_nand_data->of_node, &s);
-	else
-		gpmc_set_legacy(gpmc_nand_data, &s);
+	gpmc_set_legacy(gpmc_nand_data, &s);
 
 	s.device_nand = true;
 
drivers/memory/omap-gpmc.c +37 -106

167 lines not on this page · raw message

drivers/mtd/nand/omap2.c +114 -20

205 lines not on this page · raw message

include/linux/platform_data/mtd-nand-omap2.h +1 -2
index a067f58..ff27e5a 100644
@@ -76,11 +76,10 @@ struct omap_nand_platform_data {
 	int			devsize;
 	enum omap_ecc           ecc_opt;
 
-	/* for passing the partitions */
-	struct device_node	*of_node;
 	struct device_node	*elm_of_node;
 
 	/* deprecated */
 	struct gpmc_nand_regs	reg;
+	struct device_node	*of_node;
 };
 #endif
Signature · 1 line
2.5.0
#11 lore raw

PATCH v6 10/17 mtd: nand: omap: Update DT binding documentation

In reply to Roger Quadros

Add compatible id and interrupts. The NAND interrupts are provided by the GPMC controller node.

---
 Documentation/devicetree/bindings/mtd/gpmc-nand.txt | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/mtd/gpmc-nand.txt +13 -4
index fb733c4..ff3215d2 100644
@@ -13,7 +13,11 @@ Documentation/devicetree/bindings/mtd/nand.txt
 
 Required properties:
 
- - reg:		The CS line the peripheral is connected to
+ - compatible:	"ti,omap2-nand"
+ - reg:		range id (CS number), base offset and length of the
+		NAND I/O space
+ - interrupt-parent: must point to gpmc node
+ - interrupts:	Two interrupt specifiers, one for fifoevent, one for termcount.
 
 Optional properties:
 
@@ -55,17 +59,22 @@ Example for an AM33xx board:
 	gpmc: gpmc@50000000 {
 		compatible = "ti,am3352-gpmc";
 		ti,hwmods = "gpmc";
-		reg = <0x50000000 0x1000000>;
+		reg = <0x50000000 0x36c>;
 		interrupts = <100>;
 		gpmc,num-cs = <8>;
 		gpmc,num-waitpins = <2>;
 		#address-cells = <2>;
 		#size-cells = <1>;
-		ranges = <0 0 0x08000000 0x2000>;	/* CS0: NAND */
+		ranges = <0 0 0x08000000 0x1000000>;	/* CS0 space, 16MB */
 		elm_id = <&elm>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
 
 		nand@0,0 {
-			reg = <0 0 0>; /* CS0, offset 0 */
+			compatible = "ti,omap2-nand";
+			reg = <0 0 4>;		/* CS0, offset 0, NAND I/O window 4 */
+			interrupt-parent = <&gpmc>;
+			interrupts = <0 IRQ_TYPE_NONE>, <1 IRQ_TYPE NONE>;
 			nand-bus-width = <16>;
 			ti,nand-ecc-opt = "bch8";
 			ti,nand-xfer-type = "polled";
Signature · 1 line
2.5.0
#12 lore raw

PATCH v6 11/17 memory: omap-gpmc: Prevent mapping into 1st 16MB

In reply to Roger Quadros

We have been preventing mapping GPMC children in the first 1MB but really it has to be the first 16MB as the minimum GPMC partition size is 16MB.

Also print an error message if CS mapping fails due to DT requesting address outside the GPMC map.

---
 drivers/memory/omap-gpmc.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/memory/omap-gpmc.c +18 -6
index 8dc6e3b..bfe4e87 100644
@@ -94,6 +94,14 @@
 #define GPMC_CS_SIZE		0x30
 #define	GPMC_BCH_SIZE		0x10
 
+/*
+ * The first 1MB of GPMC address space is typically mapped to
+ * the internal ROM. Never allocate the first page, to
+ * facilitate bug detection; even if we didn't boot from ROM.
+ * As GPMC minimum partition size is 16MB we can only start from
+ * there.
+ */
+#define GPMC_MEM_START		0x1000000
 #define GPMC_MEM_END		0x3FFFFFFF
 
 #define GPMC_CHUNK_SHIFT	24		/* 16 MB */
@@ -1297,12 +1305,7 @@ static void gpmc_mem_init(void)
 {
 	int cs;
 
-	/*
-	 * The first 1MB of GPMC address space is typically mapped to
-	 * the internal ROM. Never allocate the first page, to
-	 * facilitate bug detection; even if we didn't boot from ROM.
-	 */
-	gpmc_mem_root.start = SZ_1M;
+	gpmc_mem_root.start = GPMC_MEM_START;
 	gpmc_mem_root.end = GPMC_MEM_END;
 
 	/* Reserve all regions that has been set up by bootloader */
@@ -1966,6 +1969,15 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
 	if (ret < 0) {
 		dev_err(&pdev->dev, "cannot remap GPMC CS %d to %pa\n",
 			cs, &res.start);
+		if (res.start < GPMC_MEM_START) {
+			dev_info(&pdev->dev,
+				 "GPMC CS %d start cannot be lesser than 0x%x\n",
+				 cs, GPMC_MEM_START);
+		} else if (res.end > GPMC_MEM_END) {
+			dev_info(&pdev->dev,
+				 "GPMC CS %d end cannot be greater than 0x%x\n",
+				 cs, GPMC_MEM_END);
+		}
 		goto err;
 	}
 
Signature · 6 lines
2.5.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#13 lore raw

PATCH v6 12/17 memory: omap-gpmc: Move device tree binding to correct location

In reply to Roger Quadros

omap-gpmc.c is a memory controller so move the binding to the right place.

---
 .../bindings/{bus/ti-gpmc.txt => memory-controllers/omap-gpmc.txt}        | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename Documentation/devicetree/bindings/{bus/ti-gpmc.txt => memory-controllers/omap-gpmc.txt} (100%)
Documentation/devicetree/bindings/memory-controllers/omap-gpmc.txt renamed from Documentation/devicetree/bindings/bus/ti-gpmc.txt +0 -0
similarity index 100%
rename from Documentation/devicetree/bindings/bus/ti-gpmc.txt
rename to Documentation/devicetree/bindings/memory-controllers/omap-gpmc.txt
Signature · 1 line
2.5.0
#14 lore raw

PATCH v6 13/17 memory: omap-gpmc: Support general purpose input for WAITPINs

In reply to Roger Quadros

OMAPs can have 2 to 4 WAITPINs that can be used as general purpose input if not used for memory wait state insertion.

The first user will be the OMAP NAND chip to get the NAND read/busy status using gpiolib.

---
 .../bindings/memory-controllers/omap-gpmc.txt      |   6 ++
 drivers/memory/Kconfig                             |   1 +
 drivers/memory/omap-gpmc.c                         | 117 ++++++++++++++++++---
 3 files changed, 112 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/memory-controllers/omap-gpmc.txt +6 -0
index 13f1378..97e7192 100644
@@ -38,6 +38,10 @@ Required properties:
 			0 - NAND_fifoevent
 			1 - NAND_termcount
  - interrupt-cells:	Must be set to 2
+ - gpio-controller:	The GPMC driver implements a GPIO controller for the
+			GPMC WAIT pins that can be used as general purpose inputs.
+			0 maps to GPMC_WAIT0 pin.
+ - gpio-cells:		Must be set to 2
 
 Timing properties for child nodes. All are optional and default to 0.
 
@@ -138,6 +142,8 @@ Example for an AM33xx board:
 		ranges = <0 0 0x08000000 0x10000000>; /* CS0 @addr 0x8000000, size 0x10000000 */
 		interrupt-controller;
 		#interrupt-cells = <2>;
+		gpio-controller;
+		#gpio-cells = <2>;
 
 		/* child nodes go here */
 	};
drivers/memory/Kconfig +1 -0
index 51d5cd2..a9b1c14 100644
@@ -51,6 +51,7 @@ config TI_EMIF
 
 config OMAP_GPMC
 	bool
+	select GPIOLIB
 	help
 	  This driver is for the General Purpose Memory Controller (GPMC)
 	  present on Texas Instruments SoCs (e.g. OMAP2+). GPMC allows
drivers/memory/omap-gpmc.c +105 -12

186 lines not on this page · raw message

Signature · 1 line
2.5.0
maintainer Acked-by on v6 13/17
#15 lore raw

Re: [PATCH v6 13/17] memory: omap-gpmc: Support general purpose input for WAITPINs

Quoted 9 lines · Roger Quadros

OMAPs can have 2 to 4 WAITPINs that can be used as general purpose input if not used for memory wait state insertion.

The first user will be the OMAP NAND chip to get the NAND read/busy status using gpiolib.

---
 .../bindings/memory-controllers/omap-gpmc.txt      |   6 ++
Quoted 3 lines
 drivers/memory/Kconfig                             |   1 +
 drivers/memory/omap-gpmc.c                         | 117 ++++++++++++++++++---
 3 files changed, 112 insertions(+), 12 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#16 lore raw

PATCH v6 14/17 memory: omap-gpmc: Reserve WAITPIN if needed for WAIT monitoring

In reply to Roger Quadros

If the device attached to GPMC wants to use the WAIT pin for WAIT monitoring then we reserve it internally for exclusive use.

---
 drivers/memory/omap-gpmc.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/memory/omap-gpmc.c +22 -2
index 4dd1c65..784a64f 100644
@@ -1911,6 +1911,8 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
 	const char *name;
 	int ret, cs;
 	u32 val;
+	struct gpio_desc *waitpin_desc = NULL;
+	struct gpmc_device *gpmc = platform_get_drvdata(pdev);
 
 	if (of_property_read_u32(child, "reg", &cs) < 0) {
 		dev_err(&pdev->dev, "%s has no 'reg' property\n",
@@ -2020,16 +2022,30 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
 			goto err;
 	}
 
+	/* Reserve wait pin if it is required and valid */
+	if (gpmc_s.wait_on_read || gpmc_s.wait_on_write) {
+		unsigned int wait_pin = gpmc_s.wait_pin;
+
+		waitpin_desc = gpiochip_request_own_desc(&gpmc->gpio_chip,
+							 wait_pin, "WAITPIN");
+		if (IS_ERR(waitpin_desc)) {
+			dev_err(&pdev->dev, "invalid wait-pin: %d\n", wait_pin);
+			ret = PTR_ERR(waitpin_desc);
+			goto err;
+		}
+	}
+
 	gpmc_cs_show_timings(cs, "before gpmc_cs_program_settings");
+
 	ret = gpmc_cs_program_settings(cs, &gpmc_s);
 	if (ret < 0)
-		goto err;
+		goto err_cs;
 
 	ret = gpmc_cs_set_timings(cs, &gpmc_t, &gpmc_s);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to set gpmc timings for: %s\n",
 			child->name);
-		goto err;
+		goto err_cs;
 	}
 
 	/* Clear limited address i.e. enable A26-A11 */
@@ -2060,6 +2076,10 @@ err_child_fail:
 	dev_err(&pdev->dev, "failed to create gpmc child %s\n", child->name);
 	ret = -ENODEV;
 
+err_cs:
+	if (waitpin_desc)
+		gpiochip_free_own_desc(waitpin_desc);
+
 err:
 	gpmc_cs_free(cs);
 
Signature · 1 line
2.5.0
#17 lore raw

PATCH v6 15/17 memory: omap-gpmc: Support WAIT pin edge interrupts

In reply to Roger Quadros

OMAPs can have 2 to 4 WAITPINs that can be used as edge triggered interrupts if not used for memory wait state insertion.

Support these interrupts via the gpmc IRQ domain.

The gpmc IRQ domain interrupt map is:

0 - NAND_fifoevent
1 - NAND_termcount
2 - GPMC_WAIT0 edge
3 - GPMC_WAIT1 edge, and so on

---
 .../bindings/memory-controllers/omap-gpmc.txt      |   5 +-
 drivers/memory/omap-gpmc.c                         | 106 +++++++++++++++++----
 2 files changed, 92 insertions(+), 19 deletions(-)
Documentation/devicetree/bindings/memory-controllers/omap-gpmc.txt +4 -1
index 97e7192..21055e2 100644
@@ -33,10 +33,13 @@ Required properties:
 			As this will change in the future, filling correct
 			values here is a requirement.
  - interrupt-controller: The GPMC driver implements and interrupt controller for
-			the NAND events "fifoevent" and "termcount".
+			the NAND events "fifoevent" and "termcount" plus the
+			rising/falling edges on the GPMC_WAIT pins.
 			The interrupt number mapping is as follows
 			0 - NAND_fifoevent
 			1 - NAND_termcount
+			2 - GPMC_WAIT0 pin edge
+			3 - GPMC_WAIT1 pin edge, and so on.
  - interrupt-cells:	Must be set to 2
  - gpio-controller:	The GPMC driver implements a GPIO controller for the
 			GPMC WAIT pins that can be used as general purpose inputs.
drivers/memory/omap-gpmc.c +88 -18

178 lines not on this page · raw message

Signature · 1 line
2.5.0
maintainer Acked-by on v6 15/17
#18 lore raw

Re: [PATCH v6 15/17] memory: omap-gpmc: Support WAIT pin edge interrupts

Quoted 7 lines · Roger Quadros

OMAPs can have 2 to 4 WAITPINs that can be used as edge triggered interrupts if not used for memory wait state insertion.

Support these interrupts via the gpmc IRQ domain.

The gpmc IRQ domain interrupt map is:

Quoted 8 lines

0 - NAND_fifoevent
1 - NAND_termcount
2 - GPMC_WAIT0 edge
3 - GPMC_WAIT1 edge, and so on

---
 .../bindings/memory-controllers/omap-gpmc.txt      |   5 +-
Quoted 2 lines
 drivers/memory/omap-gpmc.c                         | 106 +++++++++++++++++----
 2 files changed, 92 insertions(+), 19 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#19 lore raw

PATCH v6 16/17 memory: omap-gpmc: Prevent GPMC_STATUS from being accessed via gpmc_regs

In reply to Roger Quadros

GPMC_STATUS register is private to the GPMC module and must not be accessed directly by NAND driver through the gpmc_regs.

They must use gpmc_omap_get_nand_ops() instead.

---
 drivers/memory/omap-gpmc.c                   | 2 +-
 include/linux/platform_data/mtd-nand-omap2.h | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/memory/omap-gpmc.c +1 -1
index ea9c897..33d69b1 100644
@@ -1081,7 +1081,7 @@ void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
 {
 	int i;
 
-	reg->gpmc_status = gpmc_base + GPMC_STATUS;
+	reg->gpmc_status = NULL;	/* deprecated */
 	reg->gpmc_nand_command = gpmc_base + GPMC_CS0_OFFSET +
 				GPMC_CS_NAND_COMMAND + GPMC_CS_SIZE * cs;
 	reg->gpmc_nand_address = gpmc_base + GPMC_CS0_OFFSET +
include/linux/platform_data/mtd-nand-omap2.h +2 -1
index ff27e5a..7f6de53 100644
@@ -45,7 +45,6 @@ enum omap_ecc {
 };
 
 struct gpmc_nand_regs {
-	void __iomem	*gpmc_status;
 	void __iomem	*gpmc_nand_command;
 	void __iomem	*gpmc_nand_address;
 	void __iomem	*gpmc_nand_data;
@@ -64,6 +63,8 @@ struct gpmc_nand_regs {
 	void __iomem	*gpmc_bch_result4[GPMC_BCH_NUM_REMAINDER];
 	void __iomem	*gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER];
 	void __iomem	*gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER];
+	/* Deprecated. Do not use */
+	void __iomem	*gpmc_status;
 };
 
 struct omap_nand_platform_data {
Signature · 1 line
2.5.0
#20 lore raw

PATCH v6 17/17 mtd: nand: omap2: Implement NAND ready using gpiolib

In reply to Roger Quadros

The GPMC WAIT pin status are now available over gpiolib. Update the omap_dev_ready() function to use gpio instead of directly accessing GPMC register space.

---
 .../devicetree/bindings/mtd/gpmc-nand.txt          |  2 ++
 drivers/mtd/nand/omap2.c                           | 29 ++++++++++++++--------
 include/linux/platform_data/mtd-nand-omap2.h       |  2 +-
 3 files changed, 21 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/mtd/gpmc-nand.txt +2 -0
index ff3215d2..3ee7e20 100644
@@ -48,6 +48,7 @@ Optional properties:
 		locating ECC errors for BCHx algorithms. SoC devices which have
 		ELM hardware engines should specify this device node in .dtsi
 		Using ELM for ECC error correction frees some CPU cycles.
+ - rb-gpios:	GPIO specifier for the ready/busy# pin.
 
 For inline partition table parsing (optional):
 
@@ -78,6 +79,7 @@ Example for an AM33xx board:
 			nand-bus-width = <16>;
 			ti,nand-ecc-opt = "bch8";
 			ti,nand-xfer-type = "polled";
+			rb-gpios = <&gpmc 0 GPIO_ACTIVE_HIGH>; /* gpmc_wait0 */
 
 			gpmc,sync-clk-ps = <0>;
 			gpmc,cs-on-ns = <0>;
drivers/mtd/nand/omap2.c +18 -11
index 35b8f33..e0b2b2f 100644
@@ -12,6 +12,7 @@
 #include <linux/dmaengine.h>
 #include <linux/dma-mapping.h>
 #include <linux/delay.h>
+#include <linux/gpio/consumer.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/jiffies.h>
@@ -182,6 +183,8 @@ struct omap_nand_info {
 	struct nand_ecclayout		oobinfo;
 	/* fields specific for BCHx_HW ECC scheme */
 	struct device			*elm_dev;
+	/* NAND ready gpio */
+	struct gpio_desc		*ready_gpiod;
 };
 
 static inline struct omap_nand_info *mtd_to_omap(struct mtd_info *mtd)
@@ -1023,21 +1026,16 @@ static int omap_wait(struct mtd_info *mtd, struct nand_chip *chip)
 }
 
 /**
- * omap_dev_ready - calls the platform specific dev_ready function
+ * omap_dev_ready - checks the NAND Ready GPIO line
  * @mtd: MTD device structure
+ *
+ * Returns true if ready and false if busy.
  */
 static int omap_dev_ready(struct mtd_info *mtd)
 {
-	unsigned int val = 0;
 	struct omap_nand_info *info = mtd_to_omap(mtd);
 
-	val = readl(info->reg.gpmc_status);
-
-	if ((val & 0x100) == 0x100) {
-		return 1;
-	} else {
-		return 0;
-	}
+	return gpiod_get_value(info->ready_gpiod);
 }
 
 /**
@@ -1755,7 +1753,9 @@ static int omap_nand_probe(struct platform_device *pdev)
 		info->gpmc_cs = pdata->cs;
 		info->reg = pdata->reg;
 		info->ecc_opt = pdata->ecc_opt;
-		info->dev_ready	= pdata->dev_ready;
+		if (pdata->dev_ready)
+			dev_info(&pdev->dev, "pdata->dev_ready is deprecated\n");
+
 		info->xfer_type = pdata->xfer_type;
 		info->devsize = pdata->devsize;
 		info->elm_of_node = pdata->elm_of_node;
@@ -1787,6 +1787,13 @@ static int omap_nand_probe(struct platform_device *pdev)
 	nand_chip->IO_ADDR_W = nand_chip->IO_ADDR_R;
 	nand_chip->cmd_ctrl  = omap_hwcontrol;
 
+	info->ready_gpiod = devm_gpiod_get_optional(&pdev->dev, "rb",
+						    GPIOD_IN);
+	if (IS_ERR(info->ready_gpiod)) {
+		dev_err(dev, "failed to get ready gpio\n");
+		return PTR_ERR(info->ready_gpiod);
+	}
+
 	/*
 	 * If RDY/BSY line is connected to OMAP then use the omap ready
 	 * function and the generic nand_wait function which reads the status
@@ -1794,7 +1801,7 @@ static int omap_nand_probe(struct platform_device *pdev)
 	 * chip delay which is slightly more than tR (AC Timing) of the NAND
 	 * device and read status register until you get a failure or success
 	 */
-	if (info->dev_ready) {
+	if (info->ready_gpiod) {
 		nand_chip->dev_ready = omap_dev_ready;
 		nand_chip->chip_delay = 0;
 	} else {
include/linux/platform_data/mtd-nand-omap2.h +1 -1
index 7f6de53..17d57a1 100644
@@ -71,7 +71,6 @@ struct omap_nand_platform_data {
 	int			cs;
 	struct mtd_partition	*parts;
 	int			nr_parts;
-	bool			dev_ready;
 	bool			flash_bbt;
 	enum nand_io		xfer_type;
 	int			devsize;
@@ -82,5 +81,6 @@ struct omap_nand_platform_data {
 	/* deprecated */
 	struct gpmc_nand_regs	reg;
 	struct device_node	*of_node;
+	bool			dev_ready;
 };
 #endif
Signature · 1 line
2.5.0
maintainer Acked-by on v6 17/17
#21 lore raw

Re: [PATCH v6 17/17] mtd: nand: omap2: Implement NAND ready using gpiolib

Quoted 9 lines · Roger Quadros

The GPMC WAIT pin status are now available over gpiolib. Update the omap_dev_ready() function to use gpio instead of directly accessing GPMC register space.

---
 .../devicetree/bindings/mtd/gpmc-nand.txt          |  2 ++
Quoted 3 lines
 drivers/mtd/nand/omap2.c                           | 29 ++++++++++++++--------
 include/linux/platform_data/mtd-nand-omap2.h       |  2 +-
 3 files changed, 21 insertions(+), 12 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer Acked-by on the v6 series
#22 lore raw
In reply to Roger Quadros
Quoted 8 lines · Roger Quadros

Hi,

As this series has cross dependency between omap and mtd subsystems, I'll set up a immutable branch which omap-soc and l2-mtd must merge in together to avoid any conflicts/breakage during integration.

Brian has acked all mtd patches. Tony needs to give his Ack for the gpmc driver part and then I can provide the immutable branch.

Looks good to me, please feel free to add:

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#23 lore raw

Tony & Boris,

Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Roger Quadros

Hi,

As this series has cross dependency between omap and mtd subsystems, I'll set up a immutable branch which omap-soc and l2-mtd must merge in together to avoid any conflicts/breakage during integration.

Quoted 7 lines
Quoted 2 lines

Brian has acked all mtd patches. Tony needs to give his Ack for the gpmc driver part and then I can provide the immutable branch.

Looks good to me, please feel free to add:

I've added Tony and Rob's Acked-by tags and pushed the patches at the below PULL request.

Please take this into omap-soc and l2-mtd trees. Thanks.

The following changes since commit f55532a0c0b8bb6148f4e07853b876ef73bc69ca:

Linux 4.6-rc1 (2016-03-26 16:03:24 -0700)

are available in the git repository at:

git-9UaJU3cA/F/[email protected]:rogerq/linux.git for-v4.7/gpmc-mtd-common

for you to fetch changes up to 10f22ee367c4aff7841da6a83c10445d7d6328d9:

mtd: nand: omap2: Implement NAND ready using gpiolib (2016-04-15 11:55:37 +0300)

----------------------------------------------------------------
Roger Quadros (17):
ARM: OMAP2+: gpmc: Add platform data
ARM: OMAP2+: gpmc: Add gpmc timings and settings to platform data
memory: omap-gpmc: Introduce GPMC to NAND interface
memory: omap-gpmc: Add GPMC-NAND ops to get writebufferempty status
memory: omap-gpmc: Implement IRQ domain for NAND IRQs
mtd: nand: omap: Use gpmc_omap_get_nand_ops() to get NAND registers
mtd: nand: omap: Switch to using GPMC-NAND ops for writebuffer empty check
mtd: nand: omap: Copy platform data parameters to omap_nand_info data
mtd: nand: omap: Clean up device tree support
mtd: nand: omap: Update DT binding documentation
memory: omap-gpmc: Prevent mapping into 1st 16MB
memory: omap-gpmc: Move device tree binding to correct location
memory: omap-gpmc: Support general purpose input for WAITPINs
memory: omap-gpmc: Reserve WAITPIN if needed for WAIT monitoring
memory: omap-gpmc: Support WAIT pin edge interrupts
memory: omap-gpmc: Prevent GPMC_STATUS from being accessed via gpmc_regs
mtd: nand: omap2: Implement NAND ready using gpiolib

 Documentation/devicetree/bindings/{bus/ti-gpmc.txt => memory-controllers/omap-gpmc.txt} |  17 +++
 Documentation/devicetree/bindings/mtd/gpmc-nand.txt                                     |  19 +++-
 arch/arm/mach-omap2/gpmc-nand.c                                                         |   7 +-
 drivers/memory/Kconfig                                                                  |   1 +
 drivers/memory/omap-gpmc.c                                                              | 655 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------
 drivers/mtd/nand/omap2.c                                                                | 194 +++++++++++++++++++++++++++-------
 include/linux/omap-gpmc.h                                                               | 172 ++++++------------------------
 include/linux/platform_data/gpmc-omap.h                                                 | 172 ++++++++++++++++++++++++++++++
 include/linux/platform_data/mtd-nand-omap2.h                                            |  12 ++-
 9 files changed, 817 insertions(+), 432 deletions(-)
 rename Documentation/devicetree/bindings/{bus/ti-gpmc.txt => memory-controllers/omap-gpmc.txt} (89%)
 create mode 100644 include/linux/platform_data/gpmc-omap.h

--
cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#24 lore raw

Hi Roger,

Quoted 15 lines · On Fri, 15 Apr 2016 12:34:04 +0300 Roger Quadros…

Tony & Boris,

Quoted 12 lines · Tony Lindgren
Quoted 8 lines · Roger Quadros

Hi,

As this series has cross dependency between omap and mtd subsystems, I'll set up a immutable branch which omap-soc and l2-mtd must merge in together to avoid any conflicts/breakage during integration.

Brian has acked all mtd patches. Tony needs to give his Ack for the gpmc driver part and then I can provide the immutable branch.

Looks good to me, please feel free to add:

Quoted 7 lines
Quoted 2 lines

I've added Tony and Rob's Acked-by tags and pushed the patches at the below PULL request.

Please take this into omap-soc and l2-mtd trees. Thanks.

I Pulled this branch into nand/next and had to resolve a few conflicts (as you may have noticed, a few other reworks in the NAND and MTD layer have been merged in the meantime).

It compiles, but I'm not sure it works correctly (I pushed the result to nand/next-with-gpmc-rework [1]). Could you test it before I push this to nand/next?

Thanks,

Boris

[1]https://github.com/linux-nand/linux/tree/nand/next-with-gpmc-rework

Signature · 7 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#25 lore raw
Quoted 23 lines · Boris Brezillon

Hi Roger,

Quoted 18 lines · On Fri, 15 Apr 2016 12:34:04 +0300 Roger Quadros <[email protected]> wrote:

Tony & Boris,

Quoted 14 lines · Tony Lindgren
Quoted 8 lines · Roger Quadros

Hi,

As this series has cross dependency between omap and mtd subsystems, I'll set up a immutable branch which omap-soc and l2-mtd must merge in together to avoid any conflicts/breakage during integration.

Brian has acked all mtd patches. Tony needs to give his Ack for the gpmc driver part and then I can provide the immutable branch.

Looks good to me, please feel free to add:

Quoted 8 lines
Quoted 4 lines

I've added Tony and Rob's Acked-by tags and pushed the patches at the below PULL request.

Please take this into omap-soc and l2-mtd trees. Thanks.

I Pulled this branch into nand/next and had to resolve a few conflicts (as you may have noticed, a few other reworks in the NAND and MTD layer have been merged in the meantime).

OK. I'm not sure how well this will play when this merges into liunx-next via the omap-soc tree.

Instead, can you please create a non-mutable nand/base for me (which could be today's nand/next) and I can base my branch on that and Tony can use my branch without causing any merge-conflict in linux-next?

If this doesn't look OK please advice an alternative. Thanks.

cheers,
-roger

Quoted 12 lines

It compiles, but I'm not sure it works correctly (I pushed the result to nand/next-with-gpmc-rework [1]). Could you test it before I push this to nand/next?

Thanks,

Boris

[1]https://github.com/linux-nand/linux/tree/nand/next-with-gpmc-rework

#26 lore raw
Quoted 33 lines · On Fri, 15 Apr 2016 13:54:34 +0300 Roger Quadros <[email protected]> wrote:
Quoted 23 lines · Boris Brezillon

Hi Roger,

Quoted 18 lines · On Fri, 15 Apr 2016 12:34:04 +0300 Roger Quadros <[email protected]> wrote:

Tony & Boris,

Quoted 14 lines · Tony Lindgren
Quoted 8 lines · Roger Quadros

Hi,

As this series has cross dependency between omap and mtd subsystems, I'll set up a immutable branch which omap-soc and l2-mtd must merge in together to avoid any conflicts/breakage during integration.

Brian has acked all mtd patches. Tony needs to give his Ack for the gpmc driver part and then I can provide the immutable branch.

Looks good to me, please feel free to add:

Quoted 8 lines
Quoted 4 lines

I've added Tony and Rob's Acked-by tags and pushed the patches at the below PULL request.

Please take this into omap-soc and l2-mtd trees. Thanks.

I Pulled this branch into nand/next and had to resolve a few conflicts (as you may have noticed, a few other reworks in the NAND and MTD layer have been merged in the meantime).

Quoted 6 lines

OK. I'm not sure how well this will play when this merges into liunx-next via the omap-soc tree.

Instead, can you please create a non-mutable nand/base for me (which could be today's nand/next) and I can base my branch on that and Tony can use my branch without causing any merge-conflict in linux-next?

You want those patches to go through the arm-soc tree, right? I'm not an expert, but I'd say that Tony should take those patches and provide an immutable branch I can pull into nand/next.

Signature · 3 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#27 lore raw
In reply to Roger Quadros

Roger, Tony,

Quoted 33 lines · On Fri, 15 Apr 2016 13:54:34 +0300 Roger Quadros <[email protected]> wrote:
Quoted 23 lines · Boris Brezillon

Hi Roger,

Quoted 18 lines · On Fri, 15 Apr 2016 12:34:04 +0300 Roger Quadros <[email protected]> wrote:

Tony & Boris,

Quoted 14 lines · Tony Lindgren
Quoted 8 lines · Roger Quadros

Hi,

As this series has cross dependency between omap and mtd subsystems, I'll set up a immutable branch which omap-soc and l2-mtd must merge in together to avoid any conflicts/breakage during integration.

Brian has acked all mtd patches. Tony needs to give his Ack for the gpmc driver part and then I can provide the immutable branch.

Looks good to me, please feel free to add:

Quoted 8 lines
Quoted 4 lines

I've added Tony and Rob's Acked-by tags and pushed the patches at the below PULL request.

Please take this into omap-soc and l2-mtd trees. Thanks.

I Pulled this branch into nand/next and had to resolve a few conflicts (as you may have noticed, a few other reworks in the NAND and MTD layer have been merged in the meantime).

Quoted 6 lines

OK. I'm not sure how well this will play when this merges into liunx-next via the omap-soc tree.

Instead, can you please create a non-mutable nand/base for me (which could be today's nand/next) and I can base my branch on that and Tony can use my branch without causing any merge-conflict in linux-next?

I just created a branch called nand/for-gpmc-rework based on today's nand/next, but I'm still unsure how to proceed once you've rebased your work on this branch?

Tony will first have to pull my immutable branch, then pull yours, and then I'll have to pull an immutable branch from the the omap-soc tree to get your changes into my nand/next branch (in case other patches modify the same files before I send my PR). Am I missing something? If I'm not, then this option looks over-complicated to me.

ITOH, if we decide to let your patches go through the nand or omap-soc tree, only one immutable branch will be created, and either the nand or omap-soc maintainer (depending on who takes the patches) will have to pull it into its -next branch.

I'm quite new to all this merging process, so don't hesitate to correct me if I'm wrong.

Thanks,

Boris

Signature · 3 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
maintainer
#28 lore raw
Quoted 49 lines · Boris Brezillon

Roger, Tony,

Quoted 33 lines · On Fri, 15 Apr 2016 13:54:34 +0300 Roger Quadros…
Quoted 23 lines · Boris Brezillon

Hi Roger,

Quoted 18 lines · On Fri, 15 Apr 2016 12:34:04 +0300 Roger Quadros…

Tony & Boris,

Quoted 14 lines · Tony Lindgren
Quoted 8 lines · Roger Quadros

Hi,

As this series has cross dependency between omap and mtd subsystems, I'll set up a immutable branch which omap-soc and l2-mtd must merge in together to avoid any conflicts/breakage during integration.

Brian has acked all mtd patches. Tony needs to give his Ack for the gpmc driver part and then I can provide the immutable branch.

Looks good to me, please feel free to add:

Quoted 8 lines
Quoted 4 lines

I've added Tony and Rob's Acked-by tags and pushed the patches at the below PULL request.

Please take this into omap-soc and l2-mtd trees. Thanks.

I Pulled this branch into nand/next and had to resolve a few conflicts (as you may have noticed, a few other reworks in the NAND and MTD layer have been merged in the meantime).

Quoted 6 lines

OK. I'm not sure how well this will play when this merges into liunx-next via the omap-soc tree.

Instead, can you please create a non-mutable nand/base for me (which could be today's nand/next) and I can base my branch on that and Tony can use my branch without causing any merge-conflict in linux-next?

I just created a branch called nand/for-gpmc-rework based on today's nand/next, but I'm still unsure how to proceed once you've rebased your work on this branch?

Quoted 5 lines

Tony will first have to pull my immutable branch, then pull yours, and then I'll have to pull an immutable branch from the the omap-soc tree to get your changes into my nand/next branch (in case other patches modify the same files before I send my PR). Am I missing something? If I'm not, then this option looks over-complicated to me.

Well why don't you merge it all via NAND then? I'm not seeing any merge conflicts with the arch/arm/mach-omap* code.

Quoted 7 lines

ITOH, if we decide to let your patches go through the nand or omap-soc tree, only one immutable branch will be created, and either the nand or omap-soc maintainer (depending on who takes the patches) will have to pull it into its -next branch.

I'm quite new to all this merging process, so don't hesitate to correct me if I'm wrong.

Well the rules are that if something agreed to be immutable, then it will never get redone. And the immutable branch should be based on the absolute minimal set of patches against some earlier tag, usually -rc1 is a good one. This avoids other tree to need to pull in a huge amount of changes from other trees just to avoid merge conflicts.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#29 lore raw

Hi Tony,

Quoted 50 lines · On Fri, 15 Apr 2016 08:41:40 -0700 Tony Lindgren…
Quoted 49 lines · Boris Brezillon

Roger, Tony,

Quoted 33 lines · On Fri, 15 Apr 2016 13:54:34 +0300 Roger Quadros…
Quoted 23 lines · Boris Brezillon

Hi Roger,

Quoted 18 lines · On Fri, 15 Apr 2016 12:34:04 +0300 Roger Quadros…

Tony & Boris,

Quoted 14 lines · Tony Lindgren
Quoted 8 lines · Roger Quadros

Hi,

As this series has cross dependency between omap and mtd subsystems, I'll set up a immutable branch which omap-soc and l2-mtd must merge in together to avoid any conflicts/breakage during integration.

Brian has acked all mtd patches. Tony needs to give his Ack for the gpmc driver part and then I can provide the immutable branch.

Looks good to me, please feel free to add:

Quoted 8 lines
Quoted 4 lines

I've added Tony and Rob's Acked-by tags and pushed the patches at the below PULL request.

Please take this into omap-soc and l2-mtd trees. Thanks.

I Pulled this branch into nand/next and had to resolve a few conflicts (as you may have noticed, a few other reworks in the NAND and MTD layer have been merged in the meantime).

Quoted 6 lines

OK. I'm not sure how well this will play when this merges into liunx-next via the omap-soc tree.

Instead, can you please create a non-mutable nand/base for me (which could be today's nand/next) and I can base my branch on that and Tony can use my branch without causing any merge-conflict in linux-next?

I just created a branch called nand/for-gpmc-rework based on today's nand/next, but I'm still unsure how to proceed once you've rebased your work on this branch?

Quoted 8 lines
Quoted 5 lines

Tony will first have to pull my immutable branch, then pull yours, and then I'll have to pull an immutable branch from the the omap-soc tree to get your changes into my nand/next branch (in case other patches modify the same files before I send my PR). Am I missing something? If I'm not, then this option looks over-complicated to me.

Well why don't you merge it all via NAND then? I'm not seeing any merge conflicts with the arch/arm/mach-omap* code.

I'm perfectly fine with that. Actually, that's what I first did (see the nand/next-with-gpmc-rework I asked Roger to validate). Roger, since you don't have any dependencies on omap stuff added after 4.6-rc1, I could even rebase your patches on top of nand/next to avoid this merge commit (and the associated conflict resolution).

Quoted 9 lines
Quoted 8 lines

ITOH, if we decide to let your patches go through the nand or omap-soc tree, only one immutable branch will be created, and either the nand or omap-soc maintainer (depending on who takes the patches) will have to pull it into its -next branch.

I'm quite new to all this merging process, so don't hesitate to correct me if I'm wrong.

Quoted 6 lines

Well the rules are that if something agreed to be immutable, then it will never get redone. And the immutable branch should be based on the absolute minimal set of patches against some earlier tag, usually -rc1 is a good one. This avoids other tree to need to pull in a huge amount of changes from other trees just to avoid merge conflicts.

How would you do it in this particular case. Say I have to provide you with an immutable branch, it should only contain Roger's patches, right?

But this also means this immutable branch has to be pulled into my nand/next branch before all other changes touching the same set of files, which in turn means that I'll have to rebase and push -f my nand/next branch (which I'd like to avoid).
Or should I just pull this immutable branch in my current nand/next and let you pull the same immutable branch in omap-soc. I mean, would this prevent conflicts when our branches are merged into linux-next, no matter the order.

Signature · 7 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#30 lore raw
Quoted 11 lines · Boris Brezillon
Quoted 6 lines · On Fri, 15 Apr 2016 08:41:40 -0700 Tony Lindgren…

Well the rules are that if something agreed to be immutable, then it will never get redone. And the immutable branch should be based on the absolute minimal set of patches against some earlier tag, usually -rc1 is a good one. This avoids other tree to need to pull in a huge amount of changes from other trees just to avoid merge conflicts.

How would you do it in this particular case. Say I have to provide you with an immutable branch, it should only contain Roger's patches, right?

Well ideally it would be just minimal NAND related changes branch against v4.6-rc1. Then if Roger has a dependency to that, Roger can pull it in.

Then Roger would make a branch for the GPMC changes against your minimal NAND branch.

Then if there were non-trivial merge conflicts, I could pull in Roger's GPMC branch as needed.

But in this case, it seems you can just merge everything via the NAND tree and problem solved.

Quoted 4 lines

But this also means this immutable branch has to be pulled into my nand/next branch before all other changes touching the same set of files, which in turn means that I'll have to rebase and push -f my nand/next branch (which I'd like to avoid).

Yeah let's not do rebases, there should be no need for it.

Quoted 4 lines

Or should I just pull this immutable branch in my current nand/next and let you pull the same immutable branch in omap-soc. I mean, would this prevent conflicts when our branches are merged into linux-next, no matter the order.

Ideally just one or more branches with just minimal changes in them against -rc1. But you may have other dependencies in your NAND tree so that may no longer be doable :) Usually if I merge something that may need to get merged into other branches, I just apply them into a separate branch against -rc1 to start with, then merge that branch in.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#31 lore raw
Quoted 6 lines · On Fri, 15 Apr 2016 09:19:51 -0700 Tony Lindgren <[email protected]> wrote:
Quoted 5 lines

Or should I just pull this immutable branch in my current nand/next and let you pull the same immutable branch in omap-soc. I mean, would this prevent conflicts when our branches are merged into linux-next, no matter the order.

Quoted 6 lines

Ideally just one or more branches with just minimal changes in them against -rc1. But you may have other dependencies in your NAND tree so that may no longer be doable :) Usually if I merge something that may need to get merged into other branches, I just apply them into a separate branch against -rc1 to start with, then merge that branch in.

Okay, in this case, that's pretty much what I did from the beginning, except the immutable branch was provided by Roger (based on 4.6-rc1). Thanks for this detailed explanation, I'll try to remember that when I'll need to provide an immutable branch for another subsystem.

Roger, my request remains, could you check/test my conflict resolution (branch nand/next-with-gpmc-rework)?

Thanks,

Boris

Signature · 3 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#32 lore raw
Quoted 16 lines · Boris Brezillon
Quoted 6 lines · On Fri, 15 Apr 2016 09:19:51 -0700 Tony Lindgren <[email protected]> wrote:
Quoted 5 lines

Or should I just pull this immutable branch in my current nand/next and let you pull the same immutable branch in omap-soc. I mean, would this prevent conflicts when our branches are merged into linux-next, no matter the order.

Quoted 6 lines

Ideally just one or more branches with just minimal changes in them against -rc1. But you may have other dependencies in your NAND tree so that may no longer be doable :) Usually if I merge something that may need to get merged into other branches, I just apply them into a separate branch against -rc1 to start with, then merge that branch in.

Quoted 7 lines

Okay, in this case, that's pretty much what I did from the beginning, except the immutable branch was provided by Roger (based on 4.6-rc1). Thanks for this detailed explanation, I'll try to remember that when I'll need to provide an immutable branch for another subsystem.

Roger, my request remains, could you check/test my conflict resolution (branch nand/next-with-gpmc-rework)?

I couldn't test that branch yet as nand/next is broken on omap platforms (at least on dra7-evm).

The commit where it breaks is:
a662ef4 mtd: nand: omap2: use mtd_ooblayout_xxx() helpers where appropriate

I'm trying to figure out what went wrong there. Failure log below.

--cheers,
-roger

== attaching ubi to mtd9

[   27.173973] ubi0: attaching mtd9
[   27.178311] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.184828] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.191324] ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 0:0, read only 64 bytes, retry
[   27.203378] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.209860] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.216388] ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 0:0, read only 64 bytes, retry
[   27.228468] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.234976] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.241471] ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 0:0, read only 64 bytes, retry
[   27.253802] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.260278] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.266812] ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 0:0, read 64 bytes
[   27.277254] CPU: 0 PID: 2032 Comm: ubiattach Not tainted 4.6.0-rc1-00053-ga662ef4 #625
[   27.285549] Hardware name: Generic DRA74X (Flattened Device Tree)
[   27.291949] [<c010feec>] (unwind_backtrace) from [<c010c110>] (show_stack+0x10/0x14)
[   27.300083] [<c010c110>] (show_stack) from [<c0470f24>] (dump_stack+0xac/0xe0)
[   27.307664] [<c0470f24>] (dump_stack) from [<c05a5f8c>] (ubi_io_read+0x11c/0x2fc)
[   27.315511] [<c05a5f8c>] (ubi_io_read) from [<c05a6388>] (ubi_io_read_ec_hdr+0x44/0x228)
[   27.323989] [<c05a6388>] (ubi_io_read_ec_hdr) from [<c05aaef8>] (ubi_attach+0x138/0x149c)
[   27.332579] [<c05aaef8>] (ubi_attach) from [<c059fc78>] (ubi_attach_mtd_dev+0x3d0/0xbe4)
[   27.341063] [<c059fc78>] (ubi_attach_mtd_dev) from [<c05a15d4>] (ctrl_cdev_ioctl+0xe4/0x224)
[   27.349928] [<c05a15d4>] (ctrl_cdev_ioctl) from [<c029e380>] (do_vfs_ioctl+0x90/0xa2c)
[   27.358242] [<c029e380>] (do_vfs_ioctl) from [<c029ed88>] (SyS_ioctl+0x6c/0x7c)
[   27.365910] [<c029ed88>] (SyS_ioctl) from [<c0107840>] (ret_fast_syscall+0x0/0x1c)
[   27.374541] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.381025] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.387551] ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 0:512, read only 512 bytes, retry
[   27.399953] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.406465] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.412950] ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 0:512, read only 512 bytes, retry
[   27.425349] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.431837] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.438356] ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 0:512, read only 512 bytes, retry
[   27.450735] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.457243] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.463739] ubi0 error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 0:512, read 512 bytes
[   27.474526] CPU: 0 PID: 2032 Comm: ubiattach Not tainted 4.6.0-rc1-00053-ga662ef4 #625
[   27.482824] Hardware name: Generic DRA74X (Flattened Device Tree)
[   27.489218] [<c010feec>] (unwind_backtrace) from [<c010c110>] (show_stack+0x10/0x14)
[   27.497348] [<c010c110>] (show_stack) from [<c0470f24>] (dump_stack+0xac/0xe0)
[   27.504923] [<c0470f24>] (dump_stack) from [<c05a5f8c>] (ubi_io_read+0x11c/0x2fc)
[   27.512772] [<c05a5f8c>] (ubi_io_read) from [<c05a65b8>] (ubi_io_read_vid_hdr+0x4c/0x230)
[   27.521355] [<c05a65b8>] (ubi_io_read_vid_hdr) from [<c05ab04c>] (ubi_attach+0x28c/0x149c)
[   27.530024] [<c05ab04c>] (ubi_attach) from [<c059fc78>] (ubi_attach_mtd_dev+0x3d0/0xbe4)
[   27.538517] [<c059fc78>] (ubi_attach_mtd_dev) from [<c05a15d4>] (ctrl_cdev_ioctl+0xe4/0x224)
[   27.547409] [<c05a15d4>] (ctrl_cdev_ioctl) from [<c029e380>] (do_vfs_ioctl+0x90/0xa2c)
[   27.555736] [<c029e380>] (do_vfs_ioctl) from [<c029ed88>] (SyS_ioctl+0x6c/0x7c)
[   27.563415] [<c029ed88>] (SyS_ioctl) from [<c0107840>] (ret_fast_syscall+0x0/0x1c)
[   27.572208] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.579160] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.586560] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.593311] omap2-nand omap2-nand.0: uncorrectable bit-flips found
[   27.600038] omap2-nand omap2-nand.0: uncorrectable bit-flips found
#33 lore raw
Quoted 25 lines · Roger Quadros
Quoted 16 lines · Boris Brezillon
Quoted 6 lines · On Fri, 15 Apr 2016 09:19:51 -0700 Tony Lindgren <[email protected]> wrote:
Quoted 5 lines

Or should I just pull this immutable branch in my current nand/next and let you pull the same immutable branch in omap-soc. I mean, would this prevent conflicts when our branches are merged into linux-next, no matter the order.

Quoted 6 lines

Ideally just one or more branches with just minimal changes in them against -rc1. But you may have other dependencies in your NAND tree so that may no longer be doable :) Usually if I merge something that may need to get merged into other branches, I just apply them into a separate branch against -rc1 to start with, then merge that branch in.

Quoted 7 lines

Okay, in this case, that's pretty much what I did from the beginning, except the immutable branch was provided by Roger (based on 4.6-rc1). Thanks for this detailed explanation, I'll try to remember that when I'll need to provide an immutable branch for another subsystem.

Roger, my request remains, could you check/test my conflict resolution (branch nand/next-with-gpmc-rework)?

Quoted 7 lines

I couldn't test that branch yet as nand/next is broken on omap platforms (at least on dra7-evm).

The commit where it breaks is:
a662ef4 mtd: nand: omap2: use mtd_ooblayout_xxx() helpers where appropriate

I'm trying to figure out what went wrong there. Failure log below.

OK. I was able to fix it when at commit a662ef4 with the below patch.

Looks like we need to read exactly the ECC bytes through the ECC engine and not the entire OOB region.

--cheers,
-oger

drivers/mtd/nand/omap2.c +2 -2
index e622a1b..46b61d2 100644
@@ -1547,8 +1547,8 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
 	chip->read_buf(mtd, buf, mtd->writesize);
 
 	/* Read oob bytes */
-	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + chip->ecc.layout->eccpos[0], -1);
+	chip->read_buf(mtd, chip->oob_poi, chip->ecc.total);
 
 	/* Calculate ecc bytes */
 	chip->ecc.calculate(mtd, buf, ecc_calc);
#34 lore raw

Hi Roger,

Quoted 29 lines · On Mon, 18 Apr 2016 15:52:58 +0300 Roger Quadros…
Quoted 28 lines · Roger Quadros
Quoted 16 lines · Boris Brezillon
Quoted 6 lines · On Fri, 15 Apr 2016 09:19:51 -0700 Tony Lindgren…
Quoted 5 lines

Or should I just pull this immutable branch in my current nand/next and let you pull the same immutable branch in omap-soc. I mean, would this prevent conflicts when our branches are merged into linux-next, no matter the order.

Quoted 6 lines

Ideally just one or more branches with just minimal changes in them against -rc1. But you may have other dependencies in your NAND tree so that may no longer be doable :) Usually if I merge something that may need to get merged into other branches, I just apply them into a separate branch against -rc1 to start with, then merge that branch in.

Quoted 7 lines

Okay, in this case, that's pretty much what I did from the beginning, except the immutable branch was provided by Roger (based on 4.6-rc1). Thanks for this detailed explanation, I'll try to remember that when I'll need to provide an immutable branch for another subsystem.

Roger, my request remains, could you check/test my conflict resolution (branch nand/next-with-gpmc-rework)?

I couldn't test that branch yet as nand/next is broken on omap platforms (at least on dra7-evm).

Quoted 6 lines
Quoted 4 lines

The commit where it breaks is:
a662ef4 mtd: nand: omap2: use mtd_ooblayout_xxx() helpers where appropriate

I'm trying to figure out what went wrong there. Failure log below.

OK. I was able to fix it when at commit a662ef4 with the below patch.

Thanks for debugging that.

Quoted 3 lines

Looks like we need to read exactly the ECC bytes through the ECC engine and not the entire OOB region.

Hm, it looks like there's a bug somewhere else, because I don't see any reason why the controller wouldn't be able to read the full OOB region.

Quoted 9 lines

--cheers,

(quoted diff) +0 -1
-oger
drivers/mtd/nand/omap2.c +0 -0
index e622a1b..46b61d2 100644

drivers/mtd/nand/omap2.c static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, · line 1550

Quoted 6 lines
drivers/mtd/nand/omap2.c +1 -2
@@ -1547,8 +1547,8 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
 	chip->read_buf(mtd, buf, mtd->writesize);
 
 	/* Read oob bytes */
-	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + chip->ecc.layout->eccpos[0], -1);

The whole point of this series is to get rid of chip->ecc.layout, so we'd rather use the mtd_ooblayout_find_eccregion() instead of chip->ecc.layout->eccpos[0].

drivers/mtd/nand/omap2.c static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, · line 1551

Quoted 1 line
drivers/mtd/nand/omap2.c +1 -0
+	chip->read_buf(mtd, chip->oob_poi, chip->ecc.total);

Can you print the ->oobsize, ->writesize, chip->ecc.layout->eccpos[0] and chip->ecc.total values here. I'll also need your NAND page layout (page size and OOB size provided in the datasheet).

Thanks,

Boris

Signature · 7 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#35 lore raw

Boris,

Quoted 41 lines · Boris Brezillon

Hi Roger,

Quoted 29 lines · On Mon, 18 Apr 2016 15:52:58 +0300 Roger Quadros <[email protected]> wrote:
Quoted 28 lines · Roger Quadros
Quoted 16 lines · Boris Brezillon
Quoted 6 lines · On Fri, 15 Apr 2016 09:19:51 -0700 Tony Lindgren <[email protected]> wrote:
Quoted 5 lines

Or should I just pull this immutable branch in my current nand/next and let you pull the same immutable branch in omap-soc. I mean, would this prevent conflicts when our branches are merged into linux-next, no matter the order.

Quoted 6 lines

Ideally just one or more branches with just minimal changes in them against -rc1. But you may have other dependencies in your NAND tree so that may no longer be doable :) Usually if I merge something that may need to get merged into other branches, I just apply them into a separate branch against -rc1 to start with, then merge that branch in.

Quoted 7 lines

Okay, in this case, that's pretty much what I did from the beginning, except the immutable branch was provided by Roger (based on 4.6-rc1). Thanks for this detailed explanation, I'll try to remember that when I'll need to provide an immutable branch for another subsystem.

Roger, my request remains, could you check/test my conflict resolution (branch nand/next-with-gpmc-rework)?

I couldn't test that branch yet as nand/next is broken on omap platforms (at least on dra7-evm).

Quoted 6 lines
Quoted 4 lines

The commit where it breaks is:
a662ef4 mtd: nand: omap2: use mtd_ooblayout_xxx() helpers where appropriate

I'm trying to figure out what went wrong there. Failure log below.

OK. I was able to fix it when at commit a662ef4 with the below patch.

Quoted 8 lines

Thanks for debugging that.

Quoted 3 lines

Looks like we need to read exactly the ECC bytes through the ECC engine and not the entire OOB region.

Hm, it looks like there's a bug somewhere else, because I don't see any reason why the controller wouldn't be able to read the full OOB region.

The controller can read the full OOB region but we only want it to read just the ECC bytes because that is the way the ELM ECC engine works.

Quoted 8 lines
Quoted 8 lines
drivers/mtd/nand/omap2.c +0 -0
index e622a1b..46b61d2 100644
@@ -1547,8 +1547,8 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
 	chip->read_buf(mtd, buf, mtd->writesize);
 
Quoted 8 lines

drivers/mtd/nand/omap2.c static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, · line 1550

Quoted 4 lines
drivers/mtd/nand/omap2.c +1 -2
 	/* Read oob bytes */
-	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + chip->ecc.layout->eccpos[0], -1);

The whole point of this series is to get rid of chip->ecc.layout, so we'd rather use the mtd_ooblayout_find_eccregion() instead of chip->ecc.layout->eccpos[0].

We just need the position of the first ECC byte offset. Is that the most optimal way to get it?

Quoted 6 lines

drivers/mtd/nand/omap2.c static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, · line 1551

Quoted 2 lines
drivers/mtd/nand/omap2.c +1 -0
+	chip->read_buf(mtd, chip->oob_poi, chip->ecc.total);

Can you print the ->oobsize, ->writesize, chip->ecc.layout->eccpos[0] and chip->ecc.total values here. I'll also need your NAND page layout (page size and OOB size provided in the datasheet).

eccpos[0]: 2, oobsize 64, ecctotal 56, writesize 2048

Nand part is MT29F2G16ABAEAWP
This has page size 2048 bytes and OOB size 64 bytes.

cheers,
-roger

#36 lore raw
Quoted 47 lines · On Mon, 18 Apr 2016 16:48:26 +0300 Roger Quadros…

Boris,

Quoted 44 lines · Boris Brezillon

Hi Roger,

Quoted 29 lines · On Mon, 18 Apr 2016 15:52:58 +0300 Roger Quadros…
Quoted 28 lines · Roger Quadros
Quoted 16 lines · Boris Brezillon
Quoted 6 lines · On Fri, 15 Apr 2016 09:19:51 -0700 Tony Lindgren…
Quoted 5 lines

Or should I just pull this immutable branch in my current nand/next and let you pull the same immutable branch in omap-soc. I mean, would this prevent conflicts when our branches are merged into linux-next, no matter the order.

Quoted 6 lines

Ideally just one or more branches with just minimal changes in them against -rc1. But you may have other dependencies in your NAND tree so that may no longer be doable :) Usually if I merge something that may need to get merged into other branches, I just apply them into a separate branch against -rc1 to start with, then merge that branch in.

Quoted 7 lines

Okay, in this case, that's pretty much what I did from the beginning, except the immutable branch was provided by Roger (based on 4.6-rc1). Thanks for this detailed explanation, I'll try to remember that when I'll need to provide an immutable branch for another subsystem.

Roger, my request remains, could you check/test my conflict resolution (branch nand/next-with-gpmc-rework)?

I couldn't test that branch yet as nand/next is broken on omap platforms (at least on dra7-evm).

Quoted 6 lines
Quoted 4 lines

The commit where it breaks is:
a662ef4 mtd: nand: omap2: use mtd_ooblayout_xxx() helpers where appropriate

I'm trying to figure out what went wrong there. Failure log below.

OK. I was able to fix it when at commit a662ef4 with the below patch.

Thanks for debugging that.

Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Looks like we need to read exactly the ECC bytes through the ECC engine and not the entire OOB region.

Hm, it looks like there's a bug somewhere else, because I don't see any reason why the controller wouldn't be able to read the full OOB region.

The controller can read the full OOB region but we only want it to read just the ECC bytes because that is the way the ELM ECC engine works.

Ok, I think I got it: the ECC correction is pipelined with data read, and the controller expect to have ECC bytes right after the in-band data, is that correct?

Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
drivers/mtd/nand/omap2.c +0 -0
index e622a1b..46b61d2 100644
@@ -1547,8 +1547,8 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
 	chip->read_buf(mtd, buf, mtd->writesize);
 
Quoted 8 lines

drivers/mtd/nand/omap2.c static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, · line 1550

Quoted 4 lines
drivers/mtd/nand/omap2.c +1 -2
 	/* Read oob bytes */
-	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + chip->ecc.layout->eccpos[0], -1);

The whole point of this series is to get rid of chip->ecc.layout, so we'd rather use the mtd_ooblayout_find_eccregion() instead of chip->ecc.layout->eccpos[0].

Quoted 2 lines

We just need the position of the first ECC byte offset. Is that the most optimal way to get it?

For the BCH case, it seems that ECC bytes always start at offset BADBLOCK_MARKER_LENGTH, so you can just pass mtd->writesize + BADBLOCK_MARKER_LENGTH.

Let me know if this works, and I'll squash those changes into the faulty commit (I know this implies a rebase + push -f, but IMO that's better than breaking bisectability).

Signature · 7 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#37 lore raw
Quoted 56 lines · Boris Brezillon
Quoted 53 lines · On Mon, 18 Apr 2016 16:48:26 +0300 Roger Quadros <[email protected]> wrote:

Boris,

Quoted 49 lines · Boris Brezillon

Hi Roger,

Quoted 29 lines · On Mon, 18 Apr 2016 15:52:58 +0300 Roger Quadros <[email protected]> wrote:
Quoted 28 lines · Roger Quadros
Quoted 16 lines · Boris Brezillon
Quoted 6 lines · On Fri, 15 Apr 2016 09:19:51 -0700 Tony Lindgren <[email protected]> wrote:
Quoted 5 lines

Or should I just pull this immutable branch in my current nand/next and let you pull the same immutable branch in omap-soc. I mean, would this prevent conflicts when our branches are merged into linux-next, no matter the order.

Quoted 6 lines

Ideally just one or more branches with just minimal changes in them against -rc1. But you may have other dependencies in your NAND tree so that may no longer be doable :) Usually if I merge something that may need to get merged into other branches, I just apply them into a separate branch against -rc1 to start with, then merge that branch in.

Quoted 7 lines

Okay, in this case, that's pretty much what I did from the beginning, except the immutable branch was provided by Roger (based on 4.6-rc1). Thanks for this detailed explanation, I'll try to remember that when I'll need to provide an immutable branch for another subsystem.

Roger, my request remains, could you check/test my conflict resolution (branch nand/next-with-gpmc-rework)?

I couldn't test that branch yet as nand/next is broken on omap platforms (at least on dra7-evm).

Quoted 6 lines
Quoted 4 lines

The commit where it breaks is:
a662ef4 mtd: nand: omap2: use mtd_ooblayout_xxx() helpers where appropriate

I'm trying to figure out what went wrong there. Failure log below.

OK. I was able to fix it when at commit a662ef4 with the below patch.

Thanks for debugging that.

Quoted 3 lines

Looks like we need to read exactly the ECC bytes through the ECC engine and not the entire OOB region.

Hm, it looks like there's a bug somewhere else, because I don't see any reason why the controller wouldn't be able to read the full OOB region.

Quoted 6 lines
Quoted 2 lines

The controller can read the full OOB region but we only want it to read just the ECC bytes because that is the way the ELM ECC engine works.

Ok, I think I got it: the ECC correction is pipelined with data read, and the controller expect to have ECC bytes right after the in-band data, is that correct?

That is correct.

Quoted 22 lines
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
drivers/mtd/nand/omap2.c +0 -0
index e622a1b..46b61d2 100644
@@ -1547,8 +1547,8 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
 	chip->read_buf(mtd, buf, mtd->writesize);
 
Quoted 8 lines

drivers/mtd/nand/omap2.c static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, · line 1550

Quoted 4 lines
drivers/mtd/nand/omap2.c +1 -2
 	/* Read oob bytes */
-	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + chip->ecc.layout->eccpos[0], -1);

The whole point of this series is to get rid of chip->ecc.layout, so we'd rather use the mtd_ooblayout_find_eccregion() instead of chip->ecc.layout->eccpos[0].

Quoted 2 lines

We just need the position of the first ECC byte offset. Is that the most optimal way to get it?

Quoted 9 lines

For the BCH case, it seems that ECC bytes always start at offset BADBLOCK_MARKER_LENGTH, so you can just pass mtd->writesize + BADBLOCK_MARKER_LENGTH.

Let me know if this works, and I'll squash those changes into the faulty commit (I know this implies a rebase + push -f, but IMO that's better than breaking bisectability).

So, the below patch works as well. Please feel free to fold it with your patch.

#38 lore raw
Quoted 92 lines · On Mon, 18 Apr 2016 17:39:01 +0300 Roger Quadros <[email protected]> wrote:
Quoted 56 lines · Boris Brezillon
Quoted 53 lines · On Mon, 18 Apr 2016 16:48:26 +0300 Roger Quadros <[email protected]> wrote:

Boris,

Quoted 49 lines · Boris Brezillon

Hi Roger,

Quoted 29 lines · On Mon, 18 Apr 2016 15:52:58 +0300 Roger Quadros <[email protected]> wrote:
Quoted 28 lines · Roger Quadros
Quoted 16 lines · Boris Brezillon
Quoted 6 lines · On Fri, 15 Apr 2016 09:19:51 -0700 Tony Lindgren <[email protected]> wrote:
Quoted 5 lines

Or should I just pull this immutable branch in my current nand/next and let you pull the same immutable branch in omap-soc. I mean, would this prevent conflicts when our branches are merged into linux-next, no matter the order.

Quoted 6 lines

Ideally just one or more branches with just minimal changes in them against -rc1. But you may have other dependencies in your NAND tree so that may no longer be doable :) Usually if I merge something that may need to get merged into other branches, I just apply them into a separate branch against -rc1 to start with, then merge that branch in.

Quoted 7 lines

Okay, in this case, that's pretty much what I did from the beginning, except the immutable branch was provided by Roger (based on 4.6-rc1). Thanks for this detailed explanation, I'll try to remember that when I'll need to provide an immutable branch for another subsystem.

Roger, my request remains, could you check/test my conflict resolution (branch nand/next-with-gpmc-rework)?

I couldn't test that branch yet as nand/next is broken on omap platforms (at least on dra7-evm).

Quoted 6 lines
Quoted 4 lines

The commit where it breaks is:
a662ef4 mtd: nand: omap2: use mtd_ooblayout_xxx() helpers where appropriate

I'm trying to figure out what went wrong there. Failure log below.

OK. I was able to fix it when at commit a662ef4 with the below patch.

Thanks for debugging that.

Quoted 3 lines

Looks like we need to read exactly the ECC bytes through the ECC engine and not the entire OOB region.

Hm, it looks like there's a bug somewhere else, because I don't see any reason why the controller wouldn't be able to read the full OOB region.

Quoted 6 lines
Quoted 2 lines

The controller can read the full OOB region but we only want it to read just the ECC bytes because that is the way the ELM ECC engine works.

Ok, I think I got it: the ECC correction is pipelined with data read, and the controller expect to have ECC bytes right after the in-band data, is that correct?

That is correct.

Quoted 26 lines
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
drivers/mtd/nand/omap2.c +0 -0
index e622a1b..46b61d2 100644
@@ -1547,8 +1547,8 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
 	chip->read_buf(mtd, buf, mtd->writesize);
 
Quoted 8 lines

drivers/mtd/nand/omap2.c static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, · line 1550

Quoted 4 lines
drivers/mtd/nand/omap2.c +1 -2
 	/* Read oob bytes */
-	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + chip->ecc.layout->eccpos[0], -1);

The whole point of this series is to get rid of chip->ecc.layout, so we'd rather use the mtd_ooblayout_find_eccregion() instead of chip->ecc.layout->eccpos[0].

Quoted 2 lines

We just need the position of the first ECC byte offset. Is that the most optimal way to get it?

For the BCH case, it seems that ECC bytes always start at offset BADBLOCK_MARKER_LENGTH, so you can just pass mtd->writesize + BADBLOCK_MARKER_LENGTH.

Quoted 7 lines
Quoted 5 lines

Let me know if this works, and I'll squash those changes into the faulty commit (I know this implies a rebase + push -f, but IMO that's better than breaking bisectability).

So, the below patch works as well. Please feel free to fold it with your patch.

Will do.

Thanks,

Boris

Quoted 20 lines

--
cheers,

(quoted diff) +0 -1
-roger
drivers/mtd/nand/omap2.c +2 -2
index e622a1b..eb85d6b 100644
@@ -1547,8 +1547,8 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
 	chip->read_buf(mtd, buf, mtd->writesize);
 
 	/* Read oob bytes */
-	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + BADBLOCK_MARKER_LENGTH, -1);
+	chip->read_buf(mtd, chip->oob_poi, chip->ecc.total);
 
 	/* Calculate ecc bytes */
 	chip->ecc.calculate(mtd, buf, ecc_calc);
Signature · 3 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#39 lore raw

Boris,

Quoted 101 lines · Boris Brezillon
Quoted 98 lines · On Mon, 18 Apr 2016 17:39:01 +0300 Roger Quadros <[email protected]> wrote:
Quoted 56 lines · Boris Brezillon
Quoted 53 lines · On Mon, 18 Apr 2016 16:48:26 +0300 Roger Quadros <[email protected]> wrote:

Boris,

Quoted 49 lines · Boris Brezillon

Hi Roger,

Quoted 29 lines · On Mon, 18 Apr 2016 15:52:58 +0300 Roger Quadros <[email protected]> wrote:
Quoted 28 lines · Roger Quadros
Quoted 16 lines · Boris Brezillon
Quoted 6 lines · On Fri, 15 Apr 2016 09:19:51 -0700 Tony Lindgren <[email protected]> wrote:
Quoted 5 lines

Or should I just pull this immutable branch in my current nand/next and let you pull the same immutable branch in omap-soc. I mean, would this prevent conflicts when our branches are merged into linux-next, no matter the order.

Quoted 6 lines

Ideally just one or more branches with just minimal changes in them against -rc1. But you may have other dependencies in your NAND tree so that may no longer be doable :) Usually if I merge something that may need to get merged into other branches, I just apply them into a separate branch against -rc1 to start with, then merge that branch in.

Quoted 7 lines

Okay, in this case, that's pretty much what I did from the beginning, except the immutable branch was provided by Roger (based on 4.6-rc1). Thanks for this detailed explanation, I'll try to remember that when I'll need to provide an immutable branch for another subsystem.

Roger, my request remains, could you check/test my conflict resolution (branch nand/next-with-gpmc-rework)?

I couldn't test that branch yet as nand/next is broken on omap platforms (at least on dra7-evm).

Quoted 6 lines
Quoted 4 lines

The commit where it breaks is:
a662ef4 mtd: nand: omap2: use mtd_ooblayout_xxx() helpers where appropriate

I'm trying to figure out what went wrong there. Failure log below.

OK. I was able to fix it when at commit a662ef4 with the below patch.

Thanks for debugging that.

Quoted 3 lines

Looks like we need to read exactly the ECC bytes through the ECC engine and not the entire OOB region.

Hm, it looks like there's a bug somewhere else, because I don't see any reason why the controller wouldn't be able to read the full OOB region.

Quoted 6 lines
Quoted 2 lines

The controller can read the full OOB region but we only want it to read just the ECC bytes because that is the way the ELM ECC engine works.

Ok, I think I got it: the ECC correction is pipelined with data read, and the controller expect to have ECC bytes right after the in-band data, is that correct?

That is correct.

Quoted 31 lines
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
drivers/mtd/nand/omap2.c +0 -0
index e622a1b..46b61d2 100644
@@ -1547,8 +1547,8 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
 	chip->read_buf(mtd, buf, mtd->writesize);
 
Quoted 8 lines

drivers/mtd/nand/omap2.c static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, · line 1550

Quoted 4 lines
drivers/mtd/nand/omap2.c +1 -2
 	/* Read oob bytes */
-	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + chip->ecc.layout->eccpos[0], -1);

The whole point of this series is to get rid of chip->ecc.layout, so we'd rather use the mtd_ooblayout_find_eccregion() instead of chip->ecc.layout->eccpos[0].

Quoted 2 lines

We just need the position of the first ECC byte offset. Is that the most optimal way to get it?

For the BCH case, it seems that ECC bytes always start at offset BADBLOCK_MARKER_LENGTH, so you can just pass mtd->writesize + BADBLOCK_MARKER_LENGTH.

Let me know if this works, and I'll squash those changes into the faulty commit (I know this implies a rebase + push -f, but IMO that's better than breaking bisectability).

Quoted 7 lines
Quoted 1 line

So, the below patch works as well. Please feel free to fold it with your patch.

Will do.

Thanks,

Boris

After all the changes we discussed in [1] I was able to test nand/next-with-gpmc-rework and it worked fine.

[1] - http://thread.gmane.org/gmane.comp.hardware.netbook.arm.sunxi/22596/focus=22936

I'd be happy to test the branch again after you've incorporated all changes.

Since you are gong to do a push -f anyways, I was wondering if you want to pull in my gpmc branch first to avoid the merge conflict. But it is totally up to you.

#40 lore raw
Quoted 115 lines · On Tue, 19 Apr 2016 15:46:19 +0300 Roger Quadros <[email protected]> wrote:

Boris,

Quoted 101 lines · Boris Brezillon
Quoted 98 lines · On Mon, 18 Apr 2016 17:39:01 +0300 Roger Quadros <[email protected]> wrote:
Quoted 56 lines · Boris Brezillon
Quoted 53 lines · On Mon, 18 Apr 2016 16:48:26 +0300 Roger Quadros <[email protected]> wrote:

Boris,

Quoted 49 lines · Boris Brezillon

Hi Roger,

Quoted 29 lines · On Mon, 18 Apr 2016 15:52:58 +0300 Roger Quadros <[email protected]> wrote:
Quoted 28 lines · Roger Quadros
Quoted 16 lines · Boris Brezillon
Quoted 6 lines · On Fri, 15 Apr 2016 09:19:51 -0700 Tony Lindgren <[email protected]> wrote:
Quoted 5 lines

Or should I just pull this immutable branch in my current nand/next and let you pull the same immutable branch in omap-soc. I mean, would this prevent conflicts when our branches are merged into linux-next, no matter the order.

Quoted 6 lines

Ideally just one or more branches with just minimal changes in them against -rc1. But you may have other dependencies in your NAND tree so that may no longer be doable :) Usually if I merge something that may need to get merged into other branches, I just apply them into a separate branch against -rc1 to start with, then merge that branch in.

Quoted 7 lines

Okay, in this case, that's pretty much what I did from the beginning, except the immutable branch was provided by Roger (based on 4.6-rc1). Thanks for this detailed explanation, I'll try to remember that when I'll need to provide an immutable branch for another subsystem.

Roger, my request remains, could you check/test my conflict resolution (branch nand/next-with-gpmc-rework)?

I couldn't test that branch yet as nand/next is broken on omap platforms (at least on dra7-evm).

Quoted 6 lines
Quoted 4 lines

The commit where it breaks is:
a662ef4 mtd: nand: omap2: use mtd_ooblayout_xxx() helpers where appropriate

I'm trying to figure out what went wrong there. Failure log below.

OK. I was able to fix it when at commit a662ef4 with the below patch.

Thanks for debugging that.

Quoted 3 lines

Looks like we need to read exactly the ECC bytes through the ECC engine and not the entire OOB region.

Hm, it looks like there's a bug somewhere else, because I don't see any reason why the controller wouldn't be able to read the full OOB region.

Quoted 6 lines
Quoted 2 lines

The controller can read the full OOB region but we only want it to read just the ECC bytes because that is the way the ELM ECC engine works.

Ok, I think I got it: the ECC correction is pipelined with data read, and the controller expect to have ECC bytes right after the in-band data, is that correct?

That is correct.

Quoted 31 lines
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
drivers/mtd/nand/omap2.c +0 -0
index e622a1b..46b61d2 100644
@@ -1547,8 +1547,8 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
 	chip->read_buf(mtd, buf, mtd->writesize);
 
Quoted 8 lines

drivers/mtd/nand/omap2.c static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, · line 1550

Quoted 4 lines
drivers/mtd/nand/omap2.c +1 -2
 	/* Read oob bytes */
-	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + chip->ecc.layout->eccpos[0], -1);

The whole point of this series is to get rid of chip->ecc.layout, so we'd rather use the mtd_ooblayout_find_eccregion() instead of chip->ecc.layout->eccpos[0].

Quoted 2 lines

We just need the position of the first ECC byte offset. Is that the most optimal way to get it?

For the BCH case, it seems that ECC bytes always start at offset BADBLOCK_MARKER_LENGTH, so you can just pass mtd->writesize + BADBLOCK_MARKER_LENGTH.

Let me know if this works, and I'll squash those changes into the faulty commit (I know this implies a rebase + push -f, but IMO that's better than breaking bisectability).

Quoted 7 lines
Quoted 1 line

So, the below patch works as well. Please feel free to fold it with your patch.

Will do.

Thanks,

Boris

After all the changes we discussed in [1] I was able to test nand/next-with-gpmc-rework and it worked fine.

Quoted 6 lines

[1] - http://thread.gmane.org/gmane.comp.hardware.netbook.arm.sunxi/22596/focus=22936

I'd be happy to test the branch again after you've incorporated all changes.

Since you are gong to do a push -f anyways, I was wondering if you want to pull in my gpmc branch first to avoid the merge conflict. But it is totally up to you.

Sure, I can do that.

Signature · 3 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#41 lore raw
In reply to Roger Quadros
Quoted 7 lines · On Tue, 19 Apr 2016 15:46:19 +0300 Roger Quadros <[email protected]> wrote:

After all the changes we discussed in [1] I was able to test nand/next-with-gpmc-rework and it worked fine.

[1] - http://thread.gmane.org/gmane.comp.hardware.netbook.arm.sunxi/22596/focus=22936

I'd be happy to test the branch again after you've incorporated all changes.

Just pushed what's supposed to be my new nand/next into nand/next-with-gpmc-rework, can you test it? I'll push it to nand/next once I have your confirmation that everything is good.

Thanks,

Boris

Signature · 3 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#42 lore raw
Quoted 7 lines · Boris Brezillon
Quoted 4 lines · On Tue, 19 Apr 2016 15:46:19 +0300 Roger Quadros <[email protected]> wrote:

After all the changes we discussed in [1] I was able to test nand/next-with-gpmc-rework and it worked fine.

Quoted 8 lines
Quoted 3 lines

[1] - http://thread.gmane.org/gmane.comp.hardware.netbook.arm.sunxi/22596/focus=22936

I'd be happy to test the branch again after you've incorporated all changes.

Just pushed what's supposed to be my new nand/next into nand/next-with-gpmc-rework, can you test it? I'll push it to nand/next once I have your confirmation that everything is good.

Tested this on dra7-evm, am437x-gp-evm and omap3-beagle and all seems good. Thanks :).

cheers,
-roger

maintainer
#43 lore raw
In reply to Boris Brezillon
Quoted 7 lines · Boris Brezillon
Quoted 4 lines · On Tue, 19 Apr 2016 15:46:19 +0300 Roger Quadros…

After all the changes we discussed in [1] I was able to test nand/next-with-gpmc-rework and it worked fine.

Quoted 7 lines
Quoted 3 lines

[1] - http://thread.gmane.org/gmane.comp.hardware.netbook.arm.sunxi/22596/focus=22936

I'd be happy to test the branch again after you've incorporated all changes.

Just pushed what's supposed to be my new nand/next into nand/next-with-gpmc-rework, can you test it? I'll push it to nand/next once I have your confirmation that everything is good.

Looks good to me too, merges fine with my for-next and still works for me.

Thanks,

Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#44 lore raw
In reply to Roger Quadros
Quoted 109 lines · On Mon, 18 Apr 2016 17:39:01 +0300 Roger Quadros <[email protected]> wrote:
Quoted 56 lines · Boris Brezillon
Quoted 53 lines · On Mon, 18 Apr 2016 16:48:26 +0300 Roger Quadros <[email protected]> wrote:

Boris,

Quoted 49 lines · Boris Brezillon

Hi Roger,

Quoted 29 lines · On Mon, 18 Apr 2016 15:52:58 +0300 Roger Quadros <[email protected]> wrote:
Quoted 28 lines · Roger Quadros
Quoted 16 lines · Boris Brezillon
Quoted 6 lines · On Fri, 15 Apr 2016 09:19:51 -0700 Tony Lindgren <[email protected]> wrote:
Quoted 5 lines

Or should I just pull this immutable branch in my current nand/next and let you pull the same immutable branch in omap-soc. I mean, would this prevent conflicts when our branches are merged into linux-next, no matter the order.

Quoted 6 lines

Ideally just one or more branches with just minimal changes in them against -rc1. But you may have other dependencies in your NAND tree so that may no longer be doable :) Usually if I merge something that may need to get merged into other branches, I just apply them into a separate branch against -rc1 to start with, then merge that branch in.

Quoted 7 lines

Okay, in this case, that's pretty much what I did from the beginning, except the immutable branch was provided by Roger (based on 4.6-rc1). Thanks for this detailed explanation, I'll try to remember that when I'll need to provide an immutable branch for another subsystem.

Roger, my request remains, could you check/test my conflict resolution (branch nand/next-with-gpmc-rework)?

I couldn't test that branch yet as nand/next is broken on omap platforms (at least on dra7-evm).

Quoted 6 lines
Quoted 4 lines

The commit where it breaks is:
a662ef4 mtd: nand: omap2: use mtd_ooblayout_xxx() helpers where appropriate

I'm trying to figure out what went wrong there. Failure log below.

OK. I was able to fix it when at commit a662ef4 with the below patch.

Thanks for debugging that.

Quoted 3 lines

Looks like we need to read exactly the ECC bytes through the ECC engine and not the entire OOB region.

Hm, it looks like there's a bug somewhere else, because I don't see any reason why the controller wouldn't be able to read the full OOB region.

Quoted 6 lines
Quoted 2 lines

The controller can read the full OOB region but we only want it to read just the ECC bytes because that is the way the ELM ECC engine works.

Ok, I think I got it: the ECC correction is pipelined with data read, and the controller expect to have ECC bytes right after the in-band data, is that correct?

That is correct.

Quoted 22 lines
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
drivers/mtd/nand/omap2.c +0 -0
index e622a1b..46b61d2 100644
@@ -1547,8 +1547,8 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
 	chip->read_buf(mtd, buf, mtd->writesize);
 
Quoted 8 lines

drivers/mtd/nand/omap2.c static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, · line 1550

Quoted 4 lines
drivers/mtd/nand/omap2.c +1 -2
 	/* Read oob bytes */
-	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + chip->ecc.layout->eccpos[0], -1);

The whole point of this series is to get rid of chip->ecc.layout, so we'd rather use the mtd_ooblayout_find_eccregion() instead of chip->ecc.layout->eccpos[0].

Quoted 2 lines

We just need the position of the first ECC byte offset. Is that the most optimal way to get it?

Quoted 9 lines

For the BCH case, it seems that ECC bytes always start at offset BADBLOCK_MARKER_LENGTH, so you can just pass mtd->writesize + BADBLOCK_MARKER_LENGTH.

Let me know if this works, and I'll squash those changes into the faulty commit (I know this implies a rebase + push -f, but IMO that's better than breaking bisectability).

So, the below patch works as well. Please feel free to fold it with your patch.

--
cheers,

(quoted diff) +0 -1
-roger
drivers/mtd/nand/omap2.c +0 -0
index e622a1b..eb85d6b 100644

drivers/mtd/nand/omap2.c static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, · line 1551

Quoted 7 lines
drivers/mtd/nand/omap2.c +2 -2
@@ -1547,8 +1547,8 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
 	chip->read_buf(mtd, buf, mtd->writesize);
 
 	/* Read oob bytes */
-	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + BADBLOCK_MARKER_LENGTH, -1);
+	chip->read_buf(mtd, chip->oob_poi, chip->ecc.total);

Are you sure this patch works? Cause it seems to me that it should be

	chip->read_buf(mtd, chip->oob_poi + BADBLOCK_MARKER_LENGTH,
		       chip->ecc.total);
Signature · 3 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#45 lore raw
Quoted 114 lines · Boris Brezillon
Quoted 111 lines · On Mon, 18 Apr 2016 17:39:01 +0300 Roger Quadros <[email protected]> wrote:
Quoted 56 lines · Boris Brezillon
Quoted 53 lines · On Mon, 18 Apr 2016 16:48:26 +0300 Roger Quadros <[email protected]> wrote:

Boris,

Quoted 49 lines · Boris Brezillon

Hi Roger,

Quoted 29 lines · On Mon, 18 Apr 2016 15:52:58 +0300 Roger Quadros <[email protected]> wrote:
Quoted 28 lines · Roger Quadros
Quoted 16 lines · Boris Brezillon
Quoted 6 lines · On Fri, 15 Apr 2016 09:19:51 -0700 Tony Lindgren <[email protected]> wrote:
Quoted 5 lines

Or should I just pull this immutable branch in my current nand/next and let you pull the same immutable branch in omap-soc. I mean, would this prevent conflicts when our branches are merged into linux-next, no matter the order.

Quoted 6 lines

Ideally just one or more branches with just minimal changes in them against -rc1. But you may have other dependencies in your NAND tree so that may no longer be doable :) Usually if I merge something that may need to get merged into other branches, I just apply them into a separate branch against -rc1 to start with, then merge that branch in.

Quoted 7 lines

Okay, in this case, that's pretty much what I did from the beginning, except the immutable branch was provided by Roger (based on 4.6-rc1). Thanks for this detailed explanation, I'll try to remember that when I'll need to provide an immutable branch for another subsystem.

Roger, my request remains, could you check/test my conflict resolution (branch nand/next-with-gpmc-rework)?

I couldn't test that branch yet as nand/next is broken on omap platforms (at least on dra7-evm).

Quoted 6 lines
Quoted 4 lines

The commit where it breaks is:
a662ef4 mtd: nand: omap2: use mtd_ooblayout_xxx() helpers where appropriate

I'm trying to figure out what went wrong there. Failure log below.

OK. I was able to fix it when at commit a662ef4 with the below patch.

Thanks for debugging that.

Quoted 3 lines

Looks like we need to read exactly the ECC bytes through the ECC engine and not the entire OOB region.

Hm, it looks like there's a bug somewhere else, because I don't see any reason why the controller wouldn't be able to read the full OOB region.

Quoted 6 lines
Quoted 2 lines

The controller can read the full OOB region but we only want it to read just the ECC bytes because that is the way the ELM ECC engine works.

Ok, I think I got it: the ECC correction is pipelined with data read, and the controller expect to have ECC bytes right after the in-band data, is that correct?

That is correct.

Quoted 22 lines
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
drivers/mtd/nand/omap2.c +0 -0
index e622a1b..46b61d2 100644
@@ -1547,8 +1547,8 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
 	chip->read_buf(mtd, buf, mtd->writesize);
 
Quoted 8 lines

drivers/mtd/nand/omap2.c static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, · line 1550

Quoted 4 lines
drivers/mtd/nand/omap2.c +1 -2
 	/* Read oob bytes */
-	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + chip->ecc.layout->eccpos[0], -1);

The whole point of this series is to get rid of chip->ecc.layout, so we'd rather use the mtd_ooblayout_find_eccregion() instead of chip->ecc.layout->eccpos[0].

Quoted 2 lines

We just need the position of the first ECC byte offset. Is that the most optimal way to get it?

Quoted 9 lines

For the BCH case, it seems that ECC bytes always start at offset BADBLOCK_MARKER_LENGTH, so you can just pass mtd->writesize + BADBLOCK_MARKER_LENGTH.

Let me know if this works, and I'll squash those changes into the faulty commit (I know this implies a rebase + push -f, but IMO that's better than breaking bisectability).

So, the below patch works as well. Please feel free to fold it with your patch.

--
cheers,

(quoted diff) +0 -1
-roger
drivers/mtd/nand/omap2.c +0 -0
index e622a1b..eb85d6b 100644
@@ -1547,8 +1547,8 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
 	chip->read_buf(mtd, buf, mtd->writesize);
 
Quoted 7 lines

drivers/mtd/nand/omap2.c static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, · line 1551

Quoted 5 lines
drivers/mtd/nand/omap2.c +2 -2
 	/* Read oob bytes */
-	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + BADBLOCK_MARKER_LENGTH, -1);
+	chip->read_buf(mtd, chip->oob_poi, chip->ecc.total);

Are you sure this patch works? Cause it seems to me that it should be

For my limited test case yes. My test case involves reading an existing ubifs partition and creating a new one and then reading it back using an older kernel.

Quoted 4 lines
	chip->read_buf(mtd, chip->oob_poi + BADBLOCK_MARKER_LENGTH,
		       chip->ecc.total);

You are right. Else we'd have wrong OOB data during reads.

cheers,
-roger

#46 lore raw
Quoted 127 lines · Roger Quadros
Quoted 114 lines · Boris Brezillon
Quoted 111 lines · On Mon, 18 Apr 2016 17:39:01 +0300 Roger Quadros…
Quoted 56 lines · Boris Brezillon
Quoted 53 lines · On Mon, 18 Apr 2016 16:48:26 +0300 Roger Quadros…

Boris,

Quoted 49 lines · Boris Brezillon

Hi Roger,

Quoted 29 lines · On Mon, 18 Apr 2016 15:52:58 +0300 Roger Quadros…
Quoted 28 lines · Roger Quadros
Quoted 16 lines · Boris Brezillon
Quoted 6 lines · On Fri, 15 Apr 2016 09:19:51 -0700 Tony Lindgren…
Quoted 5 lines

Or should I just pull this immutable branch in my current nand/next and let you pull the same immutable branch in omap-soc. I mean, would this prevent conflicts when our branches are merged into linux-next, no matter the order.

Quoted 6 lines

Ideally just one or more branches with just minimal changes in them against -rc1. But you may have other dependencies in your NAND tree so that may no longer be doable :) Usually if I merge something that may need to get merged into other branches, I just apply them into a separate branch against -rc1 to start with, then merge that branch in.

Quoted 7 lines

Okay, in this case, that's pretty much what I did from the beginning, except the immutable branch was provided by Roger (based on 4.6-rc1). Thanks for this detailed explanation, I'll try to remember that when I'll need to provide an immutable branch for another subsystem.

Roger, my request remains, could you check/test my conflict resolution (branch nand/next-with-gpmc-rework)?

I couldn't test that branch yet as nand/next is broken on omap platforms (at least on dra7-evm).

Quoted 6 lines
Quoted 4 lines

The commit where it breaks is:
a662ef4 mtd: nand: omap2: use mtd_ooblayout_xxx() helpers where appropriate

I'm trying to figure out what went wrong there. Failure log below.

OK. I was able to fix it when at commit a662ef4 with the below patch.

Thanks for debugging that.

Quoted 3 lines

Looks like we need to read exactly the ECC bytes through the ECC engine and not the entire OOB region.

Hm, it looks like there's a bug somewhere else, because I don't see any reason why the controller wouldn't be able to read the full OOB region.

Quoted 6 lines
Quoted 2 lines

The controller can read the full OOB region but we only want it to read just the ECC bytes because that is the way the ELM ECC engine works.

Ok, I think I got it: the ECC correction is pipelined with data read, and the controller expect to have ECC bytes right after the in-band data, is that correct?

That is correct.

Quoted 22 lines
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
drivers/mtd/nand/omap2.c +0 -0
index e622a1b..46b61d2 100644
@@ -1547,8 +1547,8 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
 	chip->read_buf(mtd, buf, mtd->writesize);
 
Quoted 8 lines

drivers/mtd/nand/omap2.c static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, · line 1550

Quoted 4 lines
drivers/mtd/nand/omap2.c +1 -2
 	/* Read oob bytes */
-	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + chip->ecc.layout->eccpos[0], -1);

The whole point of this series is to get rid of chip->ecc.layout, so we'd rather use the mtd_ooblayout_find_eccregion() instead of chip->ecc.layout->eccpos[0].

Quoted 2 lines

We just need the position of the first ECC byte offset. Is that the most optimal way to get it?

Quoted 9 lines

For the BCH case, it seems that ECC bytes always start at offset BADBLOCK_MARKER_LENGTH, so you can just pass mtd->writesize + BADBLOCK_MARKER_LENGTH.

Let me know if this works, and I'll squash those changes into the faulty commit (I know this implies a rebase + push -f, but IMO that's better than breaking bisectability).

So, the below patch works as well. Please feel free to fold it with your patch.

--
cheers,

(quoted diff) +0 -1
-roger
drivers/mtd/nand/omap2.c +0 -0
index e622a1b..eb85d6b 100644
@@ -1547,8 +1547,8 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
 	chip->read_buf(mtd, buf, mtd->writesize);
 
Quoted 7 lines

drivers/mtd/nand/omap2.c static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip, · line 1551

Quoted 5 lines
drivers/mtd/nand/omap2.c +2 -2
 	/* Read oob bytes */
-	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + BADBLOCK_MARKER_LENGTH, -1);
+	chip->read_buf(mtd, chip->oob_poi, chip->ecc.total);

Are you sure this patch works? Cause it seems to me that it should be

For my limited test case yes. My test case involves reading an existing ubifs partition and creating a new one and then reading it back using an older kernel.

Quoted 1 line
Quoted 5 lines
Quoted 3 lines
	chip->read_buf(mtd, chip->oob_poi + BADBLOCK_MARKER_LENGTH,
		       chip->ecc.total);

You are right. Else we'd have wrong OOB data during reads.

Strange, but nanddump is showing the correct OOB data with or without this change. I'm puzzled.

--
cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html