mt76: add new wireless driver for MediaTek MT76x2 PCIe chips
Subsystems (4)
Felix Fietkau
maintainerv3 cover mt76: add new wireless driver for MediaTek MT76x2 PCIe chips
This series depends on the patch
"add basic register-field manipulation macros"
Changes since v2:
- lots of checkpatch cleanups
- various tx path (and other) fixes
- use the new bitfield API
- documented device tree bindings
Felix Fietkau (3):
Documentation: dt: net: add mt76 wireless device binding
mt76: add common code shared between multiple chipsets
mt76: add driver code for MT76x2e
.../bindings/net/wireless/mediatek,mt76.txt | 26 + drivers/net/wireless/mediatek/Kconfig | 1 + drivers/net/wireless/mediatek/Makefile | 1 + drivers/net/wireless/mediatek/mt76/Kconfig | 10 + drivers/net/wireless/mediatek/mt76/Makefile | 15 + drivers/net/wireless/mediatek/mt76/debugfs.c | 76 ++ drivers/net/wireless/mediatek/mt76/dma.c | 451 ++++++++++++ drivers/net/wireless/mediatek/mt76/dma.h | 38 + drivers/net/wireless/mediatek/mt76/eeprom.c | 122 ++++ drivers/net/wireless/mediatek/mt76/mac80211.c | 314 +++++++++ drivers/net/wireless/mediatek/mt76/mmio.c | 61 ++ drivers/net/wireless/mediatek/mt76/mt76.h | 355 ++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2.h | 220 ++++++ drivers/net/wireless/mediatek/mt76/mt76x2_core.c | 83 +++ .../net/wireless/mediatek/mt76/mt76x2_debugfs.c | 101 +++ drivers/net/wireless/mediatek/mt76/mt76x2_dma.c | 184 +++++ drivers/net/wireless/mediatek/mt76/mt76x2_dma.h | 68 ++ drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c | 644 +++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h | 181 +++++ drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 765 +++++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_mac.c | 738 ++++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_mac.h | 189 +++++ drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 532 ++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c | 452 ++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_mcu.h | 136 ++++ drivers/net/wireless/mediatek/mt76/mt76x2_pci.c | 109 +++ drivers/net/wireless/mediatek/mt76/mt76x2_phy.c | 688 ++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_regs.h | 564 +++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_trace.c | 23 + drivers/net/wireless/mediatek/mt76/mt76x2_trace.h | 144 ++++ drivers/net/wireless/mediatek/mt76/mt76x2_tx.c | 262 +++++++ drivers/net/wireless/mediatek/mt76/trace.c | 23 + drivers/net/wireless/mediatek/mt76/trace.h | 71 ++ drivers/net/wireless/mediatek/mt76/tx.c | 511 ++++++++++++++ drivers/net/wireless/mediatek/mt76/util.c | 78 +++ drivers/net/wireless/mediatek/mt76/util.h | 44 ++ 36 files changed, 8280 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt create mode 100644 drivers/net/wireless/mediatek/mt76/Kconfig create mode 100644 drivers/net/wireless/mediatek/mt76/Makefile create mode 100644 drivers/net/wireless/mediatek/mt76/debugfs.c create mode 100644 drivers/net/wireless/mediatek/mt76/dma.c create mode 100644 drivers/net/wireless/mediatek/mt76/dma.h create mode 100644 drivers/net/wireless/mediatek/mt76/eeprom.c create mode 100644 drivers/net/wireless/mediatek/mt76/mac80211.c create mode 100644 drivers/net/wireless/mediatek/mt76/mmio.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76.h create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2.h create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_core.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_dma.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_dma.h create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_init.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_mac.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_mac.h create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_main.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_mcu.h create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_pci.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_phy.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_regs.h create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_trace.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_trace.h create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_tx.c create mode 100644 drivers/net/wireless/mediatek/mt76/trace.c create mode 100644 drivers/net/wireless/mediatek/mt76/trace.h create mode 100644 drivers/net/wireless/mediatek/mt76/tx.c create mode 100644 drivers/net/wireless/mediatek/mt76/util.c create mode 100644 drivers/net/wireless/mediatek/mt76/util.h
Signature · 1 line
2.8.4
Felix Fietkau
maintainerPATCH v3 1/3 Documentation: dt: net: add mt76 wireless device binding
--- .../bindings/net/wireless/mediatek,mt76.txt | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt new file +26 -0
@@ -0,0 +1,26 @@ +* MediaTek mt76xx devices + +This node provides properties for configuring the MediaTek mt76xx wireless +device. The node is expected to be specified as a child node of the PCI +controller to which the wireless chip is connected. + +Optional properties: + +- mac-address: See ethernet.txt in the parent directory +- local-mac-address: See ethernet.txt in the parent directory +- mediatek,2ghz: Override the 2.4 GHz band capability from EEPROM +- mediatek,5ghz: Override the 5 GHz band capability from EEPROM +- mediatek,mtd-eeprom: Specify a MTD partition + offset containing EEPROM data + +&pcie { + status = "okay"; + + pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +};
Signature · 1 line
2.8.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v3 1/3] Documentation: dt: net: add mt76 wireless device binding
Quoted 28 lines · Felix Fietkau
Signed-off-by Felix Fietkau <[email protected]>--- .../bindings/net/wireless/mediatek,mt76.txt | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txtDocumentation/devicetree/bindings/net/wireless/mediatek,mt76.txt new file +16
-0@@ -0,0 +1,26 @@ +* MediaTek mt76xx devices + +This node provides properties for configuring the MediaTek mt76xx wireless +device. The node is expected to be specified as a child node of the PCI +controller to which the wireless chip is connected. + +Optional properties: + +- mac-address: See ethernet.txt in the parent directory +- local-mac-address: See ethernet.txt in the parent directory +- mediatek,2ghz: Override the 2.4 GHz band capability from EEPROM +- mediatek,5ghz: Override the 5 GHz band capability from EEPROM +- mediatek,mtd-eeprom: Specify a MTD partition + offset containing EEPROM data + +&pcie { + status = "okay";
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt line 26
Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt new file +10
-0+ + pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +};
I need an ack from device tree maintainers, CCing the devicetree list. Do we need to resend or this ok?
Patchwork link:
https://patchwork.kernel.org/patch/9313309/
Signature · 1 line
Kalle Valo
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v3 1/3] Documentation: dt: net: add mt76 wireless device binding
Quoted 44 lines · Kalle Valo
Quoted 28 lines · Felix Fietkau
Signed-off-by Felix Fietkau <[email protected]>--- .../bindings/net/wireless/mediatek,mt76.txt | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txtDocumentation/devicetree/bindings/net/wireless/mediatek,mt76.txt new file +16
-0@@ -0,0 +1,26 @@ +* MediaTek mt76xx devices + +This node provides properties for configuring the MediaTek mt76xx wireless +device. The node is expected to be specified as a child node of the PCI +controller to which the wireless chip is connected. + +Optional properties: + +- mac-address: See ethernet.txt in the parent directory +- local-mac-address: See ethernet.txt in the parent directory +- mediatek,2ghz: Override the 2.4 GHz band capability from EEPROM +- mediatek,5ghz: Override the 5 GHz band capability from EEPROM +- mediatek,mtd-eeprom: Specify a MTD partition + offset containing EEPROM data + +&pcie { + status = "okay";Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt line 26
Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt new file +10
-0+ + pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>; + }; + }; +};I need an ack from device tree maintainers, CCing the devicetree list. Do we need to resend or this ok?
Quoted 3 lines
Patchwork link:
Ping?
- Felix
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): e7d435b2-6b59-45af-07eb-b10789d61a9c-Vt+b4OUoWG0@public.gmane.org
Re: [PATCH v3 1/3] Documentation: dt: net: add mt76 wireless device binding
Quoted 27 lines · Felix Fietkau
Quoted 26 lines · Kalle Valo
Quoted 24 lines · Felix Fietkau
Signed-off-by Felix Fietkau <[email protected]>--- .../bindings/net/wireless/mediatek,mt76.txt | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txtDocumentation/devicetree/bindings/net/wireless/mediatek,mt76.txt new file +12
-0@@ -0,0 +1,26 @@ +* MediaTek mt76xx devices + +This node provides properties for configuring the MediaTek mt76xx wireless +device. The node is expected to be specified as a child node of the PCI +controller to which the wireless chip is connected. + +Optional properties: + +- mac-address: See ethernet.txt in the parent directory +- local-mac-address: See ethernet.txt in the parent directory +- mediatek,2ghz: Override the 2.4 GHz band capability from EEPROM +- mediatek,5ghz: Override the 5 GHz band capability from EEPROM
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt line 20
Quoted 8 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt new file +8
-0+- mediatek,mtd-eeprom: Specify a MTD partition + offset containing EEPROM data + +&pcie { + status = "okay"; + + pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>;
Maybe have an examplep of a real register address other than zero?
Quoted 3 lines
Quoted 3 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt line 23
Quoted 3 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt new file +3
-0+ device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>;
It's not clear what the possible values for the 2ghz property are, can you be more verbose in the description? How is <0> different from no property?
Arnd
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v3 1/3] Documentation: dt: net: add mt76 wireless device binding
Quoted 30 lines · Arnd Bergmann
Quoted 29 lines · Felix Fietkau
Quoted 28 lines · Kalle Valo
Quoted 26 lines · Felix Fietkau
Signed-off-by Felix Fietkau <[email protected]>--- .../bindings/net/wireless/mediatek,mt76.txt | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txtDocumentation/devicetree/bindings/net/wireless/mediatek,mt76.txt new file +14
-0@@ -0,0 +1,26 @@ +* MediaTek mt76xx devices + +This node provides properties for configuring the MediaTek mt76xx wireless +device. The node is expected to be specified as a child node of the PCI +controller to which the wireless chip is connected. + +Optional properties: + +- mac-address: See ethernet.txt in the parent directory +- local-mac-address: See ethernet.txt in the parent directory +- mediatek,2ghz: Override the 2.4 GHz band capability from EEPROM +- mediatek,5ghz: Override the 5 GHz band capability from EEPROM +- mediatek,mtd-eeprom: Specify a MTD partition + offset containing EEPROM data +
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt line 20
Quoted 6 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt new file +6
-0+&pcie { + status = "okay"; + + pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>;Maybe have an examplep of a real register address other than zero?
This is a real example referring to the first device on a PCI bus. I copy&pasted this from a .dts file that we use in LEDE.
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt line 23
Quoted 3 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt new file +3
-0+ device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>;It's not clear what the possible values for the 2ghz property are, can you be more verbose in the description? How is <0> different from no property?
0 means disabled, no property means unchanged (compared to EEPROM).
- Felix
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 3334122f-0d79-f910-a414-5b9cafd9901f-Vt+b4OUoWG0@public.gmane.org
Re: [PATCH v3 1/3] Documentation: dt: net: add mt76 wireless device binding
Quoted 7 lines · Felix Fietkau
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
+ pcie0 {
(quoted diff) +2
-0+ mt76@0,0 { + reg = <0x0000 0 0 0 0>;Maybe have an examplep of a real register address other than zero?
This is a real example referring to the first device on a PCI bus. I copy&pasted this from a .dts file that we use in LEDE.
Ok, I see.
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>;It's not clear what the possible values for the 2ghz property are, can you be more verbose in the description? How is <0> different from no property?
0 means disabled, no property means unchanged (compared to EEPROM).
Maybe have a boolean property instead then to say "mediatek,2ghz-disabled" ?
If zero is the only possible value, there is no need to put a number in there.
Arnd
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v3 1/3] Documentation: dt: net: add mt76 wireless device binding
Quoted 15 lines · Arnd Bergmann
Quoted 7 lines · Felix Fietkau
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
+ pcie0 {
(quoted diff) +2
-0+ mt76@0,0 { + reg = <0x0000 0 0 0 0>;Maybe have an examplep of a real register address other than zero?
This is a real example referring to the first device on a PCI bus. I copy&pasted this from a .dts file that we use in LEDE.
Ok, I see.
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(quoted diff) +3
-0+ device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>;
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
It's not clear what the possible values for the 2ghz property are, can you be more verbose in the description? How is <0> different from no property?
0 means disabled, no property means unchanged (compared to EEPROM).
Maybe have a boolean property instead then to say "mediatek,2ghz-disabled" ?
If zero is the only possible value, there is no need to put a number in there.
1 is also possible, which will force-enable the capability.
- Felix
A message that is not in the archive (sent off-list or not yet received): 557be2b8-5ff1-83ea-f6d1-6421c2465969-Vt+b4OUoWG0@public.gmane.org
Re: [PATCH v3 1/3] Documentation: dt: net: add mt76 wireless device binding
Quoted 7 lines · Felix Fietkau
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>;It's not clear what the possible values for the 2ghz property are, can you be more verbose in the description? How is <0> different from no property?
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
0 means disabled, no property means unchanged (compared to EEPROM).
Maybe have a boolean property instead then to say "mediatek,2ghz-disabled" ?
If zero is the only possible value, there is no need to put a number in there.
1 is also possible, which will force-enable the capability.
Ok, then both those values should be documented in the binding.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v3 1/3] Documentation: dt: net: add mt76 wireless device binding
Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · Felix Fietkau
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>;It's not clear what the possible values for the 2ghz property are, can you be more verbose in the description? How is <0> different from no property?
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
0 means disabled, no property means unchanged (compared to EEPROM).
Maybe have a boolean property instead then to say "mediatek,2ghz-disabled" ?
If zero is the only possible value, there is no need to put a number in there.
1 is also possible, which will force-enable the capability.
Ok, then both those values should be documented in the binding.
Related to this, Martin sent patches which add generic bindings for enabling 2 Ghz and 5 Ghz bands.
[RFC,1/3] Documentation: dt-bindings: add IEEE 802.11 binding documentation
https://patchwork.kernel.org/patch/9359833/
[RFC,2/3] of: add IEEE 802.11 device configuration support code
https://patchwork.kernel.org/patch/9359837/
Signature · 5 lines
Kalle Valo -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v3 1/3] Documentation: dt: net: add mt76 wireless device binding
Quoted 19 lines · Kalle Valo
Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · Felix Fietkau
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>;It's not clear what the possible values for the 2ghz property are, can you be more verbose in the description? How is <0> different from no property?
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
0 means disabled, no property means unchanged (compared to EEPROM).
Maybe have a boolean property instead then to say "mediatek,2ghz-disabled" ?
If zero is the only possible value, there is no need to put a number in there.
1 is also possible, which will force-enable the capability.
Ok, then both those values should be documented in the binding.
Quoted 8 lines
Related to this, Martin sent patches which add generic bindings for enabling 2 Ghz and 5 Ghz bands.
[RFC,1/3] Documentation: dt-bindings: add IEEE 802.11 binding documentation
https://patchwork.kernel.org/patch/9359833/[RFC,2/3] of: add IEEE 802.11 device configuration support code
https://patchwork.kernel.org/patch/9359837/
I would prefer something more generic. Many tri-band routers split 5 GHz band into 2 sets of channels and they have separated radios for them.
E.g. Netgear R8000 has phy0 which should be used for higher part of 5 GHz band (channels 149+) and phy2 which should be used for lower part of 5 GHz band (channels from 36 to 48 or 64).
What do you think about some more flexible properties like:
ieee80211-min-center-freq ieee80211-max-center-freq
Signature · 5 lines
Rafał -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): CACna6ryikdd0Yt2FWB_JT27N5uuh9XU+JUWNRjs4H5YcD5PVpw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH v3 1/3] Documentation: dt: net: add mt76 wireless device binding
Quoted 33 lines · Rafał Miłecki
Quoted 19 lines · Kalle Valo
Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · Felix Fietkau
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>;It's not clear what the possible values for the 2ghz property are, can you be more verbose in the description? How is <0> different from no property?
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
0 means disabled, no property means unchanged (compared to EEPROM).
Maybe have a boolean property instead then to say "mediatek,2ghz-disabled" ?
If zero is the only possible value, there is no need to put a number in there.
1 is also possible, which will force-enable the capability.
Ok, then both those values should be documented in the binding.
Quoted 8 lines
Related to this, Martin sent patches which add generic bindings for enabling 2 Ghz and 5 Ghz bands.
[RFC,1/3] Documentation: dt-bindings: add IEEE 802.11 binding documentation
https://patchwork.kernel.org/patch/9359833/[RFC,2/3] of: add IEEE 802.11 device configuration support code
https://patchwork.kernel.org/patch/9359837/I would prefer something more generic. Many tri-band routers split 5 GHz band into 2 sets of channels and they have separated radios for them.
Quoted 7 lines
E.g. Netgear R8000 has phy0 which should be used for higher part of 5 GHz band (channels 149+) and phy2 which should be used for lower part of 5 GHz band (channels from 36 to 48 or 64).
What do you think about some more flexible properties like:
ieee80211-min-center-freq ieee80211-max-center-freq
what would happen if only one of these properties was given or would we forbid that (because the .dts should always describe the hardware, and if we describe a lower bound then we should also describe the upper bound)?
the benefits of your solution are:
- this would allow *enabling* bands as well (my proposal allows this as well, but the .dts is indeed a bit hard to read - unlike your solution which looks nice to me)
- we could handle this within generic cfg80211/mac80211 code instead of "duplicating" it per driver
should we describe the center freq in Hz or MHz (cfg80211's ieee80211_channel uses the latter)?
@Arnd: what do you think from devicetree perspective?
Regards,
Martin
[0] http://lxr.free-electrons.com/source/include/net/cfg80211.h#L130
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): CAFBinCBzz0Jvk_jcWAJ1jEz17r-NYEE87xLUACTybRSHGE7uGA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH v3 1/3] Documentation: dt: net: add mt76 wireless device binding
Quoted 38 lines · Martin Blumenstingl
Quoted 37 lines · Rafał Miłecki
Quoted 19 lines · Kalle Valo
Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · Felix Fietkau
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + mediatek,2ghz = <0>;It's not clear what the possible values for the 2ghz property are, can you be more verbose in the description? How is <0> different from no property?
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
0 means disabled, no property means unchanged (compared to EEPROM).
Maybe have a boolean property instead then to say "mediatek,2ghz-disabled" ?
If zero is the only possible value, there is no need to put a number in there.
1 is also possible, which will force-enable the capability.
Ok, then both those values should be documented in the binding.
Quoted 8 lines
Related to this, Martin sent patches which add generic bindings for enabling 2 Ghz and 5 Ghz bands.
[RFC,1/3] Documentation: dt-bindings: add IEEE 802.11 binding documentation
https://patchwork.kernel.org/patch/9359833/[RFC,2/3] of: add IEEE 802.11 device configuration support code
https://patchwork.kernel.org/patch/9359837/I would prefer something more generic. Many tri-band routers split 5 GHz band into 2 sets of channels and they have separated radios for them.
E.g. Netgear R8000 has phy0 which should be used for higher part of 5 GHz band (channels 149+) and phy2 which should be used for lower part of 5 GHz band (channels from 36 to 48 or 64).
Quoted 7 lines
Quoted 3 lines
What do you think about some more flexible properties like:
ieee80211-min-center-freq ieee80211-max-center-freqwhat would happen if only one of these properties was given or would we forbid that (because the .dts should always describe the hardware, and if we describe a lower bound then we should also describe the upper bound)?
I didn't think about requiring both properties to be set, but if this is more correct from DT point of view, we can always require that. Let's see if we get DT guys opinion.
Quoted 6 lines
the benefits of your solution are:
- this would allow *enabling* bands as well (my proposal allows this as well, but the .dts is indeed a bit hard to read - unlike your solution which looks nice to me)
- we could handle this within generic cfg80211/mac80211 code instead of "duplicating" it per driver
i'm happy to hear that :)
Quoted 2 lines
should we describe the center freq in Hz or MHz (cfg80211's
ieee80211_channeluses the latter)?
Is there any case that may require HZ accuracy? I was thinking about using MHz. --
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): CACna6rzKc8kAnc2_Ca8pXtuu9Rw2mjqfV8VNumoF_E7GdvJx-g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH v3 1/3] Documentation: dt: net: add mt76 wireless device binding
Quoted 6 lines · Rafał Miłecki
Quoted 2 lines · Martin Blumenstingl
should we describe the center freq in Hz or MHz (cfg80211's
ieee80211_channeluses the latter)?Is there any case that may require HZ accuracy? I was thinking about using MHz.
Regulatory code uses KHz, so we may better do the same.
Signature · 1 line
Rafał
Felix Fietkau
maintainerPATCH v3 2/3 mt76: add common code shared between multiple chipsets
In reply to Felix FietkauFrom: Felix Fietkau <[email protected]>
This will be used by drivers for MT76x2e, MT7603e and MT7628
--- drivers/net/wireless/mediatek/mt76/debugfs.c | 76 ++++ drivers/net/wireless/mediatek/mt76/dma.c | 451 +++++++++++++++++++++++ drivers/net/wireless/mediatek/mt76/dma.h | 38 ++ drivers/net/wireless/mediatek/mt76/eeprom.c | 122 ++++++ drivers/net/wireless/mediatek/mt76/mac80211.c | 314 ++++++++++++++++ drivers/net/wireless/mediatek/mt76/mmio.c | 61 +++ drivers/net/wireless/mediatek/mt76/mt76.h | 355 ++++++++++++++++++ drivers/net/wireless/mediatek/mt76/trace.c | 23 ++ drivers/net/wireless/mediatek/mt76/trace.h | 71 ++++ drivers/net/wireless/mediatek/mt76/tx.c | 511 ++++++++++++++++++++++++++ drivers/net/wireless/mediatek/mt76/util.c | 78 ++++ drivers/net/wireless/mediatek/mt76/util.h | 44 +++ 12 files changed, 2144 insertions(+) create mode 100644 drivers/net/wireless/mediatek/mt76/debugfs.c create mode 100644 drivers/net/wireless/mediatek/mt76/dma.c create mode 100644 drivers/net/wireless/mediatek/mt76/dma.h create mode 100644 drivers/net/wireless/mediatek/mt76/eeprom.c create mode 100644 drivers/net/wireless/mediatek/mt76/mac80211.c create mode 100644 drivers/net/wireless/mediatek/mt76/mmio.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76.h create mode 100644 drivers/net/wireless/mediatek/mt76/trace.c create mode 100644 drivers/net/wireless/mediatek/mt76/trace.h create mode 100644 drivers/net/wireless/mediatek/mt76/tx.c create mode 100644 drivers/net/wireless/mediatek/mt76/util.c create mode 100644 drivers/net/wireless/mediatek/mt76/util.h
drivers/net/wireless/mediatek/mt76/debugfs.c new file +76 -0
@@ -0,0 +1,76 @@ +/* +* Copyright (C) 2016 Felix Fietkau <[email protected]> +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ +#include "mt76.h" + +static int +mt76_reg_set (void *data,u64 val) +{ +struct mt76_dev *dev = data; + + dev->bus->wr (dev, dev->debugfs_reg, val); +return 0 ; +} + +static int +mt76_reg_get (void *data,u64 *val) +{ +struct mt76_dev *dev = data; + + *val = dev->bus->rr (dev, dev->debugfs_reg); +return 0 ; +} + +DEFINE_SIMPLE_ATTRIBUTE (fops_regval, mt76_reg_get, mt76_reg_set,"0x%08llx\n" ); + +static int +mt76_queues_read (struct seq_file *s,void *data) +{ +struct mt76_dev *dev =dev_get_drvdata (s->private); +int i; + +for (i =0 ; i <ARRAY_SIZE (dev->q_tx); i++) { +struct mt76_queue *q = &dev->q_tx[i]; + +if (!q->ndesc) +continue ; + +seq_printf (s, +"%d: queued=%d head=%d tail=%d swq_queued=%d\n" , + i, q->queued, q->head, q->tail, q->swq_queued); + } + +return 0 ; +} + +struct dentry *mt76_register_debugfs (struct mt76_dev *dev) +{ +struct dentry *dir; + + dir =debugfs_create_dir ("mt76" , dev->hw->wiphy->debugfsdir); +if (!dir) +return NULL ; + +debugfs_create_u32 ("regidx" ,S_IRUSR |S_IWUSR , dir, &dev->debugfs_reg); +debugfs_create_file ("regval" ,S_IRUSR |S_IWUSR , dir, dev, + &fops_regval); +debugfs_create_blob ("eeprom" ,S_IRUSR , dir, &dev->eeprom); +if (dev->otp.data) +debugfs_create_blob ("otp" ,S_IRUSR , dir, &dev->otp); +debugfs_create_devm_seqfile (dev->dev,"queues" , dir, mt76_queues_read); + +return dir; +} +EXPORT_SYMBOL_GPL (mt76_register_debugfs);
drivers/net/wireless/mediatek/mt76/dma.c new file +451 -0
451 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/dma.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* Copyright (C) 2016 Felix Fietkau <[email protected]> +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ +#ifndef __MT76_DMA_H +#define __MT76_DMA_H + +#define MT_RING_SIZE 0x10 + +#define MT_DMA_CTL_SD_LEN1 GENMASK(13, 0) +#define MT_DMA_CTL_LAST_SEC1 BIT(14) +#define MT_DMA_CTL_BURST BIT(15) +#define MT_DMA_CTL_SD_LEN0 GENMASK(29, 16) +#define MT_DMA_CTL_LAST_SEC0 BIT(30) +#define MT_DMA_CTL_DMA_DONE BIT(31) + +struct mt76_desc { +__le32 buf0; +__le32 ctrl; +__le32 buf1; +__le32 info; +} __packed__aligned(4) ; + +int mt76_dma_attach (struct mt76_dev *dev); +void mt76_dma_cleanup (struct mt76_dev *dev); + +#endif
drivers/net/wireless/mediatek/mt76/eeprom.c new file +122 -0
122 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mac80211.c new file +314 -0
314 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mmio.c new file +61 -0
61 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76.h new file +355 -0
355 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/trace.c new file +23 -0
@@ -0,0 +1,23 @@ +/* +* Copyright (C) 2016 Felix Fietkau <[email protected]> +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include <linux/module.h> + +#ifndef __CHECKER__ +#define CREATE_TRACE_POINTS +#include "trace.h" + +#endif
drivers/net/wireless/mediatek/mt76/trace.h new file +71 -0
71 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/tx.c new file +511 -0
511 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/util.c new file +78 -0
78 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/util.h new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
2.8.4
Felix Fietkau
maintainerPATCH v3 3/3 mt76: add driver code for MT76x2e
In reply to Felix FietkauFrom: Felix Fietkau <[email protected]>
This is a 2x2 PCIe 802.11ac chipset by MediaTek
--- drivers/net/wireless/mediatek/Kconfig | 1 + drivers/net/wireless/mediatek/Makefile | 1 + drivers/net/wireless/mediatek/mt76/Kconfig | 10 + drivers/net/wireless/mediatek/mt76/Makefile | 15 + drivers/net/wireless/mediatek/mt76/mt76x2.h | 220 ++++++ drivers/net/wireless/mediatek/mt76/mt76x2_core.c | 83 +++ .../net/wireless/mediatek/mt76/mt76x2_debugfs.c | 101 +++ drivers/net/wireless/mediatek/mt76/mt76x2_dma.c | 184 +++++ drivers/net/wireless/mediatek/mt76/mt76x2_dma.h | 68 ++ drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c | 644 +++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h | 181 +++++ drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 765 +++++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_mac.c | 738 ++++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_mac.h | 189 +++++ drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 532 ++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c | 452 ++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_mcu.h | 136 ++++ drivers/net/wireless/mediatek/mt76/mt76x2_pci.c | 109 +++ drivers/net/wireless/mediatek/mt76/mt76x2_phy.c | 688 ++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_regs.h | 564 +++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_trace.c | 23 + drivers/net/wireless/mediatek/mt76/mt76x2_trace.h | 144 ++++ drivers/net/wireless/mediatek/mt76/mt76x2_tx.c | 262 +++++++ 23 files changed, 6110 insertions(+) create mode 100644 drivers/net/wireless/mediatek/mt76/Kconfig create mode 100644 drivers/net/wireless/mediatek/mt76/Makefile create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2.h create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_core.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_dma.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_dma.h create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_init.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_mac.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_mac.h create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_main.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_mcu.h create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_pci.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_phy.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_regs.h create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_trace.c create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_trace.h create mode 100644 drivers/net/wireless/mediatek/mt76/mt76x2_tx.c
drivers/net/wireless/mediatek/Kconfig +1 -0
@@ -11,4 +11,5 @@ config WLAN_VENDOR_MEDIATEK if WLAN_VENDOR_MEDIATEK source "drivers/net/wireless/mediatek/mt7601u/Kconfig" +source "drivers/net/wireless/mediatek/mt76/Kconfig" endif # WLAN_VENDOR_MEDIATEK
drivers/net/wireless/mediatek/Makefile +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_MT7601U) += mt7601u/ +obj-$(CONFIG_MT76_CORE) += mt76/
drivers/net/wireless/mediatek/mt76/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +config MT76_CORE + tristate + +config MT76x2E + tristate "MediaTek MT76x2E (PCIe) support" + select MT76_CORE + depends on MAC80211 + depends on PCI + ---help--- + This adds support for MT7612/MT7602/MT7662-based wireless PCIe devices.
drivers/net/wireless/mediatek/mt76/Makefile new file +15 -0
@@ -0,0 +1,15 @@ +obj-$(CONFIG_MT76_CORE) += mt76.o +obj-$(CONFIG_MT76x2E) += mt76x2e.o + +mt76-y := \ + mmio.o util.o trace.o dma.o mac80211.o debugfs.o eeprom.o tx.o + +CFLAGS_trace.o := -I$(src) + +mt76x2e-y := \ + mt76x2_pci.o mt76x2_dma.o \ + mt76x2_main.o mt76x2_init.o mt76x2_debugfs.o mt76x2_tx.o \ + mt76x2_core.o mt76x2_mac.o mt76x2_eeprom.o mt76x2_mcu.o mt76x2_phy.o \ + mt76x2_trace.o + +CFLAGS_mt76x2_trace.o := -I$(src)
drivers/net/wireless/mediatek/mt76/mt76x2.h new file +220 -0
220 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_core.c new file +83 -0
83 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c new file +101 -0
101 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_dma.c new file +184 -0
184 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_dma.h new file +68 -0
68 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c new file +644 -0
644 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h new file +181 -0
181 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_init.c new file +765 -0
765 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c new file +738 -0
722 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_mac.h new file +189 -0
189 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_main.c new file +532 -0
532 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c new file +452 -0
452 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_mcu.h new file +136 -0
136 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_pci.c new file +109 -0
109 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_phy.c new file +688 -0
688 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_regs.h new file +564 -0
564 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_trace.c new file +23 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/mediatek/mt76/mt76x2_trace.h new file +144 -0
144 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_tx.c new file +262 -0
262 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.8.4
Part of the diff is not shown here. View the raw message.
Re: [PATCH v3 3/3] mt76: add driver code for MT76x2e
First of all I would like to thank you Felix for this great job! Please find one simple question below.
2016-09-05 12:51 GMT+03:00 Felix Fietkau <[email protected]>:
Quoted 4 lines
From: Felix Fietkau <[email protected]>
This is a 2x2 PCIe 802.11ac chipset by MediaTek
[skip]
Quoted 71 lines
drivers/net/wireless/mediatek/mt76/mt76x2_init.c new file +71
-0+int mt76x2_init_hardware (struct mt76x2_dev *dev) +{ +static const u16 beacon_offsets[16 ] = { +/* 1024 byte per beacon */ +0xc000 , +0xc400 , +0xc800 , +0xcc00 , +0xd000 , +0xd400 , +0xd800 , +0xdc00 , + +/* BSS idx 8-15 not used for beacons */ +0xc000 , +0xc000 , +0xc000 , +0xc000 , +0xc000 , +0xc000 , +0xc000 , +0xc000 , + }; +u32 val; +int ret; + + dev->beacon_offsets = beacon_offsets; +tasklet_init (&dev->pre_tbtt_tasklet, mt76x2_pre_tbtt_tasklet, + (unsigned long ) dev); + + dev->chainmask =0x202 ; + dev->global_wcid.idx =255 ; + dev->global_wcid.hw_key_idx =-1 ; + dev->slottime =9 ; + + val =mt76_rr (dev,MT_WPDMA_GLO_CFG ); + val &=MT_WPDMA_GLO_CFG_DMA_BURST_SIZE | +MT_WPDMA_GLO_CFG_BIG_ENDIAN | +MT_WPDMA_GLO_CFG_HDR_SEG_LEN ; + val |=MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE ; +mt76_wr (dev,MT_WPDMA_GLO_CFG , val); + +mt76x2_reset_wlan (dev, true); +mt76x2_power_on (dev); + + ret =mt76x2_eeprom_init (dev); +if (ret) +return ret; + + ret =mt76x2_mac_reset (dev, true); +if (ret) +return ret; + + ret =mt76x2_dma_init (dev); +if (ret) +return ret; + +set_bit (MT76_STATE_INITIALIZED , &dev->mt76.state); + ret =mt76x2_mac_start (dev); +if (ret) +return ret; + + ret =mt76x2_mcu_init (dev); +if (ret) +return ret; + +mt76x2_mac_stop (dev, false); + dev->rxfilter =mt76_rr (dev,MT_RX_FILTR_CFG ); + +return 0 ; +}
[skip]
Quoted 58 lines
drivers/net/wireless/mediatek/mt76/mt76x2_init.c new file +58
-0+ +int mt76x2_register_device (struct mt76x2_dev *dev) +{ +struct ieee80211_hw *hw =mt76_hw (dev); +struct wiphy *wiphy = hw->wiphy; +void *status_fifo; +int fifo_size; +int i, ret; + + fifo_size =roundup_pow_of_two (32 *sizeof (struct mt76x2_tx_status )); + status_fifo =devm_kzalloc (dev->mt76.dev, fifo_size,GFP_KERNEL ); +if (!status_fifo) +return -ENOMEM ; + +kfifo_init (&dev->txstatus_fifo, status_fifo, fifo_size); + + ret =mt76x2_init_hardware (dev); +if (ret) +return ret; + + hw->queues =4 ; + hw->max_rates =1 ; + hw->max_report_rates =7 ; + hw->max_rate_tries =1 ; + hw->extra_tx_headroom =2 ; + + hw->sta_data_size =sizeof (struct mt76x2_sta ); + hw->vif_data_size =sizeof (struct mt76x2_vif ); + +for (i =0 ; i <ARRAY_SIZE (dev->macaddr_list); i++) { +u8 *addr = dev->macaddr_list[i].addr; + +memcpy (addr, dev->mt76.macaddr,ETH_ALEN ); + +if (!i) +continue ; + + addr[0 ] |=BIT (1 ); + addr[0 ] ^= ((i -1 ) <<2 ); + } + wiphy->addresses = dev->macaddr_list; + wiphy->n_addresses =ARRAY_SIZE (dev->macaddr_list); + + wiphy->iface_combinations = if_comb; + wiphy->n_iface_combinations =ARRAY_SIZE (if_comb); + +wiphy_ext_feature_set (wiphy,NL80211_EXT_FEATURE_VHT_IBSS ); + +ieee80211_hw_set (hw,SUPPORTS_HT_CCK_RATES ); +INIT_DELAYED_WORK (&dev->cal_work, mt76x2_phy_calibrate); +INIT_DELAYED_WORK (&dev->mac_work, mt76x2_mac_work); + + dev->mt76.sband_2g.sband.ht_cap.cap |=IEEE80211_HT_CAP_LDPC_CODING ; + dev->mt76.sband_5g.sband.ht_cap.cap |=IEEE80211_HT_CAP_LDPC_CODING ; + + ret =mt76_register_device (&dev->mt76, true, mt76x2_rates, +ARRAY_SIZE (mt76x2_rates)); +if (ret)
drivers/net/wireless/mediatek/mt76/mt76x2_init.c line 763
Quoted 10 lines
drivers/net/wireless/mediatek/mt76/mt76x2_init.c new file +10
-0+ goto fail; + +mt76x2_init_debugfs (dev); + +return 0 ; + +fail: +mt76x2_stop_hardware (dev); +return ret; +}
Just curious, almost full chip initialization performed in probe procedure, why not do that in start() callback? In such case we could fully restart chip without module reloading, just with ifdown/ifup circle.
Signature · 1 line
Sergey
Felix Fietkau
maintainerRe: [PATCH v3 3/3] mt76: add driver code for MT76x2e
Quoted 65 lines · Sergey Ryazanov
Quoted 65 lines
drivers/net/wireless/mediatek/mt76/mt76x2_init.c new file +65
-0+ +int mt76x2_register_device (struct mt76x2_dev *dev) +{ +struct ieee80211_hw *hw =mt76_hw (dev); +struct wiphy *wiphy = hw->wiphy; +void *status_fifo; +int fifo_size; +int i, ret; + + fifo_size =roundup_pow_of_two (32 *sizeof (struct mt76x2_tx_status )); + status_fifo =devm_kzalloc (dev->mt76.dev, fifo_size,GFP_KERNEL ); +if (!status_fifo) +return -ENOMEM ; + +kfifo_init (&dev->txstatus_fifo, status_fifo, fifo_size); + + ret =mt76x2_init_hardware (dev); +if (ret) +return ret; + + hw->queues =4 ; + hw->max_rates =1 ; + hw->max_report_rates =7 ; + hw->max_rate_tries =1 ; + hw->extra_tx_headroom =2 ; + + hw->sta_data_size =sizeof (struct mt76x2_sta ); + hw->vif_data_size =sizeof (struct mt76x2_vif ); + +for (i =0 ; i <ARRAY_SIZE (dev->macaddr_list); i++) { +u8 *addr = dev->macaddr_list[i].addr; + +memcpy (addr, dev->mt76.macaddr,ETH_ALEN ); + +if (!i) +continue ; + + addr[0 ] |=BIT (1 ); + addr[0 ] ^= ((i -1 ) <<2 ); + } + wiphy->addresses = dev->macaddr_list; + wiphy->n_addresses =ARRAY_SIZE (dev->macaddr_list); + + wiphy->iface_combinations = if_comb; + wiphy->n_iface_combinations =ARRAY_SIZE (if_comb); + +wiphy_ext_feature_set (wiphy,NL80211_EXT_FEATURE_VHT_IBSS ); + +ieee80211_hw_set (hw,SUPPORTS_HT_CCK_RATES ); +INIT_DELAYED_WORK (&dev->cal_work, mt76x2_phy_calibrate); +INIT_DELAYED_WORK (&dev->mac_work, mt76x2_mac_work); + + dev->mt76.sband_2g.sband.ht_cap.cap |=IEEE80211_HT_CAP_LDPC_CODING ; + dev->mt76.sband_5g.sband.ht_cap.cap |=IEEE80211_HT_CAP_LDPC_CODING ; + + ret =mt76_register_device (&dev->mt76, true, mt76x2_rates, +ARRAY_SIZE (mt76x2_rates)); +if (ret) + goto fail; + +mt76x2_init_debugfs (dev); + +return 0 ; + +fail:
Quoted 8 lines
drivers/net/wireless/mediatek/mt76/mt76x2_init.c line 763
Quoted 3 lines
drivers/net/wireless/mediatek/mt76/mt76x2_init.c new file +3
-0+mt76x2_stop_hardware (dev); +return ret; +}Just curious, almost full chip initialization performed in probe procedure, why not do that in
start()callback? In such case we could fully restart chip without module reloading, just with ifdown/ifup circle.
Last time I tried that I ran into some weird chip quirks. I do think it's a good idea but I'd rather see this merged first and try again to rework it when I have some more time to figure out what's going on.
- Felix
Re: [PATCH v3 3/3] mt76: add driver code for MT76x2e
2016-09-08 11:25 GMT+03:00 Felix Fietkau <[email protected]>:
Quoted 74 lines · Sergey Ryazanov
Quoted 65 lines
Quoted 65 lines
drivers/net/wireless/mediatek/mt76/mt76x2_init.c new file +65
-0+ +int mt76x2_register_device (struct mt76x2_dev *dev) +{ +struct ieee80211_hw *hw =mt76_hw (dev); +struct wiphy *wiphy = hw->wiphy; +void *status_fifo; +int fifo_size; +int i, ret; + + fifo_size =roundup_pow_of_two (32 *sizeof (struct mt76x2_tx_status )); + status_fifo =devm_kzalloc (dev->mt76.dev, fifo_size,GFP_KERNEL ); +if (!status_fifo) +return -ENOMEM ; + +kfifo_init (&dev->txstatus_fifo, status_fifo, fifo_size); + + ret =mt76x2_init_hardware (dev); +if (ret) +return ret; + + hw->queues =4 ; + hw->max_rates =1 ; + hw->max_report_rates =7 ; + hw->max_rate_tries =1 ; + hw->extra_tx_headroom =2 ; + + hw->sta_data_size =sizeof (struct mt76x2_sta ); + hw->vif_data_size =sizeof (struct mt76x2_vif ); + +for (i =0 ; i <ARRAY_SIZE (dev->macaddr_list); i++) { +u8 *addr = dev->macaddr_list[i].addr; + +memcpy (addr, dev->mt76.macaddr,ETH_ALEN ); + +if (!i) +continue ; + + addr[0 ] |=BIT (1 ); + addr[0 ] ^= ((i -1 ) <<2 ); + } + wiphy->addresses = dev->macaddr_list; + wiphy->n_addresses =ARRAY_SIZE (dev->macaddr_list); + + wiphy->iface_combinations = if_comb; + wiphy->n_iface_combinations =ARRAY_SIZE (if_comb); + +wiphy_ext_feature_set (wiphy,NL80211_EXT_FEATURE_VHT_IBSS ); + +ieee80211_hw_set (hw,SUPPORTS_HT_CCK_RATES ); +INIT_DELAYED_WORK (&dev->cal_work, mt76x2_phy_calibrate); +INIT_DELAYED_WORK (&dev->mac_work, mt76x2_mac_work); + + dev->mt76.sband_2g.sband.ht_cap.cap |=IEEE80211_HT_CAP_LDPC_CODING ; + dev->mt76.sband_5g.sband.ht_cap.cap |=IEEE80211_HT_CAP_LDPC_CODING ; + + ret =mt76_register_device (&dev->mt76, true, mt76x2_rates, +ARRAY_SIZE (mt76x2_rates)); +if (ret) + goto fail; + +mt76x2_init_debugfs (dev); + +return 0 ; + +fail:Quoted 8 lines
drivers/net/wireless/mediatek/mt76/mt76x2_init.c line 763
Quoted 3 lines
drivers/net/wireless/mediatek/mt76/mt76x2_init.c new file +3
-0+mt76x2_stop_hardware (dev); +return ret; +}Just curious, almost full chip initialization performed in probe procedure, why not do that in
start()callback? In such case we could fully restart chip without module reloading, just with ifdown/ifup circle.
Quoted 4 lines
Last time I tried that I ran into some weird chip quirks. I do think it's a good idea but I'd rather see this merged first and try again to rework it when I have some more time to figure out what's going on.
Got it. Thank you for explanation.
Signature · 1 line
Sergey
Re: [v3,3/3] mt76: add driver code for MT76x2e
In reply to Felix FietkauQuoted 5 lines · Felix Fietkau
From: Felix Fietkau <[email protected]>
This is a 2x2 PCIe 802.11ac chipset by MediaTek
Signed-off-by Felix Fietkau <[email protected]>
A summary of what feature work would be nice to have. Also if there's something notable which is not working it's good also to mention that.
I don't know why I didn't see this earlier but this fails to build for me:
ERROR: "mtd_read" [drivers/net/wireless/mediatek/mt76/mt76.ko] undefined!
ERROR: "put_mtd_device" [drivers/net/wireless/mediatek/mt76/mt76.ko] undefined!
ERROR: "get_mtd_device_nm" [drivers/net/wireless/mediatek/mt76/mt76.ko] undefined!
Dependency to mtd missing?
Signature · 6 lines
https://patchwork.kernel.org/patch/9313311/ Documentation about submitting wireless patches and checking status from patchwork: https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Felix Fietkau
maintainerRe: [v3,3/3] mt76: add driver code for MT76x2e
Quoted 10 lines · Kalle Valo
Quoted 5 lines · Felix Fietkau
From: Felix Fietkau <[email protected]>
This is a 2x2 PCIe 802.11ac chipset by MediaTek
Signed-off-by Felix Fietkau <[email protected]>A summary of what feature work would be nice to have. Also if there's something notable which is not working it's good also to mention that.
Quoted 7 lines
I don't know why I didn't see this earlier but this fails to build for me:
ERROR: "
mtd_read" [drivers/net/wireless/mediatek/mt76/mt76.ko] undefined!
ERROR: "put_mtd_device" [drivers/net/wireless/mediatek/mt76/mt76.ko] undefined!
ERROR: "get_mtd_device_nm" [drivers/net/wireless/mediatek/mt76/mt76.ko] undefined!Dependency to mtd missing?
Will fix the #ifdef in v4.
- Felix
Re: [v3,3/3] mt76: add driver code for MT76x2e
In reply to Felix FietkauQuoted 5 lines · Felix Fietkau
From: Felix Fietkau <[email protected]>
This is a 2x2 PCIe 802.11ac chipset by MediaTek
Signed-off-by Felix Fietkau <[email protected]>
I already asked this in v2, but what about firmware images? Will they be available from linux-firmware.git?
Signature · 6 lines
https://patchwork.kernel.org/patch/9313311/ Documentation about submitting wireless patches and checking status from patchwork: https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Felix Fietkau
maintainerRe: [v3,3/3] mt76: add driver code for MT76x2e
Quoted 9 lines · Kalle Valo
Quoted 5 lines · Felix Fietkau
From: Felix Fietkau <[email protected]>
This is a 2x2 PCIe 802.11ac chipset by MediaTek
Signed-off-by Felix Fietkau <[email protected]>I already asked this in v2, but what about firmware images? Will they be available from linux-firmware.git?
Seems that I forgot to submit it to linux-firmware@. I already had permission from MediaTek to do so, so I just took sent it out.
- Felix