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,mtd-eeprom:
51    $ref: /schemas/types.yaml#/definitions/phandle-array
52    description:
53      Phandle to a MTD partition + offset containing EEPROM data
54
55  big-endian:
56    $ref: /schemas/types.yaml#/definitions/flag
57    description:
58      Specify if the radio eeprom partition is written in big-endian
59
60  mediatek,eeprom-merge-otp:
61    type: boolean
62    description:
63      Merge EEPROM data with OTP data. Can be used on boards where the flash
64      calibration data is generic and specific calibration data should be
65      pulled from the OTP ROM
66
67  led:
68    type: object
69    $ref: /schemas/leds/common.yaml#
70    additionalProperties: false
71    properties:
72      led-sources:
73        maxItems: 1
74
75  power-limits:
76    type: object
77    additionalProperties: false
78    patternProperties:
79      "^r[0-9]+":
80        type: object
81        additionalProperties: false
82        properties:
83          regdomain:
84            $ref: /schemas/types.yaml#/definitions/string
85            description:
86              Regdomain refers to a legal regulatory region. Different
87              countries define different levels of allowable transmitter
88              power, time that a channel can be occupied, and different
89              available channels
90            enum:
91              - FCC
92              - ETSI
93              - JP
94
95        patternProperties:
96          "^txpower-[256]g$":
97            type: object
98            additionalProperties: false
99            patternProperties:
100              "^b[0-9]+$":
101                type: object
102                additionalProperties: false
103                properties:
104                  channels:
105                    $ref: /schemas/types.yaml#/definitions/uint32-array
106                    minItems: 2
107                    maxItems: 2
108                    description:
109                      Pairs of first and last channel number of the selected
110                      band
111
112                  rates-cck:
113                    $ref: /schemas/types.yaml#/definitions/uint8-array
114                    minItems: 4
115                    maxItems: 4
116                    description:
117                      4 half-dBm per-rate power limit values
118
119                  rates-ofdm:
120                    $ref: /schemas/types.yaml#/definitions/uint8-array
121                    minItems: 8
122                    maxItems: 8
123                    description:
124                      8 half-dBm per-rate power limit values
125
126                  rates-mcs:
127                    $ref: /schemas/types.yaml#/definitions/uint8-matrix
128                    description:
129                      Sets of per-rate power limit values for 802.11n/802.11ac
130                      rates for multiple channel bandwidth settings.
131                      Each set starts with the number of channel bandwidth
132                      settings for which the rate set applies, followed by
133                      either 8 or 10 power limit values. The order of the
134                      channel bandwidth settings is 20, 40, 80 and 160 MHz.
135                    maxItems: 4
136                    items:
137                      minItems: 9
138                      maxItems: 11
139
140                  rates-ru:
141                    $ref: /schemas/types.yaml#/definitions/uint8-matrix
142                    description:
143                      Sets of per-rate power limit values for 802.11ax rates
144                      for multiple channel bandwidth or resource unit settings.
145                      Each set starts with the number of channel bandwidth or
146                      resource unit settings for which the rate set applies,
147                      followed by 12 power limit values. The order of the
148                      channel resource unit settings is RU26, RU52, RU106,
149                      RU242/SU20, RU484/SU40, RU996/SU80 and RU2x996/SU160.
150                    items:
151                      minItems: 13
152                      maxItems: 13
153
154                  txs-delta:
155                    $ref: /schemas/types.yaml#/definitions/uint32-array
156                    description:
157                      Half-dBm power delta for different numbers of antennas
158
159required:
160  - compatible
161  - reg
162
163additionalProperties: false
164
165examples:
166  - |
167    pcie0 {
168      #address-cells = <3>;
169      #size-cells = <2>;
170      wifi@0,0 {
171        compatible = "mediatek,mt76";
172        reg = <0x0000 0 0 0 0>;
173        ieee80211-freq-limit = <5000000 6000000>;
174        mediatek,mtd-eeprom = <&factory 0x8000>;
175        big-endian;
176
177        led {
178          led-sources = <2>;
179        };
180
181        power-limits {
182          r0 {
183            regdomain = "FCC";
184            txpower-5g {
185               b0 {
186                   channels = <36 48>;
187                   rates-ofdm = /bits/ 8 <23 23 23 23 23 23 23 23>;
188                   rates-mcs = /bits/ 8 <1 23 23 23 23 23 23 23 23 23 23>,
189                                        <3 22 22 22 22 22 22 22 22 22 22>;
190                   rates-ru = /bits/ 8 <3 22 22 22 22 22 22 22 22 22 22 22 22>,
191                                       <4 20 20 20 20 20 20 20 20 20 20 20 20>;
192               };
193               b1 {
194                   channels = <100 181>;
195                   rates-ofdm = /bits/ 8 <14 14 14 14 14 14 14 14>;
196                   rates-mcs = /bits/ 8  <4 14 14 14 14 14 14 14 14 14 14>;
197                   txs-delta = <12 9 6>;
198                   rates-ru = /bits/ 8  <7 14 14 14 14 14 14 14 14 14 14 14 14>;
199               };
200             };
201          };
202        };
203      };
204    };
205
206  - |
207    wifi@10300000 {
208      compatible = "mediatek,mt7628-wmac";
209      reg = <0x10300000 0x100000>;
210
211      interrupt-parent = <&cpuintc>;
212      interrupts = <6>;
213
214      mediatek,mtd-eeprom = <&factory 0x0>;
215    };
216
217  - |
218    #include <dt-bindings/interrupt-controller/arm-gic.h>
219    #include <dt-bindings/interrupt-controller/irq.h>
220    wifi@18000000 {
221      compatible = "mediatek,mt7622-wmac";
222      reg = <0x10300000 0x100000>;
223      interrupts = <GIC_SPI 211 IRQ_TYPE_LEVEL_LOW>;
224
225      mediatek,infracfg = <&infracfg>;
226
227      power-domains = <&scpsys 3>;
228    };
229