18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
28c2ecf20Sopenharmony_ci%YAML 1.2
38c2ecf20Sopenharmony_ci---
48c2ecf20Sopenharmony_ci$id: http://devicetree.org/schemas/memory-controllers/st,stm32-fmc2-ebi.yaml#
58c2ecf20Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cititle: STMicroelectronics Flexible Memory Controller 2 (FMC2) Bindings
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cidescription: |
108c2ecf20Sopenharmony_ci  The FMC2 functional block makes the interface with: synchronous and
118c2ecf20Sopenharmony_ci  asynchronous static devices (such as PSNOR, PSRAM or other memory-mapped
128c2ecf20Sopenharmony_ci  peripherals) and NAND flash memories.
138c2ecf20Sopenharmony_ci  Its main purposes are:
148c2ecf20Sopenharmony_ci    - to translate AXI transactions into the appropriate external device
158c2ecf20Sopenharmony_ci      protocol
168c2ecf20Sopenharmony_ci    - to meet the access time requirements of the external devices
178c2ecf20Sopenharmony_ci  All external devices share the addresses, data and control signals with the
188c2ecf20Sopenharmony_ci  controller. Each external device is accessed by means of a unique Chip
198c2ecf20Sopenharmony_ci  Select. The FMC2 performs only one access at a time to an external device.
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cimaintainers:
228c2ecf20Sopenharmony_ci  - Christophe Kerello <christophe.kerello@st.com>
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ciproperties:
258c2ecf20Sopenharmony_ci  compatible:
268c2ecf20Sopenharmony_ci    const: st,stm32mp1-fmc2-ebi
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci  reg:
298c2ecf20Sopenharmony_ci    maxItems: 1
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci  clocks:
328c2ecf20Sopenharmony_ci    maxItems: 1
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci  resets:
358c2ecf20Sopenharmony_ci    maxItems: 1
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci  "#address-cells":
388c2ecf20Sopenharmony_ci    const: 2
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci  "#size-cells":
418c2ecf20Sopenharmony_ci    const: 1
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci  ranges:
448c2ecf20Sopenharmony_ci    description: |
458c2ecf20Sopenharmony_ci      Reflects the memory layout with four integer values per bank. Format:
468c2ecf20Sopenharmony_ci      <bank-number> 0 <address of the bank> <size>
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cipatternProperties:
498c2ecf20Sopenharmony_ci  "^.*@[0-4],[a-f0-9]+$":
508c2ecf20Sopenharmony_ci    type: object
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci    properties:
538c2ecf20Sopenharmony_ci      reg:
548c2ecf20Sopenharmony_ci        description: Bank number, base address and size of the device.
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-transaction-type:
578c2ecf20Sopenharmony_ci        description: |
588c2ecf20Sopenharmony_ci          Select one of the transactions type supported
598c2ecf20Sopenharmony_ci          0: Asynchronous mode 1 SRAM/FRAM.
608c2ecf20Sopenharmony_ci          1: Asynchronous mode 1 PSRAM.
618c2ecf20Sopenharmony_ci          2: Asynchronous mode A SRAM/FRAM.
628c2ecf20Sopenharmony_ci          3: Asynchronous mode A PSRAM.
638c2ecf20Sopenharmony_ci          4: Asynchronous mode 2 NOR.
648c2ecf20Sopenharmony_ci          5: Asynchronous mode B NOR.
658c2ecf20Sopenharmony_ci          6: Asynchronous mode C NOR.
668c2ecf20Sopenharmony_ci          7: Asynchronous mode D NOR.
678c2ecf20Sopenharmony_ci          8: Synchronous read synchronous write PSRAM.
688c2ecf20Sopenharmony_ci          9: Synchronous read asynchronous write PSRAM.
698c2ecf20Sopenharmony_ci          10: Synchronous read synchronous write NOR.
708c2ecf20Sopenharmony_ci          11: Synchronous read asynchronous write NOR.
718c2ecf20Sopenharmony_ci        $ref: /schemas/types.yaml#/definitions/uint32
728c2ecf20Sopenharmony_ci        minimum: 0
738c2ecf20Sopenharmony_ci        maximum: 11
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-cclk-enable:
768c2ecf20Sopenharmony_ci        description: Continuous clock enable (first bank must be configured
778c2ecf20Sopenharmony_ci          in synchronous mode). The FMC_CLK is generated continuously
788c2ecf20Sopenharmony_ci          during asynchronous and synchronous access. By default, the
798c2ecf20Sopenharmony_ci          FMC_CLK is only generated during synchronous access.
808c2ecf20Sopenharmony_ci        $ref: /schemas/types.yaml#/definitions/flag
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-mux-enable:
838c2ecf20Sopenharmony_ci        description: Address/Data multiplexed on databus (valid only with
848c2ecf20Sopenharmony_ci          NOR and PSRAM transactions type). By default, Address/Data
858c2ecf20Sopenharmony_ci          are not multiplexed.
868c2ecf20Sopenharmony_ci        $ref: /schemas/types.yaml#/definitions/flag
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-buswidth:
898c2ecf20Sopenharmony_ci        description: Data bus width
908c2ecf20Sopenharmony_ci        $ref: /schemas/types.yaml#/definitions/uint32
918c2ecf20Sopenharmony_ci        enum: [ 8, 16 ]
928c2ecf20Sopenharmony_ci        default: 16
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-waitpol-high:
958c2ecf20Sopenharmony_ci        description: Wait signal polarity (NWAIT signal active high).
968c2ecf20Sopenharmony_ci          By default, NWAIT is active low.
978c2ecf20Sopenharmony_ci        $ref: /schemas/types.yaml#/definitions/flag
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-waitcfg-enable:
1008c2ecf20Sopenharmony_ci        description: The NWAIT signal indicates wheither the data from the
1018c2ecf20Sopenharmony_ci          device are valid or if a wait state must be inserted when accessing
1028c2ecf20Sopenharmony_ci          the device in synchronous mode. By default, the NWAIT signal is
1038c2ecf20Sopenharmony_ci          active one data cycle before wait state.
1048c2ecf20Sopenharmony_ci        $ref: /schemas/types.yaml#/definitions/flag
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-wait-enable:
1078c2ecf20Sopenharmony_ci        description: The NWAIT signal is enabled (its level is taken into
1088c2ecf20Sopenharmony_ci          account after the programmed latency period to insert wait states
1098c2ecf20Sopenharmony_ci          if asserted). By default, the NWAIT signal is disabled.
1108c2ecf20Sopenharmony_ci        $ref: /schemas/types.yaml#/definitions/flag
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-asyncwait-enable:
1138c2ecf20Sopenharmony_ci        description: The NWAIT signal is taken into account during asynchronous
1148c2ecf20Sopenharmony_ci          transactions. By default, the NWAIT signal is not taken into account
1158c2ecf20Sopenharmony_ci          during asynchronous transactions.
1168c2ecf20Sopenharmony_ci        $ref: /schemas/types.yaml#/definitions/flag
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-cpsize:
1198c2ecf20Sopenharmony_ci        description: CRAM page size. The controller splits the burst access
1208c2ecf20Sopenharmony_ci          when the memory page is reached. By default, no burst split when
1218c2ecf20Sopenharmony_ci          crossing page boundary.
1228c2ecf20Sopenharmony_ci        $ref: /schemas/types.yaml#/definitions/uint32
1238c2ecf20Sopenharmony_ci        enum: [ 0, 128, 256, 512, 1024 ]
1248c2ecf20Sopenharmony_ci        default: 0
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-byte-lane-setup-ns:
1278c2ecf20Sopenharmony_ci        description: This property configures the byte lane setup timing
1288c2ecf20Sopenharmony_ci          defined in nanoseconds from NBLx low to Chip Select NEx low.
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-address-setup-ns:
1318c2ecf20Sopenharmony_ci        description: This property defines the duration of the address setup
1328c2ecf20Sopenharmony_ci          phase in nanoseconds used for asynchronous read/write transactions.
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-address-hold-ns:
1358c2ecf20Sopenharmony_ci        description: This property defines the duration of the address hold
1368c2ecf20Sopenharmony_ci          phase in nanoseconds used for asynchronous multiplexed read/write
1378c2ecf20Sopenharmony_ci          transactions.
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-data-setup-ns:
1408c2ecf20Sopenharmony_ci        description: This property defines the duration of the data setup phase
1418c2ecf20Sopenharmony_ci          in nanoseconds used for asynchronous read/write transactions.
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-bus-turnaround-ns:
1448c2ecf20Sopenharmony_ci        description: This property defines the delay in nanoseconds between the
1458c2ecf20Sopenharmony_ci          end of current read/write transaction and the next transaction.
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-data-hold-ns:
1488c2ecf20Sopenharmony_ci        description: This property defines the duration of the data hold phase
1498c2ecf20Sopenharmony_ci          in nanoseconds used for asynchronous read/write transactions.
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-clk-period-ns:
1528c2ecf20Sopenharmony_ci        description: This property defines the FMC_CLK output signal period in
1538c2ecf20Sopenharmony_ci          nanoseconds.
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-data-latency-ns:
1568c2ecf20Sopenharmony_ci        description: This property defines the data latency before reading or
1578c2ecf20Sopenharmony_ci          writing the first data in nanoseconds.
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci      st,fmc2_ebi-cs-write-address-setup-ns:
1608c2ecf20Sopenharmony_ci        description: This property defines the duration of the address setup
1618c2ecf20Sopenharmony_ci          phase in nanoseconds used for asynchronous write transactions.
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-write-address-hold-ns:
1648c2ecf20Sopenharmony_ci        description: This property defines the duration of the address hold
1658c2ecf20Sopenharmony_ci          phase in nanoseconds used for asynchronous multiplexed write
1668c2ecf20Sopenharmony_ci          transactions.
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-write-data-setup-ns:
1698c2ecf20Sopenharmony_ci        description: This property defines the duration of the data setup
1708c2ecf20Sopenharmony_ci          phase in nanoseconds used for asynchronous write transactions.
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-write-bus-turnaround-ns:
1738c2ecf20Sopenharmony_ci        description: This property defines the delay between the end of current
1748c2ecf20Sopenharmony_ci          write transaction and the next transaction in nanoseconds.
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-write-data-hold-ns:
1778c2ecf20Sopenharmony_ci        description: This property defines the duration of the data hold phase
1788c2ecf20Sopenharmony_ci          in nanoseconds used for asynchronous write transactions.
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci      st,fmc2-ebi-cs-max-low-pulse-ns:
1818c2ecf20Sopenharmony_ci        description: This property defines the maximum chip select low pulse
1828c2ecf20Sopenharmony_ci          duration in nanoseconds for synchronous transactions. When this timing
1838c2ecf20Sopenharmony_ci          reaches 0, the controller splits the current access, toggles NE to
1848c2ecf20Sopenharmony_ci          allow device refresh and restarts a new access.
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci    required:
1878c2ecf20Sopenharmony_ci      - reg
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_cirequired:
1908c2ecf20Sopenharmony_ci  - "#address-cells"
1918c2ecf20Sopenharmony_ci  - "#size-cells"
1928c2ecf20Sopenharmony_ci  - compatible
1938c2ecf20Sopenharmony_ci  - reg
1948c2ecf20Sopenharmony_ci  - clocks
1958c2ecf20Sopenharmony_ci  - ranges
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ciadditionalProperties: false
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ciexamples:
2008c2ecf20Sopenharmony_ci  - |
2018c2ecf20Sopenharmony_ci    #include <dt-bindings/interrupt-controller/arm-gic.h>
2028c2ecf20Sopenharmony_ci    #include <dt-bindings/clock/stm32mp1-clks.h>
2038c2ecf20Sopenharmony_ci    #include <dt-bindings/reset/stm32mp1-resets.h>
2048c2ecf20Sopenharmony_ci    memory-controller@58002000 {
2058c2ecf20Sopenharmony_ci      #address-cells = <2>;
2068c2ecf20Sopenharmony_ci      #size-cells = <1>;
2078c2ecf20Sopenharmony_ci      compatible = "st,stm32mp1-fmc2-ebi";
2088c2ecf20Sopenharmony_ci      reg = <0x58002000 0x1000>;
2098c2ecf20Sopenharmony_ci      clocks = <&rcc FMC_K>;
2108c2ecf20Sopenharmony_ci      resets = <&rcc FMC_R>;
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci      ranges = <0 0 0x60000000 0x04000000>, /* EBI CS 1 */
2138c2ecf20Sopenharmony_ci               <1 0 0x64000000 0x04000000>, /* EBI CS 2 */
2148c2ecf20Sopenharmony_ci               <2 0 0x68000000 0x04000000>, /* EBI CS 3 */
2158c2ecf20Sopenharmony_ci               <3 0 0x6c000000 0x04000000>, /* EBI CS 4 */
2168c2ecf20Sopenharmony_ci               <4 0 0x80000000 0x10000000>; /* NAND */
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci      psram@0,0 {
2198c2ecf20Sopenharmony_ci        compatible = "mtd-ram";
2208c2ecf20Sopenharmony_ci        reg = <0 0x00000000 0x100000>;
2218c2ecf20Sopenharmony_ci        bank-width = <2>;
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci        st,fmc2-ebi-cs-transaction-type = <1>;
2248c2ecf20Sopenharmony_ci        st,fmc2-ebi-cs-address-setup-ns = <60>;
2258c2ecf20Sopenharmony_ci        st,fmc2-ebi-cs-data-setup-ns = <30>;
2268c2ecf20Sopenharmony_ci        st,fmc2-ebi-cs-bus-turnaround-ns = <5>;
2278c2ecf20Sopenharmony_ci      };
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci      nand-controller@4,0 {
2308c2ecf20Sopenharmony_ci        #address-cells = <1>;
2318c2ecf20Sopenharmony_ci        #size-cells = <0>;
2328c2ecf20Sopenharmony_ci        compatible = "st,stm32mp1-fmc2-nfc";
2338c2ecf20Sopenharmony_ci        reg = <4 0x00000000 0x1000>,
2348c2ecf20Sopenharmony_ci              <4 0x08010000 0x1000>,
2358c2ecf20Sopenharmony_ci              <4 0x08020000 0x1000>,
2368c2ecf20Sopenharmony_ci              <4 0x01000000 0x1000>,
2378c2ecf20Sopenharmony_ci              <4 0x09010000 0x1000>,
2388c2ecf20Sopenharmony_ci              <4 0x09020000 0x1000>;
2398c2ecf20Sopenharmony_ci        interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
2408c2ecf20Sopenharmony_ci        dmas = <&mdma1 20 0x2 0x12000a02 0x0 0x0>,
2418c2ecf20Sopenharmony_ci               <&mdma1 20 0x2 0x12000a08 0x0 0x0>,
2428c2ecf20Sopenharmony_ci               <&mdma1 21 0x2 0x12000a0a 0x0 0x0>;
2438c2ecf20Sopenharmony_ci        dma-names = "tx", "rx", "ecc";
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci        nand@0 {
2468c2ecf20Sopenharmony_ci          reg = <0>;
2478c2ecf20Sopenharmony_ci          nand-on-flash-bbt;
2488c2ecf20Sopenharmony_ci          #address-cells = <1>;
2498c2ecf20Sopenharmony_ci          #size-cells = <1>;
2508c2ecf20Sopenharmony_ci        };
2518c2ecf20Sopenharmony_ci      };
2528c2ecf20Sopenharmony_ci    };
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci...
255