1*4882a593SmuzhiyunQualcomm External Bus Interface 2 (EBI2) 2*4882a593Smuzhiyun 3*4882a593SmuzhiyunThe EBI2 contains two peripheral blocks: XMEM and LCDC. The XMEM handles any 4*4882a593Smuzhiyunexternal memory (such as NAND or other memory-mapped peripherals) whereas 5*4882a593SmuzhiyunLCDC handles LCD displays. 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunAs it says it connects devices to an external bus interface, meaning address 8*4882a593Smuzhiyunlines (up to 9 address lines so can only address 1KiB external memory space), 9*4882a593Smuzhiyundata lines (16 bits), OE (output enable), ADV (address valid, used on some 10*4882a593SmuzhiyunNOR flash memories), WE (write enable). This on top of 6 different chip selects 11*4882a593Smuzhiyun(CS0 thru CS5) so that in theory 6 different devices can be connected. 12*4882a593Smuzhiyun 13*4882a593SmuzhiyunApparently this bus is clocked at 64MHz. It has dedicated pins on the package 14*4882a593Smuzhiyunand the bus can only come out on these pins, however if some of the pins are 15*4882a593Smuzhiyununused they can be left unconnected or remuxed to be used as GPIO or in some 16*4882a593Smuzhiyuncases other orthogonal functions as well. 17*4882a593Smuzhiyun 18*4882a593SmuzhiyunAlso CS1 and CS2 has -A and -B signals. Why they have that is unclear to me. 19*4882a593Smuzhiyun 20*4882a593SmuzhiyunThe chip selects have the following memory range assignments. This region of 21*4882a593Smuzhiyunmemory is referred to as "Chip Peripheral SS FPB0" and is 168MB big. 22*4882a593Smuzhiyun 23*4882a593SmuzhiyunChip Select Physical address base 24*4882a593SmuzhiyunCS0 GPIO134 0x1a800000-0x1b000000 (8MB) 25*4882a593SmuzhiyunCS1 GPIO39 (A) / GPIO123 (B) 0x1b000000-0x1b800000 (8MB) 26*4882a593SmuzhiyunCS2 GPIO40 (A) / GPIO124 (B) 0x1b800000-0x1c000000 (8MB) 27*4882a593SmuzhiyunCS3 GPIO133 0x1d000000-0x25000000 (128 MB) 28*4882a593SmuzhiyunCS4 GPIO132 0x1c800000-0x1d000000 (8MB) 29*4882a593SmuzhiyunCS5 GPIO131 0x1c000000-0x1c800000 (8MB) 30*4882a593Smuzhiyun 31*4882a593SmuzhiyunThe APQ8060 Qualcomm Application Processor User Guide, 80-N7150-14 Rev. A, 32*4882a593SmuzhiyunAugust 6, 2012 contains some incomplete documentation of the EBI2. 33*4882a593Smuzhiyun 34*4882a593SmuzhiyunFIXME: the manual mentions "write precharge cycles" and "precharge cycles". 35*4882a593SmuzhiyunWe have not been able to figure out which bit fields these correspond to 36*4882a593Smuzhiyunin the hardware, or what valid values exist. The current hypothesis is that 37*4882a593Smuzhiyunthis is something just used on the FAST chip selects and that the SLOW 38*4882a593Smuzhiyunchip selects are understood fully. There is also a "byte device enable" 39*4882a593Smuzhiyunflag somewhere for 8bit memories. 40*4882a593Smuzhiyun 41*4882a593SmuzhiyunFIXME: The chipselects have SLOW and FAST configuration registers. It's a bit 42*4882a593Smuzhiyununclear what this means, if they are mutually exclusive or can be used 43*4882a593Smuzhiyuntogether, or if some chip selects are hardwired to be FAST and others are SLOW 44*4882a593Smuzhiyunby design. 45*4882a593Smuzhiyun 46*4882a593SmuzhiyunThe XMEM registers are totally undocumented but could be partially decoded 47*4882a593Smuzhiyunbecause the Cypress AN49576 Antioch Westbridge apparently has suspiciously 48*4882a593Smuzhiyunsimilar register layout, see: http://www.cypress.com/file/105771/download 49*4882a593Smuzhiyun 50*4882a593SmuzhiyunRequired properties: 51*4882a593Smuzhiyun- compatible: should be one of: 52*4882a593Smuzhiyun "qcom,msm8660-ebi2" 53*4882a593Smuzhiyun "qcom,apq8060-ebi2" 54*4882a593Smuzhiyun- #address-cells: should be <2>: the first cell is the chipselect, 55*4882a593Smuzhiyun the second cell is the offset inside the memory range 56*4882a593Smuzhiyun- #size-cells: should be <1> 57*4882a593Smuzhiyun- ranges: should be set to: 58*4882a593Smuzhiyun ranges = <0 0x0 0x1a800000 0x00800000>, 59*4882a593Smuzhiyun <1 0x0 0x1b000000 0x00800000>, 60*4882a593Smuzhiyun <2 0x0 0x1b800000 0x00800000>, 61*4882a593Smuzhiyun <3 0x0 0x1d000000 0x08000000>, 62*4882a593Smuzhiyun <4 0x0 0x1c800000 0x00800000>, 63*4882a593Smuzhiyun <5 0x0 0x1c000000 0x00800000>; 64*4882a593Smuzhiyun- reg: two ranges of registers: EBI2 config and XMEM config areas 65*4882a593Smuzhiyun- reg-names: should be "ebi2", "xmem" 66*4882a593Smuzhiyun- clocks: two clocks, EBI_2X and EBI 67*4882a593Smuzhiyun- clock-names: should be "ebi2x", "ebi2" 68*4882a593Smuzhiyun 69*4882a593SmuzhiyunOptional subnodes: 70*4882a593Smuzhiyun- Nodes inside the EBI2 will be considered device nodes. 71*4882a593Smuzhiyun 72*4882a593SmuzhiyunThe following optional properties are properties that can be tagged onto 73*4882a593Smuzhiyunany device subnode. We are assuming that there can be only ONE device per 74*4882a593Smuzhiyunchipselect subnode, else the properties will become ambiguous. 75*4882a593Smuzhiyun 76*4882a593SmuzhiyunOptional properties arrays for SLOW chip selects: 77*4882a593Smuzhiyun- qcom,xmem-recovery-cycles: recovery cycles is the time the memory continues to 78*4882a593Smuzhiyun drive the data bus after OE is de-asserted, in order to avoid contention on 79*4882a593Smuzhiyun the data bus. They are inserted when reading one CS and switching to another 80*4882a593Smuzhiyun CS or read followed by write on the same CS. Valid values 0 thru 15. Minimum 81*4882a593Smuzhiyun value is actually 1, so a value of 0 will still yield 1 recovery cycle. 82*4882a593Smuzhiyun- qcom,xmem-write-hold-cycles: write hold cycles, these are extra cycles 83*4882a593Smuzhiyun inserted after every write minimum 1. The data out is driven from the time 84*4882a593Smuzhiyun WE is asserted until CS is asserted. With a hold of 1 (value = 0), the CS 85*4882a593Smuzhiyun stays active for 1 extra cycle etc. Valid values 0 thru 15. 86*4882a593Smuzhiyun- qcom,xmem-write-delta-cycles: initial latency for write cycles inserted for 87*4882a593Smuzhiyun the first write to a page or burst memory. Valid values 0 thru 255. 88*4882a593Smuzhiyun- qcom,xmem-read-delta-cycles: initial latency for read cycles inserted for the 89*4882a593Smuzhiyun first read to a page or burst memory. Valid values 0 thru 255. 90*4882a593Smuzhiyun- qcom,xmem-write-wait-cycles: number of wait cycles for every write access, 0=1 91*4882a593Smuzhiyun cycle. Valid values 0 thru 15. 92*4882a593Smuzhiyun- qcom,xmem-read-wait-cycles: number of wait cycles for every read access, 0=1 93*4882a593Smuzhiyun cycle. Valid values 0 thru 15. 94*4882a593Smuzhiyun 95*4882a593SmuzhiyunOptional properties arrays for FAST chip selects: 96*4882a593Smuzhiyun- qcom,xmem-address-hold-enable: this is a boolean property stating that we 97*4882a593Smuzhiyun shall hold the address for an extra cycle to meet hold time requirements 98*4882a593Smuzhiyun with ADV assertion. 99*4882a593Smuzhiyun- qcom,xmem-adv-to-oe-recovery-cycles: the number of cycles elapsed before an OE 100*4882a593Smuzhiyun assertion, with respect to the cycle where ADV (address valid) is asserted. 101*4882a593Smuzhiyun 2 means 2 cycles between ADV and OE. Valid values 0, 1, 2 or 3. 102*4882a593Smuzhiyun- qcom,xmem-read-hold-cycles: the length in cycles of the first segment of a 103*4882a593Smuzhiyun read transfer. For a single read transfer this will be the time from CS 104*4882a593Smuzhiyun assertion to OE assertion. Valid values 0 thru 15. 105*4882a593Smuzhiyun 106*4882a593Smuzhiyun 107*4882a593SmuzhiyunExample: 108*4882a593Smuzhiyun 109*4882a593Smuzhiyunebi2@1a100000 { 110*4882a593Smuzhiyun compatible = "qcom,apq8060-ebi2"; 111*4882a593Smuzhiyun #address-cells = <2>; 112*4882a593Smuzhiyun #size-cells = <1>; 113*4882a593Smuzhiyun ranges = <0 0x0 0x1a800000 0x00800000>, 114*4882a593Smuzhiyun <1 0x0 0x1b000000 0x00800000>, 115*4882a593Smuzhiyun <2 0x0 0x1b800000 0x00800000>, 116*4882a593Smuzhiyun <3 0x0 0x1d000000 0x08000000>, 117*4882a593Smuzhiyun <4 0x0 0x1c800000 0x00800000>, 118*4882a593Smuzhiyun <5 0x0 0x1c000000 0x00800000>; 119*4882a593Smuzhiyun reg = <0x1a100000 0x1000>, <0x1a110000 0x1000>; 120*4882a593Smuzhiyun reg-names = "ebi2", "xmem"; 121*4882a593Smuzhiyun clocks = <&gcc EBI2_2X_CLK>, <&gcc EBI2_CLK>; 122*4882a593Smuzhiyun clock-names = "ebi2x", "ebi2"; 123*4882a593Smuzhiyun /* Make sure to set up the pin control for the EBI2 */ 124*4882a593Smuzhiyun pinctrl-names = "default"; 125*4882a593Smuzhiyun pinctrl-0 = <&foo_ebi2_pins>; 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun foo-ebi2@2,0 { 128*4882a593Smuzhiyun compatible = "foo"; 129*4882a593Smuzhiyun reg = <2 0x0 0x100>; 130*4882a593Smuzhiyun (...) 131*4882a593Smuzhiyun qcom,xmem-recovery-cycles = <0>; 132*4882a593Smuzhiyun qcom,xmem-write-hold-cycles = <3>; 133*4882a593Smuzhiyun qcom,xmem-write-delta-cycles = <31>; 134*4882a593Smuzhiyun qcom,xmem-read-delta-cycles = <28>; 135*4882a593Smuzhiyun qcom,xmem-write-wait-cycles = <9>; 136*4882a593Smuzhiyun qcom,xmem-read-wait-cycles = <9>; 137*4882a593Smuzhiyun }; 138*4882a593Smuzhiyun}; 139