Skip to contentSkip to conversation

RFC: OMAP GPMC bindings

PATCH Superseded Daniel Mack 4 participants 19 messages Oct 22, 2012 – Oct 29, 2012

Subsystems (8)

v1 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

cover RFC: OMAP GPMC bindings

This is a series of patches to support GPMC peripherals on OMAP boards.

Depends on Linus' master +
omap-next (branch omap-for-v3.8/cleanup-headers-gpmc)

The only supported peripheral for now is NAND, but other types would be easy to add.

In order to make the gpmc driver the 'hub' for all sub-nodes, I had to add some includes. I'm not particularily happy about the fact that there are mutual references from gpmc.c to gpmc-nand.c now, but that was the easiest way.

I successfully tested these patches on an AM33xx board to make NAND work.

Comments welcome!

Thanks,
Daniel

Daniel Mack (4):
mtd: omap-nand: pass device_node in platform data
ARM: OMAP: gpmc: enable hwecc for AM33xx SoCs
ARM: OMAP: gpmc: don't create devices from initcall on DT
OMAP: mtd: gpmc: add DT bindings for GPMC timings and NAND

 Documentation/devicetree/bindings/bus/gpmc.txt     |  59 +++++++++
 .../devicetree/bindings/mtd/gpmc-nand.txt          |  65 +++++++++
 arch/arm/mach-omap2/gpmc-nand.c                    |   2 +-
 arch/arm/mach-omap2/gpmc.c                         | 146 +++++++++++++++++++++
 drivers/mtd/nand/omap2.c                           |   4 +-
 include/linux/platform_data/mtd-nand-omap2.h       |   2 +
 6 files changed, 276 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/bus/gpmc.txt
 create mode 100644 Documentation/devicetree/bindings/mtd/gpmc-nand.txt
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH 1/4 mtd: omap-nand: pass device_node in platform data

Pass an optional device_node pointer in the platform data, which in turn will be put into a mtd_part_parser_data. This way, code that sets up the platform devices can pass along the node from DT so that the partitions can be parsed.

For non-DT boards, this change has no effect.

---
 drivers/mtd/nand/omap2.c                     | 4 +++-
 include/linux/platform_data/mtd-nand-omap2.h | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/mtd/nand/omap2.c +3 -1
index 3282b15..a733f15 100644
@@ -1331,6 +1331,7 @@ static int __devinit omap_nand_probe(struct platform_device *pdev)
 	dma_cap_mask_t mask;
 	unsigned sig;
 	struct resource			*res;
+	struct mtd_part_parser_data	ppdata = {};
 
 	pdata = pdev->dev.platform_data;
 	if (pdata == NULL) {
@@ -1556,7 +1557,8 @@ static int __devinit omap_nand_probe(struct platform_device *pdev)
 		goto out_release_mem_region;
 	}
 
