I will try to upload some example files of interest..
Goal:
I intend to integrate a user-space accessible character device node for communicating between an OMAP4460 and Xilinx FPGA via NAND protocol. Initial development is on a Pandaboard-ES using the omap-linux 3.13 kernel source.
Kernel Hacks:
you may also want to export some symbols to simplify your integration.
uEnv.txt:
In order to enable the GPMC chip-selects of interest I had to set the CONFIG7_i registers for each per the TRM prior to booting the kernel. I set these registers to 0xf41, 0xf42, 0xf43, 0xf44, 0xf45, 0xf46, 0xf47, 0xf48 respectively. This sets each chip-select to a memory space size of 16MB (the minimum), enables the respective chip-select, and sets the memory space base addresses to 0x1000000 times the value in the least significant 6 bits. So CS0 = 0x1000000, CS1=0x2000000, ...CS7=0x8000000
Devicetree:
Since I am going to eventually have a custom board I hacked omap4.dtsi and omap4-panda-es.dts directly.
First set up your pinmaps in the device tree. I did this too late and feel it is important to do sooner rather than later.
Initially I started with the nand-gpmc configurations I found in Documentation/devicetree/bindings under the kernel build tree. I had to dig deeply into gpmc.c to read the supported devicetree tags and fully customize my nand node(s). I enabled debug in the gpmc.c file and subsidized that with some verbose debug of my own to fully wrap my head around code. I also noticed that sync-read and sync-write were not as flexible as I had hoped. In order to set a particular chip-select to asynchronous I had to remove the tags completely instead of just setting it to "= <0>;"
I had to add my custom devices directly under the OCP node. I flailed attempting to set it in the discrete chip-select nodes and under the gpmc node.
Platform driver:
From here you are into a standard platform driver. Remember to include soc.h and gpmc.h for some helpful macros. On my driver init function I had to re-enable the L3 clock and set the GPMC clock mux which got disabled somewhere in the booting of the kernel.
Manually adding you module at this point will allow you to use devmem2 to actuate the respective chip-selects. You will see the chip-select of interest drop from 1.8volts to almost 0 volts for each bus access. If you are configured for an 8 bit NAND a 32 bit write will strobe the gpmc-nCS0 low 4 times. If you change the nand-bus width in the devicetree and reboot the same write will only strobe the chip-select low twice.
In my driver a probe of each chip-select will cause a chardev to be allocated, registered and fops assigned. Each remaps its respective memory space configured in the CONFIG7 register (ioremap_nocache). Now any read/write activity in the mapped memory space will actuate the correct chip-select and perform the transaction on the BUS.
If you configure a chip-select for synchronous mode you can see the 200 MHz clock on the gpmc-clk pin of J6. You can also confirm the chip-select activity as you write to each memory space.