1*f7272daeSRayyan Ansari# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2*f7272daeSRayyan Ansari%YAML 1.2 3*f7272daeSRayyan Ansari--- 4*f7272daeSRayyan Ansari$id: http://devicetree.org/schemas/bus/qcom,ebi2.yaml# 5*f7272daeSRayyan Ansari$schema: http://devicetree.org/meta-schemas/core.yaml# 6*f7272daeSRayyan Ansari 7*f7272daeSRayyan Ansarititle: Qualcomm External Bus Interface 2 (EBI2) 8*f7272daeSRayyan Ansari 9*f7272daeSRayyan Ansaridescription: | 10*f7272daeSRayyan Ansari The EBI2 contains two peripheral blocks: XMEM and LCDC. The XMEM handles any 11*f7272daeSRayyan Ansari external memory (such as NAND or other memory-mapped peripherals) whereas 12*f7272daeSRayyan Ansari LCDC handles LCD displays. 13*f7272daeSRayyan Ansari 14*f7272daeSRayyan Ansari As it says it connects devices to an external bus interface, meaning address 15*f7272daeSRayyan Ansari lines (up to 9 address lines so can only address 1KiB external memory space), 16*f7272daeSRayyan Ansari data lines (16 bits), OE (output enable), ADV (address valid, used on some 17*f7272daeSRayyan Ansari NOR flash memories), WE (write enable). This on top of 6 different chip selects 18*f7272daeSRayyan Ansari (CS0 thru CS5) so that in theory 6 different devices can be connected. 19*f7272daeSRayyan Ansari 20*f7272daeSRayyan Ansari Apparently this bus is clocked at 64MHz. It has dedicated pins on the package 21*f7272daeSRayyan Ansari and the bus can only come out on these pins, however if some of the pins are 22*f7272daeSRayyan Ansari unused they can be left unconnected or remuxed to be used as GPIO or in some 23*f7272daeSRayyan Ansari cases other orthogonal functions as well. 24*f7272daeSRayyan Ansari 25*f7272daeSRayyan Ansari Also CS1 and CS2 has -A and -B signals. Why they have that is unclear to me. 26*f7272daeSRayyan Ansari 27*f7272daeSRayyan Ansari The chip selects have the following memory range assignments. This region of 28*f7272daeSRayyan Ansari memory is referred to as "Chip Peripheral SS FPB0" and is 168MB big. 29*f7272daeSRayyan Ansari 30*f7272daeSRayyan Ansari Chip Select Physical address base 31*f7272daeSRayyan Ansari CS0 GPIO134 0x1a800000-0x1b000000 (8MB) 32*f7272daeSRayyan Ansari CS1 GPIO39 (A) / GPIO123 (B) 0x1b000000-0x1b800000 (8MB) 33*f7272daeSRayyan Ansari CS2 GPIO40 (A) / GPIO124 (B) 0x1b800000-0x1c000000 (8MB) 34*f7272daeSRayyan Ansari CS3 GPIO133 0x1d000000-0x25000000 (128 MB) 35*f7272daeSRayyan Ansari CS4 GPIO132 0x1c800000-0x1d000000 (8MB) 36*f7272daeSRayyan Ansari CS5 GPIO131 0x1c000000-0x1c800000 (8MB) 37*f7272daeSRayyan Ansari 38*f7272daeSRayyan Ansari The APQ8060 Qualcomm Application Processor User Guide, 80-N7150-14 Rev. A, 39*f7272daeSRayyan Ansari August 6, 2012 contains some incomplete documentation of the EBI2. 40*f7272daeSRayyan Ansari 41*f7272daeSRayyan Ansari FIXME: the manual mentions "write precharge cycles" and "precharge cycles". 42*f7272daeSRayyan Ansari We have not been able to figure out which bit fields these correspond to 43*f7272daeSRayyan Ansari in the hardware, or what valid values exist. The current hypothesis is that 44*f7272daeSRayyan Ansari this is something just used on the FAST chip selects and that the SLOW 45*f7272daeSRayyan Ansari chip selects are understood fully. There is also a "byte device enable" 46*f7272daeSRayyan Ansari flag somewhere for 8bit memories. 47*f7272daeSRayyan Ansari 48*f7272daeSRayyan Ansari FIXME: The chipselects have SLOW and FAST configuration registers. It's a bit 49*f7272daeSRayyan Ansari unclear what this means, if they are mutually exclusive or can be used 50*f7272daeSRayyan Ansari together, or if some chip selects are hardwired to be FAST and others are SLOW 51*f7272daeSRayyan Ansari by design. 52*f7272daeSRayyan Ansari 53*f7272daeSRayyan Ansari The XMEM registers are totally undocumented but could be partially decoded 54*f7272daeSRayyan Ansari because the Cypress AN49576 Antioch Westbridge apparently has suspiciously 55*f7272daeSRayyan Ansari similar register layout, see: http://www.cypress.com/file/105771/download 56*f7272daeSRayyan Ansari 57*f7272daeSRayyan Ansarimaintainers: 58*f7272daeSRayyan Ansari - Bjorn Andersson <andersson@kernel.org> 59*f7272daeSRayyan Ansari 60*f7272daeSRayyan Ansariproperties: 61*f7272daeSRayyan Ansari compatible: 62*f7272daeSRayyan Ansari enum: 63*f7272daeSRayyan Ansari - qcom,apq8060-ebi2 64*f7272daeSRayyan Ansari - qcom,msm8660-ebi2 65*f7272daeSRayyan Ansari 66*f7272daeSRayyan Ansari reg: 67*f7272daeSRayyan Ansari items: 68*f7272daeSRayyan Ansari - description: EBI2 config region 69*f7272daeSRayyan Ansari - description: XMEM config region 70*f7272daeSRayyan Ansari 71*f7272daeSRayyan Ansari reg-names: 72*f7272daeSRayyan Ansari items: 73*f7272daeSRayyan Ansari - const: ebi2 74*f7272daeSRayyan Ansari - const: xmem 75*f7272daeSRayyan Ansari 76*f7272daeSRayyan Ansari ranges: true 77*f7272daeSRayyan Ansari 78*f7272daeSRayyan Ansari clocks: 79*f7272daeSRayyan Ansari items: 80*f7272daeSRayyan Ansari - description: EBI_2X clock 81*f7272daeSRayyan Ansari - description: EBI clock 82*f7272daeSRayyan Ansari 83*f7272daeSRayyan Ansari clock-names: 84*f7272daeSRayyan Ansari items: 85*f7272daeSRayyan Ansari - const: ebi2x 86*f7272daeSRayyan Ansari - const: ebi2 87*f7272daeSRayyan Ansari 88*f7272daeSRayyan Ansari '#address-cells': 89*f7272daeSRayyan Ansari const: 2 90*f7272daeSRayyan Ansari 91*f7272daeSRayyan Ansari '#size-cells': 92*f7272daeSRayyan Ansari const: 1 93*f7272daeSRayyan Ansari 94*f7272daeSRayyan Ansarirequired: 95*f7272daeSRayyan Ansari - compatible 96*f7272daeSRayyan Ansari - reg 97*f7272daeSRayyan Ansari - reg-names 98*f7272daeSRayyan Ansari - ranges 99*f7272daeSRayyan Ansari - clocks 100*f7272daeSRayyan Ansari - clock-names 101*f7272daeSRayyan Ansari - '#address-cells' 102*f7272daeSRayyan Ansari - '#size-cells' 103*f7272daeSRayyan Ansari 104*f7272daeSRayyan AnsaripatternProperties: 105*f7272daeSRayyan Ansari "^.*@[0-5],[0-9a-f]+$": 106*f7272daeSRayyan Ansari type: object 107*f7272daeSRayyan Ansari additionalProperties: true 108*f7272daeSRayyan Ansari properties: 109*f7272daeSRayyan Ansari reg: 110*f7272daeSRayyan Ansari maxItems: 1 111*f7272daeSRayyan Ansari 112*f7272daeSRayyan Ansari # SLOW chip selects 113*f7272daeSRayyan Ansari qcom,xmem-recovery-cycles: 114*f7272daeSRayyan Ansari $ref: /schemas/types.yaml#/definitions/uint32 115*f7272daeSRayyan Ansari description: > 116*f7272daeSRayyan Ansari The time the memory continues to drive the data bus after OE 117*f7272daeSRayyan Ansari is de-asserted, in order to avoid contention on the data bus. 118*f7272daeSRayyan Ansari They are inserted when reading one CS and switching to another 119*f7272daeSRayyan Ansari CS or read followed by write on the same CS. Minimum value is 120*f7272daeSRayyan Ansari actually 1, so a value of 0 will still yield 1 recovery cycle. 121*f7272daeSRayyan Ansari minimum: 0 122*f7272daeSRayyan Ansari maximum: 15 123*f7272daeSRayyan Ansari 124*f7272daeSRayyan Ansari qcom,xmem-write-hold-cycles: 125*f7272daeSRayyan Ansari $ref: /schemas/types.yaml#/definitions/uint32 126*f7272daeSRayyan Ansari description: > 127*f7272daeSRayyan Ansari The extra cycles inserted after every write minimum 1. The 128*f7272daeSRayyan Ansari data out is driven from the time WE is asserted until CS is 129*f7272daeSRayyan Ansari asserted. With a hold of 1 (value = 0), the CS stays active 130*f7272daeSRayyan Ansari for 1 extra cycle, etc. 131*f7272daeSRayyan Ansari minimum: 0 132*f7272daeSRayyan Ansari maximum: 15 133*f7272daeSRayyan Ansari 134*f7272daeSRayyan Ansari qcom,xmem-write-delta-cycles: 135*f7272daeSRayyan Ansari $ref: /schemas/types.yaml#/definitions/uint32 136*f7272daeSRayyan Ansari description: > 137*f7272daeSRayyan Ansari The initial latency for write cycles inserted for the first 138*f7272daeSRayyan Ansari write to a page or burst memory. 139*f7272daeSRayyan Ansari minimum: 0 140*f7272daeSRayyan Ansari maximum: 255 141*f7272daeSRayyan Ansari 142*f7272daeSRayyan Ansari qcom,xmem-read-delta-cycles: 143*f7272daeSRayyan Ansari $ref: /schemas/types.yaml#/definitions/uint32 144*f7272daeSRayyan Ansari description: > 145*f7272daeSRayyan Ansari The initial latency for read cycles inserted for the first 146*f7272daeSRayyan Ansari read to a page or burst memory. 147*f7272daeSRayyan Ansari minimum: 0 148*f7272daeSRayyan Ansari maximum: 255 149*f7272daeSRayyan Ansari 150*f7272daeSRayyan Ansari qcom,xmem-write-wait-cycles: 151*f7272daeSRayyan Ansari $ref: /schemas/types.yaml#/definitions/uint32 152*f7272daeSRayyan Ansari description: > 153*f7272daeSRayyan Ansari The number of wait cycles for every write access. 154*f7272daeSRayyan Ansari minimum: 0 155*f7272daeSRayyan Ansari maximum: 15 156*f7272daeSRayyan Ansari 157*f7272daeSRayyan Ansari qcom,xmem-read-wait-cycles: 158*f7272daeSRayyan Ansari $ref: /schemas/types.yaml#/definitions/uint32 159*f7272daeSRayyan Ansari description: > 160*f7272daeSRayyan Ansari The number of wait cycles for every read access. 161*f7272daeSRayyan Ansari minimum: 0 162*f7272daeSRayyan Ansari maximum: 15 163*f7272daeSRayyan Ansari 164*f7272daeSRayyan Ansari 165*f7272daeSRayyan Ansari # FAST chip selects 166*f7272daeSRayyan Ansari qcom,xmem-address-hold-enable: 167*f7272daeSRayyan Ansari $ref: /schemas/types.yaml#/definitions/uint32 168*f7272daeSRayyan Ansari description: > 169*f7272daeSRayyan Ansari Holds the address for an extra cycle to meet hold time 170*f7272daeSRayyan Ansari requirements with ADV assertion, when set to 1. 171*f7272daeSRayyan Ansari enum: [ 0, 1 ] 172*f7272daeSRayyan Ansari 173*f7272daeSRayyan Ansari qcom,xmem-adv-to-oe-recovery-cycles: 174*f7272daeSRayyan Ansari $ref: /schemas/types.yaml#/definitions/uint32 175*f7272daeSRayyan Ansari description: > 176*f7272daeSRayyan Ansari The number of cycles elapsed before an OE assertion, with 177*f7272daeSRayyan Ansari respect to the cycle where ADV (address valid) is asserted. 178*f7272daeSRayyan Ansari minimum: 0 179*f7272daeSRayyan Ansari maximum: 3 180*f7272daeSRayyan Ansari 181*f7272daeSRayyan Ansari qcom,xmem-read-hold-cycles: 182*f7272daeSRayyan Ansari $ref: /schemas/types.yaml#/definitions/uint32 183*f7272daeSRayyan Ansari description: > 184*f7272daeSRayyan Ansari The length in cycles of the first segment of a read transfer. 185*f7272daeSRayyan Ansari For a single read transfer this will be the time from CS 186*f7272daeSRayyan Ansari assertion to OE assertion. 187*f7272daeSRayyan Ansari minimum: 0 188*f7272daeSRayyan Ansari maximum: 15 189*f7272daeSRayyan Ansari 190*f7272daeSRayyan Ansari required: 191*f7272daeSRayyan Ansari - reg 192*f7272daeSRayyan Ansari 193*f7272daeSRayyan AnsariadditionalProperties: false 194*f7272daeSRayyan Ansari 195*f7272daeSRayyan Ansariexamples: 196*f7272daeSRayyan Ansari - | 197*f7272daeSRayyan Ansari #include <dt-bindings/clock/qcom,gcc-msm8660.h> 198*f7272daeSRayyan Ansari #include <dt-bindings/interrupt-controller/irq.h> 199*f7272daeSRayyan Ansari #include <dt-bindings/gpio/gpio.h> 200*f7272daeSRayyan Ansari 201*f7272daeSRayyan Ansari external-bus@1a100000 { 202*f7272daeSRayyan Ansari compatible = "qcom,msm8660-ebi2"; 203*f7272daeSRayyan Ansari reg = <0x1a100000 0x1000>, <0x1a110000 0x1000>; 204*f7272daeSRayyan Ansari reg-names = "ebi2", "xmem"; 205*f7272daeSRayyan Ansari ranges = <0 0x0 0x1a800000 0x00800000>, 206*f7272daeSRayyan Ansari <1 0x0 0x1b000000 0x00800000>, 207*f7272daeSRayyan Ansari <2 0x0 0x1b800000 0x00800000>, 208*f7272daeSRayyan Ansari <3 0x0 0x1d000000 0x08000000>, 209*f7272daeSRayyan Ansari <4 0x0 0x1c800000 0x00800000>, 210*f7272daeSRayyan Ansari <5 0x0 0x1c000000 0x00800000>; 211*f7272daeSRayyan Ansari 212*f7272daeSRayyan Ansari clocks = <&gcc EBI2_2X_CLK>, <&gcc EBI2_CLK>; 213*f7272daeSRayyan Ansari clock-names = "ebi2x", "ebi2"; 214*f7272daeSRayyan Ansari 215*f7272daeSRayyan Ansari #address-cells = <2>; 216*f7272daeSRayyan Ansari #size-cells = <1>; 217*f7272daeSRayyan Ansari 218*f7272daeSRayyan Ansari ethernet@2,0 { 219*f7272daeSRayyan Ansari compatible = "smsc,lan9221", "smsc,lan9115"; 220*f7272daeSRayyan Ansari reg = <2 0x0 0x100>; 221*f7272daeSRayyan Ansari 222*f7272daeSRayyan Ansari interrupts-extended = <&pm8058_gpio 7 IRQ_TYPE_EDGE_FALLING>, 223*f7272daeSRayyan Ansari <&tlmm 29 IRQ_TYPE_EDGE_RISING>; 224*f7272daeSRayyan Ansari reset-gpios = <&tlmm 30 GPIO_ACTIVE_LOW>; 225*f7272daeSRayyan Ansari 226*f7272daeSRayyan Ansari phy-mode = "mii"; 227*f7272daeSRayyan Ansari reg-io-width = <2>; 228*f7272daeSRayyan Ansari smsc,force-external-phy; 229*f7272daeSRayyan Ansari smsc,irq-push-pull; 230*f7272daeSRayyan Ansari 231*f7272daeSRayyan Ansari /* SLOW chipselect config */ 232*f7272daeSRayyan Ansari qcom,xmem-recovery-cycles = <0>; 233*f7272daeSRayyan Ansari qcom,xmem-write-hold-cycles = <3>; 234*f7272daeSRayyan Ansari qcom,xmem-write-delta-cycles = <31>; 235*f7272daeSRayyan Ansari qcom,xmem-read-delta-cycles = <28>; 236*f7272daeSRayyan Ansari qcom,xmem-write-wait-cycles = <9>; 237*f7272daeSRayyan Ansari qcom,xmem-read-wait-cycles = <9>; 238*f7272daeSRayyan Ansari }; 239*f7272daeSRayyan Ansari }; 240