162306a36Sopenharmony_ciQualcomm External Bus Interface 2 (EBI2) 262306a36Sopenharmony_ci 362306a36Sopenharmony_ciThe EBI2 contains two peripheral blocks: XMEM and LCDC. The XMEM handles any 462306a36Sopenharmony_ciexternal memory (such as NAND or other memory-mapped peripherals) whereas 562306a36Sopenharmony_ciLCDC handles LCD displays. 662306a36Sopenharmony_ci 762306a36Sopenharmony_ciAs it says it connects devices to an external bus interface, meaning address 862306a36Sopenharmony_cilines (up to 9 address lines so can only address 1KiB external memory space), 962306a36Sopenharmony_cidata lines (16 bits), OE (output enable), ADV (address valid, used on some 1062306a36Sopenharmony_ciNOR flash memories), WE (write enable). This on top of 6 different chip selects 1162306a36Sopenharmony_ci(CS0 thru CS5) so that in theory 6 different devices can be connected. 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ciApparently this bus is clocked at 64MHz. It has dedicated pins on the package 1462306a36Sopenharmony_ciand the bus can only come out on these pins, however if some of the pins are 1562306a36Sopenharmony_ciunused they can be left unconnected or remuxed to be used as GPIO or in some 1662306a36Sopenharmony_cicases other orthogonal functions as well. 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ciAlso CS1 and CS2 has -A and -B signals. Why they have that is unclear to me. 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ciThe chip selects have the following memory range assignments. This region of 2162306a36Sopenharmony_cimemory is referred to as "Chip Peripheral SS FPB0" and is 168MB big. 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ciChip Select Physical address base 2462306a36Sopenharmony_ciCS0 GPIO134 0x1a800000-0x1b000000 (8MB) 2562306a36Sopenharmony_ciCS1 GPIO39 (A) / GPIO123 (B) 0x1b000000-0x1b800000 (8MB) 2662306a36Sopenharmony_ciCS2 GPIO40 (A) / GPIO124 (B) 0x1b800000-0x1c000000 (8MB) 2762306a36Sopenharmony_ciCS3 GPIO133 0x1d000000-0x25000000 (128 MB) 2862306a36Sopenharmony_ciCS4 GPIO132 0x1c800000-0x1d000000 (8MB) 2962306a36Sopenharmony_ciCS5 GPIO131 0x1c000000-0x1c800000 (8MB) 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ciThe APQ8060 Qualcomm Application Processor User Guide, 80-N7150-14 Rev. A, 3262306a36Sopenharmony_ciAugust 6, 2012 contains some incomplete documentation of the EBI2. 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ciFIXME: the manual mentions "write precharge cycles" and "precharge cycles". 3562306a36Sopenharmony_ciWe have not been able to figure out which bit fields these correspond to 3662306a36Sopenharmony_ciin the hardware, or what valid values exist. The current hypothesis is that 3762306a36Sopenharmony_cithis is something just used on the FAST chip selects and that the SLOW 3862306a36Sopenharmony_cichip selects are understood fully. There is also a "byte device enable" 3962306a36Sopenharmony_ciflag somewhere for 8bit memories. 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ciFIXME: The chipselects have SLOW and FAST configuration registers. It's a bit 4262306a36Sopenharmony_ciunclear what this means, if they are mutually exclusive or can be used 4362306a36Sopenharmony_citogether, or if some chip selects are hardwired to be FAST and others are SLOW 4462306a36Sopenharmony_ciby design. 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ciThe XMEM registers are totally undocumented but could be partially decoded 4762306a36Sopenharmony_cibecause the Cypress AN49576 Antioch Westbridge apparently has suspiciously 4862306a36Sopenharmony_cisimilar register layout, see: http://www.cypress.com/file/105771/download 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ciRequired properties: 5162306a36Sopenharmony_ci- compatible: should be one of: 5262306a36Sopenharmony_ci "qcom,msm8660-ebi2" 5362306a36Sopenharmony_ci "qcom,apq8060-ebi2" 5462306a36Sopenharmony_ci- #address-cells: should be <2>: the first cell is the chipselect, 5562306a36Sopenharmony_ci the second cell is the offset inside the memory range 5662306a36Sopenharmony_ci- #size-cells: should be <1> 5762306a36Sopenharmony_ci- ranges: should be set to: 5862306a36Sopenharmony_ci ranges = <0 0x0 0x1a800000 0x00800000>, 5962306a36Sopenharmony_ci <1 0x0 0x1b000000 0x00800000>, 6062306a36Sopenharmony_ci <2 0x0 0x1b800000 0x00800000>, 6162306a36Sopenharmony_ci <3 0x0 0x1d000000 0x08000000>, 6262306a36Sopenharmony_ci <4 0x0 0x1c800000 0x00800000>, 6362306a36Sopenharmony_ci <5 0x0 0x1c000000 0x00800000>; 6462306a36Sopenharmony_ci- reg: two ranges of registers: EBI2 config and XMEM config areas 6562306a36Sopenharmony_ci- reg-names: should be "ebi2", "xmem" 6662306a36Sopenharmony_ci- clocks: two clocks, EBI_2X and EBI 6762306a36Sopenharmony_ci- clock-names: should be "ebi2x", "ebi2" 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ciOptional subnodes: 7062306a36Sopenharmony_ci- Nodes inside the EBI2 will be considered device nodes. 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_ciThe following optional properties are properties that can be tagged onto 7362306a36Sopenharmony_ciany device subnode. We are assuming that there can be only ONE device per 7462306a36Sopenharmony_cichipselect subnode, else the properties will become ambiguous. 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ciOptional properties arrays for SLOW chip selects: 7762306a36Sopenharmony_ci- qcom,xmem-recovery-cycles: recovery cycles is the time the memory continues to 7862306a36Sopenharmony_ci drive the data bus after OE is de-asserted, in order to avoid contention on 7962306a36Sopenharmony_ci the data bus. They are inserted when reading one CS and switching to another 8062306a36Sopenharmony_ci CS or read followed by write on the same CS. Valid values 0 thru 15. Minimum 8162306a36Sopenharmony_ci value is actually 1, so a value of 0 will still yield 1 recovery cycle. 8262306a36Sopenharmony_ci- qcom,xmem-write-hold-cycles: write hold cycles, these are extra cycles 8362306a36Sopenharmony_ci inserted after every write minimum 1. The data out is driven from the time 8462306a36Sopenharmony_ci WE is asserted until CS is asserted. With a hold of 1 (value = 0), the CS 8562306a36Sopenharmony_ci stays active for 1 extra cycle etc. Valid values 0 thru 15. 8662306a36Sopenharmony_ci- qcom,xmem-write-delta-cycles: initial latency for write cycles inserted for 8762306a36Sopenharmony_ci the first write to a page or burst memory. Valid values 0 thru 255. 8862306a36Sopenharmony_ci- qcom,xmem-read-delta-cycles: initial latency for read cycles inserted for the 8962306a36Sopenharmony_ci first read to a page or burst memory. Valid values 0 thru 255. 9062306a36Sopenharmony_ci- qcom,xmem-write-wait-cycles: number of wait cycles for every write access, 0=1 9162306a36Sopenharmony_ci cycle. Valid values 0 thru 15. 9262306a36Sopenharmony_ci- qcom,xmem-read-wait-cycles: number of wait cycles for every read access, 0=1 9362306a36Sopenharmony_ci cycle. Valid values 0 thru 15. 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ciOptional properties arrays for FAST chip selects: 9662306a36Sopenharmony_ci- qcom,xmem-address-hold-enable: this is a boolean property stating that we 9762306a36Sopenharmony_ci shall hold the address for an extra cycle to meet hold time requirements 9862306a36Sopenharmony_ci with ADV assertion. 9962306a36Sopenharmony_ci- qcom,xmem-adv-to-oe-recovery-cycles: the number of cycles elapsed before an OE 10062306a36Sopenharmony_ci assertion, with respect to the cycle where ADV (address valid) is asserted. 10162306a36Sopenharmony_ci 2 means 2 cycles between ADV and OE. Valid values 0, 1, 2 or 3. 10262306a36Sopenharmony_ci- qcom,xmem-read-hold-cycles: the length in cycles of the first segment of a 10362306a36Sopenharmony_ci read transfer. For a single read transfer this will be the time from CS 10462306a36Sopenharmony_ci assertion to OE assertion. Valid values 0 thru 15. 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_ciExample: 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ciebi2@1a100000 { 11062306a36Sopenharmony_ci compatible = "qcom,apq8060-ebi2"; 11162306a36Sopenharmony_ci #address-cells = <2>; 11262306a36Sopenharmony_ci #size-cells = <1>; 11362306a36Sopenharmony_ci ranges = <0 0x0 0x1a800000 0x00800000>, 11462306a36Sopenharmony_ci <1 0x0 0x1b000000 0x00800000>, 11562306a36Sopenharmony_ci <2 0x0 0x1b800000 0x00800000>, 11662306a36Sopenharmony_ci <3 0x0 0x1d000000 0x08000000>, 11762306a36Sopenharmony_ci <4 0x0 0x1c800000 0x00800000>, 11862306a36Sopenharmony_ci <5 0x0 0x1c000000 0x00800000>; 11962306a36Sopenharmony_ci reg = <0x1a100000 0x1000>, <0x1a110000 0x1000>; 12062306a36Sopenharmony_ci reg-names = "ebi2", "xmem"; 12162306a36Sopenharmony_ci clocks = <&gcc EBI2_2X_CLK>, <&gcc EBI2_CLK>; 12262306a36Sopenharmony_ci clock-names = "ebi2x", "ebi2"; 12362306a36Sopenharmony_ci /* Make sure to set up the pin control for the EBI2 */ 12462306a36Sopenharmony_ci pinctrl-names = "default"; 12562306a36Sopenharmony_ci pinctrl-0 = <&foo_ebi2_pins>; 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci foo-ebi2@2,0 { 12862306a36Sopenharmony_ci compatible = "foo"; 12962306a36Sopenharmony_ci reg = <2 0x0 0x100>; 13062306a36Sopenharmony_ci (...) 13162306a36Sopenharmony_ci qcom,xmem-recovery-cycles = <0>; 13262306a36Sopenharmony_ci qcom,xmem-write-hold-cycles = <3>; 13362306a36Sopenharmony_ci qcom,xmem-write-delta-cycles = <31>; 13462306a36Sopenharmony_ci qcom,xmem-read-delta-cycles = <28>; 13562306a36Sopenharmony_ci qcom,xmem-write-wait-cycles = <9>; 13662306a36Sopenharmony_ci qcom,xmem-read-wait-cycles = <9>; 13762306a36Sopenharmony_ci }; 13862306a36Sopenharmony_ci}; 139