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