-	mtd_device_parse_register(&info->mtd, NULL, NULL, pdata->parts,
+	ppdata.of_node = pdata->of_node;
+	mtd_device_parse_register(&info->mtd, NULL, &ppdata, pdata->parts,
 				  pdata->nr_parts);
 
 	platform_set_drvdata(pdev, &info->mtd);
include/linux/platform_data/mtd-nand-omap2.h +2 -0
index 24d32ca..5217d6e 100644
@@ -60,6 +60,8 @@ struct omap_nand_platform_data {
 	int			devsize;
 	enum omap_ecc           ecc_opt;
 	struct gpmc_nand_regs	reg;
+	/* for passing the partitions */
+	struct device_node	*of_node;
 };
 
 #endif
Signature · 1 line
1.7.11.7
#2 lore raw

PATCH 2/4 ARM: OMAP: gpmc: enable hwecc for AM33xx SoCs

In reply to Daniel Mack
---
 arch/arm/mach-omap2/gpmc-nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/gpmc-nand.c +1 -1
index 8607735..c3616c6 100644
@@ -92,7 +92,7 @@ static int omap2_nand_gpmc_retime(
 static bool __init gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
 {
 	/* support only OMAP3 class */
-	if (!cpu_is_omap34xx()) {
+	if (!cpu_is_omap34xx() && !soc_is_am33xx()) {
 		pr_err("BCH ecc is not supported on this CPU\n");
 		return 0;
 	}
Signature · 1 line
1.7.11.7
#3 lore raw

PATCH 3/4 ARM: OMAP: gpmc: don't create devices from initcall on DT

In reply to Daniel Mack

On DT driven boards, the gpmc node will match the driver. Hence, there's no need to do that unconditionally from the initcall.

---
 arch/arm/mach-omap2/gpmc.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/mach-omap2/gpmc.c +7 -0
index 60f1cce..1dcb30c 100644
@@ -844,6 +844,13 @@ static int __init omap_gpmc_init(void)
 	struct platform_device *pdev;
 	char *oh_name = "gpmc";
 
+	/*
+	 * if the board boots up with a populated DT, do not
+	 * manually add the device from this initcall
+	 */
+	if (of_have_populated_dt())
+		return -ENODEV;
+
 	oh = omap_hwmod_lookup(oh_name);
 	if (!oh) {
 		pr_err("Could not look up %s\n", oh_name);
Signature · 1 line
1.7.11.7
#4 lore raw

PATCH 4/4 OMAP: mtd: gpmc: add DT bindings for GPMC timings and NAND

In reply to Daniel Mack

This patch adds basic DT bindings for OMAP GPMC.

The actual peripherals are instanciated from child nodes within the GPMC node, and the only type of device that is currently supported is NAND.

Code was added to parse the generic GPMC timing parameters and some documentation with examples on how to use them.

Successfully tested on an AM33xx board.

---
 Documentation/devicetree/bindings/bus/gpmc.txt     |  59 +++++++++
 .../devicetree/bindings/mtd/gpmc-nand.txt          |  65 ++++++++++
 arch/arm/mach-omap2/gpmc.c                         | 139 +++++++++++++++++++++
 3 files changed, 263 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/gpmc.txt
 create mode 100644 Documentation/devicetree/bindings/mtd/gpmc-nand.txt
Documentation/devicetree/bindings/bus/gpmc.txt new file +59 -0
new file mode 100644
index 0000000..ef1c6e1
@@ -0,0 +1,59 @@
+Device tree bindings for OMAP general purpose memory controllers (GPMC)
+
+The actual devices are instantiated from the child nodes of a GPMC node.
+
+Required properties:
+
+ - compatible: Should be set to "ti,gpmc"
+
+Timing properties for child nodes. All are optional and default to 0.
+
+ - gpmc,sync-clk:	Minimum clock period for synchronous mode, in picoseconds
+
+ Chip-select signal timings corresponding to GPMC_CS_CONFIG2:
+ - gpmc,cs-on:		Assertion time
+ - gpmc,cs-rd-off:	Read deassertion time
+ - gpmc,cs-wr-off:	Write deassertion time
+
+ ADV signal timings corresponding to GPMC_CONFIG3:
+ - gpmc,adv-on:		Assertion time
+ - gpmc,adv-rd-off:	Read deassertion time
+ - gpmc,adv-wr-off:	Write deassertion time
+
+ WE signals timings corresponding to GPMC_CONFIG4:
+ - gpmc,we-on:		Assertion time
+ - gpmc,we-off:		Deassertion time
+
+ OE signals timings corresponding to GPMC_CONFIG4
+ - gpmc,oe-on:		Assertion time
+ - gpmc,oe-off:		Deassertion time
+
+ Access time and cycle time timings corresponding to GPMC_CONFIG5
+ - gpmc,page-burst-access: Multiple access word delay
+ - gpmc,access:		Start-cycle to first data valid delay
+ - gpmc,rd-cycle:	Total read cycle time
+ - gpmc,wr-cycle:	Total write cycle time
+
+The following are only on OMAP3430
+ - gpmc,wr-access
+ - gpmc,wr-data-mux-bus
+
+
+Example for an AM33xx board:
+
+	gpmc: gpmc at 50000000 {
+		compatible = "ti,gpmc";
+		ti,hwmods = "gpmc";
+		reg = <0x50000000 0x1000000>;
+		interrupt-parent = <&intc>;
+		interrupts = <100>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		/* child nodes go here */
+	};
+
+
+
+
+
Documentation/devicetree/bindings/mtd/gpmc-nand.txt new file +65 -0

65 lines not on this page · raw message

arch/arm/mach-omap2/gpmc.c +139 -0

169 lines not on this page · raw message

Signature · 1 line
1.7.11.7
maintainer
#5 lore raw

PATCH 4/4 OMAP: mtd: gpmc: add DT bindings for GPMC timings and NAND

Quoted 9 lines · Daniel Mack

This patch adds basic DT bindings for OMAP GPMC.

The actual peripherals are instanciated from child nodes within the GPMC node, and the only type of device that is currently supported is NAND.

Code was added to parse the generic GPMC timing parameters and some documentation with examples on how to use them.

Successfully tested on an AM33xx board.

That's great, looks good to me. Please repost at least the binding patch with devicetree-discuss and Rob Herring cc:d so hopefully we'll get an ack for the binding.

Regards,

Tony

#6 lore raw

PATCH 4/4 OMAP: mtd: gpmc: add DT bindings for GPMC timings and NAND

Quoted 6 lines · Tony Lindgren
Quoted 5 lines · Daniel Mack

This patch adds basic DT bindings for OMAP GPMC.

The actual peripherals are instanciated from child nodes within the GPMC node, and the only type of device that is currently supported is NAND.

Quoted 8 lines
Quoted 4 lines

Code was added to parse the generic GPMC timing parameters and some documentation with examples on how to use them.

Successfully tested on an AM33xx board.

That's great, looks good to me. Please repost at least the binding patch with devicetree-discuss and Rob Herring cc:d so hopefully we'll get an ack for the binding.

Thanks for the review. I'll wait for feedback from Afzal next week and then repost. Wanted to see first if that goes in the right direction at all before bordering the DT people with binding details :)

Regards,
Daniel

#7 lore raw

PATCH 4/4 OMAP: mtd: gpmc: add DT bindings for GPMC timings and NAND

Hi Daniel,

Quoted 3 lines · Daniel Mack

Thanks for the review. I'll wait for feedback from Afzal next week and then repost. Wanted to see first if that goes in the right direction at all before bordering the DT people with binding details :)

I was thinking of a generic approach, where there won't be any check for peripheral device type.

But going that path would delay achieving DT, may be let's proceed with your approach to start with so that we can have a minimal level of DT support for GPMC and probably we can make it generic later. While adding new properties, it would be better to keep in mind that we need not change these later once gpmc DT is made generic.

Regarding the bindings, there are some generic nand properties like ecc already available, may be that be made use here. Also perhaps memory size (and offset if needed) to be mapped for peripherals can go with reg property of child.

Regards
Afzal

#8 lore raw

PATCH 4/4 OMAP: mtd: gpmc: add DT bindings for GPMC timings and NAND

Hi Afzal,

Quoted 16 lines · Afzal Mohammed
Quoted 3 lines · Daniel Mack

Thanks for the review. I'll wait for feedback from Afzal next week and then repost. Wanted to see first if that goes in the right direction at all before bordering the DT people with binding details :)

I was thinking of a generic approach, where there won't be any check for peripheral device type.

But going that path would delay achieving DT, may be let's proceed with your approach to start with so that we can have a minimal level of DT support for GPMC and probably we can make it generic later. While adding new properties, it would be better to keep in mind that we need not change these later once gpmc DT is made generic.

Quoted 3 lines

Regarding the bindings, there are some generic nand properties like ecc already available, may be that be made use here.

Ah, of_get_nand_ecc_mode() - nice.

Quoted 3 lines

Also perhaps memory size (and offset if needed) to be mapped for peripherals can go with reg property of child.

Which detail are you referring to here? The only "size" property that is effective is the one of the generic GPMC block, and there it's in the "reg"-property.

I'll take the other feedback that I got and quickly do a v2.

Thanks,
Daniel

#9 lore raw

PATCH 4/4 OMAP: mtd: gpmc: add DT bindings for GPMC timings and NAND

Hi Daniel,

Quoted 9 lines · Daniel Mack
Quoted 3 lines · Afzal Mohammed

Also perhaps memory size (and offset if needed) to be mapped for peripherals can go with reg property of child.

Which detail are you referring to here? The only "size" property that is effective is the one of the generic GPMC block, and there it's in the "reg"-property.

I was referring to that of child, now in gpmc_nand_init(), gpmc_cs_request() is being done, later on if we want to make it generic and remove gpmc_nand_init(), additional information that would be required from DT at least is the memory size to be reserved in gpmc address space for the connected peripheral (assuming gpmc_cs_request() would be done by gpmc driver generically later)

What I had in mind was example for external bus in [1], but I had not looked deep into this aspect yet.

Regards
Afzal

[1] http://devicetree.org/Device_Tree_Usage#Memory_Mapped_Devices

#10 lore raw

PATCH 4/4 OMAP: mtd: gpmc: add DT bindings for GPMC timings and NAND

Hi Afzal,

Quoted 19 lines · Afzal Mohammed
Quoted 9 lines · Daniel Mack
Quoted 3 lines · Afzal Mohammed

Also perhaps memory size (and offset if needed) to be mapped for peripherals can go with reg property of child.

Which detail are you referring to here? The only "size" property that is effective is the one of the generic GPMC block, and there it's in the "reg"-property.

I was referring to that of child, now in gpmc_nand_init(), gpmc_cs_request() is being done, later on if we want to make it generic and remove gpmc_nand_init(), additional information that would be required from DT at least is the memory size to be reserved in gpmc address space for the connected peripheral (assuming gpmc_cs_request() would be done by gpmc driver generically later)

Quoted 2 lines

What I had in mind was example for external bus in [1], but I had not looked deep into this aspect yet.

Ok, now I see what you mean.

I would say we can use the "reg" property in child node for CS numbers purely and if we want to get rid of the memory node allocation, we should use a property in the gpmc top-node for this, something like:

	gpmc: gpmc at 50000000 {
		compatible = "ti,gpmc";
		cs-regs = <0x51000000 0x10000000 ...>;
	};

Changing the meaning of the reg property of children from "cs number" to "memory sub-region" later is something I would like to avoid.

Daniel

#11 lore raw

PATCH 4/4 OMAP: mtd: gpmc: add DT bindings for GPMC timings and NAND

Hi Daniel,

Quoted 15 lines · Daniel Mack
Quoted 10 lines · Afzal Mohammed

I was referring to that of child, now in gpmc_nand_init(), gpmc_cs_request() is being done, later on if we want to make it generic and remove gpmc_nand_init(), additional information that would be required from DT at least is the memory size to be reserved in gpmc address space for the connected peripheral (assuming gpmc_cs_request() would be done by gpmc driver generically later)

What I had in mind was example for external bus in [1], but I had not looked deep into this aspect yet.

Ok, now I see what you mean.

Quoted 7 lines

I would say we can use the "reg" property in child node for CS numbers purely and if we want to get rid of the memory node allocation, we should use a property in the gpmc top-node for this, something like:

	gpmc: gpmc at 50000000 {
		compatible = "ti,gpmc";
		cs-regs =<0x51000000 0x10000000 ...>;

I think you meant cs-regs = <0x00000000 ..>

0x0 - 0x1fffffff is gpmc external memory address space, while 0x50000000 to plus 16MB is gpmc configuration address space.

You may refer other gpmc peripheral init's that are NOR type.

Quoted 2 lines

Changing the meaning of the reg property of children from "cs number" to "memory sub-region" later is something I would like to avoid.

Changing any of the properties later is something we have to avoid. Let us get feedback from DT maintainers.

Regards
Afzal

#12 lore raw

PATCH 4/4 OMAP: mtd: gpmc: add DT bindings for GPMC timings and NAND

In reply to Daniel Mack

Hi Daniel,

Quoted 9 lines · Daniel Mack

This patch adds basic DT bindings for OMAP GPMC.

The actual peripherals are instanciated from child nodes within the GPMC node, and the only type of device that is currently supported is NAND.

Code was added to parse the generic GPMC timing parameters and some documentation with examples on how to use them.

Successfully tested on an AM33xx board.

Thanks for sending this and sorry for the delay in responding. Some comments below ...

Quoted 15 lines
---
 Documentation/devicetree/bindings/bus/gpmc.txt     |  59 +++++++++
 .../devicetree/bindings/mtd/gpmc-nand.txt          |  65 ++++++++++
 arch/arm/mach-omap2/gpmc.c                         | 139 +++++++++++++++++++++
 3 files changed, 263 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/gpmc.txt
 create mode 100644 Documentation/devicetree/bindings/mtd/gpmc-nand.txt
Documentation/devicetree/bindings/bus/gpmc.txt new file +0 -0
new file mode 100644
index 0000000..ef1c6e1

Documentation/devicetree/bindings/bus/gpmc.txt line 7

Quoted 7 lines
Documentation/devicetree/bindings/bus/gpmc.txt new file +7 -0
@@ -0,0 +1,59 @@
+Device tree bindings for OMAP general purpose memory controllers (GPMC)
+
+The actual devices are instantiated from the child nodes of a GPMC node.
+
+Required properties:
+
+ - compatible: Should be set to "ti,gpmc"

Is this the only required property? I think that "reg" and "ti,hwmods" are probably also required.

Also given that we are describing the hardware, I am wondering if the number of chip-selects and wait signals should be defined here too. I recall that different devices had different number of wait pins available.

Quoted 59 lines
Documentation/devicetree/bindings/bus/gpmc.txt new file +52 -0
+
+Timing properties for child nodes. All are optional and default to 0.
+
+ - gpmc,sync-clk:	Minimum clock period for synchronous mode, in picoseconds
+
+ Chip-select signal timings corresponding to GPMC_CS_CONFIG2:
+ - gpmc,cs-on:		Assertion time
+ - gpmc,cs-rd-off:	Read deassertion time
+ - gpmc,cs-wr-off:	Write deassertion time
+
+ ADV signal timings corresponding to GPMC_CONFIG3:
+ - gpmc,adv-on:		Assertion time
+ - gpmc,adv-rd-off:	Read deassertion time
+ - gpmc,adv-wr-off:	Write deassertion time
+
+ WE signals timings corresponding to GPMC_CONFIG4:
+ - gpmc,we-on:		Assertion time
+ - gpmc,we-off:		Deassertion time
+
+ OE signals timings corresponding to GPMC_CONFIG4
+ - gpmc,oe-on:		Assertion time
+ - gpmc,oe-off:		Deassertion time
+
+ Access time and cycle time timings corresponding to GPMC_CONFIG5
+ - gpmc,page-burst-access: Multiple access word delay
+ - gpmc,access:		Start-cycle to first data valid delay
+ - gpmc,rd-cycle:	Total read cycle time
+ - gpmc,wr-cycle:	Total write cycle time
+
+The following are only on OMAP3430
+ - gpmc,wr-access
+ - gpmc,wr-data-mux-bus
+
+
+Example for an AM33xx board:
+
+	gpmc: gpmc at 50000000 {
+		compatible = "ti,gpmc";
+		ti,hwmods = "gpmc";
+		reg = <0x50000000 0x1000000>;
+		interrupt-parent = <&intc>;
+		interrupts = <100>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		/* child nodes go here */
+	};
+
+
+
+
+
Documentation/devicetree/bindings/mtd/gpmc-nand.txt new file +1 -0
new file mode 100644
index 0000000..6790fcf
@@ -0,0 +1,65 @@
+Device tree bindings for GPMC connected NANDs

Documentation/devicetree/bindings/mtd/gpmc-nand.txt line 11

Quoted 10 lines
Documentation/devicetree/bindings/mtd/gpmc-nand.txt new file +10 -0
+
+GPMC connected NAND (found on OMAP boards) are represented as child nodes of
+the GPMC controller with a name of "nand".
+
+All timing relevant properties are explained in a separate documents - please
+refer to Documentation/devicetree/bindings/bus/gpmc.txt
+
+Required properties:
+
+ - reg: The CS line the peripheral is connected to

Is this the only required property? I would have thought that bus-width is needed too.

In general, I am wondering if this should be broken into two patches as you are creating the binding for the gpmc and nand here.

Cheers
Jon

#13 lore raw

PATCH 4/4 OMAP: mtd: gpmc: add DT bindings for GPMC timings and NAND

Hi Jon,

many thanks for your time to look at this.

Quoted 17 lines · Jon Hunter

Documentation/devicetree/bindings/bus/gpmc.txt line 7

Quoted 13 lines · Daniel Mack
Documentation/devicetree/bindings/bus/gpmc.txt new file +7 -0
new file mode 100644
index 0000000..ef1c6e1
@@ -0,0 +1,59 @@
+Device tree bindings for OMAP general purpose memory controllers (GPMC)
+
+The actual devices are instantiated from the child nodes of a GPMC node.
+
+Required properties:
+
+ - compatible: Should be set to "ti,gpmc"

Is this the only required property? I think that "reg" and "ti,hwmods" are probably also required.

Well yes, but at least "reg" is commonly omitted as it's part of a more "generic" set of properties. But ok, I can add these.

Quoted 3 lines

Also given that we are describing the hardware, I am wondering if the number of chip-selects and wait signals should be defined here too. I recall that different devices had different number of wait pins available.

Hmm, that number is currently hard-coded in GPMC_CS_NUM. It would take some effort to make that dynamic but I agree that this would be a good thing to have. Afzal?

Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/mtd/gpmc-nand.txt new file +6 -0
new file mode 100644
index 0000000..6790fcf
@@ -0,0 +1,65 @@
+Device tree bindings for GPMC connected NANDs
+
+GPMC connected NAND (found on OMAP boards) are represented as child nodes of
+the GPMC controller with a name of "nand".
+
+All timing relevant properties are explained in a separate documents - please
Quoted 8 lines

Documentation/devicetree/bindings/mtd/gpmc-nand.txt line 11

Quoted 5 lines
Documentation/devicetree/bindings/mtd/gpmc-nand.txt new file +5 -0
+refer to Documentation/devicetree/bindings/bus/gpmc.txt
+
+Required properties:
+
+ - reg: The CS line the peripheral is connected to

Is this the only required property? I would have thought that bus-width is needed too.

I described bus-with in the nand bindings and stated there that it defaults to 8 and the only meaningful other value us 16. I did that because the value is in fact parsed in the NAND code, but I can as well move this around in the documentation.

Quoted 2 lines

In general, I am wondering if this should be broken into two patches as you are creating the binding for the gpmc and nand here.

Yes, I thought so too. The thing is that I wanted to keep documentation and implementation tightly together, and only the generic parser bits in the code doesn't make much sense without any users. Also, the two Documentations reference each other, so I thought having them in one piece could make reviewing easier. But I can of course also split it if that helps.

Thanks,
Daniel

#14 lore raw

PATCH 4/4 OMAP: mtd: gpmc: add DT bindings for GPMC timings and NAND

Quoted 26 lines · Daniel Mack

Hi Jon,

many thanks for your time to look at this.

Quoted 17 lines · Jon Hunter

Documentation/devicetree/bindings/bus/gpmc.txt line 7

Quoted 13 lines · Daniel Mack
Documentation/devicetree/bindings/bus/gpmc.txt new file +7 -0
new file mode 100644
index 0000000..ef1c6e1
@@ -0,0 +1,59 @@
+Device tree bindings for OMAP general purpose memory controllers (GPMC)
+
+The actual devices are instantiated from the child nodes of a GPMC node.
+
+Required properties:
+
+ - compatible: Should be set to "ti,gpmc"

Is this the only required property? I think that "reg" and "ti,hwmods" are probably also required.

Well yes, but at least "reg" is commonly omitted as it's part of a more "generic" set of properties. But ok, I can add these.

Quoted 7 lines
Quoted 3 lines

Also given that we are describing the hardware, I am wondering if the number of chip-selects and wait signals should be defined here too. I recall that different devices had different number of wait pins available.

Hmm, that number is currently hard-coded in GPMC_CS_NUM. It would take some effort to make that dynamic but I agree that this would be a good thing to have. Afzal?

I believe that today all OMAP/AM devices have 8 chip-selects so probably not a big deal. However, given we are moving to DT it would be nice to move away from having such #defines for hardware related items.

Cheers
Jon

#15 lore raw

PATCH 4/4 OMAP: mtd: gpmc: add DT bindings for GPMC timings and NAND

In reply to Daniel Mack

Hi Daniel,

Quoted 3 lines · Daniel Mack

Hmm, that number is currently hard-coded in GPMC_CS_NUM. It would take some effort to make that dynamic but I agree that this would be a good thing to have. Afzal?

It would be good to have (to the best of my knowledge am335x has only 7 pinned out, even though IP has 8)

Regards
Afzal

#16 lore raw

PATCH 4/4 OMAP: mtd: gpmc: add DT bindings for GPMC timings and NAND

In reply to Daniel Mack
Quoted 62 lines · Daniel Mack

This patch adds basic DT bindings for OMAP GPMC.

The actual peripherals are instanciated from child nodes within the GPMC node, and the only type of device that is currently supported is NAND.

Code was added to parse the generic GPMC timing parameters and some documentation with examples on how to use them.

Successfully tested on an AM33xx board.

---
 Documentation/devicetree/bindings/bus/gpmc.txt     |  59 +++++++++
 .../devicetree/bindings/mtd/gpmc-nand.txt          |  65 ++++++++++
 arch/arm/mach-omap2/gpmc.c                         | 139 +++++++++++++++++++++
 3 files changed, 263 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/gpmc.txt
 create mode 100644 Documentation/devicetree/bindings/mtd/gpmc-nand.txt
Documentation/devicetree/bindings/bus/gpmc.txt new file +37 -0
new file mode 100644
index 0000000..ef1c6e1
@@ -0,0 +1,59 @@
+Device tree bindings for OMAP general purpose memory controllers (GPMC)
+
+The actual devices are instantiated from the child nodes of a GPMC node.
+
+Required properties:
+
+ - compatible: Should be set to "ti,gpmc"
+
+Timing properties for child nodes. All are optional and default to 0.
+
+ - gpmc,sync-clk:	Minimum clock period for synchronous mode, in picoseconds
+
+ Chip-select signal timings corresponding to GPMC_CS_CONFIG2:
+ - gpmc,cs-on:		Assertion time
+ - gpmc,cs-rd-off:	Read deassertion time
+ - gpmc,cs-wr-off:	Write deassertion time
+
+ ADV signal timings corresponding to GPMC_CONFIG3:
+ - gpmc,adv-on:		Assertion time
+ - gpmc,adv-rd-off:	Read deassertion time
+ - gpmc,adv-wr-off:	Write deassertion time
+
+ WE signals timings corresponding to GPMC_CONFIG4:
+ - gpmc,we-on:		Assertion time
+ - gpmc,we-off:		Deassertion time
+
+ OE signals timings corresponding to GPMC_CONFIG4
+ - gpmc,oe-on:		Assertion time
+ - gpmc,oe-off:		Deassertion time
+
+ Access time and cycle time timings corresponding to GPMC_CONFIG5
+ - gpmc,page-burst-access: Multiple access word delay
+ - gpmc,access:		Start-cycle to first data valid delay
+ - gpmc,rd-cycle:	Total read cycle time
+ - gpmc,wr-cycle:	Total write cycle time
+
+The following are only on OMAP3430

Documentation/devicetree/bindings/bus/gpmc.txt line 47

Quoted 10 lines
Documentation/devicetree/bindings/bus/gpmc.txt new file +10 -0
+ - gpmc,wr-access
+ - gpmc,wr-data-mux-bus
+
+
+Example for an AM33xx board:
+
+	gpmc: gpmc at 50000000 {
+		compatible = "ti,gpmc";
+		ti,hwmods = "gpmc";
+		reg = <0x50000000 0x1000000>;

Nit-pick, that size is quite large for a register range. I recommend looking at the HWMOD data file (arch/arm/mach-omap2/omap_hwmod_33xx_data.c) and see how much space is allocated for the registers (see structure am33xx_gpmc_addr_space).

Cheers
Jon

#17 lore raw

PATCH 4/4 OMAP: mtd: gpmc: add DT bindings for GPMC timings and NAND

Hi Jon,

Quoted 14 lines · Jon Hunter

Documentation/devicetree/bindings/bus/gpmc.txt line 47

Quoted 6 lines · Daniel Mack
Documentation/devicetree/bindings/bus/gpmc.txt new file +6 -0
+Example for an AM33xx board:
+
+	gpmc: gpmc at 50000000 {
+		compatible = "ti,gpmc";
+		ti,hwmods = "gpmc";
+		reg = <0x50000000 0x1000000>;

Nit-pick, that size is quite large for a register range. I recommend looking at the HWMOD data file (arch/arm/mach-omap2/omap_hwmod_33xx_data.c) and see how much space is allocated for the registers (see structure am33xx_gpmc_addr_space).

Yeah but reserving the entire memory as per the reference manual also prvents other from poking around in the same register space. Is there a scenario in which it would of disadvantage to reserve all that memory?

Daniel

#18 lore raw

PATCH 4/4 OMAP: mtd: gpmc: add DT bindings for GPMC timings and NAND

Quoted 18 lines · Daniel Mack

Hi Jon,

Quoted 14 lines · Jon Hunter

Documentation/devicetree/bindings/bus/gpmc.txt line 47

Quoted 6 lines · Daniel Mack
Documentation/devicetree/bindings/bus/gpmc.txt new file +6 -0
+Example for an AM33xx board:
+
+	gpmc: gpmc at 50000000 {
+		compatible = "ti,gpmc";
+		ti,hwmods = "gpmc";
+		reg = <0x50000000 0x1000000>;

Nit-pick, that size is quite large for a register range. I recommend looking at the HWMOD data file (arch/arm/mach-omap2/omap_hwmod_33xx_data.c) and see how much space is allocated for the registers (see structure am33xx_gpmc_addr_space).

Quoted 3 lines

Yeah but reserving the entire memory as per the reference manual also prvents other from poking around in the same register space. Is there a scenario in which it would of disadvantage to reserve all that memory?

1. It chews up a large chunk of virtual memory space unnecessarily. For devices not using HIGHMEM and wish to use say 512MB of RAM, virtual memory space can be constrained.
2. We don't do that today probably because of #1.

Cheers
Jon