xref: /openbmc/linux/Documentation/devicetree/bindings/bus/qcom,ebi2.txt (revision 976e3645923bdd2fe7893aae33fd7a21098bfb28)
17e525b7dSLinus WalleijQualcomm External Bus Interface 2 (EBI2)
27e525b7dSLinus Walleij
37e525b7dSLinus WalleijThe EBI2 contains two peripheral blocks: XMEM and LCDC. The XMEM handles any
47e525b7dSLinus Walleijexternal memory (such as NAND or other memory-mapped peripherals) whereas
57e525b7dSLinus WalleijLCDC handles LCD displays.
67e525b7dSLinus Walleij
77e525b7dSLinus WalleijAs it says it connects devices to an external bus interface, meaning address
87e525b7dSLinus Walleijlines (up to 9 address lines so can only address 1KiB external memory space),
97e525b7dSLinus Walleijdata lines (16 bits), OE (output enable), ADV (address valid, used on some
107e525b7dSLinus WalleijNOR flash memories), WE (write enable). This on top of 6 different chip selects
117e525b7dSLinus Walleij(CS0 thru CS5) so that in theory 6 different devices can be connected.
127e525b7dSLinus Walleij
137e525b7dSLinus WalleijApparently this bus is clocked at 64MHz. It has dedicated pins on the package
147e525b7dSLinus Walleijand the bus can only come out on these pins, however if some of the pins are
157e525b7dSLinus Walleijunused they can be left unconnected or remuxed to be used as GPIO or in some
167e525b7dSLinus Walleijcases other orthogonal functions as well.
177e525b7dSLinus Walleij
187e525b7dSLinus WalleijAlso CS1 and CS2 has -A and -B signals. Why they have that is unclear to me.
197e525b7dSLinus Walleij
207e525b7dSLinus WalleijThe chip selects have the following memory range assignments. This region of
217e525b7dSLinus Walleijmemory is referred to as "Chip Peripheral SS FPB0" and is 168MB big.
227e525b7dSLinus Walleij
237e525b7dSLinus WalleijChip Select                     Physical address base
247e525b7dSLinus WalleijCS0 GPIO134                     0x1a800000-0x1b000000 (8MB)
257e525b7dSLinus WalleijCS1 GPIO39 (A) / GPIO123 (B)    0x1b000000-0x1b800000 (8MB)
267e525b7dSLinus WalleijCS2 GPIO40 (A) / GPIO124 (B)    0x1b800000-0x1c000000 (8MB)
277e525b7dSLinus WalleijCS3 GPIO133                     0x1d000000-0x25000000 (128 MB)
287e525b7dSLinus WalleijCS4 GPIO132                     0x1c800000-0x1d000000 (8MB)
297e525b7dSLinus WalleijCS5 GPIO131                     0x1c000000-0x1c800000 (8MB)
307e525b7dSLinus Walleij
317e525b7dSLinus WalleijThe APQ8060 Qualcomm Application Processor User Guide, 80-N7150-14 Rev. A,
327e525b7dSLinus WalleijAugust 6, 2012 contains some incomplete documentation of the EBI2.
337e525b7dSLinus Walleij
347e525b7dSLinus WalleijFIXME: the manual mentions "write precharge cycles" and "precharge cycles".
357e525b7dSLinus WalleijWe have not been able to figure out which bit fields these correspond to
367e525b7dSLinus Walleijin the hardware, or what valid values exist. The current hypothesis is that
377e525b7dSLinus Walleijthis is something just used on the FAST chip selects and that the SLOW
387e525b7dSLinus Walleijchip selects are understood fully. There is also a "byte device enable"
397e525b7dSLinus Walleijflag somewhere for 8bit memories.
407e525b7dSLinus Walleij
417e525b7dSLinus WalleijFIXME: The chipselects have SLOW and FAST configuration registers. It's a bit
427e525b7dSLinus Walleijunclear what this means, if they are mutually exclusive or can be used
437e525b7dSLinus Walleijtogether, or if some chip selects are hardwired to be FAST and others are SLOW
447e525b7dSLinus Walleijby design.
457e525b7dSLinus Walleij
467e525b7dSLinus WalleijThe XMEM registers are totally undocumented but could be partially decoded
477e525b7dSLinus Walleijbecause the Cypress AN49576 Antioch Westbridge apparently has suspiciously
487e525b7dSLinus Walleijsimilar register layout, see: http://www.cypress.com/file/105771/download
497e525b7dSLinus Walleij
507e525b7dSLinus WalleijRequired properties:
517e525b7dSLinus Walleij- compatible: should be one of:
527e525b7dSLinus Walleij  "qcom,msm8660-ebi2"
537e525b7dSLinus Walleij  "qcom,apq8060-ebi2"
542956b338SMasanari Iida- #address-cells: should be <2>: the first cell is the chipselect,
557e525b7dSLinus Walleij  the second cell is the offset inside the memory range
567e525b7dSLinus Walleij- #size-cells: should be <1>
577e525b7dSLinus Walleij- ranges: should be set to:
587e525b7dSLinus Walleij  ranges = <0 0x0 0x1a800000 0x00800000>,
597e525b7dSLinus Walleij           <1 0x0 0x1b000000 0x00800000>,
607e525b7dSLinus Walleij           <2 0x0 0x1b800000 0x00800000>,
617e525b7dSLinus Walleij           <3 0x0 0x1d000000 0x08000000>,
627e525b7dSLinus Walleij           <4 0x0 0x1c800000 0x00800000>,
637e525b7dSLinus Walleij           <5 0x0 0x1c000000 0x00800000>;
647e525b7dSLinus Walleij- reg: two ranges of registers: EBI2 config and XMEM config areas
657e525b7dSLinus Walleij- reg-names: should be "ebi2", "xmem"
667e525b7dSLinus Walleij- clocks: two clocks, EBI_2X and EBI
672956b338SMasanari Iida- clock-names: should be "ebi2x", "ebi2"
687e525b7dSLinus Walleij
697e525b7dSLinus WalleijOptional subnodes:
707e525b7dSLinus Walleij- Nodes inside the EBI2 will be considered device nodes.
717e525b7dSLinus Walleij
727e525b7dSLinus WalleijThe following optional properties are properties that can be tagged onto
737e525b7dSLinus Walleijany device subnode. We are assuming that there can be only ONE device per
74*e65e50ffSColin Ian Kingchipselect subnode, else the properties will become ambiguous.
757e525b7dSLinus Walleij
767e525b7dSLinus WalleijOptional properties arrays for SLOW chip selects:
777e525b7dSLinus Walleij- qcom,xmem-recovery-cycles: recovery cycles is the time the memory continues to
787e525b7dSLinus Walleij  drive the data bus after OE is de-asserted, in order to avoid contention on
797e525b7dSLinus Walleij  the data bus. They are inserted when reading one CS and switching to another
807e525b7dSLinus Walleij  CS or read followed by write on the same CS. Valid values 0 thru 15. Minimum
817e525b7dSLinus Walleij  value is actually 1, so a value of 0 will still yield 1 recovery cycle.
827e525b7dSLinus Walleij- qcom,xmem-write-hold-cycles: write hold cycles, these are extra cycles
837e525b7dSLinus Walleij  inserted after every write minimum 1. The data out is driven from the time
847e525b7dSLinus Walleij  WE is asserted until CS is asserted. With a hold of 1 (value = 0), the CS
857e525b7dSLinus Walleij  stays active for 1 extra cycle etc. Valid values 0 thru 15.
867e525b7dSLinus Walleij- qcom,xmem-write-delta-cycles: initial latency for write cycles inserted for
877e525b7dSLinus Walleij  the first write to a page or burst memory. Valid values 0 thru 255.
887e525b7dSLinus Walleij- qcom,xmem-read-delta-cycles: initial latency for read cycles inserted for the
897e525b7dSLinus Walleij  first read to a page or burst memory. Valid values 0 thru 255.
907e525b7dSLinus Walleij- qcom,xmem-write-wait-cycles: number of wait cycles for every write access, 0=1
917e525b7dSLinus Walleij  cycle. Valid values 0 thru 15.
927e525b7dSLinus Walleij- qcom,xmem-read-wait-cycles: number of wait cycles for every read access, 0=1
937e525b7dSLinus Walleij  cycle. Valid values 0 thru 15.
947e525b7dSLinus Walleij
957e525b7dSLinus WalleijOptional properties arrays for FAST chip selects:
967e525b7dSLinus Walleij- qcom,xmem-address-hold-enable: this is a boolean property stating that we
977e525b7dSLinus Walleij  shall hold the address for an extra cycle to meet hold time requirements
987e525b7dSLinus Walleij  with ADV assertion.
997e525b7dSLinus Walleij- qcom,xmem-adv-to-oe-recovery-cycles: the number of cycles elapsed before an OE
1007e525b7dSLinus Walleij  assertion, with respect to the cycle where ADV (address valid) is asserted.
1017e525b7dSLinus Walleij  2 means 2 cycles between ADV and OE. Valid values 0, 1, 2 or 3.
1027e525b7dSLinus Walleij- qcom,xmem-read-hold-cycles: the length in cycles of the first segment of a
1032956b338SMasanari Iida  read transfer. For a single read transfer this will be the time from CS
1047e525b7dSLinus Walleij  assertion to OE assertion. Valid values 0 thru 15.
1057e525b7dSLinus Walleij
1067e525b7dSLinus Walleij
1077e525b7dSLinus WalleijExample:
1087e525b7dSLinus Walleij
1097e525b7dSLinus Walleijebi2@1a100000 {
1107e525b7dSLinus Walleij	compatible = "qcom,apq8060-ebi2";
1117e525b7dSLinus Walleij	#address-cells = <2>;
1127e525b7dSLinus Walleij	#size-cells = <1>;
1137e525b7dSLinus Walleij	ranges = <0 0x0 0x1a800000 0x00800000>,
1147e525b7dSLinus Walleij		 <1 0x0 0x1b000000 0x00800000>,
1157e525b7dSLinus Walleij		 <2 0x0 0x1b800000 0x00800000>,
1167e525b7dSLinus Walleij		 <3 0x0 0x1d000000 0x08000000>,
1177e525b7dSLinus Walleij		 <4 0x0 0x1c800000 0x00800000>,
1187e525b7dSLinus Walleij		 <5 0x0 0x1c000000 0x00800000>;
1197e525b7dSLinus Walleij	reg = <0x1a100000 0x1000>, <0x1a110000 0x1000>;
1207e525b7dSLinus Walleij	reg-names = "ebi2", "xmem";
1217e525b7dSLinus Walleij	clocks = <&gcc EBI2_2X_CLK>, <&gcc EBI2_CLK>;
1227e525b7dSLinus Walleij	clock-names = "ebi2x", "ebi2";
1237e525b7dSLinus Walleij	/* Make sure to set up the pin control for the EBI2 */
1247e525b7dSLinus Walleij	pinctrl-names = "default";
1257e525b7dSLinus Walleij	pinctrl-0 = <&foo_ebi2_pins>;
1267e525b7dSLinus Walleij
1277e525b7dSLinus Walleij	foo-ebi2@2,0 {
1287e525b7dSLinus Walleij		compatible = "foo";
1297e525b7dSLinus Walleij		reg = <2 0x0 0x100>;
1307e525b7dSLinus Walleij		(...)
1317e525b7dSLinus Walleij		qcom,xmem-recovery-cycles = <0>;
1327e525b7dSLinus Walleij		qcom,xmem-write-hold-cycles = <3>;
1337e525b7dSLinus Walleij		qcom,xmem-write-delta-cycles = <31>;
1347e525b7dSLinus Walleij		qcom,xmem-read-delta-cycles = <28>;
1357e525b7dSLinus Walleij		qcom,xmem-write-wait-cycles = <9>;
1367e525b7dSLinus Walleij		qcom,xmem-read-wait-cycles = <9>;
1377e525b7dSLinus Walleij	};
1387e525b7dSLinus Walleij};
139