mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 18:38:10 +00:00 
			
		
		
		
	Compare commits
	
		
			14 Commits
		
	
	
		
			v2.4.0-rc2
			...
			v2.4.1
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 6d9d4ab47a | ||
|   | 0406b7cb95 | ||
|   | 211e9c39e9 | ||
|   | 64009d7d2a | ||
|   | 70e922f609 | ||
|   | b41b53b9d8 | ||
|   | 92d03f5283 | ||
|   | 8529d7471a | ||
|   | 02c0af4bb4 | ||
|   | 8c987c4949 | ||
|   | a686beebbb | ||
|   | ec8d056cc8 | ||
|   | 1d4b8ab7ff | ||
|   | f87960eadc | 
							
								
								
									
										2
									
								
								.github/workflows/build-dev.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/build-dev.yml
									
									
									
									
										vendored
									
									
								
							| @@ -11,7 +11,7 @@ jobs: | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         target: ['cig_wf188n', 'cig_wf194c', 'cig_wf194c4', 'cig_wf160d', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'edgecore_ecw5410', 'edgecore_oap100', 'edgecore_ssw2ac2600', 'edgecore_spw2ac1200', 'edgecore_spw2ac1200-lan-poe', 'hfcl_ion4', 'indio_um-305ac', 'linksys_ea6350-v4', 'linksys_e8450-ubi', 'linksys_ea8300', 'tp-link_ec420-g1', 'tplink_ex227', 'tplink_ex228', 'tplink_ex447', 'wallys_dr40x9', 'wallys_dr6018', 'wallys_dr6018_v4' ] | ||||
|         target: ['cig_wf188n', 'cig_wf194c', 'cig_wf194c4', 'cig_wf160d', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'edgecore_ecw5410', 'edgecore_oap100', 'edgecore_ssw2ac2600', 'edgecore_spw2ac1200', 'edgecore_spw2ac1200-lan-poe', 'hfcl_ion4', 'hfcl_ion4xe', 'hfcl_ion4xi', 'indio_um-305ac', 'linksys_ea6350-v4', 'linksys_e8450-ubi', 'linksys_ea8300', 'tp-link_ec420-g1', 'tplink_ex227', 'tplink_ex228', 'tplink_ex447', 'wallys_dr40x9', 'wallys_dr6018', 'wallys_dr6018_v4' ] | ||||
|  | ||||
|     steps: | ||||
|     - uses: actions/checkout@v2 | ||||
|   | ||||
							
								
								
									
										1088
									
								
								backports/0058-kernel-backport-napi-threading-patches.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1088
									
								
								backports/0058-kernel-backport-napi-threading-patches.patch
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -5,8 +5,7 @@ RUN apt-get update \ | ||||
|     && apt-get install -y \ | ||||
|             time git-core build-essential gcc-multilib clang \ | ||||
|             libncurses5-dev zlib1g-dev gawk flex gettext wget unzip python \ | ||||
|             python3 python3-pip python3-yaml libssl-dev rsync llvm llvm-12 \ | ||||
|             clang-12 \ | ||||
|             python3 python3-pip python3-yaml libssl-dev rsync \ | ||||
|     && apt-get clean | ||||
| RUN git config --global user.email "you@example.com" | ||||
| RUN git config --global user.name "Your Name" | ||||
|   | ||||
| @@ -2,35 +2,43 @@ Index: qca-ssdk/include/hsl/phy/hsl_phy.h | ||||
| =================================================================== | ||||
| --- qca-ssdk.orig/include/hsl/phy/hsl_phy.h | ||||
| +++ qca-ssdk/include/hsl/phy/hsl_phy.h | ||||
| @@ -541,6 +541,7 @@ typedef struct { | ||||
| @@ -562,6 +562,7 @@ typedef struct { | ||||
|  #define QCA8033_PHY             0x004DD074 | ||||
|  #define QCA8035_PHY             0x004DD072 | ||||
|  /*qca808x_start*/ | ||||
| +#define QCA8081_PHY             0x004DD100 | ||||
|  #define QCA8081_PHY_V1_1        0x004DD101 | ||||
|  #define INVALID_PHY_ID          0 | ||||
|  #define INVALID_PHY_ID          0xFFFFFFFF | ||||
|   | ||||
| @@ -559,6 +560,7 @@ typedef struct { | ||||
| @@ -576,11 +577,14 @@ typedef struct { | ||||
|  #define AQUANTIA_PHY_109        0x03a1b502 | ||||
|  #define AQUANTIA_PHY_111        0x03a1b610 | ||||
|  #define AQUANTIA_PHY_111B0      0x03a1b612 | ||||
| +#define AQUANTIA_PHY_111C	0x03a1b7e2 | ||||
|  #define AQUANTIA_PHY_112        0x03a1b660 | ||||
|  #define AQUANTIA_PHY_113C_A0    0x31c31C10 | ||||
|  #define AQUANTIA_PHY_113C_A1    0x31c31C11 | ||||
|  #define AQUANTIA_PHY_112C       0x03a1b792 | ||||
| +#define AQUANTIA_PHY_114C       0x31c31C22 | ||||
|   | ||||
| +#define AQUANTIA_PHY_114C       0x31c31C22 | ||||
| + | ||||
|  #define PHY_805XV2              0x004DD082 | ||||
|  #define PHY_805XV1              0x004DD081 | ||||
|  /*qca808x_start*/ | ||||
| Index: qca-ssdk/src/hsl/phy/hsl_phy.c | ||||
| =================================================================== | ||||
| --- qca-ssdk.orig/src/hsl/phy/hsl_phy.c | ||||
| +++ qca-ssdk/src/hsl/phy/hsl_phy.c | ||||
| @@ -231,6 +231,7 @@ phy_type_t hsl_phytype_get_by_phyid(a_ui | ||||
| @@ -231,6 +231,8 @@ phy_type_t hsl_phytype_get_by_phyid(a_ui | ||||
|  		case AQUANTIA_PHY_108: | ||||
|  		case AQUANTIA_PHY_109: | ||||
|  		case AQUANTIA_PHY_111: | ||||
| +		case AQUANTIA_PHY_111C: | ||||
| +		case AQUANTIA_PHY_114C: | ||||
|  		case AQUANTIA_PHY_111B0: | ||||
|  		case AQUANTIA_PHY_112: | ||||
|  		case AQUANTIA_PHY_113C_A0: | ||||
| @@ -250,6 +251,7 @@ phy_type_t hsl_phytype_get_by_phyid(a_ui | ||||
| @@ -250,6 +252,7 @@ phy_type_t hsl_phytype_get_by_phyid(a_ui | ||||
|  			phytype = MPGE_PHY_CHIP; | ||||
|  			break; | ||||
|  /*qca808x_start*/ | ||||
|   | ||||
							
								
								
									
										14
									
								
								feeds/ipq807x/qca-ssdk/patches/200-eap101.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								feeds/ipq807x/qca-ssdk/patches/200-eap101.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| diff --git a/src/hsl/phy/hsl_phy.c b/src/hsl/phy/hsl_phy.c | ||||
| index 5866a522..41227581 100755 | ||||
| --- a/src/hsl/phy/hsl_phy.c | ||||
| +++ b/src/hsl/phy/hsl_phy.c | ||||
| @@ -608,6 +608,9 @@ hsl_port_phyid_get(a_uint32_t dev_id, fal_port_t port_id) | ||||
|  		return INVALID_PHY_ID; | ||||
|  	} | ||||
|   | ||||
| +	if (phy_id == MALIBU5PORT_PHY && of_machine_is_compatible("edgecore,eap101")) | ||||
| +		phy_id = MALIBU2PORT_PHY; | ||||
| + | ||||
|  	return phy_id; | ||||
|  } | ||||
|   | ||||
| @@ -6,7 +6,7 @@ PKG_RELEASE:=1 | ||||
| PKG_SOURCE_URL=https://github.com/blogic/ucentral-client.git | ||||
| PKG_SOURCE_PROTO:=git | ||||
| PKG_SOURCE_DATE:=2021-02-15 | ||||
| PKG_SOURCE_VERSION:=e27356216c6baecda9424b81ad90242505e16f08 | ||||
| PKG_SOURCE_VERSION:=b4e8fc882634b407e7f2f7c859d7ecf078264261 | ||||
|  | ||||
| PKG_LICENSE:=BSD-3-Clause | ||||
| PKG_MAINTAINER:=John Crispin <john@phrozen.org> | ||||
|   | ||||
| @@ -9,7 +9,7 @@ PKG_MAINTAINER:=John Crispin <john@phrozen.org> | ||||
| PKG_SOURCE_URL=https://github.com/blogic/udnssnoop.git | ||||
| PKG_SOURCE_PROTO:=git | ||||
| PKG_SOURCE_DATE:=2021-04-12 | ||||
| PKG_SOURCE_VERSION:=852a5246af43d321905979fc850e654718a56061 | ||||
| PKG_SOURCE_VERSION:=67e1e5f0bfc12222aa59c54e7066b1c00a680e56 | ||||
|  | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
| include $(INCLUDE_DIR)/cmake.mk | ||||
|   | ||||
							
								
								
									
										701
									
								
								feeds/wifi-ath10k/ath10k-ct-firmware/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										701
									
								
								feeds/wifi-ath10k/ath10k-ct-firmware/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,701 @@ | ||||
| include $(TOPDIR)/rules.mk | ||||
|  | ||||
| PKG_NAME:=ath10k-ct-firmware | ||||
| PKG_VERSION:=2020-10-07 | ||||
| PKG_RELEASE:=2 | ||||
| CTVER1=021 | ||||
| CTVER2=021 | ||||
|  | ||||
| # From fw_lede.bash, or can do it manually as well. | ||||
| H988XFC=a4c3d1e2fb80f6b8b9738c7189795ab9505e6c09efc12ba5f08ee7f49e934239 | ||||
| H988XFCH=93108bd0870652860cdb57749f5a12205ecb15bb1f129d916ad73b6f06406c82 | ||||
| H9887FC=459692deb186a63ab8eeddb7ad5d54779266e68ca686e7c46062554db6dca12b | ||||
| H9887FCH=fd126a457d0927d0c8ea10d66ef5b67d5e1e0741f8692bb3016bb602d0af3098 | ||||
| H9980FC=52300e9d128c3d506e0b133d7a7964df3115f9511f1b574ef2a0767972c063bd | ||||
| H9980FCH=9c20c3a44b701f8fef0fe02f156e382b36b717fb56c76d540f6eac2077ec189b | ||||
| H9980CH=55f27045e7cf87a6a5656a050771d6d7a6197153a0737288a702c0836d5c6572 | ||||
| H9980FHQ=add509b2a15ba90869f403c2e4440dbb91bd7037188d8468249cf1263adfd44e | ||||
| H9984FC=e6354a1547a308b4b0fe4cbc29693848c234acedd9e7a483a1b4fb5f9bbf0dc0 | ||||
| H9984FCH=6e19ecd0b001ffb594a8b033deb2007595b8c0402402789b7de55b208639ebec | ||||
| H9984CH=7b6fdf3d970f3eff7c34df476c934a9bebb4f289b7968067950d31b82c71bb07 | ||||
| H9984FHQ=f6a5d5a3a7b2c9267dc31673a19ee3b5312a2f84f26123cb5e8c000428ed76d2 | ||||
| H4019FC=cde992cb328680e81cf85e195554699bcceef065c0c696ce4ef90c3311ab11fb | ||||
| H4019FCH=818afeb1226389357dfde754d641f936fb82ebe78607f10e15efd5c952a54f48 | ||||
| H4019CH=30ba10f0d82116c6617cb58c3df5cc81e5ed8f29dbc8f95c0ca9c5013ce4f702 | ||||
| H4019FHQ=8e4161f7bed5bd56513ca5caab582a6eee64e9e14a69f4de67587563b7b4d735 | ||||
| H9888FC=d24e66bdb2f1098a2e06ff20fe037e31937e1a483e87c68827830513b4233b5d | ||||
| H9888FCH=5891e1c184da433ecc12ca0176ca89a77f7bc2b675576698b69bc93d46b77042 | ||||
| H9888CH=b94f46cdda6171e5f566b1cdd6aafd68ff1a4f7e8a27762b90eb5d4f03839d99 | ||||
| H9888FHQ=3cc81f8707bf5ba63bc9ffc14578c77637cae0e15766ae146af02eefb9ab7bfd | ||||
|  | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
|  | ||||
| ATH10K_FIRMWARE_REV:=d622d160e9f552ead68d9ae81b715422892dc2ef | ||||
| ATH10K_FIRMWARE_URL:=@GITHUB/kvalo/ath10k-firmware/$(ATH10K_FIRMWARE_REV) | ||||
|  | ||||
| QCA9887_BOARD_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca9887-board.bin | ||||
| define Download/qca9887-board | ||||
|   FILE:=$(QCA9887_BOARD_FILE) | ||||
|   URL:=$(ATH10K_FIRMWARE_URL)/QCA9887/hw1.0 | ||||
|   URL_FILE:=board.bin | ||||
|   HASH:=cf4df099f6ee05c181f55ce17297a1d32c61d725eb96246fd315ad5587c42426 | ||||
| endef | ||||
| $(eval $(call Download,qca9887-board)) | ||||
|  | ||||
| QCA988X_BOARD_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca988x-board.bin | ||||
| define Download/qca988x-board | ||||
|   FILE:=$(QCA988X_BOARD_FILE) | ||||
|   URL:=$(ATH10K_FIRMWARE_URL)/QCA988X/hw2.0 | ||||
|   URL_FILE:=board.bin | ||||
|   HASH:=5b5b380333c2dd3b6ce67f30e2f7008f4020bf594970d3b464fd8d4a80fcd880 | ||||
| endef | ||||
| $(eval $(call Download,qca988x-board)) | ||||
|  | ||||
| QCA99X0_BOARD_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca99x0-board.bin | ||||
| define Download/qca99x0-board | ||||
|   FILE:=$(QCA99X0_BOARD_FILE) | ||||
|   URL:=$(ATH10K_FIRMWARE_URL)/QCA99X0/hw2.0 | ||||
|   URL_FILE:=boardData_AR900B_CUS239_5G_v2_001.bin | ||||
|   HASH:=3bf7561ee373b369025dcd366d276d038a97d3397ccae41ce841d98a58b30aff | ||||
| endef | ||||
| $(eval $(call Download,qca99x0-board)) | ||||
|  | ||||
| QCA99X0_BOARD2_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe | ||||
| QCA99X0_BOARD2_FILE:=ath10k-firmware-$(QCA99X0_BOARD2_REV)-qca99x0-board-2.bin | ||||
| define Download/qca99x0-board2 | ||||
|   FILE:=$(QCA99X0_BOARD2_FILE) | ||||
|   URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0 | ||||
|   URL_FILE:=board-2.bin?id=$(QCA99X0_BOARD2_REV) | ||||
|   HASH:=03711ac21e60ef59d3815e235eb721c0c22851b5410299411085aa6f2af45401 | ||||
| endef | ||||
| $(eval $(call Download,qca99x0-board2)) | ||||
|  | ||||
| QCA9984_BOARD2_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca9984-board-2.bin | ||||
| define Download/qca9984-board2 | ||||
|   FILE:=$(QCA9984_BOARD2_FILE) | ||||
|   URL:=$(ATH10K_FIRMWARE_URL)/QCA9984/hw1.0 | ||||
|   URL_FILE:=board-2.bin | ||||
|   HASH:=0d6d46cf0467185e3959ce3cb69e2415be6e48ab8a4bee3eb400edbe48cb9c25 | ||||
| endef | ||||
| $(eval $(call Download,qca9984-board2)) | ||||
|  | ||||
| QCA4019_BOARD2_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca4019-board-2.bin | ||||
| define Download/qca4019-board2 | ||||
|   FILE:=$(QCA4019_BOARD2_FILE) | ||||
|   URL:=$(ATH10K_FIRMWARE_URL)/QCA4019/hw1.0 | ||||
|   URL_FILE:=board-2.bin | ||||
|   HASH:=94b66aa4ddbed5110a96364d3c7b4ebcb320e3ac4e8697660b277e76077bc338 | ||||
| endef | ||||
| $(eval $(call Download,qca4019-board2)) | ||||
|  | ||||
| QCA9888_BOARD2_FILE:=ath10k-firmware-$(ATH10K_FIRMWARE_REV)-qca9888-board-2.bin | ||||
| define Download/qca9888-board2 | ||||
|   FILE:=$(QCA9888_BOARD2_FILE) | ||||
|   URL:=$(ATH10K_FIRMWARE_URL)/QCA9888/hw2.0 | ||||
|   URL_FILE:=board-2.bin | ||||
|   HASH:=5b871bb567f64525ca45adb88063211de472015d09e0f9aa3fa61ab71c8fdfd3 | ||||
| endef | ||||
| $(eval $(call Download,qca9888-board2)) | ||||
|  | ||||
| CT_FIRMWARE_FILE = $(1)-$($(1)_FIRMWARE_FILE_CT) | ||||
| CT_FIRMWARE_FILE_FULL_HTT = $(1)-$($(1)_FIRMWARE_FILE_CT_FULL_HTT) | ||||
| CT_FIRMWARE_FILE_HTT = $(1)-$($(1)_FIRMWARE_FILE_CT_HTT) | ||||
|  | ||||
| define Download/ct-firmware | ||||
|   URL:=https://www.candelatech.com/downloads/$(2) | ||||
|   FILE:=$(call CT_FIRMWARE_FILE,$(1)) | ||||
|   URL_FILE:=$($(1)_FIRMWARE_FILE_CT) | ||||
| endef | ||||
|  | ||||
| define Download/ct-firmware-full-htt | ||||
|   URL:=https://www.candelatech.com/downloads/$(2) | ||||
|   FILE:=$(call CT_FIRMWARE_FILE_FULL_HTT,$(1)) | ||||
|   URL_FILE:=$($(1)_FIRMWARE_FILE_CT_FULL_HTT) | ||||
| endef | ||||
|  | ||||
| define Download/ct-firmware-htt | ||||
|   URL:=https://www.candelatech.com/downloads/$(2) | ||||
|   FILE:=$(call CT_FIRMWARE_FILE_HTT,$(1)) | ||||
|   URL_FILE:=$($(1)_FIRMWARE_FILE_CT_HTT) | ||||
| endef | ||||
|  | ||||
| QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.$(CTVER1) | ||||
| define Download/ath10k-firmware-qca988x-ct | ||||
|   $(call Download/ct-firmware,QCA988X,) | ||||
|   HASH:=$(H988XFC) | ||||
| endef | ||||
| $(eval $(call Download,ath10k-firmware-qca988x-ct)) | ||||
|  | ||||
| QCA988X_FIRMWARE_FILE_CT_FULL_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.$(CTVER1) | ||||
| define Download/ath10k-firmware-qca988x-ct-full-htt | ||||
|   $(call Download/ct-firmware-full-htt,QCA988X,) | ||||
|   HASH:=$(H988XFCH) | ||||
| endef | ||||
| $(eval $(call Download,ath10k-firmware-qca988x-ct-full-htt)) | ||||
|  | ||||
|  | ||||
| QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.$(CTVER1) | ||||
| define Download/ath10k-firmware-qca9887-ct | ||||
|   $(call Download/ct-firmware,QCA9887,ath10k-9887) | ||||
|   HASH:=$(H9887FC) | ||||
| endef | ||||
| $(eval $(call Download,ath10k-firmware-qca9887-ct)) | ||||
|  | ||||
| QCA9887_FIRMWARE_FILE_CT_FULL_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.$(CTVER1) | ||||
| define Download/ath10k-firmware-qca9887-ct-full-htt | ||||
|   $(call Download/ct-firmware-full-htt,QCA9887,ath10k-9887) | ||||
|   HASH:=$(H9887FCH) | ||||
| endef | ||||
| $(eval $(call Download,ath10k-firmware-qca9887-ct-full-htt)) | ||||
|  | ||||
|  | ||||
| QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.$(CTVER2) | ||||
| define Download/ath10k-firmware-qca99x0-ct | ||||
|   $(call Download/ct-firmware,QCA99X0,ath10k-10-4b) | ||||
|   HASH:=$(H9980FC) | ||||
| endef | ||||
| $(eval $(call Download,ath10k-firmware-qca99x0-ct)) | ||||
|  | ||||
| QCA99X0_FIRMWARE_FILE_CT_FULL_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.$(CTVER2) | ||||
| define Download/ath10k-firmware-qca99x0-ct-full-htt | ||||
|   $(call Download/ct-firmware-full-htt,QCA99X0,ath10k-10-4b) | ||||
|   HASH:=$(H9980FCH) | ||||
| endef | ||||
| $(eval $(call Download,ath10k-firmware-qca99x0-ct-full-htt)) | ||||
|  | ||||
| QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.$(CTVER2) | ||||
| define Download/ath10k-firmware-qca99x0-ct-htt | ||||
|   $(call Download/ct-firmware-htt,QCA99X0,ath10k-10-4b) | ||||
|   HASH:=$(H9980CH) | ||||
| endef | ||||
| $(eval $(call Download,ath10k-firmware-qca99x0-ct-htt)) | ||||
|  | ||||
|  | ||||
| QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.$(CTVER2) | ||||
| define Download/ath10k-firmware-qca9984-ct | ||||
|   $(call Download/ct-firmware,QCA9984,ath10k-9984-10-4b) | ||||
|   HASH:=$(H9984FC) | ||||
| endef | ||||
| $(eval $(call Download,ath10k-firmware-qca9984-ct)) | ||||
|  | ||||
| QCA9984_FIRMWARE_FILE_CT_FULL_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.$(CTVER2) | ||||
| define Download/ath10k-firmware-qca9984-ct-full-htt | ||||
|   $(call Download/ct-firmware-full-htt,QCA9984,ath10k-9984-10-4b) | ||||
|   HASH:=$(H9984FCH) | ||||
| endef | ||||
| $(eval $(call Download,ath10k-firmware-qca9984-ct-full-htt)) | ||||
|  | ||||
| QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.$(CTVER2) | ||||
| define Download/ath10k-firmware-qca9984-ct-htt | ||||
|   $(call Download/ct-firmware-htt,QCA9984,ath10k-9984-10-4b) | ||||
|   HASH:=$(H9984CH) | ||||
| endef | ||||
| $(eval $(call Download,ath10k-firmware-qca9984-ct-htt)) | ||||
|  | ||||
|  | ||||
| QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.$(CTVER2) | ||||
| define Download/ath10k-firmware-qca4019-ct | ||||
|   $(call Download/ct-firmware,QCA4019,ath10k-4019-10-4b) | ||||
|   HASH:=$(H4019FC) | ||||
| endef | ||||
| $(eval $(call Download,ath10k-firmware-qca4019-ct)) | ||||
|  | ||||
| QCA4019_FIRMWARE_FILE_CT_FULL_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.$(CTVER2) | ||||
| define Download/ath10k-firmware-qca4019-ct-full-htt | ||||
|   $(call Download/ct-firmware-full-htt,QCA4019,ath10k-4019-10-4b) | ||||
|   HASH:=$(H4019FCH) | ||||
| endef | ||||
| $(eval $(call Download,ath10k-firmware-qca4019-ct-full-htt)) | ||||
|  | ||||
| QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.$(CTVER2) | ||||
| define Download/ath10k-firmware-qca4019-ct-htt | ||||
|   $(call Download/ct-firmware-htt,QCA4019,ath10k-4019-10-4b) | ||||
|   HASH:=$(H4019CH) | ||||
| endef | ||||
| $(eval $(call Download,ath10k-firmware-qca4019-ct-htt)) | ||||
|  | ||||
|  | ||||
| QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.$(CTVER2) | ||||
| define Download/ath10k-firmware-qca9888-ct | ||||
|   $(call Download/ct-firmware,QCA9888,ath10k-9888-10-4b) | ||||
|   HASH:=$(H9888FC) | ||||
| endef | ||||
| $(eval $(call Download,ath10k-firmware-qca9888-ct)) | ||||
|  | ||||
| QCA9888_FIRMWARE_FILE_CT_FULL_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.$(CTVER2) | ||||
| define Download/ath10k-firmware-qca9888-ct-full-htt | ||||
|   $(call Download/ct-firmware-full-htt,QCA9888,ath10k-9888-10-4b) | ||||
|   HASH:=$(H9888FCH) | ||||
| endef | ||||
| $(eval $(call Download,ath10k-firmware-qca9888-ct-full-htt)) | ||||
|  | ||||
| QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.$(CTVER2) | ||||
| define Download/ath10k-firmware-qca9888-ct-htt | ||||
|   $(call Download/ct-firmware-htt,QCA9888,ath10k-9888-10-4b) | ||||
|   HASH:=$(H9888CH) | ||||
| endef | ||||
| $(eval $(call Download,ath10k-firmware-qca9888-ct-htt)) | ||||
|  | ||||
|  | ||||
| define Package/ath10k-ct-firmware-default | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   URL:=https://www.candelatech.com/ath10k.php | ||||
|   DEPENDS:= | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca988x-ct | ||||
| $(Package/ath10k-ct-firmware-default) | ||||
|   TITLE:=ath10k CT 10.1 firmware for QCA988x devices | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   PROVIDES:=ath10k-firmware-qca988x | ||||
| endef | ||||
| define Package/ath10k-firmware-qca988x-ct-full-htt | ||||
| $(Package/ath10k-ct-firmware-default) | ||||
|   TITLE:=ath10k CT 10.1 full-htt-mgt fw for QCA988x | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   PROVIDES:=ath10k-firmware-qca988x | ||||
|   DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca9887-ct | ||||
| $(Package/ath10k-ct-firmware-default) | ||||
|   TITLE:=ath10k CT 10.1 firmware for QCA9887 devices | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   PROVIDES:=ath10k-firmware-qca9887 | ||||
| endef | ||||
| define Package/ath10k-firmware-qca9887-ct-full-htt | ||||
| $(Package/ath10k-ct-firmware-default) | ||||
|   TITLE:=ath10k CT 10.1 full-htt-mgt fw for QCA9887 | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   PROVIDES:=ath10k-firmware-qca9887 | ||||
|   DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca99x0-ct | ||||
| $(Package/ath10k-ct-firmware-default) | ||||
|   TITLE:=ath10k CT 10.4 firmware for QCA99x0 devices | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   PROVIDES:=ath10k-firmware-qca99x0 | ||||
| endef | ||||
| define Package/ath10k-firmware-qca99x0-ct-full-htt | ||||
| $(Package/ath10k-ct-firmware-default) | ||||
|   TITLE:=ath10k CT 10.4 full-htt-mgt fw for QCA99x0 | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   PROVIDES:=ath10k-firmware-qca99x0 | ||||
|   DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct | ||||
| endef | ||||
| define Package/ath10k-firmware-qca99x0-ct-htt | ||||
| $(Package/ath10k-firmware-default) | ||||
|   TITLE:=ath10k CT 10.4 htt-mgt fw for QCA99x0 | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   PROVIDES:=ath10k-firmware-qca99x0 | ||||
|   DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca9984-ct | ||||
| $(Package/ath10k-ct-firmware-default) | ||||
|   TITLE:=ath10k CT 10.4 firmware for QCA9984 devices | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   PROVIDES:=ath10k-firmware-qca9984 | ||||
| endef | ||||
| define Package/ath10k-firmware-qca9984-ct-full-htt | ||||
| $(Package/ath10k-ct-firmware-default) | ||||
|   TITLE:=ath10k CT 10.4 full-htt-mgt fw for QCA9984 | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   PROVIDES:=ath10k-firmware-qca9984 | ||||
|   DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct | ||||
| endef | ||||
| define Package/ath10k-firmware-qca9984-ct-htt | ||||
| $(Package/ath10k-firmware-default) | ||||
|   TITLE:=ath10k CT 10.4 htt-mgt fw for QCA9984 | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   PROVIDES:=ath10k-firmware-qca9984 | ||||
|   DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca4019-ct | ||||
| $(Package/ath10k-ct-firmware-default) | ||||
|   TITLE:=ath10k CT 10.4 firmware for QCA4018/9 | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   PROVIDES:=ath10k-firmware-qca4019 | ||||
| endef | ||||
| define Package/ath10k-firmware-qca4019-ct-full-htt | ||||
| $(Package/ath10k-ct-firmware-default) | ||||
|   TITLE:=ath10k CT 10.4 full-htt-mgt for QCA4018/9 | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   PROVIDES:=ath10k-firmware-qca4019 | ||||
|   DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct | ||||
| endef | ||||
| define Package/ath10k-firmware-qca4019-ct-htt | ||||
| $(Package/ath10k-firmware-default) | ||||
|   TITLE:=ath10k CT 10.4 htt-mgt for QCA4018/9 | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   PROVIDES:=ath10k-firmware-qca4019 | ||||
|   DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca9888-ct | ||||
| $(Package/ath10k-ct-firmware-default) | ||||
|   TITLE:=ath10k CT 10.4 fw for QCA9886/8 devices | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   PROVIDES:=ath10k-firmware-qca9888 | ||||
| endef | ||||
| define Package/ath10k-firmware-qca9888-ct-full-htt | ||||
| $(Package/ath10k-ct-firmware-default) | ||||
|   TITLE:=ath10k CT 10.4 full-htt-mgt fw for QCA9886/8 | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   PROVIDES:=ath10k-firmware-qca9888 | ||||
|   DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct | ||||
| endef | ||||
| define Package/ath10k-firmware-qca9888-ct-htt | ||||
| $(Package/ath10k-firmware-default) | ||||
|   TITLE:=ath10k CT 10.4 htt-mgt fw for QCA9886/8 | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   PROVIDES:=ath10k-firmware-qca9888 | ||||
|   DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct | ||||
| endef | ||||
|  | ||||
|  | ||||
| define Package/ath10k-firmware-qca9887-ct/description | ||||
| Alternative ath10k firmware for QCA9887 from Candela Technologies. | ||||
| Enables IBSS and other features.  See: | ||||
| http://www.candelatech.com/ath10k-10.1.php | ||||
| This firmware conflicts with the standard 9887 firmware, so select only | ||||
| one. | ||||
| endef | ||||
| define Package/ath10k-firmware-qca9887-ct-full-htt/description | ||||
| Alternative ath10k firmware for QCA9887 from Candela Technologies. | ||||
| Uses normal HTT TX data path for management frames, which improves | ||||
| stability in busy networks and fixes .11r authentication. | ||||
| Enables IBSS and other features.  See: | ||||
| http://www.candelatech.com/ath10k-10.1.php | ||||
| This firmware selects and requires the ath10k-ct driver. | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca988x-ct/description | ||||
| Alternative ath10k firmware for QCA988X from Candela Technologies. | ||||
| Enables IBSS and other features.  See: | ||||
| http://www.candelatech.com/ath10k-10.1.php | ||||
| This firmware will NOT be used unless the standard ath10k-firmware-qca988x | ||||
| is un-selected since the driver will try to load firmware-5.bin before | ||||
| firmware-2.bin | ||||
| endef | ||||
| define Package/ath10k-firmware-qca988x-ct-full-htt/description | ||||
| Alternative ath10k firmware for QCA988X from Candela Technologies. | ||||
| Uses normal HTT TX data path for management frames, which improves | ||||
| stability in busy networks and fixes .11r authentication. | ||||
| Enables IBSS and other features.  See: | ||||
| http://www.candelatech.com/ath10k-10.1.php | ||||
| This firmware selects and requires the ath10k-ct driver. | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca99x0-ct/description | ||||
| Alternative ath10k firmware for QCA99x0 from Candela Technologies. | ||||
| Enables IBSS and other features.  See: | ||||
| http://www.candelatech.com/ath10k-10.4.php | ||||
| This firmware conflicts with the standard 99x0 firmware, so select only | ||||
| one. | ||||
| endef | ||||
| define Package/ath10k-firmware-qca99x0-ct-full-htt/description | ||||
| Alternative ath10k firmware for QCA99x0 from Candela Technologies. | ||||
| Uses normal HTT TX data path for management frames, which improves | ||||
| stability in busy networks and may be required for .11r authentication. | ||||
| Enables IBSS and other features.  See: | ||||
| http://www.candelatech.com/ath10k-10.4.php | ||||
| This firmware selects and requires the ath10k-ct driver. | ||||
| endef | ||||
| define Package/ath10k-firmware-qca99x0-ct-htt/description | ||||
| Alternative ath10k firmware for QCA99x0 from Candela Technologies. | ||||
| Uses normal HTT TX data path for management frames, which improves | ||||
| stability in busy networks and may be required for .11r authentication. | ||||
| This firmware lacks a lot of features that ath10k does not use, saving | ||||
| a lot of resources. | ||||
| Enables IBSS and other features.  See: | ||||
| http://www.candelatech.com/ath10k-10.4.php | ||||
| This firmware selects and requires the ath10k-ct driver. | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca9984-ct/description | ||||
| Alternative ath10k firmware for QCA9984 from Candela Technologies. | ||||
| Enables IBSS and other features.  See: | ||||
| http://www.candelatech.com/ath10k-10.4.php | ||||
| This firmware conflicts with the standard 9984 firmware, so select only | ||||
| one. | ||||
| endef | ||||
| define Package/ath10k-firmware-qca9984-ct-full-htt/description | ||||
| Alternative ath10k firmware for QCA9984 from Candela Technologies. | ||||
| Uses normal HTT TX data path for management frames, which improves | ||||
| stability in busy networks and may be required for .11r authentication. | ||||
| Enables IBSS and other features.  See: | ||||
| http://www.candelatech.com/ath10k-10.4.php | ||||
| This firmware selects and requires the ath10k-ct driver. | ||||
| endef | ||||
| define Package/ath10k-firmware-qca9984-ct-htt/description | ||||
| Alternative ath10k firmware for QCA9984 from Candela Technologies. | ||||
| Uses normal HTT TX data path for management frames, which improves | ||||
| stability in busy networks and may be required for .11r authentication. | ||||
| This firmware lacks a lot of features that ath10k does not use, saving | ||||
| a lot of resources. | ||||
| Enables IBSS and other features.  See: | ||||
| http://www.candelatech.com/ath10k-10.4.php | ||||
| This firmware selects and requires the ath10k-ct driver. | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca4019-ct/description | ||||
| Alternative ath10k firmware for IPQ4019 radio from Candela Technologies. | ||||
| Enables IBSS and other features.  Works with standard or ath10k-ct driver. | ||||
| See:  http://www.candelatech.com/ath10k-10.4.php | ||||
| endef | ||||
| define Package/ath10k-firmware-qca4019-ct-full-htt/description | ||||
| Alternative ath10k firmware for IPQ4019 radio from Candela Technologies. | ||||
| Uses normal HTT TX data path for management frames, which improves | ||||
| stability in busy networks and may be required for .11r authentication. | ||||
| Enables IBSS and other features. | ||||
| See:  http://www.candelatech.com/ath10k-10.4.php | ||||
| This firmware selects and requires the ath10k-ct driver. | ||||
| endef | ||||
| define Package/ath10k-firmware-qca4019-ct-htt/description | ||||
| Alternative ath10k firmware for IPQ4019 radio from Candela Technologies. | ||||
| Uses normal HTT TX data path for management frames, which improves | ||||
| stability in busy networks and may be required for .11r authentication. | ||||
| This firmware lacks a lot of features that ath10k does not use, saving | ||||
| a lot of resources. | ||||
| Enables IBSS and other features. | ||||
| See:  http://www.candelatech.com/ath10k-10.4.php | ||||
| This firmware selects and requires the ath10k-ct driver. | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca9888-ct/description | ||||
| Alternative ath10k firmware for QCA9886 and QCA9888 from Candela Technologies. | ||||
| Enables IBSS and other features.  See: | ||||
| http://www.candelatech.com/ath10k-10.4.php | ||||
| This firmware conflicts with the standard 9886 and 9888 firmware, so select only | ||||
| one. | ||||
| endef | ||||
| define Package/ath10k-firmware-qca9888-ct-full-htt/description | ||||
| Alternative ath10k firmware for QCA9886 and QCA9888 from Candela Technologies. | ||||
| Uses normal HTT TX data path for management frames, which improves | ||||
| stability in busy networks and may be required for .11r authentication. | ||||
| Enables IBSS and other features.  See: | ||||
| http://www.candelatech.com/ath10k-10.4.php | ||||
| This firmware selects and requires the ath10k-ct driver. | ||||
| endef | ||||
| define Package/ath10k-firmware-qca9888-ct-htt/description | ||||
| Alternative ath10k firmware for QCA9886 and QCA9888 from Candela Technologies. | ||||
| Uses normal HTT TX data path for management frames, which improves | ||||
| stability in busy networks and may be required for .11r authentication. | ||||
| This firmware lacks a lot of features that ath10k does not use, saving | ||||
| a lot of resources. | ||||
| Enables IBSS and other features.  See: | ||||
| http://www.candelatech.com/ath10k-10.4.php | ||||
| This firmware selects and requires the ath10k-ct driver. | ||||
| endef | ||||
|  | ||||
|  | ||||
| define Build/Compile | ||||
|  | ||||
| endef | ||||
|  | ||||
|  | ||||
| define Package/ath10k-firmware-qca9887-ct/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA9887) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9887/hw1.0/firmware-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA9887_BOARD_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9887/hw1.0/board.bin | ||||
| endef | ||||
| define Package/ath10k-firmware-qca9887-ct-full-htt/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA9887) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9887/hw1.0/ct-firmware-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA9887_BOARD_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9887/hw1.0/board.bin | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca988x-ct/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA988X_BOARD_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA988X/hw2.0/board.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA988X) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin | ||||
| endef | ||||
| define Package/ath10k-firmware-qca988x-ct-full-htt/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA988X_BOARD_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA988X/hw2.0/board.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA988X) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA988X/hw2.0/ct-firmware-2.bin | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca99x0-ct/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA99X0_BOARD2_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA99X0_BOARD_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA99X0) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin | ||||
| endef | ||||
| define Package/ath10k-firmware-qca99x0-ct-full-htt/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA99X0_BOARD2_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA99X0_BOARD_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA99X0) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/ct-firmware-5.bin | ||||
| endef | ||||
| define Package/ath10k-firmware-qca99x0-ct-htt/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA99X0_BOARD2_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA99X0_BOARD_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA99X0) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/ct-firmware-5.bin | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca9984-ct/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA9984_BOARD2_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA9984) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin | ||||
| endef | ||||
| define Package/ath10k-firmware-qca9984-ct-full-htt/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA9984_BOARD2_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA9984) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/ct-firmware-5.bin | ||||
| endef | ||||
| define Package/ath10k-firmware-qca9984-ct-htt/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA9984_BOARD2_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA9984) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/ct-firmware-5.bin | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca4019-ct/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA4019_BOARD2_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/board-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA4019) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/firmware-5.bin | ||||
| endef | ||||
| define Package/ath10k-firmware-qca4019-ct-full-htt/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA4019_BOARD2_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/board-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA4019) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/ct-firmware-5.bin | ||||
| endef | ||||
| define Package/ath10k-firmware-qca4019-ct-htt/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA4019_BOARD2_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/board-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA4019) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/ct-firmware-5.bin | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca9888-ct/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0 | ||||
| 	ln -s \ | ||||
| 		../../cal-pci-0000:01:00.0.bin \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA9888_BOARD2_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(call CT_FIRMWARE_FILE,QCA9888) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/firmware-5.bin | ||||
| endef | ||||
| define Package/ath10k-firmware-qca9888-ct-full-htt/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0 | ||||
| 	ln -s \ | ||||
| 		../../cal-pci-0000:01:00.0.bin \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA9888_BOARD2_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(call CT_FIRMWARE_FILE_FULL_HTT,QCA9888) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/ct-firmware-5.bin | ||||
| endef | ||||
| define Package/ath10k-firmware-qca9888-ct-htt/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0 | ||||
| 	ln -s \ | ||||
| 		../../cal-pci-0000:01:00.0.bin \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA9888_BOARD2_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(call CT_FIRMWARE_FILE_HTT,QCA9888) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/ct-firmware-5.bin | ||||
| endef | ||||
|  | ||||
|  | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca9887-ct)) | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca9887-ct-full-htt)) | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca988x-ct)) | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca988x-ct-full-htt)) | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct)) | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct-full-htt)) | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct-htt)) | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca9984-ct)) | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca9984-ct-full-htt)) | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca9984-ct-htt)) | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca4019-ct)) | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca4019-ct-full-htt)) | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca4019-ct-htt)) | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca9888-ct)) | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca9888-ct-full-htt)) | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca9888-ct-htt)) | ||||
							
								
								
									
										121
									
								
								feeds/wifi-ath10k/ath10k-ct/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										121
									
								
								feeds/wifi-ath10k/ath10k-ct/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,121 @@ | ||||
| include $(TOPDIR)/rules.mk | ||||
|  | ||||
| PKG_NAME:=ath10k-ct | ||||
| PKG_RELEASE=1 | ||||
|  | ||||
| PKG_LICENSE:=GPLv2 | ||||
| PKG_LICENSE_FILES:= | ||||
|  | ||||
| PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git | ||||
| PKG_SOURCE_PROTO:=git | ||||
| PKG_SOURCE_DATE:=2021-05-22b | ||||
| PKG_SOURCE_VERSION:=54a9ac02f1139596ea4361ebbc3e444955d86cfd | ||||
| #PKG_MIRROR_HASH:=97cf22a4a57381c7eb7a9b8a8b1e347e9711ce51c89db971b4ab9a35af476ece | ||||
|  | ||||
| # Build the 5.4 ath10k-ct driver version.  Other option is "-4.19". | ||||
| # Probably this should match as closely as | ||||
| # possible to whatever mac80211 backports version is being used. | ||||
| CT_KVER="-5.7" | ||||
|  | ||||
| PKG_MAINTAINER:=Ben Greear <greearb@candelatech.com> | ||||
| PKG_BUILD_PARALLEL:=1 | ||||
| PKG_EXTMOD_SUBDIRS:=ath10k$(CT_KVER) | ||||
|  | ||||
| STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h | ||||
|  | ||||
| include $(INCLUDE_DIR)/kernel.mk | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
|  | ||||
| define KernelPackage/ath10k-ct | ||||
|   SUBMENU:=Wireless Drivers | ||||
|   TITLE:=ath10k-ct driver optimized for CT ath10k firmware | ||||
|   DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT @PCI_SUPPORT +kmod-hwmon-core | ||||
|   FILES:=\ | ||||
| 	$(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_pci.ko \ | ||||
| 	$(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_core.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ath10k_pci) | ||||
|   PROVIDES:=kmod-ath10k | ||||
|   VARIANT:=regular | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath10k-ct/config | ||||
|  | ||||
|        config ATH10K-CT_LEDS | ||||
|                bool "Enable LED support" | ||||
|                default y | ||||
|                depends on PACKAGE_kmod-ath10k-ct || PACKAGE_kmod-ath10k-ct-smallbuffers | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath10k-ct-smallbuffers | ||||
| $(call KernelPackage/ath10k-ct) | ||||
|   TITLE+= (small buffers for low-RAM devices) | ||||
|   VARIANT:=smallbuffers | ||||
| endef | ||||
|  | ||||
| NOSTDINC_FLAGS = \ | ||||
| 	-I$(PKG_BUILD_DIR) \ | ||||
| 	-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \ | ||||
| 	-I$(STAGING_DIR)/usr/include/mac80211-backport \ | ||||
| 	-I$(STAGING_DIR)/usr/include/mac80211/uapi \ | ||||
| 	-I$(STAGING_DIR)/usr/include/mac80211 \ | ||||
| 	-include backport/autoconf.h \ | ||||
| 	-include backport/backport.h | ||||
|  | ||||
| ifdef CONFIG_PACKAGE_MAC80211_MESH | ||||
|   NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH | ||||
| endif | ||||
|  | ||||
| CT_MAKEDEFS += CONFIG_ATH10K=m CONFIG_ATH10K_PCI=m CONFIG_ATH10K_CE=y | ||||
|  | ||||
| # This AHB logic is needed for IPQ4019 radios | ||||
| CT_MAKEDEFS += CONFIG_ATH10K_AHB=m | ||||
| NOSTDINC_FLAGS += -DCONFIG_ATH10K_AHB | ||||
|  | ||||
| NOSTDINC_FLAGS += -DSTANDALONE_CT | ||||
|  | ||||
| ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS | ||||
|   CT_MAKEDEFS += CONFIG_ATH10K_DEBUGFS=y CONFIG_MAC80211_DEBUGFS=y | ||||
|   NOSTDINC_FLAGS += -DCONFIG_MAC80211_DEBUGFS | ||||
|   NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUGFS | ||||
| endif | ||||
|  | ||||
| ifdef CONFIG_PACKAGE_ATH_DEBUG | ||||
|   NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUG | ||||
| endif | ||||
|  | ||||
| ifdef CONFIG_PACKAGE_ATH_DFS | ||||
|   NOSTDINC_FLAGS += -DCONFIG_ATH10K_DFS_CERTIFIED | ||||
| endif | ||||
|  | ||||
| ifdef CONFIG_PACKAGE_ATH_SPECTRAL | ||||
|   CT_MAKEDEFS += CONFIG_ATH10K_SPECTRAL=y | ||||
|   NOSTDINC_FLAGS += -DCONFIG_ATH10K_SPECTRAL | ||||
| endif | ||||
|  | ||||
| ifeq ($(CONFIG_ATH10K-CT_LEDS),y) | ||||
|   CT_MAKEDEFS += CONFIG_ATH10K_LEDS=y | ||||
|   NOSTDINC_FLAGS += -DCONFIG_ATH10K_LEDS | ||||
| endif | ||||
|  | ||||
| ifeq ($(BUILD_VARIANT),smallbuffers) | ||||
|   NOSTDINC_FLAGS += -DCONFIG_ATH10K_SMALLBUFFERS | ||||
| endif | ||||
|  | ||||
| define Build/Configure | ||||
| 	cp $(STAGING_DIR)/usr/include/mac80211/ath/*.h $(PKG_BUILD_DIR) | ||||
| endef | ||||
|  | ||||
| ifneq ($(findstring c,$(OPENWRT_VERBOSE)),) | ||||
|   CT_MAKEDEFS += V=1 | ||||
| endif | ||||
|  | ||||
| define Build/Compile | ||||
| 	+$(MAKE) $(CT_MAKEDEFS) $(PKG_JOBS) -C "$(LINUX_DIR)" \ | ||||
| 		$(KERNEL_MAKE_FLAGS) \ | ||||
| 		M="$(PKG_BUILD_DIR)/ath10k$(CT_KVER)" \ | ||||
| 		NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \ | ||||
| 		modules | ||||
| endef | ||||
|  | ||||
| $(eval $(call KernelPackage,ath10k-ct)) | ||||
| $(eval $(call KernelPackage,ath10k-ct-smallbuffers)) | ||||
| @@ -0,0 +1,37 @@ | ||||
| From: Sven Eckelmann <sven@narfation.org> | ||||
| Date: Tue, 26 Feb 2019 08:06:35 +0100 | ||||
| Subject: ath10k-ct: apply mac80211 rates to ath10k-ct rate state | ||||
|  | ||||
| The rates from mac80211 have to be copied to the state of ath10k-ct or | ||||
| otherwise the ath10k_check_apply_special_rates function overwrites | ||||
| them again with some default values. This breaks for example the | ||||
| mcast_rate set for a wifi-iface. | ||||
|  | ||||
| Signed-off-by: Sven Eckelmann <sven@narfation.org> | ||||
|  | ||||
| --- a/ath10k-5.4/mac.c | ||||
| +++ b/ath10k-5.4/mac.c | ||||
| @@ -6793,6 +6793,7 @@ static void ath10k_bss_info_changed(stru | ||||
|  			   "mac vdev %d mcast_rate %x\n", | ||||
|  			   arvif->vdev_id, rate); | ||||
|   | ||||
| +		arvif->mcast_rate[band] = rate; | ||||
|  		vdev_param = ar->wmi.vdev_param->mcast_data_rate; | ||||
|  		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, | ||||
|  						vdev_param, rate); | ||||
| @@ -6801,6 +6802,7 @@ static void ath10k_bss_info_changed(stru | ||||
|  				    "failed to set mcast rate on vdev %i: %d\n", | ||||
|  				    arvif->vdev_id,  ret); | ||||
|   | ||||
| +		arvif->bcast_rate[band] = rate; | ||||
|  		vdev_param = ar->wmi.vdev_param->bcast_data_rate; | ||||
|  		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, | ||||
|  						vdev_param, rate); | ||||
| @@ -6827,6 +6829,7 @@ static void ath10k_bss_info_changed(stru | ||||
|  			return; | ||||
|  		} | ||||
|   | ||||
| +		arvif->mgt_rate[def.chan->band] = hw_rate_code; | ||||
|  		vdev_param = ar->wmi.vdev_param->mgmt_rate; | ||||
|  		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, | ||||
|  						hw_rate_code); | ||||
| @@ -0,0 +1,598 @@ | ||||
| From: Sebastian Gottschall <s.gottschall@newmedia-net.de> | ||||
|  | ||||
| Adds LED and GPIO Control support for 988x, 9887, 9888, 99x0, 9984 based | ||||
| chipsets with on chipset connected led's using WMI Firmware API.  The LED | ||||
| device will get available named as "ath10k-phyX" at sysfs and can be controlled | ||||
| with various triggers.  adds also debugfs interface for gpio control. | ||||
|  | ||||
| This patch is specific for OpenWRt base, as is use old backported package | ||||
| with old wireless source. Support for QCA9984 is removed. | ||||
| Reworked to use ath10k-ct custom source | ||||
|  | ||||
|  | ||||
| Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com> | ||||
| Reviewed-by: Steve deRosier <derosier@cal-sierra.com> | ||||
| [kvalo: major reorg and cleanup] | ||||
| Signed-off-by: Kalle Valo <kvalo@codeaurora.org> | ||||
| Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com> | ||||
| --- | ||||
|  | ||||
| v13: | ||||
|  | ||||
| * only compile tested! | ||||
|  | ||||
| * fix all checkpatch warnings | ||||
|  | ||||
| * fix commit log | ||||
|  | ||||
| * sizeof(struct ath10k_gpiocontrol) -> sizeof(*gpio) | ||||
|  | ||||
| * unsigned -> unsigned int | ||||
|  | ||||
| * remove GPIOLIB code, that should be added in a separate patch | ||||
|  | ||||
| * rename gpio.c to leds.c | ||||
|  | ||||
| * add leds.h | ||||
|  | ||||
| * rename some functions: | ||||
|  | ||||
|   ath10k_attach_led() -> ath10k_leds_register() | ||||
|   ath10k_unregister_led() -> ath10k_leds_unregister() | ||||
|   ath10k_reset_led_pin() -> ath10k_leds_start() | ||||
|  | ||||
| * call ath10k_leds_unregister() before ath10k_thermal_unregister() to preserve ordering | ||||
|  | ||||
| * call ath10k_leds_start() only from ath10k_core_start() and not from mac.c | ||||
|  | ||||
| * rename struct ath10k_gpiocontrol as anonymous function under struct | ||||
|   ath10k::leds, no need for memory allocation | ||||
|  | ||||
| * merge ath10k_add_led() to ath10k_attach_led(), which is it's only caller | ||||
|  | ||||
| * remove #if IS_ENABLED() checks from most of places, memory savings from those were not worth it | ||||
|  | ||||
| * Kconfig help text improvement and move it lower in the menu, also don't enable it by default | ||||
|  | ||||
| * switch to set_brightness_blocking() so that the callback can sleep, | ||||
|   then no need to use ath10k_wmi_cmd_send_nowait() and can take mutex | ||||
|   to access ar->state | ||||
|  | ||||
| * don't touch ath10k_wmi_pdev_get_temperature() | ||||
|  | ||||
| * as QCA6174/QCA9377 are not (yet) supported don't add the command to WMI-TLV interface | ||||
|  | ||||
| * remove debugfs interface, that should be added in another patch | ||||
|  | ||||
| * cleanup includes | ||||
|  | ||||
|  ath10k-5.4/Kconfig   |  10 +++ | ||||
|  ath10k-5.4/Makefile  |   1 + | ||||
|  ath10k-5.4/core.c    |  22 +++++++ | ||||
|  ath10k-5.4/core.h    |   9 ++- | ||||
|  ath10k-5.4/hw.h      |   1 + | ||||
|  ath10k-5.4/leds.c    | 103 ++++++++++++++++++++++++++++++ | ||||
|  ath10k-5.4/leds.h    |  45 +++++++++++++ | ||||
|  ath10k-5.4/mac.c     |   1 + | ||||
|  ath10k-5.4/wmi-ops.h |  32 ++++++++++ | ||||
|  ath10k-5.4/wmi-tlv.c |   2 + | ||||
|  ath10k-5.4/wmi.c     |  54 ++++++++++++++++ | ||||
|  ath10k-5.4/wmi.h     |  35 ++++++++++ | ||||
|  12 files changed, 314 insertions(+), 1 deletion(-) | ||||
|  create mode 100644 ath10k-5.4/leds.c | ||||
|  create mode 100644 ath10k-5.4/leds.h | ||||
|  | ||||
| --- a/ath10k-5.4/Kconfig | ||||
| +++ b/ath10k-5.4/Kconfig | ||||
| @@ -66,6 +66,16 @@ config ATH10K_DEBUGFS | ||||
|   | ||||
|  	  If unsure, say Y to make it easier to debug problems. | ||||
|   | ||||
| +config ATH10K_LEDS | ||||
| +	bool "Atheros ath10k LED support" | ||||
| +	depends on ATH10K | ||||
| +	select MAC80211_LEDS | ||||
| +	select LEDS_CLASS | ||||
| +	select NEW_LEDS | ||||
| +	default y | ||||
| +	---help--- | ||||
| +	  This option is necessary, if you want LED support for chipset connected led pins. If unsure, say N. | ||||
| + | ||||
|  config ATH10K_SPECTRAL | ||||
|  	bool "Atheros ath10k spectral scan support" | ||||
|  	depends on ATH10K_DEBUGFS | ||||
| --- a/ath10k-5.4/Makefile | ||||
| +++ b/ath10k-5.4/Makefile | ||||
| @@ -19,6 +19,7 @@ ath10k_core-$(CONFIG_ATH10K_SPECTRAL) += | ||||
|  ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o | ||||
|  ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o | ||||
|  ath10k_core-$(CONFIG_THERMAL) += thermal.o | ||||
| +ath10k_core-$(CONFIG_ATH10K_LEDS) += leds.o | ||||
|  ath10k_core-$(CONFIG_MAC80211_DEBUGFS) += debugfs_sta.o | ||||
|  ath10k_core-$(CONFIG_PM) += wow.o | ||||
|  ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o | ||||
| --- a/ath10k-5.4/core.c | ||||
| +++ b/ath10k-5.4/core.c | ||||
| @@ -25,6 +25,7 @@ | ||||
|  #include "testmode.h" | ||||
|  #include "wmi-ops.h" | ||||
|  #include "coredump.h" | ||||
| +#include "leds.h" | ||||
|   | ||||
|  /* Disable ath10k-ct DBGLOG output by default */ | ||||
|  unsigned int ath10k_debug_mask = ATH10K_DBG_NO_DBGLOG; | ||||
| @@ -67,6 +68,7 @@ static const struct ath10k_hw_params ath | ||||
|  		.dev_id = QCA988X_2_0_DEVICE_ID, | ||||
|  		.bus = ATH10K_BUS_PCI, | ||||
|  		.name = "qca988x hw2.0", | ||||
| +		.led_pin = 1, | ||||
|  		.patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, | ||||
|  		.uart_pin = 7, | ||||
|  		.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, | ||||
| @@ -137,6 +139,7 @@ static const struct ath10k_hw_params ath | ||||
|  		.dev_id = QCA9887_1_0_DEVICE_ID, | ||||
|  		.bus = ATH10K_BUS_PCI, | ||||
|  		.name = "qca9887 hw1.0", | ||||
| +		.led_pin = 1, | ||||
|  		.patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, | ||||
|  		.uart_pin = 7, | ||||
|  		.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, | ||||
| @@ -344,6 +347,7 @@ static const struct ath10k_hw_params ath | ||||
|  		.dev_id = QCA99X0_2_0_DEVICE_ID, | ||||
|  		.bus = ATH10K_BUS_PCI, | ||||
|  		.name = "qca99x0 hw2.0", | ||||
| +		.led_pin = 17, | ||||
|  		.patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, | ||||
|  		.uart_pin = 7, | ||||
|  		.otp_exe_param = 0x00000700, | ||||
| @@ -385,6 +389,7 @@ static const struct ath10k_hw_params ath | ||||
|  		.dev_id = QCA9984_1_0_DEVICE_ID, | ||||
|  		.bus = ATH10K_BUS_PCI, | ||||
|  		.name = "qca9984/qca9994 hw1.0", | ||||
| +		.led_pin = 17, | ||||
|  		.patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, | ||||
|  		.uart_pin = 7, | ||||
|  		.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, | ||||
| @@ -433,6 +438,7 @@ static const struct ath10k_hw_params ath | ||||
|  		.dev_id = QCA9888_2_0_DEVICE_ID, | ||||
|  		.bus = ATH10K_BUS_PCI, | ||||
|  		.name = "qca9888 hw2.0", | ||||
| +		.led_pin = 17, | ||||
|  		.patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, | ||||
|  		.uart_pin = 7, | ||||
|  		.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, | ||||
| @@ -3573,6 +3579,10 @@ int ath10k_core_start(struct ath10k *ar, | ||||
|  			ath10k_wmi_check_apply_board_power_ctl_table(ar); | ||||
|  	} | ||||
|   | ||||
| +	status = ath10k_leds_start(ar); | ||||
| +	if (status) | ||||
| +		goto err_hif_stop; | ||||
| + | ||||
|  	return 0; | ||||
|   | ||||
|  err_hif_stop: | ||||
| @@ -3829,9 +3839,18 @@ static void ath10k_core_register_work(st | ||||
|  		goto err_spectral_destroy; | ||||
|  	} | ||||
|   | ||||
| +	status = ath10k_leds_register(ar); | ||||
| +	if (status) { | ||||
| +		ath10k_err(ar, "could not register leds: %d\n", | ||||
| +			   status); | ||||
| +		goto err_thermal_unregister; | ||||
| +	} | ||||
| + | ||||
|  	set_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags); | ||||
|  	return; | ||||
|   | ||||
| +err_thermal_unregister: | ||||
| +	ath10k_thermal_unregister(ar); | ||||
|  err_spectral_destroy: | ||||
|  	ath10k_spectral_destroy(ar); | ||||
|  err_debug_destroy: | ||||
| @@ -3891,6 +3910,8 @@ void ath10k_core_unregister(struct ath10 | ||||
|  	if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) | ||||
|  		return; | ||||
|   | ||||
| +	ath10k_leds_unregister(ar); | ||||
| + | ||||
|  	ath10k_thermal_unregister(ar); | ||||
|  	/* Stop spectral before unregistering from mac80211 to remove the | ||||
|  	 * relayfs debugfs file cleanly. Otherwise the parent debugfs tree | ||||
| --- a/ath10k-5.4/core.h | ||||
| +++ b/ath10k-5.4/core.h | ||||
| @@ -14,6 +14,7 @@ | ||||
|  #include <linux/pci.h> | ||||
|  #include <linux/uuid.h> | ||||
|  #include <linux/time.h> | ||||
| +#include <linux/leds.h> | ||||
|   | ||||
|  #include "htt.h" | ||||
|  #include "htc.h" | ||||
| @@ -1469,6 +1470,13 @@ struct ath10k { | ||||
|  	} testmode; | ||||
|   | ||||
|  	struct { | ||||
| +		struct gpio_led wifi_led; | ||||
| +		struct led_classdev cdev; | ||||
| +		char label[48]; | ||||
| +		u32 gpio_state_pin; | ||||
| +	} leds; | ||||
| + | ||||
| +	struct { | ||||
|  		/* protected by data_lock */ | ||||
|  		u32 fw_crash_counter; | ||||
|  		u32 fw_warm_reset_counter; | ||||
| --- a/ath10k-5.4/hw.h | ||||
| +++ b/ath10k-5.4/hw.h | ||||
| @@ -518,6 +518,7 @@ struct ath10k_hw_params { | ||||
|  	const char *name; | ||||
|  	u32 patch_load_addr; | ||||
|  	int uart_pin; | ||||
| +	int led_pin; | ||||
|  	u32 otp_exe_param; | ||||
|   | ||||
|  	/* Type of hw cycle counter wraparound logic, for more info | ||||
| --- /dev/null | ||||
| +++ b/ath10k-5.4/leds.c | ||||
| @@ -0,0 +1,103 @@ | ||||
| +/* | ||||
| + * Copyright (c) 2005-2011 Atheros Communications Inc. | ||||
| + * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. | ||||
| + * Copyright (c) 2018 Sebastian Gottschall <s.gottschall@dd-wrt.com> | ||||
| + * Copyright (c) 2018, The Linux Foundation. All rights reserved. | ||||
| + * | ||||
| + * 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/leds.h> | ||||
| + | ||||
| +#include "core.h" | ||||
| +#include "wmi.h" | ||||
| +#include "wmi-ops.h" | ||||
| + | ||||
| +#include "leds.h" | ||||
| + | ||||
| +static int ath10k_leds_set_brightness_blocking(struct led_classdev *led_cdev, | ||||
| +					       enum led_brightness brightness) | ||||
| +{ | ||||
| +	struct ath10k *ar = container_of(led_cdev, struct ath10k, | ||||
| +					 leds.cdev); | ||||
| +	struct gpio_led *led = &ar->leds.wifi_led; | ||||
| + | ||||
| +	mutex_lock(&ar->conf_mutex); | ||||
| + | ||||
| +	if (ar->state != ATH10K_STATE_ON) | ||||
| +		goto out; | ||||
| + | ||||
| +	ar->leds.gpio_state_pin = (brightness != LED_OFF) ^ led->active_low; | ||||
| +	ath10k_wmi_gpio_output(ar, led->gpio, ar->leds.gpio_state_pin); | ||||
| + | ||||
| +out: | ||||
| +	mutex_unlock(&ar->conf_mutex); | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +int ath10k_leds_start(struct ath10k *ar) | ||||
| +{ | ||||
| +	if (ar->hw_params.led_pin == 0) | ||||
| +		/* leds not supported */ | ||||
| +		return 0; | ||||
| + | ||||
| +	/* under some circumstances, the gpio pin gets reconfigured | ||||
| +	 * to default state by the firmware, so we need to | ||||
| +	 * reconfigure it this behaviour has only ben seen on | ||||
| +	 * QCA9984 and QCA99XX devices so far | ||||
| +	 */ | ||||
| +	ath10k_wmi_gpio_config(ar, ar->hw_params.led_pin, 0, | ||||
| +			       WMI_GPIO_PULL_NONE, WMI_GPIO_INTTYPE_DISABLE); | ||||
| +	ath10k_wmi_gpio_output(ar, ar->hw_params.led_pin, 1); | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +int ath10k_leds_register(struct ath10k *ar) | ||||
| +{ | ||||
| +	int ret; | ||||
| + | ||||
| +	if (ar->hw_params.led_pin == 0) | ||||
| +		/* leds not supported */ | ||||
| +		return 0; | ||||
| + | ||||
| +	snprintf(ar->leds.label, sizeof(ar->leds.label), "ath10k-%s", | ||||
| +		 wiphy_name(ar->hw->wiphy)); | ||||
| +	ar->leds.wifi_led.active_low = 1; | ||||
| +	ar->leds.wifi_led.gpio = ar->hw_params.led_pin; | ||||
| +	ar->leds.wifi_led.name = ar->leds.label; | ||||
| +	ar->leds.wifi_led.default_state = LEDS_GPIO_DEFSTATE_KEEP; | ||||
| + | ||||
| +	ar->leds.cdev.name = ar->leds.label; | ||||
| +	ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking; | ||||
| + | ||||
| +	/* FIXME: this assignment doesn't make sense as it's NULL, remove it? */ | ||||
| +	ar->leds.cdev.default_trigger = ar->leds.wifi_led.default_trigger; | ||||
| + | ||||
| +	ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); | ||||
| +	if (ret) | ||||
| +		return ret; | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +void ath10k_leds_unregister(struct ath10k *ar) | ||||
| +{ | ||||
| +	if (ar->hw_params.led_pin == 0) | ||||
| +		/* leds not supported */ | ||||
| +		return; | ||||
| + | ||||
| +	led_classdev_unregister(&ar->leds.cdev); | ||||
| +} | ||||
| + | ||||
| --- /dev/null | ||||
| +++ b/ath10k-5.4/leds.h | ||||
| @@ -0,0 +1,41 @@ | ||||
| +/* | ||||
| + * Copyright (c) 2018, The Linux Foundation. All rights reserved. | ||||
| + * | ||||
| + * 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 _LEDS_H_ | ||||
| +#define _LEDS_H_ | ||||
| + | ||||
| +#include "core.h" | ||||
| + | ||||
| +#ifdef CONFIG_ATH10K_LEDS | ||||
| +void ath10k_leds_unregister(struct ath10k *ar); | ||||
| +int ath10k_leds_start(struct ath10k *ar); | ||||
| +int ath10k_leds_register(struct ath10k *ar); | ||||
| +#else | ||||
| +static inline void ath10k_leds_unregister(struct ath10k *ar) | ||||
| +{ | ||||
| +} | ||||
| + | ||||
| +static inline int ath10k_leds_start(struct ath10k *ar) | ||||
| +{ | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +static inline int ath10k_leds_register(struct ath10k *ar) | ||||
| +{ | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +#endif | ||||
| +#endif /* _LEDS_H_ */ | ||||
| --- a/ath10k-5.4/mac.c | ||||
| +++ b/ath10k-5.4/mac.c | ||||
| @@ -24,6 +24,7 @@ | ||||
|  #include "wmi-tlv.h" | ||||
|  #include "wmi-ops.h" | ||||
|  #include "wow.h" | ||||
| +#include "leds.h" | ||||
|   | ||||
|  /*********/ | ||||
|  /* Rates */ | ||||
| --- a/ath10k-5.4/wmi-ops.h | ||||
| +++ b/ath10k-5.4/wmi-ops.h | ||||
| @@ -218,7 +218,10 @@ struct wmi_ops { | ||||
|  	struct sk_buff *(*gen_bb_timing) | ||||
|  			(struct ath10k *ar, | ||||
|  			 const struct wmi_bb_timing_cfg_arg *arg); | ||||
| +	struct sk_buff *(*gen_gpio_config)(struct ath10k *ar, u32 gpio_num, | ||||
| +					   u32 input, u32 pull_type, u32 intr_mode); | ||||
|   | ||||
| +	struct sk_buff *(*gen_gpio_output)(struct ath10k *ar, u32 gpio_num, u32 set); | ||||
|  }; | ||||
|   | ||||
|  int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id); | ||||
| @@ -1105,6 +1108,35 @@ ath10k_wmi_force_fw_hang(struct ath10k * | ||||
|  	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid); | ||||
|  } | ||||
|   | ||||
| +static inline int ath10k_wmi_gpio_config(struct ath10k *ar, u32 gpio_num, | ||||
| +					 u32 input, u32 pull_type, u32 intr_mode) | ||||
| +{ | ||||
| +	struct sk_buff *skb; | ||||
| + | ||||
| +	if (!ar->wmi.ops->gen_gpio_config) | ||||
| +		return -EOPNOTSUPP; | ||||
| + | ||||
| +	skb = ar->wmi.ops->gen_gpio_config(ar, gpio_num, input, pull_type, intr_mode); | ||||
| +	if (IS_ERR(skb)) | ||||
| +		return PTR_ERR(skb); | ||||
| + | ||||
| +	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->gpio_config_cmdid); | ||||
| +} | ||||
| + | ||||
| +static inline int ath10k_wmi_gpio_output(struct ath10k *ar, u32 gpio_num, u32 set) | ||||
| +{ | ||||
| +	struct sk_buff *skb; | ||||
| + | ||||
| +	if (!ar->wmi.ops->gen_gpio_config) | ||||
| +		return -EOPNOTSUPP; | ||||
| + | ||||
| +	skb = ar->wmi.ops->gen_gpio_output(ar, gpio_num, set); | ||||
| +	if (IS_ERR(skb)) | ||||
| +		return PTR_ERR(skb); | ||||
| + | ||||
| +	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->gpio_output_cmdid); | ||||
| +} | ||||
| + | ||||
|  static inline int | ||||
|  ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level) | ||||
|  { | ||||
| --- a/ath10k-5.4/wmi-tlv.c | ||||
| +++ b/ath10k-5.4/wmi-tlv.c | ||||
| @@ -4364,6 +4364,8 @@ static const struct wmi_ops wmi_tlv_ops | ||||
|  	.gen_echo = ath10k_wmi_tlv_op_gen_echo, | ||||
|  	.gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, | ||||
|  	.gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable, | ||||
| +	/* .gen_gpio_config not implemented */ | ||||
| +	/* .gen_gpio_output not implemented */ | ||||
|  }; | ||||
|   | ||||
|  static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = { | ||||
| --- a/ath10k-5.4/wmi.c | ||||
| +++ b/ath10k-5.4/wmi.c | ||||
| @@ -8295,6 +8295,49 @@ ath10k_wmi_op_gen_peer_set_param(struct | ||||
|  	return skb; | ||||
|  } | ||||
|   | ||||
| +static struct sk_buff *ath10k_wmi_op_gen_gpio_config(struct ath10k *ar, | ||||
| +						     u32 gpio_num, u32 input, | ||||
| +						     u32 pull_type, u32 intr_mode) | ||||
| +{ | ||||
| +	struct wmi_gpio_config_cmd *cmd; | ||||
| +	struct sk_buff *skb; | ||||
| + | ||||
| +	skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | ||||
| +	if (!skb) | ||||
| +		return ERR_PTR(-ENOMEM); | ||||
| + | ||||
| +	cmd = (struct wmi_gpio_config_cmd *)skb->data; | ||||
| +	cmd->pull_type = __cpu_to_le32(pull_type); | ||||
| +	cmd->gpio_num = __cpu_to_le32(gpio_num); | ||||
| +	cmd->input = __cpu_to_le32(input); | ||||
| +	cmd->intr_mode = __cpu_to_le32(intr_mode); | ||||
| + | ||||
| +	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi gpio_config gpio_num 0x%08x input 0x%08x pull_type 0x%08x intr_mode 0x%08x\n", | ||||
| +		   gpio_num, input, pull_type, intr_mode); | ||||
| + | ||||
| +	return skb; | ||||
| +} | ||||
| + | ||||
| +static struct sk_buff *ath10k_wmi_op_gen_gpio_output(struct ath10k *ar, | ||||
| +						     u32 gpio_num, u32 set) | ||||
| +{ | ||||
| +	struct wmi_gpio_output_cmd *cmd; | ||||
| +	struct sk_buff *skb; | ||||
| + | ||||
| +	skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | ||||
| +	if (!skb) | ||||
| +		return ERR_PTR(-ENOMEM); | ||||
| + | ||||
| +	cmd = (struct wmi_gpio_output_cmd *)skb->data; | ||||
| +	cmd->gpio_num = __cpu_to_le32(gpio_num); | ||||
| +	cmd->set = __cpu_to_le32(set); | ||||
| + | ||||
| +	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi gpio_output gpio_num 0x%08x set 0x%08x\n", | ||||
| +		   gpio_num, set); | ||||
| + | ||||
| +	return skb; | ||||
| +} | ||||
| + | ||||
|  static struct sk_buff * | ||||
|  ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, | ||||
|  			     enum wmi_sta_ps_mode psmode) | ||||
| @@ -10094,6 +10137,9 @@ static const struct wmi_ops wmi_ops = { | ||||
|  	.fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill, | ||||
|  	.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, | ||||
|  	.gen_echo = ath10k_wmi_op_gen_echo, | ||||
| +	.gen_gpio_config = ath10k_wmi_op_gen_gpio_config, | ||||
| +	.gen_gpio_output = ath10k_wmi_op_gen_gpio_output, | ||||
| + | ||||
|  	/* .gen_bcn_tmpl not implemented */ | ||||
|  	/* .gen_prb_tmpl not implemented */ | ||||
|  	/* .gen_p2p_go_bcn_ie not implemented */ | ||||
| @@ -10164,6 +10210,8 @@ static const struct wmi_ops wmi_10_1_ops | ||||
|  	.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, | ||||
|  	.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, | ||||
|  	.gen_echo = ath10k_wmi_op_gen_echo, | ||||
| +	.gen_gpio_config = ath10k_wmi_op_gen_gpio_config, | ||||
| +	.gen_gpio_output = ath10k_wmi_op_gen_gpio_output, | ||||
|  	/* .gen_bcn_tmpl not implemented */ | ||||
|  	/* .gen_prb_tmpl not implemented */ | ||||
|  	/* .gen_p2p_go_bcn_ie not implemented */ | ||||
| @@ -10243,6 +10291,8 @@ static const struct wmi_ops wmi_10_2_ops | ||||
|  	.gen_delba_send = ath10k_wmi_op_gen_delba_send, | ||||
|  	.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, | ||||
|  	.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, | ||||
| +	.gen_gpio_config = ath10k_wmi_op_gen_gpio_config, | ||||
| +	.gen_gpio_output = ath10k_wmi_op_gen_gpio_output, | ||||
|  	/* .gen_pdev_enable_adaptive_cca not implemented */ | ||||
|  }; | ||||
|   | ||||
| @@ -10314,6 +10364,8 @@ static const struct wmi_ops wmi_10_2_4_o | ||||
|  		ath10k_wmi_op_gen_pdev_enable_adaptive_cca, | ||||
|  	.get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype, | ||||
|  	.gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing, | ||||
| +	.gen_gpio_config = ath10k_wmi_op_gen_gpio_config, | ||||
| +	.gen_gpio_output = ath10k_wmi_op_gen_gpio_output, | ||||
|  	/* .gen_bcn_tmpl not implemented */ | ||||
|  	/* .gen_prb_tmpl not implemented */ | ||||
|  	/* .gen_p2p_go_bcn_ie not implemented */ | ||||
| @@ -10395,6 +10447,8 @@ static const struct wmi_ops wmi_10_4_ops | ||||
|  	.gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info, | ||||
|  	.gen_echo = ath10k_wmi_op_gen_echo, | ||||
|  	.gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config, | ||||
| +	.gen_gpio_config = ath10k_wmi_op_gen_gpio_config, | ||||
| +	.gen_gpio_output = ath10k_wmi_op_gen_gpio_output, | ||||
|  }; | ||||
|   | ||||
|  int ath10k_wmi_attach(struct ath10k *ar) | ||||
| --- a/ath10k-5.4/wmi.h | ||||
| +++ b/ath10k-5.4/wmi.h | ||||
| @@ -3110,6 +3110,41 @@ enum wmi_10_4_feature_mask { | ||||
|   | ||||
|  }; | ||||
|   | ||||
| +/* WMI_GPIO_CONFIG_CMDID */ | ||||
| +enum { | ||||
| +	WMI_GPIO_PULL_NONE, | ||||
| +	WMI_GPIO_PULL_UP, | ||||
| +	WMI_GPIO_PULL_DOWN, | ||||
| +}; | ||||
| + | ||||
| +enum { | ||||
| +	WMI_GPIO_INTTYPE_DISABLE, | ||||
| +	WMI_GPIO_INTTYPE_RISING_EDGE, | ||||
| +	WMI_GPIO_INTTYPE_FALLING_EDGE, | ||||
| +	WMI_GPIO_INTTYPE_BOTH_EDGE, | ||||
| +	WMI_GPIO_INTTYPE_LEVEL_LOW, | ||||
| +	WMI_GPIO_INTTYPE_LEVEL_HIGH | ||||
| +}; | ||||
| + | ||||
| +/* WMI_GPIO_CONFIG_CMDID */ | ||||
| +struct wmi_gpio_config_cmd { | ||||
| +	__le32 gpio_num;             /* GPIO number to be setup */ | ||||
| +	__le32 input;                /* 0 - Output/ 1 - Input */ | ||||
| +	__le32 pull_type;            /* Pull type defined above */ | ||||
| +	__le32 intr_mode;            /* Interrupt mode defined above (Input) */ | ||||
| +} __packed; | ||||
| + | ||||
| +/* WMI_GPIO_OUTPUT_CMDID */ | ||||
| +struct wmi_gpio_output_cmd { | ||||
| +	__le32 gpio_num;    /* GPIO number to be setup */ | ||||
| +	__le32 set;         /* Set the GPIO pin*/ | ||||
| +} __packed; | ||||
| + | ||||
| +/* WMI_GPIO_INPUT_EVENTID */ | ||||
| +struct wmi_gpio_input_event { | ||||
| +	__le32 gpio_num;    /* GPIO number which changed state */ | ||||
| +} __packed; | ||||
| + | ||||
|  struct wmi_ext_resource_config_10_4_cmd { | ||||
|  	/* contains enum wmi_host_platform_type */ | ||||
|  	__le32 host_platform_config; | ||||
| @@ -0,0 +1,53 @@ | ||||
| From 79c9d7aabae1d1da9eea97d83b61e1517a8a2221 Mon Sep 17 00:00:00 2001 | ||||
| From: Mathias Kresin <dev@kresin.me> | ||||
| Date: Fri, 22 Jun 2018 18:59:44 +0200 | ||||
| Subject: [PATCH] ath10k: use tpt LED trigger by default | ||||
|  | ||||
| Use the tpt LED trigger for each created phy led. Ths way LEDs attached | ||||
| to the ath10k GPIO pins are indicating the phy status and blink on | ||||
| traffic. | ||||
|  | ||||
| Signed-off-by: Mathias Kresin <dev@kresin.me> | ||||
| --- | ||||
|  ath10k-5.4/core.h | 4 ++++ | ||||
|  ath10k-5.4/leds.c | 4 +--- | ||||
|  ath10k-5.4/mac.c  | 2 +- | ||||
|  3 files changed, 6 insertions(+), 4 deletions(-) | ||||
|  | ||||
| --- a/ath10k-5.4/core.h | ||||
| +++ b/ath10k-5.4/core.h | ||||
| @@ -1573,6 +1573,10 @@ struct ath10k { | ||||
|  	u8 csi_data[4096]; | ||||
|  	u16 csi_data_len; | ||||
|   | ||||
| +#ifdef CPTCFG_MAC80211_LEDS | ||||
| +	const char *led_default_trigger; | ||||
| +#endif | ||||
| + | ||||
|  	/* must be last */ | ||||
|  	u8 drv_priv[0] __aligned(sizeof(void *)); | ||||
|  }; | ||||
| --- a/ath10k-5.4/leds.c | ||||
| +++ b/ath10k-5.4/leds.c | ||||
| @@ -81,9 +81,7 @@ int ath10k_leds_register(struct ath10k * | ||||
|   | ||||
|  	ar->leds.cdev.name = ar->leds.label; | ||||
|  	ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking; | ||||
| - | ||||
| -	/* FIXME: this assignment doesn't make sense as it's NULL, remove it? */ | ||||
| -	ar->leds.cdev.default_trigger = ar->leds.wifi_led.default_trigger; | ||||
| +	ar->leds.cdev.default_trigger = ar->led_default_trigger; | ||||
|   | ||||
|  	ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); | ||||
|  	if (ret) | ||||
| --- a/ath10k-5.4/mac.c | ||||
| +++ b/ath10k-5.4/mac.c | ||||
| @@ -10367,7 +10367,7 @@ int ath10k_mac_register(struct ath10k *a | ||||
|  	ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; | ||||
|   | ||||
|  #ifdef CPTCFG_MAC80211_LEDS | ||||
| -	ieee80211_create_tpt_led_trigger(ar->hw, | ||||
| +	ar->led_default_trigger = ieee80211_create_tpt_led_trigger(ar->hw, | ||||
|  		IEEE80211_TPT_LEDTRIG_FL_RADIO, ath10k_tpt_blink, | ||||
|  		ARRAY_SIZE(ath10k_tpt_blink)); | ||||
|  #endif | ||||
| @@ -0,0 +1,10 @@ | ||||
| --- a/ath10k-5.4/mac.c | ||||
| +++ b/ath10k-5.4/mac.c | ||||
| @@ -10180,6 +10180,7 @@ int ath10k_mac_register(struct ath10k *a | ||||
|  	wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS); | ||||
|  	wiphy_ext_feature_set(ar->hw->wiphy, | ||||
|  			      NL80211_EXT_FEATURE_SET_SCAN_DWELL); | ||||
| +	wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL); | ||||
|   | ||||
|  	if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map) || | ||||
|  	    test_bit(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, ar->wmi.svc_map)) | ||||
| @@ -0,0 +1,14 @@ | ||||
| --- a/ath10k-5.4/htt.h | ||||
| +++ b/ath10k-5.4/htt.h | ||||
| @@ -225,7 +225,11 @@ enum htt_rx_ring_flags { | ||||
|  }; | ||||
|   | ||||
|  #define HTT_RX_RING_SIZE_MIN 128 | ||||
| +#ifndef CONFIG_ATH10K_SMALLBUFFERS | ||||
|  #define HTT_RX_RING_SIZE_MAX 2048 | ||||
| +#else | ||||
| +#define HTT_RX_RING_SIZE_MAX 512 | ||||
| +#endif | ||||
|  #define HTT_RX_RING_SIZE HTT_RX_RING_SIZE_MAX | ||||
|  #define HTT_RX_RING_FILL_LEVEL (((HTT_RX_RING_SIZE) / 2) - 1) | ||||
|  #define HTT_RX_RING_FILL_LEVEL_DUAL_MAC (HTT_RX_RING_SIZE - 1) | ||||
| @@ -0,0 +1,50 @@ | ||||
| --- a/ath10k-5.4/pci.c | ||||
| +++ b/ath10k-5.4/pci.c | ||||
| @@ -131,7 +131,11 @@ static struct ce_attr host_ce_config_wla | ||||
|  		.flags = CE_ATTR_FLAGS, | ||||
|  		.src_nentries = 0, | ||||
|  		.src_sz_max = 2048, | ||||
| +#ifndef CONFIG_ATH10K_SMALLBUFFERS | ||||
|  		.dest_nentries = 512, | ||||
| +#else | ||||
| +		.dest_nentries = 128, | ||||
| +#endif | ||||
|  		.recv_cb = ath10k_pci_htt_htc_rx_cb, | ||||
|  	}, | ||||
|   | ||||
| @@ -140,7 +144,11 @@ static struct ce_attr host_ce_config_wla | ||||
|  		.flags = CE_ATTR_FLAGS, | ||||
|  		.src_nentries = 0, | ||||
|  		.src_sz_max = 2048, | ||||
| +#ifndef CONFIG_ATH10K_SMALLBUFFERS | ||||
|  		.dest_nentries = 128, | ||||
| +#else | ||||
| +		.dest_nentries = 64, | ||||
| +#endif | ||||
|  		.recv_cb = ath10k_pci_htc_rx_cb, | ||||
|  	}, | ||||
|   | ||||
| @@ -167,7 +175,11 @@ static struct ce_attr host_ce_config_wla | ||||
|  		.flags = CE_ATTR_FLAGS, | ||||
|  		.src_nentries = 0, | ||||
|  		.src_sz_max = 512, | ||||
| +#ifndef CONFIG_ATH10K_SMALLBUFFERS | ||||
|  		.dest_nentries = 512, | ||||
| +#else | ||||
| +		.dest_nentries = 128, | ||||
| +#endif | ||||
|  		.recv_cb = ath10k_pci_htt_rx_cb, | ||||
|  	}, | ||||
|   | ||||
| @@ -192,7 +204,11 @@ static struct ce_attr host_ce_config_wla | ||||
|  		.flags = CE_ATTR_FLAGS, | ||||
|  		.src_nentries = 0, | ||||
|  		.src_sz_max = 2048, | ||||
| +#ifndef CONFIG_ATH10K_SMALLBUFFERS | ||||
|  		.dest_nentries = 128, | ||||
| +#else | ||||
| +		.dest_nentries = 96, | ||||
| +#endif | ||||
|  		.recv_cb = ath10k_pci_pktlog_rx_cb, | ||||
|  	}, | ||||
|   | ||||
| @@ -0,0 +1,22 @@ | ||||
| diff -Naur a/ath10k-5.7/mac.c b/ath10k-5.7/mac.c | ||||
| --- a/ath10k-5.7/mac.c	2021-06-09 16:30:17.793556032 -0400 | ||||
| +++ b/ath10k-5.7/mac.c	2021-06-09 17:38:08.587733979 -0400 | ||||
| @@ -7103,13 +7103,15 @@ | ||||
|  		scan_timeout = min_t(u32, arg.max_rest_time * | ||||
|  				(arg.n_channels - 1) + (req->duration + | ||||
|  				ATH10K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD) * | ||||
| -				arg.n_channels, arg.max_scan_time + 200); | ||||
| +				arg.n_channels, arg.max_scan_time); | ||||
|   | ||||
|  	} else { | ||||
| -		/* Add a 200ms margin to account for event/command processing */ | ||||
| -		scan_timeout = arg.max_scan_time + 200; | ||||
| +		scan_timeout = arg.max_scan_time; | ||||
|  	} | ||||
|   | ||||
| +	/* Add a 200ms margin to account for event/command processing */ | ||||
| +	scan_timeout += 200; | ||||
| + | ||||
|  	ret = ath10k_start_scan(ar, &arg); | ||||
|  	if (ret) { | ||||
|  		ath10k_warn(ar, "failed to start hw scan: %d\n", ret); | ||||
| @@ -0,0 +1,11 @@ | ||||
| --- a/ath10k-5.7/mac.c	2021-07-06 11:12:56.022146449 -0700 | ||||
| +++ b/ath10k-5.7/mac.c	2021-07-06 19:37:52.352753693 -0700 | ||||
| @@ -8286,7 +8286,7 @@ | ||||
|  				  struct ieee80211_channel *channel) | ||||
|  { | ||||
|  	int ret; | ||||
| -	enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR; | ||||
| +	enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ; | ||||
|   | ||||
|  	lockdep_assert_held(&ar->conf_mutex); | ||||
|   | ||||
| @@ -0,0 +1,31 @@ | ||||
| --- a/ath10k-5.7/wmi.c | ||||
| +++ b/ath10k-5.7/wmi.c | ||||
| @@ -6347,16 +6347,18 @@ | ||||
|   | ||||
|  	survey = &ar->survey[idx]; | ||||
|   | ||||
| -	survey->noise     = noise_floor; | ||||
| -	survey->time      = div_u64(total, cc_freq_hz); | ||||
| -	survey->time_busy = div_u64(busy, cc_freq_hz); | ||||
| -	survey->time_rx   = div_u64(rx_bss, cc_freq_hz); | ||||
| -	survey->time_tx   = div_u64(tx, cc_freq_hz); | ||||
| -	survey->filled   |= (SURVEY_INFO_NOISE_DBM | | ||||
| -			     SURVEY_INFO_TIME | | ||||
| -			     SURVEY_INFO_TIME_BUSY | | ||||
| -			     SURVEY_INFO_TIME_RX | | ||||
| -			     SURVEY_INFO_TIME_TX); | ||||
| +	survey->noise       = noise_floor; | ||||
| +	survey->time        = div_u64(total, cc_freq_hz); | ||||
| +	survey->time_busy   = div_u64(busy, cc_freq_hz); | ||||
| +	survey->time_rx     = div_u64(rx, cc_freq_hz); | ||||
| +	survey->time_bss_rx = div_u64(rx_bss, cc_freq_hz); | ||||
| +	survey->time_tx     = div_u64(tx, cc_freq_hz); | ||||
| +	survey->filled     |= (SURVEY_INFO_NOISE_DBM | | ||||
| +			       SURVEY_INFO_TIME | | ||||
| +			       SURVEY_INFO_TIME_BUSY | | ||||
| +			       SURVEY_INFO_TIME_RX | | ||||
| +			       SURVEY_INFO_TIME_TX | | ||||
| +			       SURVEY_INFO_TIME_BSS_RX); | ||||
|  exit: | ||||
|  	spin_unlock_bh(&ar->data_lock); | ||||
|  	complete(&ar->bss_survey_done); | ||||
| @@ -0,0 +1,14 @@ | ||||
| Index: ath10k-ct-2021-05-22b-54a9ac02/ath10k-5.7/core.c | ||||
| =================================================================== | ||||
| --- ath10k-ct-2021-05-22b-54a9ac02.orig/ath10k-5.7/core.c | ||||
| +++ ath10k-ct-2021-05-22b-54a9ac02/ath10k-5.7/core.c | ||||
| @@ -4146,6 +4146,9 @@ struct ath10k *ath10k_core_create(size_t | ||||
|  	INIT_WORK(&ar->stop_scan_work, ath10k_wmi_stop_scan_work); | ||||
|   | ||||
|  	init_dummy_netdev(&ar->napi_dev); | ||||
| +	snprintf(ar->napi_dev.name, sizeof(ar->napi_dev.name), "%s", | ||||
| +		 wiphy_name(ar->hw->wiphy)); | ||||
| +	ar->napi_dev.threaded = 1; | ||||
|   | ||||
|  	ret = ath10k_coredump_create(ar); | ||||
|  	if (ret) | ||||
							
								
								
									
										182
									
								
								feeds/wifi-ath10k/ath10k-firmware/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										182
									
								
								feeds/wifi-ath10k/ath10k-firmware/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,182 @@ | ||||
| # | ||||
| # Copyright (C) 2015 OpenWrt.org | ||||
| # | ||||
| # This is free software, licensed under the GNU General Public License v2. | ||||
| # See /LICENSE for more information. | ||||
| # | ||||
|  | ||||
| include $(TOPDIR)/rules.mk | ||||
|  | ||||
| PKG_NAME:=ath10k-firmware | ||||
| PKG_SOURCE_DATE:=2019-10-03 | ||||
| PKG_SOURCE_VERSION:=d622d160e9f552ead68d9ae81b715422892dc2ef | ||||
| PKG_MIRROR_HASH:=2e504e071c3f896d629c4cfffe7ff4b5f1acdb4fecd3f01e8ff8c73e87a67cc7 | ||||
| PKG_RELEASE:=1 | ||||
|  | ||||
| PKG_SOURCE_PROTO:=git | ||||
| PKG_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git | ||||
|  | ||||
| PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name> | ||||
|  | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
|  | ||||
| define Package/ath10k-firmware-default | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
|   URL:=$(PKG_SOURCE_URL) | ||||
|   DEPENDS:= | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca9887 | ||||
| $(Package/ath10k-firmware-default) | ||||
|   TITLE:=ath10k firmware for QCA9887 devices | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca9888 | ||||
| $(Package/ath10k-firmware-default) | ||||
|   TITLE:=ath10k firmware for QCA9888 devices | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca988x | ||||
| $(Package/ath10k-firmware-default) | ||||
|   TITLE:=ath10k firmware for QCA988x devices | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca99x0 | ||||
| $(Package/ath10k-firmware-default) | ||||
|   TITLE:=ath10k firmware for QCA99x0 devices | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca99x0/description | ||||
| Standard ath10k firmware for QCA99x0 from QCA | ||||
| This firmware conflicts with the CT 99x0 firmware, so select only | ||||
| one. | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca9984 | ||||
| $(Package/ath10k-firmware-default) | ||||
|   TITLE:=ath10k firmware for QCA9984 devices | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca4019 | ||||
| $(Package/ath10k-firmware-default) | ||||
|   TITLE:=ath10k firmware for IPQ/QCA4019 devices | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca6174 | ||||
| $(Package/ath10k-firmware-default) | ||||
|   TITLE:=ath10k firmware for QCA6174 devices | ||||
|   SECTION:=firmware | ||||
|   CATEGORY:=Firmware | ||||
| endef | ||||
|  | ||||
| QCA99X0_BOARD_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe | ||||
| QCA99X0_BOARD_FILE:=board-2.bin.$(QCA99X0_BOARD_REV) | ||||
|  | ||||
| define Download/qca99x0-board | ||||
|   URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0 | ||||
|   URL_FILE:=board-2.bin?id=$(QCA99X0_BOARD_REV) | ||||
|   FILE:=$(QCA99X0_BOARD_FILE) | ||||
|   HASH:=03711ac21e60ef59d3815e235eb721c0c22851b5410299411085aa6f2af45401 | ||||
| endef | ||||
| $(eval $(call Download,qca99x0-board)) | ||||
|  | ||||
| define Build/Compile | ||||
|  | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca4019/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(PKG_BUILD_DIR)/QCA4019/hw1.0/board-2.bin \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/ | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(PKG_BUILD_DIR)/QCA4019/hw1.0/3.5.3/firmware-5.bin_10.4-3.5.3-00057 \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA4019/hw1.0/firmware-5.bin | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca9887/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(PKG_BUILD_DIR)/QCA9887/hw1.0/10.2.4-1.0/firmware-5.bin_10.2.4-1.0-00047 \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9887/hw1.0/firmware-5.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(PKG_BUILD_DIR)/QCA9887/hw1.0/board.bin \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9887/hw1.0/board.bin | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca9888/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(PKG_BUILD_DIR)/QCA9888/hw2.0/board-2.bin \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(PKG_BUILD_DIR)/QCA9888/hw2.0/3.5.3/firmware-5.bin_10.4-3.5.3-00053 \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9888/hw2.0/firmware-5.bin | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca988x/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(PKG_BUILD_DIR)/QCA988X/hw2.0/board.bin \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA988X/hw2.0/ | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(PKG_BUILD_DIR)/QCA988X/hw2.0/10.2.4-1.0/firmware-5.bin_10.2.4-1.0-00047 \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca6174/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA6174/hw2.1 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(PKG_BUILD_DIR)/QCA6174/hw2.1/board-2.bin \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA6174/hw2.1/ | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(PKG_BUILD_DIR)/QCA6174/hw2.1/firmware-5.bin_SW_RM.1.1.1-00157-QCARMSWPZ-1 \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA6174/hw2.1/firmware-5.bin | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA6174/hw3.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(PKG_BUILD_DIR)/QCA6174/hw3.0/board-2.bin \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA6174/hw3.0/ | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(PKG_BUILD_DIR)/QCA6174/hw3.0/4.4.1.c1/firmware-6.bin_RM.4.4.1.c1-00042-QCARMSWP-1 \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA6174/hw3.0/firmware-6.bin | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca99x0/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(DL_DIR)/$(QCA99X0_BOARD_FILE) \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(PKG_BUILD_DIR)/QCA99X0/hw2.0/boardData_AR900B_CUS239_5G_v2_001.bin \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(PKG_BUILD_DIR)/QCA99X0/hw2.0/firmware-5.bin_10.4.1.00030-1 \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin | ||||
| endef | ||||
|  | ||||
| define Package/ath10k-firmware-qca9984/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0 | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin | ||||
| 	$(INSTALL_DATA) \ | ||||
| 		$(PKG_BUILD_DIR)/QCA9984/hw1.0/3.5.3/firmware-5.bin_10.4-3.5.3-00053 \ | ||||
| 		$(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin | ||||
| endef | ||||
|  | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca9887)) | ||||
| #$(eval $(call BuildPackage,ath10k-firmware-qca9888)) | ||||
| $(eval $(call BuildPackage,ath10k-firmware-qca988x)) | ||||
| #$(eval $(call BuildPackage,ath10k-firmware-qca99x0)) | ||||
| #$(eval $(call BuildPackage,ath10k-firmware-qca6174)) | ||||
| #$(eval $(call BuildPackage,ath10k-firmware-qca9984)) | ||||
| #$(eval $(call BuildPackage,ath10k-firmware-qca4019)) | ||||
							
								
								
									
										231
									
								
								feeds/wifi-ath10k/batctl/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										231
									
								
								feeds/wifi-ath10k/batctl/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,231 @@ | ||||
| # SPDX-License-Identifier: GPL-2.0-only | ||||
|  | ||||
| include $(TOPDIR)/rules.mk | ||||
|  | ||||
| PKG_NAME:=batctl | ||||
| PKG_VERSION:=2020.2 | ||||
| PKG_RELEASE:=1 | ||||
|  | ||||
| PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | ||||
| PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) | ||||
| PKG_HASH:=d29cdb53ee68abd5027eae07d9fd645b3f154e0d577efa2666c1334bb6d60efd | ||||
| PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) | ||||
|  | ||||
| PKG_MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de> | ||||
| PKG_LICENSE:=GPL-2.0-only ISC MIT | ||||
| PKG_LICENSE_FILES:=LICENSES/preferred/GPL-2.0 LICENSES/preferred/MIT LICENSES/deprecated/ISC | ||||
|  | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
|  | ||||
| define Package/batctl/Default | ||||
|   SECTION:=net | ||||
|   CATEGORY:=Network | ||||
|   URL:=https://www.open-mesh.org/ | ||||
|   DEPENDS:=+libnl-tiny +libc +librt | ||||
|   PROVIDES:=batctl | ||||
| endef | ||||
|  | ||||
| define Package/batctl/description | ||||
|   batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced. | ||||
|   It is an easier method for configuring batman-adv and provides some | ||||
|   additional tools for debugging as well. This package builds | ||||
|   version $(PKG_VERSION) of the user space utility. | ||||
| endef | ||||
|  | ||||
| define Package/batctl-tiny | ||||
| $(call Package/batctl/Default) | ||||
|   TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Minimal) | ||||
|   VARIANT:=tiny | ||||
|   ALTERNATIVES:=100:/usr/sbin/batctl:/usr/libexec/batctl-tiny | ||||
| endef | ||||
|  | ||||
| define Package/batctl-tiny/description | ||||
| $(Package/batctl/description) | ||||
|   Only configuration relevant subcommands are enabled. | ||||
| endef | ||||
|  | ||||
| define Package/batctl-default | ||||
| $(call Package/batctl/Default) | ||||
|   TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Default) | ||||
|   VARIANT:=default | ||||
|   ALTERNATIVES:=200:/usr/sbin/batctl:/usr/libexec/batctl-default | ||||
| endef | ||||
|  | ||||
| define Package/batctl-default/description | ||||
| $(Package/batctl/description) | ||||
|   Standard subcommands for configuration and online debugging are enabled. | ||||
| endef | ||||
|  | ||||
| define Package/batctl-full | ||||
| $(call Package/batctl/Default) | ||||
|   TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Full) | ||||
|   VARIANT:=full | ||||
|   ALTERNATIVES:=300:/usr/sbin/batctl:/usr/libexec/batctl-full | ||||
| endef | ||||
|  | ||||
| define Package/batctl-full/description | ||||
| $(Package/batctl/description) | ||||
|   Subcommands for configuration, online and offline debugging are enabled. | ||||
| endef | ||||
|  | ||||
| # The linker can identify unused sections of a binary when each symbol is stored | ||||
| # in a separate section. This mostly removes unused linker sections and reduces | ||||
| # the size by ~3% on mipsel. | ||||
|  | ||||
| TARGET_CFLAGS  += -ffunction-sections -fdata-sections | ||||
| TARGET_LDFLAGS += -Wl,--gc-sections | ||||
|  | ||||
| # Link-time optimization allows to move parts of the optimization from the single | ||||
| # source file to the global source view. This is done by emitting the GIMPLE | ||||
| # representation in each object file and analyzing it again during the link step. | ||||
|  | ||||
| TARGET_CFLAGS  += -flto | ||||
| TARGET_LDFLAGS += -fuse-linker-plugin | ||||
|  | ||||
| MAKE_VARS += \ | ||||
|         LIBNL_NAME="libnl-tiny" \ | ||||
|         LIBNL_GENL_NAME="libnl-tiny" | ||||
|  | ||||
| MAKE_FLAGS += \ | ||||
|         REVISION="$(PKG_VERSION)-openwrt-$(PKG_RELEASE)" | ||||
|  | ||||
| config-n := \ | ||||
| 	aggregation \ | ||||
| 	ap_isolation \ | ||||
| 	backbonetable \ | ||||
| 	bisect_iv \ | ||||
| 	bonding \ | ||||
| 	bridge_loop_avoidance \ | ||||
| 	claimtable \ | ||||
| 	dat_cache \ | ||||
| 	distributed_arp_table \ | ||||
| 	elp_interval \ | ||||
| 	event \ | ||||
| 	fragmentation \ | ||||
| 	gateways \ | ||||
| 	gw_mode \ | ||||
| 	hop_penalty \ | ||||
| 	interface \ | ||||
| 	isolation_mark \ | ||||
| 	loglevel \ | ||||
| 	mcast_flags \ | ||||
| 	multicast_fanout \ | ||||
| 	multicast_forceflood \ | ||||
| 	multicast_mode \ | ||||
| 	nc_nodes \ | ||||
| 	neighbors \ | ||||
| 	network_coding \ | ||||
| 	orig_interval \ | ||||
| 	originators \ | ||||
| 	ping \ | ||||
| 	routing_algo \ | ||||
| 	statistics \ | ||||
| 	tcpdump \ | ||||
| 	throughput_override \ | ||||
| 	throughputmeter \ | ||||
| 	traceroute \ | ||||
| 	transglobal \ | ||||
| 	translate \ | ||||
| 	translocal \ | ||||
|  | ||||
| config-settings := \ | ||||
| 	aggregation \ | ||||
| 	ap_isolation \ | ||||
| 	bonding \ | ||||
| 	bridge_loop_avoidance \ | ||||
| 	distributed_arp_table \ | ||||
| 	elp_interval \ | ||||
| 	fragmentation \ | ||||
| 	gw_mode \ | ||||
| 	hop_penalty \ | ||||
| 	interface \ | ||||
| 	isolation_mark \ | ||||
| 	loglevel \ | ||||
| 	multicast_fanout \ | ||||
| 	multicast_forceflood \ | ||||
| 	multicast_mode \ | ||||
| 	network_coding \ | ||||
| 	orig_interval \ | ||||
| 	routing_algo \ | ||||
| 	throughput_override \ | ||||
|  | ||||
| config-tables := \ | ||||
| 	backbonetable \ | ||||
| 	claimtable \ | ||||
| 	dat_cache \ | ||||
| 	gateways \ | ||||
| 	loglevel \ | ||||
| 	nc_nodes \ | ||||
| 	neighbors \ | ||||
| 	originators \ | ||||
| 	statistics \ | ||||
| 	transglobal \ | ||||
| 	translocal \ | ||||
|  | ||||
| config-tools := \ | ||||
| 	event \ | ||||
| 	ping \ | ||||
| 	tcpdump \ | ||||
| 	throughputmeter \ | ||||
| 	traceroute \ | ||||
| 	translate \ | ||||
|  | ||||
| config-extratools := \ | ||||
| 	bisect_iv \ | ||||
|  | ||||
| ifeq ($(BUILD_VARIANT),tiny) | ||||
|  | ||||
| config-y := \ | ||||
| 	$(config-settings) \ | ||||
|  | ||||
| endif | ||||
|  | ||||
| ifeq ($(BUILD_VARIANT),default) | ||||
|  | ||||
| config-y := \ | ||||
| 	$(config-settings) \ | ||||
| 	$(config-tables) \ | ||||
| 	$(config-tools) \ | ||||
|  | ||||
| endif | ||||
|  | ||||
| ifeq ($(BUILD_VARIANT),full) | ||||
|  | ||||
| config-y := \ | ||||
| 	$(config-settings) \ | ||||
| 	$(config-tables) \ | ||||
| 	$(config-tools) \ | ||||
| 	$(config-extratools) \ | ||||
|  | ||||
| endif | ||||
|  | ||||
| define ConfigVars | ||||
| $(subst $(space),,$(foreach opt,$(config-$(1)),CONFIG_$(opt)=$(1) | ||||
| )) | ||||
| endef | ||||
|  | ||||
| define batctl_config | ||||
| $(call ConfigVars,n)$(call ConfigVars,y) | ||||
| endef | ||||
| $(eval $(call shexport,batctl_config)) | ||||
|  | ||||
| MAKE_FLAGS += $$$$$(call shvar,batctl_config) | ||||
|  | ||||
| define Package/batctl-tiny/install | ||||
| 	$(INSTALL_DIR) $(1)/usr/libexec | ||||
| 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-tiny | ||||
| endef | ||||
|  | ||||
| define Package/batctl-default/install | ||||
| 	$(INSTALL_DIR) $(1)/usr/libexec | ||||
| 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-default | ||||
| endef | ||||
|  | ||||
| define Package/batctl-full/install | ||||
| 	$(INSTALL_DIR) $(1)/usr/libexec | ||||
| 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-full | ||||
| endef | ||||
|  | ||||
| $(eval $(call BuildPackage,batctl-default)) | ||||
| $(eval $(call BuildPackage,batctl-tiny)) | ||||
| $(eval $(call BuildPackage,batctl-full)) | ||||
							
								
								
									
										110
									
								
								feeds/wifi-ath10k/batman-adv/Config.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								feeds/wifi-ath10k/batman-adv/Config.in
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,110 @@ | ||||
| # SPDX-License-Identifier: GPL-2.0 | ||||
| # Copyright (C) 2007-2019  B.A.T.M.A.N. contributors: | ||||
| # | ||||
| # Marek Lindner, Simon Wunderlich | ||||
|  | ||||
| # | ||||
| # B.A.T.M.A.N meshing protocol | ||||
| # | ||||
|  | ||||
| config BATMAN_ADV_BATMAN_V | ||||
| 	bool "B.A.T.M.A.N. V protocol" | ||||
| 	depends on PACKAGE_kmod-batman-adv | ||||
| 	default y | ||||
| 	help | ||||
| 	  This option enables the B.A.T.M.A.N. V protocol, the successor | ||||
| 	  of the currently used B.A.T.M.A.N. IV protocol. The main | ||||
| 	  changes include splitting of the OGM protocol into a neighbor | ||||
| 	  discovery protocol (Echo Location Protocol, ELP) and a new OGM | ||||
| 	  Protocol OGMv2 for flooding protocol information through the | ||||
| 	  network, as well as a throughput based metric. | ||||
| 	  B.A.T.M.A.N. V is currently considered experimental and not | ||||
| 	  compatible to B.A.T.M.A.N. IV networks. | ||||
|  | ||||
| config BATMAN_ADV_BLA | ||||
| 	bool "Bridge Loop Avoidance" | ||||
| 	depends on PACKAGE_kmod-batman-adv | ||||
| 	select PACKAGE_kmod-lib-crc16 | ||||
| 	default y | ||||
| 	help | ||||
| 	  This option enables BLA (Bridge Loop Avoidance), a mechanism | ||||
| 	  to avoid Ethernet frames looping when mesh nodes are connected | ||||
| 	  to both the same LAN and the same mesh. If you will never use | ||||
| 	  more than one mesh node in the same LAN, you can safely remove | ||||
| 	  this feature and save some space. | ||||
|  | ||||
| config BATMAN_ADV_DAT | ||||
| 	bool "Distributed ARP Table" | ||||
| 	depends on PACKAGE_kmod-batman-adv | ||||
| 	default y | ||||
| 	help | ||||
| 	  This option enables DAT (Distributed ARP Table), a DHT based | ||||
| 	  mechanism that increases ARP reliability on sparse wireless | ||||
| 	  mesh networks. If you think that your network does not need | ||||
| 	  this option you can safely remove it and save some space. | ||||
|  | ||||
| config BATMAN_ADV_NC | ||||
| 	bool "Network Coding" | ||||
| 	depends on PACKAGE_kmod-batman-adv | ||||
| 	help | ||||
| 	  This option enables network coding, a mechanism that aims to | ||||
| 	  increase the overall network throughput by fusing multiple | ||||
| 	  packets in one transmission. | ||||
| 	  Note that interfaces controlled by batman-adv must be manually | ||||
| 	  configured to have promiscuous mode enabled in order to make | ||||
| 	  network coding work. | ||||
| 	  If you think that your network does not need this feature you | ||||
| 	  can safely disable it and save some space. | ||||
|  | ||||
| config BATMAN_ADV_MCAST | ||||
| 	bool "Multicast optimisation" | ||||
| 	depends on PACKAGE_kmod-batman-adv | ||||
| 	default y | ||||
| 	help | ||||
| 	  This option enables the multicast optimisation which aims to | ||||
| 	  reduce the air overhead while improving the reliability of | ||||
| 	  multicast messages. | ||||
|  | ||||
| config BATMAN_ADV_DEBUGFS | ||||
| 	bool "batman-adv debugfs entries" | ||||
| 	depends on PACKAGE_kmod-batman-adv | ||||
| 	select KERNEL_DEBUG_FS | ||||
| 	help | ||||
| 	  Enable this to export routing related debug tables via debugfs. | ||||
| 	  The information for each soft-interface and used hard-interface can be | ||||
| 	  found under batman_adv/ | ||||
|  | ||||
| 	  If unsure, say N. | ||||
|  | ||||
| config BATMAN_ADV_DEBUG | ||||
| 	bool "B.A.T.M.A.N. debugging" | ||||
| 	depends on PACKAGE_kmod-batman-adv | ||||
| 	help | ||||
| 	  This is an option for use by developers; most people should | ||||
| 	  say N here. This enables compilation of support for | ||||
| 	  outputting debugging information to the debugfs log or tracing | ||||
| 	  buffer. The output is controlled via the batadv netdev specific | ||||
| 	  log_level setting. | ||||
|  | ||||
| config BATMAN_ADV_SYSFS | ||||
| 	bool "batman-adv sysfs entries" | ||||
| 	depends on PACKAGE_kmod-batman-adv | ||||
| 	help | ||||
| 	  Say Y here if you want to enable batman-adv device configuration and | ||||
| 	  status interface through sysfs attributes. It is replaced by the | ||||
| 	  batadv generic netlink family but still used by various userspace | ||||
| 	  tools and scripts. | ||||
|  | ||||
| 	  If unsure, say Y. | ||||
|  | ||||
| config BATMAN_ADV_TRACING | ||||
| 	bool "B.A.T.M.A.N. tracing support" | ||||
| 	depends on PACKAGE_kmod-batman-adv | ||||
| 	select KERNEL_FTRACE | ||||
| 	select KERNEL_ENABLE_DEFAULT_TRACERS | ||||
| 	help | ||||
| 	  This is an option for use by developers; most people should | ||||
| 	  say N here. Select this option to gather traces like the debug | ||||
| 	  messages using the generic tracing infrastructure of the kernel. | ||||
| 	  BATMAN_ADV_DEBUG must also be selected to get trace events for | ||||
| 	  batadv_dbg. | ||||
							
								
								
									
										91
									
								
								feeds/wifi-ath10k/batman-adv/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								feeds/wifi-ath10k/batman-adv/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,91 @@ | ||||
| # SPDX-License-Identifier: GPL-2.0-only | ||||
|  | ||||
| include $(TOPDIR)/rules.mk | ||||
|  | ||||
| PKG_NAME:=batman-adv | ||||
| PKG_VERSION:=2020.2 | ||||
| PKG_RELEASE:=1 | ||||
|  | ||||
| PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | ||||
| PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) | ||||
| PKG_HASH:=a73f5ce72c6efa9dd7bd7cc8daa667d0982e12e40811c978bb652607bb5666a3 | ||||
| PKG_EXTMOD_SUBDIRS:=net/batman-adv | ||||
|  | ||||
| PKG_MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de> | ||||
| PKG_LICENSE:=GPL-2.0-only MIT | ||||
| PKG_LICENSE_FILES:=LICENSES/preferred/GPL-2.0 LICENSES/preferred/MIT | ||||
|  | ||||
| STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h | ||||
|  | ||||
| include $(INCLUDE_DIR)/kernel.mk | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
|  | ||||
| define KernelPackage/batman-adv | ||||
|   SUBMENU:=Network Support | ||||
|   TITLE:=B.A.T.M.A.N. Adv | ||||
|   URL:=https://www.open-mesh.org/ | ||||
|   DEPENDS:=+BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-lib-crc32c +kmod-cfg80211 +batctl | ||||
|   FILES:=$(PKG_BUILD_DIR)/net/batman-adv/batman-adv.$(LINUX_KMOD_SUFFIX) | ||||
|   AUTOLOAD:=$(call AutoProbe,batman-adv) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/batman-adv/description | ||||
|   B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is | ||||
|   a routing protocol for multi-hop ad-hoc mesh networks. The | ||||
|   networks may be wired or wireless. See | ||||
|   https://www.open-mesh.org/ for more information and user space | ||||
|   tools. This package builds version $(PKG_VERSION) of the kernel | ||||
|   module. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/batman-adv/config | ||||
| 	source "$(SOURCE)/Config.in" | ||||
| endef | ||||
|  | ||||
| define Package/kmod-batman-adv/conffiles | ||||
| /etc/config/batman-adv | ||||
| endef | ||||
|  | ||||
| PKG_EXTRA_KCONFIG:= \ | ||||
| 	CONFIG_BATMAN_ADV=m \ | ||||
| 	CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_BATMAN_ADV_DEBUG),y,n) \ | ||||
| 	CONFIG_BATMAN_ADV_DEBUGFS=$(if $(CONFIG_BATMAN_ADV_DEBUGFS),y,n) \ | ||||
| 	CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_BATMAN_ADV_BLA),y,n) \ | ||||
| 	CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_BATMAN_ADV_DAT),y,n) \ | ||||
| 	CONFIG_BATMAN_ADV_MCAST=$(if $(CONFIG_BATMAN_ADV_MCAST),y,n) \ | ||||
| 	CONFIG_BATMAN_ADV_NC=$(if $(CONFIG_BATMAN_ADV_NC),y,n) \ | ||||
| 	CONFIG_BATMAN_ADV_BATMAN_V=$(if $(CONFIG_BATMAN_ADV_BATMAN_V),y,n) \ | ||||
| 	CONFIG_BATMAN_ADV_SYSFS=$(if $(CONFIG_BATMAN_ADV_SYSFS),y,n) \ | ||||
| 	CONFIG_BATMAN_ADV_TRACING=$(if $(CONFIG_BATMAN_ADV_TRACING),y,n) \ | ||||
|  | ||||
| PKG_EXTRA_CFLAGS:= \ | ||||
| 	$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \ | ||||
| 	$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_EXTRA_KCONFIG)))) \ | ||||
|  | ||||
| NOSTDINC_FLAGS = \ | ||||
| 	-I$(PKG_BUILD_DIR)/net/batman-adv \ | ||||
| 	-I$(STAGING_DIR)/usr/include/mac80211-backport \ | ||||
| 	-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \ | ||||
| 	-I$(STAGING_DIR)/usr/include/mac80211 \ | ||||
| 	-I$(STAGING_DIR)/usr/include/mac80211/uapi \ | ||||
| 	-I$(PKG_BUILD_DIR)/include/ \ | ||||
| 	-include backport/autoconf.h \ | ||||
| 	-include backport/backport.h \ | ||||
| 	-include $(PKG_BUILD_DIR)/compat-hacks.h \ | ||||
| 	-DBATADV_SOURCE_VERSION=\\\"$(PKG_VERSION)-openwrt-$(PKG_RELEASE)\\\" | ||||
|  | ||||
| define Build/Compile | ||||
| 	$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ | ||||
| 		$(KERNEL_MAKE_FLAGS) \ | ||||
| 		M="$(PKG_BUILD_DIR)/net/batman-adv" \ | ||||
| 		$(PKG_EXTRA_KCONFIG) \ | ||||
| 		EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS)" \ | ||||
| 		NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \ | ||||
| 		modules | ||||
| endef | ||||
|  | ||||
| define KernelPackage/batman-adv/install | ||||
| 	$(CP) ./files/. $(1)/ | ||||
| endef | ||||
|  | ||||
| $(eval $(call KernelPackage,batman-adv)) | ||||
							
								
								
									
										97
									
								
								feeds/wifi-ath10k/batman-adv/files/etc/uci-defaults/99-migrate-batadv_hardif
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										97
									
								
								feeds/wifi-ath10k/batman-adv/files/etc/uci-defaults/99-migrate-batadv_hardif
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,97 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| # This UCI-Defaults script will split the batadv proto network interfaces | ||||
| # in batadv_hardif and batadv proto. The configuration options from | ||||
| # /etc/config/batman-adv will be moved to the latter. | ||||
|  | ||||
| . /lib/functions.sh | ||||
|  | ||||
| proto_batadv_to_batadv_hardif() { | ||||
|     local section="$1" | ||||
|     local proto | ||||
|     local mesh | ||||
|     local routing_algo | ||||
|  | ||||
|     config_get proto "${section}" proto | ||||
|     config_get mesh "${section}" mesh | ||||
|     config_get routing_algo "${section}" routing_algo | ||||
|  | ||||
|     if [ -z "$mesh" -o "${proto}" != "batadv" ]; then | ||||
|         continue | ||||
|     fi | ||||
|  | ||||
|     uci set network."${section}".proto="batadv_hardif" | ||||
|     uci rename network."${section}".mesh="master" | ||||
|     uci delete network."${section}".routing_algo | ||||
|  | ||||
|     # create new section or adjust existing one | ||||
|     uci set network."${mesh}"=interface | ||||
|     uci set network."${mesh}".proto=batadv | ||||
|     [ -n "${routing_algo}" ]  && uci set network."${mesh}".routing_algo="${routing_algo}" | ||||
| } | ||||
|  | ||||
| mv_batadv_config_section() { | ||||
|     local section="$1" | ||||
|     local aggregated_ogms | ||||
|     local ap_isolation | ||||
|     local bonding | ||||
|     local bridge_loop_avoidance | ||||
|     local distributed_arp_table | ||||
|     local fragmentation | ||||
|     local gw_bandwidth | ||||
|     local gw_mode | ||||
|     local gw_sel_class | ||||
|     local hop_penalty | ||||
|     local isolation_mark | ||||
|     local log_level | ||||
|     local multicast_mode | ||||
|     local network_coding | ||||
|     local orig_interval | ||||
|  | ||||
|     config_get aggregated_ogms "${section}" aggregated_ogms | ||||
|     config_get ap_isolation "${section}" ap_isolation | ||||
|     config_get bonding "${section}" bonding | ||||
|     config_get bridge_loop_avoidance "${section}" bridge_loop_avoidance | ||||
|     config_get distributed_arp_table "${section}" distributed_arp_table | ||||
|     config_get fragmentation "${section}" fragmentation | ||||
|     config_get gw_bandwidth "${section}" gw_bandwidth | ||||
|     config_get gw_mode "${section}" gw_mode | ||||
|     config_get gw_sel_class "${section}" gw_sel_class | ||||
|     config_get hop_penalty "${section}" hop_penalty | ||||
|     config_get isolation_mark "${section}" isolation_mark | ||||
|     config_get log_level "${section}" log_level | ||||
|     config_get multicast_mode "${section}" multicast_mode | ||||
|     config_get network_coding "${section}" network_coding | ||||
|     config_get orig_interval "${section}" orig_interval | ||||
|  | ||||
|     # update section in case it exists | ||||
|     [ -n "${aggregated_ogms}" ]  && uci set network."${section}".aggregated_ogms="${aggregated_ogms}" | ||||
|     [ -n "${ap_isolation}" ]  && uci set network."${section}".ap_isolation="${ap_isolation}" | ||||
|     [ -n "${bonding}" ]  && uci set network."${section}".bonding="${bonding}" | ||||
|     [ -n "${bridge_loop_avoidance}" ]  && uci set network."${section}".bridge_loop_avoidance="${bridge_loop_avoidance}" | ||||
|     [ -n "${distributed_arp_table}" ]  && uci set network."${section}".distributed_arp_table="${distributed_arp_table}" | ||||
|     [ -n "${fragmentation}" ]  && uci set network."${section}".fragmentation="${fragmentation}" | ||||
|     [ -n "${gw_bandwidth}" ]  && uci set network."${section}".gw_bandwidth="${gw_bandwidth}" | ||||
|     [ -n "${gw_mode}" ]  && uci set network."${section}".gw_mode="${gw_mode}" | ||||
|     [ -n "${gw_sel_class}" ]  && uci set network."${section}".gw_sel_class="${gw_sel_class}" | ||||
|     [ -n "${hop_penalty}" ]  && uci set network."${section}".hop_penalty="${hop_penalty}" | ||||
|     [ -n "${isolation_mark}" ]  && uci set network."${section}".isolation_mark="${isolation_mark}" | ||||
|     [ -n "${log_level}" ]  && uci set network."${section}".log_level="${log_level}" | ||||
|     [ -n "${multicast_mode}" ]  && uci set network."${section}".multicast_mode="${multicast_mode}" | ||||
|     [ -n "${network_coding}" ]  && uci set network."${section}".network_coding="${network_coding}" | ||||
|     [ -n "${orig_interval}" ]  && uci set network."${section}".orig_interval="${orig_interval}" | ||||
| } | ||||
|  | ||||
| if [ -f /etc/config/batman-adv ]; then | ||||
|     config_load network | ||||
|     config_foreach proto_batadv_to_batadv_hardif 'interface' | ||||
|     uci commit network | ||||
|  | ||||
|     config_load batman-adv | ||||
|     config_foreach mv_batadv_config_section 'mesh' | ||||
|     uci commit network | ||||
|  | ||||
|     rm -f /etc/config/batman-adv | ||||
| fi | ||||
|  | ||||
| exit 0 | ||||
							
								
								
									
										123
									
								
								feeds/wifi-ath10k/batman-adv/files/lib/netifd/proto/batadv.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										123
									
								
								feeds/wifi-ath10k/batman-adv/files/lib/netifd/proto/batadv.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,123 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| [ -n "$INCLUDE_ONLY" ] || { | ||||
| 	. /lib/functions.sh | ||||
| 	. ../netifd-proto.sh | ||||
| 	init_proto "$@" | ||||
| } | ||||
|  | ||||
| proto_batadv_init_config() { | ||||
| 	no_device=1 | ||||
| 	available=1 | ||||
|  | ||||
| 	proto_config_add_boolean 'aggregated_ogms:bool' | ||||
| 	proto_config_add_boolean 'ap_isolation:bool' | ||||
| 	proto_config_add_boolean 'bonding:bool' | ||||
| 	proto_config_add_boolean 'bridge_loop_avoidance:bool' | ||||
| 	proto_config_add_boolean 'distributed_arp_table:bool' | ||||
| 	proto_config_add_boolean 'fragmentation:bool' | ||||
| 	proto_config_add_string 'gw_bandwidth' | ||||
| 	proto_config_add_string 'gw_mode' | ||||
| 	proto_config_add_int 'gw_sel_class' | ||||
| 	proto_config_add_int 'hop_penalty' | ||||
| 	proto_config_add_string 'isolation_mark' | ||||
| 	proto_config_add_string 'log_level' | ||||
| 	proto_config_add_int 'multicast_fanout' | ||||
| 	proto_config_add_boolean 'multicast_mode:bool' | ||||
| 	proto_config_add_boolean 'network_coding:bool' | ||||
| 	proto_config_add_int 'orig_interval' | ||||
| 	proto_config_add_string 'routing_algo' | ||||
| } | ||||
|  | ||||
| proto_batadv_setup() { | ||||
| 	local config="$1" | ||||
| 	local iface="$config" | ||||
|  | ||||
| 	local aggregated_ogms | ||||
| 	local ap_isolation | ||||
| 	local bonding | ||||
| 	local bridge_loop_avoidance | ||||
| 	local distributed_arp_table | ||||
| 	local fragmentation | ||||
| 	local gw_bandwidth | ||||
| 	local gw_mode | ||||
| 	local gw_sel_class | ||||
| 	local hop_penalty | ||||
| 	local isolation_mark | ||||
| 	local log_level | ||||
| 	local multicast_fanout | ||||
| 	local multicast_mode | ||||
| 	local network_coding | ||||
| 	local orig_interval | ||||
| 	local routing_algo | ||||
|  | ||||
| 	json_get_vars aggregated_ogms | ||||
| 	json_get_vars ap_isolation | ||||
| 	json_get_vars bonding | ||||
| 	json_get_vars bridge_loop_avoidance | ||||
| 	json_get_vars distributed_arp_table | ||||
| 	json_get_vars fragmentation | ||||
| 	json_get_vars gw_bandwidth | ||||
| 	json_get_vars gw_mode | ||||
| 	json_get_vars gw_sel_class | ||||
| 	json_get_vars hop_penalty | ||||
| 	json_get_vars isolation_mark | ||||
| 	json_get_vars log_level | ||||
| 	json_get_vars multicast_fanout | ||||
| 	json_get_vars multicast_mode | ||||
| 	json_get_vars network_coding | ||||
| 	json_get_vars orig_interval | ||||
| 	json_get_vars routing_algo | ||||
|  | ||||
| 	set_default routing_algo 'BATMAN_IV' | ||||
|  | ||||
| 	batctl routing_algo "$routing_algo" | ||||
| 	batctl meshif "$iface" interface create | ||||
|  | ||||
| 	[ -n "$aggregated_ogms" ] && batctl meshif "$iface" aggregation "$aggregated_ogms" | ||||
| 	[ -n "$ap_isolation" ] && batctl meshif "$iface" ap_isolation "$ap_isolation" | ||||
| 	[ -n "$bonding" ] && batctl meshif "$iface" bonding "$bonding" | ||||
| 	[ -n "$bridge_loop_avoidance" ] &&  batctl meshif "$iface" bridge_loop_avoidance "$bridge_loop_avoidance" 2>&- | ||||
| 	[ -n "$distributed_arp_table" ] && batctl meshif "$iface" distributed_arp_table "$distributed_arp_table" 2>&- | ||||
| 	[ -n "$fragmentation" ] && batctl meshif "$iface" fragmentation "$fragmentation" | ||||
|  | ||||
| 	case "$gw_mode" in | ||||
| 	server) | ||||
| 		if [ -n "$gw_bandwidth" ]; then | ||||
| 			batctl meshif "$iface" gw_mode "server" "$gw_bandwidth" | ||||
| 		else | ||||
| 			batctl meshif "$iface" gw_mode "server" | ||||
| 		fi | ||||
| 		;; | ||||
| 	client) | ||||
| 		if [ -n "$gw_sel_class" ]; then | ||||
| 			batctl meshif "$iface" gw_mode "client" "$gw_sel_class" | ||||
| 		else | ||||
| 			batctl meshif "$iface" gw_mode "client" | ||||
| 		fi | ||||
| 		;; | ||||
| 	*) | ||||
| 		batctl meshif "$iface" gw_mode "off" | ||||
| 		;; | ||||
| 	esac | ||||
|  | ||||
| 	[ -n "$hop_penalty" ] && batctl meshif "$iface" hop_penalty "$hop_penalty" | ||||
| 	[ -n "$isolation_mark" ] && batctl meshif "$iface" isolation_mark "$isolation_mark" | ||||
| 	[ -n "$multicast_fanout" ] && batctl meshif "$iface" multicast_fanout "$multicast_fanout" | ||||
| 	[ -n "$multicast_mode" ] && batctl meshif "$iface" multicast_mode "$multicast_mode" 2>&- | ||||
| 	[ -n "$network_coding" ] && batctl meshif "$iface" network_coding "$network_coding" 2>&- | ||||
| 	[ -n "$log_level" ] && batctl meshif "$iface" loglevel "$log_level" 2>&- | ||||
| 	[ -n "$orig_interval" ] && batctl meshif "$iface" orig_interval "$orig_interval" | ||||
|  | ||||
| 	proto_init_update "$iface" 1 | ||||
| 	proto_send_update "$config" | ||||
| } | ||||
|  | ||||
| proto_batadv_teardown() { | ||||
| 	local config="$1" | ||||
| 	local iface="$config" | ||||
|  | ||||
| 	batctl meshif "$iface" interface destroy | ||||
| } | ||||
|  | ||||
| add_protocol batadv | ||||
							
								
								
									
										49
									
								
								feeds/wifi-ath10k/batman-adv/files/lib/netifd/proto/batadv_hardif.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										49
									
								
								feeds/wifi-ath10k/batman-adv/files/lib/netifd/proto/batadv_hardif.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,49 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| [ -n "$INCLUDE_ONLY" ] || { | ||||
| 	. /lib/functions.sh | ||||
| 	. ../netifd-proto.sh | ||||
| 	init_proto "$@" | ||||
| } | ||||
|  | ||||
| proto_batadv_hardif_init_config() { | ||||
| 	proto_config_add_int 'elp_interval' | ||||
| 	proto_config_add_string "master" | ||||
| 	proto_config_add_string 'throughput_override' | ||||
| } | ||||
|  | ||||
| proto_batadv_hardif_setup() { | ||||
| 	local config="$1" | ||||
| 	local iface="$2" | ||||
|  | ||||
| 	local elp_interval | ||||
| 	local master | ||||
| 	local throughput_override | ||||
|  | ||||
| 	json_get_vars elp_interval | ||||
| 	json_get_vars master | ||||
| 	json_get_vars throughput_override | ||||
|  | ||||
| 	( proto_add_host_dependency "$config" '' "$master" ) | ||||
|  | ||||
| 	batctl meshif "$master" interface -M add "$iface" | ||||
|  | ||||
| 	[ -n "$elp_interval" ] && batctl hardif "$iface" elp_interval "$elp_interval" | ||||
| 	[ -n "$throughput_override" ] && batctl hardif "$iface" throughput_override "$throughput_override" | ||||
|  | ||||
| 	proto_init_update "$iface" 1 | ||||
| 	proto_send_update "$config" | ||||
| } | ||||
|  | ||||
| proto_batadv_hardif_teardown() { | ||||
| 	local config="$1" | ||||
| 	local iface="$2" | ||||
|  | ||||
| 	local master | ||||
|  | ||||
| 	json_get_vars master | ||||
|  | ||||
| 	batctl meshif "$master" interface -M del "$iface" || true | ||||
| } | ||||
|  | ||||
| add_protocol batadv_hardif | ||||
							
								
								
									
										25
									
								
								feeds/wifi-ath10k/batman-adv/files/lib/netifd/proto/batadv_vlan.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										25
									
								
								feeds/wifi-ath10k/batman-adv/files/lib/netifd/proto/batadv_vlan.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| . /lib/functions.sh | ||||
| . ../netifd-proto.sh | ||||
| init_proto "$@" | ||||
|  | ||||
| proto_batadv_vlan_init_config() { | ||||
| 	proto_config_add_boolean 'ap_isolation:bool' | ||||
| } | ||||
|  | ||||
| proto_batadv_vlan_setup() { | ||||
| 	local config="$1" | ||||
| 	local iface="$2" | ||||
|  | ||||
| 	# batadv_vlan options | ||||
| 	local ap_isolation | ||||
|  | ||||
| 	json_get_vars ap_isolation | ||||
|  | ||||
| 	[ -n "$ap_isolation" ] && batctl vlan "$iface" ap_isolation "$ap_isolation" | ||||
| 	proto_init_update "$iface" 1 | ||||
| 	proto_send_update "$config" | ||||
| } | ||||
|  | ||||
| add_protocol batadv_vlan | ||||
							
								
								
									
										181
									
								
								feeds/wifi-ath10k/batman-adv/src/compat-hacks.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										181
									
								
								feeds/wifi-ath10k/batman-adv/src/compat-hacks.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,181 @@ | ||||
| /* Please avoid adding hacks here - instead add it to mac80211/backports.git */ | ||||
|  | ||||
| #undef CONFIG_MODULE_STRIPPED | ||||
|  | ||||
| #include <linux/version.h>	/* LINUX_VERSION_CODE */ | ||||
| #include <linux/types.h> | ||||
|  | ||||
| #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) | ||||
|  | ||||
| #include <linux/netdevice.h> | ||||
|  | ||||
| #define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info, extack) ({\ | ||||
| 	BUILD_BUG_ON(extack != NULL); \ | ||||
| 	netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info); \ | ||||
| }) | ||||
|  | ||||
| #endif /* < KERNEL_VERSION(4, 15, 0) */ | ||||
|  | ||||
|  | ||||
| #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0) | ||||
|  | ||||
| #ifndef sizeof_field | ||||
| #define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER)) | ||||
| #endif | ||||
|  | ||||
| #endif /* < KERNEL_VERSION(4, 16, 0) */ | ||||
|  | ||||
|  | ||||
| #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) | ||||
|  | ||||
| #include_next <linux/igmp.h> | ||||
| #include_next <net/addrconf.h> | ||||
|  | ||||
| static inline int batadv_ipv6_mc_check_mld1(struct sk_buff *skb) | ||||
| { | ||||
| 	return ipv6_mc_check_mld(skb, NULL); | ||||
| } | ||||
|  | ||||
| static inline int batadv_ipv6_mc_check_mld2(struct sk_buff *skb, | ||||
| 					    struct sk_buff **skb_trimmed) | ||||
| { | ||||
| 	return ipv6_mc_check_mld(skb, skb_trimmed); | ||||
| } | ||||
|  | ||||
| #define ipv6_mc_check_mld_get(_1, _2, ipv6_mc_check_mld_name, ...) ipv6_mc_check_mld_name | ||||
| #define ipv6_mc_check_mld(...) \ | ||||
| 	ipv6_mc_check_mld_get(__VA_ARGS__, batadv_ipv6_mc_check_mld2, batadv_ipv6_mc_check_mld1)(__VA_ARGS__) | ||||
|  | ||||
| static inline int batadv_ip_mc_check_igmp1(struct sk_buff *skb) | ||||
| { | ||||
| 	return ip_mc_check_igmp(skb, NULL); | ||||
| } | ||||
|  | ||||
| static inline int batadv_ip_mc_check_igmp2(struct sk_buff *skb, | ||||
| 					   struct sk_buff **skb_trimmed) | ||||
| { | ||||
| 	return ip_mc_check_igmp(skb, skb_trimmed); | ||||
| } | ||||
|  | ||||
| #define ip_mc_check_igmp_get(_1, _2, ip_mc_check_igmp_name, ...) ip_mc_check_igmp_name | ||||
| #define ip_mc_check_igmp(...) \ | ||||
| 	ip_mc_check_igmp_get(__VA_ARGS__, batadv_ip_mc_check_igmp2, batadv_ip_mc_check_igmp1)(__VA_ARGS__) | ||||
|  | ||||
| #endif /* < KERNEL_VERSION(5, 1, 0) */ | ||||
|  | ||||
|  | ||||
| #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) | ||||
|  | ||||
| #define batadv_softif_slave_add(__dev, __slave_dev, __extack) \ | ||||
| 	batadv_softif_slave_add(__dev, __slave_dev) | ||||
|  | ||||
| #endif /* < KERNEL_VERSION(4, 15, 0) */ | ||||
|  | ||||
|  | ||||
| #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) | ||||
|  | ||||
| static inline int batadv_access_ok(int type, const void __user *p, | ||||
| 				   unsigned long size) | ||||
| { | ||||
| 	return access_ok(type, p, size); | ||||
| } | ||||
|  | ||||
| #ifdef access_ok | ||||
| #undef access_ok | ||||
| #endif | ||||
|  | ||||
| #define access_ok_get(_1, _2, _3 , access_ok_name, ...) access_ok_name | ||||
| #define access_ok(...) \ | ||||
| 	access_ok_get(__VA_ARGS__, access_ok3, access_ok2)(__VA_ARGS__) | ||||
|  | ||||
| #define access_ok2(addr, size)	batadv_access_ok(VERIFY_WRITE, (addr), (size)) | ||||
| #define access_ok3(type, addr, size)	batadv_access_ok((type), (addr), (size)) | ||||
|  | ||||
| #endif /* < KERNEL_VERSION(5, 0, 0) */ | ||||
|  | ||||
| #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0) | ||||
|  | ||||
| #ifndef fallthrough | ||||
| #if __GNUC__ > 7 && !defined(__CHECKER__) | ||||
| # define fallthrough                    __attribute__((__fallthrough__)) | ||||
| #else | ||||
| # define fallthrough                    do {} while (0)  /* fallthrough */ | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #endif /* < KERNEL_VERSION(5, 4, 0) */ | ||||
|  | ||||
| /* <DECLARE_EWMA> */ | ||||
|  | ||||
| #include <linux/version.h> | ||||
| #include_next <linux/average.h> | ||||
|  | ||||
| #include <linux/bug.h> | ||||
|  | ||||
| #ifdef DECLARE_EWMA | ||||
| #undef DECLARE_EWMA | ||||
| #endif /* DECLARE_EWMA */ | ||||
|  | ||||
| /* | ||||
|  * Exponentially weighted moving average (EWMA) | ||||
|  * | ||||
|  * This implements a fixed-precision EWMA algorithm, with both the | ||||
|  * precision and fall-off coefficient determined at compile-time | ||||
|  * and built into the generated helper funtions. | ||||
|  * | ||||
|  * The first argument to the macro is the name that will be used | ||||
|  * for the struct and helper functions. | ||||
|  * | ||||
|  * The second argument, the precision, expresses how many bits are | ||||
|  * used for the fractional part of the fixed-precision values. | ||||
|  * | ||||
|  * The third argument, the weight reciprocal, determines how the | ||||
|  * new values will be weighed vs. the old state, new values will | ||||
|  * get weight 1/weight_rcp and old values 1-1/weight_rcp. Note | ||||
|  * that this parameter must be a power of two for efficiency. | ||||
|  */ | ||||
|  | ||||
| #define DECLARE_EWMA(name, _precision, _weight_rcp)			\ | ||||
| 	struct ewma_##name {						\ | ||||
| 		unsigned long internal;					\ | ||||
| 	};								\ | ||||
| 	static inline void ewma_##name##_init(struct ewma_##name *e)	\ | ||||
| 	{								\ | ||||
| 		BUILD_BUG_ON(!__builtin_constant_p(_precision));	\ | ||||
| 		BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp));	\ | ||||
| 		/*							\ | ||||
| 		 * Even if you want to feed it just 0/1 you should have	\ | ||||
| 		 * some bits for the non-fractional part...		\ | ||||
| 		 */							\ | ||||
| 		BUILD_BUG_ON((_precision) > 30);			\ | ||||
| 		BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp);		\ | ||||
| 		e->internal = 0;					\ | ||||
| 	}								\ | ||||
| 	static inline unsigned long					\ | ||||
| 	ewma_##name##_read(struct ewma_##name *e)			\ | ||||
| 	{								\ | ||||
| 		BUILD_BUG_ON(!__builtin_constant_p(_precision));	\ | ||||
| 		BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp));	\ | ||||
| 		BUILD_BUG_ON((_precision) > 30);			\ | ||||
| 		BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp);		\ | ||||
| 		return e->internal >> (_precision);			\ | ||||
| 	}								\ | ||||
| 	static inline void ewma_##name##_add(struct ewma_##name *e,	\ | ||||
| 					     unsigned long val)		\ | ||||
| 	{								\ | ||||
| 		unsigned long internal = READ_ONCE(e->internal);	\ | ||||
| 		unsigned long weight_rcp = ilog2(_weight_rcp);		\ | ||||
| 		unsigned long precision = _precision;			\ | ||||
| 									\ | ||||
| 		BUILD_BUG_ON(!__builtin_constant_p(_precision));	\ | ||||
| 		BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp));	\ | ||||
| 		BUILD_BUG_ON((_precision) > 30);			\ | ||||
| 		BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp);		\ | ||||
| 									\ | ||||
| 		WRITE_ONCE(e->internal, internal ?			\ | ||||
| 			(((internal << weight_rcp) - internal) +	\ | ||||
| 				(val << precision)) >> weight_rcp :	\ | ||||
| 			(val << precision));				\ | ||||
| 	} | ||||
|  | ||||
| /* </DECLARE_EWMA> */ | ||||
							
								
								
									
										544
									
								
								feeds/wifi-ath10k/mac80211/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										544
									
								
								feeds/wifi-ath10k/mac80211/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,544 @@ | ||||
| # | ||||
| # Copyright (C) 2007-2015 OpenWrt.org | ||||
| # | ||||
| # This is free software, licensed under the GNU General Public License v2. | ||||
| # See /LICENSE for more information. | ||||
| # | ||||
|  | ||||
| include $(TOPDIR)/rules.mk | ||||
| include $(INCLUDE_DIR)/kernel.mk | ||||
|  | ||||
| PKG_NAME:=mac80211 | ||||
|  | ||||
| PKG_VERSION:=5.8-1 | ||||
| PKG_RELEASE:=1 | ||||
| PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.8/ | ||||
| PKG_HASH:=19b4174d89bf11ee221458e11f1e8dace26558498774b823051156f522d2036b | ||||
|  | ||||
| PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz | ||||
| PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) | ||||
| PKG_BUILD_PARALLEL:=1 | ||||
|  | ||||
| PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name> | ||||
|  | ||||
| PKG_DRIVERS = \ | ||||
| 	adm8211 \ | ||||
| 	airo \ | ||||
| 	hermes hermes-pci hermes-pcmcia hermes-plx\ | ||||
| 	lib80211 \ | ||||
| 	mac80211-hwsim \ | ||||
| 	mt7601u \ | ||||
| 	p54-common p54-pci p54-usb \ | ||||
| 	rsi91x rsi91x-usb rsi91x-sdio\ | ||||
| 	wlcore wl12xx wl18xx \ | ||||
| 	zd1211rw | ||||
|  | ||||
| PKG_CONFIG_DEPENDS:= \ | ||||
| 	CONFIG_PACKAGE_kmod-mac80211 \ | ||||
| 	CONFIG_PACKAGE_CFG80211_TESTMODE \ | ||||
| 	CONFIG_PACKAGE_MAC80211_DEBUGFS \ | ||||
| 	CONFIG_PACKAGE_MAC80211_MESH \ | ||||
| 	CONFIG_PACKAGE_MAC80211_TRACING \ | ||||
| 	CONFIG_PACKAGE_IWLWIFI_DEBUG \ | ||||
| 	CONFIG_PACKAGE_IWLWIFI_DEBUGFS \ | ||||
| 	CONFIG_PACKAGE_RTLWIFI_DEBUG \ | ||||
|  | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
|  | ||||
| WMENU:=Wireless Drivers | ||||
|  | ||||
| define KernelPackage/mac80211/Default | ||||
|   SUBMENU:=$(WMENU) | ||||
|   URL:=https://wireless.wiki.kernel.org/ | ||||
|   MAINTAINER:=Felix Fietkau <nbd@nbd.name> | ||||
| endef | ||||
|  | ||||
| config_package=$(if $(CONFIG_PACKAGE_kmod-$(1)),m) | ||||
|  | ||||
| config-y:= \ | ||||
| 	WLAN \ | ||||
| 	CFG80211_WEXT \ | ||||
| 	CFG80211_CERTIFICATION_ONUS \ | ||||
| 	MAC80211_RC_MINSTREL \ | ||||
| 	MAC80211_RC_MINSTREL_HT \ | ||||
| 	MAC80211_RC_MINSTREL_VHT \ | ||||
| 	MAC80211_RC_DEFAULT_MINSTREL \ | ||||
| 	WLAN_VENDOR_ADMTEK \ | ||||
| 	WLAN_VENDOR_ATH \ | ||||
| 	WLAN_VENDOR_ATMEL \ | ||||
| 	WLAN_VENDOR_BROADCOM \ | ||||
| 	WLAN_VENDOR_CISCO \ | ||||
| 	WLAN_VENDOR_INTEL \ | ||||
| 	WLAN_VENDOR_INTERSIL \ | ||||
| 	WLAN_VENDOR_MARVELL \ | ||||
| 	WLAN_VENDOR_MEDIATEK \ | ||||
| 	WLAN_VENDOR_RALINK \ | ||||
| 	WLAN_VENDOR_REALTEK \ | ||||
| 	WLAN_VENDOR_RSI \ | ||||
| 	WLAN_VENDOR_ST \ | ||||
| 	WLAN_VENDOR_TI \ | ||||
| 	WLAN_VENDOR_ZYDAS \ | ||||
|  | ||||
| config-$(call config_package,cfg80211) += CFG80211 | ||||
| config-$(CONFIG_PACKAGE_CFG80211_TESTMODE) += NL80211_TESTMODE | ||||
|  | ||||
| config-$(call config_package,mac80211) += MAC80211 | ||||
| config-$(CONFIG_PACKAGE_MAC80211_MESH) += MAC80211_MESH | ||||
|  | ||||
| include ath.mk | ||||
| include broadcom.mk | ||||
| include intel.mk | ||||
| include marvell.mk | ||||
| include ralink.mk | ||||
| include realtek.mk | ||||
|  | ||||
| PKG_CONFIG_DEPENDS += \ | ||||
| 	$(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS)) | ||||
|  | ||||
| define KernelPackage/cfg80211 | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=cfg80211 - wireless configuration API | ||||
|   DEPENDS+= +iw +wireless-regdb | ||||
|   ABI_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE) | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/compat/compat.ko \ | ||||
| 	$(PKG_BUILD_DIR)/net/wireless/cfg80211.ko | ||||
| endef | ||||
|  | ||||
| define KernelPackage/cfg80211/description | ||||
| cfg80211 is the Linux wireless LAN (802.11) configuration API. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/cfg80211/config | ||||
|   if PACKAGE_kmod-cfg80211 | ||||
|  | ||||
| 	config PACKAGE_CFG80211_TESTMODE | ||||
| 		bool "Enable testmode command support" | ||||
| 		default n | ||||
| 		help | ||||
| 		  This is typically used for tests and calibration during | ||||
| 		  manufacturing, or vendor specific debugging features | ||||
|  | ||||
|   endif | ||||
| endef | ||||
|  | ||||
|  | ||||
| define KernelPackage/mac80211 | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Linux 802.11 Wireless Networking Stack | ||||
|   # +kmod-crypto-cmac is a runtime only dependency of net/mac80211/aes_cmac.c | ||||
|   DEPENDS+= +kmod-cfg80211 +hostapd-common | ||||
|   KCONFIG:=\ | ||||
| 	CONFIG_AVERAGE=y | ||||
|   FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko | ||||
|   ABI_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE) | ||||
|   MENU:=1 | ||||
| endef | ||||
|  | ||||
| define KernelPackage/mac80211/config | ||||
|   if PACKAGE_kmod-mac80211 | ||||
|  | ||||
| 	config PACKAGE_MAC80211_DEBUGFS | ||||
| 		bool "Export mac80211 internals in DebugFS" | ||||
| 		select KERNEL_DEBUG_FS | ||||
| 		default y | ||||
| 		help | ||||
| 		  Select this to see extensive information about | ||||
| 		  the internal state of mac80211 in debugfs. | ||||
|  | ||||
| 	config PACKAGE_MAC80211_TRACING | ||||
| 		bool "Enable tracing (mac80211 and supported drivers)" | ||||
| 		select KERNEL_FTRACE | ||||
| 		select KERNEL_ENABLE_DEFAULT_TRACERS | ||||
| 		default n | ||||
| 		help | ||||
| 		  Select this to enable tracing of mac80211 and | ||||
| 		  related wifi drivers (using trace-cmd). | ||||
|  | ||||
| 	config PACKAGE_MAC80211_MESH | ||||
| 		bool "Enable 802.11s mesh support" | ||||
| 		default y | ||||
|  | ||||
|   endif | ||||
| endef | ||||
|  | ||||
| define KernelPackage/mac80211/description | ||||
| Generic IEEE 802.11 Networking Stack (mac80211) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/adm8211 | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=ADMTek 8211 support | ||||
|   DEPENDS+=@PCI_SUPPORT +kmod-mac80211 +kmod-eeprom-93cx6 | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/admtek/adm8211.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,adm8211) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/airo | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Cisco Aironet driver | ||||
|   DEPENDS+=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-cfg80211 @TARGET_x86 @BROKEN | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/cisco/airo.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,airo) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/airo/description | ||||
|  Kernel support for Cisco Aironet cards | ||||
| endef | ||||
|  | ||||
| define KernelPackage/hermes | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Hermes 802.11b chipset support | ||||
|   DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT +kmod-crypto-michael-mic | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/orinoco/orinoco.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,orinoco) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/hermes/description | ||||
|  Kernel support for Hermes 802.11b chipsets | ||||
| endef | ||||
|  | ||||
| define KernelPackage/hermes-pci | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Intersil Prism 2.5 PCI support | ||||
|   DEPENDS:=@PCI_SUPPORT +kmod-hermes | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/orinoco/orinoco_pci.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,orinoco_pci) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/hermes-pci/description | ||||
|  Kernel modules for Intersil Prism 2.5 PCI support | ||||
| endef | ||||
|  | ||||
| define KernelPackage/hermes-plx | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=PLX9052 based PCI adaptor | ||||
|   DEPENDS:=@PCI_SUPPORT +kmod-hermes | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/orinoco/orinoco_plx.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,orinoco_plx) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/hermes-plx/description | ||||
|  Kernel modules for Hermes in PLX9052 based PCI adaptors | ||||
| endef | ||||
|  | ||||
| define KernelPackage/hermes-pcmcia | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Hermes based PCMCIA adaptors | ||||
|   DEPENDS:=@PCMCIA_SUPPORT +kmod-hermes +kmod-pcmcia-core | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/orinoco/orinoco_cs.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,orinoco_cs) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/hermes-pcmcia/description | ||||
|  Kernel modules for Hermes based PCMCIA adaptors | ||||
| endef | ||||
|  | ||||
|  | ||||
| define KernelPackage/lib80211 | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=802.11 Networking stack | ||||
|   DEPENDS:=+kmod-cfg80211 +kmod-crypto-hash +kmod-crypto-ccm | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/net/wireless/lib80211.ko \ | ||||
| 	$(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \ | ||||
| 	$(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_ccmp.ko \ | ||||
| 	$(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_tkip.ko | ||||
|   AUTOLOAD:=$(call AutoProbe, \ | ||||
| 	lib80211 \ | ||||
| 	lib80211_crypt_wep \ | ||||
| 	lib80211_crypt_ccmp \ | ||||
| 	lib80211_crypt_tkip \ | ||||
|   ) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/lib80211/description | ||||
|  Kernel modules for 802.11 Networking stack | ||||
|  Includes: | ||||
|  - lib80211 | ||||
|  - lib80211_crypt_wep | ||||
|  - lib80211_crypt_tkip | ||||
|  - lib80211_crytp_ccmp | ||||
| endef | ||||
|  | ||||
|  | ||||
| define KernelPackage/mac80211-hwsim | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=mac80211 HW simulation device | ||||
|   DEPENDS+= +kmod-mac80211 +@DRIVER_11AC_SUPPORT +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,mac80211_hwsim) | ||||
| endef | ||||
|  | ||||
|  | ||||
| define KernelPackage/mt7601u | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=MT7601U-based USB dongles Wireless Driver | ||||
|   DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT @USB_SUPPORT +kmod-usb-core +mt7601u-firmware | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mediatek/mt7601u/mt7601u.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,mt7601u) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/p54/Default | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Prism54 Drivers | ||||
| endef | ||||
|  | ||||
| define KernelPackage/p54/description | ||||
|   Kernel module for Prism54 chipsets (mac80211) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/p54-common | ||||
|   $(call KernelPackage/p54/Default) | ||||
|   DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211 +kmod-lib-crc-ccitt +@DRIVER_11W_SUPPORT | ||||
|   TITLE+= (COMMON) | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54common.ko | ||||
| endef | ||||
|  | ||||
| define KernelPackage/p54-pci | ||||
|   $(call KernelPackage/p54/Default) | ||||
|   TITLE+= (PCI) | ||||
|   DEPENDS+= @PCI_SUPPORT +kmod-p54-common +p54-pci-firmware | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54pci.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,p54pci) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/p54-usb | ||||
|   $(call KernelPackage/p54/Default) | ||||
|   TITLE+= (USB) | ||||
|   DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common +p54-usb-firmware | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54usb.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,p54usb) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/rsi91x | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Redpine Signals Inc 91x WLAN driver support | ||||
|   DEPENDS+= +kmod-mac80211 +rs9113-firmware +@DRIVER_11N_SUPPORT | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rsi/rsi_91x.ko | ||||
| endef | ||||
|  | ||||
| define KernelPackage/rsi91x-usb | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Redpine Signals USB bus support | ||||
|   DEPENDS+=@USB_SUPPORT +kmod-usb-core +kmod-mac80211 +kmod-rsi91x +rs9113-firmware | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rsi/rsi_usb.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,rsi_usb) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/rsi91x-sdio | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Redpine Signals SDIO bus support | ||||
|   DEPENDS+= +kmod-mac80211 +kmod-mmc +kmod-rsi91x +rs9113-firmware | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rsi/rsi_sdio.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,rsi_sdio) | ||||
| endef | ||||
|  | ||||
|  | ||||
| define KernelPackage/wlcore | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=TI common driver part | ||||
|   DEPENDS+= +kmod-mmc +kmod-mac80211 +@DRIVER_11N_SUPPORT | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore.ko \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore_sdio.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,wlcore wlcore_sdio) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/wlcore/description | ||||
|  This module contains some common parts needed by TI Wireless drivers. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/wl12xx | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Driver for TI WL12xx | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/wl12xx | ||||
|   DEPENDS+= +kmod-wlcore +wl12xx-firmware | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl12xx/wl12xx.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,wl12xx) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/wl12xx/description | ||||
|  Kernel modules for TI WL12xx | ||||
| endef | ||||
|  | ||||
| define KernelPackage/wl18xx | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Driver for TI WL18xx | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/wl18xx | ||||
|   DEPENDS+= +kmod-wlcore +wl18xx-firmware | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl18xx/wl18xx.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,wl18xx) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/wl18xx/description | ||||
|  Kernel modules for TI WL18xx | ||||
| endef | ||||
|  | ||||
|  | ||||
| ZD1211FW_NAME:=zd1211-firmware | ||||
| ZD1211FW_VERSION:=1.4 | ||||
| define Download/zd1211rw | ||||
|   FILE:=$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2 | ||||
|   URL:=@SF/zd1211/ | ||||
|   HASH:=866308f6f59f7075f075d4959dff2ede47735c751251fecd1496df1ba4d338e1 | ||||
| endef | ||||
| $(eval $(call Download,zd1211rw)) | ||||
|  | ||||
| define KernelPackage/zd1211rw | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Zydas ZD1211 support | ||||
|   DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211 +@DRIVER_11W_SUPPORT | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/zydas/zd1211rw/zd1211rw.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,zd1211rw) | ||||
| endef | ||||
|  | ||||
| ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS | ||||
|   config-y += \ | ||||
| 	CFG80211_DEBUGFS \ | ||||
| 	MAC80211_DEBUGFS | ||||
| endif | ||||
|  | ||||
| ifdef CONFIG_PACKAGE_MAC80211_TRACING | ||||
|   config-y += \ | ||||
| 	IWLWIFI_DEVICE_TRACING | ||||
| endif | ||||
|  | ||||
| config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP | ||||
|  | ||||
| config-$(call config_package,airo) += AIRO | ||||
|  | ||||
| config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM | ||||
| config-$(call config_package,mt7601u) += MT7601U | ||||
| config-y += WL_MEDIATEK | ||||
|  | ||||
| config-$(call config_package,p54-common) += P54_COMMON | ||||
| config-$(call config_package,p54-pci) += P54_PCI | ||||
| config-$(call config_package,p54-usb) += P54_USB | ||||
|  | ||||
| config-$(call config_package,hermes) += HERMES | ||||
| config-$(call config_package,hermes-pci) += PCI_HERMES | ||||
| config-$(call config_package,hermes-plx) += PLX_HERMES | ||||
| config-$(call config_package,hermes-pcmcia) += PCMCIA_HERMES | ||||
| config-y += HERMES_PRISM | ||||
|  | ||||
| config-$(call config_package,adm8211) += ADM8211 | ||||
| config-$(call config_package,wlcore) += WLCORE WLCORE_SDIO | ||||
| config-$(call config_package,wl12xx) += WL12XX | ||||
| config-$(call config_package,wl18xx) += WL18XX | ||||
| config-y += WL_TI WILINK_PLATFORM_DATA | ||||
| config-$(call config_package,zd1211rw) += ZD1211RW | ||||
| config-$(call config_package,rsi91x) += RSI_91X | ||||
| config-$(call config_package,rsi91x-usb) += RSI_USB | ||||
| config-$(call config_package,rsi91x-sdio) += RSI_SDIO | ||||
|  | ||||
| config-$(CONFIG_LEDS_TRIGGERS) += MAC80211_LEDS | ||||
|  | ||||
| MAKE_OPTS:= -C "$(PKG_BUILD_DIR)" \ | ||||
| 	$(KERNEL_MAKE_FLAGS) \ | ||||
| 	EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/include $(IREMAP_CFLAGS)" \ | ||||
| 	KLIB_BUILD="$(LINUX_DIR)" \ | ||||
| 	MODPROBE=true \ | ||||
| 	KLIB=$(TARGET_MODULES_DIR) \ | ||||
| 	KERNEL_SUBLEVEL=$(lastword $(subst ., ,$(KERNEL_PATCHVER))) \ | ||||
| 	KBUILD_LDFLAGS_MODULE_PREREQ= | ||||
|  | ||||
| define ConfigVars | ||||
| $(subst $(space),,$(foreach opt,$(config-$(1)),CPTCFG_$(opt)=$(1) | ||||
| )) | ||||
| endef | ||||
|  | ||||
| define mac80211_config | ||||
| $(call ConfigVars,m)$(call ConfigVars,y) | ||||
| endef | ||||
| $(eval $(call shexport,mac80211_config)) | ||||
|  | ||||
| define Build/Prepare | ||||
| 	rm -rf $(PKG_BUILD_DIR) | ||||
| 	mkdir -p $(PKG_BUILD_DIR) | ||||
| 	$(PKG_UNPACK) | ||||
| 	$(Build/Patch) | ||||
| 	$(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(IPW2100_NAME)-$(IPW2100_VERSION).tgz | ||||
| 	$(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION).tgz | ||||
| 	$(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2 | ||||
| 	rm -rf \ | ||||
| 		$(PKG_BUILD_DIR)/include/linux/ssb \ | ||||
| 		$(PKG_BUILD_DIR)/include/linux/bcma \ | ||||
| 		$(PKG_BUILD_DIR)/include/net/bluetooth | ||||
|  | ||||
| 	rm -f \ | ||||
| 		$(PKG_BUILD_DIR)/include/linux/cordic.h \ | ||||
| 		$(PKG_BUILD_DIR)/include/linux/crc8.h \ | ||||
| 		$(PKG_BUILD_DIR)/include/linux/eeprom_93cx6.h \ | ||||
| 		$(PKG_BUILD_DIR)/include/linux/wl12xx.h \ | ||||
| 		$(PKG_BUILD_DIR)/include/linux/spi/libertas_spi.h \ | ||||
| 		$(PKG_BUILD_DIR)/include/net/ieee80211.h \ | ||||
| 		$(PKG_BUILD_DIR)/backport-include/linux/bcm47xx_nvram.h | ||||
|  | ||||
| 	echo 'compat-wireless-$(PKG_VERSION)-$(PKG_RELEASE)-$(REVISION)' > $(PKG_BUILD_DIR)/compat_version | ||||
| endef | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-cfg80211)$(CONFIG_PACKAGE_kmod-lib80211),) | ||||
|  define Build/Compile/kmod | ||||
| 	rm -rf $(PKG_BUILD_DIR)/modules | ||||
| 	+$(MAKE) $(PKG_JOBS) $(MAKE_OPTS) modules | ||||
|  endef | ||||
| endif | ||||
|  | ||||
| define Build/Patch | ||||
| 	$(if $(QUILT),rm -rf $(PKG_BUILD_DIR)/patches; mkdir -p $(PKG_BUILD_DIR)/patches) | ||||
| 	$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/build,build/) | ||||
| 	$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/subsys,subsys/) | ||||
| 	$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath,ath/) | ||||
| 	$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rt2x00,rt2x00/) | ||||
| 	$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mwl,mwl/) | ||||
| 	$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/brcm,brcm/) | ||||
| 	$(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used) | ||||
| endef | ||||
|  | ||||
| define Quilt/Refresh/Package | ||||
| 	$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/build,build/) | ||||
| 	$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/subsys,subsys/) | ||||
| 	$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath,ath/) | ||||
| 	$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rt2x00,rt2x00/) | ||||
| 	$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mwl,mwl/) | ||||
| 	$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/brcm,brcm/) | ||||
| endef | ||||
|  | ||||
| define Build/Compile | ||||
| 	$(SH_FUNC) var2file "$(call shvar,mac80211_config)" $(PKG_BUILD_DIR)/.config | ||||
| 	$(MAKE) $(MAKE_OPTS) allnoconfig | ||||
| 	$(call Build/Compile/kmod) | ||||
| endef | ||||
|  | ||||
| define Build/InstallDev | ||||
| 	mkdir -p \ | ||||
| 		$(1)/usr/include/mac80211 \ | ||||
| 		$(1)/usr/include/mac80211-backport \ | ||||
| 		$(1)/usr/include/mac80211/ath \ | ||||
| 		$(1)/usr/include/net/mac80211 | ||||
| 	$(CP) $(PKG_BUILD_DIR)/net/mac80211/*.h $(PKG_BUILD_DIR)/include/* $(1)/usr/include/mac80211/ | ||||
| 	$(CP) $(PKG_BUILD_DIR)/backport-include/* $(1)/usr/include/mac80211-backport/ | ||||
| 	$(CP) $(PKG_BUILD_DIR)/net/mac80211/rate.h $(1)/usr/include/net/mac80211/ | ||||
| 	$(CP) $(PKG_BUILD_DIR)/drivers/net/wireless/ath/*.h $(1)/usr/include/mac80211/ath/ | ||||
| 	rm -f $(1)/usr/include/mac80211-backport/linux/module.h | ||||
| endef | ||||
|  | ||||
|  | ||||
| define KernelPackage/cfg80211/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless | ||||
| 	$(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi | ||||
| 	$(INSTALL_DATA) ./files/lib/netifd/mac80211.sh $(1)/lib/netifd | ||||
| 	$(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless | ||||
| 	$(INSTALL_DIR) $(1)/etc/hotplug.d/ieee80211 | ||||
| 	$(INSTALL_DATA) ./files/mac80211.hotplug $(1)/etc/hotplug.d/ieee80211/10-wifi-detect | ||||
| endef | ||||
|  | ||||
| define KernelPackage/zd1211rw/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/zd1211 | ||||
| 	$(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211 | ||||
| endef | ||||
|  | ||||
| $(eval $(foreach drv,$(PKG_DRIVERS),$(call KernelPackage,$(drv)))) | ||||
| $(eval $(call KernelPackage,cfg80211)) | ||||
| $(eval $(call KernelPackage,mac80211)) | ||||
							
								
								
									
										310
									
								
								feeds/wifi-ath10k/mac80211/ath.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										310
									
								
								feeds/wifi-ath10k/mac80211/ath.mk
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,310 @@ | ||||
| PKG_DRIVERS += \ | ||||
| 	ath ath5k ath6kl ath6kl-sdio ath6kl-usb ath9k ath9k-common ath9k-htc ath10k \ | ||||
| 	carl9170 owl-loader ar5523 | ||||
|  | ||||
| PKG_CONFIG_DEPENDS += \ | ||||
| 	CONFIG_PACKAGE_ATH_DEBUG \ | ||||
| 	CONFIG_PACKAGE_ATH_DFS \ | ||||
| 	CONFIG_PACKAGE_ATH_SPECTRAL \ | ||||
| 	CONFIG_PACKAGE_ATH_DYNACK \ | ||||
| 	CONFIG_ATH9K_HWRNG \ | ||||
| 	CONFIG_ATH9K_SUPPORT_PCOEM \ | ||||
| 	CONFIG_ATH9K_TX99 \ | ||||
| 	CONFIG_ATH10K_LEDS \ | ||||
| 	CONFIG_ATH10K_THERMAL \ | ||||
| 	CONFIG_ATH_USER_REGD | ||||
|  | ||||
| ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS | ||||
|   config-y += \ | ||||
| 	ATH9K_DEBUGFS \ | ||||
| 	ATH9K_HTC_DEBUGFS \ | ||||
| 	ATH10K_DEBUGFS \ | ||||
| 	CARL9170_DEBUGFS \ | ||||
| 	ATH5K_DEBUG \ | ||||
| 	ATH6KL_DEBUG | ||||
| endif | ||||
|  | ||||
| ifdef CONFIG_PACKAGE_MAC80211_TRACING | ||||
|   config-y += \ | ||||
| 	ATH10K_TRACING \ | ||||
| 	ATH6KL_TRACING \ | ||||
| 	ATH_TRACEPOINTS \ | ||||
| 	ATH5K_TRACER | ||||
| endif | ||||
|  | ||||
| config-$(call config_package,ath) += ATH_CARDS ATH_COMMON ATH_REG_DYNAMIC_USER_REG_HINTS | ||||
| config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG ATH9K_STATION_STATISTICS | ||||
| config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED | ||||
| config-$(CONFIG_PACKAGE_ATH_SPECTRAL) += ATH9K_COMMON_SPECTRAL ATH10K_SPECTRAL | ||||
| config-$(CONFIG_PACKAGE_ATH_DYNACK) += ATH9K_DYNACK | ||||
| config-$(call config_package,ath9k) += ATH9K | ||||
| config-$(call config_package,ath9k-common) += ATH9K_COMMON | ||||
| config-$(call config_package,owl-loader) += ATH9K_PCI_NO_EEPROM | ||||
| config-$(CONFIG_TARGET_ath79) += ATH9K_AHB | ||||
| config-$(CONFIG_TARGET_ipq40xx) += ATH10K_AHB | ||||
| config-$(CONFIG_PCI) += ATH9K_PCI | ||||
| config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD | ||||
| config-$(CONFIG_ATH9K_HWRNG) += ATH9K_HWRNG | ||||
| config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM | ||||
| config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99 | ||||
| config-$(CONFIG_ATH9K_UBNTHSR) += ATH9K_UBNTHSR | ||||
| config-$(CONFIG_ATH10K_LEDS) += ATH10K_LEDS | ||||
| config-$(CONFIG_ATH10K_THERMAL) += ATH10K_THERMAL | ||||
|  | ||||
| config-$(call config_package,ath9k-htc) += ATH9K_HTC | ||||
| config-$(call config_package,ath10k) += ATH10K ATH10K_PCI | ||||
|  | ||||
| config-$(call config_package,ath5k) += ATH5K | ||||
| ifdef CONFIG_TARGET_ath25 | ||||
|   config-y += ATH5K_AHB | ||||
| else | ||||
|   config-y += ATH5K_PCI | ||||
| endif | ||||
|  | ||||
| config-$(call config_package,ath6kl) += ATH6KL | ||||
| config-$(call config_package,ath6kl-sdio) += ATH6KL_SDIO | ||||
| config-$(call config_package,ath6kl-usb) += ATH6KL_USB | ||||
|  | ||||
| config-$(call config_package,carl9170) += CARL9170 | ||||
| config-$(call config_package,ar5523) += AR5523 | ||||
|  | ||||
| define KernelPackage/ath/config | ||||
|   if PACKAGE_kmod-ath | ||||
| 	config ATH_USER_REGD | ||||
| 		bool "Force Atheros drivers to respect the user's regdomain settings" | ||||
| 		default y | ||||
| 		help | ||||
| 		  Atheros' idea of regulatory handling is that the EEPROM of the card defines | ||||
| 		  the regulatory limits and the user is only allowed to restrict the settings | ||||
| 		  even further, even if the country allows frequencies or power levels that | ||||
| 		  are forbidden by the EEPROM settings. | ||||
|  | ||||
| 		  Select this option if you want the driver to respect the user's decision about | ||||
| 		  regulatory settings. | ||||
|  | ||||
| 	config PACKAGE_ATH_DEBUG | ||||
| 		bool "Atheros wireless debugging" | ||||
| 		help | ||||
| 		  Say Y, if you want to debug atheros wireless drivers. | ||||
| 		  Only ath9k & ath10k make use of this. | ||||
|  | ||||
| 	config PACKAGE_ATH_DFS | ||||
| 		bool "Enable DFS support" | ||||
| 		default y | ||||
| 		help | ||||
| 		  Dynamic frequency selection (DFS) is required for most of the 5 GHz band | ||||
| 		  channels in Europe, US, and Japan. | ||||
|  | ||||
| 		  Select this option if you want to use such channels. | ||||
|  | ||||
| 	config PACKAGE_ATH_SPECTRAL | ||||
| 		bool "Atheros spectral scan support" | ||||
| 		depends on PACKAGE_ATH_DEBUG | ||||
| 		select KERNEL_RELAY | ||||
| 		help | ||||
| 		  Say Y to enable access to the FFT/spectral data via debugfs. | ||||
|  | ||||
| 	config PACKAGE_ATH_DYNACK | ||||
| 		bool "Enable Dynack support" | ||||
| 		depends on PACKAGE_kmod-ath9k-common | ||||
| 		help | ||||
| 		  Enables support for Dynamic ACK estimation, which allows the fastest possible speed | ||||
| 		  at any distance automatically by increasing/decreasing the max frame ACK time for | ||||
| 		  the most remote station detected.  It can be enabled by using iw (iw phy0 set distance auto), | ||||
| 		  or by sending the NL80211_ATTR_WIPHY_DYN_ACK flag to mac80211 driver using netlink. | ||||
|  | ||||
| 		  Select this option if you want to enable this feature | ||||
|  | ||||
|   endif | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros common driver part | ||||
|   DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ath79||TARGET_ath25 +kmod-mac80211 | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko | ||||
|   MENU:=1 | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath/description | ||||
|  This module contains some common parts needed by Atheros Wireless drivers. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath5k | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros 5xxx wireless cards support | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k | ||||
|   DEPENDS+= @(PCI_SUPPORT||TARGET_ath25) +kmod-ath +@DRIVER_11W_SUPPORT | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ath5k) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath5k/description | ||||
|  This module adds support for wireless adapters based on | ||||
|  Atheros 5xxx chipset. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath6kl | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros FullMAC wireless devices (common code for ath6kl_sdio and ath6kl_usb) | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath6kl | ||||
|   HIDDEN:=1 | ||||
|   DEPENDS+= +kmod-ath +@DRIVER_11N_SUPPORT | ||||
|   FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath6kl/ath6kl_core.ko | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath6kl-sdio | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros 802.11n SDIO wireless cards support | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath6kl | ||||
|   DEPENDS+= +kmod-mmc +kmod-ath6kl | ||||
|   FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath6kl/ath6kl_sdio.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ath6kl_sdio) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath6kl-sdio/description | ||||
| This module adds support for wireless adapters based on | ||||
| Atheros IEEE 802.11n AR6003 and AR6004 family of chipsets. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath6kl-usb | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros 802.11n USB wireless cards support | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath6kl | ||||
|   DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-ath6kl | ||||
|   FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath6kl/ath6kl_usb.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ath6kl_usb) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath6kl-usb/description | ||||
| This module adds support for wireless adapters based on the | ||||
| Atheros IEEE 802.11n AR6004 chipset. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath9k-common | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc) | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k | ||||
|   HIDDEN:=1 | ||||
|   DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ath79 +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath9k | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros 802.11n PCI wireless cards support | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k | ||||
|   DEPENDS+= @PCI_SUPPORT||TARGET_ath79 +kmod-ath9k-common | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ath9k) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath9k/description | ||||
| This module adds support for wireless adapters based on | ||||
| Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath9k/config | ||||
|  | ||||
| 	config ATH9K_HWRNG | ||||
| 		bool "Add wireless noise as source of randomness to kernel entropy pool" | ||||
| 		depends on PACKAGE_kmod-ath9k | ||||
| 		select PACKAGE_kmod-random-core | ||||
| 		default n | ||||
|  | ||||
| 	config ATH9K_SUPPORT_PCOEM | ||||
| 		bool "Support chips used in PC OEM cards" | ||||
| 		depends on PACKAGE_kmod-ath9k | ||||
|  | ||||
|        config ATH9K_TX99 | ||||
|                bool "Enable TX99 support (WARNING: testing only, breaks normal operation!)" | ||||
|                depends on PACKAGE_kmod-ath9k | ||||
|  | ||||
| 	config ATH9K_UBNTHSR | ||||
| 		bool "Support for Ubiquiti UniFi Outdoor+ access point" | ||||
| 		depends on PACKAGE_kmod-ath9k && TARGET_ath79 | ||||
| 		default y | ||||
|  | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath9k-htc | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros 802.11n USB device support | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k | ||||
|   DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core +ath9k-htc-firmware | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ath9k_htc) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath9k-htc/description | ||||
| This module adds support for wireless adapters based on | ||||
| Atheros USB AR9271 and AR7010 family of chipsets. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath10k | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros 802.11ac wireless cards support | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath10k | ||||
|   DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT \ | ||||
| 	+ATH10K_THERMAL:kmod-hwmon-core +ATH10K_THERMAL:kmod-thermal | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ath10k_pci) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath10k/description | ||||
| This module adds support for wireless adapters based on | ||||
| Atheros IEEE 802.11ac family of chipsets. For now only | ||||
| PCI is supported. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath10k/config | ||||
|  | ||||
|        config ATH10K_LEDS | ||||
|                bool "Enable LED support" | ||||
|                default y | ||||
|                depends on PACKAGE_kmod-ath10k | ||||
|  | ||||
|        config ATH10K_THERMAL | ||||
|                bool "Enable thermal sensors and throttling support" | ||||
|                depends on PACKAGE_kmod-ath10k | ||||
|  | ||||
| endef | ||||
|  | ||||
| define KernelPackage/carl9170 | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Driver for Atheros AR9170 USB sticks | ||||
|   DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +carl9170-firmware | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,carl9170) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/owl-loader | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Owl loader for initializing Atheros PCI(e) Wifi chips | ||||
|   DEPENDS:=@PCI_SUPPORT +kmod-ath9k | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ath9k_pci_owl_loader) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/owl-loader/description | ||||
|   Kernel module that helps to initialize certain Qualcomm | ||||
|   Atheros' PCI(e) Wifi chips, which have the init data | ||||
|   (which contains the PCI device ID for example) stored | ||||
|   together with the calibration data in the file system. | ||||
|  | ||||
|   This is necessary for devices like the Cisco Meraki Z1. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ar5523 | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Driver for Atheros AR5523 USB sticks | ||||
|   DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core  | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ar5523/ar5523.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ar5523) | ||||
| endef | ||||
							
								
								
									
										302
									
								
								feeds/wifi-ath10k/mac80211/ath.mk.orig
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										302
									
								
								feeds/wifi-ath10k/mac80211/ath.mk.orig
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,302 @@ | ||||
| PKG_DRIVERS += \ | ||||
| 	ath ath5k ath6kl ath6kl-sdio ath6kl-usb ath9k ath9k-common ath9k-htc ath10k \ | ||||
| 	carl9170 owl-loader | ||||
|  | ||||
| PKG_CONFIG_DEPENDS += \ | ||||
| 	CONFIG_PACKAGE_ATH_DEBUG \ | ||||
| 	CONFIG_PACKAGE_ATH_DFS \ | ||||
| 	CONFIG_PACKAGE_ATH_SPECTRAL \ | ||||
| 	CONFIG_PACKAGE_ATH_DYNACK \ | ||||
| 	CONFIG_ATH9K_HWRNG \ | ||||
| 	CONFIG_ATH9K_SUPPORT_PCOEM \ | ||||
| 	CONFIG_ATH9K_TX99 \ | ||||
| 	CONFIG_ATH10K_LEDS \ | ||||
| 	CONFIG_ATH10K_THERMAL \ | ||||
| 	CONFIG_ATH_USER_REGD | ||||
|  | ||||
| ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS | ||||
|   config-y += \ | ||||
| 	ATH9K_DEBUGFS \ | ||||
| 	ATH9K_HTC_DEBUGFS \ | ||||
| 	ATH10K_DEBUGFS \ | ||||
| 	CARL9170_DEBUGFS \ | ||||
| 	ATH5K_DEBUG \ | ||||
| 	ATH6KL_DEBUG | ||||
| endif | ||||
|  | ||||
| ifdef CONFIG_PACKAGE_MAC80211_TRACING | ||||
|   config-y += \ | ||||
| 	ATH10K_TRACING \ | ||||
| 	ATH6KL_TRACING \ | ||||
| 	ATH_TRACEPOINTS \ | ||||
| 	ATH5K_TRACER | ||||
| endif | ||||
|  | ||||
| config-$(call config_package,ath) += ATH_CARDS ATH_COMMON ATH_REG_DYNAMIC_USER_REG_HINTS | ||||
| config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG ATH9K_STATION_STATISTICS | ||||
| config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED | ||||
| config-$(CONFIG_PACKAGE_ATH_SPECTRAL) += ATH9K_COMMON_SPECTRAL ATH10K_SPECTRAL | ||||
| config-$(CONFIG_PACKAGE_ATH_DYNACK) += ATH9K_DYNACK | ||||
| config-$(call config_package,ath9k) += ATH9K | ||||
| config-$(call config_package,ath9k-common) += ATH9K_COMMON | ||||
| config-$(call config_package,owl-loader) += ATH9K_PCI_NO_EEPROM | ||||
| config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB | ||||
| config-$(CONFIG_TARGET_ath79) += ATH9K_AHB | ||||
| config-$(CONFIG_TARGET_ipq40xx) += ATH10K_AHB | ||||
| config-$(CONFIG_PCI) += ATH9K_PCI | ||||
| config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD | ||||
| config-$(CONFIG_ATH9K_HWRNG) += ATH9K_HWRNG | ||||
| config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM | ||||
| config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99 | ||||
| config-$(CONFIG_ATH9K_UBNTHSR) += ATH9K_UBNTHSR | ||||
| config-$(CONFIG_ATH10K_LEDS) += ATH10K_LEDS | ||||
| config-$(CONFIG_ATH10K_THERMAL) += ATH10K_THERMAL | ||||
|  | ||||
| config-$(call config_package,ath9k-htc) += ATH9K_HTC | ||||
| config-$(call config_package,ath10k) += ATH10K ATH10K_PCI | ||||
|  | ||||
| config-$(call config_package,ath5k) += ATH5K | ||||
| ifdef CONFIG_TARGET_ath25 | ||||
|   config-y += ATH5K_AHB | ||||
| else | ||||
|   config-y += ATH5K_PCI | ||||
| endif | ||||
|  | ||||
| config-$(call config_package,ath6kl) += ATH6KL | ||||
| config-$(call config_package,ath6kl-sdio) += ATH6KL_SDIO | ||||
| config-$(call config_package,ath6kl-usb) += ATH6KL_USB | ||||
|  | ||||
| config-$(call config_package,carl9170) += CARL9170 | ||||
|  | ||||
| define KernelPackage/ath/config | ||||
|   if PACKAGE_kmod-ath | ||||
| 	config ATH_USER_REGD | ||||
| 		bool "Force Atheros drivers to respect the user's regdomain settings" | ||||
| 		default y | ||||
| 		help | ||||
| 		  Atheros' idea of regulatory handling is that the EEPROM of the card defines | ||||
| 		  the regulatory limits and the user is only allowed to restrict the settings | ||||
| 		  even further, even if the country allows frequencies or power levels that | ||||
| 		  are forbidden by the EEPROM settings. | ||||
|  | ||||
| 		  Select this option if you want the driver to respect the user's decision about | ||||
| 		  regulatory settings. | ||||
|  | ||||
| 	config PACKAGE_ATH_DEBUG | ||||
| 		bool "Atheros wireless debugging" | ||||
| 		help | ||||
| 		  Say Y, if you want to debug atheros wireless drivers. | ||||
| 		  Only ath9k & ath10k make use of this. | ||||
|  | ||||
| 	config PACKAGE_ATH_DFS | ||||
| 		bool "Enable DFS support" | ||||
| 		default y | ||||
| 		help | ||||
| 		  Dynamic frequency selection (DFS) is required for most of the 5 GHz band | ||||
| 		  channels in Europe, US, and Japan. | ||||
|  | ||||
| 		  Select this option if you want to use such channels. | ||||
|  | ||||
| 	config PACKAGE_ATH_SPECTRAL | ||||
| 		bool "Atheros spectral scan support" | ||||
| 		depends on PACKAGE_ATH_DEBUG | ||||
| 		select KERNEL_RELAY | ||||
| 		help | ||||
| 		  Say Y to enable access to the FFT/spectral data via debugfs. | ||||
|  | ||||
| 	config PACKAGE_ATH_DYNACK | ||||
| 		bool "Enable Dynack support" | ||||
| 		depends on PACKAGE_kmod-ath9k-common | ||||
| 		help | ||||
| 		  Enables support for Dynamic ACK estimation, which allows the fastest possible speed | ||||
| 		  at any distance automatically by increasing/decreasing the max frame ACK time for | ||||
| 		  the most remote station detected.  It can be enabled by using iw (iw phy0 set distance auto), | ||||
| 		  or by sending the NL80211_ATTR_WIPHY_DYN_ACK flag to mac80211 driver using netlink. | ||||
|  | ||||
| 		  Select this option if you want to enable this feature | ||||
|  | ||||
|   endif | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros common driver part | ||||
|   DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath79||TARGET_ath25 +kmod-mac80211 | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko | ||||
|   MENU:=1 | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath/description | ||||
|  This module contains some common parts needed by Atheros Wireless drivers. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath5k | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros 5xxx wireless cards support | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k | ||||
|   DEPENDS+= @(PCI_SUPPORT||TARGET_ath25) +kmod-ath +@DRIVER_11W_SUPPORT | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ath5k) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath5k/description | ||||
|  This module adds support for wireless adapters based on | ||||
|  Atheros 5xxx chipset. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath6kl | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros FullMAC wireless devices (common code for ath6kl_sdio and ath6kl_usb) | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath6kl | ||||
|   HIDDEN:=1 | ||||
|   DEPENDS+= +kmod-ath +@DRIVER_11N_SUPPORT | ||||
|   FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath6kl/ath6kl_core.ko | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath6kl-sdio | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros 802.11n SDIO wireless cards support | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath6kl | ||||
|   DEPENDS+= +kmod-mmc +kmod-ath6kl | ||||
|   FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath6kl/ath6kl_sdio.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ath6kl_sdio) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath6kl-sdio/description | ||||
| This module adds support for wireless adapters based on | ||||
| Atheros IEEE 802.11n AR6003 and AR6004 family of chipsets. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath6kl-usb | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros 802.11n USB wireless cards support | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath6kl | ||||
|   DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-ath6kl | ||||
|   FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath6kl/ath6kl_usb.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ath6kl_usb) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath6kl-usb/description | ||||
| This module adds support for wireless adapters based on the | ||||
| Atheros IEEE 802.11n AR6004 chipset. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath9k-common | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc) | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k | ||||
|   HIDDEN:=1 | ||||
|   DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath79 +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath9k | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros 802.11n PCI wireless cards support | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k | ||||
|   DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx||TARGET_ath79 +kmod-ath9k-common | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ath9k) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath9k/description | ||||
| This module adds support for wireless adapters based on | ||||
| Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath9k/config | ||||
|  | ||||
| 	config ATH9K_HWRNG | ||||
| 		bool "Add wireless noise as source of randomness to kernel entropy pool" | ||||
| 		depends on PACKAGE_kmod-ath9k | ||||
| 		select PACKAGE_kmod-random-core | ||||
| 		default n | ||||
|  | ||||
| 	config ATH9K_SUPPORT_PCOEM | ||||
| 		bool "Support chips used in PC OEM cards" | ||||
| 		depends on PACKAGE_kmod-ath9k | ||||
|  | ||||
|        config ATH9K_TX99 | ||||
|                bool "Enable TX99 support (WARNING: testing only, breaks normal operation!)" | ||||
|                depends on PACKAGE_kmod-ath9k | ||||
|  | ||||
| 	config ATH9K_UBNTHSR | ||||
| 		bool "Support for Ubiquiti UniFi Outdoor+ access point" | ||||
| 		depends on PACKAGE_kmod-ath9k && (TARGET_ar71xx_generic||TARGET_ath79) | ||||
| 		default y | ||||
|  | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath9k-htc | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros 802.11n USB device support | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k | ||||
|   DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core +ath9k-htc-firmware | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ath9k_htc) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath9k-htc/description | ||||
| This module adds support for wireless adapters based on | ||||
| Atheros USB AR9271 and AR7010 family of chipsets. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath10k | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Atheros 802.11ac wireless cards support | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath10k | ||||
|   DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT \ | ||||
| 	+ATH10K_THERMAL:kmod-hwmon-core +ATH10K_THERMAL:kmod-thermal | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ath10k_pci) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath10k/description | ||||
| This module adds support for wireless adapters based on | ||||
| Atheros IEEE 802.11ac family of chipsets. For now only | ||||
| PCI is supported. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ath10k/config | ||||
|  | ||||
|        config ATH10K_LEDS | ||||
|                bool "Enable LED support" | ||||
|                default y | ||||
|                depends on PACKAGE_kmod-ath10k | ||||
|  | ||||
|        config ATH10K_THERMAL | ||||
|                bool "Enable thermal sensors and throttling support" | ||||
|                depends on PACKAGE_kmod-ath10k | ||||
|  | ||||
| endef | ||||
|  | ||||
| define KernelPackage/carl9170 | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Driver for Atheros AR9170 USB sticks | ||||
|   DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +carl9170-firmware | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,carl9170) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/owl-loader | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Owl loader for initializing Atheros PCI(e) Wifi chips | ||||
|   DEPENDS:=@PCI_SUPPORT +kmod-ath9k | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ath9k_pci_owl_loader) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/owl-loader/description | ||||
|   Kernel module that helps to initialize certain Qualcomm | ||||
|   Atheros' PCI(e) Wifi chips, which have the init data | ||||
|   (which contains the PCI device ID for example) stored | ||||
|   together with the calibration data in the file system. | ||||
|  | ||||
|   This is necessary for devices like the Cisco Meraki Z1. | ||||
| endef | ||||
							
								
								
									
										510
									
								
								feeds/wifi-ath10k/mac80211/broadcom.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										510
									
								
								feeds/wifi-ath10k/mac80211/broadcom.mk
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,510 @@ | ||||
| PKG_DRIVERS += \ | ||||
| 	b43 b43legacy brcmsmac brcmfmac brcmutil | ||||
|  | ||||
| PKG_CONFIG_DEPENDS += \ | ||||
| 	CONFIG_PACKAGE_B43_DEBUG \ | ||||
| 	CONFIG_PACKAGE_B43_PIO \ | ||||
| 	CONFIG_PACKAGE_B43_PHY_G \ | ||||
| 	CONFIG_PACKAGE_B43_PHY_N \ | ||||
| 	CONFIG_PACKAGE_B43_PHY_LP \ | ||||
| 	CONFIG_PACKAGE_B43_PHY_HT \ | ||||
| 	CONFIG_PACKAGE_B43_BUSES_BCMA_AND_SSB \ | ||||
| 	CONFIG_PACKAGE_B43_BUSES_BCMA \ | ||||
| 	CONFIG_PACKAGE_B43_BUSES_SSB \ | ||||
| 	CONFIG_PACKAGE_BRCM80211_DEBUG | ||||
|  | ||||
| config-$(call config_package,b43) += B43 | ||||
| config-$(CONFIG_PACKAGE_B43_BUSES_BCMA_AND_SSB) += B43_BUSES_BCMA_AND_SSB | ||||
| config-$(CONFIG_PACKAGE_B43_BUSES_BCMA) += B43_BUSES_BCMA | ||||
| config-$(CONFIG_PACKAGE_B43_BUSES_SSB) += B43_BUSES_SSB | ||||
| config-$(CONFIG_PACKAGE_B43_PHY_G) += B43_PHY_G | ||||
| config-$(CONFIG_PACKAGE_B43_PHY_N) += B43_PHY_N | ||||
| config-$(CONFIG_PACKAGE_B43_PHY_LP) += B43_PHY_LP | ||||
| config-$(CONFIG_PACKAGE_B43_PHY_HT) += B43_PHY_HT | ||||
| config-$(CONFIG_PACKAGE_B43_PIO) += B43_PIO | ||||
| config-$(CONFIG_PACKAGE_B43_DEBUG) += B43_DEBUG | ||||
|  | ||||
| config-$(call config_package,b43legacy) += B43LEGACY | ||||
| config-y += B43LEGACY_DMA_MODE | ||||
|  | ||||
| config-$(call config_package,brcmutil) += BRCMUTIL | ||||
| config-$(call config_package,brcmsmac) += BRCMSMAC | ||||
| config-$(call config_package,brcmfmac) += BRCMFMAC | ||||
| config-$(CONFIG_BRCMFMAC_SDIO) += BRCMFMAC_SDIO | ||||
| config-$(CONFIG_BRCMFMAC_USB) += BRCMFMAC_USB | ||||
| config-$(CONFIG_BRCMFMAC_PCIE) += BRCMFMAC_PCIE | ||||
| config-$(CONFIG_PACKAGE_BRCM80211_DEBUG) += BRCMDBG | ||||
|  | ||||
| config-$(CONFIG_LEDS_TRIGGERS) += B43_LEDS B43LEGACY_LEDS | ||||
|  | ||||
| #Broadcom firmware | ||||
| ifneq ($(CONFIG_B43_FW_6_30),) | ||||
|   PKG_B43_FWV4_NAME:=broadcom-wl | ||||
|   PKG_B43_FWV4_VERSION:=6.30.163.46 | ||||
|   PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).wl_apsta.o | ||||
|   PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2 | ||||
|   PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/ | ||||
|   PKG_B43_FWV4_HASH:=a07c3b6b277833c7dbe61daa511f908cd66c5e2763eb7a0859abc36cd9335c2d | ||||
| else | ||||
| ifneq ($(CONFIG_B43_FW_5_10),) | ||||
|   PKG_B43_FWV4_NAME:=broadcom-wl | ||||
|   PKG_B43_FWV4_VERSION:=5.10.56.27.3 | ||||
|   PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta/wl_prebuilt.o | ||||
|   PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)_mipsel.tar.bz2 | ||||
|   PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/ | ||||
|   PKG_B43_FWV4_HASH:=26a8c370f48fc129d0731cfd751c36cae1419b0bc8ca35781126744e60eae009 | ||||
| else | ||||
| ifneq ($(CONFIG_B43_FW_4_178),) | ||||
|   PKG_B43_FWV4_NAME:=broadcom-wl | ||||
|   PKG_B43_FWV4_VERSION:=4.178.10.4 | ||||
|   PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o | ||||
|   PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2 | ||||
|   PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/ | ||||
|   PKG_B43_FWV4_HASH:=32f6ad98facbb9045646fdc8b54bb03086d204153253f9c65d0234a5d90ae53f | ||||
| else | ||||
| ifneq ($(CONFIG_B43_FW_5_100_138),) | ||||
|   PKG_B43_FWV4_NAME:=broadcom-wl | ||||
|   PKG_B43_FWV4_VERSION:=5.100.138 | ||||
|   PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o | ||||
|   PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2 | ||||
|   PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/ | ||||
|   PKG_B43_FWV4_HASH:=f1e7067aac5b62b67b8b6e4c517990277804339ac16065eb13c731ff909ae46f | ||||
| else | ||||
|   PKG_B43_FWV4_NAME:=broadcom-wl | ||||
|   PKG_B43_FWV4_VERSION:=4.150.10.5 | ||||
|   PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta_mimo.o | ||||
|   PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2 | ||||
|   PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/ | ||||
|   PKG_B43_FWV4_HASH:=a9f4e276a4d8d3a1cd0f2eb87080ae89b77f0a7140f06d4e9e2135fc44fdd533 | ||||
| endif | ||||
| endif | ||||
| endif | ||||
| endif | ||||
| ifneq ($(CONFIG_B43_OPENFIRMWARE),) | ||||
|   PKG_B43_FWV4_NAME:=broadcom-wl | ||||
|   PKG_B43_FWV4_VERSION:=5.2 | ||||
|   PKG_B43_FWV4_OBJECT:=openfwwf-$(PKG_B43_FWV4_VERSION) | ||||
|   PKG_B43_FWV4_SOURCE:=openfwwf-$(PKG_B43_FWV4_VERSION).tar.gz | ||||
|   PKG_B43_FWV4_SOURCE_URL:=http://netweb.ing.unibs.it/~openfwwf/firmware | ||||
|   PKG_B43_FWV4_HASH:=9de03320083201080b2e94b81637ac07a159cf4e6f3481383e1a217e627bc0dc | ||||
| endif | ||||
|  | ||||
|  | ||||
| define Download/b43 | ||||
|   FILE:=$(PKG_B43_FWV4_SOURCE) | ||||
|   URL:=$(PKG_B43_FWV4_SOURCE_URL) | ||||
|   HASH:=$(PKG_B43_FWV4_HASH) | ||||
| endef | ||||
| $(eval $(call Download,b43)) | ||||
|  | ||||
| define KernelPackage/b43 | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Broadcom 43xx wireless support | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43 | ||||
|   KCONFIG:= \ | ||||
|   	CONFIG_HW_RANDOM=y | ||||
|   # Depend on PCI_SUPPORT to make sure we can select kmod-bcma or kmod-ssb | ||||
|   DEPENDS += \ | ||||
| 	@PCI_SUPPORT +@DRIVER_11W_SUPPORT +kmod-mac80211 +kmod-lib-cordic \ | ||||
| 	$(if $(CONFIG_PACKAGE_B43_USE_SSB),+kmod-ssb) \ | ||||
| 	$(if $(CONFIG_PACKAGE_B43_USE_BCMA),+kmod-bcma) | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/b43/b43.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,b43) | ||||
|   MENU:=1 | ||||
| endef | ||||
|  | ||||
| define KernelPackage/b43/config | ||||
|  | ||||
| config PACKAGE_B43_USE_SSB | ||||
| 	select PACKAGE_kmod-ssb | ||||
| 	tristate | ||||
| 	depends on !TARGET_bcm47xx && !TARGET_bcm63xx | ||||
| 	default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB | ||||
| 	default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_SSB | ||||
|  | ||||
| config PACKAGE_B43_USE_BCMA | ||||
| 	select PACKAGE_kmod-bcma | ||||
| 	tristate | ||||
| 	depends on !TARGET_bcm47xx && !TARGET_bcm53xx | ||||
| 	default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB | ||||
| 	default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA | ||||
|  | ||||
|   if PACKAGE_kmod-b43 | ||||
|  | ||||
| 	choice | ||||
| 		prompt "b43 firmware version" | ||||
| 		default B43_FW_5_100_138 | ||||
| 		help | ||||
| 		  This option allows you to select the version of the b43 firmware. | ||||
|  | ||||
| 	config B43_FW_4_150 | ||||
| 		bool "Firmware 410.2160 from driver 4.150.10.5 (old stable)" | ||||
| 		help | ||||
| 		  Old stable firmware for BCM43xx devices. | ||||
|  | ||||
| 		  If unsure, select this. | ||||
|  | ||||
| 	config B43_FW_4_178 | ||||
| 		bool "Firmware 478.104 from driver 4.178.10.4" | ||||
| 		help | ||||
| 		  Older firmware for BCM43xx devices. | ||||
|  | ||||
| 		  If unsure, select the "stable" firmware. | ||||
|  | ||||
| 	config B43_FW_5_10 | ||||
| 		bool "Firmware 508.1084 from driver 5.10.56.27" | ||||
| 		help | ||||
| 		  Older firmware for BCM43xx devices. | ||||
|  | ||||
| 		  If unsure, select the "stable" firmware. | ||||
|  | ||||
| 	config B43_FW_5_100_138 | ||||
| 		bool "Firmware 666.2 from driver 5.100.138 (stable)" | ||||
| 		help | ||||
| 		  The currently default firmware for BCM43xx devices. | ||||
|  | ||||
| 		  This firmware currently gets most of the testing and is needed for some N-PHY devices. | ||||
|  | ||||
| 		  If unsure, select the this firmware. | ||||
|  | ||||
| 	config B43_FW_6_30 | ||||
| 		bool "Firmware 784.2 from driver 6.30.163.46 (experimental)" | ||||
| 		help | ||||
| 		  Newer experimental firmware for BCM43xx devices. | ||||
|  | ||||
| 		  This firmware is mostly untested. | ||||
|  | ||||
| 		  If unsure, select the "stable" firmware. | ||||
|  | ||||
| 	config B43_OPENFIRMWARE | ||||
| 		bool "Open FirmWare for WiFi networks" | ||||
| 		help | ||||
| 		  Opensource firmware for BCM43xx devices. | ||||
|  | ||||
| 		  Do _not_ select this, unless you know what you are doing. | ||||
| 		  The Opensource firmware is not suitable for embedded devices, yet. | ||||
| 		  It does not support QoS, which is bad for AccessPoints. | ||||
| 		  It does not support hardware crypto acceleration, which is a showstopper | ||||
| 		  for embedded devices with low CPU resources. | ||||
|  | ||||
| 		  If unsure, select the "stable" firmware. | ||||
|  | ||||
| 	endchoice | ||||
|  | ||||
| 	config B43_FW_SQUASH | ||||
| 		bool "Remove unnecessary firmware files" | ||||
| 		depends on !B43_OPENFIRMWARE | ||||
| 		default y | ||||
| 		help | ||||
| 		  This options allows you to remove unnecessary b43 firmware files | ||||
| 		  from the final rootfs image. This can reduce the rootfs size by | ||||
| 		  up to 200k. | ||||
|  | ||||
| 		  If unsure, say Y. | ||||
|  | ||||
| 	config B43_FW_SQUASH_COREREVS | ||||
| 		string "Core revisions to include" | ||||
| 		depends on B43_FW_SQUASH | ||||
| 		default "5,6,7,8,9,10,11,13,15" if TARGET_bcm47xx_legacy | ||||
| 		default "16,28,29,30" if TARGET_bcm47xx_mips74k | ||||
| 		default "5,6,7,8,9,10,11,13,15,16,28,29,30" | ||||
| 		help | ||||
| 		  This is a comma seperated list of core revision numbers. | ||||
|  | ||||
| 		  Example (keep files for rev5 only): | ||||
| 		    5 | ||||
|  | ||||
| 		  Example (keep files for rev5 and rev11): | ||||
| 		    5,11 | ||||
|  | ||||
| 	config B43_FW_SQUASH_PHYTYPES | ||||
| 		string "PHY types to include" | ||||
| 		depends on B43_FW_SQUASH | ||||
| 		default "G,N,LP" if TARGET_bcm47xx_legacy | ||||
| 		default "N,HT" if TARGET_bcm47xx_mips74k | ||||
| 		default "G,N,LP,HT" | ||||
| 		help | ||||
| 		  This is a comma seperated list of PHY types: | ||||
| 		    A  => A-PHY | ||||
| 		    AG => Dual A-PHY G-PHY | ||||
| 		    G  => G-PHY | ||||
| 		    LP => LP-PHY | ||||
| 		    N  => N-PHY | ||||
| 		    HT  => HT-PHY | ||||
| 		    LCN  => LCN-PHY | ||||
| 		    LCN40  => LCN40-PHY | ||||
| 		    AC  => AC-PHY | ||||
|  | ||||
| 		  Example (keep files for G-PHY only): | ||||
| 		    G | ||||
|  | ||||
| 		  Example (keep files for G-PHY and N-PHY): | ||||
| 		    G,N | ||||
|  | ||||
| 	choice | ||||
| 		prompt "Supported buses" | ||||
| 		default PACKAGE_B43_BUSES_BCMA_AND_SSB | ||||
| 		help | ||||
| 		  This allows choosing buses that b43 should support. | ||||
|  | ||||
| 	config PACKAGE_B43_BUSES_BCMA_AND_SSB | ||||
| 		depends on !TARGET_bcm47xx_legacy && !TARGET_bcm47xx_mips74k && !TARGET_bcm53xx | ||||
| 		bool "BCMA and SSB" | ||||
|  | ||||
| 	config PACKAGE_B43_BUSES_BCMA | ||||
| 		depends on !TARGET_bcm47xx_legacy | ||||
| 		bool "BCMA only" | ||||
|  | ||||
| 	config PACKAGE_B43_BUSES_SSB | ||||
| 		depends on !TARGET_bcm47xx_mips74k && !TARGET_bcm53xx | ||||
| 		bool "SSB only" | ||||
|  | ||||
| 	endchoice | ||||
|  | ||||
| 	config PACKAGE_B43_DEBUG | ||||
| 		bool "Enable debug output and debugfs for b43" | ||||
| 		default n | ||||
| 		help | ||||
| 		  Enable additional debug output and runtime sanity checks for b43 | ||||
| 		  and enables the debugfs interface. | ||||
|  | ||||
| 		  If unsure, say N. | ||||
|  | ||||
| 	config PACKAGE_B43_PIO | ||||
| 		bool "Enable support for PIO transfer mode" | ||||
| 		default n | ||||
| 		help | ||||
| 		  Enable support for using PIO instead of DMA. Unless you have DMA | ||||
| 		  transfer problems you don't need this. | ||||
|  | ||||
| 		  If unsure, say N. | ||||
|  | ||||
| 	config PACKAGE_B43_PHY_G | ||||
| 		bool "Enable support for G-PHYs" | ||||
| 		default n if TARGET_bcm47xx_mips74k | ||||
| 		default y | ||||
| 		help | ||||
| 		  Enable support for G-PHY. This includes support for the following devices: | ||||
| 		  PCI: BCM4306, BCM4311, BCM4318 | ||||
| 		  SoC: BCM5352E, BCM4712 | ||||
|  | ||||
| 		  If unsure, say Y. | ||||
|  | ||||
| 	config PACKAGE_B43_PHY_N | ||||
| 		bool "Enable support for N-PHYs" | ||||
| 		default y | ||||
| 		help | ||||
| 		  Enable support for N-PHY. This includes support for the following devices: | ||||
| 		  PCI: BCM4321, BCM4322, BCM43222, BCM43224, BCM43225 | ||||
| 		  SoC: BCM4716, BCM4717, BCM4718 | ||||
|  | ||||
| 		  Currently only 11g speed is available. | ||||
|  | ||||
| 		  If unsure, say Y. | ||||
|  | ||||
| 	config PACKAGE_B43_PHY_LP | ||||
| 		bool "Enable support for LP-PHYs" | ||||
| 		default n if TARGET_bcm47xx_mips74k | ||||
| 		default y | ||||
| 		help | ||||
| 		  Enable support for LP-PHY. This includes support for the following devices: | ||||
| 		  PCI: BCM4312 | ||||
| 		  SoC: BCM5354 | ||||
|  | ||||
| 		  If unsure, say Y. | ||||
|  | ||||
| 	config PACKAGE_B43_PHY_HT | ||||
| 		bool "Enable support for HT-PHYs" | ||||
| 		default n if TARGET_bcm47xx_legacy | ||||
| 		default y | ||||
| 		help | ||||
| 		  Enable support for HT-PHY. This includes support for the following devices: | ||||
| 		  PCI: BCM4331 | ||||
|  | ||||
| 		  Currently only 11g speed is available. | ||||
|  | ||||
| 		  If unsure, say Y. | ||||
|  | ||||
| 	config PACKAGE_B43_PHY_LCN | ||||
| 		bool "Enable support for LCN-PHYs" | ||||
| 		depends on BROKEN | ||||
| 		default n | ||||
| 		help | ||||
| 		  Currently broken. | ||||
|  | ||||
| 		  If unsure, say N. | ||||
|  | ||||
|   endif | ||||
| endef | ||||
|  | ||||
| define KernelPackage/b43/description | ||||
| Kernel module for Broadcom 43xx wireless support (mac80211 stack) new | ||||
| endef | ||||
|  | ||||
| define KernelPackage/b43legacy | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Broadcom 43xx-legacy wireless support | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43 | ||||
|   KCONFIG:= \ | ||||
|   	CONFIG_HW_RANDOM=y | ||||
|   DEPENDS+= +kmod-mac80211 +!(TARGET_bcm47xx||TARGET_bcm63xx):kmod-ssb @!TARGET_bcm47xx_mips74k +b43legacy-firmware +@DRIVER_11W_SUPPORT | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/b43legacy/b43legacy.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,b43legacy) | ||||
|   MENU:=1 | ||||
| endef | ||||
|  | ||||
| define KernelPackage/b43legacy/description | ||||
| Kernel module for Broadcom 43xx-legacy wireless support (mac80211 stack) new | ||||
| endef | ||||
|  | ||||
|  | ||||
| define KernelPackage/brcmutil | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Broadcom IEEE802.11n common driver parts | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211 | ||||
|   DEPENDS+=@PCI_SUPPORT||USB_SUPPORT | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,brcmutil) | ||||
|   MENU:=1 | ||||
| endef | ||||
|  | ||||
| define KernelPackage/brcmutil/description | ||||
|  This module contains some common parts needed by Broadcom Wireless drivers brcmsmac and brcmfmac. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/brcmutil/config | ||||
|   if PACKAGE_kmod-brcmutil | ||||
|  | ||||
| 	config PACKAGE_BRCM80211_DEBUG | ||||
| 		bool "Broadcom wireless driver debugging" | ||||
| 		help | ||||
| 		  Say Y, if you want to debug brcmsmac and brcmfmac wireless driver. | ||||
|  | ||||
|   endif | ||||
| endef | ||||
|  | ||||
| PKG_BRCMSMAC_FW_NAME:=broadcom-wl | ||||
| PKG_BRCMSMAC_FW_VERSION:=5.100.138 | ||||
| PKG_BRCMSMAC_FW_OBJECT:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION)/linux/wl_apsta.o | ||||
| PKG_BRCMSMAC_FW_SOURCE:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION).tar.bz2 | ||||
| PKG_BRCMSMAC_FW_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/ | ||||
| PKG_BRCMSMAC_FW_HASH:=f1e7067aac5b62b67b8b6e4c517990277804339ac16065eb13c731ff909ae46f | ||||
|  | ||||
| define Download/brcmsmac | ||||
|   FILE:=$(PKG_BRCMSMAC_FW_SOURCE) | ||||
|   URL:=$(PKG_BRCMSMAC_FW_SOURCE_URL) | ||||
|   HASH:=$(PKG_BRCMSMAC_FW_HASH) | ||||
| endef | ||||
| $(eval $(call Download,brcmsmac)) | ||||
|  | ||||
| define KernelPackage/brcmsmac | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Broadcom IEEE802.11n PCIe SoftMAC WLAN driver | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211 | ||||
|   DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT +!TARGET_bcm47xx:kmod-bcma +kmod-lib-cordic +kmod-lib-crc8 +kmod-brcmutil +!BRCMSMAC_USE_FW_FROM_WL:brcmsmac-firmware | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcmsmac.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,brcmsmac) | ||||
|   MENU:=1 | ||||
| endef | ||||
|  | ||||
| define KernelPackage/brcmsmac/description | ||||
|  Kernel module for Broadcom IEEE802.11n PCIe Wireless cards | ||||
| endef | ||||
|  | ||||
| define KernelPackage/brcmsmac/config | ||||
|   if PACKAGE_kmod-brcmsmac | ||||
|  | ||||
| 	config BRCMSMAC_USE_FW_FROM_WL | ||||
| 		bool "Use firmware extracted from broadcom proprietary driver" | ||||
| 		default y | ||||
| 		help | ||||
| 		  Instead of using the official brcmsmac firmware a firmware | ||||
| 		  version 666.2 extracted from the proprietary Broadcom driver | ||||
| 		  is used. This is needed to get core rev 17 used in bcm4716 | ||||
| 		  to work. | ||||
|  | ||||
| 		  If unsure, say Y. | ||||
|  | ||||
|   endif | ||||
| endef | ||||
|  | ||||
|  | ||||
| define KernelPackage/brcmfmac | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Broadcom IEEE802.11n USB FullMAC WLAN driver | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211 | ||||
|   DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT \ | ||||
|   	+kmod-brcmutil +BRCMFMAC_SDIO:kmod-mmc @!TARGET_uml \ | ||||
| 	+BRCMFMAC_USB:kmod-usb-core +BRCMFMAC_USB:brcmfmac-firmware-usb | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,brcmfmac) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/brcmfmac/description | ||||
|  Kernel module for Broadcom IEEE802.11n USB Wireless cards | ||||
| endef | ||||
|  | ||||
| define KernelPackage/brcmfmac/config | ||||
|   if PACKAGE_kmod-brcmfmac | ||||
|  | ||||
| 	config BRCMFMAC_SDIO | ||||
| 		bool "Enable SDIO bus interface support" | ||||
| 		default y if TARGET_bcm27xx | ||||
| 		default y if TARGET_sunxi | ||||
| 		default n | ||||
| 		help | ||||
| 		  Enable support for cards attached to an SDIO bus. | ||||
| 		  Select this option only if you are sure that your | ||||
| 		  board has a Broadcom wireless chip atacched to | ||||
| 		  that bus. | ||||
|  | ||||
| 	config BRCMFMAC_USB | ||||
| 		bool "Enable USB bus interface support" | ||||
| 		depends on USB_SUPPORT | ||||
| 		default y | ||||
| 		help | ||||
| 		  Supported USB connected chipsets: | ||||
| 		  BCM43235, BCM43236, BCM43238 (all in revision 3 only) | ||||
| 		  BCM43143, BCM43242, BCM43566, BCM43569 | ||||
|  | ||||
| 	config BRCMFMAC_PCIE | ||||
| 		bool "Enable PCIE bus interface support" | ||||
| 		depends on PCI_SUPPORT | ||||
| 		default y | ||||
| 		help | ||||
| 		  Supported PCIe connected chipsets: | ||||
| 		  BCM4354, BCM4356, BCM43567, BCM43570, BCM43602 | ||||
|  | ||||
|   endif | ||||
| endef | ||||
|  | ||||
|  | ||||
| define KernelPackage/b43/install | ||||
| 	rm -rf $(1)/lib/firmware/ | ||||
| ifeq ($(CONFIG_B43_OPENFIRMWARE),y) | ||||
| 	tar xzf "$(DL_DIR)/$(PKG_B43_FWV4_SOURCE)" -C "$(PKG_BUILD_DIR)" | ||||
| else | ||||
| 	tar xjf "$(DL_DIR)/$(PKG_B43_FWV4_SOURCE)" -C "$(PKG_BUILD_DIR)" | ||||
| endif | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/ | ||||
| ifeq ($(CONFIG_B43_OPENFIRMWARE),y) | ||||
| 	$(MAKE) -C "$(PKG_BUILD_DIR)/$(PKG_B43_FWV4_OBJECT)/" | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/b43-open/ | ||||
| 	$(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_B43_FWV4_OBJECT)/ucode5.fw $(1)/lib/firmware/b43-open/ucode5.fw | ||||
| 	$(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_B43_FWV4_OBJECT)/b0g0bsinitvals5.fw $(1)/lib/firmware/b43-open/b0g0bsinitvals5.fw | ||||
| 	$(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_B43_FWV4_OBJECT)/b0g0initvals5.fw $(1)/lib/firmware/b43-open/b0g0initvals5.fw | ||||
| else | ||||
| 	b43-fwcutter -w $(1)/lib/firmware/ $(PKG_BUILD_DIR)/$(PKG_B43_FWV4_OBJECT) | ||||
| endif | ||||
| ifneq ($(CONFIG_B43_FW_SQUASH),) | ||||
| 	b43-fwsquash.py "$(CONFIG_B43_FW_SQUASH_PHYTYPES)" "$(CONFIG_B43_FW_SQUASH_COREREVS)" "$(1)/lib/firmware/b43" | ||||
| endif | ||||
| endef | ||||
|  | ||||
| define KernelPackage/brcmsmac/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware/brcm | ||||
| ifeq ($(CONFIG_BRCMSMAC_USE_FW_FROM_WL),y) | ||||
| 	tar xjf "$(DL_DIR)/$(PKG_BRCMSMAC_FW_SOURCE)" -C "$(PKG_BUILD_DIR)" | ||||
| 	b43-fwcutter --brcmsmac -w $(1)/lib/firmware/ $(PKG_BUILD_DIR)/$(PKG_BRCMSMAC_FW_OBJECT) | ||||
| endif | ||||
| endef | ||||
							
								
								
									
										36
									
								
								feeds/wifi-ath10k/mac80211/files/lib/netifd/mac80211.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								feeds/wifi-ath10k/mac80211/files/lib/netifd/mac80211.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| mac80211_phy_to_path() { | ||||
| 	local phy="$1" | ||||
|  | ||||
| 	[ -x /usr/bin/readlink -a -h /sys/class/ieee80211/${phy} ] || return | ||||
|  | ||||
| 	local path="$(readlink -f /sys/class/ieee80211/${phy}/device)" | ||||
| 	[ -n "$path" ] || return | ||||
|  | ||||
| 	path="${path##/sys/devices/}" | ||||
| 	case "$path" in | ||||
| 		platform*/pci*) path="${path##platform/}";; | ||||
| 	esac | ||||
|  | ||||
| 	local p | ||||
| 	local seq="" | ||||
| 	for p in $(ls /sys/class/ieee80211/$phy/device/ieee80211); do | ||||
| 		[ "$p" = "$phy" ] && { | ||||
| 			echo "$path${seq:++$seq}" | ||||
| 			break | ||||
| 		} | ||||
|  | ||||
| 		seq=$((${seq:-0} + 1)) | ||||
| 	done | ||||
| } | ||||
|  | ||||
| mac80211_path_to_phy() { | ||||
| 	local path="$1" | ||||
|  | ||||
| 	local p | ||||
| 	for p in $(ls /sys/class/ieee80211); do | ||||
| 		local cur="$(mac80211_phy_to_path "$p")" | ||||
| 		case "$cur" in | ||||
| 			*$path) echo "$p"; return;; | ||||
| 		esac | ||||
| 	done | ||||
| } | ||||
							
								
								
									
										1232
									
								
								feeds/wifi-ath10k/mac80211/files/lib/netifd/wireless/mac80211.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1232
									
								
								feeds/wifi-ath10k/mac80211/files/lib/netifd/wireless/mac80211.sh
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										190
									
								
								feeds/wifi-ath10k/mac80211/files/lib/wifi/mac80211.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										190
									
								
								feeds/wifi-ath10k/mac80211/files/lib/wifi/mac80211.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,190 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| append DRIVERS "mac80211" | ||||
|  | ||||
| lookup_phy() { | ||||
| 	[ -n "$phy" ] && { | ||||
| 		[ -d /sys/class/ieee80211/$phy ] && return | ||||
| 	} | ||||
|  | ||||
| 	local devpath | ||||
| 	config_get devpath "$device" path | ||||
| 	[ -n "$devpath" ] && { | ||||
| 		phy="$(iwinfo nl80211 phyname "path=$devpath")" | ||||
| 		[ -n "$phy" ] && return | ||||
| 	} | ||||
|  | ||||
| 	local macaddr="$(config_get "$device" macaddr | tr 'A-Z' 'a-z')" | ||||
| 	[ -n "$macaddr" ] && { | ||||
| 		for _phy in /sys/class/ieee80211/*; do | ||||
| 			[ -e "$_phy" ] || continue | ||||
|  | ||||
| 			[ "$macaddr" = "$(cat ${_phy}/macaddress)" ] || continue | ||||
| 			phy="${_phy##*/}" | ||||
| 			return | ||||
| 		done | ||||
| 	} | ||||
| 	phy= | ||||
| 	return | ||||
| } | ||||
|  | ||||
| find_mac80211_phy() { | ||||
| 	local device="$1" | ||||
|  | ||||
| 	config_get phy "$device" phy | ||||
| 	lookup_phy | ||||
| 	[ -n "$phy" -a -d "/sys/class/ieee80211/$phy" ] || { | ||||
| 		echo "PHY for wifi device $1 not found" | ||||
| 		return 1 | ||||
| 	} | ||||
| 	config_set "$device" phy "$phy" | ||||
|  | ||||
| 	config_get macaddr "$device" macaddr | ||||
| 	[ -z "$macaddr" ] && { | ||||
| 		config_set "$device" macaddr "$(cat /sys/class/ieee80211/${phy}/macaddress)" | ||||
| 	} | ||||
|  | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| check_mac80211_device() { | ||||
| 	config_get phy "$1" phy | ||||
| 	[ -z "$phy" ] && { | ||||
| 		find_mac80211_phy "$1" >/dev/null || return 0 | ||||
| 		config_get phy "$1" phy | ||||
| 	} | ||||
| 	[ "$phy" = "$dev" ] && found=1 | ||||
| } | ||||
|  | ||||
|  | ||||
| __get_band_defaults() { | ||||
| 	local phy="$1" | ||||
|  | ||||
| 	( iw phy "$phy" info; echo ) | awk ' | ||||
| BEGIN { | ||||
|         bands = "" | ||||
| } | ||||
|  | ||||
| ($1 == "Band" || $1 == "") && band { | ||||
|         if (channel) { | ||||
| 		mode="NOHT" | ||||
| 		if (ht) mode="HT20" | ||||
| 		if (vht && band != "1:") mode="VHT80" | ||||
| 		if (he) mode="HE80" | ||||
| 		if (he && band == "1:") mode="HE20" | ||||
|                 sub("\\[", "", channel) | ||||
|                 sub("\\]", "", channel) | ||||
|                 bands = bands band channel ":" mode " " | ||||
|         } | ||||
|         band="" | ||||
| } | ||||
|  | ||||
| $1 == "Band" { | ||||
|         band = $2 | ||||
|         channel = "" | ||||
| 	vht = "" | ||||
| 	ht = "" | ||||
| 	he = "" | ||||
| } | ||||
|  | ||||
| $0 ~ "Capabilities:" { | ||||
| 	ht=1 | ||||
| } | ||||
|  | ||||
| $0 ~ "VHT Capabilities" { | ||||
| 	vht=1 | ||||
| } | ||||
|  | ||||
| $0 ~ "HE Iftypes" { | ||||
| 	he=1 | ||||
| } | ||||
|  | ||||
| $1 == "*" && $3 == "MHz" && $0 !~ /disabled/ && band && !channel { | ||||
|         channel = $4 | ||||
| } | ||||
|  | ||||
| END { | ||||
|         print bands | ||||
| }' | ||||
| } | ||||
|  | ||||
| get_band_defaults() { | ||||
| 	local phy="$1" | ||||
|  | ||||
| 	for c in $(__get_band_defaults "$phy"); do | ||||
| 		local band="${c%%:*}" | ||||
| 		c="${c#*:}" | ||||
| 		local chan="${c%%:*}" | ||||
| 		c="${c#*:}" | ||||
| 		local mode="${c%%:*}" | ||||
|  | ||||
| 		case "$band" in | ||||
| 			1) band=2g;; | ||||
| 			2) band=5g;; | ||||
| 			3) band=60g;; | ||||
| 			4) band=6g;; | ||||
| 			*) band="";; | ||||
| 		esac | ||||
|  | ||||
| 		[ -n "$band" ] || continue | ||||
| 		[ -n "$mode_band" -a "$band" = "6g" ] && return | ||||
|  | ||||
| 		mode_band="$band" | ||||
| 		channel="$chan" | ||||
| 		htmode="$mode" | ||||
| 	done | ||||
| } | ||||
|  | ||||
| detect_mac80211() { | ||||
| 	devidx=0 | ||||
| 	config_load wireless | ||||
| 	while :; do | ||||
| 		config_get type "radio$devidx" type | ||||
| 		[ -n "$type" ] || break | ||||
| 		devidx=$(($devidx + 1)) | ||||
| 	done | ||||
|  | ||||
| 	for _dev in /sys/class/ieee80211/*; do | ||||
| 		[ -e "$_dev" ] || continue | ||||
|  | ||||
| 		dev="${_dev##*/}" | ||||
|  | ||||
| 		found=0 | ||||
| 		config_foreach check_mac80211_device wifi-device | ||||
| 		[ "$found" -gt 0 ] && continue | ||||
|  | ||||
| 		mode_band="" | ||||
| 		channel="" | ||||
| 		htmode="" | ||||
| 		ht_capab="" | ||||
|  | ||||
| 		get_band_defaults "$dev" | ||||
|  | ||||
| 		path="$(iwinfo nl80211 path "$dev")" | ||||
| 		if [ -n "$path" ]; then | ||||
| 			dev_id="set wireless.radio${devidx}.path='$path'" | ||||
| 		else | ||||
| 			dev_id="set wireless.radio${devidx}.macaddr=$(cat /sys/class/ieee80211/${dev}/macaddress)" | ||||
| 		fi | ||||
|  | ||||
| 		uci -q batch <<-EOF | ||||
| 			set wireless.radio${devidx}=wifi-device | ||||
| 			set wireless.radio${devidx}.type=mac80211 | ||||
| 			${dev_id} | ||||
| 			set wireless.radio${devidx}.channel=${channel} | ||||
| 			set wireless.radio${devidx}.band=${mode_band} | ||||
| 			set wireless.radio${devidx}.htmode=$htmode | ||||
| 			set wireless.radio${devidx}.disabled=1 | ||||
|  | ||||
| 			set wireless.default_radio${devidx}=wifi-iface | ||||
| 			set wireless.default_radio${devidx}.device=radio${devidx} | ||||
| 			set wireless.default_radio${devidx}.network=lan | ||||
| 			set wireless.default_radio${devidx}.mode=ap | ||||
| 			set wireless.default_radio${devidx}.ssid=OpenWrt | ||||
| 			set wireless.default_radio${devidx}.encryption=none | ||||
| EOF | ||||
| 		uci -q commit wireless | ||||
|  | ||||
| 		devidx=$(($devidx + 1)) | ||||
| 	done | ||||
| } | ||||
							
								
								
									
										5
									
								
								feeds/wifi-ath10k/mac80211/files/mac80211.hotplug
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								feeds/wifi-ath10k/mac80211/files/mac80211.hotplug
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| [ "${ACTION}" = "add" ] && { | ||||
| 	/sbin/wifi config | ||||
| } | ||||
							
								
								
									
										200
									
								
								feeds/wifi-ath10k/mac80211/intel.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										200
									
								
								feeds/wifi-ath10k/mac80211/intel.mk
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,200 @@ | ||||
| PKG_DRIVERS += \ | ||||
| 	iwl-legacy iwl3945 iwl4965 iwlwifi \ | ||||
| 	libipw ipw2100 ipw2200 \ | ||||
|  | ||||
| config-$(call config_package,iwl-legacy) += IWLEGACY | ||||
| config-$(call config_package,iwl3945) += IWL3945 | ||||
| config-$(call config_package,iwl4965) += IWL4965 | ||||
| config-$(call config_package,iwlwifi) += IWLWIFI IWLDVM IWLMVM | ||||
| config-$(CONFIG_PACKAGE_IWLWIFI_DEBUG)+= IWLWIFI_DEBUG | ||||
| config-$(CONFIG_PACKAGE_IWLWIFI_DEBUGFS)+= IWLWIFI_DEBUGFS | ||||
|  | ||||
| config-$(call config_package,libipw) += LIBIPW | ||||
| config-$(call config_package,ipw2100) += IPW2100 | ||||
| config-$(call config_package,ipw2200) += IPW2200 | ||||
|  | ||||
| define KernelPackage/iwlwifi | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT | ||||
|   TITLE:=Intel AGN Wireless support | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/dvm/iwldvm.ko \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/mvm/iwlmvm.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,iwlwifi iwldvm iwlmvm) | ||||
|   MENU:=1 | ||||
| endef | ||||
|  | ||||
| define KernelPackage/iwlwifi/description | ||||
|  iwlwifi kernel module for | ||||
|  Intel Wireless WiFi Link 6250AGN Adapter | ||||
|  Intel 6000 Series Wi-Fi Adapters (6200AGN and 6300AGN) | ||||
|  Intel WiFi Link 1000BGN | ||||
|  Intel Wireless WiFi 5150AGN | ||||
|  Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN | ||||
|  Intel 6005 Series Wi-Fi Adapters | ||||
|  Intel 6030 Series Wi-Fi Adapters | ||||
|  Intel Wireless WiFi Link 6150BGN 2 Adapter | ||||
|  Intel 100 Series Wi-Fi Adapters (100BGN and 130BGN) | ||||
|  Intel 2000 Series Wi-Fi Adapters | ||||
|  Intel 7260 Wi-Fi Adapter | ||||
|  Intel 3160 Wi-Fi Adapter | ||||
|  Intel 7265 Wi-Fi Adapter | ||||
|  Intel 8260 Wi-Fi Adapter | ||||
|  Intel 3165 Wi-Fi Adapter | ||||
| endef | ||||
|  | ||||
| define KernelPackage/iwlwifi/config | ||||
|   if PACKAGE_kmod-iwlwifi | ||||
|  | ||||
| 	config PACKAGE_IWLWIFI_DEBUG | ||||
| 		bool "Enable full debugging output in the iwlwifi driver" | ||||
| 		default n | ||||
| 		help | ||||
| 		  This option will enable debug tracing output for the iwlwifi drivers | ||||
|  | ||||
| 		  This will result in the kernel module being ~100k larger.  You can | ||||
| 		  control which debug output is sent to the kernel log by setting the | ||||
| 		  value in | ||||
|  | ||||
| 			/sys/module/iwlwifi/parameters/debug | ||||
|  | ||||
| 		  This entry will only exist if this option is enabled. | ||||
|  | ||||
| 		  To set a value, simply echo an 8-byte hex value to the same file: | ||||
|  | ||||
| 			  % echo 0x43fff > /sys/module/iwlwifi/parameters/debug | ||||
|  | ||||
| 		  You can find the list of debug mask values in: | ||||
| 			  drivers/net/wireless/intel/iwlwifi/iwl-debug.h | ||||
|  | ||||
| 		  If this is your first time using this driver, you should say Y here | ||||
| 		  as the debug information can assist others in helping you resolve | ||||
| 		  any problems you may encounter. | ||||
|  | ||||
| 	config PACKAGE_IWLWIFI_DEBUGFS | ||||
| 	        bool "iwlwifi debugfs support" | ||||
| 		depends on PACKAGE_MAC80211_DEBUGFS | ||||
| 		default n | ||||
| 		help | ||||
| 		  Enable creation of debugfs files for the iwlwifi drivers. This | ||||
| 		  is a low-impact option that allows getting insight into the | ||||
| 		  driver's state at runtime. | ||||
|  | ||||
|   endif | ||||
| endef | ||||
|  | ||||
| define KernelPackage/iwl-legacy | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   DEPENDS:= +kmod-mac80211 @PCI_SUPPORT | ||||
|   TITLE:=Intel legacy Wireless support | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlegacy/iwlegacy.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,iwlegacy) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/iwl-legacy/description | ||||
|  iwl-legacy kernel module for legacy Intel wireless support | ||||
| endef | ||||
|  | ||||
| define KernelPackage/iwl3945 | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +iwl3945-firmware | ||||
|   TITLE:=Intel iwl3945 Wireless support | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlegacy/iwl3945.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,iwl3945) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/iwl3945/description | ||||
|  iwl3945 kernel module for Intel 3945 support | ||||
| endef | ||||
|  | ||||
| define KernelPackage/iwl4965 | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +@DRIVER_11N_SUPPORT +iwl4965-firmware | ||||
|   TITLE:=Intel iwl4965 Wireless support | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlegacy/iwl4965.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,iwl4965) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/iwl4965/description | ||||
|  iwl4965 kernel module for Intel 4965 support | ||||
| endef | ||||
|  | ||||
|  | ||||
| define KernelPackage/libipw | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=libipw for ipw2100 and ipw2200 | ||||
|   DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-crypto-ecb +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/libipw.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,libipw) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/libipw/description | ||||
|  Hardware independent IEEE 802.11 networking stack for ipw2100 and ipw2200. | ||||
| endef | ||||
|  | ||||
| IPW2100_NAME:=ipw2100-fw | ||||
| IPW2100_VERSION:=1.3 | ||||
|  | ||||
| define Download/ipw2100 | ||||
|   URL:= \ | ||||
| 	https://src.fedoraproject.org/repo/pkgs/ipw2100-firmware/ipw2100-fw-1.3.tgz/46aa75bcda1a00efa841f9707bbbd113/ \ | ||||
| 	https://archlinux.mirror.pkern.at/other/packages/ipw2100-fw/ \ | ||||
| 	http://mirror.ox.ac.uk/sites/ftp.openbsd.org/pub/OpenBSD/distfiles/firmware/ \ | ||||
| 	http://firmware.openbsd.org/firmware-dist/ | ||||
|   FILE:=$(IPW2100_NAME)-$(IPW2100_VERSION).tgz | ||||
|   HASH:=e1107c455e48d324a616b47a622593bc8413dcce72026f72731c0b03dae3a7a2 | ||||
| endef | ||||
| $(eval $(call Download,ipw2100)) | ||||
|  | ||||
| define KernelPackage/ipw2100 | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Intel IPW2100 driver | ||||
|   DEPENDS:=@PCI_SUPPORT +kmod-libipw | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/ipw2100.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ipw2100) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ipw2100/description | ||||
|  Kernel support for Intel IPW2100 | ||||
|  Includes: | ||||
|  - ipw2100 | ||||
| endef | ||||
|  | ||||
| IPW2200_NAME:=ipw2200-fw | ||||
| IPW2200_VERSION:=3.1 | ||||
|  | ||||
| define Download/ipw2200 | ||||
|   URL:= \ | ||||
| 	https://src.fedoraproject.org/repo/pkgs/ipw2200-firmware/ipw2200-fw-3.1.tgz/eaba788643c7cc7483dd67ace70f6e99/ \ | ||||
| 	https://archlinux.mirror.pkern.at/other/packages/ipw2200-fw/ \ | ||||
| 	http://mirror.ox.ac.uk/sites/ftp.openbsd.org/pub/OpenBSD/distfiles/firmware/ \ | ||||
| 	http://firmware.openbsd.org/firmware-dist/ | ||||
|   FILE:=$(IPW2200_NAME)-$(IPW2200_VERSION).tgz | ||||
|   HASH:=c6818c11c18cc030d55ff83f64b2bad8feef485e7742f84f94a61d811a6258bd | ||||
| endef | ||||
| $(eval $(call Download,ipw2200)) | ||||
|  | ||||
| define KernelPackage/ipw2200 | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Intel IPW2200 driver | ||||
|   DEPENDS:=@PCI_SUPPORT +kmod-libipw | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/ipw2200.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ipw2200) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ipw2200/description | ||||
|  Kernel support for Intel IPW2200 | ||||
|  Includes: | ||||
|  - ipw2200 | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ipw2100/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware | ||||
| 	$(INSTALL_DATA) $(PKG_BUILD_DIR)/ipw2100-$(IPW2100_VERSION)*.fw $(1)/lib/firmware | ||||
| endef | ||||
|  | ||||
| define KernelPackage/ipw2200/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware | ||||
| 	$(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware | ||||
| endef | ||||
							
								
								
									
										90
									
								
								feeds/wifi-ath10k/mac80211/marvell.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								feeds/wifi-ath10k/mac80211/marvell.mk
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,90 @@ | ||||
| PKG_DRIVERS += \ | ||||
| 	libertas-sdio libertas-usb libertas-spi \ | ||||
| 	mwl8k mwifiex-pcie mwifiex-sdio | ||||
|  | ||||
| config-$(call config_package,libertas-sdio) += LIBERTAS LIBERTAS_SDIO | ||||
| config-$(call config_package,libertas-usb) += LIBERTAS LIBERTAS_USB | ||||
| config-$(call config_package,libertas-spi) += LIBERTAS LIBERTAS_SPI | ||||
| config-$(call config_package,mwl8k) += MWL8K | ||||
| config-$(call config_package,mwifiex-pcie) += MWIFIEX MWIFIEX_PCIE | ||||
| config-$(call config_package,mwifiex-sdio) += MWIFIEX MWIFIEX_SDIO | ||||
|  | ||||
| define KernelPackage/libertas-usb | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +libertas-usb-firmware | ||||
|   TITLE:=Marvell 88W8015 Wireless Driver | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas.ko \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/usb8xxx.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,libertas usb8xxx) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/libertas-sdio | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-sdio-firmware | ||||
|   TITLE:=Marvell 88W8686 Wireless Driver | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas.ko \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas_sdio.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,libertas libertas_sdio) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/libertas-spi | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   SUBMENU:=Wireless Drivers | ||||
|   DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-spi-firmware | ||||
|   KCONFIG := \ | ||||
| 	CONFIG_SPI=y \ | ||||
| 	CONFIG_SPI_MASTER=y | ||||
|   TITLE:=Marvell 88W8686 SPI Wireless Driver | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas.ko \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas_spi.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,libertas libertas_spi) | ||||
| endef | ||||
|  | ||||
|  | ||||
| define KernelPackage/mwl8k | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Driver for Marvell TOPDOG 802.11 Wireless cards | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/mwl8k | ||||
|   DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT +mwl8k-firmware | ||||
|   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwl8k.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,mwl8k) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/mwl8k/description | ||||
|  Kernel modules for Marvell TOPDOG 802.11 Wireless cards | ||||
| endef | ||||
|  | ||||
|  | ||||
| define KernelPackage/mwifiex-pcie | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Driver for Marvell 802.11n/802.11ac PCIe Wireless cards | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/mwifiex | ||||
|   DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +mwifiex-pcie-firmware | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex.ko \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex_pcie.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,mwifiex_pcie) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/mwifiex-pcie/description | ||||
|  Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards | ||||
| endef | ||||
|  | ||||
| define KernelPackage/mwifiex-sdio | ||||
|   $(call KernelPackage/mac80211/Default) | ||||
|   TITLE:=Driver for Marvell 802.11n/802.11ac SDIO Wireless cards | ||||
|   URL:=https://wireless.wiki.kernel.org/en/users/drivers/mwifiex | ||||
|   DEPENDS+= +kmod-mmc +kmod-mac80211 +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +mwifiex-sdio-firmware | ||||
|   FILES:= \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex.ko \ | ||||
| 	$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex_sdio.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,mwifiex_sdio) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/mwifiex-sdio/description | ||||
|  Kernel modules for Marvell 802.11n/802.11ac SDIO Wireless cards | ||||
| endef | ||||
|  | ||||
| @@ -0,0 +1,10 @@ | ||||
| --- a/drivers/net/wireless/ath/Kconfig | ||||
| +++ b/drivers/net/wireless/ath/Kconfig | ||||
| @@ -1,6 +1,6 @@ | ||||
|  # SPDX-License-Identifier: ISC | ||||
|  config ATH_COMMON | ||||
| -	tristate | ||||
| +	tristate "ath.ko" | ||||
|  	depends on m | ||||
|   | ||||
|  config WLAN_VENDOR_ATH | ||||
| @@ -0,0 +1,47 @@ | ||||
| --- a/drivers/net/wireless/ath/ath10k/Kconfig | ||||
| +++ b/drivers/net/wireless/ath/ath10k/Kconfig | ||||
| @@ -86,6 +86,12 @@ config ATH10K_TRACING | ||||
|  	help | ||||
|  	  Select this to ath10k use tracing infrastructure. | ||||
|   | ||||
| +config ATH10K_THERMAL | ||||
| +	bool "Atheros ath10k thermal monitoring support" | ||||
| +	depends on THERMAL | ||||
| +	---help--- | ||||
| +	  Select this to ath10k use hwmon for thermal measurement. | ||||
| + | ||||
|  config ATH10K_DFS_CERTIFIED | ||||
|  	bool "Atheros DFS support for certified platforms" | ||||
|  	depends on ATH10K && CFG80211_CERTIFICATION_ONUS | ||||
| --- a/drivers/net/wireless/ath/ath10k/Makefile | ||||
| +++ b/drivers/net/wireless/ath/ath10k/Makefile | ||||
| @@ -18,7 +18,7 @@ ath10k_core-y += mac.o \ | ||||
|  ath10k_core-$(CPTCFG_ATH10K_SPECTRAL) += spectral.o | ||||
|  ath10k_core-$(CPTCFG_NL80211_TESTMODE) += testmode.o | ||||
|  ath10k_core-$(CPTCFG_ATH10K_TRACING) += trace.o | ||||
| -ath10k_core-$(CONFIG_THERMAL) += thermal.o | ||||
| +ath10k_core-$(CPTCFG_ATH10K_THERMAL) += thermal.o | ||||
|  ath10k_core-$(CPTCFG_MAC80211_DEBUGFS) += debugfs_sta.o | ||||
|  ath10k_core-$(CONFIG_PM) += wow.o | ||||
|  ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o | ||||
| --- a/drivers/net/wireless/ath/ath10k/thermal.h | ||||
| +++ b/drivers/net/wireless/ath/ath10k/thermal.h | ||||
| @@ -25,7 +25,7 @@ struct ath10k_thermal { | ||||
|  	int temperature; | ||||
|  }; | ||||
|   | ||||
| -#if IS_REACHABLE(CONFIG_THERMAL) | ||||
| +#if IS_REACHABLE(CPTCFG_ATH10K_THERMAL) | ||||
|  int ath10k_thermal_register(struct ath10k *ar); | ||||
|  void ath10k_thermal_unregister(struct ath10k *ar); | ||||
|  void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature); | ||||
| --- a/local-symbols | ||||
| +++ b/local-symbols | ||||
| @@ -142,6 +142,7 @@ ATH10K_SNOC= | ||||
|  ATH10K_DEBUG= | ||||
|  ATH10K_DEBUGFS= | ||||
|  ATH10K_SPECTRAL= | ||||
| +ATH10K_THERMAL= | ||||
|  ATH10K_TRACING= | ||||
|  ATH10K_DFS_CERTIFIED= | ||||
|  WCN36XX= | ||||
| @@ -0,0 +1,53 @@ | ||||
| From: Christian Lamparter <chunkeey@gmail.com> | ||||
| Date: Sat, 16 Nov 2019 19:25:24 +0100 | ||||
| Subject: [PATCH] owl_loader: compatibility patch | ||||
|  | ||||
| This patch includes OpenWrt specific changes that are | ||||
| not included in the upstream owl-loader. | ||||
|  | ||||
| This includes a platform data handling changes for ar71xx. | ||||
|  | ||||
| Signed-off-by: Christian Lamparter <chunkeey@gmail.com> | ||||
|  | ||||
| --- a/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c | ||||
| @@ -103,6 +103,7 @@ static void owl_fw_cb(const struct firmw | ||||
|  { | ||||
|  	struct pci_dev *pdev = (struct pci_dev *)context; | ||||
|  	struct owl_ctx *ctx = (struct owl_ctx *)pci_get_drvdata(pdev); | ||||
| +	struct ath9k_platform_data *pdata = dev_get_platdata(&pdev->dev); | ||||
|  	struct pci_bus *bus; | ||||
|   | ||||
|  	complete(&ctx->eeprom_load); | ||||
| @@ -118,6 +119,16 @@ static void owl_fw_cb(const struct firmw | ||||
|  		goto release; | ||||
|  	} | ||||
|   | ||||
| +	if (pdata) { | ||||
| +		memcpy(pdata->eeprom_data, fw->data, fw->size); | ||||
| + | ||||
| +		/* | ||||
| +		 * eeprom has been successfully loaded - pass the data to ath9k | ||||
| +		 * but remove the eeprom_name, so it doesn't try to load it too. | ||||
| +		 */ | ||||
| +		pdata->eeprom_name = NULL; | ||||
| +	} | ||||
| + | ||||
|  	if (ath9k_pci_fixup(pdev, (const u16 *)fw->data, fw->size)) | ||||
|  		goto release; | ||||
|   | ||||
| @@ -137,8 +148,14 @@ release: | ||||
|  static const char *owl_get_eeprom_name(struct pci_dev *pdev) | ||||
|  { | ||||
|  	struct device *dev = &pdev->dev; | ||||
| +	struct ath9k_platform_data *pdata; | ||||
|  	char *eeprom_name; | ||||
|   | ||||
| +	/* try the existing platform data first */ | ||||
| +	pdata = dev_get_platdata(dev); | ||||
| +	if (pdata && pdata->eeprom_name) | ||||
| +		return pdata->eeprom_name; | ||||
| + | ||||
|  	dev_dbg(dev, "using auto-generated eeprom filename\n"); | ||||
|   | ||||
|  	eeprom_name = devm_kzalloc(dev, EEPROM_FILENAME_LEN, GFP_KERNEL); | ||||
| @@ -0,0 +1,38 @@ | ||||
| --- a/drivers/net/wireless/ath/ath5k/initvals.c | ||||
| +++ b/drivers/net/wireless/ath/ath5k/initvals.c | ||||
| @@ -62,8 +62,14 @@ static const struct ath5k_ini ar5210_ini | ||||
|  	{ AR5K_IMR,		0 }, | ||||
|  	{ AR5K_IER,		AR5K_IER_DISABLE }, | ||||
|  	{ AR5K_BSR,		0, AR5K_INI_READ }, | ||||
| +#if !defined(CONFIG_ATHEROS_AR71XX) && !defined(CONFIG_ATH79) | ||||
|  	{ AR5K_TXCFG,		AR5K_DMASIZE_128B }, | ||||
|  	{ AR5K_RXCFG,		AR5K_DMASIZE_128B }, | ||||
| +#else | ||||
| +	/* WAR for AR71xx PCI bug */ | ||||
| +	{ AR5K_TXCFG,		AR5K_DMASIZE_128B }, | ||||
| +	{ AR5K_RXCFG,		AR5K_DMASIZE_4B }, | ||||
| +#endif | ||||
|  	{ AR5K_CFG,		AR5K_INIT_CFG }, | ||||
|  	{ AR5K_TOPS,		8 }, | ||||
|  	{ AR5K_RXNOFRM,		8 }, | ||||
| --- a/drivers/net/wireless/ath/ath5k/dma.c | ||||
| +++ b/drivers/net/wireless/ath/ath5k/dma.c | ||||
| @@ -869,10 +869,18 @@ ath5k_hw_dma_init(struct ath5k_hw *ah) | ||||
|  	 * guess we can tweak it and see how it goes ;-) | ||||
|  	 */ | ||||
|  	if (ah->ah_version != AR5K_AR5210) { | ||||
| +#if !defined(CONFIG_ATHEROS_AR71XX) && !defined(CONFIG_ATH79) | ||||
|  		AR5K_REG_WRITE_BITS(ah, AR5K_TXCFG, | ||||
|  			AR5K_TXCFG_SDMAMR, AR5K_DMASIZE_128B); | ||||
|  		AR5K_REG_WRITE_BITS(ah, AR5K_RXCFG, | ||||
|  			AR5K_RXCFG_SDMAMW, AR5K_DMASIZE_128B); | ||||
| +#else | ||||
| +		/* WAR for AR71xx PCI bug */ | ||||
| +		AR5K_REG_WRITE_BITS(ah, AR5K_TXCFG, | ||||
| +			AR5K_TXCFG_SDMAMR, AR5K_DMASIZE_128B); | ||||
| +		AR5K_REG_WRITE_BITS(ah, AR5K_RXCFG, | ||||
| +			AR5K_RXCFG_SDMAMW, AR5K_DMASIZE_4B); | ||||
| +#endif | ||||
|  	} | ||||
|   | ||||
|  	/* Pre-enable interrupts on 5211/5212*/ | ||||
| @@ -0,0 +1,25 @@ | ||||
| From: Felix Fietkau <nbd@nbd.name> | ||||
| Date: Sat, 9 Jul 2016 15:25:24 +0200 | ||||
| Subject: [PATCH] ath9k_hw: reset AHB-WMAC interface on AR91xx | ||||
|  | ||||
| Should fix a few stability issues | ||||
|  | ||||
| Signed-off-by: Felix Fietkau <nbd@nbd.name> | ||||
| --- | ||||
|  | ||||
| --- a/drivers/net/wireless/ath/ath9k/hw.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/hw.c | ||||
| @@ -1435,8 +1435,12 @@ static bool ath9k_hw_set_reset(struct at | ||||
|  	if (!AR_SREV_9100(ah)) | ||||
|  		REG_WRITE(ah, AR_RC, 0); | ||||
|   | ||||
| -	if (AR_SREV_9100(ah)) | ||||
| +	if (AR_SREV_9100(ah)) { | ||||
| +		/* Reset the AHB-WMAC interface */ | ||||
| +		if (ah->external_reset) | ||||
| +			ah->external_reset(); | ||||
|  		udelay(50); | ||||
| +	} | ||||
|   | ||||
|  	return true; | ||||
|  } | ||||
| @@ -0,0 +1,129 @@ | ||||
| From: Felix Fietkau <nbd@nbd.name> | ||||
| Date: Sat, 9 Jul 2016 15:26:44 +0200 | ||||
| Subject: [PATCH] ath9k_hw: issue external reset for QCA955x | ||||
|  | ||||
| The RTC interface on the SoC needs to be reset along with the rest of | ||||
| the WMAC. | ||||
|  | ||||
| Signed-off-by: Felix Fietkau <nbd@nbd.name> | ||||
| --- | ||||
|  | ||||
| --- a/drivers/net/wireless/ath/ath9k/hw.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/hw.c | ||||
| @@ -1312,39 +1312,56 @@ void ath9k_hw_get_delta_slope_vals(struc | ||||
|  	*coef_exponent = coef_exp - 16; | ||||
|  } | ||||
|   | ||||
| -/* AR9330 WAR: | ||||
| - * call external reset function to reset WMAC if: | ||||
| - * - doing a cold reset | ||||
| - * - we have pending frames in the TX queues. | ||||
| - */ | ||||
| -static bool ath9k_hw_ar9330_reset_war(struct ath_hw *ah, int type) | ||||
| +static bool ath9k_hw_need_external_reset(struct ath_hw *ah, int type) | ||||
|  { | ||||
| -	int i, npend = 0; | ||||
| +	int i; | ||||
|   | ||||
| -	for (i = 0; i < AR_NUM_QCU; i++) { | ||||
| -		npend = ath9k_hw_numtxpending(ah, i); | ||||
| -		if (npend) | ||||
| -			break; | ||||
| -	} | ||||
| - | ||||
| -	if (ah->external_reset && | ||||
| -	    (npend || type == ATH9K_RESET_COLD)) { | ||||
| -		int reset_err = 0; | ||||
| - | ||||
| -		ath_dbg(ath9k_hw_common(ah), RESET, | ||||
| -			"reset MAC via external reset\n"); | ||||
| - | ||||
| -		reset_err = ah->external_reset(); | ||||
| -		if (reset_err) { | ||||
| -			ath_err(ath9k_hw_common(ah), | ||||
| -				"External reset failed, err=%d\n", | ||||
| -				reset_err); | ||||
| -			return false; | ||||
| +	if (type == ATH9K_RESET_COLD) | ||||
| +		return true; | ||||
| + | ||||
| +	if (AR_SREV_9550(ah)) | ||||
| +		return true; | ||||
| + | ||||
| +	/* AR9330 WAR: | ||||
| +	 * call external reset function to reset WMAC if: | ||||
| +	 * - doing a cold reset | ||||
| +	 * - we have pending frames in the TX queues. | ||||
| +	 */ | ||||
| +	if (AR_SREV_9330(ah)) { | ||||
| +		for (i = 0; i < AR_NUM_QCU; i++) { | ||||
| +			if (ath9k_hw_numtxpending(ah, i)) | ||||
| +				return true; | ||||
|  		} | ||||
| +	} | ||||
| + | ||||
| +	return false; | ||||
| +} | ||||
| + | ||||
| +static bool ath9k_hw_external_reset(struct ath_hw *ah, int type) | ||||
| +{ | ||||
| +	int err; | ||||
| + | ||||
| +	if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type)) | ||||
| +		return true; | ||||
| + | ||||
| +	ath_dbg(ath9k_hw_common(ah), RESET, | ||||
| +		"reset MAC via external reset\n"); | ||||
|   | ||||
| -		REG_WRITE(ah, AR_RTC_RESET, 1); | ||||
| +	err = ah->external_reset(); | ||||
| +	if (err) { | ||||
| +		ath_err(ath9k_hw_common(ah), | ||||
| +			"External reset failed, err=%d\n", err); | ||||
| +		return false; | ||||
|  	} | ||||
|   | ||||
| +	if (AR_SREV_9550(ah)) { | ||||
| +		REG_WRITE(ah, AR_RTC_RESET, 0); | ||||
| +		udelay(10); | ||||
| +	} | ||||
| + | ||||
| +	REG_WRITE(ah, AR_RTC_RESET, 1); | ||||
| +	udelay(10); | ||||
| + | ||||
|  	return true; | ||||
|  } | ||||
|   | ||||
| @@ -1397,24 +1414,24 @@ static bool ath9k_hw_set_reset(struct at | ||||
|  			rst_flags |= AR_RTC_RC_MAC_COLD; | ||||
|  	} | ||||
|   | ||||
| -	if (AR_SREV_9330(ah)) { | ||||
| -		if (!ath9k_hw_ar9330_reset_war(ah, type)) | ||||
| -			return false; | ||||
| -	} | ||||
| - | ||||
|  	if (ath9k_hw_mci_is_enabled(ah)) | ||||
|  		ar9003_mci_check_gpm_offset(ah); | ||||
|   | ||||
|  	/* DMA HALT added to resolve ar9300 and ar9580 bus error during | ||||
| -	 * RTC_RC reg read | ||||
| +	 * RTC_RC reg read. Also needed for AR9550 external reset | ||||
|  	 */ | ||||
| -	if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) { | ||||
| +	if (AR_SREV_9300(ah) || AR_SREV_9580(ah) || AR_SREV_9550(ah)) { | ||||
|  		REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ); | ||||
|  		ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK, | ||||
|  			      20 * AH_WAIT_TIMEOUT); | ||||
| -		REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ); | ||||
|  	} | ||||
|   | ||||
| +	if (!AR_SREV_9100(ah)) | ||||
| +		ath9k_hw_external_reset(ah, type); | ||||
| + | ||||
| +	if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) | ||||
| +		REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ); | ||||
| + | ||||
|  	REG_WRITE(ah, AR_RTC_RC, rst_flags); | ||||
|   | ||||
|  	REGWRITE_BUFFER_FLUSH(ah); | ||||
| @@ -0,0 +1,35 @@ | ||||
| From: Felix Fietkau <nbd@openwrt.org> | ||||
| Date: Sun, 7 Jun 2015 13:53:35 +0200 | ||||
| Subject: [PATCH] ath9k: force rx_clear when disabling rx | ||||
|  | ||||
| This makes stopping Rx more reliable and should reduce the frequency of | ||||
| Rx related DMA stop warnings. Don't use rx_clear in TX99 mode. | ||||
|  | ||||
| Cc: stable@vger.kernel.org | ||||
| Signed-off-by: Felix Fietkau <nbd@nbd.name> | ||||
| Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> | ||||
| --- | ||||
|  | ||||
| --- a/drivers/net/wireless/ath/ath9k/mac.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/mac.c | ||||
| @@ -678,13 +678,18 @@ void ath9k_hw_startpcureceive(struct ath | ||||
|   | ||||
|  	ath9k_ani_reset(ah, is_scanning); | ||||
|   | ||||
| -	REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); | ||||
| +	REG_CLR_BIT(ah, AR_DIAG_SW, | ||||
| +		    AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR); | ||||
|  } | ||||
|  EXPORT_SYMBOL(ath9k_hw_startpcureceive); | ||||
|   | ||||
|  void ath9k_hw_abortpcurecv(struct ath_hw *ah) | ||||
|  { | ||||
| -	REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS); | ||||
| +	u32 reg = AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT; | ||||
| + | ||||
| +	if (!IS_ENABLED(CPTCFG_ATH9K_TX99)) | ||||
| +		reg |= AR_DIAG_FORCE_RX_CLEAR; | ||||
| +	REG_SET_BIT(ah, AR_DIAG_SW, reg); | ||||
|   | ||||
|  	ath9k_hw_disable_mib_counters(ah); | ||||
|  } | ||||
| @@ -0,0 +1,36 @@ | ||||
| From: Felix Fietkau <nbd@nbd.name> | ||||
| Date: Sat, 14 May 2016 14:51:02 +0200 | ||||
| Subject: [PATCH] Revert "ath9k: interpret requested txpower in EIRP | ||||
|  domain" | ||||
|  | ||||
| This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411. | ||||
| --- | ||||
|  | ||||
| --- a/drivers/net/wireless/ath/ath9k/hw.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/hw.c | ||||
| @@ -2977,7 +2977,8 @@ void ath9k_hw_apply_txpower(struct ath_h | ||||
|  { | ||||
|  	struct ath_regulatory *reg = ath9k_hw_regulatory(ah); | ||||
|  	struct ieee80211_channel *channel; | ||||
| -	int chan_pwr, new_pwr; | ||||
| +	int chan_pwr, new_pwr, max_gain; | ||||
| +	int ant_gain, ant_reduction = 0; | ||||
|  	u16 ctl = NO_CTL; | ||||
|   | ||||
|  	if (!chan) | ||||
| @@ -2989,9 +2990,14 @@ void ath9k_hw_apply_txpower(struct ath_h | ||||
|  	channel = chan->chan; | ||||
|  	chan_pwr = min_t(int, channel->max_power * 2, MAX_COMBINED_POWER); | ||||
|  	new_pwr = min_t(int, chan_pwr, reg->power_limit); | ||||
| +	max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2; | ||||
| + | ||||
| +	ant_gain = get_antenna_gain(ah, chan); | ||||
| +	if (ant_gain > max_gain) | ||||
| +		ant_reduction = ant_gain - max_gain; | ||||
|   | ||||
|  	ah->eep_ops->set_txpower(ah, chan, ctl, | ||||
| -				 get_antenna_gain(ah, chan), new_pwr, test); | ||||
| +				 ant_reduction, new_pwr, test); | ||||
|  } | ||||
|   | ||||
|  void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) | ||||
| @@ -0,0 +1,24 @@ | ||||
| From: Felix Fietkau <nbd@nbd.name> | ||||
| Date: Wed, 19 Jul 2017 08:49:31 +0200 | ||||
| Subject: [PATCH] ath9k: adjust tx power reduction for US regulatory | ||||
|  domain | ||||
|  | ||||
| FCC regulatory rules allow for up to 6 dBi antenna gain. Account for | ||||
| this in the EEPROM based tx power reduction code. | ||||
|  | ||||
| Signed-off-by: Felix Fietkau <nbd@nbd.name> | ||||
| --- | ||||
|  | ||||
| --- a/drivers/net/wireless/ath/ath9k/hw.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/hw.c | ||||
| @@ -2996,6 +2996,10 @@ void ath9k_hw_apply_txpower(struct ath_h | ||||
|  	if (ant_gain > max_gain) | ||||
|  		ant_reduction = ant_gain - max_gain; | ||||
|   | ||||
| +	/* FCC allows maximum antenna gain of 6 dBi */ | ||||
| +	if (reg->region == NL80211_DFS_FCC) | ||||
| +		ant_reduction = max_t(int, ant_reduction - 12, 0); | ||||
| + | ||||
|  	ah->eep_ops->set_txpower(ah, chan, ctl, | ||||
|  				 ant_reduction, new_pwr, test); | ||||
|  } | ||||
| @@ -0,0 +1,31 @@ | ||||
| --- a/drivers/net/wireless/ath/Makefile | ||||
| +++ b/drivers/net/wireless/ath/Makefile | ||||
| @@ -15,10 +15,10 @@ ath-objs :=	main.o \ | ||||
|  		regd.o \ | ||||
|  		hw.o \ | ||||
|  		key.o \ | ||||
| +		debug.o \ | ||||
|  		dfs_pattern_detector.o \ | ||||
|  		dfs_pri_detector.o | ||||
|   | ||||
| -ath-$(CPTCFG_ATH_DEBUG) += debug.o | ||||
|  ath-$(CPTCFG_ATH_TRACEPOINTS) += trace.o | ||||
|   | ||||
|  CFLAGS_trace.o := -I$(src) | ||||
| --- a/drivers/net/wireless/ath/ath.h | ||||
| +++ b/drivers/net/wireless/ath/ath.h | ||||
| @@ -316,14 +316,7 @@ void _ath_dbg(struct ath_common *common, | ||||
|  #endif /* CPTCFG_ATH_DEBUG */ | ||||
|   | ||||
|  /** Returns string describing opmode, or NULL if unknown mode. */ | ||||
| -#ifdef CPTCFG_ATH_DEBUG | ||||
|  const char *ath_opmode_to_string(enum nl80211_iftype opmode); | ||||
| -#else | ||||
| -static inline const char *ath_opmode_to_string(enum nl80211_iftype opmode) | ||||
| -{ | ||||
| -	return "UNKNOWN"; | ||||
| -} | ||||
| -#endif | ||||
|   | ||||
|  extern const char *ath_bus_type_strings[]; | ||||
|  static inline const char *ath_bus_type_to_string(enum ath_bus_type bustype) | ||||
| @@ -0,0 +1,11 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/init.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/init.c | ||||
| @@ -48,7 +48,7 @@ int ath9k_modparam_nohwcrypt; | ||||
|  module_param_named(nohwcrypt, ath9k_modparam_nohwcrypt, int, 0444); | ||||
|  MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption"); | ||||
|   | ||||
| -int ath9k_led_blink; | ||||
| +int ath9k_led_blink = 1; | ||||
|  module_param_named(blink, ath9k_led_blink, int, 0444); | ||||
|  MODULE_PARM_DESC(blink, "Enable LED blink on activity"); | ||||
|   | ||||
| @@ -0,0 +1,92 @@ | ||||
| --- a/drivers/net/wireless/ath/regd.c | ||||
| +++ b/drivers/net/wireless/ath/regd.c | ||||
| @@ -24,6 +24,7 @@ | ||||
|  #include "regd_common.h" | ||||
|   | ||||
|  static int __ath_regd_init(struct ath_regulatory *reg); | ||||
| +static struct reg_dmn_pair_mapping *ath_get_regpair(int regdmn); | ||||
|   | ||||
|  /* | ||||
|   * This is a set of common rules used by our world regulatory domains. | ||||
| @@ -116,6 +117,9 @@ static const struct ieee80211_regdomain | ||||
|   | ||||
|  static bool dynamic_country_user_possible(struct ath_regulatory *reg) | ||||
|  { | ||||
| +	if (IS_ENABLED(CPTCFG_ATH_USER_REGD)) | ||||
| +		return true; | ||||
| + | ||||
|  	if (IS_ENABLED(CPTCFG_ATH_REG_DYNAMIC_USER_CERT_TESTING)) | ||||
|  		return true; | ||||
|   | ||||
| @@ -188,6 +192,8 @@ static bool dynamic_country_user_possibl | ||||
|   | ||||
|  static bool ath_reg_dyn_country_user_allow(struct ath_regulatory *reg) | ||||
|  { | ||||
| +	if (IS_ENABLED(CPTCFG_ATH_USER_REGD)) | ||||
| +		return true; | ||||
|  	if (!IS_ENABLED(CPTCFG_ATH_REG_DYNAMIC_USER_REG_HINTS)) | ||||
|  		return false; | ||||
|  	if (!dynamic_country_user_possible(reg)) | ||||
| @@ -345,6 +351,9 @@ ath_reg_apply_beaconing_flags(struct wip | ||||
|  	struct ieee80211_channel *ch; | ||||
|  	unsigned int i; | ||||
|   | ||||
| +	if (IS_ENABLED(CPTCFG_ATH_USER_REGD)) | ||||
| +		return; | ||||
| + | ||||
|  	for (band = 0; band < NUM_NL80211_BANDS; band++) { | ||||
|  		if (!wiphy->bands[band]) | ||||
|  			continue; | ||||
| @@ -378,6 +387,9 @@ ath_reg_apply_ir_flags(struct wiphy *wip | ||||
|  { | ||||
|  	struct ieee80211_supported_band *sband; | ||||
|   | ||||
| +	if (IS_ENABLED(CPTCFG_ATH_USER_REGD)) | ||||
| +		return; | ||||
| + | ||||
|  	sband = wiphy->bands[NL80211_BAND_2GHZ]; | ||||
|  	if (!sband) | ||||
|  		return; | ||||
| @@ -407,6 +419,9 @@ static void ath_reg_apply_radar_flags(st | ||||
|  	struct ieee80211_channel *ch; | ||||
|  	unsigned int i; | ||||
|   | ||||
| +	if (IS_ENABLED(CPTCFG_ATH_USER_REGD)) | ||||
| +		return; | ||||
| + | ||||
|  	if (!wiphy->bands[NL80211_BAND_5GHZ]) | ||||
|  		return; | ||||
|   | ||||
| @@ -639,6 +654,10 @@ ath_regd_init_wiphy(struct ath_regulator | ||||
|  	const struct ieee80211_regdomain *regd; | ||||
|   | ||||
|  	wiphy->reg_notifier = reg_notifier; | ||||
| + | ||||
| +	if (IS_ENABLED(CPTCFG_ATH_USER_REGD)) | ||||
| +		return 0; | ||||
| + | ||||
|  	wiphy->regulatory_flags |= REGULATORY_STRICT_REG | | ||||
|  				   REGULATORY_CUSTOM_REG; | ||||
|   | ||||
| --- a/drivers/net/wireless/ath/Kconfig | ||||
| +++ b/drivers/net/wireless/ath/Kconfig | ||||
| @@ -24,6 +24,9 @@ config WLAN_VENDOR_ATH | ||||
|   | ||||
|  if WLAN_VENDOR_ATH | ||||
|   | ||||
| +config ATH_USER_REGD | ||||
| +	bool "Do not enforce EEPROM regulatory restrictions" | ||||
| + | ||||
|  config ATH_DEBUG | ||||
|  	bool "Atheros wireless debugging" | ||||
|  	help | ||||
| --- a/local-symbols | ||||
| +++ b/local-symbols | ||||
| @@ -85,6 +85,7 @@ ADM8211= | ||||
|  ATH_COMMON= | ||||
|  WLAN_VENDOR_ATH= | ||||
|  ATH_DEBUG= | ||||
| +ATH_USER_REGD= | ||||
|  ATH_TRACEPOINTS= | ||||
|  ATH_REG_DYNAMIC_USER_REG_HINTS= | ||||
|  ATH_REG_DYNAMIC_USER_CERT_TESTING= | ||||
| @@ -0,0 +1,84 @@ | ||||
| --- a/drivers/net/wireless/ath/regd.c | ||||
| +++ b/drivers/net/wireless/ath/regd.c | ||||
| @@ -44,7 +44,8 @@ static struct reg_dmn_pair_mapping *ath_ | ||||
|  					 NL80211_RRF_NO_OFDM) | ||||
|   | ||||
|  /* We allow IBSS on these on a case by case basis by regulatory domain */ | ||||
| -#define ATH_5GHZ_5150_5350	REG_RULE(5150-10, 5350+10, 80, 0, 30,\ | ||||
| +#define ATH_5GHZ_5150_5350	REG_RULE(5150-10, 5240+10, 80, 0, 30, 0),\ | ||||
| +				REG_RULE(5260-10, 5350+10, 80, 0, 30,\ | ||||
|  					 NL80211_RRF_NO_IR) | ||||
|  #define ATH_5GHZ_5470_5850	REG_RULE(5470-10, 5850+10, 80, 0, 30,\ | ||||
|  					 NL80211_RRF_NO_IR) | ||||
| @@ -62,57 +63,56 @@ static struct reg_dmn_pair_mapping *ath_ | ||||
|  #define ATH_5GHZ_NO_MIDBAND	ATH_5GHZ_5150_5350, \ | ||||
|  				ATH_5GHZ_5725_5850 | ||||
|   | ||||
| +#define REGD_RULES(...) \ | ||||
| +	.reg_rules = { __VA_ARGS__ }, \ | ||||
| +	.n_reg_rules = ARRAY_SIZE(((struct ieee80211_reg_rule[]) { __VA_ARGS__ })) | ||||
| + | ||||
|  /* Can be used for: | ||||
|   * 0x60, 0x61, 0x62 */ | ||||
|  static const struct ieee80211_regdomain ath_world_regdom_60_61_62 = { | ||||
| -	.n_reg_rules = 5, | ||||
|  	.alpha2 =  "99", | ||||
| -	.reg_rules = { | ||||
| +	REGD_RULES( | ||||
|  		ATH_2GHZ_ALL, | ||||
|  		ATH_5GHZ_ALL, | ||||
| -	} | ||||
| +	) | ||||
|  }; | ||||
|   | ||||
|  /* Can be used by 0x63 and 0x65 */ | ||||
|  static const struct ieee80211_regdomain ath_world_regdom_63_65 = { | ||||
| -	.n_reg_rules = 4, | ||||
|  	.alpha2 =  "99", | ||||
| -	.reg_rules = { | ||||
| +	REGD_RULES( | ||||
|  		ATH_2GHZ_CH01_11, | ||||
|  		ATH_2GHZ_CH12_13, | ||||
|  		ATH_5GHZ_NO_MIDBAND, | ||||
| -	} | ||||
| +	) | ||||
|  }; | ||||
|   | ||||
|  /* Can be used by 0x64 only */ | ||||
|  static const struct ieee80211_regdomain ath_world_regdom_64 = { | ||||
| -	.n_reg_rules = 3, | ||||
|  	.alpha2 =  "99", | ||||
| -	.reg_rules = { | ||||
| +	REGD_RULES( | ||||
|  		ATH_2GHZ_CH01_11, | ||||
|  		ATH_5GHZ_NO_MIDBAND, | ||||
| -	} | ||||
| +	) | ||||
|  }; | ||||
|   | ||||
|  /* Can be used by 0x66 and 0x69 */ | ||||
|  static const struct ieee80211_regdomain ath_world_regdom_66_69 = { | ||||
| -	.n_reg_rules = 3, | ||||
|  	.alpha2 =  "99", | ||||
| -	.reg_rules = { | ||||
| +	REGD_RULES( | ||||
|  		ATH_2GHZ_CH01_11, | ||||
|  		ATH_5GHZ_ALL, | ||||
| -	} | ||||
| +	) | ||||
|  }; | ||||
|   | ||||
|  /* Can be used by 0x67, 0x68, 0x6A and 0x6C */ | ||||
|  static const struct ieee80211_regdomain ath_world_regdom_67_68_6A_6C = { | ||||
| -	.n_reg_rules = 4, | ||||
|  	.alpha2 =  "99", | ||||
| -	.reg_rules = { | ||||
| +	REGD_RULES( | ||||
|  		ATH_2GHZ_CH01_11, | ||||
|  		ATH_2GHZ_CH12_13, | ||||
|  		ATH_5GHZ_ALL, | ||||
| -	} | ||||
| +	) | ||||
|  }; | ||||
|   | ||||
|  static bool dynamic_country_user_possible(struct ath_regulatory *reg) | ||||
| @@ -0,0 +1,19 @@ | ||||
| --- a/net/wireless/reg.c | ||||
| +++ b/net/wireless/reg.c | ||||
| @@ -3042,6 +3042,8 @@ void regulatory_hint_country_ie(struct w | ||||
|  	enum environment_cap env = ENVIRON_ANY; | ||||
|  	struct regulatory_request *request = NULL, *lr; | ||||
|   | ||||
| +	return; | ||||
| + | ||||
|  	/* IE len must be evenly divisible by 2 */ | ||||
|  	if (country_ie_len & 0x01) | ||||
|  		return; | ||||
| @@ -3293,6 +3295,7 @@ static bool is_wiphy_all_set_reg_flag(en | ||||
|   | ||||
|  void regulatory_hint_disconnect(void) | ||||
|  { | ||||
| +	return; | ||||
|  	/* Restore of regulatory settings is not required when wiphy(s) | ||||
|  	 * ignore IE from connected access point but clearance of beacon hints | ||||
|  	 * is required when wiphy(s) supports beacon hints. | ||||
							
								
								
									
										26
									
								
								feeds/wifi-ath10k/mac80211/patches/ath/405-ath_regd_us.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								feeds/wifi-ath10k/mac80211/patches/ath/405-ath_regd_us.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| --- a/drivers/net/wireless/ath/regd_common.h | ||||
| +++ b/drivers/net/wireless/ath/regd_common.h | ||||
| @@ -32,6 +32,7 @@ enum EnumRd { | ||||
|  	FCC2_WORLD = 0x21, | ||||
|  	FCC2_ETSIC = 0x22, | ||||
|  	FCC6_WORLD = 0x23, | ||||
| +	FCC3_FCCA_2 = 0x2A, | ||||
|  	FRANCE_RES = 0x31, | ||||
|  	FCC3_FCCA = 0x3A, | ||||
|  	FCC3_WORLD = 0x3B, | ||||
| @@ -172,6 +173,7 @@ static struct reg_dmn_pair_mapping regDo | ||||
|  	{FCC2_WORLD, CTL_FCC, CTL_ETSI}, | ||||
|  	{FCC2_ETSIC, CTL_FCC, CTL_ETSI}, | ||||
|  	{FCC3_FCCA, CTL_FCC, CTL_FCC}, | ||||
| +	{FCC3_FCCA_2, CTL_FCC, CTL_FCC}, | ||||
|  	{FCC3_WORLD, CTL_FCC, CTL_ETSI}, | ||||
|  	{FCC3_ETSIC, CTL_FCC, CTL_ETSI}, | ||||
|  	{FCC4_FCCA, CTL_FCC, CTL_FCC}, | ||||
| @@ -483,6 +485,7 @@ static struct country_code_to_enum_rd al | ||||
|  	{CTRY_UAE, NULL1_WORLD, "AE"}, | ||||
|  	{CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"}, | ||||
|  	{CTRY_UNITED_STATES, FCC3_FCCA, "US"}, | ||||
| +	{CTRY_UNITED_STATES, FCC3_FCCA_2, "US"}, | ||||
|  	{CTRY_UNITED_STATES2, FCC3_FCCA, "US"}, | ||||
|  	{CTRY_UNITED_STATES3, FCC3_FCCA, "US"}, | ||||
|  	/* This "PS" is for US public safety actually... to support this we | ||||
| @@ -0,0 +1,51 @@ | ||||
| --- a/drivers/net/wireless/ath/regd.c | ||||
| +++ b/drivers/net/wireless/ath/regd.c | ||||
| @@ -115,6 +115,16 @@ static const struct ieee80211_regdomain | ||||
|  	) | ||||
|  }; | ||||
|   | ||||
| +static u16 ath_regd_get_eepromRD(struct ath_regulatory *reg) | ||||
| +{ | ||||
| +	return reg->current_rd & ~WORLDWIDE_ROAMING_FLAG; | ||||
| +} | ||||
| + | ||||
| +static bool is_default_regd(struct ath_regulatory *reg) | ||||
| +{ | ||||
| +	return ath_regd_get_eepromRD(reg) == CTRY_DEFAULT; | ||||
| +} | ||||
| + | ||||
|  static bool dynamic_country_user_possible(struct ath_regulatory *reg) | ||||
|  { | ||||
|  	if (IS_ENABLED(CPTCFG_ATH_USER_REGD)) | ||||
| @@ -123,6 +133,9 @@ static bool dynamic_country_user_possibl | ||||
|  	if (IS_ENABLED(CPTCFG_ATH_REG_DYNAMIC_USER_CERT_TESTING)) | ||||
|  		return true; | ||||
|   | ||||
| +	if (is_default_regd(reg)) | ||||
| +		return true; | ||||
| + | ||||
|  	switch (reg->country_code) { | ||||
|  	case CTRY_UNITED_STATES: | ||||
|  	case CTRY_JAPAN1: | ||||
| @@ -208,11 +221,6 @@ static inline bool is_wwr_sku(u16 regd) | ||||
|  		(regd == WORLD)); | ||||
|  } | ||||
|   | ||||
| -static u16 ath_regd_get_eepromRD(struct ath_regulatory *reg) | ||||
| -{ | ||||
| -	return reg->current_rd & ~WORLDWIDE_ROAMING_FLAG; | ||||
| -} | ||||
| - | ||||
|  bool ath_is_world_regd(struct ath_regulatory *reg) | ||||
|  { | ||||
|  	return is_wwr_sku(ath_regd_get_eepromRD(reg)); | ||||
| @@ -658,6 +666,9 @@ ath_regd_init_wiphy(struct ath_regulator | ||||
|  	if (IS_ENABLED(CPTCFG_ATH_USER_REGD)) | ||||
|  		return 0; | ||||
|   | ||||
| +	if (is_default_regd(reg)) | ||||
| +		return 0; | ||||
| + | ||||
|  	wiphy->regulatory_flags |= REGULATORY_STRICT_REG | | ||||
|  				   REGULATORY_CUSTOM_REG; | ||||
|   | ||||
| @@ -0,0 +1,10 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/init.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/init.c | ||||
| @@ -831,6 +831,7 @@ static const struct ieee80211_iface_limi | ||||
|  				 BIT(NL80211_IFTYPE_AP) }, | ||||
|  	{ .max = 1,	.types = BIT(NL80211_IFTYPE_P2P_CLIENT) | | ||||
|  				 BIT(NL80211_IFTYPE_P2P_GO) }, | ||||
| +	{ .max = 1,	.types = BIT(NL80211_IFTYPE_ADHOC) }, | ||||
|  }; | ||||
|   | ||||
|  #ifdef CPTCFG_WIRELESS_WDS | ||||
| @@ -0,0 +1,46 @@ | ||||
| --- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c | ||||
| +++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c | ||||
| @@ -86,13 +86,8 @@ ath5k_add_interface(struct ieee80211_hw | ||||
|  		goto end; | ||||
|  	} | ||||
|   | ||||
| -	/* Don't allow other interfaces if one ad-hoc is configured. | ||||
| -	 * TODO: Fix the problems with ad-hoc and multiple other interfaces. | ||||
| -	 * We would need to operate the HW in ad-hoc mode to allow TSF updates | ||||
| -	 * for the IBSS, but this breaks with additional AP or STA interfaces | ||||
| -	 * at the moment. */ | ||||
| -	if (ah->num_adhoc_vifs || | ||||
| -	    (ah->nvifs && vif->type == NL80211_IFTYPE_ADHOC)) { | ||||
| +	/* Don't allow more than one ad-hoc interface */ | ||||
| +	if (ah->num_adhoc_vifs && vif->type == NL80211_IFTYPE_ADHOC) { | ||||
|  		ATH5K_ERR(ah, "Only one single ad-hoc interface is allowed.\n"); | ||||
|  		ret = -ELNRNG; | ||||
|  		goto end; | ||||
| --- a/drivers/net/wireless/ath/ath5k/base.c | ||||
| +++ b/drivers/net/wireless/ath/ath5k/base.c | ||||
| @@ -1964,7 +1964,7 @@ ath5k_beacon_send(struct ath5k_hw *ah) | ||||
|  	} | ||||
|   | ||||
|  	if ((ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs + | ||||
| -			ah->num_mesh_vifs > 1) || | ||||
| +			ah->num_adhoc_vifs + ah->num_mesh_vifs > 1) || | ||||
|  			ah->opmode == NL80211_IFTYPE_MESH_POINT) { | ||||
|  		u64 tsf = ath5k_hw_get_tsf64(ah); | ||||
|  		u32 tsftu = TSF_TO_TU(tsf); | ||||
| @@ -2050,7 +2050,7 @@ ath5k_beacon_update_timers(struct ath5k_ | ||||
|   | ||||
|  	intval = ah->bintval & AR5K_BEACON_PERIOD; | ||||
|  	if (ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs | ||||
| -		+ ah->num_mesh_vifs > 1) { | ||||
| +		+ ah->num_adhoc_vifs + ah->num_mesh_vifs > 1) { | ||||
|  		intval /= ATH_BCBUF;	/* staggered multi-bss beacons */ | ||||
|  		if (intval < 15) | ||||
|  			ATH5K_WARN(ah, "intval %u is too low, min 15\n", | ||||
| @@ -2516,6 +2516,7 @@ static const struct ieee80211_iface_limi | ||||
|  				 BIT(NL80211_IFTYPE_MESH_POINT) | | ||||
|  #endif | ||||
|  				 BIT(NL80211_IFTYPE_AP) }, | ||||
| +	{ .max = 1,	.types = BIT(NL80211_IFTYPE_ADHOC) }, | ||||
|  }; | ||||
|   | ||||
|  static const struct ieee80211_iface_combination if_comb = { | ||||
| @@ -0,0 +1,18 @@ | ||||
| --- a/drivers/net/wireless/ath/ath5k/reset.c | ||||
| +++ b/drivers/net/wireless/ath/ath5k/reset.c | ||||
| @@ -1154,6 +1154,7 @@ ath5k_hw_reset(struct ath5k_hw *ah, enum | ||||
|  	tsf_lo = 0; | ||||
|  	mode = 0; | ||||
|   | ||||
| +#if 0 | ||||
|  	/* | ||||
|  	 * Sanity check for fast flag | ||||
|  	 * Fast channel change only available | ||||
| @@ -1161,6 +1162,7 @@ ath5k_hw_reset(struct ath5k_hw *ah, enum | ||||
|  	 */ | ||||
|  	if (fast && (ah->ah_radio != AR5K_RF2413) && | ||||
|  	(ah->ah_radio != AR5K_RF5413)) | ||||
| +#endif | ||||
|  		fast = false; | ||||
|   | ||||
|  	/* Disable sleep clock operation | ||||
| @@ -0,0 +1,33 @@ | ||||
| --- /dev/null | ||||
| +++ b/include/linux/ath5k_platform.h | ||||
| @@ -0,0 +1,30 @@ | ||||
| +/* | ||||
| + * Copyright (c) 2008 Atheros Communications Inc. | ||||
| + * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org> | ||||
| + * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org> | ||||
| + * Copyright (c) 2010 Daniel Golle <daniel.golle@gmail.com> | ||||
| + * | ||||
| + * 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 _LINUX_ATH5K_PLATFORM_H | ||||
| +#define _LINUX_ATH5K_PLATFORM_H | ||||
| + | ||||
| +#define ATH5K_PLAT_EEP_MAX_WORDS	2048 | ||||
| + | ||||
| +struct ath5k_platform_data { | ||||
| +	u16 *eeprom_data; | ||||
| +	u8 *macaddr; | ||||
| +}; | ||||
| + | ||||
| +#endif /* _LINUX_ATH5K_PLATFORM_H */ | ||||
| @@ -0,0 +1,56 @@ | ||||
| --- a/drivers/net/wireless/ath/ath5k/pci.c | ||||
| +++ b/drivers/net/wireless/ath/ath5k/pci.c | ||||
| @@ -20,6 +20,7 @@ | ||||
|  #include <linux/pci.h> | ||||
|  #include <linux/etherdevice.h> | ||||
|  #include <linux/module.h> | ||||
| +#include <linux/ath5k_platform.h> | ||||
|  #include "../ath.h" | ||||
|  #include "ath5k.h" | ||||
|  #include "debug.h" | ||||
| @@ -71,7 +72,7 @@ static void ath5k_pci_read_cachesize(str | ||||
|  } | ||||
|   | ||||
|  /* | ||||
| - * Read from eeprom | ||||
| + * Read from eeprom or platform_data | ||||
|   */ | ||||
|  static bool | ||||
|  ath5k_pci_eeprom_read(struct ath_common *common, u32 offset, u16 *data) | ||||
| @@ -79,6 +80,19 @@ ath5k_pci_eeprom_read(struct ath_common | ||||
|  	struct ath5k_hw *ah = (struct ath5k_hw *) common->ah; | ||||
|  	u32 status, timeout; | ||||
|   | ||||
| +	struct ath5k_platform_data *pdata = NULL; | ||||
| + | ||||
| +	if (ah->pdev) | ||||
| +		pdata = ah->pdev->dev.platform_data; | ||||
| + | ||||
| +	if (pdata && pdata->eeprom_data && pdata->eeprom_data[61] == AR5K_EEPROM_MAGIC_VALUE) { | ||||
| +		if (offset >= ATH5K_PLAT_EEP_MAX_WORDS) | ||||
| +			return false; | ||||
| + | ||||
| +		*data = pdata->eeprom_data[offset]; | ||||
| +		return true; | ||||
| +	} | ||||
| + | ||||
|  	/* | ||||
|  	 * Initialize EEPROM access | ||||
|  	 */ | ||||
| @@ -122,6 +136,16 @@ static int ath5k_pci_eeprom_read_mac(str | ||||
|  	u16 data; | ||||
|  	int octet; | ||||
|   | ||||
| +	struct ath5k_platform_data *pdata = NULL; | ||||
| + | ||||
| +	if (ah->pdev) | ||||
| +		pdata = ah->pdev->dev.platform_data; | ||||
| + | ||||
| +	if (pdata && pdata->macaddr) { | ||||
| +		memcpy(mac, pdata->macaddr, ETH_ALEN); | ||||
| +		return 0; | ||||
| +	} | ||||
| + | ||||
|  	AR5K_EEPROM_READ(0x20, data); | ||||
|   | ||||
|  	for (offset = 0x1f, octet = 0, total = 0; offset >= 0x1d; offset--) { | ||||
| @@ -0,0 +1,11 @@ | ||||
| --- a/drivers/net/wireless/ath/ath5k/pci.c | ||||
| +++ b/drivers/net/wireless/ath/ath5k/pci.c | ||||
| @@ -47,6 +47,8 @@ static const struct pci_device_id ath5k_ | ||||
|  	{ PCI_VDEVICE(ATHEROS, 0x001b) }, /* 5413 Eagle */ | ||||
|  	{ PCI_VDEVICE(ATHEROS, 0x001c) }, /* PCI-E cards */ | ||||
|  	{ PCI_VDEVICE(ATHEROS, 0x001d) }, /* 2417 Nala */ | ||||
| +	{ PCI_VDEVICE(ATHEROS, 0xff16) }, /* 2413,2414 sx76x on lantiq_danube */ | ||||
| +	{ PCI_VDEVICE(ATHEROS, 0xff1a) }, /* 2417 arv45xx on lantiq_danube */ | ||||
|  	{ PCI_VDEVICE(ATHEROS, 0xff1b) }, /* AR5BXB63 */ | ||||
|  	{ 0 } | ||||
|  }; | ||||
| @@ -0,0 +1,142 @@ | ||||
| This adds a bwmode debugfs file which can be used to set alternate | ||||
| channel operating bandwidths.  Only tested with AR5413 and only at | ||||
| 5 and 20 mhz channels. | ||||
|  | ||||
| Signed-off-by: Pat Erley <pat-lkml at erley.org> | ||||
| --- | ||||
| Other devices will need to be added to the switch in  write_file_bwmode | ||||
|  | ||||
| drivers/net/wireless/ath/ath5k/debug.c |   86 ++++++++++++++++++++++++++++++++ | ||||
|  1 files changed, 86 insertions(+), 0 deletions(-) | ||||
|  | ||||
| --- a/drivers/net/wireless/ath/ath5k/debug.c | ||||
| +++ b/drivers/net/wireless/ath/ath5k/debug.c | ||||
| @@ -822,6 +822,97 @@ static const struct file_operations fops | ||||
|  	.llseek = default_llseek, | ||||
|  }; | ||||
|   | ||||
| +/* debugfs: bwmode */ | ||||
| + | ||||
| +static ssize_t read_file_bwmode(struct file *file, char __user *user_buf, | ||||
| +				   size_t count, loff_t *ppos) | ||||
| +{ | ||||
| +	struct ath5k_hw *ah = file->private_data; | ||||
| +	char buf[15]; | ||||
| +	unsigned int len = 0; | ||||
| + | ||||
| +	int cur_ah_bwmode = ah->ah_bwmode_debug; | ||||
| + | ||||
| +#define print_selected(MODE, LABEL) \ | ||||
| +	if (cur_ah_bwmode == MODE) \ | ||||
| +		len += snprintf(buf+len, sizeof(buf)-len, "[%s]", LABEL); \ | ||||
| +	else \ | ||||
| +		len += snprintf(buf+len, sizeof(buf)-len, "%s", LABEL); \ | ||||
| +	len += snprintf(buf+len, sizeof(buf)-len, " "); | ||||
| + | ||||
| +	print_selected(AR5K_BWMODE_5MHZ, "5"); | ||||
| +	print_selected(AR5K_BWMODE_10MHZ, "10"); | ||||
| +	print_selected(AR5K_BWMODE_DEFAULT, "20"); | ||||
| +	print_selected(AR5K_BWMODE_40MHZ, "40"); | ||||
| +#undef print_selected | ||||
| + | ||||
| +	len += snprintf(buf+len, sizeof(buf)-len, "\n"); | ||||
| + | ||||
| +	return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||||
| +} | ||||
| + | ||||
| +static ssize_t write_file_bwmode(struct file *file, | ||||
| +				 const char __user *userbuf, | ||||
| +				 size_t count, loff_t *ppos) | ||||
| +{ | ||||
| +	struct ath5k_hw *ah = file->private_data; | ||||
| +	char buf[3]; | ||||
| +	int bw = 20; | ||||
| +	int tobwmode = AR5K_BWMODE_DEFAULT; | ||||
| + | ||||
| +	if (copy_from_user(buf, userbuf, min(count, sizeof(buf)))) | ||||
| +		return -EFAULT; | ||||
| + | ||||
| +	/* TODO: Add check for active interface */ | ||||
| + | ||||
| +	if(strncmp(buf, "5", 1) == 0 ) { | ||||
| +		tobwmode = AR5K_BWMODE_5MHZ; | ||||
| +		bw = 5; | ||||
| +	} else if ( strncmp(buf, "10", 2) == 0 ) { | ||||
| +		tobwmode = AR5K_BWMODE_10MHZ; | ||||
| +		bw = 10; | ||||
| +	} else if ( strncmp(buf, "20", 2) == 0 ) { | ||||
| +		tobwmode = AR5K_BWMODE_DEFAULT; | ||||
| +		bw = 20; | ||||
| +	} else if ( strncmp(buf, "40", 2) == 0 ) { | ||||
| +		tobwmode = AR5K_BWMODE_40MHZ; | ||||
| +		bw = 40; | ||||
| +	} else | ||||
| +		return -EINVAL; | ||||
| + | ||||
| +	ATH5K_INFO(ah, "Changing to %imhz channel width[%i]\n", | ||||
| +		bw, tobwmode); | ||||
| + | ||||
| +	switch (ah->ah_radio) { | ||||
| +	/* TODO: only define radios that actually support 5/10mhz channels */ | ||||
| +	case AR5K_RF5413: | ||||
| +	case AR5K_RF5110: | ||||
| +	case AR5K_RF5111: | ||||
| +	case AR5K_RF5112: | ||||
| +	case AR5K_RF2413: | ||||
| +	case AR5K_RF2316: | ||||
| +	case AR5K_RF2317: | ||||
| +	case AR5K_RF2425: | ||||
| +		if(ah->ah_bwmode_debug != tobwmode) { | ||||
| +			mutex_lock(&ah->lock); | ||||
| +			ah->ah_bwmode = tobwmode; | ||||
| +			ah->ah_bwmode_debug = tobwmode; | ||||
| +			mutex_unlock(&ah->lock); | ||||
| +		} | ||||
| +		break; | ||||
| +	default: | ||||
| +		return -EOPNOTSUPP; | ||||
| +	} | ||||
| +	return count; | ||||
| +} | ||||
| + | ||||
| +static const struct file_operations fops_bwmode = { | ||||
| +	.read = read_file_bwmode, | ||||
| +	.write = write_file_bwmode, | ||||
| +	.open = simple_open, | ||||
| +	.owner = THIS_MODULE, | ||||
| +	.llseek = default_llseek, | ||||
| +}; | ||||
|   | ||||
|  /* debugfs: queues etc */ | ||||
|   | ||||
| @@ -1016,6 +1107,8 @@ ath5k_debug_init_device(struct ath5k_hw | ||||
|  	debugfs_create_file("queue", 0600, phydir, ah, &fops_queue); | ||||
|  	debugfs_create_bool("32khz_clock", 0600, phydir, | ||||
|  			    &ah->ah_use_32khz_clock); | ||||
| +	debugfs_create_file("bwmode", S_IWUSR | S_IRUSR, phydir, ah, | ||||
| +			    &fops_bwmode); | ||||
|  } | ||||
|   | ||||
|  /* functions used in other places */ | ||||
| --- a/drivers/net/wireless/ath/ath5k/ath5k.h | ||||
| +++ b/drivers/net/wireless/ath/ath5k/ath5k.h | ||||
| @@ -1372,6 +1372,7 @@ struct ath5k_hw { | ||||
|  	u8			ah_coverage_class; | ||||
|  	bool			ah_ack_bitrate_high; | ||||
|  	u8			ah_bwmode; | ||||
| +	u8			ah_bwmode_debug; | ||||
|  	bool			ah_short_slot; | ||||
|   | ||||
|  	/* Antenna Control */ | ||||
| --- a/drivers/net/wireless/ath/ath5k/base.c | ||||
| +++ b/drivers/net/wireless/ath/ath5k/base.c | ||||
| @@ -466,6 +466,9 @@ ath5k_chan_set(struct ath5k_hw *ah, stru | ||||
|  		return -EINVAL; | ||||
|  	} | ||||
|   | ||||
| +	if (ah->ah_bwmode_debug != AR5K_BWMODE_DEFAULT) | ||||
| +		ah->ah_bwmode = ah->ah_bwmode_debug; | ||||
| + | ||||
|  	/* | ||||
|  	 * To switch channels clear any pending DMA operations; | ||||
|  	 * wait long enough for the RX fifo to drain, reset the | ||||
| @@ -0,0 +1,34 @@ | ||||
| From d946085ff5a331de64e91a2e3c96b9ca79d740f5 Mon Sep 17 00:00:00 2001 | ||||
| From: David Bauer <mail@david-bauer.net> | ||||
| Date: Mon, 15 Jun 2020 00:10:34 +0200 | ||||
| Subject: [PATCH] ath9k: enabled MFP capability unconditionally | ||||
|  | ||||
| ath9k will already fallback on software-crypto for chipsets not | ||||
| supporting IEEE802.11w (MFP). So advertising MFP is not dependent | ||||
| on disabling HW crypto for all traffic entirely. | ||||
|  | ||||
| Signed-off-by: David Bauer <mail@david-bauer.net> | ||||
| --- | ||||
|  drivers/net/wireless/ath/ath9k/init.c | 4 +--- | ||||
|  1 file changed, 1 insertion(+), 3 deletions(-) | ||||
|  | ||||
| --- a/drivers/net/wireless/ath/ath9k/init.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/init.c | ||||
| @@ -928,6 +928,7 @@ static void ath9k_set_hw_capab(struct at | ||||
|  	ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING); | ||||
|  	ieee80211_hw_set(hw, SUPPORT_FAST_XMIT); | ||||
|  	ieee80211_hw_set(hw, SUPPORTS_CLONED_SKBS); | ||||
| +	ieee80211_hw_set(hw, MFP_CAPABLE); | ||||
|   | ||||
|  	if (ath9k_ps_enable) | ||||
|  		ieee80211_hw_set(hw, SUPPORTS_PS); | ||||
| @@ -940,9 +941,6 @@ static void ath9k_set_hw_capab(struct at | ||||
|  				IEEE80211_RADIOTAP_MCS_HAVE_STBC; | ||||
|  	} | ||||
|   | ||||
| -	if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || ath9k_modparam_nohwcrypt) | ||||
| -		ieee80211_hw_set(hw, MFP_CAPABLE); | ||||
| - | ||||
|  	hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR | | ||||
|  			       NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE | | ||||
|  			       NL80211_FEATURE_P2P_GO_CTWIN; | ||||
| @@ -0,0 +1,65 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/debug.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/debug.c | ||||
| @@ -1361,6 +1361,53 @@ void ath9k_deinit_debug(struct ath_softc | ||||
|  	ath9k_cmn_spectral_deinit_debug(&sc->spec_priv); | ||||
|  } | ||||
|   | ||||
| +static ssize_t read_file_eeprom(struct file *file, char __user *user_buf, | ||||
| +			     size_t count, loff_t *ppos) | ||||
| +{ | ||||
| +	struct ath_softc *sc = file->private_data; | ||||
| +	struct ath_hw *ah = sc->sc_ah; | ||||
| +	struct ath_common *common = ath9k_hw_common(ah); | ||||
| +	int bytes = 0; | ||||
| +	int pos = *ppos; | ||||
| +	int size = 4096; | ||||
| +	u16 val; | ||||
| +	int i; | ||||
| + | ||||
| +	if (AR_SREV_9300_20_OR_LATER(ah)) | ||||
| +		size = 16384; | ||||
| + | ||||
| +	if (*ppos < 0) | ||||
| +		return -EINVAL; | ||||
| + | ||||
| +	if (count > size - *ppos) | ||||
| +		count = size - *ppos; | ||||
| + | ||||
| +	for (i = *ppos / 2; count > 0; count -= bytes, *ppos += bytes, i++) { | ||||
| +		void *from = &val; | ||||
| + | ||||
| +		if (!common->bus_ops->eeprom_read(common, i, &val)) | ||||
| +			val = 0xffff; | ||||
| + | ||||
| +		if (*ppos % 2) { | ||||
| +			from++; | ||||
| +			bytes = 1; | ||||
| +		} else if (count == 1) { | ||||
| +			bytes = 1; | ||||
| +		} else { | ||||
| +			bytes = 2; | ||||
| +		} | ||||
| +		copy_to_user(user_buf, from, bytes); | ||||
| +		user_buf += bytes; | ||||
| +	} | ||||
| +	return *ppos - pos; | ||||
| +} | ||||
| + | ||||
| +static const struct file_operations fops_eeprom = { | ||||
| +	.read = read_file_eeprom, | ||||
| +	.open = simple_open, | ||||
| +	.owner = THIS_MODULE | ||||
| +}; | ||||
| + | ||||
|  int ath9k_init_debug(struct ath_hw *ah) | ||||
|  { | ||||
|  	struct ath_common *common = ath9k_hw_common(ah); | ||||
| @@ -1380,6 +1427,8 @@ int ath9k_init_debug(struct ath_hw *ah) | ||||
|  	ath9k_tx99_init_debug(sc); | ||||
|  	ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy); | ||||
|   | ||||
| +	debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, | ||||
| +			    &fops_eeprom); | ||||
|  	debugfs_create_devm_seqfile(sc->dev, "dma", sc->debug.debugfs_phy, | ||||
|  				    read_file_dma); | ||||
|  	debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy, | ||||
| @@ -0,0 +1,34 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/init.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/init.c | ||||
| @@ -1143,25 +1143,25 @@ static int __init ath9k_init(void) | ||||
|  { | ||||
|  	int error; | ||||
|   | ||||
| -	error = ath_pci_init(); | ||||
| +	error = ath_ahb_init(); | ||||
|  	if (error < 0) { | ||||
| -		pr_err("No PCI devices found, driver not installed\n"); | ||||
|  		error = -ENODEV; | ||||
|  		goto err_out; | ||||
|  	} | ||||
|   | ||||
| -	error = ath_ahb_init(); | ||||
| +	error = ath_pci_init(); | ||||
|  	if (error < 0) { | ||||
| +		pr_err("No PCI devices found, driver not installed\n"); | ||||
|  		error = -ENODEV; | ||||
| -		goto err_pci_exit; | ||||
| +		goto err_ahb_exit; | ||||
|  	} | ||||
|   | ||||
|  	dmi_check_system(ath9k_quirks); | ||||
|   | ||||
|  	return 0; | ||||
|   | ||||
| - err_pci_exit: | ||||
| -	ath_pci_exit(); | ||||
| + err_ahb_exit: | ||||
| +	ath_ahb_exit(); | ||||
|   err_out: | ||||
|  	return error; | ||||
|  } | ||||
| @@ -0,0 +1,18 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/hw.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/hw.c | ||||
| @@ -403,13 +403,8 @@ static void ath9k_hw_init_config(struct | ||||
|   | ||||
|  	ah->config.rx_intr_mitigation = true; | ||||
|   | ||||
| -	if (AR_SREV_9300_20_OR_LATER(ah)) { | ||||
| -		ah->config.rimt_last = 500; | ||||
| -		ah->config.rimt_first = 2000; | ||||
| -	} else { | ||||
| -		ah->config.rimt_last = 250; | ||||
| -		ah->config.rimt_first = 700; | ||||
| -	} | ||||
| +	ah->config.rimt_last = 250; | ||||
| +	ah->config.rimt_first = 500; | ||||
|   | ||||
|  	if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) | ||||
|  		ah->config.pll_pwrsave = 7; | ||||
| @@ -0,0 +1,11 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/ath9k.h | ||||
| +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | ||||
| @@ -88,7 +88,7 @@ int ath_descdma_setup(struct ath_softc * | ||||
|  		(_l) &= ((_sz) - 1);		\ | ||||
|  	} while (0) | ||||
|   | ||||
| -#define ATH_RXBUF               512 | ||||
| +#define ATH_RXBUF               256 | ||||
|  #define ATH_TXBUF               512 | ||||
|  #define ATH_TXBUF_RESERVE       5 | ||||
|  #define ATH_TXMAXTRY            13 | ||||
| @@ -0,0 +1,125 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/debug.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/debug.c | ||||
| @@ -1408,6 +1408,52 @@ static const struct file_operations fops | ||||
|  	.owner = THIS_MODULE | ||||
|  }; | ||||
|   | ||||
| + | ||||
| +static ssize_t read_file_chan_bw(struct file *file, char __user *user_buf, | ||||
| +			     size_t count, loff_t *ppos) | ||||
| +{ | ||||
| +	struct ath_softc *sc = file->private_data; | ||||
| +	struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||||
| +	char buf[32]; | ||||
| +	unsigned int len; | ||||
| + | ||||
| +	len = sprintf(buf, "0x%08x\n", common->chan_bw); | ||||
| +	return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||||
| +} | ||||
| + | ||||
| +static ssize_t write_file_chan_bw(struct file *file, const char __user *user_buf, | ||||
| +			     size_t count, loff_t *ppos) | ||||
| +{ | ||||
| +	struct ath_softc *sc = file->private_data; | ||||
| +	struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||||
| +	unsigned long chan_bw; | ||||
| +	char buf[32]; | ||||
| +	ssize_t len; | ||||
| + | ||||
| +	len = min(count, sizeof(buf) - 1); | ||||
| +	if (copy_from_user(buf, user_buf, len)) | ||||
| +		return -EFAULT; | ||||
| + | ||||
| +	buf[len] = '\0'; | ||||
| +	if (kstrtoul(buf, 0, &chan_bw)) | ||||
| +		return -EINVAL; | ||||
| + | ||||
| +	common->chan_bw = chan_bw; | ||||
| +	if (!test_bit(ATH_OP_INVALID, &common->op_flags)) | ||||
| +		ath9k_ops.config(sc->hw, IEEE80211_CONF_CHANGE_CHANNEL); | ||||
| + | ||||
| +	return count; | ||||
| +} | ||||
| + | ||||
| +static const struct file_operations fops_chanbw = { | ||||
| +	.read = read_file_chan_bw, | ||||
| +	.write = write_file_chan_bw, | ||||
| +	.open = simple_open, | ||||
| +	.owner = THIS_MODULE, | ||||
| +	.llseek = default_llseek, | ||||
| +}; | ||||
| + | ||||
| + | ||||
|  int ath9k_init_debug(struct ath_hw *ah) | ||||
|  { | ||||
|  	struct ath_common *common = ath9k_hw_common(ah); | ||||
| @@ -1429,6 +1475,8 @@ int ath9k_init_debug(struct ath_hw *ah) | ||||
|   | ||||
|  	debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, | ||||
|  			    &fops_eeprom); | ||||
| +	debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | ||||
| +			    sc, &fops_chanbw); | ||||
|  	debugfs_create_devm_seqfile(sc->dev, "dma", sc->debug.debugfs_phy, | ||||
|  				    read_file_dma); | ||||
|  	debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy, | ||||
| --- a/drivers/net/wireless/ath/ath.h | ||||
| +++ b/drivers/net/wireless/ath/ath.h | ||||
| @@ -149,6 +149,7 @@ struct ath_common { | ||||
|  	int debug_mask; | ||||
|  	enum ath_device_state state; | ||||
|  	unsigned long op_flags; | ||||
| +	u32 chan_bw; | ||||
|   | ||||
|  	struct ath_ani ani; | ||||
|   | ||||
| --- a/drivers/net/wireless/ath/ath9k/common.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/common.c | ||||
| @@ -297,11 +297,13 @@ EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_ke | ||||
|  /* | ||||
|   * Update internal channel flags. | ||||
|   */ | ||||
| -static void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, | ||||
| +static void ath9k_cmn_update_ichannel(struct ath_common *common, | ||||
| +				      struct ath9k_channel *ichan, | ||||
|  				      struct cfg80211_chan_def *chandef) | ||||
|  { | ||||
|  	struct ieee80211_channel *chan = chandef->chan; | ||||
|  	u16 flags = 0; | ||||
| +	int width; | ||||
|   | ||||
|  	ichan->channel = chan->center_freq; | ||||
|  	ichan->chan = chan; | ||||
| @@ -309,7 +311,19 @@ static void ath9k_cmn_update_ichannel(st | ||||
|  	if (chan->band == NL80211_BAND_5GHZ) | ||||
|  		flags |= CHANNEL_5GHZ; | ||||
|   | ||||
| -	switch (chandef->width) { | ||||
| +	switch (common->chan_bw) { | ||||
| +	case 5: | ||||
| +		width = NL80211_CHAN_WIDTH_5; | ||||
| +		break; | ||||
| +	case 10: | ||||
| +		width = NL80211_CHAN_WIDTH_10; | ||||
| +		break; | ||||
| +	default: | ||||
| +		width = chandef->width; | ||||
| +		break; | ||||
| +	} | ||||
| + | ||||
| +	switch (width) { | ||||
|  	case NL80211_CHAN_WIDTH_5: | ||||
|  		flags |= CHANNEL_QUARTER; | ||||
|  		break; | ||||
| @@ -342,10 +356,11 @@ struct ath9k_channel *ath9k_cmn_get_chan | ||||
|  					    struct cfg80211_chan_def *chandef) | ||||
|  { | ||||
|  	struct ieee80211_channel *curchan = chandef->chan; | ||||
| +	struct ath_common *common = ath9k_hw_common(ah); | ||||
|  	struct ath9k_channel *channel; | ||||
|   | ||||
|  	channel = &ah->channels[curchan->hw_value]; | ||||
| -	ath9k_cmn_update_ichannel(channel, chandef); | ||||
| +	ath9k_cmn_update_ichannel(common, channel, chandef); | ||||
|   | ||||
|  	return channel; | ||||
|  } | ||||
| @@ -0,0 +1,30 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/hw.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/hw.c | ||||
| @@ -663,6 +663,7 @@ int ath9k_hw_init(struct ath_hw *ah) | ||||
|   | ||||
|  	/* These are all the AR5008/AR9001/AR9002/AR9003 hardware family of chipsets */ | ||||
|  	switch (ah->hw_version.devid) { | ||||
| +	case AR9300_DEVID_INVALID: | ||||
|  	case AR5416_DEVID_PCI: | ||||
|  	case AR5416_DEVID_PCIE: | ||||
|  	case AR5416_AR9100_DEVID: | ||||
| --- a/drivers/net/wireless/ath/ath9k/hw.h | ||||
| +++ b/drivers/net/wireless/ath/ath9k/hw.h | ||||
| @@ -36,6 +36,7 @@ | ||||
|   | ||||
|  #define ATHEROS_VENDOR_ID	0x168c | ||||
|   | ||||
| +#define AR9300_DEVID_INVALID	0xabcd | ||||
|  #define AR5416_DEVID_PCI	0x0023 | ||||
|  #define AR5416_DEVID_PCIE	0x0024 | ||||
|  #define AR9160_DEVID_PCI	0x0027 | ||||
| --- a/drivers/net/wireless/ath/ath9k/pci.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/pci.c | ||||
| @@ -774,6 +774,7 @@ static const struct pci_device_id ath_pc | ||||
|  	  .driver_data = ATH9K_PCI_BT_ANT_DIV }, | ||||
|  #endif | ||||
|   | ||||
| +	{ PCI_VDEVICE(ATHEROS, 0xabcd) }, /* PCI-E  internal chip default ID */ | ||||
|  	{ 0 } | ||||
|  }; | ||||
|   | ||||
| @@ -0,0 +1,267 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/ath9k.h | ||||
| +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | ||||
| @@ -843,6 +843,9 @@ static inline int ath9k_dump_btcoex(stru | ||||
|  #ifdef CPTCFG_MAC80211_LEDS | ||||
|  void ath_init_leds(struct ath_softc *sc); | ||||
|  void ath_deinit_leds(struct ath_softc *sc); | ||||
| +int ath_create_gpio_led(struct ath_softc *sc, int gpio, const char *name, | ||||
| +			const char *trigger, bool active_low); | ||||
| + | ||||
|  #else | ||||
|  static inline void ath_init_leds(struct ath_softc *sc) | ||||
|  { | ||||
| @@ -979,6 +982,13 @@ void ath_ant_comb_scan(struct ath_softc | ||||
|   | ||||
|  #define ATH9K_NUM_CHANCTX  2 /* supports 2 operating channels */ | ||||
|   | ||||
| +struct ath_led { | ||||
| +	struct list_head list; | ||||
| +	struct ath_softc *sc; | ||||
| +	const struct gpio_led *gpio; | ||||
| +	struct led_classdev cdev; | ||||
| +}; | ||||
| + | ||||
|  struct ath_softc { | ||||
|  	struct ieee80211_hw *hw; | ||||
|  	struct device *dev; | ||||
| @@ -1032,9 +1042,8 @@ struct ath_softc { | ||||
|  	spinlock_t chan_lock; | ||||
|   | ||||
|  #ifdef CPTCFG_MAC80211_LEDS | ||||
| -	bool led_registered; | ||||
| -	char led_name[32]; | ||||
| -	struct led_classdev led_cdev; | ||||
| +	const char *led_default_trigger; | ||||
| +	struct list_head leds; | ||||
|  #endif | ||||
|   | ||||
|  #ifdef CPTCFG_ATH9K_DEBUGFS | ||||
| --- a/drivers/net/wireless/ath/ath9k/gpio.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/gpio.c | ||||
| @@ -39,61 +39,111 @@ static void ath_fill_led_pin(struct ath_ | ||||
|  		else | ||||
|  			ah->led_pin = ATH_LED_PIN_DEF; | ||||
|  	} | ||||
| +} | ||||
| + | ||||
| +static void ath_led_brightness(struct led_classdev *led_cdev, | ||||
| +			       enum led_brightness brightness) | ||||
| +{ | ||||
| +	struct ath_led *led = container_of(led_cdev, struct ath_led, cdev); | ||||
| +	struct ath_softc *sc = led->sc; | ||||
| + | ||||
| +	ath9k_ps_wakeup(sc); | ||||
| +	ath9k_hw_set_gpio(sc->sc_ah, led->gpio->gpio, | ||||
| +			  (brightness != LED_OFF) ^ led->gpio->active_low); | ||||
| +	ath9k_ps_restore(sc); | ||||
| +} | ||||
| + | ||||
| +static int ath_add_led(struct ath_softc *sc, struct ath_led *led) | ||||
| +{ | ||||
| +	const struct gpio_led *gpio = led->gpio; | ||||
| +	int ret; | ||||
| + | ||||
| +	led->cdev.name = gpio->name; | ||||
| +	led->cdev.default_trigger = gpio->default_trigger; | ||||
| +	led->cdev.brightness_set = ath_led_brightness; | ||||
| + | ||||
| +	ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &led->cdev); | ||||
| +	if (ret < 0) | ||||
| +		return ret; | ||||
| + | ||||
| +	led->sc = sc; | ||||
| +	list_add(&led->list, &sc->leds); | ||||
|   | ||||
|  	/* Configure gpio for output */ | ||||
| -	ath9k_hw_gpio_request_out(ah, ah->led_pin, "ath9k-led", | ||||
| +	ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name, | ||||
|  				  AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | ||||
|   | ||||
| -	/* LED off, active low */ | ||||
| -	ath9k_hw_set_gpio(ah, ah->led_pin, ah->config.led_active_high ? 0 : 1); | ||||
| +	/* LED off */ | ||||
| +	ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); | ||||
| + | ||||
| +	return 0; | ||||
|  } | ||||
|   | ||||
| -static void ath_led_brightness(struct led_classdev *led_cdev, | ||||
| -			       enum led_brightness brightness) | ||||
| +int ath_create_gpio_led(struct ath_softc *sc, int gpio_num, const char *name, | ||||
| +			const char *trigger, bool active_low) | ||||
|  { | ||||
| -	struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev); | ||||
| -	u32 val = (brightness == LED_OFF); | ||||
| +	struct ath_led *led; | ||||
| +	struct gpio_led *gpio; | ||||
| +	char *_name; | ||||
| +	int ret; | ||||
|   | ||||
| -	if (sc->sc_ah->config.led_active_high) | ||||
| -		val = !val; | ||||
| +	led = kzalloc(sizeof(*led) + sizeof(*gpio) + strlen(name) + 1, | ||||
| +		      GFP_KERNEL); | ||||
| +	if (!led) | ||||
| +		return -ENOMEM; | ||||
| + | ||||
| +	led->gpio = gpio = (struct gpio_led *) (led + 1); | ||||
| +	_name = (char *) (led->gpio + 1); | ||||
| + | ||||
| +	strcpy(_name, name); | ||||
| +	gpio->name = _name; | ||||
| +	gpio->gpio = gpio_num; | ||||
| +	gpio->active_low = active_low; | ||||
| +	gpio->default_trigger = trigger; | ||||
| + | ||||
| +	ret = ath_add_led(sc, led); | ||||
| +	if (unlikely(ret < 0)) | ||||
| +		kfree(led); | ||||
|   | ||||
| -	ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val); | ||||
| +	return ret; | ||||
|  } | ||||
|   | ||||
|  void ath_deinit_leds(struct ath_softc *sc) | ||||
|  { | ||||
| -	if (!sc->led_registered) | ||||
| -		return; | ||||
| +	struct ath_led *led; | ||||
|   | ||||
| -	ath_led_brightness(&sc->led_cdev, LED_OFF); | ||||
| -	led_classdev_unregister(&sc->led_cdev); | ||||
| - | ||||
| -	ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin); | ||||
| +	while (!list_empty(&sc->leds)) { | ||||
| +		led = list_first_entry(&sc->leds, struct ath_led, list); | ||||
| +		list_del(&led->list); | ||||
| +		ath_led_brightness(&led->cdev, LED_OFF); | ||||
| +		led_classdev_unregister(&led->cdev); | ||||
| +		ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio); | ||||
| +		kfree(led); | ||||
| +	} | ||||
|  } | ||||
|   | ||||
|  void ath_init_leds(struct ath_softc *sc) | ||||
|  { | ||||
| -	int ret; | ||||
| +	char led_name[32]; | ||||
| +	const char *trigger; | ||||
| + | ||||
| +	INIT_LIST_HEAD(&sc->leds); | ||||
|   | ||||
|  	if (AR_SREV_9100(sc->sc_ah)) | ||||
|  		return; | ||||
|   | ||||
|  	ath_fill_led_pin(sc); | ||||
|   | ||||
| -	if (!ath9k_led_blink) | ||||
| -		sc->led_cdev.default_trigger = | ||||
| -			ieee80211_get_radio_led_name(sc->hw); | ||||
| - | ||||
| -	snprintf(sc->led_name, sizeof(sc->led_name), | ||||
| -		"ath9k-%s", wiphy_name(sc->hw->wiphy)); | ||||
| -	sc->led_cdev.name = sc->led_name; | ||||
| -	sc->led_cdev.brightness_set = ath_led_brightness; | ||||
| +	snprintf(led_name, sizeof(led_name), "ath9k-%s", | ||||
| +		 wiphy_name(sc->hw->wiphy)); | ||||
|   | ||||
| -	ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &sc->led_cdev); | ||||
| -	if (ret < 0) | ||||
| -		return; | ||||
| +	if (ath9k_led_blink) | ||||
| +		trigger = sc->led_default_trigger; | ||||
| +	else | ||||
| +		trigger = ieee80211_get_radio_led_name(sc->hw); | ||||
|   | ||||
| -	sc->led_registered = true; | ||||
| +	ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, | ||||
| +			   !sc->sc_ah->config.led_active_high); | ||||
|  } | ||||
|  #endif | ||||
|   | ||||
| --- a/drivers/net/wireless/ath/ath9k/init.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/init.c | ||||
| @@ -1055,7 +1055,7 @@ int ath9k_init_device(u16 devid, struct | ||||
|   | ||||
|  #ifdef CPTCFG_MAC80211_LEDS | ||||
|  	/* must be initialized before ieee80211_register_hw */ | ||||
| -	sc->led_cdev.default_trigger = ieee80211_create_tpt_led_trigger(sc->hw, | ||||
| +	sc->led_default_trigger = ieee80211_create_tpt_led_trigger(sc->hw, | ||||
|  		IEEE80211_TPT_LEDTRIG_FL_RADIO, ath9k_tpt_blink, | ||||
|  		ARRAY_SIZE(ath9k_tpt_blink)); | ||||
|  #endif | ||||
| --- a/drivers/net/wireless/ath/ath9k/debug.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/debug.c | ||||
| @@ -1453,6 +1453,61 @@ static const struct file_operations fops | ||||
|  	.llseek = default_llseek, | ||||
|  }; | ||||
|   | ||||
| +#ifdef CONFIG_MAC80211_LEDS | ||||
| + | ||||
| +static ssize_t write_file_gpio_led(struct file *file, const char __user *ubuf, | ||||
| +				   size_t count, loff_t *ppos) | ||||
| +{ | ||||
| +	struct ath_softc *sc = file->private_data; | ||||
| +	char buf[32], *str, *name, *c; | ||||
| +	ssize_t len; | ||||
| +	unsigned int gpio; | ||||
| +	bool active_low = false; | ||||
| + | ||||
| +	len = min(count, sizeof(buf) - 1); | ||||
| +	if (copy_from_user(buf, ubuf, len)) | ||||
| +		return -EFAULT; | ||||
| + | ||||
| +	buf[len] = '\0'; | ||||
| +	name = strchr(buf, ','); | ||||
| +	if (!name) | ||||
| +		return -EINVAL; | ||||
| + | ||||
| +	*(name++) = 0; | ||||
| +	if (!*name) | ||||
| +		return -EINVAL; | ||||
| + | ||||
| +	c = strchr(name, '\n'); | ||||
| +	if (c) | ||||
| +		*c = 0; | ||||
| + | ||||
| +	str = buf; | ||||
| +	if (*str == '!') { | ||||
| +		str++; | ||||
| +		active_low = true; | ||||
| +	} | ||||
| + | ||||
| +	if (kstrtouint(str, 0, &gpio) < 0) | ||||
| +		return -EINVAL; | ||||
| + | ||||
| +	if (gpio >= sc->sc_ah->caps.num_gpio_pins) | ||||
| +		return -EINVAL; | ||||
| + | ||||
| +	if (ath_create_gpio_led(sc, gpio, name, NULL, active_low) < 0) | ||||
| +		return -EINVAL; | ||||
| + | ||||
| +	return count; | ||||
| +} | ||||
| + | ||||
| +static const struct file_operations fops_gpio_led = { | ||||
| +	.write = write_file_gpio_led, | ||||
| +	.open = simple_open, | ||||
| +	.owner = THIS_MODULE, | ||||
| +	.llseek = default_llseek, | ||||
| +}; | ||||
| + | ||||
| +#endif | ||||
| + | ||||
|   | ||||
|  int ath9k_init_debug(struct ath_hw *ah) | ||||
|  { | ||||
| @@ -1477,6 +1532,10 @@ int ath9k_init_debug(struct ath_hw *ah) | ||||
|  			    &fops_eeprom); | ||||
|  	debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | ||||
|  			    sc, &fops_chanbw); | ||||
| +#ifdef CONFIG_MAC80211_LEDS | ||||
| +	debugfs_create_file("gpio_led", S_IWUSR, | ||||
| +			   sc->debug.debugfs_phy, sc, &fops_gpio_led); | ||||
| +#endif | ||||
|  	debugfs_create_devm_seqfile(sc->dev, "dma", sc->debug.debugfs_phy, | ||||
|  				    read_file_dma); | ||||
|  	debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy, | ||||
| @@ -0,0 +1,76 @@ | ||||
| --- a/include/linux/ath9k_platform.h | ||||
| +++ b/include/linux/ath9k_platform.h | ||||
| @@ -46,6 +46,9 @@ struct ath9k_platform_data { | ||||
|  	int (*external_reset)(void); | ||||
|   | ||||
|  	bool use_eeprom; | ||||
| + | ||||
| +	int num_leds; | ||||
| +	const struct gpio_led *leds; | ||||
|  }; | ||||
|   | ||||
|  #endif /* _LINUX_ATH9K_PLATFORM_H */ | ||||
| --- a/drivers/net/wireless/ath/ath9k/gpio.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/gpio.c | ||||
| @@ -15,6 +15,7 @@ | ||||
|   */ | ||||
|   | ||||
|  #include "ath9k.h" | ||||
| +#include <linux/ath9k_platform.h> | ||||
|   | ||||
|  /********************************/ | ||||
|  /*	 LED functions		*/ | ||||
| @@ -108,6 +109,24 @@ int ath_create_gpio_led(struct ath_softc | ||||
|  	return ret; | ||||
|  } | ||||
|   | ||||
| +static int ath_create_platform_led(struct ath_softc *sc, | ||||
| +				   const struct gpio_led *gpio) | ||||
| +{ | ||||
| +	struct ath_led *led; | ||||
| +	int ret; | ||||
| + | ||||
| +	led = kzalloc(sizeof(*led), GFP_KERNEL); | ||||
| +	if (!led) | ||||
| +		return -ENOMEM; | ||||
| + | ||||
| +	led->gpio = gpio; | ||||
| +	ret = ath_add_led(sc, led); | ||||
| +	if (ret < 0) | ||||
| +		kfree(led); | ||||
| + | ||||
| +	return ret; | ||||
| +} | ||||
| + | ||||
|  void ath_deinit_leds(struct ath_softc *sc) | ||||
|  { | ||||
|  	struct ath_led *led; | ||||
| @@ -124,8 +143,10 @@ void ath_deinit_leds(struct ath_softc *s | ||||
|   | ||||
|  void ath_init_leds(struct ath_softc *sc) | ||||
|  { | ||||
| +	struct ath9k_platform_data *pdata = sc->dev->platform_data; | ||||
|  	char led_name[32]; | ||||
|  	const char *trigger; | ||||
| +	int i; | ||||
|   | ||||
|  	INIT_LIST_HEAD(&sc->leds); | ||||
|   | ||||
| @@ -134,6 +155,17 @@ void ath_init_leds(struct ath_softc *sc) | ||||
|   | ||||
|  	ath_fill_led_pin(sc); | ||||
|   | ||||
| +	if (pdata && pdata->leds && pdata->num_leds) | ||||
| +		for (i = 0; i < pdata->num_leds; i++) { | ||||
| +			if (pdata->leds[i].gpio == sc->sc_ah->led_pin) | ||||
| +				sc->sc_ah->led_pin = -1; | ||||
| + | ||||
| +			ath_create_platform_led(sc, &pdata->leds[i]); | ||||
| +		} | ||||
| + | ||||
| +	if (sc->sc_ah->led_pin < 0) | ||||
| +		return; | ||||
| + | ||||
|  	snprintf(led_name, sizeof(led_name), "ath9k-%s", | ||||
|  		 wiphy_name(sc->hw->wiphy)); | ||||
|   | ||||
| @@ -0,0 +1,11 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/ani.h | ||||
| +++ b/drivers/net/wireless/ath/ath9k/ani.h | ||||
| @@ -42,7 +42,7 @@ | ||||
|  #define ATH9K_ANI_PERIOD                  300 | ||||
|   | ||||
|  /* in ms */ | ||||
| -#define ATH9K_ANI_POLLINTERVAL            1000 | ||||
| +#define ATH9K_ANI_POLLINTERVAL            300 | ||||
|   | ||||
|  #define ATH9K_SIG_FIRSTEP_SETTING_MIN     0 | ||||
|  #define ATH9K_SIG_FIRSTEP_SETTING_MAX     20 | ||||
| @@ -0,0 +1,139 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/debug.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/debug.c | ||||
| @@ -1509,6 +1509,50 @@ static const struct file_operations fops | ||||
|  #endif | ||||
|   | ||||
|   | ||||
| +static ssize_t read_file_diag(struct file *file, char __user *user_buf, | ||||
| +			     size_t count, loff_t *ppos) | ||||
| +{ | ||||
| +	struct ath_softc *sc = file->private_data; | ||||
| +	struct ath_hw *ah = sc->sc_ah; | ||||
| +	char buf[32]; | ||||
| +	unsigned int len; | ||||
| + | ||||
| +	len = sprintf(buf, "0x%08lx\n", ah->diag); | ||||
| +	return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||||
| +} | ||||
| + | ||||
| +static ssize_t write_file_diag(struct file *file, const char __user *user_buf, | ||||
| +			     size_t count, loff_t *ppos) | ||||
| +{ | ||||
| +	struct ath_softc *sc = file->private_data; | ||||
| +	struct ath_hw *ah = sc->sc_ah; | ||||
| +	unsigned long diag; | ||||
| +	char buf[32]; | ||||
| +	ssize_t len; | ||||
| + | ||||
| +	len = min(count, sizeof(buf) - 1); | ||||
| +	if (copy_from_user(buf, user_buf, len)) | ||||
| +		return -EFAULT; | ||||
| + | ||||
| +	buf[len] = '\0'; | ||||
| +	if (kstrtoul(buf, 0, &diag)) | ||||
| +		return -EINVAL; | ||||
| + | ||||
| +	ah->diag = diag; | ||||
| +	ath9k_hw_update_diag(ah); | ||||
| + | ||||
| +	return count; | ||||
| +} | ||||
| + | ||||
| +static const struct file_operations fops_diag = { | ||||
| +	.read = read_file_diag, | ||||
| +	.write = write_file_diag, | ||||
| +	.open = simple_open, | ||||
| +	.owner = THIS_MODULE, | ||||
| +	.llseek = default_llseek, | ||||
| +}; | ||||
| + | ||||
| + | ||||
|  int ath9k_init_debug(struct ath_hw *ah) | ||||
|  { | ||||
|  	struct ath_common *common = ath9k_hw_common(ah); | ||||
| @@ -1536,6 +1580,8 @@ int ath9k_init_debug(struct ath_hw *ah) | ||||
|  	debugfs_create_file("gpio_led", S_IWUSR, | ||||
|  			   sc->debug.debugfs_phy, sc, &fops_gpio_led); | ||||
|  #endif | ||||
| +	debugfs_create_file("diag", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | ||||
| +			    sc, &fops_diag); | ||||
|  	debugfs_create_devm_seqfile(sc->dev, "dma", sc->debug.debugfs_phy, | ||||
|  				    read_file_dma); | ||||
|  	debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy, | ||||
| --- a/drivers/net/wireless/ath/ath9k/hw.h | ||||
| +++ b/drivers/net/wireless/ath/ath9k/hw.h | ||||
| @@ -522,6 +522,12 @@ enum { | ||||
|  	ATH9K_RESET_COLD, | ||||
|  }; | ||||
|   | ||||
| +enum { | ||||
| +	ATH_DIAG_DISABLE_RX, | ||||
| +	ATH_DIAG_DISABLE_TX, | ||||
| +	ATH_DIAG_TRIGGER_ERROR, | ||||
| +}; | ||||
| + | ||||
|  struct ath9k_hw_version { | ||||
|  	u32 magic; | ||||
|  	u16 devid; | ||||
| @@ -810,6 +816,8 @@ struct ath_hw { | ||||
|  	u32 ah_flags; | ||||
|  	s16 nf_override; | ||||
|   | ||||
| +	unsigned long diag; | ||||
| + | ||||
|  	bool reset_power_on; | ||||
|  	bool htc_reset_init; | ||||
|   | ||||
| @@ -1076,6 +1084,7 @@ void ath9k_hw_check_nav(struct ath_hw *a | ||||
|  bool ath9k_hw_check_alive(struct ath_hw *ah); | ||||
|   | ||||
|  bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); | ||||
| +void ath9k_hw_update_diag(struct ath_hw *ah); | ||||
|   | ||||
|  /* Generic hw timer primitives */ | ||||
|  struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, | ||||
| --- a/drivers/net/wireless/ath/ath9k/hw.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/hw.c | ||||
| @@ -1883,6 +1883,20 @@ u32 ath9k_hw_get_tsf_offset(struct times | ||||
|  } | ||||
|  EXPORT_SYMBOL(ath9k_hw_get_tsf_offset); | ||||
|   | ||||
| +void ath9k_hw_update_diag(struct ath_hw *ah) | ||||
| +{ | ||||
| +	if (test_bit(ATH_DIAG_DISABLE_RX, &ah->diag)) | ||||
| +		REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_DIS); | ||||
| +	else | ||||
| +		REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_DIS); | ||||
| + | ||||
| +	if (test_bit(ATH_DIAG_DISABLE_TX, &ah->diag)) | ||||
| +		REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_LOOP_BACK); | ||||
| +	else | ||||
| +		REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_LOOP_BACK); | ||||
| +} | ||||
| +EXPORT_SYMBOL(ath9k_hw_update_diag); | ||||
| + | ||||
|  int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | ||||
|  		   struct ath9k_hw_cal_data *caldata, bool fastcc) | ||||
|  { | ||||
| @@ -2091,6 +2105,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st | ||||
|  		ar9003_hw_disable_phy_restart(ah); | ||||
|   | ||||
|  	ath9k_hw_apply_gpio_override(ah); | ||||
| +	ath9k_hw_update_diag(ah); | ||||
|   | ||||
|  	if (AR_SREV_9565(ah) && common->bt_ant_diversity) | ||||
|  		REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON); | ||||
| --- a/drivers/net/wireless/ath/ath9k/main.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/main.c | ||||
| @@ -528,6 +528,11 @@ irqreturn_t ath_isr(int irq, void *dev) | ||||
|  	if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) | ||||
|  		return IRQ_HANDLED; | ||||
|   | ||||
| +	if (test_bit(ATH_DIAG_TRIGGER_ERROR, &ah->diag)) { | ||||
| +		status |= ATH9K_INT_FATAL; | ||||
| +		clear_bit(ATH_DIAG_TRIGGER_ERROR, &ah->diag); | ||||
| +	} | ||||
| + | ||||
|  	/* | ||||
|  	 * If there are no status bits set, then this interrupt was not | ||||
|  	 * for me (should have been caught above). | ||||
| @@ -0,0 +1,186 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/hw.h | ||||
| +++ b/drivers/net/wireless/ath/ath9k/hw.h | ||||
| @@ -723,6 +723,7 @@ struct ath_spec_scan { | ||||
|   * @config_pci_powersave: | ||||
|   * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC | ||||
|   * | ||||
| + * @get_adc_entropy: get entropy from the raw ADC I/Q output | ||||
|   * @spectral_scan_config: set parameters for spectral scan and enable/disable it | ||||
|   * @spectral_scan_trigger: trigger a spectral scan run | ||||
|   * @spectral_scan_wait: wait for a spectral scan run to finish | ||||
| @@ -745,6 +746,7 @@ struct ath_hw_ops { | ||||
|  			struct ath_hw_antcomb_conf *antconf); | ||||
|  	void (*antdiv_comb_conf_set)(struct ath_hw *ah, | ||||
|  			struct ath_hw_antcomb_conf *antconf); | ||||
| +	void (*get_adc_entropy)(struct ath_hw *ah, u8 *buf, size_t len); | ||||
|  	void (*spectral_scan_config)(struct ath_hw *ah, | ||||
|  				     struct ath_spec_scan *param); | ||||
|  	void (*spectral_scan_trigger)(struct ath_hw *ah); | ||||
| --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | ||||
| @@ -1927,6 +1927,26 @@ void ar9003_hw_init_rate_txpower(struct | ||||
|  	} | ||||
|  } | ||||
|   | ||||
| +static void ar9003_hw_get_adc_entropy(struct ath_hw *ah, u8 *buf, size_t len) | ||||
| +{ | ||||
| +	int i, j; | ||||
| + | ||||
| +	REG_RMW_FIELD(ah, AR_PHY_TEST, AR_PHY_TEST_BBB_OBS_SEL, 1); | ||||
| +	REG_CLR_BIT(ah, AR_PHY_TEST, AR_PHY_TEST_RX_OBS_SEL_BIT5); | ||||
| +	REG_RMW_FIELD(ah, AR_PHY_TEST_CTL_STATUS, AR_PHY_TEST_CTL_RX_OBS_SEL, 0); | ||||
| + | ||||
| +	memset(buf, 0, len); | ||||
| +	for (i = 0; i < len; i++) { | ||||
| +		for (j = 0; j < 4; j++) { | ||||
| +			u32 regval = REG_READ(ah, AR_PHY_TST_ADC); | ||||
| + | ||||
| +			buf[i] <<= 2; | ||||
| +			buf[i] |= (regval & 1) | ((regval & BIT(10)) >> 9); | ||||
| +			udelay(1); | ||||
| +		} | ||||
| +	} | ||||
| +} | ||||
| + | ||||
|  void ar9003_hw_attach_phy_ops(struct ath_hw *ah) | ||||
|  { | ||||
|  	struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); | ||||
| @@ -1963,6 +1983,7 @@ void ar9003_hw_attach_phy_ops(struct ath | ||||
|  	priv_ops->set_radar_params = ar9003_hw_set_radar_params; | ||||
|  	priv_ops->fast_chan_change = ar9003_hw_fast_chan_change; | ||||
|   | ||||
| +	ops->get_adc_entropy = ar9003_hw_get_adc_entropy; | ||||
|  	ops->antdiv_comb_conf_get = ar9003_hw_antdiv_comb_conf_get; | ||||
|  	ops->antdiv_comb_conf_set = ar9003_hw_antdiv_comb_conf_set; | ||||
|  	ops->spectral_scan_config = ar9003_hw_spectral_scan_config; | ||||
| --- a/drivers/net/wireless/ath/ath9k/init.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/init.c | ||||
| @@ -819,7 +819,8 @@ static void ath9k_init_txpower_limits(st | ||||
|  	if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) | ||||
|  		ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ); | ||||
|   | ||||
| -	ah->curchan = curchan; | ||||
| +	if (curchan) | ||||
| +		ah->curchan = curchan; | ||||
|  } | ||||
|   | ||||
|  static const struct ieee80211_iface_limit if_limits[] = { | ||||
| @@ -1015,6 +1016,18 @@ static void ath9k_set_hw_capab(struct at | ||||
|  			      NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS); | ||||
|  } | ||||
|   | ||||
| +static void ath_get_initial_entropy(struct ath_softc *sc) | ||||
| +{ | ||||
| +	struct ath_hw *ah = sc->sc_ah; | ||||
| +	char buf[256]; | ||||
| + | ||||
| +	/* reuse last channel initialized by the tx power test */ | ||||
| +	ath9k_hw_reset(ah, ah->curchan, NULL, false); | ||||
| + | ||||
| +	ath9k_hw_get_adc_entropy(ah, buf, sizeof(buf)); | ||||
| +	add_device_randomness(buf, sizeof(buf)); | ||||
| +} | ||||
| + | ||||
|  int ath9k_init_device(u16 devid, struct ath_softc *sc, | ||||
|  		    const struct ath_bus_ops *bus_ops) | ||||
|  { | ||||
| @@ -1060,6 +1073,8 @@ int ath9k_init_device(u16 devid, struct | ||||
|  		ARRAY_SIZE(ath9k_tpt_blink)); | ||||
|  #endif | ||||
|   | ||||
| +	ath_get_initial_entropy(sc); | ||||
| + | ||||
|  	/* Register with mac80211 */ | ||||
|  	error = ieee80211_register_hw(hw); | ||||
|  	if (error) | ||||
| --- a/drivers/net/wireless/ath/ath9k/hw-ops.h | ||||
| +++ b/drivers/net/wireless/ath/ath9k/hw-ops.h | ||||
| @@ -100,6 +100,12 @@ static inline void ath9k_hw_tx99_set_txp | ||||
|  		ath9k_hw_ops(ah)->tx99_set_txpower(ah, power); | ||||
|  } | ||||
|   | ||||
| +static inline void ath9k_hw_get_adc_entropy(struct ath_hw *ah, | ||||
| +		u8 *buf, size_t len) | ||||
| +{ | ||||
| +	ath9k_hw_ops(ah)->get_adc_entropy(ah, buf, len); | ||||
| +} | ||||
| + | ||||
|  #ifdef CPTCFG_ATH9K_BTCOEX_SUPPORT | ||||
|   | ||||
|  static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable) | ||||
| --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | ||||
| @@ -1320,9 +1320,30 @@ void ar5008_hw_init_rate_txpower(struct | ||||
|  	} | ||||
|  } | ||||
|   | ||||
| +static void ar5008_hw_get_adc_entropy(struct ath_hw *ah, u8 *buf, size_t len) | ||||
| +{ | ||||
| +	int i, j; | ||||
| + | ||||
| +	REG_RMW_FIELD(ah, AR_PHY_TEST, AR_PHY_TEST_BBB_OBS_SEL, 1); | ||||
| +	REG_CLR_BIT(ah, AR_PHY_TEST, AR_PHY_TEST_RX_OBS_SEL_BIT5); | ||||
| +	REG_RMW_FIELD(ah, AR_PHY_TEST2, AR_PHY_TEST2_RX_OBS_SEL, 0); | ||||
| + | ||||
| +	memset(buf, 0, len); | ||||
| +	for (i = 0; i < len; i++) { | ||||
| +		for (j = 0; j < 4; j++) { | ||||
| +			u32 regval = REG_READ(ah, AR_PHY_TST_ADC); | ||||
| + | ||||
| +			buf[i] <<= 2; | ||||
| +			buf[i] |= (regval & 1) | ((regval & BIT(9)) >> 8); | ||||
| +			udelay(1); | ||||
| +		} | ||||
| +	} | ||||
| +} | ||||
| + | ||||
|  int ar5008_hw_attach_phy_ops(struct ath_hw *ah) | ||||
|  { | ||||
|  	struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); | ||||
| +	struct ath_hw_ops *ops = ath9k_hw_ops(ah); | ||||
|  	static const u32 ar5416_cca_regs[6] = { | ||||
|  		AR_PHY_CCA, | ||||
|  		AR_PHY_CH1_CCA, | ||||
| @@ -1337,6 +1358,8 @@ int ar5008_hw_attach_phy_ops(struct ath_ | ||||
|  	if (ret) | ||||
|  	    return ret; | ||||
|   | ||||
| +	ops->get_adc_entropy = ar5008_hw_get_adc_entropy; | ||||
| + | ||||
|  	priv_ops->rf_set_freq = ar5008_hw_set_channel; | ||||
|  	priv_ops->spur_mitigate_freq = ar5008_hw_spur_mitigate; | ||||
|   | ||||
| --- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h | ||||
| +++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.h | ||||
| @@ -20,6 +20,12 @@ | ||||
|  #define PHY_AGC_CLR             0x10000000 | ||||
|  #define RFSILENT_BB             0x00002000 | ||||
|   | ||||
| +#define AR_PHY_TEST_BBB_OBS_SEL       0x780000 | ||||
| +#define AR_PHY_TEST_BBB_OBS_SEL_S     19 | ||||
| + | ||||
| +#define AR_PHY_TEST_RX_OBS_SEL_BIT5_S 23 | ||||
| +#define AR_PHY_TEST_RX_OBS_SEL_BIT5   (1 << AR_PHY_TEST_RX_OBS_SEL_BIT5_S) | ||||
| + | ||||
|  #define AR_PHY_TURBO                0x9804 | ||||
|  #define AR_PHY_FC_TURBO_MODE        0x00000001 | ||||
|  #define AR_PHY_FC_TURBO_SHORT       0x00000002 | ||||
| @@ -36,6 +42,9 @@ | ||||
|   | ||||
|  #define AR_PHY_TEST2			0x9808 | ||||
|   | ||||
| +#define AR_PHY_TEST2_RX_OBS_SEL        0x3C00 | ||||
| +#define AR_PHY_TEST2_RX_OBS_SEL_S      10 | ||||
| + | ||||
|  #define AR_PHY_TIMING2           0x9810 | ||||
|  #define AR_PHY_TIMING3           0x9814 | ||||
|  #define AR_PHY_TIMING3_DSC_MAN   0xFFFE0000 | ||||
| @@ -393,6 +402,8 @@ | ||||
|  #define AR_PHY_RFBUS_GRANT       0x9C20 | ||||
|  #define AR_PHY_RFBUS_GRANT_EN    0x00000001 | ||||
|   | ||||
| +#define AR_PHY_TST_ADC      0x9C24 | ||||
| + | ||||
|  #define AR_PHY_CHAN_INFO_GAIN_DIFF             0x9CF4 | ||||
|  #define AR_PHY_CHAN_INFO_GAIN_DIFF_UPPER_LIMIT 320 | ||||
|   | ||||
| @@ -0,0 +1,79 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/hw.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/hw.c | ||||
| @@ -248,6 +248,19 @@ void ath9k_hw_get_channel_centers(struct | ||||
|  		centers->synth_center + (extoff * HT40_CHANNEL_CENTER_SHIFT); | ||||
|  } | ||||
|   | ||||
| +static inline void ath9k_hw_disable_pll_lock_detect(struct ath_hw *ah) | ||||
| +{ | ||||
| +	/* On AR9330 and AR9340 devices, some PHY registers must be | ||||
| +	 * tuned to gain better stability/performance. These registers | ||||
| +	 * might be changed while doing wlan reset so the registers must | ||||
| +	 * be reprogrammed after each reset. | ||||
| +	 */ | ||||
| +	REG_CLR_BIT(ah, AR_PHY_USB_CTRL1, BIT(20)); | ||||
| +	REG_RMW(ah, AR_PHY_USB_CTRL2, | ||||
| +		(1 << 21) | (0xf << 22), | ||||
| +		(1 << 21) | (0x3 << 22)); | ||||
| +} | ||||
| + | ||||
|  /******************/ | ||||
|  /* Chip Revisions */ | ||||
|  /******************/ | ||||
| @@ -1455,6 +1468,9 @@ static bool ath9k_hw_set_reset(struct at | ||||
|  		udelay(50); | ||||
|  	} | ||||
|   | ||||
| +	if (AR_SREV_9330(ah) || AR_SREV_9340(ah)) | ||||
| +		ath9k_hw_disable_pll_lock_detect(ah); | ||||
| + | ||||
|  	return true; | ||||
|  } | ||||
|   | ||||
| @@ -1554,6 +1570,9 @@ static bool ath9k_hw_chip_reset(struct a | ||||
|  		ar9003_hw_internal_regulator_apply(ah); | ||||
|  	ath9k_hw_init_pll(ah, chan); | ||||
|   | ||||
| +	if (AR_SREV_9330(ah) || AR_SREV_9340(ah)) | ||||
| +		ath9k_hw_disable_pll_lock_detect(ah); | ||||
| + | ||||
|  	return true; | ||||
|  } | ||||
|   | ||||
| @@ -1861,8 +1880,14 @@ static int ath9k_hw_do_fastcc(struct ath | ||||
|  	if (AR_SREV_9271(ah)) | ||||
|  		ar9002_hw_load_ani_reg(ah, chan); | ||||
|   | ||||
| +	if (AR_SREV_9330(ah) || AR_SREV_9340(ah)) | ||||
| +		ath9k_hw_disable_pll_lock_detect(ah); | ||||
| + | ||||
|  	return 0; | ||||
|  fail: | ||||
| +	if (AR_SREV_9330(ah) || AR_SREV_9340(ah)) | ||||
| +		ath9k_hw_disable_pll_lock_detect(ah); | ||||
| + | ||||
|  	return -EINVAL; | ||||
|  } | ||||
|   | ||||
| @@ -2116,6 +2141,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st | ||||
|  		ath9k_hw_set_radar_params(ah); | ||||
|  	} | ||||
|   | ||||
| +	if (AR_SREV_9330(ah) || AR_SREV_9340(ah)) | ||||
| +		ath9k_hw_disable_pll_lock_detect(ah); | ||||
| + | ||||
|  	return 0; | ||||
|  } | ||||
|  EXPORT_SYMBOL(ath9k_hw_reset); | ||||
| --- a/drivers/net/wireless/ath/ath9k/phy.h | ||||
| +++ b/drivers/net/wireless/ath/ath9k/phy.h | ||||
| @@ -48,6 +48,9 @@ | ||||
|  #define AR_PHY_PLL_CONTROL 0x16180 | ||||
|  #define AR_PHY_PLL_MODE 0x16184 | ||||
|   | ||||
| +#define AR_PHY_USB_CTRL1	0x16c84 | ||||
| +#define AR_PHY_USB_CTRL2	0x16c88 | ||||
| + | ||||
|  enum ath9k_ant_div_comb_lna_conf { | ||||
|  	ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2, | ||||
|  	ATH_ANT_DIV_COMB_LNA2, | ||||
| @@ -0,0 +1,155 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | ||||
| @@ -949,55 +949,6 @@ static bool ar5008_hw_ani_control_new(st | ||||
|  		 * on == 0 means more noise imm | ||||
|  		 */ | ||||
|  		u32 on = param ? 1 : 0; | ||||
| -		/* | ||||
| -		 * make register setting for default | ||||
| -		 * (weak sig detect ON) come from INI file | ||||
| -		 */ | ||||
| -		int m1ThreshLow = on ? | ||||
| -			aniState->iniDef.m1ThreshLow : m1ThreshLow_off; | ||||
| -		int m2ThreshLow = on ? | ||||
| -			aniState->iniDef.m2ThreshLow : m2ThreshLow_off; | ||||
| -		int m1Thresh = on ? | ||||
| -			aniState->iniDef.m1Thresh : m1Thresh_off; | ||||
| -		int m2Thresh = on ? | ||||
| -			aniState->iniDef.m2Thresh : m2Thresh_off; | ||||
| -		int m2CountThr = on ? | ||||
| -			aniState->iniDef.m2CountThr : m2CountThr_off; | ||||
| -		int m2CountThrLow = on ? | ||||
| -			aniState->iniDef.m2CountThrLow : m2CountThrLow_off; | ||||
| -		int m1ThreshLowExt = on ? | ||||
| -			aniState->iniDef.m1ThreshLowExt : m1ThreshLowExt_off; | ||||
| -		int m2ThreshLowExt = on ? | ||||
| -			aniState->iniDef.m2ThreshLowExt : m2ThreshLowExt_off; | ||||
| -		int m1ThreshExt = on ? | ||||
| -			aniState->iniDef.m1ThreshExt : m1ThreshExt_off; | ||||
| -		int m2ThreshExt = on ? | ||||
| -			aniState->iniDef.m2ThreshExt : m2ThreshExt_off; | ||||
| - | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW, | ||||
| -			      AR_PHY_SFCORR_LOW_M1_THRESH_LOW, | ||||
| -			      m1ThreshLow); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW, | ||||
| -			      AR_PHY_SFCORR_LOW_M2_THRESH_LOW, | ||||
| -			      m2ThreshLow); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR, | ||||
| -			      AR_PHY_SFCORR_M1_THRESH, m1Thresh); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR, | ||||
| -			      AR_PHY_SFCORR_M2_THRESH, m2Thresh); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR, | ||||
| -			      AR_PHY_SFCORR_M2COUNT_THR, m2CountThr); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW, | ||||
| -			      AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW, | ||||
| -			      m2CountThrLow); | ||||
| - | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT, | ||||
| -			      AR_PHY_SFCORR_EXT_M1_THRESH_LOW, m1ThreshLowExt); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT, | ||||
| -			      AR_PHY_SFCORR_EXT_M2_THRESH_LOW, m2ThreshLowExt); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT, | ||||
| -			      AR_PHY_SFCORR_EXT_M1_THRESH, m1ThreshExt); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT, | ||||
| -			      AR_PHY_SFCORR_EXT_M2_THRESH, m2ThreshExt); | ||||
|   | ||||
|  		if (on) | ||||
|  			REG_SET_BIT(ah, AR_PHY_SFCORR_LOW, | ||||
| --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | ||||
| @@ -42,20 +42,6 @@ static const int cycpwrThr1_table[] = | ||||
|  /* level:  0   1   2   3   4   5   6   7   8  */ | ||||
|  	{ -6, -4, -2,  0,  2,  4,  6,  8 };     /* lvl 0-7, default 3 */ | ||||
|   | ||||
| -/* | ||||
| - * register values to turn OFDM weak signal detection OFF | ||||
| - */ | ||||
| -static const int m1ThreshLow_off = 127; | ||||
| -static const int m2ThreshLow_off = 127; | ||||
| -static const int m1Thresh_off = 127; | ||||
| -static const int m2Thresh_off = 127; | ||||
| -static const int m2CountThr_off =  31; | ||||
| -static const int m2CountThrLow_off =  63; | ||||
| -static const int m1ThreshLowExt_off = 127; | ||||
| -static const int m2ThreshLowExt_off = 127; | ||||
| -static const int m1ThreshExt_off = 127; | ||||
| -static const int m2ThreshExt_off = 127; | ||||
| - | ||||
|  static const u8 ofdm2pwr[] = { | ||||
|  	ALL_TARGET_LEGACY_6_24, | ||||
|  	ALL_TARGET_LEGACY_6_24, | ||||
| @@ -1077,11 +1063,6 @@ static bool ar9003_hw_ani_control(struct | ||||
|  	struct ath_common *common = ath9k_hw_common(ah); | ||||
|  	struct ath9k_channel *chan = ah->curchan; | ||||
|  	struct ar5416AniState *aniState = &ah->ani; | ||||
| -	int m1ThreshLow, m2ThreshLow; | ||||
| -	int m1Thresh, m2Thresh; | ||||
| -	int m2CountThr, m2CountThrLow; | ||||
| -	int m1ThreshLowExt, m2ThreshLowExt; | ||||
| -	int m1ThreshExt, m2ThreshExt; | ||||
|  	s32 value, value2; | ||||
|   | ||||
|  	switch (cmd & ah->ani_function) { | ||||
| @@ -1095,61 +1076,6 @@ static bool ar9003_hw_ani_control(struct | ||||
|  		 */ | ||||
|  		u32 on = param ? 1 : 0; | ||||
|   | ||||
| -		if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) | ||||
| -			goto skip_ws_det; | ||||
| - | ||||
| -		m1ThreshLow = on ? | ||||
| -			aniState->iniDef.m1ThreshLow : m1ThreshLow_off; | ||||
| -		m2ThreshLow = on ? | ||||
| -			aniState->iniDef.m2ThreshLow : m2ThreshLow_off; | ||||
| -		m1Thresh = on ? | ||||
| -			aniState->iniDef.m1Thresh : m1Thresh_off; | ||||
| -		m2Thresh = on ? | ||||
| -			aniState->iniDef.m2Thresh : m2Thresh_off; | ||||
| -		m2CountThr = on ? | ||||
| -			aniState->iniDef.m2CountThr : m2CountThr_off; | ||||
| -		m2CountThrLow = on ? | ||||
| -			aniState->iniDef.m2CountThrLow : m2CountThrLow_off; | ||||
| -		m1ThreshLowExt = on ? | ||||
| -			aniState->iniDef.m1ThreshLowExt : m1ThreshLowExt_off; | ||||
| -		m2ThreshLowExt = on ? | ||||
| -			aniState->iniDef.m2ThreshLowExt : m2ThreshLowExt_off; | ||||
| -		m1ThreshExt = on ? | ||||
| -			aniState->iniDef.m1ThreshExt : m1ThreshExt_off; | ||||
| -		m2ThreshExt = on ? | ||||
| -			aniState->iniDef.m2ThreshExt : m2ThreshExt_off; | ||||
| - | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW, | ||||
| -			      AR_PHY_SFCORR_LOW_M1_THRESH_LOW, | ||||
| -			      m1ThreshLow); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW, | ||||
| -			      AR_PHY_SFCORR_LOW_M2_THRESH_LOW, | ||||
| -			      m2ThreshLow); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR, | ||||
| -			      AR_PHY_SFCORR_M1_THRESH, | ||||
| -			      m1Thresh); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR, | ||||
| -			      AR_PHY_SFCORR_M2_THRESH, | ||||
| -			      m2Thresh); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR, | ||||
| -			      AR_PHY_SFCORR_M2COUNT_THR, | ||||
| -			      m2CountThr); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW, | ||||
| -			      AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW, | ||||
| -			      m2CountThrLow); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT, | ||||
| -			      AR_PHY_SFCORR_EXT_M1_THRESH_LOW, | ||||
| -			      m1ThreshLowExt); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT, | ||||
| -			      AR_PHY_SFCORR_EXT_M2_THRESH_LOW, | ||||
| -			      m2ThreshLowExt); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT, | ||||
| -			      AR_PHY_SFCORR_EXT_M1_THRESH, | ||||
| -			      m1ThreshExt); | ||||
| -		REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT, | ||||
| -			      AR_PHY_SFCORR_EXT_M2_THRESH, | ||||
| -			      m2ThreshExt); | ||||
| -skip_ws_det: | ||||
|  		if (on) | ||||
|  			REG_SET_BIT(ah, AR_PHY_SFCORR_LOW, | ||||
|  				    AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); | ||||
| @@ -0,0 +1,29 @@ | ||||
| From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl> | ||||
| Date: Sun, 31 Jan 2016 20:48:49 +0100 | ||||
| Subject: [PATCH v4 2/8] mac80211: ath9k: set default state for platform LEDs | ||||
|  | ||||
| Support default state for platform LEDs connected to ath9k device. | ||||
| Now LEDs are correctly set on or off at ath9k module initialization. | ||||
| Very useful if power LED is connected to wireless chip. | ||||
|  | ||||
| Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl> | ||||
| --- | ||||
|  gpio.c |    7 +++++-- | ||||
|  1 file changed, 5 insertions(+), 2 deletions(-) | ||||
|  | ||||
| --- a/drivers/net/wireless/ath/ath9k/gpio.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/gpio.c | ||||
| @@ -74,8 +74,11 @@ static int ath_add_led(struct ath_softc | ||||
|  	ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name, | ||||
|  				  AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | ||||
|   | ||||
| -	/* LED off */ | ||||
| -	ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); | ||||
| +	/* Set default LED state */ | ||||
| +	if (gpio->default_state == LEDS_GPIO_DEFSTATE_ON) | ||||
| +		ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, !gpio->active_low); | ||||
| +	else | ||||
| +		ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); | ||||
|   | ||||
|  	return 0; | ||||
|  } | ||||
| @@ -0,0 +1,251 @@ | ||||
| From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl> | ||||
| Date: Sun, 31 Jan 2016 21:01:31 +0100 | ||||
| Subject: [PATCH v4 4/8] mac80211: ath9k: enable access to GPIO | ||||
|  | ||||
| Enable access to GPIO chip and its pins for Atheros AR92xx | ||||
| wireless devices. For now AR9285 and AR9287 are supported. | ||||
|  | ||||
| Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl> | ||||
| Signed-off-by: Felix Fietkau <nbd@nbd.name> | ||||
| --- | ||||
| --- a/drivers/net/wireless/ath/ath9k/ath9k.h | ||||
| +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | ||||
| @@ -24,6 +24,7 @@ | ||||
|  #include <linux/completion.h> | ||||
|  #include <linux/time.h> | ||||
|  #include <linux/hw_random.h> | ||||
| +#include <linux/gpio/driver.h> | ||||
|   | ||||
|  #include "common.h" | ||||
|  #include "debug.h" | ||||
| @@ -989,6 +990,14 @@ struct ath_led { | ||||
|  	struct led_classdev cdev; | ||||
|  }; | ||||
|   | ||||
| +#ifdef CONFIG_GPIOLIB | ||||
| +struct ath9k_gpio_chip { | ||||
| +	struct ath_softc *sc; | ||||
| +	char label[32]; | ||||
| +	struct gpio_chip gchip; | ||||
| +}; | ||||
| +#endif | ||||
| + | ||||
|  struct ath_softc { | ||||
|  	struct ieee80211_hw *hw; | ||||
|  	struct device *dev; | ||||
| @@ -1044,6 +1053,9 @@ struct ath_softc { | ||||
|  #ifdef CPTCFG_MAC80211_LEDS | ||||
|  	const char *led_default_trigger; | ||||
|  	struct list_head leds; | ||||
| +#ifdef CONFIG_GPIOLIB | ||||
| +	struct ath9k_gpio_chip *gpiochip; | ||||
| +#endif | ||||
|  #endif | ||||
|   | ||||
|  #ifdef CPTCFG_ATH9K_DEBUGFS | ||||
| --- a/drivers/net/wireless/ath/ath9k/gpio.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/gpio.c | ||||
| @@ -16,13 +16,139 @@ | ||||
|   | ||||
|  #include "ath9k.h" | ||||
|  #include <linux/ath9k_platform.h> | ||||
| +#include <linux/gpio.h> | ||||
| + | ||||
| +#ifdef CPTCFG_MAC80211_LEDS | ||||
| + | ||||
| +#ifdef CONFIG_GPIOLIB | ||||
| + | ||||
| +/***************/ | ||||
| +/*  GPIO Chip  */ | ||||
| +/***************/ | ||||
| + | ||||
| +/* gpio_chip handler : set GPIO to input */ | ||||
| +static int ath9k_gpio_pin_cfg_input(struct gpio_chip *chip, unsigned offset) | ||||
| +{ | ||||
| +	struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, | ||||
| +						  gchip); | ||||
| + | ||||
| +	ath9k_hw_gpio_request_in(gc->sc->sc_ah, offset, "ath9k-gpio"); | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +/* gpio_chip handler : set GPIO to output */ | ||||
| +static int ath9k_gpio_pin_cfg_output(struct gpio_chip *chip, unsigned offset, | ||||
| +				     int value) | ||||
| +{ | ||||
| +	struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, | ||||
| +						  gchip); | ||||
| + | ||||
| +	ath9k_hw_gpio_request_out(gc->sc->sc_ah, offset, "ath9k-gpio", | ||||
| +				  AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | ||||
| +	ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value); | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +/* gpio_chip handler : query GPIO direction (0=out, 1=in) */ | ||||
| +static int ath9k_gpio_pin_get_dir(struct gpio_chip *chip, unsigned offset) | ||||
| +{ | ||||
| +	struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, | ||||
| +						  gchip); | ||||
| +	struct ath_hw *ah = gc->sc->sc_ah; | ||||
| + | ||||
| +	return !((REG_READ(ah, AR_GPIO_OE_OUT) >> (offset * 2)) & 3); | ||||
| +} | ||||
| + | ||||
| +/* gpio_chip handler : get GPIO pin value */ | ||||
| +static int ath9k_gpio_pin_get(struct gpio_chip *chip, unsigned offset) | ||||
| +{ | ||||
| +	struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, | ||||
| +						  gchip); | ||||
| + | ||||
| +	return ath9k_hw_gpio_get(gc->sc->sc_ah, offset); | ||||
| +} | ||||
| + | ||||
| +/* gpio_chip handler : set GPIO pin to value */ | ||||
| +static void ath9k_gpio_pin_set(struct gpio_chip *chip, unsigned offset, | ||||
| +			       int value) | ||||
| +{ | ||||
| +	struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, | ||||
| +						  gchip); | ||||
| + | ||||
| +	ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value); | ||||
| +} | ||||
| + | ||||
| +/* register GPIO chip */ | ||||
| +static void ath9k_register_gpio_chip(struct ath_softc *sc) | ||||
| +{ | ||||
| +	struct ath9k_gpio_chip *gc; | ||||
| +	struct ath_hw *ah = sc->sc_ah; | ||||
| + | ||||
| +	gc = kzalloc(sizeof(struct ath9k_gpio_chip), GFP_KERNEL); | ||||
| +	if (!gc) | ||||
| +		return; | ||||
| + | ||||
| +	gc->sc = sc; | ||||
| +	snprintf(gc->label, sizeof(gc->label), "ath9k-%s", | ||||
| +		 wiphy_name(sc->hw->wiphy)); | ||||
| +#ifdef CONFIG_OF | ||||
| +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) | ||||
| +	gc->gchip.parent = sc->dev; | ||||
| +#else | ||||
| +	gc->gchip.dev = sc->dev; | ||||
| +#endif | ||||
| +#endif | ||||
| +	gc->gchip.label = gc->label; | ||||
| +	gc->gchip.base = -1;	/* determine base automatically */ | ||||
| +	gc->gchip.ngpio = ah->caps.num_gpio_pins; | ||||
| +	gc->gchip.direction_input = ath9k_gpio_pin_cfg_input; | ||||
| +	gc->gchip.direction_output = ath9k_gpio_pin_cfg_output; | ||||
| +	gc->gchip.get_direction = ath9k_gpio_pin_get_dir; | ||||
| +	gc->gchip.get = ath9k_gpio_pin_get; | ||||
| +	gc->gchip.set = ath9k_gpio_pin_set; | ||||
| + | ||||
| +	if (gpiochip_add(&gc->gchip)) { | ||||
| +		kfree(gc); | ||||
| +		return; | ||||
| +	} | ||||
| + | ||||
| +#ifdef CONFIG_OF | ||||
| +	gc->gchip.owner = NULL; | ||||
| +#endif | ||||
| +	sc->gpiochip = gc; | ||||
| +} | ||||
| + | ||||
| +/* remove GPIO chip */ | ||||
| +static void ath9k_unregister_gpio_chip(struct ath_softc *sc) | ||||
| +{ | ||||
| +	struct ath9k_gpio_chip *gc = sc->gpiochip; | ||||
| + | ||||
| +	if (!gc) | ||||
| +		return; | ||||
| + | ||||
| +	gpiochip_remove(&gc->gchip); | ||||
| +	kfree(gc); | ||||
| +	sc->gpiochip = NULL; | ||||
| +} | ||||
| + | ||||
| +#else /* CONFIG_GPIOLIB */ | ||||
| + | ||||
| +static inline void ath9k_register_gpio_chip(struct ath_softc *sc) | ||||
| +{ | ||||
| +} | ||||
| + | ||||
| +static inline void ath9k_unregister_gpio_chip(struct ath_softc *sc) | ||||
| +{ | ||||
| +} | ||||
| + | ||||
| +#endif /* CONFIG_GPIOLIB */ | ||||
|   | ||||
|  /********************************/ | ||||
|  /*	 LED functions		*/ | ||||
|  /********************************/ | ||||
|   | ||||
| -#ifdef CPTCFG_MAC80211_LEDS | ||||
| - | ||||
|  static void ath_fill_led_pin(struct ath_softc *sc) | ||||
|  { | ||||
|  	struct ath_hw *ah = sc->sc_ah; | ||||
| @@ -80,6 +206,12 @@ static int ath_add_led(struct ath_softc | ||||
|  	else | ||||
|  		ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); | ||||
|   | ||||
| +#ifdef CONFIG_GPIOLIB | ||||
| +	/* If there is GPIO chip configured, reserve LED pin */ | ||||
| +	if (sc->gpiochip) | ||||
| +		gpio_request(sc->gpiochip->gchip.base + gpio->gpio, gpio->name); | ||||
| +#endif | ||||
| + | ||||
|  	return 0; | ||||
|  } | ||||
|   | ||||
| @@ -136,17 +268,24 @@ void ath_deinit_leds(struct ath_softc *s | ||||
|   | ||||
|  	while (!list_empty(&sc->leds)) { | ||||
|  		led = list_first_entry(&sc->leds, struct ath_led, list); | ||||
| +#ifdef CONFIG_GPIOLIB | ||||
| +		/* If there is GPIO chip configured, free LED pin */ | ||||
| +		if (sc->gpiochip) | ||||
| +			gpio_free(sc->gpiochip->gchip.base + led->gpio->gpio); | ||||
| +#endif | ||||
|  		list_del(&led->list); | ||||
|  		ath_led_brightness(&led->cdev, LED_OFF); | ||||
|  		led_classdev_unregister(&led->cdev); | ||||
|  		ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio); | ||||
|  		kfree(led); | ||||
|  	} | ||||
| +	ath9k_unregister_gpio_chip(sc); | ||||
|  } | ||||
|   | ||||
|  void ath_init_leds(struct ath_softc *sc) | ||||
|  { | ||||
|  	struct ath9k_platform_data *pdata = sc->dev->platform_data; | ||||
| +	struct device_node *np = sc->dev->of_node; | ||||
|  	char led_name[32]; | ||||
|  	const char *trigger; | ||||
|  	int i; | ||||
| @@ -156,6 +295,15 @@ void ath_init_leds(struct ath_softc *sc) | ||||
|  	if (AR_SREV_9100(sc->sc_ah)) | ||||
|  		return; | ||||
|   | ||||
| +	if (!np) | ||||
| +		ath9k_register_gpio_chip(sc); | ||||
| + | ||||
| +	/* setup gpio controller only if requested and skip the led_pin setup */ | ||||
| +	if (of_property_read_bool(np, "gpio-controller")) { | ||||
| +		ath9k_register_gpio_chip(sc); | ||||
| +		return; | ||||
| +	} | ||||
| + | ||||
|  	ath_fill_led_pin(sc); | ||||
|   | ||||
|  	if (pdata && pdata->leds && pdata->num_leds) | ||||
| @@ -180,6 +328,7 @@ void ath_init_leds(struct ath_softc *sc) | ||||
|  	ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, | ||||
|  			   !sc->sc_ah->config.led_active_high); | ||||
|  } | ||||
| + | ||||
|  #endif | ||||
|   | ||||
|  /*******************/ | ||||
| @@ -0,0 +1,143 @@ | ||||
| From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl> | ||||
| Subject: [PATCH v5 5/8] mac80211: ath9k: enable GPIO buttons | ||||
|  | ||||
| Enable platform-defined GPIO button support for ath9k device. | ||||
| Key poller is activated for attached platform buttons. | ||||
| Requires ath9k GPIO chip access. | ||||
|  | ||||
| Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl> | ||||
| Signed-off-by: Felix Fietkau <nbd@nbd.name> | ||||
| --- | ||||
| --- a/drivers/net/wireless/ath/ath9k/ath9k.h | ||||
| +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | ||||
| @@ -1055,6 +1055,7 @@ struct ath_softc { | ||||
|  	struct list_head leds; | ||||
|  #ifdef CONFIG_GPIOLIB | ||||
|  	struct ath9k_gpio_chip *gpiochip; | ||||
| +	struct platform_device *btnpdev;	/* gpio-keys-polled */ | ||||
|  #endif | ||||
|  #endif | ||||
|   | ||||
| --- a/drivers/net/wireless/ath/ath9k/gpio.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/gpio.c | ||||
| @@ -17,6 +17,8 @@ | ||||
|  #include "ath9k.h" | ||||
|  #include <linux/ath9k_platform.h> | ||||
|  #include <linux/gpio.h> | ||||
| +#include <linux/platform_device.h> | ||||
| +#include <linux/gpio_keys.h> | ||||
|   | ||||
|  #ifdef CPTCFG_MAC80211_LEDS | ||||
|   | ||||
| @@ -133,6 +135,67 @@ static void ath9k_unregister_gpio_chip(s | ||||
|  	sc->gpiochip = NULL; | ||||
|  } | ||||
|   | ||||
| +/******************/ | ||||
| +/*  GPIO Buttons  */ | ||||
| +/******************/ | ||||
| + | ||||
| +/* add GPIO buttons */ | ||||
| +static void ath9k_init_buttons(struct ath_softc *sc) | ||||
| +{ | ||||
| +	struct ath9k_platform_data *pdata = sc->dev->platform_data; | ||||
| +	struct platform_device *pdev; | ||||
| +	struct gpio_keys_platform_data gkpdata; | ||||
| +	struct gpio_keys_button *bt; | ||||
| +	int i; | ||||
| + | ||||
| +	if (!sc->gpiochip) | ||||
| +		return; | ||||
| + | ||||
| +	if (!pdata || !pdata->btns || !pdata->num_btns) | ||||
| +		return; | ||||
| + | ||||
| +	bt = devm_kmemdup(sc->dev, pdata->btns, | ||||
| +			  pdata->num_btns * sizeof(struct gpio_keys_button), | ||||
| +			  GFP_KERNEL); | ||||
| +	if (!bt) | ||||
| +		return; | ||||
| + | ||||
| +	for (i = 0; i < pdata->num_btns; i++) { | ||||
| +		if (pdata->btns[i].gpio == sc->sc_ah->led_pin) | ||||
| +				sc->sc_ah->led_pin = -1; | ||||
| + | ||||
| +		ath9k_hw_gpio_request_in(sc->sc_ah, pdata->btns[i].gpio, | ||||
| +					 "ath9k-gpio"); | ||||
| +		bt[i].gpio = sc->gpiochip->gchip.base + pdata->btns[i].gpio; | ||||
| +	} | ||||
| + | ||||
| +	memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data)); | ||||
| +	gkpdata.buttons = bt; | ||||
| +	gkpdata.nbuttons = pdata->num_btns; | ||||
| +	gkpdata.poll_interval = pdata->btn_poll_interval; | ||||
| + | ||||
| +	pdev = platform_device_register_data(sc->dev, "gpio-keys-polled", | ||||
| +					     PLATFORM_DEVID_AUTO, &gkpdata, | ||||
| +					     sizeof(gkpdata)); | ||||
| +	if (!IS_ERR_OR_NULL(pdev)) | ||||
| +		sc->btnpdev = pdev; | ||||
| +	else { | ||||
| +		sc->btnpdev = NULL; | ||||
| +		devm_kfree(sc->dev, bt); | ||||
| +	} | ||||
| +} | ||||
| + | ||||
| +/* remove GPIO buttons */ | ||||
| +static void ath9k_deinit_buttons(struct ath_softc *sc) | ||||
| +{ | ||||
| +	if (!sc->gpiochip || !sc->btnpdev) | ||||
| +		return; | ||||
| + | ||||
| +	platform_device_unregister(sc->btnpdev); | ||||
| + | ||||
| +	sc->btnpdev = NULL; | ||||
| +} | ||||
| + | ||||
|  #else /* CONFIG_GPIOLIB */ | ||||
|   | ||||
|  static inline void ath9k_register_gpio_chip(struct ath_softc *sc) | ||||
| @@ -143,6 +206,14 @@ static inline void ath9k_unregister_gpio | ||||
|  { | ||||
|  } | ||||
|   | ||||
| +static inline void ath9k_init_buttons(struct ath_softc *sc) | ||||
| +{ | ||||
| +} | ||||
| + | ||||
| +static inline void ath9k_deinit_buttons(struct ath_softc *sc) | ||||
| +{ | ||||
| +} | ||||
| + | ||||
|  #endif /* CONFIG_GPIOLIB */ | ||||
|   | ||||
|  /********************************/ | ||||
| @@ -266,6 +337,7 @@ void ath_deinit_leds(struct ath_softc *s | ||||
|  { | ||||
|  	struct ath_led *led; | ||||
|   | ||||
| +	ath9k_deinit_buttons(sc); | ||||
|  	while (!list_empty(&sc->leds)) { | ||||
|  		led = list_first_entry(&sc->leds, struct ath_led, list); | ||||
|  #ifdef CONFIG_GPIOLIB | ||||
| @@ -305,6 +377,7 @@ void ath_init_leds(struct ath_softc *sc) | ||||
|  	} | ||||
|   | ||||
|  	ath_fill_led_pin(sc); | ||||
| +	ath9k_init_buttons(sc); | ||||
|   | ||||
|  	if (pdata && pdata->leds && pdata->num_leds) | ||||
|  		for (i = 0; i < pdata->num_leds; i++) { | ||||
| --- a/include/linux/ath9k_platform.h | ||||
| +++ b/include/linux/ath9k_platform.h | ||||
| @@ -49,6 +49,10 @@ struct ath9k_platform_data { | ||||
|   | ||||
|  	int num_leds; | ||||
|  	const struct gpio_led *leds; | ||||
| + | ||||
| +	unsigned num_btns; | ||||
| +	const struct gpio_keys_button *btns; | ||||
| +	unsigned btn_poll_interval; | ||||
|  }; | ||||
|   | ||||
|  #endif /* _LINUX_ATH9K_PLATFORM_H */ | ||||
| @@ -0,0 +1,15 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/init.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/init.c | ||||
| @@ -627,6 +627,12 @@ static int ath9k_of_init(struct ath_soft | ||||
|   | ||||
|  	ath_dbg(common, CONFIG, "parsing configuration from OF node\n"); | ||||
|   | ||||
| +	if (of_property_read_bool(np, "qca,disable-2ghz")) | ||||
| +		ah->disable_2ghz = true; | ||||
| + | ||||
| +	if (of_property_read_bool(np, "qca,disable-5ghz")) | ||||
| +		ah->disable_5ghz = true; | ||||
| + | ||||
|  	if (of_property_read_bool(np, "qca,no-eeprom")) { | ||||
|  		/* ath9k-eeprom-<bus>-<id>.bin */ | ||||
|  		scnprintf(eeprom_name, sizeof(eeprom_name), | ||||
| @@ -0,0 +1,418 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/channel.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/channel.c | ||||
| @@ -15,6 +15,8 @@ | ||||
|   */ | ||||
|   | ||||
|  #include "ath9k.h" | ||||
| +#include <linux/ath9k_platform.h> | ||||
| +#include "hsr.h" | ||||
|   | ||||
|  /* Set/change channels.  If the channel is really being changed, it's done | ||||
|   * by reseting the chip.  To accomplish this we must first cleanup any pending | ||||
| @@ -22,6 +24,7 @@ | ||||
|   */ | ||||
|  static int ath_set_channel(struct ath_softc *sc) | ||||
|  { | ||||
| +	struct ath9k_platform_data *pdata = sc->dev->platform_data; | ||||
|  	struct ath_hw *ah = sc->sc_ah; | ||||
|  	struct ath_common *common = ath9k_hw_common(ah); | ||||
|  	struct ieee80211_hw *hw = sc->hw; | ||||
| @@ -42,6 +45,11 @@ static int ath_set_channel(struct ath_so | ||||
|  	ath_dbg(common, CONFIG, "Set channel: %d MHz width: %d\n", | ||||
|  		chan->center_freq, chandef->width); | ||||
|   | ||||
| +	if (pdata && pdata->ubnt_hsr) { | ||||
| +		ath9k_hsr_enable(ah, chandef->width, chan->center_freq); | ||||
| +		ath9k_hsr_status(ah); | ||||
| +	} | ||||
| + | ||||
|  	/* update survey stats for the old channel before switching */ | ||||
|  	spin_lock_irqsave(&common->cc_lock, flags); | ||||
|  	ath_update_survey_stats(sc); | ||||
| --- /dev/null | ||||
| +++ b/drivers/net/wireless/ath/ath9k/hsr.c | ||||
| @@ -0,0 +1,247 @@ | ||||
| +/* | ||||
| + * | ||||
| + * The MIT License (MIT) | ||||
| + * | ||||
| + * Copyright (c) 2015 Kirill Berezin | ||||
| + * | ||||
| + * Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
| + * of this software and associated documentation files (the "Software"), to deal | ||||
| + * in the Software without restriction, including without limitation the rights | ||||
| + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
| + * copies of the Software, and to permit persons to whom the Software is | ||||
| + * furnished to do so, subject to the following conditions: | ||||
| + * | ||||
| + * The above copyright notice and this permission notice shall be included in | ||||
| + * all copies or substantial portions of the Software. | ||||
| + * | ||||
| + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
| + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
| + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
| + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
| + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
| + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
| + * SOFTWARE. | ||||
| + * | ||||
| + */ | ||||
| + | ||||
| +#include <linux/io.h> | ||||
| +#include <linux/slab.h> | ||||
| +#include <linux/module.h> | ||||
| +#include <linux/time.h> | ||||
| +#include <linux/bitops.h> | ||||
| +#include <linux/etherdevice.h> | ||||
| +#include <linux/rtnetlink.h> | ||||
| +#include <asm/unaligned.h> | ||||
| + | ||||
| +#include "hw.h" | ||||
| +#include "ath9k.h" | ||||
| + | ||||
| +#define HSR_GPIO_CSN 8 | ||||
| +#define HSR_GPIO_CLK 6 | ||||
| +#define HSR_GPIO_DOUT 7 | ||||
| +#define HSR_GPIO_DIN 5 | ||||
| + | ||||
| +/* delays are in useconds */ | ||||
| +#define HSR_DELAY_HALF_TICK 100 | ||||
| +#define HSR_DELAY_PRE_WRITE 75 | ||||
| +#define HSR_DELAY_FINAL 20000 | ||||
| +#define HSR_DELAY_TRAILING 200 | ||||
| + | ||||
| +void ath9k_hsr_init(struct ath_hw *ah) | ||||
| +{ | ||||
| +	ath9k_hw_gpio_request_in(ah, HSR_GPIO_DIN, NULL); | ||||
| +	ath9k_hw_gpio_request_out(ah, HSR_GPIO_CSN, NULL, | ||||
| +				  AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | ||||
| +	ath9k_hw_gpio_request_out(ah, HSR_GPIO_CLK, NULL, | ||||
| +				  AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | ||||
| +	ath9k_hw_gpio_request_out(ah, HSR_GPIO_DOUT, NULL, | ||||
| +				  AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | ||||
| + | ||||
| +	ath9k_hw_set_gpio(ah, HSR_GPIO_CSN, 1); | ||||
| +	ath9k_hw_set_gpio(ah, HSR_GPIO_CLK, 0); | ||||
| +	ath9k_hw_set_gpio(ah, HSR_GPIO_DOUT, 0); | ||||
| + | ||||
| +	udelay(HSR_DELAY_TRAILING); | ||||
| +} | ||||
| + | ||||
| +static u32 ath9k_hsr_write_byte(struct ath_hw *ah, int delay, u32 value) | ||||
| +{ | ||||
| +	struct ath_common *common = ath9k_hw_common(ah); | ||||
| +	int i; | ||||
| +	u32 rval = 0; | ||||
| + | ||||
| +	udelay(delay); | ||||
| + | ||||
| +	ath9k_hw_set_gpio(ah, HSR_GPIO_CLK, 0); | ||||
| +	udelay(HSR_DELAY_HALF_TICK); | ||||
| + | ||||
| +	ath9k_hw_set_gpio(ah, HSR_GPIO_CSN, 0); | ||||
| +	udelay(HSR_DELAY_HALF_TICK); | ||||
| + | ||||
| +	for (i = 0; i < 8; ++i) { | ||||
| +		rval = rval << 1; | ||||
| + | ||||
| +		/* pattern is left to right, that is 7-th bit runs first */ | ||||
| +		ath9k_hw_set_gpio(ah, HSR_GPIO_DOUT, (value >> (7 - i)) & 0x1); | ||||
| +		udelay(HSR_DELAY_HALF_TICK); | ||||
| + | ||||
| +		ath9k_hw_set_gpio(ah, HSR_GPIO_CLK, 1); | ||||
| +		udelay(HSR_DELAY_HALF_TICK); | ||||
| + | ||||
| +		rval |= ath9k_hw_gpio_get(ah, HSR_GPIO_DIN); | ||||
| + | ||||
| +		ath9k_hw_set_gpio(ah, HSR_GPIO_CLK, 0); | ||||
| +		udelay(HSR_DELAY_HALF_TICK); | ||||
| +	} | ||||
| + | ||||
| +	ath9k_hw_set_gpio(ah, HSR_GPIO_CSN, 1); | ||||
| +	udelay(HSR_DELAY_HALF_TICK); | ||||
| + | ||||
| +	ath_dbg(common, CONFIG, "ath9k_hsr_write_byte: write byte %d return value is %d %c\n", | ||||
| +		value, rval, rval > 32 ? rval : '-'); | ||||
| + | ||||
| +	return rval & 0xff; | ||||
| +} | ||||
| + | ||||
| +static int ath9k_hsr_write_a_chain(struct ath_hw *ah, char *chain, int items) | ||||
| +{ | ||||
| +	int status = 0; | ||||
| +	int i = 0; | ||||
| +	int err; | ||||
| + | ||||
| +	/* a preamble */ | ||||
| +	ath9k_hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, 0); | ||||
| +	status = ath9k_hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, 0); | ||||
| + | ||||
| +	/* clear HSR's reply buffer */ | ||||
| +	if (status) { | ||||
| +		int loop = 0; | ||||
| + | ||||
| +		for (loop = 0; (loop < 42) && status; ++loop) | ||||
| +			status = ath9k_hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, | ||||
| +						      0); | ||||
| + | ||||
| +		if (loop >= 42) { | ||||
| +			ATH_DBG_WARN(1, | ||||
| +				     "ath9k_hsr_write_a_chain: can't clear an output buffer after a 42 cycles.\n"); | ||||
| +			return -1; | ||||
| +		} | ||||
| +	} | ||||
| + | ||||
| +	for (i = 0; (i < items) && (chain[i] != 0); ++i) | ||||
| +		ath9k_hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, (u32)chain[i]); | ||||
| + | ||||
| +	ath9k_hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, 0); | ||||
| +	mdelay(HSR_DELAY_FINAL / 1000); | ||||
| + | ||||
| +	/* reply */ | ||||
| +	memset(chain, 0, items); | ||||
| + | ||||
| +	ath9k_hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, 0); | ||||
| +	udelay(HSR_DELAY_TRAILING); | ||||
| + | ||||
| +	for (i = 0; i < (items - 1); ++i) { | ||||
| +		u32 ret; | ||||
| + | ||||
| +		ret = ath9k_hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, 0); | ||||
| +		if (ret != 0) | ||||
| +			chain[i] = (char)ret; | ||||
| +		else | ||||
| +			break; | ||||
| + | ||||
| +		udelay(HSR_DELAY_TRAILING); | ||||
| +	} | ||||
| + | ||||
| +	if (i <= 1) | ||||
| +		return 0; | ||||
| + | ||||
| +	err = kstrtoint(chain + 1, 10, &i); | ||||
| +	if (err) | ||||
| +		return err; | ||||
| + | ||||
| +	return i; | ||||
| +} | ||||
| + | ||||
| +int ath9k_hsr_disable(struct ath_hw *ah) | ||||
| +{ | ||||
| +	char cmd[10] = {'b', '4', '0', 0, 0, 0, 0, 0, 0, 0}; | ||||
| +	int ret; | ||||
| + | ||||
| +	ret = ath9k_hsr_write_a_chain(ah, cmd, sizeof(cmd)); | ||||
| +	if ((ret > 0) && (*cmd == 'B')) | ||||
| +		return 0; | ||||
| + | ||||
| +	return -1; | ||||
| +} | ||||
| + | ||||
| +int ath9k_hsr_enable(struct ath_hw *ah, int bw, int fq) | ||||
| +{ | ||||
| +	char cmd[10]; | ||||
| +	int ret; | ||||
| + | ||||
| +	/* Bandwidth argument is 0 sometimes. Assume default 802.11bgn | ||||
| +	 * 20MHz on invalid values | ||||
| +	 */ | ||||
| +	if ((bw != 5) && (bw != 10) && (bw != 20) && (bw != 40)) | ||||
| +		bw = 20; | ||||
| + | ||||
| +	memset(cmd, 0, sizeof(cmd)); | ||||
| +	*cmd = 'b'; | ||||
| +	snprintf(cmd + 1, 3, "%02d", bw); | ||||
| + | ||||
| +	ret = ath9k_hsr_write_a_chain(ah, cmd, sizeof(cmd)); | ||||
| +	if ((*cmd != 'B') || (ret != bw)) { | ||||
| +		ATH_DBG_WARN(1, | ||||
| +			     "ath9k_hsr_enable: failed changing bandwidth -> set (%d,%d) reply (%d, %d)\n", | ||||
| +			     'b', bw, *cmd, ret); | ||||
| +		return -1; | ||||
| +	} | ||||
| + | ||||
| +	memset(cmd, 0, sizeof(cmd)); | ||||
| +	*cmd = 'x'; | ||||
| +	ret = ath9k_hsr_write_a_chain(ah, cmd, sizeof(cmd)); | ||||
| +	if (*cmd != 'X') { | ||||
| +		ATH_DBG_WARN(1, | ||||
| +			     "ath9k_hsr_enable: failed 'x' command -> reply (%d, %d)\n", | ||||
| +			     *cmd, ret); | ||||
| +		return -1; | ||||
| +	} | ||||
| + | ||||
| +	memset(cmd, 0, sizeof(cmd)); | ||||
| +	*cmd = 'm'; | ||||
| +	ret = ath9k_hsr_write_a_chain(ah, cmd, sizeof(cmd)); | ||||
| +	if (*cmd != 'M') { | ||||
| +		ATH_DBG_WARN(1, | ||||
| +			     "ath9k_hsr_enable: failed 'm' command -> reply (%d, %d)\n", | ||||
| +			     *cmd, ret); | ||||
| +		return  -1; | ||||
| +	} | ||||
| + | ||||
| +	memset(cmd, 0, sizeof(cmd)); | ||||
| +	*cmd = 'f'; | ||||
| +	snprintf(cmd + 1, 6, "%05d", fq); | ||||
| +	ret = ath9k_hsr_write_a_chain(ah, cmd, sizeof(cmd)); | ||||
| +	if ((*cmd != 'F') && (ret != fq)) { | ||||
| +		ATH_DBG_WARN(1, | ||||
| +			     "ath9k_hsr_enable: failed set frequency -> reply (%d, %d)\n", | ||||
| +			     *cmd, ret); | ||||
| +		return -1; | ||||
| +	} | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +int ath9k_hsr_status(struct ath_hw *ah) | ||||
| +{ | ||||
| +	char cmd[10] = {'s', 0, 0, 0, 0, 0, 0, 0, 0, 0}; | ||||
| +	int ret; | ||||
| + | ||||
| +	ret = ath9k_hsr_write_a_chain(ah, cmd, sizeof(cmd)); | ||||
| +	if (*cmd != 'S') { | ||||
| +		ATH_DBG_WARN(1, "ath9k_hsr_status: returned %d,%d\n", *cmd, | ||||
| +			     ret); | ||||
| +		return -1; | ||||
| +	} | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| --- /dev/null | ||||
| +++ b/drivers/net/wireless/ath/ath9k/hsr.h | ||||
| @@ -0,0 +1,48 @@ | ||||
| +/* | ||||
| + * The MIT License (MIT) | ||||
| + * | ||||
| + * Copyright (c) 2015 Kirill Berezin | ||||
| + * | ||||
| + * Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
| + * of this software and associated documentation files (the "Software"), to deal | ||||
| + * in the Software without restriction, including without limitation the rights | ||||
| + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
| + * copies of the Software, and to permit persons to whom the Software is | ||||
| + * furnished to do so, subject to the following conditions: | ||||
| + * | ||||
| + * The above copyright notice and this permission notice shall be included in | ||||
| + * all copies or substantial portions of the Software. | ||||
| + * | ||||
| + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
| + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
| + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
| + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
| + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
| + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
| + * SOFTWARE. | ||||
| + */ | ||||
| + | ||||
| +#ifndef HSR_H | ||||
| +#define HSR_H | ||||
| + | ||||
| +#ifdef CPTCFG_ATH9K_UBNTHSR | ||||
| + | ||||
| +void ath9k_hsr_init(struct ath_hw *ah); | ||||
| +int ath9k_hsr_disable(struct ath_hw *ah); | ||||
| +int ath9k_hsr_enable(struct ath_hw *ah, int bw, int fq); | ||||
| +int ath9k_hsr_status(struct ath_hw *ah); | ||||
| + | ||||
| +#else | ||||
| +static inline void ath9k_hsr_init(struct ath_hw *ah) {} | ||||
| + | ||||
| +static inline int ath9k_hsr_enable(struct ath_hw *ah, int bw, int fq) | ||||
| +{ | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +static inline int ath9k_hsr_disable(struct ath_hw *ah) { return 0; } | ||||
| +static inline int ath9k_hsr_status(struct ath_hw *ah) { return 0; } | ||||
| + | ||||
| +#endif | ||||
| + | ||||
| +#endif /* HSR_H */ | ||||
| --- a/drivers/net/wireless/ath/ath9k/main.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/main.c | ||||
| @@ -16,8 +16,10 @@ | ||||
|   | ||||
|  #include <linux/nl80211.h> | ||||
|  #include <linux/delay.h> | ||||
| +#include <linux/ath9k_platform.h> | ||||
|  #include "ath9k.h" | ||||
|  #include "btcoex.h" | ||||
| +#include "hsr.h" | ||||
|   | ||||
|  u8 ath9k_parse_mpdudensity(u8 mpdudensity) | ||||
|  { | ||||
| @@ -649,6 +651,7 @@ void ath_reset_work(struct work_struct * | ||||
|  static int ath9k_start(struct ieee80211_hw *hw) | ||||
|  { | ||||
|  	struct ath_softc *sc = hw->priv; | ||||
| +	struct ath9k_platform_data *pdata = sc->dev->platform_data; | ||||
|  	struct ath_hw *ah = sc->sc_ah; | ||||
|  	struct ath_common *common = ath9k_hw_common(ah); | ||||
|  	struct ieee80211_channel *curchan = sc->cur_chan->chandef.chan; | ||||
| @@ -727,6 +730,11 @@ static int ath9k_start(struct ieee80211_ | ||||
|  					  AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | ||||
|  	} | ||||
|   | ||||
| +	if (pdata && pdata->ubnt_hsr) { | ||||
| +		ath9k_hsr_init(ah); | ||||
| +		ath9k_hsr_disable(ah); | ||||
| +	} | ||||
| + | ||||
|  	/* | ||||
|  	 * Reset key cache to sane defaults (all entries cleared) instead of | ||||
|  	 * semi-random values after suspend/resume. | ||||
| --- a/drivers/net/wireless/ath/ath9k/Makefile | ||||
| +++ b/drivers/net/wireless/ath/ath9k/Makefile | ||||
| @@ -17,6 +17,7 @@ ath9k-$(CPTCFG_ATH9K_DFS_CERTIFIED) += d | ||||
|  ath9k-$(CPTCFG_ATH9K_TX99) += tx99.o | ||||
|  ath9k-$(CPTCFG_ATH9K_WOW) += wow.o | ||||
|  ath9k-$(CPTCFG_ATH9K_HWRNG) += rng.o | ||||
| +ath9k-$(CPTCFG_ATH9K_UBNTHSR) += hsr.o | ||||
|   | ||||
|  ath9k-$(CPTCFG_ATH9K_DEBUGFS) += debug.o | ||||
|   | ||||
| --- a/include/linux/ath9k_platform.h | ||||
| +++ b/include/linux/ath9k_platform.h | ||||
| @@ -53,6 +53,8 @@ struct ath9k_platform_data { | ||||
|  	unsigned num_btns; | ||||
|  	const struct gpio_keys_button *btns; | ||||
|  	unsigned btn_poll_interval; | ||||
| + | ||||
| +	bool ubnt_hsr; | ||||
|  }; | ||||
|   | ||||
|  #endif /* _LINUX_ATH9K_PLATFORM_H */ | ||||
| --- a/local-symbols | ||||
| +++ b/local-symbols | ||||
| @@ -112,6 +112,7 @@ ATH9K_WOW= | ||||
|  ATH9K_RFKILL= | ||||
|  ATH9K_CHANNEL_CONTEXT= | ||||
|  ATH9K_PCOEM= | ||||
| +ATH9K_UBNTHSR= | ||||
|  ATH9K_PCI_NO_EEPROM= | ||||
|  ATH9K_HTC= | ||||
|  ATH9K_HTC_DEBUGFS= | ||||
| --- a/drivers/net/wireless/ath/ath9k/Kconfig | ||||
| +++ b/drivers/net/wireless/ath/ath9k/Kconfig | ||||
| @@ -60,6 +60,19 @@ config ATH9K_AHB | ||||
|  	  Say Y, if you have a SoC with a compatible built-in | ||||
|  	  wireless MAC. Say N if unsure. | ||||
|   | ||||
| +config ATH9K_UBNTHSR | ||||
| +	bool "Ubiquiti UniFi Outdoor Plus HSR support" | ||||
| +	depends on ATH9K | ||||
| +	---help--- | ||||
| +	  This options enables code to control the HSR RF | ||||
| +	  filter in the receive path of the Ubiquiti UniFi | ||||
| +	  Outdoor Plus access point. | ||||
| + | ||||
| +	  Say Y if you want to use the access point. The | ||||
| +	  code will only be used if the device is detected, | ||||
| +	  so it does not harm other setup other than occupying | ||||
| +	  a bit of memory. | ||||
| + | ||||
|  config ATH9K_DEBUGFS | ||||
|  	bool "Atheros ath9k debugging" | ||||
|  	depends on ATH9K && DEBUG_FS | ||||
							
								
								
									
										337
									
								
								feeds/wifi-ath10k/mac80211/patches/ath/552-ahb_of.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										337
									
								
								feeds/wifi-ath10k/mac80211/patches/ath/552-ahb_of.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,337 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/ahb.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/ahb.c | ||||
| @@ -20,7 +20,15 @@ | ||||
|  #include <linux/platform_device.h> | ||||
|  #include <linux/module.h> | ||||
|  #include <linux/mod_devicetable.h> | ||||
| +#include <linux/of_device.h> | ||||
|  #include "ath9k.h" | ||||
| +#include <linux/ath9k_platform.h> | ||||
| + | ||||
| +#ifdef CONFIG_OF | ||||
| +#include <asm/mach-ath79/ath79.h> | ||||
| +#include <asm/mach-ath79/ar71xx_regs.h> | ||||
| +#include <linux/mtd/mtd.h> | ||||
| +#endif | ||||
|   | ||||
|  static const struct platform_device_id ath9k_platform_id_table[] = { | ||||
|  	{ | ||||
| @@ -69,6 +77,242 @@ static const struct ath_bus_ops ath_ahb_ | ||||
|  	.eeprom_read = ath_ahb_eeprom_read, | ||||
|  }; | ||||
|   | ||||
| +#ifdef CONFIG_OF | ||||
| + | ||||
| +#define QCA955X_DDR_CTL_CONFIG          0x108 | ||||
| +#define QCA955X_DDR_CTL_CONFIG_ACT_WMAC BIT(23) | ||||
| + | ||||
| +static int of_get_wifi_cal(struct device_node *np, struct ath9k_platform_data *pdata) | ||||
| +{ | ||||
| +#ifdef CONFIG_MTD | ||||
| +	struct device_node *mtd_np = NULL; | ||||
| +	size_t retlen; | ||||
| +	int size, ret; | ||||
| +	struct mtd_info *mtd; | ||||
| +	const char *part; | ||||
| +	const __be32 *list; | ||||
| +	phandle phandle; | ||||
| + | ||||
| +	list = of_get_property(np, "mtd-cal-data", &size); | ||||
| +	if (!list) | ||||
| +		return 0; | ||||
| + | ||||
| +	if (size != (2 * sizeof(*list))) | ||||
| +		return 1; | ||||
| + | ||||
| +	phandle = be32_to_cpup(list++); | ||||
| +	if (phandle) | ||||
| +		mtd_np = of_find_node_by_phandle(phandle); | ||||
| + | ||||
| +	if (!mtd_np) | ||||
| +		return 1; | ||||
| + | ||||
| +	part = of_get_property(mtd_np, "label", NULL); | ||||
| +	if (!part) | ||||
| +		part = mtd_np->name; | ||||
| + | ||||
| +	mtd = get_mtd_device_nm(part); | ||||
| +	if (IS_ERR(mtd)) | ||||
| +		return 1; | ||||
| + | ||||
| +	ret = mtd_read(mtd, be32_to_cpup(list), sizeof(pdata->eeprom_data), | ||||
| +			&retlen, (u8*)pdata->eeprom_data); | ||||
| +	put_mtd_device(mtd); | ||||
| + | ||||
| +#endif | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +static int ar913x_wmac_reset(void) | ||||
| +{ | ||||
| +	ath79_device_reset_set(AR913X_RESET_AMBA2WMAC); | ||||
| +	mdelay(10); | ||||
| + | ||||
| +	ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC); | ||||
| +	mdelay(10); | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +static int ar933x_wmac_reset(void) | ||||
| +{ | ||||
| +	int retries = 20; | ||||
| + | ||||
| +	ath79_device_reset_set(AR933X_RESET_WMAC); | ||||
| +	ath79_device_reset_clear(AR933X_RESET_WMAC); | ||||
| + | ||||
| +	while (1) { | ||||
| +		u32 bootstrap; | ||||
| + | ||||
| +		bootstrap = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); | ||||
| +		if ((bootstrap & AR933X_BOOTSTRAP_EEPBUSY) == 0) | ||||
| +			return 0; | ||||
| + | ||||
| +		if (retries-- == 0) | ||||
| +			break; | ||||
| + | ||||
| +		udelay(10000); | ||||
| +	} | ||||
| + | ||||
| +	pr_err("ar933x: WMAC reset timed out"); | ||||
| +	return -ETIMEDOUT; | ||||
| +} | ||||
| + | ||||
| +static int qca955x_wmac_reset(void) | ||||
| +{ | ||||
| +	int i; | ||||
| + | ||||
| +	/* Try to wait for WMAC DDR activity to stop */ | ||||
| +	for (i = 0; i < 10; i++) { | ||||
| +		if (!(__raw_readl(ath79_ddr_base + QCA955X_DDR_CTL_CONFIG) & | ||||
| +		    QCA955X_DDR_CTL_CONFIG_ACT_WMAC)) | ||||
| +			break; | ||||
| + | ||||
| +		udelay(10); | ||||
| +	} | ||||
| + | ||||
| +	ath79_device_reset_set(QCA955X_RESET_RTC); | ||||
| +	udelay(10); | ||||
| +	ath79_device_reset_clear(QCA955X_RESET_RTC); | ||||
| +	udelay(10); | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +enum { | ||||
| +	AR913X_WMAC = 0, | ||||
| +	AR933X_WMAC, | ||||
| +	AR934X_WMAC, | ||||
| +	QCA953X_WMAC, | ||||
| +	QCA955X_WMAC, | ||||
| +	QCA956X_WMAC, | ||||
| +}; | ||||
| + | ||||
| +static int ar9330_get_soc_revision(void) | ||||
| +{ | ||||
| +	if (ath79_soc_rev == 1) | ||||
| +		return ath79_soc_rev; | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +static int ath79_get_soc_revision(void) | ||||
| +{ | ||||
| +	return ath79_soc_rev; | ||||
| +} | ||||
| + | ||||
| +static const struct of_ath_ahb_data { | ||||
| +	u16 dev_id; | ||||
| +	u32 bootstrap_reg; | ||||
| +	u32 bootstrap_ref; | ||||
| + | ||||
| +	int (*soc_revision)(void); | ||||
| +	int (*wmac_reset)(void); | ||||
| +} of_ath_ahb_data[] = { | ||||
| +	[AR913X_WMAC] = { | ||||
| +		.dev_id = AR5416_AR9100_DEVID, | ||||
| +		.wmac_reset = ar913x_wmac_reset, | ||||
| + | ||||
| +	}, | ||||
| +	[AR933X_WMAC] = { | ||||
| +		.dev_id = AR9300_DEVID_AR9330, | ||||
| +		.bootstrap_reg = AR933X_RESET_REG_BOOTSTRAP, | ||||
| +		.bootstrap_ref = AR933X_BOOTSTRAP_REF_CLK_40, | ||||
| +		.soc_revision = ar9330_get_soc_revision, | ||||
| +		.wmac_reset = ar933x_wmac_reset, | ||||
| +	}, | ||||
| +	[AR934X_WMAC] = { | ||||
| +		.dev_id = AR9300_DEVID_AR9340, | ||||
| +		.bootstrap_reg = AR934X_RESET_REG_BOOTSTRAP, | ||||
| +		.bootstrap_ref = AR934X_BOOTSTRAP_REF_CLK_40, | ||||
| +		.soc_revision = ath79_get_soc_revision, | ||||
| +	}, | ||||
| +	[QCA953X_WMAC] = { | ||||
| +		.dev_id = AR9300_DEVID_AR953X, | ||||
| +		.bootstrap_reg = QCA953X_RESET_REG_BOOTSTRAP, | ||||
| +		.bootstrap_ref = QCA953X_BOOTSTRAP_REF_CLK_40, | ||||
| +		.soc_revision = ath79_get_soc_revision, | ||||
| +	}, | ||||
| +	[QCA955X_WMAC] = { | ||||
| +		.dev_id = AR9300_DEVID_QCA955X, | ||||
| +		.bootstrap_reg = QCA955X_RESET_REG_BOOTSTRAP, | ||||
| +		.bootstrap_ref = QCA955X_BOOTSTRAP_REF_CLK_40, | ||||
| +		.wmac_reset = qca955x_wmac_reset, | ||||
| +	}, | ||||
| +	[QCA956X_WMAC] = { | ||||
| +		.dev_id = AR9300_DEVID_QCA956X, | ||||
| +		.bootstrap_reg = QCA956X_RESET_REG_BOOTSTRAP, | ||||
| +		.bootstrap_ref = QCA956X_BOOTSTRAP_REF_CLK_40, | ||||
| +		.soc_revision = ath79_get_soc_revision, | ||||
| +	}, | ||||
| +}; | ||||
| + | ||||
| +const struct of_device_id of_ath_ahb_match[] = { | ||||
| +	{ .compatible = "qca,ar9130-wmac", .data = &of_ath_ahb_data[AR913X_WMAC] }, | ||||
| +	{ .compatible = "qca,ar9330-wmac", .data = &of_ath_ahb_data[AR933X_WMAC] }, | ||||
| +	{ .compatible = "qca,ar9340-wmac", .data = &of_ath_ahb_data[AR934X_WMAC] }, | ||||
| +	{ .compatible = "qca,qca9530-wmac", .data = &of_ath_ahb_data[QCA953X_WMAC] }, | ||||
| +	{ .compatible = "qca,qca9550-wmac", .data = &of_ath_ahb_data[QCA955X_WMAC] }, | ||||
| +	{ .compatible = "qca,qca9560-wmac", .data = &of_ath_ahb_data[QCA956X_WMAC] }, | ||||
| +	{}, | ||||
| +}; | ||||
| +MODULE_DEVICE_TABLE(of, of_ath_ahb_match); | ||||
| + | ||||
| +static int of_ath_ahb_probe(struct platform_device *pdev) | ||||
| +{ | ||||
| +	struct ath9k_platform_data *pdata; | ||||
| +	const struct of_device_id *match; | ||||
| +	const struct of_ath_ahb_data *data; | ||||
| +	u8 led_pin; | ||||
| + | ||||
| +	match = of_match_device(of_ath_ahb_match, &pdev->dev); | ||||
| +	data = (const struct of_ath_ahb_data *)match->data; | ||||
| + | ||||
| +	pdata = dev_get_platdata(&pdev->dev); | ||||
| + | ||||
| +	if (!of_property_read_u8(pdev->dev.of_node, "qca,led-pin", &led_pin)) | ||||
| +		pdata->led_pin = led_pin; | ||||
| +	else | ||||
| +		pdata->led_pin = -1; | ||||
| + | ||||
| +	if (of_property_read_bool(pdev->dev.of_node, "qca,disable-2ghz")) | ||||
| +		pdata->disable_2ghz = true; | ||||
| + | ||||
| +	if (of_property_read_bool(pdev->dev.of_node, "qca,disable-5ghz")) | ||||
| +		pdata->disable_5ghz = true; | ||||
| + | ||||
| +	if (of_property_read_bool(pdev->dev.of_node, "qca,tx-gain-buffalo")) | ||||
| +		pdata->tx_gain_buffalo = true; | ||||
| + | ||||
| +	if (data->wmac_reset) { | ||||
| +		data->wmac_reset(); | ||||
| +		pdata->external_reset = data->wmac_reset; | ||||
| +	} | ||||
| + | ||||
| +	if (data->dev_id == AR9300_DEVID_AR953X) { | ||||
| +		/* | ||||
| +		 * QCA953x only supports 25MHz refclk. | ||||
| +		 * Some vendors have an invalid bootstrap option | ||||
| +		 * set, which would break the WMAC here. | ||||
| +		 */ | ||||
| +		pdata->is_clk_25mhz = true; | ||||
| +	} else if (data->bootstrap_reg && data->bootstrap_ref) { | ||||
| +		u32 t = ath79_reset_rr(data->bootstrap_reg); | ||||
| +		if (t & data->bootstrap_ref) | ||||
| +			pdata->is_clk_25mhz = false; | ||||
| +		else | ||||
| +			pdata->is_clk_25mhz = true; | ||||
| +	} | ||||
| + | ||||
| +	pdata->get_mac_revision = data->soc_revision; | ||||
| + | ||||
| +	if (of_get_wifi_cal(pdev->dev.of_node, pdata)) | ||||
| +		dev_err(&pdev->dev, "failed to load calibration data from mtd device\n"); | ||||
| + | ||||
| +	return data->dev_id; | ||||
| +} | ||||
| +#endif | ||||
| + | ||||
|  static int ath_ahb_probe(struct platform_device *pdev) | ||||
|  { | ||||
|  	void __iomem *mem; | ||||
| @@ -80,6 +324,17 @@ static int ath_ahb_probe(struct platform | ||||
|  	int ret = 0; | ||||
|  	struct ath_hw *ah; | ||||
|  	char hw_name[64]; | ||||
| +	u16 dev_id; | ||||
| + | ||||
| +	if (id) | ||||
| +		dev_id = id->driver_data; | ||||
| + | ||||
| +#ifdef CONFIG_OF | ||||
| +	if (pdev->dev.of_node) | ||||
| +		pdev->dev.platform_data = devm_kzalloc(&pdev->dev, | ||||
| +					sizeof(struct ath9k_platform_data), | ||||
| +					GFP_KERNEL); | ||||
| +#endif | ||||
|   | ||||
|  	if (!dev_get_platdata(&pdev->dev)) { | ||||
|  		dev_err(&pdev->dev, "no platform data specified\n"); | ||||
| @@ -122,13 +377,16 @@ static int ath_ahb_probe(struct platform | ||||
|  	sc->mem = mem; | ||||
|  	sc->irq = irq; | ||||
|   | ||||
| +#ifdef CONFIG_OF | ||||
| +	dev_id = of_ath_ahb_probe(pdev); | ||||
| +#endif | ||||
|  	ret = request_irq(irq, ath_isr, IRQF_SHARED, "ath9k", sc); | ||||
|  	if (ret) { | ||||
|  		dev_err(&pdev->dev, "request_irq failed\n"); | ||||
|  		goto err_free_hw; | ||||
|  	} | ||||
|   | ||||
| -	ret = ath9k_init_device(id->driver_data, sc, &ath_ahb_bus_ops); | ||||
| +	ret = ath9k_init_device(dev_id, sc, &ath_ahb_bus_ops); | ||||
|  	if (ret) { | ||||
|  		dev_err(&pdev->dev, "failed to initialize device\n"); | ||||
|  		goto err_irq; | ||||
| @@ -159,6 +417,9 @@ static int ath_ahb_remove(struct platfor | ||||
|  		free_irq(sc->irq, sc); | ||||
|  		ieee80211_free_hw(sc->hw); | ||||
|  	} | ||||
| +#ifdef CONFIG_OF | ||||
| +	pdev->dev.platform_data = NULL; | ||||
| +#endif | ||||
|   | ||||
|  	return 0; | ||||
|  } | ||||
| @@ -168,6 +429,9 @@ static struct platform_driver ath_ahb_dr | ||||
|  	.remove     = ath_ahb_remove, | ||||
|  	.driver		= { | ||||
|  		.name	= "ath9k", | ||||
| +#ifdef CONFIG_OF | ||||
| +		.of_match_table = of_ath_ahb_match, | ||||
| +#endif | ||||
|  	}, | ||||
|  	.id_table    = ath9k_platform_id_table, | ||||
|  }; | ||||
| --- a/drivers/net/wireless/ath/ath9k/ath9k.h | ||||
| +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | ||||
| @@ -25,6 +25,7 @@ | ||||
|  #include <linux/time.h> | ||||
|  #include <linux/hw_random.h> | ||||
|  #include <linux/gpio/driver.h> | ||||
| +#include <linux/reset.h> | ||||
|   | ||||
|  #include "common.h" | ||||
|  #include "debug.h" | ||||
| @@ -1011,6 +1012,9 @@ struct ath_softc { | ||||
|  	struct ath_hw *sc_ah; | ||||
|  	void __iomem *mem; | ||||
|  	int irq; | ||||
| +#ifdef CONFIG_OF | ||||
| +	struct reset_control *reset; | ||||
| +#endif | ||||
|  	spinlock_t sc_serial_rw; | ||||
|  	spinlock_t sc_pm_lock; | ||||
|  	spinlock_t sc_pcu_lock; | ||||
| @@ -0,0 +1,25 @@ | ||||
| --- a/drivers/net/wireless/ath/ath9k/init.c | ||||
| +++ b/drivers/net/wireless/ath/ath9k/init.c | ||||
| @@ -654,6 +654,12 @@ static int ath9k_of_init(struct ath_soft | ||||
|  	return 0; | ||||
|  } | ||||
|   | ||||
| +static void ath9k_of_gpio_mask(struct ath_softc *sc) | ||||
| +{ | ||||
| +	of_property_read_u32(sc->dev->of_node, "qca,gpio-mask", | ||||
| +			     &sc->sc_ah->caps.gpio_mask); | ||||
| +} | ||||
| + | ||||
|  static int ath9k_init_softc(u16 devid, struct ath_softc *sc, | ||||
|  			    const struct ath_bus_ops *bus_ops) | ||||
|  { | ||||
| @@ -758,6 +764,9 @@ static int ath9k_init_softc(u16 devid, s | ||||
|  	if (ret) | ||||
|  		goto err_hw; | ||||
|   | ||||
| +	/* GPIO mask quirk */ | ||||
| +	ath9k_of_gpio_mask(sc); | ||||
| + | ||||
|  	ret = ath9k_init_queues(sc); | ||||
|  	if (ret) | ||||
|  		goto err_queues; | ||||
| @@ -0,0 +1,33 @@ | ||||
| From: Sven Eckelmann <sven@open-mesh.com> | ||||
| Date: Tue, 18 Nov 2014 12:29:28 +0100 | ||||
| Subject: [PATCH] ath10k: Don't initialize devices asynchronously | ||||
|  | ||||
| OpenWrt requires all PHYs to be initialized to create the configuration files | ||||
| during bootup. ath10k violates this because it delays the creation of the PHY | ||||
| to a not well defined point in the future. | ||||
|  | ||||
| Forcing the work to be done immediately works around this problem but may also | ||||
| delay the boot when firmware images cannot be found. | ||||
|  | ||||
| Signed-off-by: Sven Eckelmann <sven@open-mesh.com> | ||||
| --- | ||||
|  | ||||
| --- a/drivers/net/wireless/ath/ath10k/core.c | ||||
| +++ b/drivers/net/wireless/ath/ath10k/core.c | ||||
| @@ -3172,6 +3172,16 @@ int ath10k_core_register(struct ath10k * | ||||
|   | ||||
|  	queue_work(ar->workqueue, &ar->register_work); | ||||
|   | ||||
| +	/* OpenWrt requires all PHYs to be initialized to create the | ||||
| +	 * configuration files during bootup. ath10k violates this | ||||
| +	 * because it delays the creation of the PHY to a not well defined | ||||
| +	 * point in the future. | ||||
| +	 * | ||||
| +	 * Forcing the work to be done immediately works around this problem | ||||
| +	 * but may also delay the boot when firmware images cannot be found. | ||||
| +	 */ | ||||
| +	flush_workqueue(ar->workqueue); | ||||
| + | ||||
|  	return 0; | ||||
|  } | ||||
|  EXPORT_SYMBOL(ath10k_core_register); | ||||
| @@ -0,0 +1,37 @@ | ||||
| From: Linus Lüssing <ll@simonwunderlich.de> | ||||
| Date: Wed, 5 Feb 2020 20:10:43 +0100 | ||||
| Subject: ath10k: increase rx buffer size to 2048 | ||||
|  | ||||
| Before, only frames with a maximum size of 1528 bytes could be | ||||
| transmitted between two 802.11s nodes. | ||||
|  | ||||
| For batman-adv for instance, which adds its own header to each frame, | ||||
| we typically need an MTU of at least 1532 bytes to be able to transmit | ||||
| without fragmentation. | ||||
|  | ||||
| This patch now increases the maxmimum frame size from 1528 to 1656 | ||||
| bytes. | ||||
|  | ||||
| Tested with two ath10k devices in 802.11s mode, as well as with | ||||
| batman-adv on top of 802.11s with forwarding disabled. | ||||
|  | ||||
| Fix originally found and developed by Ben Greear. | ||||
|  | ||||
| Link: https://github.com/greearb/ath10k-ct/issues/89 | ||||
| Link: https://github.com/greearb/ath10k-ct/commit/9e5ab25027e0971fa24ccf93373324c08c4e992d | ||||
| Cc: Ben Greear <greearb@candelatech.com> | ||||
| Signed-off-by: Linus Lüssing <ll@simonwunderlich.de> | ||||
|  | ||||
| Forwarded: https://patchwork.kernel.org/patch/11367055/ | ||||
|  | ||||
| --- a/drivers/net/wireless/ath/ath10k/htt.h | ||||
| +++ b/drivers/net/wireless/ath/ath10k/htt.h | ||||
| @@ -2242,7 +2242,7 @@ struct htt_rx_chan_info { | ||||
|   * Should be: sizeof(struct htt_host_rx_desc) + max rx MSDU size, | ||||
|   * rounded up to a cache line size. | ||||
|   */ | ||||
| -#define HTT_RX_BUF_SIZE 1920 | ||||
| +#define HTT_RX_BUF_SIZE 2048 | ||||
|  #define HTT_RX_MSDU_SIZE (HTT_RX_BUF_SIZE - (int)sizeof(struct htt_rx_desc)) | ||||
|   | ||||
|  /* Refill a bunch of RX buffers for each refill round so that FW/HW can handle | ||||
| @@ -0,0 +1,37 @@ | ||||
| --- a/drivers/net/wireless/ath/ath10k/mac.c | ||||
| +++ b/drivers/net/wireless/ath/ath10k/mac.c | ||||
| @@ -9053,6 +9053,21 @@ static int ath10k_mac_init_rd(struct ath | ||||
|  	return 0; | ||||
|  } | ||||
|   | ||||
| +#ifdef CPTCFG_MAC80211_LEDS | ||||
| +static const struct ieee80211_tpt_blink ath10k_tpt_blink[] = { | ||||
| +	{ .throughput = 0 * 1024, .blink_time = 334 }, | ||||
| +	{ .throughput = 1 * 1024, .blink_time = 260 }, | ||||
| +	{ .throughput = 2 * 1024, .blink_time = 220 }, | ||||
| +	{ .throughput = 5 * 1024, .blink_time = 190 }, | ||||
| +	{ .throughput = 10 * 1024, .blink_time = 170 }, | ||||
| +	{ .throughput = 25 * 1024, .blink_time = 150 }, | ||||
| +	{ .throughput = 54 * 1024, .blink_time = 130 }, | ||||
| +	{ .throughput = 120 * 1024, .blink_time = 110 }, | ||||
| +	{ .throughput = 265 * 1024, .blink_time = 80 }, | ||||
| +	{ .throughput = 586 * 1024, .blink_time = 50 }, | ||||
| +}; | ||||
| +#endif | ||||
| + | ||||
|  int ath10k_mac_register(struct ath10k *ar) | ||||
|  { | ||||
|  	static const u32 cipher_suites[] = { | ||||
| @@ -9380,6 +9395,12 @@ int ath10k_mac_register(struct ath10k *a | ||||
|   | ||||
|  	ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; | ||||
|   | ||||
| +#ifdef CPTCFG_MAC80211_LEDS | ||||
| +	ieee80211_create_tpt_led_trigger(ar->hw, | ||||
| +		IEEE80211_TPT_LEDTRIG_FL_RADIO, ath10k_tpt_blink, | ||||
| +		ARRAY_SIZE(ath10k_tpt_blink)); | ||||
| +#endif | ||||
| + | ||||
|  	ret = ieee80211_register_hw(ar->hw); | ||||
|  	if (ret) { | ||||
|  		ath10k_err(ar, "failed to register ieee80211: %d\n", ret); | ||||
| @@ -0,0 +1,609 @@ | ||||
| From: Sebastian Gottschall <s.gottschall@newmedia-net.de> | ||||
|  | ||||
| Adds LED and GPIO Control support for 988x, 9887, 9888, 99x0, 9984 based | ||||
| chipsets with on chipset connected led's using WMI Firmware API.  The LED | ||||
| device will get available named as "ath10k-phyX" at sysfs and can be controlled | ||||
| with various triggers.  adds also debugfs interface for gpio control. | ||||
|  | ||||
| This patch is specific for OpenWRt base, as is use old backported package | ||||
| with old wireless source. Support for QCA9984 is removed and a simbol | ||||
| is added to local-simbol file to export the actually compile the code  | ||||
| with the ATH10K_LEDS simbol. | ||||
|  | ||||
|  | ||||
| Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com> | ||||
| Reviewed-by: Steve deRosier <derosier@cal-sierra.com> | ||||
| [kvalo: major reorg and cleanup] | ||||
| Signed-off-by: Kalle Valo <kvalo@codeaurora.org> | ||||
| Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com> | ||||
| --- | ||||
|  | ||||
| v13: | ||||
|  | ||||
| * only compile tested! | ||||
|  | ||||
| * fix all checkpatch warnings | ||||
|  | ||||
| * fix commit log | ||||
|  | ||||
| * sizeof(struct ath10k_gpiocontrol) -> sizeof(*gpio) | ||||
|  | ||||
| * unsigned -> unsigned int | ||||
|  | ||||
| * remove GPIOLIB code, that should be added in a separate patch | ||||
|  | ||||
| * rename gpio.c to leds.c | ||||
|  | ||||
| * add leds.h | ||||
|  | ||||
| * rename some functions: | ||||
|  | ||||
|   ath10k_attach_led() -> ath10k_leds_register() | ||||
|   ath10k_unregister_led() -> ath10k_leds_unregister() | ||||
|   ath10k_reset_led_pin() -> ath10k_leds_start() | ||||
|  | ||||
| * call ath10k_leds_unregister() before ath10k_thermal_unregister() to preserve ordering | ||||
|  | ||||
| * call ath10k_leds_start() only from ath10k_core_start() and not from mac.c | ||||
|  | ||||
| * rename struct ath10k_gpiocontrol as anonymous function under struct | ||||
|   ath10k::leds, no need for memory allocation | ||||
|  | ||||
| * merge ath10k_add_led() to ath10k_attach_led(), which is it's only caller | ||||
|  | ||||
| * remove #if IS_ENABLED() checks from most of places, memory savings from those were not worth it | ||||
|  | ||||
| * Kconfig help text improvement and move it lower in the menu, also don't enable it by default | ||||
|  | ||||
| * switch to set_brightness_blocking() so that the callback can sleep, | ||||
|   then no need to use ath10k_wmi_cmd_send_nowait() and can take mutex | ||||
|   to access ar->state | ||||
|  | ||||
| * don't touch ath10k_wmi_pdev_get_temperature() | ||||
|  | ||||
| * as QCA6174/QCA9377 are not (yet) supported don't add the command to WMI-TLV interface | ||||
|  | ||||
| * remove debugfs interface, that should be added in another patch | ||||
|  | ||||
| * cleanup includes | ||||
|  | ||||
|  | ||||
|  drivers/net/wireless/ath/ath10k/Kconfig   |  10 +++ | ||||
|  drivers/net/wireless/ath/ath10k/Makefile  |   1 + | ||||
|  drivers/net/wireless/ath/ath10k/core.c    |  22 +++++++ | ||||
|  drivers/net/wireless/ath/ath10k/core.h    |   9 ++- | ||||
|  drivers/net/wireless/ath/ath10k/hw.h      |   1 + | ||||
|  drivers/net/wireless/ath/ath10k/leds.c    | 103 ++++++++++++++++++++++++++++++ | ||||
|  drivers/net/wireless/ath/ath10k/leds.h    |  45 +++++++++++++ | ||||
|  drivers/net/wireless/ath/ath10k/mac.c     |   1 + | ||||
|  drivers/net/wireless/ath/ath10k/wmi-ops.h |  32 ++++++++++ | ||||
|  drivers/net/wireless/ath/ath10k/wmi-tlv.c |   2 + | ||||
|  drivers/net/wireless/ath/ath10k/wmi.c     |  54 ++++++++++++++++ | ||||
|  drivers/net/wireless/ath/ath10k/wmi.h     |  35 ++++++++++ | ||||
|  12 files changed, 314 insertions(+), 1 deletion(-) | ||||
|  create mode 100644 drivers/net/wireless/ath/ath10k/leds.c | ||||
|  create mode 100644 drivers/net/wireless/ath/ath10k/leds.h | ||||
| --- a/drivers/net/wireless/ath/ath10k/Kconfig | ||||
| +++ b/drivers/net/wireless/ath/ath10k/Kconfig | ||||
| @@ -70,6 +70,16 @@ config ATH10K_DEBUGFS | ||||
|   | ||||
|  	  If unsure, say Y to make it easier to debug problems. | ||||
|   | ||||
| +config ATH10K_LEDS | ||||
| +	bool "Atheros ath10k LED support" | ||||
| +	depends on ATH10K | ||||
| +	select MAC80211_LEDS | ||||
| +	select LEDS_CLASS | ||||
| +	select NEW_LEDS | ||||
| +	default y | ||||
| +	---help--- | ||||
| +	  This option is necessary, if you want LED support for chipset connected led pins. If unsure, say N. | ||||
| + | ||||
|  config ATH10K_SPECTRAL | ||||
|  	bool "Atheros ath10k spectral scan support" | ||||
|  	depends on ATH10K_DEBUGFS | ||||
| --- a/drivers/net/wireless/ath/ath10k/Makefile | ||||
| +++ b/drivers/net/wireless/ath/ath10k/Makefile | ||||
| @@ -19,6 +19,7 @@ ath10k_core-$(CPTCFG_ATH10K_SPECTRAL) += | ||||
|  ath10k_core-$(CPTCFG_NL80211_TESTMODE) += testmode.o | ||||
|  ath10k_core-$(CPTCFG_ATH10K_TRACING) += trace.o | ||||
|  ath10k_core-$(CPTCFG_ATH10K_THERMAL) += thermal.o | ||||
| +ath10k_core-$(CPTCFG_ATH10K_LEDS) += leds.o | ||||
|  ath10k_core-$(CPTCFG_MAC80211_DEBUGFS) += debugfs_sta.o | ||||
|  ath10k_core-$(CONFIG_PM) += wow.o | ||||
|  ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o | ||||
| --- a/local-symbols | ||||
| +++ b/local-symbols | ||||
| @@ -145,6 +145,7 @@ ATH10K_DEBUG= | ||||
|  ATH10K_DEBUGFS= | ||||
|  ATH10K_SPECTRAL= | ||||
|  ATH10K_THERMAL= | ||||
| +ATH10K_LEDS= | ||||
|  ATH10K_TRACING= | ||||
|  ATH10K_DFS_CERTIFIED= | ||||
|  WCN36XX= | ||||
| --- a/drivers/net/wireless/ath/ath10k/core.c | ||||
| +++ b/drivers/net/wireless/ath/ath10k/core.c | ||||
| @@ -25,6 +25,7 @@ | ||||
|  #include "testmode.h" | ||||
|  #include "wmi-ops.h" | ||||
|  #include "coredump.h" | ||||
| +#include "leds.h" | ||||
|   | ||||
|  unsigned int ath10k_debug_mask; | ||||
|  EXPORT_SYMBOL(ath10k_debug_mask); | ||||
| @@ -61,6 +62,7 @@ static const struct ath10k_hw_params ath | ||||
|  		.dev_id = QCA988X_2_0_DEVICE_ID, | ||||
|  		.bus = ATH10K_BUS_PCI, | ||||
|  		.name = "qca988x hw2.0", | ||||
| +		.led_pin = 1, | ||||
|  		.patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, | ||||
|  		.uart_pin = 7, | ||||
|  		.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, | ||||
| @@ -131,6 +133,7 @@ static const struct ath10k_hw_params ath | ||||
|  		.dev_id = QCA9887_1_0_DEVICE_ID, | ||||
|  		.bus = ATH10K_BUS_PCI, | ||||
|  		.name = "qca9887 hw1.0", | ||||
| +		.led_pin = 1, | ||||
|  		.patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, | ||||
|  		.uart_pin = 7, | ||||
|  		.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, | ||||
| @@ -340,6 +343,7 @@ static const struct ath10k_hw_params ath | ||||
|  		.dev_id = QCA99X0_2_0_DEVICE_ID, | ||||
|  		.bus = ATH10K_BUS_PCI, | ||||
|  		.name = "qca99x0 hw2.0", | ||||
| +		.led_pin = 17, | ||||
|  		.patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, | ||||
|  		.uart_pin = 7, | ||||
|  		.otp_exe_param = 0x00000700, | ||||
| @@ -381,6 +385,7 @@ static const struct ath10k_hw_params ath | ||||
|  		.dev_id = QCA9984_1_0_DEVICE_ID, | ||||
|  		.bus = ATH10K_BUS_PCI, | ||||
|  		.name = "qca9984/qca9994 hw1.0", | ||||
| +		.led_pin = 17, | ||||
|  		.patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, | ||||
|  		.uart_pin = 7, | ||||
|  		.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, | ||||
| @@ -429,6 +434,7 @@ static const struct ath10k_hw_params ath | ||||
|  		.dev_id = QCA9888_2_0_DEVICE_ID, | ||||
|  		.bus = ATH10K_BUS_PCI, | ||||
|  		.name = "qca9888 hw2.0", | ||||
| +		.led_pin = 17, | ||||
|  		.patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, | ||||
|  		.uart_pin = 7, | ||||
|  		.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, | ||||
| @@ -2887,6 +2893,10 @@ int ath10k_core_start(struct ath10k *ar, | ||||
|  		goto err_hif_stop; | ||||
|  	} | ||||
|   | ||||
| +	status = ath10k_leds_start(ar); | ||||
| +	if (status) | ||||
| +		goto err_hif_stop; | ||||
| + | ||||
|  	return 0; | ||||
|   | ||||
|  err_hif_stop: | ||||
| @@ -3145,9 +3155,18 @@ static void ath10k_core_register_work(st | ||||
|  		goto err_spectral_destroy; | ||||
|  	} | ||||
|   | ||||
| +	status = ath10k_leds_register(ar); | ||||
| +	if (status) { | ||||
| +		ath10k_err(ar, "could not register leds: %d\n", | ||||
| +			   status); | ||||
| +		goto err_thermal_unregister; | ||||
| +	} | ||||
| + | ||||
|  	set_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags); | ||||
|  	return; | ||||
|   | ||||
| +err_thermal_unregister: | ||||
| +	ath10k_thermal_unregister(ar); | ||||
|  err_spectral_destroy: | ||||
|  	ath10k_spectral_destroy(ar); | ||||
|  err_debug_destroy: | ||||
| @@ -3193,6 +3212,8 @@ void ath10k_core_unregister(struct ath10 | ||||
|  	if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) | ||||
|  		return; | ||||
|   | ||||
| +	ath10k_leds_unregister(ar); | ||||
| + | ||||
|  	ath10k_thermal_unregister(ar); | ||||
|  	/* Stop spectral before unregistering from mac80211 to remove the | ||||
|  	 * relayfs debugfs file cleanly. Otherwise the parent debugfs tree | ||||
| --- a/drivers/net/wireless/ath/ath10k/core.h | ||||
| +++ b/drivers/net/wireless/ath/ath10k/core.h | ||||
| @@ -14,6 +14,7 @@ | ||||
|  #include <linux/pci.h> | ||||
|  #include <linux/uuid.h> | ||||
|  #include <linux/time.h> | ||||
| +#include <linux/leds.h> | ||||
|   | ||||
|  #include "htt.h" | ||||
|  #include "htc.h" | ||||
| @@ -1216,6 +1217,13 @@ struct ath10k { | ||||
|  	} testmode; | ||||
|   | ||||
|  	struct { | ||||
| +		struct gpio_led wifi_led; | ||||
| +		struct led_classdev cdev; | ||||
| +		char label[48]; | ||||
| +		u32 gpio_state_pin; | ||||
| +	} leds; | ||||
| + | ||||
| +	struct { | ||||
|  		/* protected by data_lock */ | ||||
|  		u32 rx_crc_err_drop; | ||||
|  		u32 fw_crash_counter; | ||||
| --- a/drivers/net/wireless/ath/ath10k/hw.h | ||||
| +++ b/drivers/net/wireless/ath/ath10k/hw.h | ||||
| @@ -517,6 +517,7 @@ struct ath10k_hw_params { | ||||
|  	const char *name; | ||||
|  	u32 patch_load_addr; | ||||
|  	int uart_pin; | ||||
| +	int led_pin; | ||||
|  	u32 otp_exe_param; | ||||
|   | ||||
|  	/* Type of hw cycle counter wraparound logic, for more info | ||||
| --- /dev/null | ||||
| +++ b/drivers/net/wireless/ath/ath10k/leds.c | ||||
| @@ -0,0 +1,103 @@ | ||||
| +/* | ||||
| + * Copyright (c) 2005-2011 Atheros Communications Inc. | ||||
| + * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. | ||||
| + * Copyright (c) 2018 Sebastian Gottschall <s.gottschall@dd-wrt.com> | ||||
| + * Copyright (c) 2018, The Linux Foundation. All rights reserved. | ||||
| + * | ||||
| + * 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/leds.h> | ||||
| + | ||||
| +#include "core.h" | ||||
| +#include "wmi.h" | ||||
| +#include "wmi-ops.h" | ||||
| + | ||||
| +#include "leds.h" | ||||
| + | ||||
| +static int ath10k_leds_set_brightness_blocking(struct led_classdev *led_cdev, | ||||
| +					       enum led_brightness brightness) | ||||
| +{ | ||||
| +	struct ath10k *ar = container_of(led_cdev, struct ath10k, | ||||
| +					 leds.cdev); | ||||
| +	struct gpio_led *led = &ar->leds.wifi_led; | ||||
| + | ||||
| +	mutex_lock(&ar->conf_mutex); | ||||
| + | ||||
| +	if (ar->state != ATH10K_STATE_ON) | ||||
| +		goto out; | ||||
| + | ||||
| +	ar->leds.gpio_state_pin = (brightness != LED_OFF) ^ led->active_low; | ||||
| +	ath10k_wmi_gpio_output(ar, led->gpio, ar->leds.gpio_state_pin); | ||||
| + | ||||
| +out: | ||||
| +	mutex_unlock(&ar->conf_mutex); | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +int ath10k_leds_start(struct ath10k *ar) | ||||
| +{ | ||||
| +	if (ar->hw_params.led_pin == 0) | ||||
| +		/* leds not supported */ | ||||
| +		return 0; | ||||
| + | ||||
| +	/* under some circumstances, the gpio pin gets reconfigured | ||||
| +	 * to default state by the firmware, so we need to | ||||
| +	 * reconfigure it this behaviour has only ben seen on | ||||
| +	 * QCA9984 and QCA99XX devices so far | ||||
| +	 */ | ||||
| +	ath10k_wmi_gpio_config(ar, ar->hw_params.led_pin, 0, | ||||
| +			       WMI_GPIO_PULL_NONE, WMI_GPIO_INTTYPE_DISABLE); | ||||
| +	ath10k_wmi_gpio_output(ar, ar->hw_params.led_pin, 1); | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +int ath10k_leds_register(struct ath10k *ar) | ||||
| +{ | ||||
| +	int ret; | ||||
| + | ||||
| +	if (ar->hw_params.led_pin == 0) | ||||
| +		/* leds not supported */ | ||||
| +		return 0; | ||||
| + | ||||
| +	snprintf(ar->leds.label, sizeof(ar->leds.label), "ath10k-%s", | ||||
| +		 wiphy_name(ar->hw->wiphy)); | ||||
| +	ar->leds.wifi_led.active_low = 1; | ||||
| +	ar->leds.wifi_led.gpio = ar->hw_params.led_pin; | ||||
| +	ar->leds.wifi_led.name = ar->leds.label; | ||||
| +	ar->leds.wifi_led.default_state = LEDS_GPIO_DEFSTATE_KEEP; | ||||
| + | ||||
| +	ar->leds.cdev.name = ar->leds.label; | ||||
| +	ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking; | ||||
| + | ||||
| +	/* FIXME: this assignment doesn't make sense as it's NULL, remove it? */ | ||||
| +	ar->leds.cdev.default_trigger = ar->leds.wifi_led.default_trigger; | ||||
| + | ||||
| +	ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); | ||||
| +	if (ret) | ||||
| +		return ret; | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +void ath10k_leds_unregister(struct ath10k *ar) | ||||
| +{ | ||||
| +	if (ar->hw_params.led_pin == 0) | ||||
| +		/* leds not supported */ | ||||
| +		return; | ||||
| + | ||||
| +	led_classdev_unregister(&ar->leds.cdev); | ||||
| +} | ||||
| + | ||||
| --- /dev/null | ||||
| +++ b/drivers/net/wireless/ath/ath10k/leds.h | ||||
| @@ -0,0 +1,41 @@ | ||||
| +/* | ||||
| + * Copyright (c) 2018, The Linux Foundation. All rights reserved. | ||||
| + * | ||||
| + * 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 _LEDS_H_ | ||||
| +#define _LEDS_H_ | ||||
| + | ||||
| +#include "core.h" | ||||
| + | ||||
| +#ifdef CPTCFG_ATH10K_LEDS | ||||
| +void ath10k_leds_unregister(struct ath10k *ar); | ||||
| +int ath10k_leds_start(struct ath10k *ar); | ||||
| +int ath10k_leds_register(struct ath10k *ar); | ||||
| +#else | ||||
| +static inline void ath10k_leds_unregister(struct ath10k *ar) | ||||
| +{ | ||||
| +} | ||||
| + | ||||
| +static inline int ath10k_leds_start(struct ath10k *ar) | ||||
| +{ | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +static inline int ath10k_leds_register(struct ath10k *ar) | ||||
| +{ | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +#endif | ||||
| +#endif /* _LEDS_H_ */ | ||||
| --- a/drivers/net/wireless/ath/ath10k/mac.c | ||||
| +++ b/drivers/net/wireless/ath/ath10k/mac.c | ||||
| @@ -24,6 +24,7 @@ | ||||
|  #include "wmi-tlv.h" | ||||
|  #include "wmi-ops.h" | ||||
|  #include "wow.h" | ||||
| +#include "leds.h" | ||||
|   | ||||
|  /*********/ | ||||
|  /* Rates */ | ||||
| --- a/drivers/net/wireless/ath/ath10k/wmi-ops.h | ||||
| +++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h | ||||
| @@ -224,7 +224,10 @@ struct wmi_ops { | ||||
|  	struct sk_buff *(*gen_bb_timing) | ||||
|  			(struct ath10k *ar, | ||||
|  			 const struct wmi_bb_timing_cfg_arg *arg); | ||||
| +	struct sk_buff *(*gen_gpio_config)(struct ath10k *ar, u32 gpio_num, | ||||
| +					   u32 input, u32 pull_type, u32 intr_mode); | ||||
|   | ||||
| +	struct sk_buff *(*gen_gpio_output)(struct ath10k *ar, u32 gpio_num, u32 set); | ||||
|  }; | ||||
|   | ||||
|  int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id); | ||||
| @@ -1120,6 +1123,35 @@ ath10k_wmi_force_fw_hang(struct ath10k * | ||||
|  	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid); | ||||
|  } | ||||
|   | ||||
| +static inline int ath10k_wmi_gpio_config(struct ath10k *ar, u32 gpio_num, | ||||
| +					 u32 input, u32 pull_type, u32 intr_mode) | ||||
| +{ | ||||
| +	struct sk_buff *skb; | ||||
| + | ||||
| +	if (!ar->wmi.ops->gen_gpio_config) | ||||
| +		return -EOPNOTSUPP; | ||||
| + | ||||
| +	skb = ar->wmi.ops->gen_gpio_config(ar, gpio_num, input, pull_type, intr_mode); | ||||
| +	if (IS_ERR(skb)) | ||||
| +		return PTR_ERR(skb); | ||||
| + | ||||
| +	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->gpio_config_cmdid); | ||||
| +} | ||||
| + | ||||
| +static inline int ath10k_wmi_gpio_output(struct ath10k *ar, u32 gpio_num, u32 set) | ||||
| +{ | ||||
| +	struct sk_buff *skb; | ||||
| + | ||||
| +	if (!ar->wmi.ops->gen_gpio_config) | ||||
| +		return -EOPNOTSUPP; | ||||
| + | ||||
| +	skb = ar->wmi.ops->gen_gpio_output(ar, gpio_num, set); | ||||
| +	if (IS_ERR(skb)) | ||||
| +		return PTR_ERR(skb); | ||||
| + | ||||
| +	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->gpio_output_cmdid); | ||||
| +} | ||||
| + | ||||
|  static inline int | ||||
|  ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level) | ||||
|  { | ||||
| --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c | ||||
| +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c | ||||
| @@ -4583,6 +4583,8 @@ static const struct wmi_ops wmi_tlv_ops | ||||
|  	.gen_echo = ath10k_wmi_tlv_op_gen_echo, | ||||
|  	.gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, | ||||
|  	.gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable, | ||||
| +	/* .gen_gpio_config not implemented */ | ||||
| +	/* .gen_gpio_output not implemented */ | ||||
|  }; | ||||
|   | ||||
|  static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = { | ||||
| --- a/drivers/net/wireless/ath/ath10k/wmi.c | ||||
| +++ b/drivers/net/wireless/ath/ath10k/wmi.c | ||||
| @@ -7471,6 +7471,49 @@ ath10k_wmi_op_gen_peer_set_param(struct | ||||
|  	return skb; | ||||
|  } | ||||
|   | ||||
| +static struct sk_buff *ath10k_wmi_op_gen_gpio_config(struct ath10k *ar, | ||||
| +						     u32 gpio_num, u32 input, | ||||
| +						     u32 pull_type, u32 intr_mode) | ||||
| +{ | ||||
| +	struct wmi_gpio_config_cmd *cmd; | ||||
| +	struct sk_buff *skb; | ||||
| + | ||||
| +	skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | ||||
| +	if (!skb) | ||||
| +		return ERR_PTR(-ENOMEM); | ||||
| + | ||||
| +	cmd = (struct wmi_gpio_config_cmd *)skb->data; | ||||
| +	cmd->pull_type = __cpu_to_le32(pull_type); | ||||
| +	cmd->gpio_num = __cpu_to_le32(gpio_num); | ||||
| +	cmd->input = __cpu_to_le32(input); | ||||
| +	cmd->intr_mode = __cpu_to_le32(intr_mode); | ||||
| + | ||||
| +	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi gpio_config gpio_num 0x%08x input 0x%08x pull_type 0x%08x intr_mode 0x%08x\n", | ||||
| +		   gpio_num, input, pull_type, intr_mode); | ||||
| + | ||||
| +	return skb; | ||||
| +} | ||||
| + | ||||
| +static struct sk_buff *ath10k_wmi_op_gen_gpio_output(struct ath10k *ar, | ||||
| +						     u32 gpio_num, u32 set) | ||||
| +{ | ||||
| +	struct wmi_gpio_output_cmd *cmd; | ||||
| +	struct sk_buff *skb; | ||||
| + | ||||
| +	skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); | ||||
| +	if (!skb) | ||||
| +		return ERR_PTR(-ENOMEM); | ||||
| + | ||||
| +	cmd = (struct wmi_gpio_output_cmd *)skb->data; | ||||
| +	cmd->gpio_num = __cpu_to_le32(gpio_num); | ||||
| +	cmd->set = __cpu_to_le32(set); | ||||
| + | ||||
| +	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi gpio_output gpio_num 0x%08x set 0x%08x\n", | ||||
| +		   gpio_num, set); | ||||
| + | ||||
| +	return skb; | ||||
| +} | ||||
| + | ||||
|  static struct sk_buff * | ||||
|  ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, | ||||
|  			     enum wmi_sta_ps_mode psmode) | ||||
| @@ -9129,6 +9172,9 @@ static const struct wmi_ops wmi_ops = { | ||||
|  	.fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill, | ||||
|  	.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, | ||||
|  	.gen_echo = ath10k_wmi_op_gen_echo, | ||||
| +	.gen_gpio_config = ath10k_wmi_op_gen_gpio_config, | ||||
| +	.gen_gpio_output = ath10k_wmi_op_gen_gpio_output, | ||||
| + | ||||
|  	/* .gen_bcn_tmpl not implemented */ | ||||
|  	/* .gen_prb_tmpl not implemented */ | ||||
|  	/* .gen_p2p_go_bcn_ie not implemented */ | ||||
| @@ -9199,6 +9245,8 @@ static const struct wmi_ops wmi_10_1_ops | ||||
|  	.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, | ||||
|  	.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, | ||||
|  	.gen_echo = ath10k_wmi_op_gen_echo, | ||||
| +	.gen_gpio_config = ath10k_wmi_op_gen_gpio_config, | ||||
| +	.gen_gpio_output = ath10k_wmi_op_gen_gpio_output, | ||||
|  	/* .gen_bcn_tmpl not implemented */ | ||||
|  	/* .gen_prb_tmpl not implemented */ | ||||
|  	/* .gen_p2p_go_bcn_ie not implemented */ | ||||
| @@ -9271,6 +9319,8 @@ static const struct wmi_ops wmi_10_2_ops | ||||
|  	.gen_delba_send = ath10k_wmi_op_gen_delba_send, | ||||
|  	.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, | ||||
|  	.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, | ||||
| +	.gen_gpio_config = ath10k_wmi_op_gen_gpio_config, | ||||
| +	.gen_gpio_output = ath10k_wmi_op_gen_gpio_output, | ||||
|  	/* .gen_pdev_enable_adaptive_cca not implemented */ | ||||
|  }; | ||||
|   | ||||
| @@ -9342,6 +9392,8 @@ static const struct wmi_ops wmi_10_2_4_o | ||||
|  		ath10k_wmi_op_gen_pdev_enable_adaptive_cca, | ||||
|  	.get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype, | ||||
|  	.gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing, | ||||
| +	.gen_gpio_config = ath10k_wmi_op_gen_gpio_config, | ||||
| +	.gen_gpio_output = ath10k_wmi_op_gen_gpio_output, | ||||
|  	/* .gen_bcn_tmpl not implemented */ | ||||
|  	/* .gen_prb_tmpl not implemented */ | ||||
|  	/* .gen_p2p_go_bcn_ie not implemented */ | ||||
| @@ -9422,6 +9474,8 @@ static const struct wmi_ops wmi_10_4_ops | ||||
|  	.gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info, | ||||
|  	.gen_echo = ath10k_wmi_op_gen_echo, | ||||
|  	.gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config, | ||||
| +	.gen_gpio_config = ath10k_wmi_op_gen_gpio_config, | ||||
| +	.gen_gpio_output = ath10k_wmi_op_gen_gpio_output, | ||||
|  }; | ||||
|   | ||||
|  int ath10k_wmi_attach(struct ath10k *ar) | ||||
| --- a/drivers/net/wireless/ath/ath10k/wmi.h | ||||
| +++ b/drivers/net/wireless/ath/ath10k/wmi.h | ||||
| @@ -3016,6 +3016,41 @@ enum wmi_10_4_feature_mask { | ||||
|   | ||||
|  }; | ||||
|   | ||||
| +/* WMI_GPIO_CONFIG_CMDID */ | ||||
| +enum { | ||||
| +	WMI_GPIO_PULL_NONE, | ||||
| +	WMI_GPIO_PULL_UP, | ||||
| +	WMI_GPIO_PULL_DOWN, | ||||
| +}; | ||||
| + | ||||
| +enum { | ||||
| +	WMI_GPIO_INTTYPE_DISABLE, | ||||
| +	WMI_GPIO_INTTYPE_RISING_EDGE, | ||||
| +	WMI_GPIO_INTTYPE_FALLING_EDGE, | ||||
| +	WMI_GPIO_INTTYPE_BOTH_EDGE, | ||||
| +	WMI_GPIO_INTTYPE_LEVEL_LOW, | ||||
| +	WMI_GPIO_INTTYPE_LEVEL_HIGH | ||||
| +}; | ||||
| + | ||||
| +/* WMI_GPIO_CONFIG_CMDID */ | ||||
| +struct wmi_gpio_config_cmd { | ||||
| +	__le32 gpio_num;             /* GPIO number to be setup */ | ||||
| +	__le32 input;                /* 0 - Output/ 1 - Input */ | ||||
| +	__le32 pull_type;            /* Pull type defined above */ | ||||
| +	__le32 intr_mode;            /* Interrupt mode defined above (Input) */ | ||||
| +} __packed; | ||||
| + | ||||
| +/* WMI_GPIO_OUTPUT_CMDID */ | ||||
| +struct wmi_gpio_output_cmd { | ||||
| +	__le32 gpio_num;    /* GPIO number to be setup */ | ||||
| +	__le32 set;         /* Set the GPIO pin*/ | ||||
| +} __packed; | ||||
| + | ||||
| +/* WMI_GPIO_INPUT_EVENTID */ | ||||
| +struct wmi_gpio_input_event { | ||||
| +	__le32 gpio_num;    /* GPIO number which changed state */ | ||||
| +} __packed; | ||||
| + | ||||
|  struct wmi_ext_resource_config_10_4_cmd { | ||||
|  	/* contains enum wmi_host_platform_type */ | ||||
|  	__le32 host_platform_config; | ||||
| @@ -0,0 +1,53 @@ | ||||
| From 79c9d7aabae1d1da9eea97d83b61e1517a8a2221 Mon Sep 17 00:00:00 2001 | ||||
| From: Mathias Kresin <dev@kresin.me> | ||||
| Date: Fri, 22 Jun 2018 18:59:44 +0200 | ||||
| Subject: [PATCH] ath10k: use tpt LED trigger by default | ||||
|  | ||||
| Use the tpt LED trigger for each created phy led. Ths way LEDs attached | ||||
| to the ath10k GPIO pins are indicating the phy status and blink on | ||||
| traffic. | ||||
|  | ||||
| Signed-off-by: Mathias Kresin <dev@kresin.me> | ||||
| --- | ||||
|  drivers/net/wireless/ath/ath10k/core.h | 4 ++++ | ||||
|  drivers/net/wireless/ath/ath10k/leds.c | 4 +--- | ||||
|  drivers/net/wireless/ath/ath10k/mac.c  | 2 +- | ||||
|  3 files changed, 6 insertions(+), 4 deletions(-) | ||||
|  | ||||
| --- a/drivers/net/wireless/ath/ath10k/core.h | ||||
| +++ b/drivers/net/wireless/ath/ath10k/core.h | ||||
| @@ -1269,6 +1269,10 @@ struct ath10k { | ||||
|  	bool coex_support; | ||||
|  	int coex_gpio_pin; | ||||
|   | ||||
| +#ifdef CPTCFG_MAC80211_LEDS | ||||
| +	const char *led_default_trigger; | ||||
| +#endif | ||||
| + | ||||
|  	/* must be last */ | ||||
|  	u8 drv_priv[] __aligned(sizeof(void *)); | ||||
|  }; | ||||
| --- a/drivers/net/wireless/ath/ath10k/leds.c | ||||
| +++ b/drivers/net/wireless/ath/ath10k/leds.c | ||||
| @@ -81,9 +81,7 @@ int ath10k_leds_register(struct ath10k * | ||||
|   | ||||
|  	ar->leds.cdev.name = ar->leds.label; | ||||
|  	ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking; | ||||
| - | ||||
| -	/* FIXME: this assignment doesn't make sense as it's NULL, remove it? */ | ||||
| -	ar->leds.cdev.default_trigger = ar->leds.wifi_led.default_trigger; | ||||
| +	ar->leds.cdev.default_trigger = ar->led_default_trigger; | ||||
|   | ||||
|  	ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); | ||||
|  	if (ret) | ||||
| --- a/drivers/net/wireless/ath/ath10k/mac.c | ||||
| +++ b/drivers/net/wireless/ath/ath10k/mac.c | ||||
| @@ -9397,7 +9397,7 @@ int ath10k_mac_register(struct ath10k *a | ||||
|  	ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; | ||||
|   | ||||
|  #ifdef CPTCFG_MAC80211_LEDS | ||||
| -	ieee80211_create_tpt_led_trigger(ar->hw, | ||||
| +	ar->led_default_trigger = ieee80211_create_tpt_led_trigger(ar->hw, | ||||
|  		IEEE80211_TPT_LEDTRIG_FL_RADIO, ath10k_tpt_blink, | ||||
|  		ARRAY_SIZE(ath10k_tpt_blink)); | ||||
|  #endif | ||||
| @@ -0,0 +1,49 @@ | ||||
| From: Sven Eckelmann <seckelmann@datto.com> | ||||
| Date: Tue, 11 Jun 2019 13:58:35 +0200 | ||||
| Subject: ath10k: fix max antenna gain unit | ||||
|  | ||||
| Most of the txpower for the ath10k firmware is stored as twicepower (0.5 dB | ||||
| steps). This isn't the case for max_antenna_gain - which is still expected | ||||
| by the firmware as dB. | ||||
|  | ||||
| The firmware is converting it from dB to the internal (twicepower) | ||||
| representation when it calculates the limits of a channel. This can be seen | ||||
| in tpc_stats when configuring "12" as max_antenna_gain. Instead of the | ||||
| expected 12 (6 dB), the tpc_stats shows 24 (12 dB). | ||||
|  | ||||
| Tested on QCA9888 and IPQ4019 with firmware 10.4-3.5.3-00057. | ||||
|  | ||||
| Fixes: 02256930d9b8 ("ath10k: use proper tx power unit") | ||||
| Signed-off-by: Sven Eckelmann <seckelmann@datto.com> | ||||
|  | ||||
| Forwarded: https://patchwork.kernel.org/patch/10986723/ | ||||
|  | ||||
| --- a/drivers/net/wireless/ath/ath10k/mac.c | ||||
| +++ b/drivers/net/wireless/ath/ath10k/mac.c | ||||
| @@ -1043,7 +1043,7 @@ static int ath10k_monitor_vdev_start(str | ||||
|  	arg.channel.min_power = 0; | ||||
|  	arg.channel.max_power = channel->max_power * 2; | ||||
|  	arg.channel.max_reg_power = channel->max_reg_power * 2; | ||||
| -	arg.channel.max_antenna_gain = channel->max_antenna_gain * 2; | ||||
| +	arg.channel.max_antenna_gain = channel->max_antenna_gain; | ||||
|   | ||||
|  	reinit_completion(&ar->vdev_setup_done); | ||||
|  	reinit_completion(&ar->vdev_delete_done); | ||||
| @@ -1489,7 +1489,7 @@ static int ath10k_vdev_start_restart(str | ||||
|  	arg.channel.min_power = 0; | ||||
|  	arg.channel.max_power = chandef->chan->max_power * 2; | ||||
|  	arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; | ||||
| -	arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain * 2; | ||||
| +	arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain; | ||||
|   | ||||
|  	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { | ||||
|  		arg.ssid = arvif->u.ap.ssid; | ||||
| @@ -3194,7 +3194,7 @@ static int ath10k_update_channel_list(st | ||||
|  			ch->min_power = 0; | ||||
|  			ch->max_power = channel->max_power * 2; | ||||
|  			ch->max_reg_power = channel->max_reg_power * 2; | ||||
| -			ch->max_antenna_gain = channel->max_antenna_gain * 2; | ||||
| +			ch->max_antenna_gain = channel->max_antenna_gain; | ||||
|  			ch->reg_class_id = 0; /* FIXME */ | ||||
|   | ||||
|  			/* FIXME: why use only legacy modes, why not any | ||||
| @@ -0,0 +1,101 @@ | ||||
| From: Sven Eckelmann <seckelmann@datto.com> | ||||
| Date: Wed, 28 Nov 2018 16:16:27 +0100 | ||||
| Subject: ath10k: adjust tx power reduction for US regulatory domain | ||||
|  | ||||
| FCC allows maximum antenna gain of 6 dBi. 15.247(b)(4): | ||||
|  | ||||
| > (4) The conducted output power limit | ||||
| > specified in paragraph (b) of this section | ||||
| > is based on the use of antennas | ||||
| > with directional gains that do not exceed | ||||
| > 6 dBi. Except as shown in paragraph | ||||
| > (c) of this section, if transmitting | ||||
| > antennas of directional gain greater | ||||
| > than 6 dBi are used, the conducted | ||||
| > output power from the intentional radiator | ||||
| > shall be reduced below the stated | ||||
| > values in paragraphs (b)(1), (b)(2), | ||||
| > and (b)(3) of this section, as appropriate, | ||||
| > by the amount in dB that the | ||||
| > directional gain of the antenna exceeds | ||||
| > 6 dBi. | ||||
|  | ||||
| https://www.gpo.gov/fdsys/pkg/CFR-2013-title47-vol1/pdf/CFR-2013-title47-vol1-sec15-247.pdf | ||||
|  | ||||
| Signed-off-by: Sven Eckelmann <seckelmann@datto.com> | ||||
|  | ||||
| Forwarded: no | ||||
|  | ||||
| --- a/drivers/net/wireless/ath/ath10k/mac.c | ||||
| +++ b/drivers/net/wireless/ath/ath10k/mac.c | ||||
| @@ -1011,6 +1011,40 @@ static inline int ath10k_vdev_setup_sync | ||||
|  	return ar->last_wmi_vdev_start_status; | ||||
|  } | ||||
|   | ||||
| +static u32 ath10k_get_max_antenna_gain(struct ath10k *ar, | ||||
| +				       u32 ch_max_antenna_gain) | ||||
| +{ | ||||
| +	u32 max_antenna_gain; | ||||
| + | ||||
| +	if (ar->dfs_detector && ar->dfs_detector->region == NL80211_DFS_FCC) { | ||||
| +		/* FCC allows maximum antenna gain of 6 dBi. 15.247(b)(4): | ||||
| +		 * | ||||
| +		 * > (4) The conducted output power limit | ||||
| +		 * > specified in paragraph (b) of this section | ||||
| +		 * > is based on the use of antennas | ||||
| +		 * > with directional gains that do not exceed | ||||
| +		 * > 6 dBi. Except as shown in paragraph | ||||
| +		 * > (c) of this section, if transmitting | ||||
| +		 * > antennas of directional gain greater | ||||
| +		 * > than 6 dBi are used, the conducted | ||||
| +		 * > output power from the intentional radiator | ||||
| +		 * > shall be reduced below the stated | ||||
| +		 * > values in paragraphs (b)(1), (b)(2), | ||||
| +		 * > and (b)(3) of this section, as appropriate, | ||||
| +		 * > by the amount in dB that the | ||||
| +		 * > directional gain of the antenna exceeds | ||||
| +		 * > 6 dBi. | ||||
| +		 * | ||||
| +		 * https://www.gpo.gov/fdsys/pkg/CFR-2013-title47-vol1/pdf/CFR-2013-title47-vol1-sec15-247.pdf | ||||
| +		 */ | ||||
| +		max_antenna_gain = 6; | ||||
| +	} else { | ||||
| +		max_antenna_gain = 0; | ||||
| +	} | ||||
| + | ||||
| +	return max(ch_max_antenna_gain, max_antenna_gain); | ||||
| +} | ||||
| + | ||||
|  static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id) | ||||
|  { | ||||
|  	struct cfg80211_chan_def *chandef = NULL; | ||||
| @@ -1043,7 +1077,8 @@ static int ath10k_monitor_vdev_start(str | ||||
|  	arg.channel.min_power = 0; | ||||
|  	arg.channel.max_power = channel->max_power * 2; | ||||
|  	arg.channel.max_reg_power = channel->max_reg_power * 2; | ||||
| -	arg.channel.max_antenna_gain = channel->max_antenna_gain; | ||||
| +	arg.channel.max_antenna_gain = ath10k_get_max_antenna_gain(ar, | ||||
| +						channel->max_antenna_gain); | ||||
|   | ||||
|  	reinit_completion(&ar->vdev_setup_done); | ||||
|  	reinit_completion(&ar->vdev_delete_done); | ||||
| @@ -1489,7 +1524,8 @@ static int ath10k_vdev_start_restart(str | ||||
|  	arg.channel.min_power = 0; | ||||
|  	arg.channel.max_power = chandef->chan->max_power * 2; | ||||
|  	arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; | ||||
| -	arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain; | ||||
| +	arg.channel.max_antenna_gain = ath10k_get_max_antenna_gain(ar, | ||||
| +					chandef->chan->max_antenna_gain); | ||||
|   | ||||
|  	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { | ||||
|  		arg.ssid = arvif->u.ap.ssid; | ||||
| @@ -3194,7 +3230,8 @@ static int ath10k_update_channel_list(st | ||||
|  			ch->min_power = 0; | ||||
|  			ch->max_power = channel->max_power * 2; | ||||
|  			ch->max_reg_power = channel->max_reg_power * 2; | ||||
| -			ch->max_antenna_gain = channel->max_antenna_gain; | ||||
| +			ch->max_antenna_gain = ath10k_get_max_antenna_gain(ar, | ||||
| +						channel->max_antenna_gain); | ||||
|  			ch->reg_class_id = 0; /* FIXME */ | ||||
|   | ||||
|  			/* FIXME: why use only legacy modes, why not any | ||||
| @@ -0,0 +1,10 @@ | ||||
| --- a/drivers/net/wireless/broadcom/brcm80211/Kconfig | ||||
| +++ b/drivers/net/wireless/broadcom/brcm80211/Kconfig | ||||
| @@ -1,6 +1,6 @@ | ||||
|  # SPDX-License-Identifier: GPL-2.0-only | ||||
|  config BRCMUTIL | ||||
| -	tristate | ||||
| +	tristate "Broadcom 802.11 driver utility functions" | ||||
|  	depends on m | ||||
|   | ||||
|  config BRCMSMAC | ||||
| @@ -0,0 +1,37 @@ | ||||
| --- a/drivers/net/wireless/broadcom/b43/b43.h | ||||
| +++ b/drivers/net/wireless/broadcom/b43/b43.h | ||||
| @@ -840,6 +840,7 @@ struct b43_wldev { | ||||
|  	bool qos_enabled;		/* TRUE, if QoS is used. */ | ||||
|  	bool hwcrypto_enabled;		/* TRUE, if HW crypto acceleration is enabled. */ | ||||
|  	bool use_pio;			/* TRUE if next init should use PIO */ | ||||
| +	int gpiomask;			/* GPIO LED mask as a module parameter */ | ||||
|   | ||||
|  	/* PHY/Radio device. */ | ||||
|  	struct b43_phy phy; | ||||
| --- a/drivers/net/wireless/broadcom/b43/main.c | ||||
| +++ b/drivers/net/wireless/broadcom/b43/main.c | ||||
| @@ -72,6 +72,11 @@ MODULE_FIRMWARE("b43/ucode40.fw"); | ||||
|  MODULE_FIRMWARE("b43/ucode42.fw"); | ||||
|  MODULE_FIRMWARE("b43/ucode9.fw"); | ||||
|   | ||||
| +static int modparam_gpiomask = 0x000F; | ||||
| +module_param_named(gpiomask, modparam_gpiomask, int, 0444); | ||||
| +MODULE_PARM_DESC(gpiomask, | ||||
| +         "GPIO mask for LED control (default 0x000F)"); | ||||
| + | ||||
|  static int modparam_bad_frames_preempt; | ||||
|  module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444); | ||||
|  MODULE_PARM_DESC(bad_frames_preempt, | ||||
| @@ -2867,10 +2872,10 @@ static int b43_gpio_init(struct b43_wlde | ||||
|  	u32 mask, set; | ||||
|   | ||||
|  	b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_GPOUTSMSK, 0); | ||||
| -	b43_maskset16(dev, B43_MMIO_GPIO_MASK, ~0, 0xF); | ||||
| +	b43_maskset16(dev, B43_MMIO_GPIO_MASK, ~0, modparam_gpiomask); | ||||
|   | ||||
|  	mask = 0x0000001F; | ||||
| -	set = 0x0000000F; | ||||
| +	set = modparam_gpiomask; | ||||
|  	if (dev->dev->chip_id == 0x4301) { | ||||
|  		mask |= 0x0060; | ||||
|  		set |= 0x0060; | ||||
							
								
								
									
										86
									
								
								feeds/wifi-ath10k/mac80211/patches/brcm/811-b43_no_pio.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								feeds/wifi-ath10k/mac80211/patches/brcm/811-b43_no_pio.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,86 @@ | ||||
| --- a/drivers/net/wireless/broadcom/b43/Makefile | ||||
| +++ b/drivers/net/wireless/broadcom/b43/Makefile | ||||
| @@ -18,7 +18,7 @@ b43-$(CPTCFG_B43_PHY_AC)	+= phy_ac.o | ||||
|  b43-y				+= sysfs.o | ||||
|  b43-y				+= xmit.o | ||||
|  b43-y				+= dma.o | ||||
| -b43-y				+= pio.o | ||||
| +b43-$(CPTCFG_B43_PIO)		+= pio.o | ||||
|  b43-y				+= rfkill.o | ||||
|  b43-y				+= ppr.o | ||||
|  b43-$(CPTCFG_B43_LEDS)		+= leds.o | ||||
| --- a/drivers/net/wireless/broadcom/b43/main.c | ||||
| +++ b/drivers/net/wireless/broadcom/b43/main.c | ||||
| @@ -2000,10 +2000,12 @@ static void b43_do_interrupt_thread(stru | ||||
|  			dma_reason[0], dma_reason[1], | ||||
|  			dma_reason[2], dma_reason[3], | ||||
|  			dma_reason[4], dma_reason[5]); | ||||
| +#ifdef CPTCFG_B43_PIO | ||||
|  		b43err(dev->wl, "This device does not support DMA " | ||||
|  			       "on your system. It will now be switched to PIO.\n"); | ||||
|  		/* Fall back to PIO transfers if we get fatal DMA errors! */ | ||||
|  		dev->use_pio = true; | ||||
| +#endif | ||||
|  		b43_controller_restart(dev, "DMA error"); | ||||
|  		return; | ||||
|  	} | ||||
| --- a/drivers/net/wireless/broadcom/b43/pio.h | ||||
| +++ b/drivers/net/wireless/broadcom/b43/pio.h | ||||
| @@ -151,7 +151,7 @@ static inline void b43_piorx_write32(str | ||||
|  	b43_write32(q->dev, q->mmio_base + offset, value); | ||||
|  } | ||||
|   | ||||
| - | ||||
| +#ifdef CPTCFG_B43_PIO | ||||
|  int b43_pio_init(struct b43_wldev *dev); | ||||
|  void b43_pio_free(struct b43_wldev *dev); | ||||
|   | ||||
| @@ -162,5 +162,37 @@ void b43_pio_rx(struct b43_pio_rxqueue * | ||||
|   | ||||
|  void b43_pio_tx_suspend(struct b43_wldev *dev); | ||||
|  void b43_pio_tx_resume(struct b43_wldev *dev); | ||||
| +#else | ||||
| +static inline int b43_pio_init(struct b43_wldev *dev) | ||||
| +{ | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +static inline void b43_pio_free(struct b43_wldev *dev) | ||||
| +{ | ||||
| +} | ||||
| + | ||||
| +static inline int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb) | ||||
| +{ | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +static inline void b43_pio_handle_txstatus(struct b43_wldev *dev, | ||||
| +					   const struct b43_txstatus *status) | ||||
| +{ | ||||
| +} | ||||
| + | ||||
| +static inline void b43_pio_rx(struct b43_pio_rxqueue *q) | ||||
| +{ | ||||
| +} | ||||
| + | ||||
| +static inline void b43_pio_tx_suspend(struct b43_wldev *dev) | ||||
| +{ | ||||
| +} | ||||
| + | ||||
| +static inline void b43_pio_tx_resume(struct b43_wldev *dev) | ||||
| +{ | ||||
| +} | ||||
| +#endif /* CPTCFG_B43_PIO */ | ||||
|   | ||||
|  #endif /* B43_PIO_H_ */ | ||||
| --- a/drivers/net/wireless/broadcom/b43/Kconfig | ||||
| +++ b/drivers/net/wireless/broadcom/b43/Kconfig | ||||
| @@ -100,7 +100,7 @@ config B43_BCMA_PIO | ||||
|  	default y | ||||
|   | ||||
|  config B43_PIO | ||||
| -	bool | ||||
| +	bool "Broadcom 43xx PIO support" | ||||
|  	depends on B43 && B43_SSB | ||||
|  	depends on SSB_BLOCKIO | ||||
|  	default y | ||||
| @@ -0,0 +1,131 @@ | ||||
| --- a/drivers/net/wireless/broadcom/b43/main.c | ||||
| +++ b/drivers/net/wireless/broadcom/b43/main.c | ||||
| @@ -1642,7 +1642,7 @@ static void b43_write_beacon_template(st | ||||
|  				  len, ram_offset, shm_size_offset, rate); | ||||
|   | ||||
|  	/* Write the PHY TX control parameters. */ | ||||
| -	antenna = B43_ANTENNA_DEFAULT; | ||||
| +	antenna = dev->tx_antenna; | ||||
|  	antenna = b43_antenna_to_phyctl(antenna); | ||||
|  	ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL); | ||||
|  	/* We can't send beacons with short preamble. Would get PHY errors. */ | ||||
| @@ -3282,8 +3282,8 @@ static int b43_chip_init(struct b43_wlde | ||||
|   | ||||
|  	/* Select the antennae */ | ||||
|  	if (phy->ops->set_rx_antenna) | ||||
| -		phy->ops->set_rx_antenna(dev, B43_ANTENNA_DEFAULT); | ||||
| -	b43_mgmtframe_txantenna(dev, B43_ANTENNA_DEFAULT); | ||||
| +		phy->ops->set_rx_antenna(dev, dev->rx_antenna); | ||||
| +	b43_mgmtframe_txantenna(dev, dev->tx_antenna); | ||||
|   | ||||
|  	if (phy->type == B43_PHYTYPE_B) { | ||||
|  		value16 = b43_read16(dev, 0x005E); | ||||
| @@ -3983,7 +3983,6 @@ static int b43_op_config(struct ieee8021 | ||||
|  	struct b43_wldev *dev = wl->current_dev; | ||||
|  	struct b43_phy *phy = &dev->phy; | ||||
|  	struct ieee80211_conf *conf = &hw->conf; | ||||
| -	int antenna; | ||||
|  	int err = 0; | ||||
|   | ||||
|  	mutex_lock(&wl->mutex); | ||||
| @@ -4026,11 +4025,9 @@ static int b43_op_config(struct ieee8021 | ||||
|  	} | ||||
|   | ||||
|  	/* Antennas for RX and management frame TX. */ | ||||
| -	antenna = B43_ANTENNA_DEFAULT; | ||||
| -	b43_mgmtframe_txantenna(dev, antenna); | ||||
| -	antenna = B43_ANTENNA_DEFAULT; | ||||
| +	b43_mgmtframe_txantenna(dev, dev->tx_antenna); | ||||
|  	if (phy->ops->set_rx_antenna) | ||||
| -		phy->ops->set_rx_antenna(dev, antenna); | ||||
| +		phy->ops->set_rx_antenna(dev, dev->rx_antenna); | ||||
|   | ||||
|  	if (wl->radio_enabled != phy->radio_on) { | ||||
|  		if (wl->radio_enabled) { | ||||
| @@ -5174,6 +5171,47 @@ static int b43_op_get_survey(struct ieee | ||||
|  	return 0; | ||||
|  } | ||||
|   | ||||
| +static int b43_op_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) | ||||
| +{ | ||||
| +	struct b43_wl *wl = hw_to_b43_wl(hw); | ||||
| +	struct b43_wldev *dev = wl->current_dev; | ||||
| + | ||||
| +	if (tx_ant == 1 && rx_ant == 1) { | ||||
| +		dev->tx_antenna = B43_ANTENNA0; | ||||
| +		dev->rx_antenna = B43_ANTENNA0; | ||||
| +	} | ||||
| +	else if (tx_ant == 2 && rx_ant == 2) { | ||||
| +		dev->tx_antenna = B43_ANTENNA1; | ||||
| +		dev->rx_antenna = B43_ANTENNA1; | ||||
| +	} | ||||
| +	else if ((tx_ant & 3) == 3 && (rx_ant & 3) == 3) { | ||||
| +		dev->tx_antenna = B43_ANTENNA_DEFAULT; | ||||
| +		dev->rx_antenna = B43_ANTENNA_DEFAULT; | ||||
| +	} | ||||
| +	else { | ||||
| +		return -EINVAL; | ||||
| +	} | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| + | ||||
| +static int b43_op_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) | ||||
| +{ | ||||
| +	struct b43_wl *wl = hw_to_b43_wl(hw); | ||||
| +	struct b43_wldev *dev = wl->current_dev; | ||||
| + | ||||
| +	switch (dev->tx_antenna) { | ||||
| +	case B43_ANTENNA0: | ||||
| +		*tx_ant = 1; *rx_ant = 1; break; | ||||
| +	case B43_ANTENNA1: | ||||
| +		*tx_ant = 2; *rx_ant = 2; break; | ||||
| +	case B43_ANTENNA_DEFAULT: | ||||
| +		*tx_ant = 3; *rx_ant = 3; break; | ||||
| +	} | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
|  static const struct ieee80211_ops b43_hw_ops = { | ||||
|  	.tx			= b43_op_tx, | ||||
|  	.conf_tx		= b43_op_conf_tx, | ||||
| @@ -5195,6 +5233,8 @@ static const struct ieee80211_ops b43_hw | ||||
|  	.sw_scan_complete	= b43_op_sw_scan_complete_notifier, | ||||
|  	.get_survey		= b43_op_get_survey, | ||||
|  	.rfkill_poll		= b43_rfkill_poll, | ||||
| +	.set_antenna		= b43_op_set_antenna, | ||||
| +	.get_antenna		= b43_op_get_antenna, | ||||
|  }; | ||||
|   | ||||
|  /* Hard-reset the chip. Do not call this directly. | ||||
| @@ -5496,6 +5536,8 @@ static int b43_one_core_attach(struct b4 | ||||
|  	if (!wldev) | ||||
|  		goto out; | ||||
|   | ||||
| +	wldev->rx_antenna = B43_ANTENNA_DEFAULT; | ||||
| +	wldev->tx_antenna = B43_ANTENNA_DEFAULT; | ||||
|  	wldev->use_pio = b43_modparam_pio; | ||||
|  	wldev->dev = dev; | ||||
|  	wldev->wl = wl; | ||||
| @@ -5590,6 +5632,9 @@ static struct b43_wl *b43_wireless_init( | ||||
|   | ||||
|  	wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); | ||||
|   | ||||
| +	hw->wiphy->available_antennas_rx = 0x3; | ||||
| +	hw->wiphy->available_antennas_tx = 0x3; | ||||
| + | ||||
|  	wl->hw_registered = false; | ||||
|  	hw->max_rates = 2; | ||||
|  	SET_IEEE80211_DEV(hw, dev->dev); | ||||
| --- a/drivers/net/wireless/broadcom/b43/b43.h | ||||
| +++ b/drivers/net/wireless/broadcom/b43/b43.h | ||||
| @@ -841,6 +841,8 @@ struct b43_wldev { | ||||
|  	bool hwcrypto_enabled;		/* TRUE, if HW crypto acceleration is enabled. */ | ||||
|  	bool use_pio;			/* TRUE if next init should use PIO */ | ||||
|  	int gpiomask;			/* GPIO LED mask as a module parameter */ | ||||
| +	int rx_antenna;			/* Used RX antenna (B43_ANTENNAxxx) */ | ||||
| +	int tx_antenna;			/* Used TX antenna (B43_ANTENNAxxx) */ | ||||
|   | ||||
|  	/* PHY/Radio device. */ | ||||
|  	struct b43_phy phy; | ||||
| @@ -0,0 +1,11 @@ | ||||
| --- a/drivers/net/wireless/broadcom/b43/dma.h | ||||
| +++ b/drivers/net/wireless/broadcom/b43/dma.h | ||||
| @@ -170,7 +170,7 @@ struct b43_dmadesc_generic { | ||||
|   | ||||
|  /* DMA engine tuning knobs */ | ||||
|  #define B43_TXRING_SLOTS		256 | ||||
| -#define B43_RXRING_SLOTS		256 | ||||
| +#define B43_RXRING_SLOTS		32 | ||||
|  #define B43_DMA0_RX_FW598_BUFSIZE	(B43_DMA0_RX_FW598_FO + IEEE80211_MAX_FRAME_LEN) | ||||
|  #define B43_DMA0_RX_FW351_BUFSIZE	(B43_DMA0_RX_FW351_FO + IEEE80211_MAX_FRAME_LEN) | ||||
|   | ||||
| @@ -0,0 +1,17 @@ | ||||
| --- a/drivers/net/wireless/broadcom/b43/main.c | ||||
| +++ b/drivers/net/wireless/broadcom/b43/main.c | ||||
| @@ -2884,6 +2884,14 @@ static int b43_gpio_init(struct b43_wlde | ||||
|  	} else if (dev->dev->chip_id == 0x5354) { | ||||
|  		/* Don't allow overtaking buttons GPIOs */ | ||||
|  		set &= 0x2; /* 0x2 is LED GPIO on BCM5354 */ | ||||
| +	} else if (dev->dev->chip_id == BCMA_CHIP_ID_BCM4716 ||  | ||||
| +		   dev->dev->chip_id == BCMA_CHIP_ID_BCM47162 || | ||||
| +		   dev->dev->chip_id == BCMA_CHIP_ID_BCM5356 || | ||||
| +		   dev->dev->chip_id == BCMA_CHIP_ID_BCM5357 || | ||||
| +		   dev->dev->chip_id == BCMA_CHIP_ID_BCM53572) { | ||||
| +		/* just use gpio 0 and 1 for 2.4 GHz wifi led */ | ||||
| +		set &= 0x3; | ||||
| +		mask &= 0x3; | ||||
|  	} | ||||
|   | ||||
|  	if (0 /* FIXME: conditional unknown */ ) { | ||||
| @@ -0,0 +1,11 @@ | ||||
| --- a/drivers/net/wireless/broadcom/b43/main.c | ||||
| +++ b/drivers/net/wireless/broadcom/b43/main.c | ||||
| @@ -114,7 +114,7 @@ static int b43_modparam_pio = 0; | ||||
|  module_param_named(pio, b43_modparam_pio, int, 0644); | ||||
|  MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO"); | ||||
|   | ||||
| -static int modparam_allhwsupport = !IS_ENABLED(CPTCFG_BRCMSMAC); | ||||
| +static int modparam_allhwsupport = 1; | ||||
|  module_param_named(allhwsupport, modparam_allhwsupport, int, 0444); | ||||
|  MODULE_PARM_DESC(allhwsupport, "Enable support for all hardware (even it if overlaps with the brcmsmac driver)"); | ||||
|   | ||||
| @@ -0,0 +1,27 @@ | ||||
| --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/channel.c | ||||
| +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/channel.c | ||||
| @@ -58,19 +58,12 @@ | ||||
|  				 (((c) < 149) ? 3 : 4)))) | ||||
|   | ||||
|  #define BRCM_2GHZ_2412_2462	REG_RULE(2412-10, 2462+10, 40, 0, 19, 0) | ||||
| -#define BRCM_2GHZ_2467_2472	REG_RULE(2467-10, 2472+10, 20, 0, 19, \ | ||||
| -					 NL80211_RRF_NO_IR) | ||||
| +#define BRCM_2GHZ_2467_2472	REG_RULE(2467-10, 2472+10, 20, 0, 19, 0) | ||||
|   | ||||
| -#define BRCM_5GHZ_5180_5240	REG_RULE(5180-10, 5240+10, 40, 0, 21, \ | ||||
| -					 NL80211_RRF_NO_IR) | ||||
| -#define BRCM_5GHZ_5260_5320	REG_RULE(5260-10, 5320+10, 40, 0, 21, \ | ||||
| -					 NL80211_RRF_DFS | \ | ||||
| -					 NL80211_RRF_NO_IR) | ||||
| -#define BRCM_5GHZ_5500_5700	REG_RULE(5500-10, 5700+10, 40, 0, 21, \ | ||||
| -					 NL80211_RRF_DFS | \ | ||||
| -					 NL80211_RRF_NO_IR) | ||||
| -#define BRCM_5GHZ_5745_5825	REG_RULE(5745-10, 5825+10, 40, 0, 21, \ | ||||
| -					 NL80211_RRF_NO_IR) | ||||
| +#define BRCM_5GHZ_5180_5240	REG_RULE(5180-10, 5240+10, 40, 0, 21, 0) | ||||
| +#define BRCM_5GHZ_5260_5320	REG_RULE(5260-10, 5320+10, 40, 0, 21, 0) | ||||
| +#define BRCM_5GHZ_5500_5700	REG_RULE(5500-10, 5700+10, 40, 0, 21, 0) | ||||
| +#define BRCM_5GHZ_5745_5825	REG_RULE(5745-10, 5825+10, 40, 0, 21, 0) | ||||
|   | ||||
|  static const struct ieee80211_regdomain brcms_regdom_x2 = { | ||||
|  	.n_reg_rules = 6, | ||||
| @@ -0,0 +1,74 @@ | ||||
| From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> | ||||
| Date: Mon, 8 Jun 2015 16:11:40 +0200 | ||||
| Subject: [PATCH] brcmfmac: register wiphy(s) during module_init | ||||
| MIME-Version: 1.0 | ||||
| Content-Type: text/plain; charset=UTF-8 | ||||
| Content-Transfer-Encoding: 8bit | ||||
|  | ||||
| This is needed by OpenWrt which expects all PHYs to be created after | ||||
| module loads successfully. | ||||
|  | ||||
| Signed-off-by: Rafał Miłecki <zajec5@gmail.com> | ||||
| --- | ||||
|  | ||||
| --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | ||||
| +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | ||||
| @@ -1551,6 +1551,7 @@ int __init brcmf_core_init(void) | ||||
|  { | ||||
|  	if (!schedule_work(&brcmf_driver_work)) | ||||
|  		return -EBUSY; | ||||
| +	flush_work(&brcmf_driver_work); | ||||
|   | ||||
|  	return 0; | ||||
|  } | ||||
| --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | ||||
| +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | ||||
| @@ -431,6 +431,7 @@ struct brcmf_fw { | ||||
|  	struct brcmf_fw_request *req; | ||||
|  	u32 curpos; | ||||
|  	void (*done)(struct device *dev, int err, struct brcmf_fw_request *req); | ||||
| +	struct completion *completion; | ||||
|  }; | ||||
|   | ||||
|  static void brcmf_fw_request_done(const struct firmware *fw, void *ctx); | ||||
| @@ -638,6 +639,8 @@ static void brcmf_fw_request_done(const | ||||
|  		fwctx->req = NULL; | ||||
|  	} | ||||
|  	fwctx->done(fwctx->dev, ret, fwctx->req); | ||||
| +	if (fwctx->completion) | ||||
| +		complete(fwctx->completion); | ||||
|  	kfree(fwctx); | ||||
|  } | ||||
|   | ||||
| @@ -662,6 +665,8 @@ int brcmf_fw_get_firmwares(struct device | ||||
|  { | ||||
|  	struct brcmf_fw_item *first = &req->items[0]; | ||||
|  	struct brcmf_fw *fwctx; | ||||
| +	struct completion completion; | ||||
| +	unsigned long time_left; | ||||
|  	int ret; | ||||
|   | ||||
|  	brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev)); | ||||
| @@ -678,6 +683,9 @@ int brcmf_fw_get_firmwares(struct device | ||||
|  	fwctx->dev = dev; | ||||
|  	fwctx->req = req; | ||||
|  	fwctx->done = fw_cb; | ||||
| +  | ||||
| +	init_completion(&completion); | ||||
| +	fwctx->completion = &completion; | ||||
|   | ||||
|  	ret = request_firmware_nowait(THIS_MODULE, true, first->path, | ||||
|  				      fwctx->dev, GFP_KERNEL, fwctx, | ||||
| @@ -685,6 +693,12 @@ int brcmf_fw_get_firmwares(struct device | ||||
|  	if (ret < 0) | ||||
|  		brcmf_fw_request_done(NULL, fwctx); | ||||
|   | ||||
| + | ||||
| +	time_left = wait_for_completion_timeout(&completion, | ||||
| +						msecs_to_jiffies(5000)); | ||||
| +	if (!time_left && fwctx) | ||||
| +		fwctx->completion = NULL; | ||||
| + | ||||
|  	return 0; | ||||
|  } | ||||
|   | ||||
| @@ -0,0 +1,49 @@ | ||||
| From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> | ||||
| Date: Thu, 9 Jul 2015 00:07:59 +0200 | ||||
| Subject: [PATCH] brcmfmac: workaround bug with some inconsistent BSSes state | ||||
| MIME-Version: 1.0 | ||||
| Content-Type: text/plain; charset=UTF-8 | ||||
| Content-Transfer-Encoding: 8bit | ||||
|  | ||||
| Signed-off-by: Rafał Miłecki <zajec5@gmail.com> | ||||
| --- | ||||
|  | ||||
| --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | ||||
| +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | ||||
| @@ -712,8 +712,36 @@ static struct wireless_dev *brcmf_cfg802 | ||||
|  	struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); | ||||
|  	struct brcmf_pub *drvr = cfg->pub; | ||||
|  	struct wireless_dev *wdev; | ||||
| +	struct net_device *dev; | ||||
|  	int err; | ||||
|   | ||||
| +	/* | ||||
| +	 * There is a bug with in-firmware BSS management. When adding virtual | ||||
| +	 * interface brcmfmac first tells firmware to create new BSS and then | ||||
| +	 * it creates new struct net_device. | ||||
| +	 * | ||||
| +	 * If creating/registering netdev(ice) fails, BSS remains in some bugged | ||||
| +	 * state. It conflicts with existing BSSes by overtaking their auth | ||||
| +	 * requests. | ||||
| +	 * | ||||
| +	 * It results in one BSS (addresss X) sending beacons and another BSS | ||||
| +	 * (address Y) replying to authentication requests. This makes interface | ||||
| +	 * unusable as AP. | ||||
| +	 * | ||||
| +	 * To workaround this bug we may try to guess if register_netdev(ice) | ||||
| +	 * will fail. The most obvious case is using interface name that already | ||||
| +	 * exists. This is actually quite likely with brcmfmac & some user space | ||||
| +	 * scripts as brcmfmac doesn't allow deleting virtual interfaces. | ||||
| +	 * So this bug can be triggered even by something trivial like: | ||||
| +	 * iw dev wlan0 delete | ||||
| +	 * iw phy phy0 interface add wlan0 type __ap | ||||
| +	 */ | ||||
| +	dev = dev_get_by_name(&init_net, name); | ||||
| +	if (dev) { | ||||
| +		dev_put(dev); | ||||
| +		return ERR_PTR(-ENFILE); | ||||
| +	} | ||||
| + | ||||
|  	brcmf_dbg(TRACE, "enter: %s type %d\n", name, type); | ||||
|  	err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type); | ||||
|  	if (err) { | ||||
| @@ -0,0 +1,27 @@ | ||||
| From 66ae1b1750720a33e29792a177b1e696f4f005fb Mon Sep 17 00:00:00 2001 | ||||
| From: Phil Elwell <phil@raspberrypi.org> | ||||
| Date: Wed, 9 Mar 2016 17:25:59 +0000 | ||||
| Subject: [PATCH] brcmfmac: Disable power management | ||||
|  | ||||
| Disable wireless power saving in the brcmfmac WLAN driver. This is a | ||||
| temporary measure until the connectivity loss resulting from power | ||||
| saving is resolved. | ||||
|  | ||||
| Signed-off-by: Phil Elwell <phil@raspberrypi.org> | ||||
| --- | ||||
|  drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 2 ++ | ||||
|  1 file changed, 2 insertions(+) | ||||
|  | ||||
| --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | ||||
| +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | ||||
| @@ -2953,6 +2953,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip | ||||
|  	 * preference in cfg struct to apply this to | ||||
|  	 * FW later while initializing the dongle | ||||
|  	 */ | ||||
| +#if defined(CONFIG_ARCH_BCM2835) | ||||
| +	brcmf_dbg(INFO, "power management disabled\n"); | ||||
| +	enabled = false; | ||||
| +#endif | ||||
|  	cfg->pwr_save = enabled; | ||||
|  	if (!check_vif_up(ifp->vif)) { | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user