1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2# Copyright (C) Sunplus Co., Ltd. 2021
3%YAML 1.2
4---
5$id: http://devicetree.org/schemas/net/sunplus,sp7021-emac.yaml#
6$schema: http://devicetree.org/meta-schemas/core.yaml#
7
8title: Sunplus SP7021 Dual Ethernet MAC Device Tree Bindings
9
10maintainers:
11  - Wells Lu <wellslutw@gmail.com>
12
13description: |
14  Sunplus SP7021 dual 10M/100M Ethernet MAC controller.
15  Device node of the controller has following properties.
16
17properties:
18  compatible:
19    const: sunplus,sp7021-emac
20
21  reg:
22    maxItems: 1
23
24  interrupts:
25    maxItems: 1
26
27  clocks:
28    maxItems: 1
29
30  resets:
31    maxItems: 1
32
33  ethernet-ports:
34    type: object
35    description: Ethernet ports to PHY
36
37    properties:
38      "#address-cells":
39        const: 1
40
41      "#size-cells":
42        const: 0
43
44    patternProperties:
45      "^port@[0-1]$":
46        type: object
47        description: Port to PHY
48
49        properties:
50          reg:
51            minimum: 0
52            maximum: 1
53
54          phy-handle:
55            maxItems: 1
56
57          phy-mode:
58            maxItems: 1
59
60          nvmem-cells:
61            items:
62              - description: nvmem cell address of MAC address
63
64          nvmem-cell-names:
65            description: names corresponding to the nvmem cells
66            items:
67              - const: mac-address
68
69        required:
70          - reg
71          - phy-handle
72          - phy-mode
73          - nvmem-cells
74          - nvmem-cell-names
75
76  mdio:
77    $ref: mdio.yaml#
78    unevaluatedProperties: false
79
80additionalProperties: false
81
82required:
83  - compatible
84  - reg
85  - interrupts
86  - clocks
87  - resets
88  - pinctrl-0
89  - pinctrl-names
90  - ethernet-ports
91  - mdio
92
93examples:
94  - |
95    #include <dt-bindings/interrupt-controller/irq.h>
96
97    ethernet@9c108000 {
98        compatible = "sunplus,sp7021-emac";
99        reg = <0x9c108000 0x400>;
100        interrupt-parent = <&intc>;
101        interrupts = <66 IRQ_TYPE_LEVEL_HIGH>;
102        clocks = <&clkc 0xa7>;
103        resets = <&rstc 0x97>;
104        pinctrl-0 = <&emac_demo_board_v3_pins>;
105        pinctrl-names = "default";
106
107        ethernet-ports {
108            #address-cells = <1>;
109            #size-cells = <0>;
110
111            port@0 {
112                reg = <0>;
113                phy-handle = <&eth_phy0>;
114                phy-mode = "rmii";
115                nvmem-cells = <&mac_addr0>;
116                nvmem-cell-names = "mac-address";
117            };
118
119            port@1 {
120                reg = <1>;
121                phy-handle = <&eth_phy1>;
122                phy-mode = "rmii";
123                nvmem-cells = <&mac_addr1>;
124                nvmem-cell-names = "mac-address";
125            };
126        };
127
128        mdio {
129            #address-cells = <1>;
130            #size-cells = <0>;
131
132            eth_phy0: ethernet-phy@0 {
133                reg = <0>;
134            };
135
136            eth_phy1: ethernet-phy@1 {
137                reg = <1>;
138            };
139        };
140    };
141...
142