Skip to contentSkip to conversation

omap2: Assorted GPMC cleanups

PATCH New Ezequiel Garcia 2 participants 8 messages Oct 28, 2013 – Jan 8, 2014

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

cover omap2: Assorted GPMC cleanups

(I'm CCing the MTD list, because GPMC is the memory controller used for NOR, NAND and OneNAND devices).

Hi all,

Just a small patchset containing two small cleanups and a minor fix for the GPMC memory controller. The first two are cleanups and can be considered as preparation work for the fix.

The fix is patch 3/3: "Move legacy GPMC width setting". It makes explicit use of the DT property "gpmc,device-width" and removes the subsequent (and redundant) setting of the GPMC width, based in the NAND bus widht.

Tested in AM335x (using DT) so I'd appreciate if someone can test using a board-file, on a device with NAND flash.

Jon: If you happen to read this, I'd like if you could take a look at patch 1/3, since you were the last to touch that part of the code.

Thanks!

Ezequiel Garcia (3):
omap2: gpmc: Move initialization outside the gpmc_t condition
omap2: gpmc: Introduce gpmc_set_legacy()
omap2: gpmc: Move legacy GPMC width setting

 arch/arm/mach-omap2/gpmc-nand.c | 50 +++++++++++++++++++++++------------------
 1 file changed, 28 insertions(+), 22 deletions(-)
Signature · 1 line
1.8.1.5
#1 lore raw

PATCH 1/3 omap2: gpmc: Move initialization outside the gpmc_t condition

This commit moves a bunch of initialization previously enclosed under a 'if (gpmc_t)' check, to be outside such condition.

These initializations are not related to gpmc_t (timings) in any way so it's nonsense to enclose them under such check.

---
 arch/arm/mach-omap2/gpmc-nand.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)
arch/arm/mach-omap2/gpmc-nand.c +20 -20
index 662c7fd..d66b856 100644
@@ -98,32 +98,32 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
 			dev_err(dev, "Unable to set gpmc timings: %d\n", err);
 			return err;
 		}
+	}
 
-		if (gpmc_nand_data->of_node) {
-			gpmc_read_settings_dt(gpmc_nand_data->of_node, &s);
-		} else {
-			/* Enable RD PIN Monitoring Reg */
-			if (gpmc_nand_data->dev_ready) {
-				s.wait_on_read = true;
-				s.wait_on_write = true;
-			}
+	if (gpmc_nand_data->of_node) {
+		gpmc_read_settings_dt(gpmc_nand_data->of_node, &s);
+	} else {
+		/* Enable RD PIN Monitoring Reg */
+		if (gpmc_nand_data->dev_ready) {
+			s.wait_on_read = true;
+			s.wait_on_write = true;
 		}
+	}
 
-		s.device_nand = true;
+	s.device_nand = true;
 
-		if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
-			s.device_width = GPMC_DEVWIDTH_16BIT;
-		else
-			s.device_width = GPMC_DEVWIDTH_8BIT;
+	if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
+		s.device_width = GPMC_DEVWIDTH_16BIT;
+	else
+		s.device_width = GPMC_DEVWIDTH_8BIT;
 
-		err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s);
-		if (err < 0)
-			goto out_free_cs;
+	err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s);
+	if (err < 0)
+		goto out_free_cs;
 
-		err = gpmc_configure(GPMC_CONFIG_WP, 0);
-		if (err < 0)
-			goto out_free_cs;
-	}
+	err = gpmc_configure(GPMC_CONFIG_WP, 0);
+	if (err < 0)
+		goto out_free_cs;
 
 	gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs);
 
Signature · 1 line
1.8.1.5
#2 lore raw

PATCH 2/3 omap2: gpmc: Introduce gpmc_set_legacy()

In reply to Ezequiel Garcia

Introduce a helper function to complete the setting of some GPMC parameters, only used when the gpmc is probed from a board file. As such, it will go away once the DT conversion is completed.

