1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2# Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
3
4%YAML 1.2
5---
6$id: http://devicetree.org/schemas/net/wireless/mediatek,mt76.yaml#
7$schema: http://devicetree.org/meta-schemas/core.yaml#
8
9title: MediaTek mt76 wireless devices Generic Binding
10
11maintainers:
12  - Felix Fietkau <nbd@nbd.name>
13  - Lorenzo Bianconi <lorenzo@kernel.org>
14  - Ryder Lee <ryder.lee@mediatek.com>
15
16description: |
17  This node provides properties for configuring the MediaTek mt76xx
18  wireless device. The node is expected to be specified as a child
19  node of the PCI controller to which the wireless chip is connected.
20  Alternatively, it can specify the wireless part of the MT7628/MT7688
21  or MT7622 SoC.
22
23allOf:
24  - $ref: ieee80211.yaml#
25
26properties:
27  compatible:
28    enum:
29      - mediatek,mt76
30      - mediatek,mt7628-wmac
31      - mediatek,mt7622-wmac
32
33  reg:
34    maxItems: 1
35
36  interrupts:
37    maxItems: 1
38
39  power-domains:
40    maxItems: 1
41
42  mediatek,infracfg:
43    $ref: /schemas/types.yaml#/definitions/phandle
44    description:
45      Phandle to the infrastructure bus fabric syscon node.
46      This property is MT7622 specific
47
48  ieee80211-freq-limit: true
49
50  mediatek,eeprom-data:
51    $ref: /schemas/types.yaml#/definitions/uint32-array
52    description:
53      EEPROM data embedded as array.
54
55  mediatek,mtd-eeprom:
56    $ref: /schemas/types.yaml#/definitions/phandle-array
57    items:
58      - items:
59          - description: phandle to MTD partition
60          - description: offset containing EEPROM data
61    description:
62      Phandle to a MTD partition + offset containing EEPROM data
63
64  big-endian:
65    $ref: /schemas/types.yaml#/definitions/flag
66    description:
67      Specify if the radio eeprom partition is written in big-endian
68
69  mediatek,eeprom-merge-otp:
70    type: boolean
71    description:
72      Merge EEPROM data with OTP data. Can be used on boards where the flash
73      calibration data is generic and specific calibration data should be
74      pulled from the OTP ROM
75
76  led:
77    type: object
78    $ref: /schemas/leds/common.yaml#
79    additionalProperties: false
80    properties:
81      led-sources:
82        maxItems: 1
83
84  power-limits:
85    type: object
86    additionalProperties: false
87    patternProperties:
88      "^r[0-9]+":
89        type: object
90        additionalProperties: false
91        properties:
92          regdomain:
93            $ref: /schemas/types.yaml#/definitions/string
94            description:
95              Regdomain refers to a legal regulatory region. Different
96              countries define different levels of allowable transmitter
97              power, time that a channel can be occupied, and different
98              available channels
99            enum:
100              - FCC
101              - ETSI
102              - JP
103
104        patternProperties:
105          "^txpower-[256]g$":
106            type: object
107            additionalProperties: false
108            patternProperties:
109              "^b[0-9]+$":
110                type: object
111                additionalProperties: false
112                properties:
113                  channels:
114                    $ref: /schemas/types.yaml#/definitions/uint32-array
115                    minItems: 2
116                    maxItems: 2
117                    description:
118                      Pairs of first and last channel number of the selected
119                      band
120
121                  rates-cck:
122                    $ref: /schemas/types.yaml#/definitions/uint8-array
123                    minItems: 4
124                    maxItems: 4
125                    description:
126                      4 half-dBm per-rate power limit values
127
128                  rates-ofdm:
129                    $ref: /schemas/types.yaml#/definitions/uint8-array
130                    minItems: 8
131                    maxItems: 8
132                    description:
133                      8 half-dBm per-rate power limit values
134
135                  rates-mcs:
136                    $ref: /schemas/types.yaml#/definitions/uint8-matrix
137                    description:
138                      Sets of per-rate power limit values for 802.11n/802.11ac
139                      rates for multiple channel bandwidth settings.
140                      Each set starts with the number of channel bandwidth
141                      settings for which the rate set applies, followed by
142                      either 8 or 10 power limit values. The order of the
143                      channel bandwidth settings is 20, 40, 80 and 160 MHz.
144                    maxItems: 4
145                    items:
146                      minItems: 9
147                      maxItems: 11
148
149                  rates-ru:
150                    $ref: /schemas/types.yaml#/definitions/uint8-matrix
151                    description:
152                      Sets of per-rate power limit values for 802.11ax rates
153                      for multiple channel bandwidth or resource unit settings.
154                      Each set starts with the number of channel bandwidth or
155                      resource unit settings for which the rate set applies,
156                      followed by 12 power limit values. The order of the
157                      channel resource unit settings is RU26, RU52, RU106,
158                      RU242/SU20, RU484/SU40, RU996/SU80 and RU2x996/SU160.
159                    items:
160                      minItems: 13
161                      maxItems: 13
162
163                  txs-delta:
164                    $ref: /schemas/types.yaml#/definitions/uint32-array
165                    description:
166                      Half-dBm power delta for different numbers of antennas
167
168required:
169  - compatible
170  - reg
171
172additionalProperties: false
173
174examples:
175  - |
176    pcie0 {
177      #address-cells = <3>;
178      #size-cells = <2>;
179      wifi@0,0 {
180        compatible = "mediatek,mt76";
181        reg = <0x0000 0 0 0 0>;
182        ieee80211-freq-limit = <5000000 6000000>;
183        mediatek,mtd-eeprom = <&factory 0x8000>;
184        big-endian;
185
186        led {
187          led-sources = <2>;
188        };
189
190        power-limits {
191          r0 {
192            regdomain = "FCC";
193            txpower-5g {
194               b0 {
195                   channels = <36 48>;
196                   rates-ofdm = /bits/ 8 <23 23 23 23 23 23 23 23>;
197                   rates-mcs = /bits/ 8 <1 23 23 23 23 23 23 23 23 23 23>,
198                               /bits/ 8 <3 22 22 22 22 22 22 22 22 22 22>;
199                   rates-ru = /bits/ 8 <3 22 22 22 22 22 22 22 22 22 22 22 22>,
200                              /bits/ 8 <4 20 20 20 20 20 20 20 20 20 20 20 20>;
201               };
202               b1 {
203                   channels = <100 181>;
204                   rates-ofdm = /bits/ 8 <14 14 14 14 14 14 14 14>;
205                   rates-mcs = /bits/ 8  <4 14 14 14 14 14 14 14 14 14 14>;
206                   txs-delta = <12 9 6>;
207                   rates-ru = /bits/ 8  <7 14 14 14 14 14 14 14 14 14 14 14 14>;
208               };
209             };
210          };
211        };
212      };
213    };
214
215  - |
216    wifi@10300000 {
217      compatible = "mediatek,mt7628-wmac";
218      reg = <0x10300000 0x100000>;
219
220      interrupt-parent = <&cpuintc>;
221      interrupts = <6>;
222
223      mediatek,mtd-eeprom = <&factory 0x0>;
224    };
225
226  - |
227    #include <dt-bindings/interrupt-controller/arm-gic.h>
228    #include <dt-bindings/interrupt-controller/irq.h>
229    wifi@18000000 {
230      compatible = "mediatek,mt7622-wmac";
231      reg = <0x10300000 0x100000>;
232      interrupts = <GIC_SPI 211 IRQ_TYPE_LEVEL_LOW>;
233
234      mediatek,infracfg = <&infracfg>;
235
236      power-domains = <&scpsys 3>;
237    };
238