18c2ecf20Sopenharmony_ci* Freescale Management Complex
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciThe Freescale Management Complex (fsl-mc) is a hardware resource
48c2ecf20Sopenharmony_cimanager that manages specialized hardware objects used in
58c2ecf20Sopenharmony_cinetwork-oriented packet processing applications. After the fsl-mc
68c2ecf20Sopenharmony_ciblock is enabled, pools of hardware resources are available, such as
78c2ecf20Sopenharmony_ciqueues, buffer pools, I/O interfaces. These resources are building
88c2ecf20Sopenharmony_ciblocks that can be used to create functional hardware objects/devices
98c2ecf20Sopenharmony_cisuch as network interfaces, crypto accelerator instances, L2 switches,
108c2ecf20Sopenharmony_cietc.
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciFor an overview of the DPAA2 architecture and fsl-mc bus see:
138c2ecf20Sopenharmony_ciDocumentation/networking/device_drivers/ethernet/freescale/dpaa2/overview.rst
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciAs described in the above overview, all DPAA2 objects in a DPRC share the
168c2ecf20Sopenharmony_cisame hardware "isolation context" and a 10-bit value called an ICID
178c2ecf20Sopenharmony_ci(isolation context id) is expressed by the hardware to identify
188c2ecf20Sopenharmony_cithe requester.
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciThe generic 'iommus' property is insufficient to describe the relationship
218c2ecf20Sopenharmony_cibetween ICIDs and IOMMUs, so an iommu-map property is used to define
228c2ecf20Sopenharmony_cithe set of possible ICIDs under a root DPRC and how they map to
238c2ecf20Sopenharmony_cian IOMMU.
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciFor generic IOMMU bindings, see
268c2ecf20Sopenharmony_ciDocumentation/devicetree/bindings/iommu/iommu.txt.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciFor arm-smmu binding, see:
298c2ecf20Sopenharmony_ciDocumentation/devicetree/bindings/iommu/arm,smmu.yaml.
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciThe MSI writes are accompanied by sideband data which is derived from the ICID.
328c2ecf20Sopenharmony_ciThe msi-map property is used to associate the devices with both the ITS
338c2ecf20Sopenharmony_cicontroller and the sideband data which accompanies the writes.
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciFor generic MSI bindings, see
368c2ecf20Sopenharmony_ciDocumentation/devicetree/bindings/interrupt-controller/msi.txt.
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciFor GICv3 and GIC ITS bindings, see:
398c2ecf20Sopenharmony_ciDocumentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml.
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciRequired properties:
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci    - compatible
448c2ecf20Sopenharmony_ci        Value type: <string>
458c2ecf20Sopenharmony_ci        Definition: Must be "fsl,qoriq-mc".  A Freescale Management Complex
468c2ecf20Sopenharmony_ci                    compatible with this binding must have Block Revision
478c2ecf20Sopenharmony_ci                    Registers BRR1 and BRR2 at offset 0x0BF8 and 0x0BFC in
488c2ecf20Sopenharmony_ci                    the MC control register region.
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci    - reg
518c2ecf20Sopenharmony_ci        Value type: <prop-encoded-array>
528c2ecf20Sopenharmony_ci        Definition: A standard property.  Specifies one or two regions
538c2ecf20Sopenharmony_ci                    defining the MC's registers:
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci                       -the first region is the command portal for the
568c2ecf20Sopenharmony_ci                        this machine and must always be present
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci                       -the second region is the MC control registers. This
598c2ecf20Sopenharmony_ci                        region may not be present in some scenarios, such
608c2ecf20Sopenharmony_ci                        as in the device tree presented to a virtual machine.
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci    - ranges
638c2ecf20Sopenharmony_ci        Value type: <prop-encoded-array>
648c2ecf20Sopenharmony_ci        Definition: A standard property.  Defines the mapping between the child
658c2ecf20Sopenharmony_ci                    MC address space and the parent system address space.
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci                    The MC address space is defined by 3 components:
688c2ecf20Sopenharmony_ci                       <region type> <offset hi> <offset lo>
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci                    Valid values for region type are
718c2ecf20Sopenharmony_ci                       0x0 - MC portals
728c2ecf20Sopenharmony_ci                       0x1 - QBMAN portals
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci    - #address-cells
758c2ecf20Sopenharmony_ci        Value type: <u32>
768c2ecf20Sopenharmony_ci        Definition: Must be 3.  (see definition in 'ranges' property)
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci    - #size-cells
798c2ecf20Sopenharmony_ci        Value type: <u32>
808c2ecf20Sopenharmony_ci        Definition: Must be 1.
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ciSub-nodes:
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci        The fsl-mc node may optionally have dpmac sub-nodes that describe
858c2ecf20Sopenharmony_ci        the relationship between the Ethernet MACs which belong to the MC
868c2ecf20Sopenharmony_ci        and the Ethernet PHYs on the system board.
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci        The dpmac nodes must be under a node named "dpmacs" which contains
898c2ecf20Sopenharmony_ci        the following properties:
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci            - #address-cells
928c2ecf20Sopenharmony_ci              Value type: <u32>
938c2ecf20Sopenharmony_ci              Definition: Must be present if dpmac sub-nodes are defined and must
948c2ecf20Sopenharmony_ci                          have a value of 1.
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci            - #size-cells
978c2ecf20Sopenharmony_ci              Value type: <u32>
988c2ecf20Sopenharmony_ci              Definition: Must be present if dpmac sub-nodes are defined and must
998c2ecf20Sopenharmony_ci                          have a value of 0.
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci        These nodes must have the following properties:
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci            - compatible
1048c2ecf20Sopenharmony_ci              Value type: <string>
1058c2ecf20Sopenharmony_ci              Definition: Must be "fsl,qoriq-mc-dpmac".
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci            - reg
1088c2ecf20Sopenharmony_ci              Value type: <prop-encoded-array>
1098c2ecf20Sopenharmony_ci              Definition: Specifies the id of the dpmac.
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci            - phy-handle
1128c2ecf20Sopenharmony_ci              Value type: <phandle>
1138c2ecf20Sopenharmony_ci              Definition: Specifies the phandle to the PHY device node associated
1148c2ecf20Sopenharmony_ci                          with the this dpmac.
1158c2ecf20Sopenharmony_ciOptional properties:
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci- iommu-map: Maps an ICID to an IOMMU and associated iommu-specifier
1188c2ecf20Sopenharmony_ci  data.
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci  The property is an arbitrary number of tuples of
1218c2ecf20Sopenharmony_ci  (icid-base,iommu,iommu-base,length).
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci  Any ICID i in the interval [icid-base, icid-base + length) is
1248c2ecf20Sopenharmony_ci  associated with the listed IOMMU, with the iommu-specifier
1258c2ecf20Sopenharmony_ci  (i - icid-base + iommu-base).
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci- msi-map: Maps an ICID to a GIC ITS and associated msi-specifier
1288c2ecf20Sopenharmony_ci  data.
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci  The property is an arbitrary number of tuples of
1318c2ecf20Sopenharmony_ci  (icid-base,gic-its,msi-base,length).
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci  Any ICID in the interval [icid-base, icid-base + length) is
1348c2ecf20Sopenharmony_ci  associated with the listed GIC ITS, with the msi-specifier
1358c2ecf20Sopenharmony_ci  (i - icid-base + msi-base).
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ciDeprecated properties:
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci    - msi-parent
1408c2ecf20Sopenharmony_ci        Value type: <phandle>
1418c2ecf20Sopenharmony_ci        Definition: Describes the MSI controller node handling message
1428c2ecf20Sopenharmony_ci                    interrupts for the MC. When there is no translation
1438c2ecf20Sopenharmony_ci                    between the ICID and deviceID this property can be used
1448c2ecf20Sopenharmony_ci                    to describe the MSI controller used by the devices on the
1458c2ecf20Sopenharmony_ci                    mc-bus.
1468c2ecf20Sopenharmony_ci                    The use of this property for mc-bus is deprecated. Please
1478c2ecf20Sopenharmony_ci                    use msi-map.
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ciExample:
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci        smmu: iommu@5000000 {
1528c2ecf20Sopenharmony_ci               compatible = "arm,mmu-500";
1538c2ecf20Sopenharmony_ci               #iommu-cells = <1>;
1548c2ecf20Sopenharmony_ci               stream-match-mask = <0x7C00>;
1558c2ecf20Sopenharmony_ci               ...
1568c2ecf20Sopenharmony_ci        };
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci        gic: interrupt-controller@6000000 {
1598c2ecf20Sopenharmony_ci               compatible = "arm,gic-v3";
1608c2ecf20Sopenharmony_ci               ...
1618c2ecf20Sopenharmony_ci        }
1628c2ecf20Sopenharmony_ci        its: gic-its@6020000 {
1638c2ecf20Sopenharmony_ci               compatible = "arm,gic-v3-its";
1648c2ecf20Sopenharmony_ci               msi-controller;
1658c2ecf20Sopenharmony_ci               ...
1668c2ecf20Sopenharmony_ci        };
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci        fsl_mc: fsl-mc@80c000000 {
1698c2ecf20Sopenharmony_ci                compatible = "fsl,qoriq-mc";
1708c2ecf20Sopenharmony_ci                reg = <0x00000008 0x0c000000 0 0x40>,    /* MC portal base */
1718c2ecf20Sopenharmony_ci                      <0x00000000 0x08340000 0 0x40000>; /* MC control reg */
1728c2ecf20Sopenharmony_ci                /* define map for ICIDs 23-64 */
1738c2ecf20Sopenharmony_ci                iommu-map = <23 &smmu 23 41>;
1748c2ecf20Sopenharmony_ci                /* define msi map for ICIDs 23-64 */
1758c2ecf20Sopenharmony_ci                msi-map = <23 &its 23 41>;
1768c2ecf20Sopenharmony_ci                #address-cells = <3>;
1778c2ecf20Sopenharmony_ci                #size-cells = <1>;
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci                /*
1808c2ecf20Sopenharmony_ci                 * Region type 0x0 - MC portals
1818c2ecf20Sopenharmony_ci                 * Region type 0x1 - QBMAN portals
1828c2ecf20Sopenharmony_ci                 */
1838c2ecf20Sopenharmony_ci                ranges = <0x0 0x0 0x0 0x8 0x0c000000 0x4000000
1848c2ecf20Sopenharmony_ci                          0x1 0x0 0x0 0x8 0x18000000 0x8000000>;
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci                dpmacs {
1878c2ecf20Sopenharmony_ci                    #address-cells = <1>;
1888c2ecf20Sopenharmony_ci                    #size-cells = <0>;
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ci                    dpmac@1 {
1918c2ecf20Sopenharmony_ci                        compatible = "fsl,qoriq-mc-dpmac";
1928c2ecf20Sopenharmony_ci                        reg = <1>;
1938c2ecf20Sopenharmony_ci                        phy-handle = <&mdio0_phy0>;
1948c2ecf20Sopenharmony_ci                    }
1958c2ecf20Sopenharmony_ci                }
1968c2ecf20Sopenharmony_ci        };
197