---
 arch/arm/mach-omap2/gpmc-nand.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
arch/arm/mach-omap2/gpmc-nand.c +14 -8
index d66b856..9dd40e7 100644
@@ -65,6 +65,17 @@ static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
 	return 1;
 }
 
+/* This function will go away once the device-tree convertion is complete */
+static void gpmc_set_legacy(struct omap_nand_platform_data *gpmc_nand_data,
+			    struct gpmc_settings *s)
+{
+	/* Enable RD PIN Monitoring Reg */
+	if (gpmc_nand_data->dev_ready) {
+		s->wait_on_read = true;
+		s->wait_on_write = true;
+	}
+}
+
 int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
 		   struct gpmc_timings *gpmc_t)
 {
@@ -100,15 +111,10 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
 		}
 	}
 
-	if (gpmc_nand_data->of_node) {
+	if (gpmc_nand_data->of_node)
 		gpmc_read_settings_dt(gpmc_nand_data->of_node, &s);
-	} else {
-		/* Enable RD PIN Monitoring Reg */
-		if (gpmc_nand_data->dev_ready) {
-			s.wait_on_read = true;
-			s.wait_on_write = true;
-		}
-	}
+	else
+		gpmc_set_legacy(gpmc_nand_data, &s);
 
 	s.device_nand = true;
 
Signature · 1 line
1.8.1.5
#3 lore raw

PATCH 3/3 omap2: gpmc: Move legacy GPMC width setting

In reply to Ezequiel Garcia

After the introduction of gpmc_set_legacy(), move the GPMC width setting to be done inside it. Currently, in the DT probed case, this is (wrongly) done twice: first at gpmc_read_settings_dt(), and then based in the NAND width setting.
Fix this and use only the value obtained from the DT.

---
 arch/arm/mach-omap2/gpmc-nand.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/gpmc-nand.c +5 -5
index 9dd40e7..174caec 100644
@@ -74,6 +74,11 @@ static void gpmc_set_legacy(struct omap_nand_platform_data *gpmc_nand_data,
 		s->wait_on_read = true;
 		s->wait_on_write = true;
 	}
+
+	if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
+		s->device_width = GPMC_DEVWIDTH_16BIT;
+	else
+		s->device_width = GPMC_DEVWIDTH_8BIT;
 }
 
 int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
@@ -118,11 +123,6 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
 
 	s.device_nand = true;
 
-	if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
-		s.device_width = GPMC_DEVWIDTH_16BIT;
-	else
-		s.device_width = GPMC_DEVWIDTH_8BIT;
-
 	err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s);
 	if (err < 0)
 		goto out_free_cs;
Signature · 1 line
1.8.1.5
#4 lore raw

cover omap2: Assorted GPMC cleanups

In reply to Ezequiel Garcia
Quoted 22 lines · Ezequiel Garcia

(I'm CCing the MTD list, because GPMC is the memory controller used for NOR, NAND and OneNAND devices).

Hi all,

Just a small patchset containing two small cleanups and a minor fix for the GPMC memory controller. The first two are cleanups and can be considered as preparation work for the fix.

The fix is patch 3/3: "Move legacy GPMC width setting". It makes explicit use of the DT property "gpmc,device-width" and removes the subsequent (and redundant) setting of the GPMC width, based in the NAND bus widht.

Tested in AM335x (using DT) so I'd appreciate if someone can test using a board-file, on a device with NAND flash.

Jon: If you happen to read this, I'd like if you could take a look at patch 1/3, since you were the last to touch that part of the code.

Thanks!

Quoted 8 lines

Ezequiel Garcia (3):
omap2: gpmc: Move initialization outside the gpmc_t condition
omap2: gpmc: Introduce gpmc_set_legacy()
omap2: gpmc: Move legacy GPMC width setting

 arch/arm/mach-omap2/gpmc-nand.c | 50 +++++++++++++++++++++++------------------
 1 file changed, 28 insertions(+), 22 deletions(-)

Any comments about this?

Pekon? Maybe you can comment or otherwise ack the patches?

Thanks!

Signature · 3 lines
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
maintainer
#5 lore raw

cover omap2: Assorted GPMC cleanups

In reply to Ezequiel Garcia
Quoted 5 lines · Ezequiel Garcia

(I'm CCing the MTD list, because GPMC is the memory controller used for NOR, NAND and OneNAND devices).

Hi all,

Quoted 8 lines

Just a small patchset containing two small cleanups and a minor fix for the GPMC memory controller. The first two are cleanups and can be considered as preparation work for the fix.

The fix is patch 3/3: "Move legacy GPMC width setting". It makes explicit use of the DT property "gpmc,device-width" and removes the subsequent (and redundant) setting of the GPMC width, based in the NAND bus widht.

Thanks and sorry for the delay. Applying these all into branch omap-for-v3.14/fixes-not-urgent.

Regards,

Tony

Quoted 19 lines

Tested in AM335x (using DT) so I'd appreciate if someone can test using a board-file, on a device with NAND flash.

Jon: If you happen to read this, I'd like if you could take a look at patch 1/3, since you were the last to touch that part of the code.

Thanks!

Ezequiel Garcia (3):
omap2: gpmc: Move initialization outside the gpmc_t condition
omap2: gpmc: Introduce gpmc_set_legacy()
omap2: gpmc: Move legacy GPMC width setting

 arch/arm/mach-omap2/gpmc-nand.c | 50 +++++++++++++++++++++++------------------
 1 file changed, 28 insertions(+), 22 deletions(-)
Signature · 1 line
1.8.1.5
#6 lore raw

cover omap2: Assorted GPMC cleanups

Quoted 10 lines · Tony Lindgren
Quoted 9 lines · Ezequiel Garcia

(I'm CCing the MTD list, because GPMC is the memory controller used for NOR, NAND and OneNAND devices).

Hi all,

Just a small patchset containing two small cleanups and a minor fix for the GPMC memory controller. The first two are cleanups and can be considered as preparation work for the fix.

Quoted 8 lines
Quoted 4 lines

The fix is patch 3/3: "Move legacy GPMC width setting". It makes explicit use of the DT property "gpmc,device-width" and removes the subsequent (and redundant) setting of the GPMC width, based in the NAND bus widht.

Thanks and sorry for the delay. Applying these all into branch omap-for-v3.14/fixes-not-urgent.

No problem. I'll give this a test/review next week.

Do we still need the board-file (legacy) workaround in this patchset? I was actually waiting for you to clean-up completely that, before re-sending the series, without the board-file workaround.

Signature · 7 lines
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#7 lore raw

cover omap2: Assorted GPMC cleanups

Quoted 20 lines · Ezequiel Garcia
Quoted 10 lines · Tony Lindgren
Quoted 9 lines · Ezequiel Garcia

(I'm CCing the MTD list, because GPMC is the memory controller used for NOR, NAND and OneNAND devices).

Hi all,

Just a small patchset containing two small cleanups and a minor fix for the GPMC memory controller. The first two are cleanups and can be considered as preparation work for the fix.

Quoted 8 lines
Quoted 4 lines

The fix is patch 3/3: "Move legacy GPMC width setting". It makes explicit use of the DT property "gpmc,device-width" and removes the subsequent (and redundant) setting of the GPMC width, based in the NAND bus widht.

Thanks and sorry for the delay. Applying these all into branch omap-for-v3.14/fixes-not-urgent.

Quoted 5 lines

No problem. I'll give this a test/review next week.

Do we still need the board-file (legacy) workaround in this patchset? I was actually waiting for you to clean-up completely that, before re-sending the series, without the board-file workaround.

Yes we still need it for a little bit longer.

Regards,

Tony