mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 02:17:58 +00:00 
			
		
		
		
	Compare commits
	
		
			28 Commits
		
	
	
		
			v2.8.0-rc1
			...
			v2.8.0-rc5
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 7997df122a | ||
|   | 0c03b63c0f | ||
|   | 5ed2f1d964 | ||
|   | 515793450e | ||
|   | 541e9b0b4f | ||
|   | 24611df4c6 | ||
|   | 083010d43c | ||
|   | f9b46fd6b0 | ||
|   | 74eb6f96ab | ||
|   | 4967fcd2be | ||
|   | e973110de7 | ||
|   | a62503328b | ||
|   | e42051d3a9 | ||
|   | e5336b7351 | ||
|   | 5469af35f1 | ||
|   | 8c9cd8f9d2 | ||
|   | 8b3ac5ea36 | ||
|   | c230825486 | ||
|   | e8b0f5da60 | ||
|   | bc45e11824 | ||
|   | d6b3e97c34 | ||
|   | d35a12b4f4 | ||
|   | a42f103500 | ||
|   | dc2a48c515 | ||
|   | db617e23f0 | ||
|   | 71189b1b74 | ||
|   | 5567de89e6 | ||
|   | 5430d79f53 | 
							
								
								
									
										2
									
								
								.github/workflows/build-dev.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/build-dev.yml
									
									
									
									
										vendored
									
									
								
							| @@ -21,7 +21,7 @@ jobs: | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         target: ['actiontec_web7200', 'cig_wf188n', 'cig_wf196', 'cig_wf610d', 'cig_wf808', 'cybertan_eww622-a1', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_eap104', 'liteon_wpx8324', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'edgecore_ecw5410', 'edgecore_oap100', 'edgecore_ssw2ac2600', 'edgecore_spw2ac1200', 'edgecore_spw2ac1200-lan-poe', 'hfcl_ion4', 'hfcl_ion4xe', 'hfcl_ion4xi', 'hfcl_ion4x', 'hfcl_ion4x_2', 'indio_um-305ac', 'indio_um-305ax', 'indio_um-325ac', 'indio_um-510ac-v3', 'indio_um-550ac', 'indio_um-310ax-v1', 'indio_um-510axp-v1', 'indio_um-510axm-v1', 'linksys_ea6350-v4', 'linksys_e8450-ubi', 'linksys_ea8300', 'meshpp_s618_cp03', 'meshpp_s618_cp01', 'udaya_a5-id2', 'wallys_dr40x9', 'wallys_dr6018', 'wallys_dr6018_v4', 'x64_vm' ] | ||||
|         target: ['actiontec_web7200', 'cig_wf188n', 'cig_wf194c4', 'cig_wf196', 'cig_wf610d', 'cig_wf808', 'cybertan_eww622-a1', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_eap104', 'liteon_wpx8324', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'edgecore_ecw5410', 'edgecore_oap100', 'edgecore_ssw2ac2600', 'edgecore_spw2ac1200', 'edgecore_spw2ac1200-lan-poe', 'hfcl_ion4', 'hfcl_ion4xe', 'hfcl_ion4xi', 'hfcl_ion4x', 'hfcl_ion4x_2', 'indio_um-305ac', 'indio_um-305ax', 'indio_um-325ac', 'indio_um-510ac-v3', 'indio_um-550ac', 'indio_um-310ax-v1', 'indio_um-510axp-v1', 'indio_um-510axm-v1', 'linksys_ea6350-v4', 'linksys_e8450-ubi', 'linksys_ea8300', 'meshpp_s618_cp03', 'meshpp_s618_cp01', 'udaya_a5-id2', 'wallys_dr40x9', 'wallys_dr6018', 'wallys_dr6018_v4', 'x64_vm', 'yuncore_ax840', 'yuncore_fap640', 'yuncore_fap650' ] | ||||
|  | ||||
|     steps: | ||||
|     - uses: actions/checkout@v3 | ||||
|   | ||||
| @@ -50,6 +50,7 @@ glinet,ax1800|\ | ||||
| glinet,axt1800) | ||||
| 	ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth0" "tx rx link" | ||||
| 	;; | ||||
| yuncore,fap650|\ | ||||
| muxi,ap3220l) | ||||
|         ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy0tpt" | ||||
|         ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy1tpt" | ||||
|   | ||||
| @@ -59,6 +59,10 @@ qcom_setup_interfaces() | ||||
| 		ucidef_set_interface_lan "eth1" | ||||
| 		ucidef_set_interface_wan "eth0" | ||||
| 		;; | ||||
| 	yuncore,fap650) | ||||
| 		ucidef_set_interface_lan "eth3 eth2 eth1 eth0" | ||||
| 		ucidef_set_interface_wan "eth4" | ||||
| 		;; | ||||
| 	qcom,ipq807x-hk14) | ||||
| 		ucidef_set_interface_lan "eth0 eth1 eth2 eth3" | ||||
| 		ucidef_set_interface_wan "eth4" | ||||
|   | ||||
| @@ -116,6 +116,7 @@ case "$FIRMWARE" in | ||||
| 	xiaomi,ax1800|\ | ||||
| 	glinet,ax1800|\ | ||||
| 	yuncore,ax840|\ | ||||
| 	yuncore,fap650|\ | ||||
| 	plasmacloud,pax1800-v1|\ | ||||
| 	plasmacloud,pax1800-v2) | ||||
|                 caldata_extract "0:ART" 0x1000 0x20000   | ||||
| @@ -193,7 +194,8 @@ ath11k-macs) | ||||
| 		ath11k_generate_macs | ||||
| 		;; | ||||
| 	cig,wf194c|\ | ||||
| 	cig,wf194c) | ||||
| 	cig,wf194c4|\ | ||||
| 	cig,wf196) | ||||
| 		ath11k_generate_macs_wf194 | ||||
| 		;; | ||||
| 	plasmacloud,pax1800-v1|\ | ||||
|   | ||||
| @@ -0,0 +1,18 @@ | ||||
| /* | ||||
|  * Copyright (c) 2019, 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 "../../../arm64/boot/dts/qcom/qcom-ipq6018-yuncore-fap650.dts" | ||||
| #include "qcom-ipq6018.dtsi" | ||||
| @@ -0,0 +1,423 @@ | ||||
| /dts-v1/; | ||||
| /* | ||||
|  * Copyright (c) 2019, 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 "qcom-ipq6018.dtsi" | ||||
| #include "qcom-ipq6018-rpm-regulator.dtsi" | ||||
| #include "qcom-ipq6018-cpr-regulator.dtsi" | ||||
| #include "qcom-ipq6018-cp-cpu.dtsi" | ||||
| #include <dt-bindings/input/input.h> | ||||
| #include <dt-bindings/gpio/gpio.h> | ||||
|  | ||||
| / { | ||||
| 	#address-cells = <0x2>; | ||||
| 	#size-cells = <0x2>; | ||||
| 	model = "Qualcomm Technologies, Inc. IPQ6018/AP-CP03-C1"; | ||||
| 	compatible = "yuncore,fap650", "qcom,ipq6018-cp03", "qcom,ipq6018"; | ||||
| 	interrupt-parent = <&intc>; | ||||
| 	qcom,msm-id = <0x1A5 0x0>; | ||||
|  | ||||
| 	aliases { | ||||
| 		/* | ||||
| 		 * Aliases as required by u-boot | ||||
| 		 * to patch MAC addresses | ||||
| 		 */ | ||||
| 		ethernet0 = "/soc/dp1"; | ||||
| 		ethernet1 = "/soc/dp2"; | ||||
| 		ethernet2 = "/soc/dp3"; | ||||
| 		ethernet3 = "/soc/dp4"; | ||||
| 		ethernet4 = "/soc/dp5"; | ||||
|  | ||||
| 		led-boot = &led_power; | ||||
| 		led-failsafe = &led_power; | ||||
| 		led-running = &led_power; | ||||
| 		led-upgrade = &led_power; | ||||
| 	}; | ||||
|  | ||||
| 	chosen { | ||||
| 		bootargs = "console=ttyMSM0,115200,n8 rw init=/init"; | ||||
| #ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 		bootargs-append = " swiotlb=1"; | ||||
| #else | ||||
| 		bootargs-append = " swiotlb=1 coherent_pool=2M"; | ||||
| #endif | ||||
| 	}; | ||||
|  | ||||
| 	/* | ||||
| 	 * +=========+==============+========================+ | ||||
| 	 * |        |              |                         | | ||||
| 	 * | Region | Start Offset |          Size           | | ||||
| 	 * |        |              |                         | | ||||
| 	 * +--------+--------------+-------------------------+ | ||||
| 	 * |        |              |                         | | ||||
| 	 * |        |              |                         | | ||||
| 	 * |        |              |                         | | ||||
| 	 * |        |              |                         | | ||||
| 	 * | Linux  |  0x41000000  |         139MB           | | ||||
| 	 * |        |              |                         | | ||||
| 	 * |        |              |                         | | ||||
| 	 * |        |              |                         | | ||||
| 	 * +--------+--------------+-------------------------+ | ||||
| 	 * | TZ App |  0x49B00000  |           6MB           | | ||||
| 	 * +--------+--------------+-------------------------+ | ||||
| 	 * | ||||
| 	 * From the available 145 MB for Linux in the first 256 MB, | ||||
| 	 * we are reserving 6 MB for TZAPP. | ||||
| 	 * | ||||
| 	 * Refer arch/arm64/boot/dts/qcom/qcom-ipq6018-memory.dtsi | ||||
| 	 * for memory layout. | ||||
| 	 */ | ||||
|  | ||||
| /* TZAPP is enabled only in default memory profile */ | ||||
| #if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__) | ||||
| 	reserved-memory { | ||||
| 		tzapp:tzapp@49B00000 {	/* TZAPPS */ | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x49B00000 0x0 0x00600000>; | ||||
| 		}; | ||||
| 	}; | ||||
| #endif | ||||
| }; | ||||
|  | ||||
| &tlmm { | ||||
| 	uart_pins: uart_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio44", "gpio45"; | ||||
| 			function = "blsp2_uart"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	spi_0_pins: spi_0_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio38", "gpio39", "gpio40", "gpio41"; | ||||
| 			function = "blsp0_spi"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	qpic_pins: qpic_pins { | ||||
| 		data_0 { | ||||
| 			pins = "gpio15"; | ||||
| 			function = "qpic_pad0"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		data_1 { | ||||
| 			pins = "gpio12"; | ||||
| 			function = "qpic_pad1"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		data_2 { | ||||
| 			pins = "gpio13"; | ||||
| 			function = "qpic_pad2"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		data_3 { | ||||
| 			pins = "gpio14"; | ||||
| 			function = "qpic_pad3"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		data_4 { | ||||
| 			pins = "gpio5"; | ||||
| 			function = "qpic_pad4"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		data_5 { | ||||
| 			pins = "gpio6"; | ||||
| 			function = "qpic_pad5"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		data_6 { | ||||
| 			pins = "gpio7"; | ||||
| 			function = "qpic_pad6"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		data_7 { | ||||
| 			pins = "gpio8"; | ||||
| 			function = "qpic_pad7"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		qpic_pad { | ||||
| 			pins = "gpio1", "gpio3", "gpio4", | ||||
| 			       "gpio10", "gpio11", "gpio17"; | ||||
| 			function = "qpic_pad"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	button_pins: button_pins { | ||||
| 		wps_button { | ||||
| 			pins = "gpio19"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	mdio_pins: mdio_pinmux { | ||||
| 		mux_0 { | ||||
| 			pins = "gpio64"; | ||||
| 			function = "mdc"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 		mux_1 { | ||||
| 			pins = "gpio65"; | ||||
| 			function = "mdio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 		mux_2 { | ||||
| 			pins = "gpio75"; | ||||
| 			function = "gpio"; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	leds_pins: leds_pins { | ||||
| 		led_sys { | ||||
| 			pins = "gpio32"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		led_5g { | ||||
| 			pins = "gpio35"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		led_2g { | ||||
| 			pins = "gpio37"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
| 	mdio@90000 { | ||||
| 		pinctrl-0 = <&mdio_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
| 		phy-reset-gpio = <&tlmm 75 0>; | ||||
| 		status = "ok"; | ||||
| 		phy0: ethernet-phy@0 { | ||||
| 			reg = <0>; | ||||
| 		}; | ||||
| 		phy1: ethernet-phy@1 { | ||||
| 			reg = <1>; | ||||
| 		}; | ||||
| 		phy2: ethernet-phy@2 { | ||||
| 			reg = <2>; | ||||
| 		}; | ||||
| 		phy3: ethernet-phy@3 { | ||||
| 			reg = <3>; | ||||
| 		}; | ||||
| 		phy4: ethernet-phy@4 { | ||||
| 			reg = <4>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	ess-switch@3a000000 { | ||||
| 		switch_cpu_bmp = <0x1>;  /* cpu port bitmap */ | ||||
| 		switch_lan_bmp = <0x1e>; /* lan port bitmap */ | ||||
| 		switch_wan_bmp = <0x20>; /* wan port bitmap */ | ||||
| 		switch_inner_bmp = <0xc0>; /*inner port bitmap*/ | ||||
| 		switch_mac_mode = <0x0>; /* mac mode for uniphy instance0*/ | ||||
| 		switch_mac_mode1 = <0xff>; /* mac mode for uniphy instance1*/ | ||||
| 		switch_mac_mode2 = <0xff>; /* mac mode for uniphy instance2*/ | ||||
| 		qcom,port_phyinfo { | ||||
| 			port@3 { | ||||
| 				port_id = <3>; | ||||
| 				phy_address = <4>; | ||||
| 			}; | ||||
| 			port@4 { | ||||
| 				port_id = <4>; | ||||
| 				phy_address = <3>; | ||||
| 			}; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	dp1 { | ||||
| 		device_type = "network"; | ||||
| 		compatible = "qcom,nss-dp"; | ||||
| 		qcom,id = <1>; | ||||
| 		reg = <0x3a001000 0x200>; | ||||
| 		qcom,mactype = <0>; | ||||
| 		local-mac-address = [000000000000]; | ||||
| 		qcom,link-poll = <1>; | ||||
| 		qcom,phy-mdio-addr = <0>; | ||||
| 		phy-mode = "sgmii"; | ||||
| 	}; | ||||
|  | ||||
| 	dp2 { | ||||
| 		device_type = "network"; | ||||
| 		compatible = "qcom,nss-dp"; | ||||
| 		qcom,id = <2>; | ||||
| 		reg = <0x3a001200 0x200>; | ||||
| 		qcom,mactype = <0>; | ||||
| 		local-mac-address = [000000000000]; | ||||
| 		qcom,link-poll = <1>; | ||||
| 		qcom,phy-mdio-addr = <1>; | ||||
| 		phy-mode = "sgmii"; | ||||
| 	}; | ||||
|  | ||||
| 	dp3 { | ||||
| 		device_type = "network"; | ||||
| 		compatible = "qcom,nss-dp"; | ||||
| 		qcom,id = <3>; | ||||
| 		reg = <0x3a001400 0x200>; | ||||
| 		qcom,mactype = <0>; | ||||
| 		local-mac-address = [000000000000]; | ||||
| 		qcom,link-poll = <1>; | ||||
| 		qcom,phy-mdio-addr = <2>; | ||||
| 		phy-mode = "sgmii"; | ||||
| 	}; | ||||
|  | ||||
| 	dp4 { | ||||
| 		device_type = "network"; | ||||
| 		compatible = "qcom,nss-dp"; | ||||
| 		qcom,id = <4>; | ||||
| 		reg = <0x3a001600 0x200>; | ||||
| 		qcom,mactype = <0>; | ||||
| 		local-mac-address = [000000000000]; | ||||
| 		qcom,link-poll = <1>; | ||||
| 		qcom,phy-mdio-addr = <3>; | ||||
| 		phy-mode = "sgmii"; | ||||
| 	}; | ||||
|  | ||||
| 	dp5 { | ||||
| 		device_type = "network"; | ||||
| 		compatible = "qcom,nss-dp"; | ||||
| 		qcom,id = <5>; | ||||
| 		reg = <0x3a001800 0x200>; | ||||
| 		qcom,mactype = <0>; | ||||
| 		local-mac-address = [000000000000]; | ||||
| 		qcom,link-poll = <1>; | ||||
| 		qcom,phy-mdio-addr = <4>; | ||||
| 		phy-mode = "sgmii"; | ||||
| 	}; | ||||
|  | ||||
| 	leds { | ||||
| 		compatible = "gpio-leds"; | ||||
| 		pinctrl-0 = <&leds_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		led_power: led@32 { | ||||
| 			label = "green:power"; | ||||
| 			gpios = <&tlmm 32 GPIO_ACTIVE_HIGH>; | ||||
| 			default-state = "on"; | ||||
| 		}; | ||||
|  | ||||
| 		led@35 { | ||||
| 			label = "green:wifi5"; | ||||
| 			gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; | ||||
| 			default-state = "off"; | ||||
| 		}; | ||||
|  | ||||
| 		led@37 { | ||||
| 			label = "green:wifi2"; | ||||
| 			gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; | ||||
| 			default-state = "off"; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	gpio_keys { | ||||
| 		compatible = "gpio-keys"; | ||||
| 		pinctrl-0 = <&button_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		wps { | ||||
| 			label = "reset"; | ||||
| 			linux,code = <KEY_RESTART>; | ||||
| 			gpios = <&tlmm 19 GPIO_ACTIVE_LOW>; | ||||
| 			linux,input-type = <1>; | ||||
| 			debounce-interval = <60>; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &blsp1_uart3 { | ||||
| 	pinctrl-0 = <&uart_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &spi_0 { | ||||
| 	pinctrl-0 = <&spi_0_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	cs-select = <0>; | ||||
| 	status = "ok"; | ||||
|  | ||||
| 	m25p80@0 { | ||||
| 		#address-cells = <1>; | ||||
| 		#size-cells = <1>; | ||||
| 		reg = <0>; | ||||
| 		compatible = "n25q128a11"; | ||||
| 		linux,modalias = "m25p80", "n25q128a11"; | ||||
| 		spi-max-frequency = <50000000>; | ||||
| 		use-default-sizes; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &qpic_bam { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &nand { | ||||
| 	pinctrl-0 = <&qpic_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &ssphy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qusb_phy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &usb3 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &nss_crypto { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| /* TZAPP is enabled in default memory profile only */ | ||||
| #if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__) | ||||
| &qseecom { | ||||
| 	mem-start = <0x49B00000>; | ||||
| 	mem-size = <0x600000>; | ||||
| 	status = "ok"; | ||||
| }; | ||||
| #endif | ||||
| @@ -185,3 +185,13 @@ define Device/meshpp_s618_cp01 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-meshpp-s618 -kmod-usb-dwc3-of-simple kmod-usb-dwc3-qcom kmod-usb3 | ||||
| endef | ||||
| TARGET_DEVICES += meshpp_s618_cp01 | ||||
|  | ||||
| define Device/yuncore_fap650 | ||||
|   DEVICE_TITLE := YunCore FAP 650 | ||||
|   DEVICE_DTS := qcom-ipq6018-yuncore-fap650 | ||||
|   SUPPORTED_DEVICES := yuncore,fap650 | ||||
|   DEVICE_DTS_CONFIG := config@cp03-c1 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-yuncore-fap650 | ||||
| endef | ||||
| TARGET_DEVICES += yuncore_fap650 | ||||
|  | ||||
|   | ||||
| @@ -52,6 +52,6 @@ start_service() { | ||||
| } | ||||
|  | ||||
| service_started() { | ||||
| 	ubus -t 10 wait_for atfpolicy | ||||
| 	ubus -t 2 wait_for atfpolicy | ||||
| 	[ $? = 0 ] && reload_service | ||||
| } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
| case $2 in | ||||
| AP-STA-CONNECTED) | ||||
| 	[ $4 = 0 -o $5 = 0 ] && { | ||||
| 		ubus call ratelimit client_set '{"device": "'$1'", "address": "'$3'", "defaults": "'$(ubus call wifi iface | jsonfilter -e "@.$1.ssid")'" }' | ||||
| 		ubus call ratelimit client_set '{"device": "'$1'", "address": "'$3'", "defaults": "'$(ubus call wifi iface | jsonfilter -e "@['$1'].ssid")'" }' | ||||
| 		logger ratelimit addclient $1 $3 $ssid | ||||
| 		return | ||||
| 	} | ||||
|   | ||||
| @@ -4,9 +4,10 @@ PKG_NAME:=ucentral-schema | ||||
| PKG_RELEASE:=1 | ||||
|  | ||||
| PKG_SOURCE_URL=https://github.com/Telecominfraproject/wlan-ucentral-schema.git | ||||
| PKG_MIRROR_HASH:=52c322f964bf66e9d559c26dc9e7ca868a49ae1894b23c7581cb60effd48371c | ||||
| PKG_SOURCE_PROTO:=git | ||||
| PKG_SOURCE_DATE:=2022-05-29 | ||||
| PKG_SOURCE_VERSION:=084fa1a01d0acbdd8fc8e110b9519efb6e32ee8f | ||||
| PKG_SOURCE_VERSION:=ad84690d77cc80f9017d634fdee5053d29f17262 | ||||
|  | ||||
| PKG_MAINTAINER:=John Crispin <john@phrozen.org> | ||||
| PKG_LICENSE:=BSD-3-Clause | ||||
|   | ||||
| @@ -13,7 +13,7 @@ define Package/uspot | ||||
|   SECTION:=net | ||||
|   CATEGORY:=Network | ||||
|   TITLE:=hotspot daemon | ||||
|   DEPENDS:=+spotfilter +uhttpd-mod-ucode +libradcli | ||||
|   DEPENDS:=+spotfilter +uhttpd-mod-ucode +libradcli +iptables-mod-conntrack-extra +conntrack | ||||
| endef | ||||
|  | ||||
| define Package/uspot/install | ||||
|   | ||||
| @@ -56,20 +56,15 @@ function radius_call(mac, payload) { | ||||
| 	system('/usr/bin/radius-client /tmp/acct' + mac + '.json'); | ||||
| } | ||||
|  | ||||
| function radius_stop(mac) { | ||||
| function radius_stop(mac, payload) { | ||||
| 	if (!radius_available(mac)) | ||||
| 		return; | ||||
| 	debug(mac, 'stopping accounting'); | ||||
| 	ubus.call('spotfilter', 'client_set', payload); | ||||
| 	system('conntrack -D -s ' + clients[mac].ip4addr  + ' -m 2'); | ||||
| 	if (clients[mac].accounting) | ||||
| 		clients[mac].timeout.cancel(); | ||||
|  | ||||
| 	let payload = { | ||||
| 		acct: true, | ||||
| 		acct_type: 8, | ||||
| 		terminate_cause: 0, | ||||
| 	}; | ||||
| 	radius_init(mac, payload); | ||||
| 	radius_call(mac, payload); | ||||
| 	delete clients[mac]; | ||||
| } | ||||
|  | ||||
| function radius_acct(mac, payload) { | ||||
| @@ -122,7 +117,7 @@ function radius_logoff(mac) { | ||||
| 		return; | ||||
| 	let payload = { | ||||
| 		acct_type: 2, | ||||
| 		terminate_cause: 0, | ||||
| 		terminate_cause: 1, | ||||
| 	}; | ||||
| 	radius_acct(mac, payload); | ||||
| } | ||||
| @@ -174,6 +169,10 @@ function client_add(mac, state) { | ||||
| 		idle, | ||||
| 		max_total, | ||||
| 	}; | ||||
| 	if (state.ip4addr) | ||||
| 		clients[mac].ip4addr = state.ip4addr; | ||||
| 	if (state.ip6addr) | ||||
| 		clients[mac].ip6addr = state.ip6addr; | ||||
| 	if (state.data?.radius?.request) | ||||
| 		clients[mac].radius= state.data.radius.request; | ||||
| 	syslog(mac, 'adding client'); | ||||
| @@ -183,39 +182,34 @@ function client_add(mac, state) { | ||||
|  | ||||
| function client_remove(mac, reason) { | ||||
| 	syslog(mac, reason); | ||||
| 	radius_stop(mac); | ||||
| 	delete clients[mac]; | ||||
| 	ubus.call('spotfilter', 'client_remove', { | ||||
| 			interface: "hotspot", | ||||
| 			address: mac | ||||
| 		}); | ||||
| 	radius_stop(mac, { | ||||
| 		interface: "hotspot", | ||||
| 		address: mac | ||||
| 	}); | ||||
| } | ||||
|  | ||||
| function client_flush(mac) { | ||||
| 	syslog(mac, 'logoff event'); | ||||
| 	radius_stop(mac); | ||||
| 	ubus.call('spotfilter', 'client_set', { | ||||
| 			interface: 'hotspot', | ||||
| 			address: mac, | ||||
| 			state: 0, | ||||
| 			dns_state: 1, | ||||
| 			accounting: [], | ||||
| 			flush: true | ||||
| 		}); | ||||
| 	radius_stop(mac, { | ||||
| 		interface: 'hotspot', | ||||
| 		address: mac, | ||||
| 		state: 0, | ||||
| 		dns_state: 1, | ||||
| 		accounting: [], | ||||
| 		flush: true | ||||
| 	}); | ||||
| } | ||||
|  | ||||
| function client_timeout(mac, reason) { | ||||
| 	syslog(mac, reason); | ||||
| 	radius_stop(mac); | ||||
| 	delete clients[mac]; | ||||
| 	ubus.call('spotfilter', 'client_set', { | ||||
| 			interface: "hotspot", | ||||
| 			state: 0, | ||||
| 			dns_state: 1, | ||||
| 			address: mac, | ||||
| 			accounting: [], | ||||
| 			flush: true, | ||||
| 		}); | ||||
| 	radius_stop(mac, { | ||||
| 		interface: "hotspot", | ||||
| 		state: 0, | ||||
| 		dns_state: 1, | ||||
| 		address: mac, | ||||
| 		accounting: [], | ||||
| 		flush: true, | ||||
| 	}); | ||||
| } | ||||
|  | ||||
| uloop.init(); | ||||
|   | ||||
							
								
								
									
										3
									
								
								feeds/ucentral/uspot/files/usr/share/uspot/firewall.ipt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								feeds/ucentral/uspot/files/usr/share/uspot/firewall.ipt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| *mangle | ||||
| -A POSTROUTING -m mark --mark 0x2 -j CONNMARK --set-mark 0x2 | ||||
| COMMIT | ||||
| @@ -47,6 +47,7 @@ ALLWIFIBOARDS:= \ | ||||
| 	tplink-ex227 \ | ||||
| 	tplink-ex447 \ | ||||
| 	yuncore-ax840 \ | ||||
| 	yuncore-fap650 \ | ||||
| 	meshpp-s618 | ||||
|  | ||||
| ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ath11k-wifi-$(BOARD)) | ||||
| @@ -254,6 +255,7 @@ $(eval $(call generate-ath11k-wifi-package,tplink-ex447,TP-Link EX447)) | ||||
| $(eval $(call generate-ath11k-wifi-package,yuncore-ax840,YunCore AX840)) | ||||
| $(eval $(call generate-ath11k-wifi-package,meshpp-s618,Mesh++ S618)) | ||||
| $(eval $(call generate-ath11k-wifi-package,muxi-ap3220l,MUXI AP3220L)) | ||||
| $(eval $(call generate-ath11k-wifi-package,yuncore-fap650,YunCore FAP650)) | ||||
|  | ||||
| $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) | ||||
| $(eval $(call BuildPackage,ath11k-wifi-qcom-ipq5018)) | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								feeds/wifi-ax/ath11k-wifi/board-yuncore-fap650.bin.IPQ6018
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								feeds/wifi-ax/ath11k-wifi/board-yuncore-fap650.bin.IPQ6018
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -552,11 +552,13 @@ append_radius_server() { | ||||
| 	json_get_vars \ | ||||
| 		auth_server auth_secret auth_port \ | ||||
| 		dae_client dae_secret dae_port \ | ||||
| 		ownip radius_client_addr \ | ||||
| 		dynamic_ownip ownip radius_client_addr \ | ||||
| 		eap_reauth_period request_cui \ | ||||
| 		erp_domain mobility_domain \ | ||||
| 		fils_realm fils_dhcp | ||||
|  | ||||
| 	set_default dynamic_ownip 1 | ||||
|  | ||||
| 	# legacy compatibility | ||||
| 	[ -n "$auth_server" ] || json_get_var auth_server server | ||||
| 	[ -n "$auth_port" ] || json_get_var auth_port port | ||||
| @@ -605,7 +607,12 @@ append_radius_server() { | ||||
| 	} | ||||
| 	json_for_each_item append_radius_auth_req_attr radius_auth_req_attr | ||||
|  | ||||
| 	[ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N" | ||||
| 	if [ -n "$ownip" ]; then | ||||
| 		append bss_conf "own_ip_addr=$ownip" "$N" | ||||
| 	elif [ "$dynamic_ownip" -gt 0 ]; then | ||||
| 		append bss_conf "dynamic_own_ip_addr=$dynamic_ownip" "$N" | ||||
| 	fi | ||||
|  | ||||
| 	[ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N" | ||||
| 	[ "$macfilter" = radius ] && append bss_conf "macaddr_acl=2" "$N" | ||||
| } | ||||
| @@ -698,7 +705,9 @@ hostapd_set_bss_options() { | ||||
| 		[ -n "$wpa_strict_rekey" ] && append bss_conf "wpa_strict_rekey=$wpa_strict_rekey" "$N" | ||||
| 	} | ||||
|  | ||||
| 	[ -n "$nasid" ] && append bss_conf "nas_identifier=$nasid" "$N" | ||||
| 	set_default nasid "${macaddr//\:}" | ||||
| 	append bss_conf "nas_identifier=$nasid" "$N" | ||||
|  | ||||
| 	[ -n "$acct_server" ] && { | ||||
| 		append bss_conf "acct_server_addr=$acct_server" "$N" | ||||
| 		append bss_conf "acct_server_port=$acct_port" "$N" | ||||
| @@ -916,7 +925,6 @@ hostapd_set_bss_options() { | ||||
| 			append bss_conf "ft_psk_generate_local=$ft_psk_generate_local" "$N" | ||||
| 			append bss_conf "ft_over_ds=$ft_over_ds" "$N" | ||||
| 			append bss_conf "reassociation_deadline=$reassociation_deadline" "$N" | ||||
| 			[ -n "$nasid" ] || append bss_conf "nas_identifier=${macaddr//\:}" "$N" | ||||
|  | ||||
| 			if [ "$skip_kh_setup" -eq "0" ]; then | ||||
| 				json_get_vars r0_key_lifetime r1_key_holder pmk_r1_push | ||||
|   | ||||
							
								
								
									
										109
									
								
								feeds/wifi-ax/hostapd/patches/760-dynamic_own_ip.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								feeds/wifi-ax/hostapd/patches/760-dynamic_own_ip.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
| --- a/src/ap/ap_config.h | ||||
| +++ b/src/ap/ap_config.h | ||||
| @@ -311,6 +311,7 @@ struct hostapd_bss_config { | ||||
|  	unsigned int eap_sim_db_timeout; | ||||
|  	int eap_server_erp; /* Whether ERP is enabled on internal EAP server */ | ||||
|  	struct hostapd_ip_addr own_ip_addr; | ||||
| +	int dynamic_own_ip_addr; | ||||
|  	char *nas_identifier; | ||||
|  	struct hostapd_radius_servers *radius; | ||||
|  	int acct_interim_interval; | ||||
| --- a/src/radius/radius_client.c | ||||
| +++ b/src/radius/radius_client.c | ||||
| @@ -163,6 +163,8 @@ struct radius_client_data { | ||||
|  	 */ | ||||
|  	void *ctx; | ||||
|   | ||||
| +	struct hostapd_ip_addr local_ip; | ||||
| + | ||||
|  	/** | ||||
|  	 * conf - RADIUS client configuration (list of RADIUS servers to use) | ||||
|  	 */ | ||||
| @@ -720,6 +722,30 @@ static void radius_client_list_add(struc | ||||
|   | ||||
|   | ||||
|  /** | ||||
| + * radius_client_send - Get local address for the RADIUS auth socket | ||||
| + * @radius: RADIUS client context from radius_client_init() | ||||
| + * @addr: pointer to store the address | ||||
| + * | ||||
| + * This function returns the local address for the connection to the RADIUS | ||||
| + * auth server. It also opens the socket if it's not available yet. | ||||
| + */ | ||||
| +int radius_client_get_local_addr(struct radius_client_data *radius, | ||||
| +				 struct hostapd_ip_addr *addr) | ||||
| +{ | ||||
| +	struct hostapd_radius_servers *conf = radius->conf; | ||||
| + | ||||
| +	if (conf->auth_server && radius->auth_sock < 0) | ||||
| +		radius_client_init_auth(radius); | ||||
| + | ||||
| +	if (radius->auth_sock < 0) | ||||
| +		return -1; | ||||
| + | ||||
| +	memcpy(addr, &radius->local_ip, sizeof(*addr)); | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +/** | ||||
|   * radius_client_send - Send a RADIUS request | ||||
|   * @radius: RADIUS client context from radius_client_init() | ||||
|   * @msg: RADIUS message to be sent | ||||
| @@ -1238,6 +1264,10 @@ radius_change_server(struct radius_clien | ||||
|  			wpa_printf(MSG_DEBUG, "RADIUS local address: %s:%u", | ||||
|  				   inet_ntoa(claddr.sin_addr), | ||||
|  				   ntohs(claddr.sin_port)); | ||||
| +			if (auth) { | ||||
| +				radius->local_ip.af = AF_INET; | ||||
| +				radius->local_ip.u.v4 = claddr.sin_addr; | ||||
| +			} | ||||
|  		} | ||||
|  		break; | ||||
|  #ifdef CONFIG_IPV6 | ||||
| @@ -1249,6 +1279,10 @@ radius_change_server(struct radius_clien | ||||
|  				   inet_ntop(AF_INET6, &claddr6.sin6_addr, | ||||
|  					     abuf, sizeof(abuf)), | ||||
|  				   ntohs(claddr6.sin6_port)); | ||||
| +			if (auth) { | ||||
| +				radius->local_ip.af = AF_INET6; | ||||
| +				radius->local_ip.u.v6 = claddr6.sin6_addr; | ||||
| +			} | ||||
|  		} | ||||
|  		break; | ||||
|  	} | ||||
| --- a/src/radius/radius_client.h | ||||
| +++ b/src/radius/radius_client.h | ||||
| @@ -249,6 +249,8 @@ int radius_client_register(struct radius | ||||
|  void radius_client_set_interim_error_cb(struct radius_client_data *radius, | ||||
|  					void (*cb)(const u8 *addr, void *ctx), | ||||
|  					void *ctx); | ||||
| +int radius_client_get_local_addr(struct radius_client_data *radius, | ||||
| +				 struct hostapd_ip_addr * addr); | ||||
|  int radius_client_send(struct radius_client_data *radius, | ||||
|  		       struct radius_msg *msg, | ||||
|  		       RadiusType msg_type, const u8 *addr); | ||||
| --- a/src/ap/ieee802_1x.c | ||||
| +++ b/src/ap/ieee802_1x.c | ||||
| @@ -535,6 +535,10 @@ int add_common_radius_attr(struct hostap | ||||
|  	struct hostapd_radius_attr *attr; | ||||
|  	int len; | ||||
|   | ||||
| +	if (hapd->conf->dynamic_own_ip_addr) | ||||
| +		radius_client_get_local_addr(hapd->radius, | ||||
| +					     &hapd->conf->own_ip_addr); | ||||
| + | ||||
|  	if (!hostapd_config_get_radius_attr(req_attr, | ||||
|  					    RADIUS_ATTR_NAS_IP_ADDRESS) && | ||||
|  	    hapd->conf->own_ip_addr.af == AF_INET && | ||||
| --- a/hostapd/config_file.c | ||||
| +++ b/hostapd/config_file.c | ||||
| @@ -2681,6 +2681,8 @@ static int hostapd_config_fill(struct ho | ||||
|  	} else if (os_strcmp(buf, "iapp_interface") == 0) { | ||||
|  		wpa_printf(MSG_INFO, "DEPRECATED: iapp_interface not used"); | ||||
|  #endif /* CONFIG_IAPP */ | ||||
| +	} else if (os_strcmp(buf, "dynamic_own_ip_addr") == 0) { | ||||
| +		bss->dynamic_own_ip_addr = atoi(pos); | ||||
|  	} else if (os_strcmp(buf, "own_ip_addr") == 0) { | ||||
|  		if (hostapd_parse_ip_addr(pos, &bss->own_ip_addr)) { | ||||
|  			wpa_printf(MSG_ERROR, | ||||
| @@ -1,76 +1,298 @@ | ||||
| Index: hostapd-2021-02-20-59e9794c/src/ap/hostapd.c | ||||
| =================================================================== | ||||
| --- hostapd-2021-02-20-59e9794c.orig/src/ap/hostapd.c | ||||
| +++ hostapd-2021-02-20-59e9794c/src/ap/hostapd.c | ||||
| @@ -862,7 +862,6 @@ static int hostapd_das_nas_mismatch(stru | ||||
|  	return 0; | ||||
|  } | ||||
|   | ||||
| - | ||||
|  static struct sta_info * hostapd_das_find_sta(struct hostapd_data *hapd, | ||||
|  					      struct radius_das_attrs *attr, | ||||
|  					      int *multi) | ||||
| @@ -1050,6 +1049,24 @@ static int hostapd_das_disconnect_pmksa( | ||||
|  } | ||||
| --- a/src/radius/radius_das.h | ||||
| +++ b/src/radius/radius_das.h | ||||
| @@ -44,6 +44,7 @@ struct radius_das_attrs { | ||||
|  struct radius_das_conf { | ||||
|  	int port; | ||||
|  	const u8 *shared_secret; | ||||
| +	const u8 *nas_identifier; | ||||
|  	size_t shared_secret_len; | ||||
|  	const struct hostapd_ip_addr *client_addr; | ||||
|  	unsigned int time_window; | ||||
| --- a/src/ap/hostapd.c | ||||
| +++ b/src/ap/hostapd.c | ||||
| @@ -1367,6 +1367,7 @@ static int hostapd_setup_bss(struct host | ||||
|  		struct radius_das_conf das_conf; | ||||
|  		os_memset(&das_conf, 0, sizeof(das_conf)); | ||||
|  		das_conf.port = conf->radius_das_port; | ||||
| +		das_conf.nas_identifier = conf->nas_identifier; | ||||
|  		das_conf.shared_secret = conf->radius_das_shared_secret; | ||||
|  		das_conf.shared_secret_len = | ||||
|  			conf->radius_das_shared_secret_len; | ||||
| --- a/src/radius/radius_das.c | ||||
| +++ b/src/radius/radius_das.c | ||||
| @@ -12,13 +12,26 @@ | ||||
|  #include "utils/common.h" | ||||
|  #include "utils/eloop.h" | ||||
|  #include "utils/ip_addr.h" | ||||
| +#include "utils/list.h" | ||||
|  #include "radius.h" | ||||
|  #include "radius_das.h" | ||||
|   | ||||
|   | ||||
| +static struct hostapd_data * ap_get_hapd(struct hostapd_data *hapd, struct radius_das_attrs *attr) | ||||
| +{ | ||||
| +	size_t i; | ||||
| +	int multi; | ||||
| -struct radius_das_data { | ||||
| +static struct dl_list das_ports = DL_LIST_HEAD_INIT(das_ports); | ||||
| + | ||||
| +	for (i = 0; i < hapd->iface->num_bss; i++) { | ||||
| +		if (!hapd->iface->bss[i]->iface->bss[i]->radius_das) | ||||
| +			continue; | ||||
| +		if (hapd->conf->radius_das_port !=hapd->iface->bss[i]->iface->bss[i]->conf->radius_das_port) | ||||
| +			continue; | ||||
| +		if (hostapd_das_find_sta(hapd, attr, &multi)) | ||||
| +			return hapd->iface->bss[i]; | ||||
| +struct radius_das_port { | ||||
| +	struct dl_list list; | ||||
| +	struct dl_list das_data; | ||||
| + | ||||
| +	int port; | ||||
|  	int sock; | ||||
| +}; | ||||
| + | ||||
| +struct radius_das_data { | ||||
| +	struct dl_list list; | ||||
| +	struct radius_das_port *port; | ||||
|  	u8 *shared_secret; | ||||
| +	u8 *nas_identifier; | ||||
|  	size_t shared_secret_len; | ||||
|  	struct hostapd_ip_addr client_addr; | ||||
|  	unsigned int time_window; | ||||
| @@ -378,56 +391,17 @@ fail: | ||||
|  } | ||||
|   | ||||
|   | ||||
| -static void radius_das_receive(int sock, void *eloop_ctx, void *sock_ctx) | ||||
| +static void | ||||
| +radius_das_receive_msg(struct radius_das_data *das, struct radius_msg *msg, | ||||
| +		       struct sockaddr *from, socklen_t fromlen, | ||||
| +		       char *abuf, int from_port) | ||||
|  { | ||||
| -	struct radius_das_data *das = eloop_ctx; | ||||
| -	u8 buf[1500]; | ||||
| -	union { | ||||
| -		struct sockaddr_storage ss; | ||||
| -		struct sockaddr_in sin; | ||||
| -#ifdef CONFIG_IPV6 | ||||
| -		struct sockaddr_in6 sin6; | ||||
| -#endif /* CONFIG_IPV6 */ | ||||
| -	} from; | ||||
| -	char abuf[50]; | ||||
| -	int from_port = 0; | ||||
| -	socklen_t fromlen; | ||||
| -	int len; | ||||
| -	struct radius_msg *msg, *reply = NULL; | ||||
| +	struct radius_msg *reply = NULL; | ||||
|  	struct radius_hdr *hdr; | ||||
|  	struct wpabuf *rbuf; | ||||
| +	struct os_time now; | ||||
|  	u32 val; | ||||
|  	int res; | ||||
| -	struct os_time now; | ||||
| - | ||||
| -	fromlen = sizeof(from); | ||||
| -	len = recvfrom(sock, buf, sizeof(buf), 0, | ||||
| -		       (struct sockaddr *) &from.ss, &fromlen); | ||||
| -	if (len < 0) { | ||||
| -		wpa_printf(MSG_ERROR, "DAS: recvfrom: %s", strerror(errno)); | ||||
| -		return; | ||||
| -	} | ||||
| - | ||||
| -	os_strlcpy(abuf, inet_ntoa(from.sin.sin_addr), sizeof(abuf)); | ||||
| -	from_port = ntohs(from.sin.sin_port); | ||||
| - | ||||
| -	wpa_printf(MSG_DEBUG, "DAS: Received %d bytes from %s:%d", | ||||
| -		   len, abuf, from_port); | ||||
| -	if (das->client_addr.u.v4.s_addr && | ||||
| -	    das->client_addr.u.v4.s_addr != from.sin.sin_addr.s_addr) { | ||||
| -		wpa_printf(MSG_DEBUG, "DAS: Drop message from unknown client"); | ||||
| -		return; | ||||
| -	} | ||||
| - | ||||
| -	msg = radius_msg_parse(buf, len); | ||||
| -	if (msg == NULL) { | ||||
| -		wpa_printf(MSG_DEBUG, "DAS: Parsing incoming RADIUS packet " | ||||
| -			   "from %s:%d failed", abuf, from_port); | ||||
| -		return; | ||||
| -	} | ||||
| - | ||||
| -	if (wpa_debug_level <= MSG_MSGDUMP) | ||||
| -		radius_msg_dump(msg); | ||||
|   | ||||
|  	if (radius_msg_verify_das_req(msg, das->shared_secret, | ||||
|  				       das->shared_secret_len, | ||||
| @@ -494,9 +468,8 @@ static void radius_das_receive(int sock, | ||||
|  			radius_msg_dump(reply); | ||||
|   | ||||
|  		rbuf = radius_msg_get_buf(reply); | ||||
| -		res = sendto(das->sock, wpabuf_head(rbuf), | ||||
| -			     wpabuf_len(rbuf), 0, | ||||
| -			     (struct sockaddr *) &from.ss, fromlen); | ||||
| +		res = sendto(das->port->sock, wpabuf_head(rbuf), | ||||
| +			     wpabuf_len(rbuf), 0, from, fromlen); | ||||
|  		if (res < 0) { | ||||
|  			wpa_printf(MSG_ERROR, "DAS: sendto(to %s:%d): %s", | ||||
|  				   abuf, from_port, strerror(errno)); | ||||
| @@ -508,6 +481,72 @@ fail: | ||||
|  	radius_msg_free(reply); | ||||
|  } | ||||
|   | ||||
| +static void radius_das_receive(int sock, void *eloop_ctx, void *sock_ctx) | ||||
| +{ | ||||
| +	struct radius_das_port *p = eloop_ctx; | ||||
| +	struct radius_das_data *das; | ||||
| +	u8 buf[1500]; | ||||
| +	union { | ||||
| +		struct sockaddr_storage ss; | ||||
| +		struct sockaddr_in sin; | ||||
| +#ifdef CONFIG_IPV6 | ||||
| +		struct sockaddr_in6 sin6; | ||||
| +#endif /* CONFIG_IPV6 */ | ||||
| +	} from; | ||||
| +	struct radius_msg *msg; | ||||
| +	size_t nasid_len = 0; | ||||
| +	u8 *nasid_buf = NULL; | ||||
| +	char abuf[50]; | ||||
| +	int from_port = 0; | ||||
| +	socklen_t fromlen; | ||||
| +	int found = 0; | ||||
| +	int len; | ||||
| + | ||||
| +	fromlen = sizeof(from); | ||||
| +	len = recvfrom(sock, buf, sizeof(buf), 0, | ||||
| +		       (struct sockaddr *) &from.ss, &fromlen); | ||||
| +	if (len < 0) { | ||||
| +		wpa_printf(MSG_ERROR, "DAS: recvfrom: %s", strerror(errno)); | ||||
| +		return; | ||||
| +	} | ||||
| +	return hapd; | ||||
| + | ||||
| +	os_strlcpy(abuf, inet_ntoa(from.sin.sin_addr), sizeof(abuf)); | ||||
| +	from_port = ntohs(from.sin.sin_port); | ||||
| + | ||||
| +	msg = radius_msg_parse(buf, len); | ||||
| +	if (msg == NULL) { | ||||
| +		wpa_printf(MSG_DEBUG, "DAS: Parsing incoming RADIUS packet " | ||||
| +			   "from %s:%d failed", abuf, from_port); | ||||
| +		return; | ||||
| +	} | ||||
| + | ||||
| +	wpa_printf(MSG_DEBUG, "DAS: Received %d bytes from %s:%d", | ||||
| +		   len, abuf, from_port); | ||||
| + | ||||
| +	if (wpa_debug_level <= MSG_MSGDUMP) | ||||
| +		radius_msg_dump(msg); | ||||
| + | ||||
| +	radius_msg_get_attr_ptr(msg, RADIUS_ATTR_NAS_IDENTIFIER, | ||||
| +				&nasid_buf, &nasid_len, NULL); | ||||
| +	dl_list_for_each(das, &p->das_data, struct radius_das_data, list) { | ||||
| +		if (das->client_addr.u.v4.s_addr && | ||||
| +		    das->client_addr.u.v4.s_addr != from.sin.sin_addr.s_addr) | ||||
| +			continue; | ||||
| + | ||||
| +		if (das->nas_identifier && nasid_buf && | ||||
| +		    (nasid_len != os_strlen(das->nas_identifier) || | ||||
| +		     os_memcmp(das->nas_identifier, nasid_buf, nasid_len) != 0)) | ||||
| +			continue; | ||||
| + | ||||
| +		found = 1; | ||||
| +		radius_das_receive_msg(das, msg, (struct sockaddr *)&from.ss, | ||||
| +				       fromlen, abuf, from_port); | ||||
| +	} | ||||
| + | ||||
| +	if (!found) | ||||
| +		wpa_printf(MSG_DEBUG, "DAS: Drop message from unknown client"); | ||||
| +} | ||||
| + | ||||
| + | ||||
| + | ||||
|  static enum radius_das_res | ||||
|  hostapd_das_disconnect(void *ctx, struct radius_das_attrs *attr) | ||||
|   | ||||
|  static int radius_das_open_socket(int port) | ||||
|  { | ||||
| @@ -1057,6 +1074,10 @@ hostapd_das_disconnect(void *ctx, struct | ||||
|  	struct sta_info *sta; | ||||
|  	int multi; | ||||
| @@ -533,6 +572,49 @@ static int radius_das_open_socket(int po | ||||
|  } | ||||
|   | ||||
| +	hapd = ap_get_hapd(hapd, attr); | ||||
| +	if (!hapd) | ||||
| +		return RADIUS_DAS_SESSION_NOT_FOUND; | ||||
|   | ||||
| +static struct radius_das_port * | ||||
| +radius_das_open_port(int port) | ||||
| +{ | ||||
| +	struct radius_das_port *p; | ||||
| + | ||||
|  	if (hostapd_das_nas_mismatch(hapd, attr)) | ||||
|  		return RADIUS_DAS_NAS_MISMATCH; | ||||
|   | ||||
| @@ -1096,6 +1117,10 @@ hostapd_das_coa(void *ctx, struct radius | ||||
|  	struct sta_info *sta; | ||||
|  	int multi; | ||||
|   | ||||
| +	hapd = ap_get_hapd(hapd, attr); | ||||
| +	if (!hapd) | ||||
| +		return RADIUS_DAS_SESSION_NOT_FOUND; | ||||
| +	dl_list_for_each(p, &das_ports, struct radius_das_port, list) { | ||||
| +		if (p->port == port) | ||||
| +			return p; | ||||
| +	} | ||||
| + | ||||
|  	if (hostapd_das_nas_mismatch(hapd, attr)) | ||||
|  		return RADIUS_DAS_NAS_MISMATCH; | ||||
| +	p = os_zalloc(sizeof(*p)); | ||||
| +	if (p == NULL) | ||||
| +		return NULL; | ||||
| + | ||||
| +	dl_list_init(&p->das_data); | ||||
| +	p->port = port; | ||||
| +	p->sock = radius_das_open_socket(port); | ||||
| +	if (p->sock < 0) | ||||
| +		goto free_port; | ||||
| + | ||||
| +	if (eloop_register_read_sock(p->sock, radius_das_receive, p, NULL)) | ||||
| +		goto close_port; | ||||
| + | ||||
| +	dl_list_add(&das_ports, &p->list); | ||||
| + | ||||
| +	return p; | ||||
| + | ||||
| +close_port: | ||||
| +	close(p->sock); | ||||
| +free_port: | ||||
| +	os_free(p); | ||||
| + | ||||
| +	return NULL; | ||||
| +} | ||||
| + | ||||
| +static void radius_das_close_port(struct radius_das_port *p) | ||||
| +{ | ||||
| +	dl_list_del(&p->list); | ||||
| +	eloop_unregister_read_sock(p->sock); | ||||
| +	close(p->sock); | ||||
| +	free(p); | ||||
| +} | ||||
| + | ||||
|  struct radius_das_data * | ||||
|  radius_das_init(struct radius_das_conf *conf) | ||||
|  { | ||||
| @@ -553,6 +635,8 @@ radius_das_init(struct radius_das_conf * | ||||
|  	das->ctx = conf->ctx; | ||||
|  	das->disconnect = conf->disconnect; | ||||
|  	das->coa = conf->coa; | ||||
| +	if (conf->nas_identifier) | ||||
| +		das->nas_identifier = os_strdup(conf->nas_identifier); | ||||
|   | ||||
| Index: hostapd-2021-02-20-59e9794c/src/radius/radius_das.c | ||||
| =================================================================== | ||||
| --- hostapd-2021-02-20-59e9794c.orig/src/radius/radius_das.c | ||||
| +++ hostapd-2021-02-20-59e9794c/src/radius/radius_das.c | ||||
| @@ -568,10 +568,9 @@ radius_das_init(struct radius_das_conf * | ||||
|  	os_memcpy(&das->client_addr, conf->client_addr, | ||||
|  		  sizeof(das->client_addr)); | ||||
| @@ -565,19 +649,15 @@ radius_das_init(struct radius_das_conf * | ||||
|  	} | ||||
|  	das->shared_secret_len = conf->shared_secret_len; | ||||
|   | ||||
|  	das->sock = radius_das_open_socket(conf->port); | ||||
|  	if (das->sock < 0) { | ||||
| -		wpa_printf(MSG_ERROR, "Failed to open UDP socket for RADIUS " | ||||
| +		wpa_printf(MSG_ERROR, "Failed to open UDP socket for RADIUS - reusing existing port " | ||||
| -	das->sock = radius_das_open_socket(conf->port); | ||||
| -	if (das->sock < 0) { | ||||
| +	das->port = radius_das_open_port(conf->port); | ||||
| +	if (!das->port) { | ||||
|  		wpa_printf(MSG_ERROR, "Failed to open UDP socket for RADIUS " | ||||
|  			   "DAS"); | ||||
| -		radius_das_deinit(das); | ||||
| -		return NULL; | ||||
| +		return das; | ||||
|  		radius_das_deinit(das); | ||||
|  		return NULL; | ||||
|  	} | ||||
|   | ||||
|  	if (eloop_register_read_sock(das->sock, radius_das_receive, das, NULL)) | ||||
| -	if (eloop_register_read_sock(das->sock, radius_das_receive, das, NULL)) | ||||
| -	{ | ||||
| -		radius_das_deinit(das); | ||||
| -		return NULL; | ||||
| -	} | ||||
| +	dl_list_add(&das->port->das_data, &das->list); | ||||
|   | ||||
|  	return das; | ||||
|  } | ||||
| @@ -588,11 +668,14 @@ void radius_das_deinit(struct radius_das | ||||
|  	if (das == NULL) | ||||
|  		return; | ||||
|   | ||||
| -	if (das->sock >= 0) { | ||||
| -		eloop_unregister_read_sock(das->sock); | ||||
| -		close(das->sock); | ||||
| +	if (das->port) { | ||||
| +		dl_list_del(&das->list); | ||||
| + | ||||
| +		if (dl_list_empty(&das->port->das_data)) | ||||
| +			radius_das_close_port(das->port); | ||||
|  	} | ||||
|   | ||||
| +	os_free(das->nas_identifier); | ||||
|  	os_free(das->shared_secret); | ||||
|  	os_free(das); | ||||
|  } | ||||
|   | ||||
| @@ -2,11 +2,22 @@ Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/q | ||||
| =================================================================== | ||||
| --- backports-20210222_001-4.4.60-b157d2276.orig/drivers/net/wireless/ath/ath11k/qmi.c | ||||
| +++ backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/qmi.c | ||||
| @@ -3161,6 +3161,12 @@ out_req: | ||||
| @@ -3161,6 +3161,23 @@ out_req: | ||||
|  	return ret; | ||||
|  } | ||||
|   | ||||
| +static const struct firmware *fw_macs; | ||||
| +static int fw_macs_num = 0; | ||||
| + | ||||
| +int ath11k_get_custom_macs_num(int num) | ||||
| +{ | ||||
| +	int ret = fw_macs_num; | ||||
| + | ||||
| +	fw_macs_num += num; | ||||
| + | ||||
| +	return ret; | ||||
| +} | ||||
| + | ||||
| +const struct firmware* ath11k_get_custom_macs(void) | ||||
| +{ | ||||
| +	return fw_macs; | ||||
| @@ -15,7 +26,7 @@ Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/q | ||||
|  static int ath11k_qmi_load_bdf_qmi(struct ath11k_base *ab) | ||||
|  { | ||||
|  	char filename[ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE]; | ||||
| @@ -3188,6 +3194,8 @@ static int ath11k_qmi_load_bdf_qmi(struc | ||||
| @@ -3188,6 +3205,8 @@ static int ath11k_qmi_load_bdf_qmi(struc | ||||
|  		goto out; | ||||
|  	} | ||||
|   | ||||
| @@ -36,11 +47,12 @@ Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/w | ||||
|   | ||||
|  struct wmi_tlv_policy { | ||||
|  	size_t min_len; | ||||
| @@ -7278,11 +7279,14 @@ mem_free: | ||||
| @@ -7268,11 +7269,15 @@ mem_free: | ||||
|  	return ret; | ||||
|  } | ||||
|   | ||||
| +const struct firmware* ath11k_get_custom_macs(void); | ||||
| +int ath11k_get_custom_macs_num(int num); | ||||
| + | ||||
|  static int ath11k_wmi_tlv_rdy_parse(struct ath11k_base *ab, u16 tag, u16 len, | ||||
|  				    const void *ptr, void *data) | ||||
| @@ -51,17 +63,18 @@ Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/w | ||||
|  	struct wmi_mac_addr *addr_list; | ||||
|  	struct ath11k_pdev *pdev; | ||||
|  	u32 num_mac_addr; | ||||
| @@ -7307,6 +7311,19 @@ static int ath11k_wmi_tlv_rdy_parse(stru | ||||
| @@ -7297,6 +7302,20 @@ static int ath11k_wmi_tlv_rdy_parse(stru | ||||
|  		addr_list = (struct wmi_mac_addr *)ptr; | ||||
|  		num_mac_addr = rdy_parse->num_extra_mac_addr; | ||||
|   | ||||
| +		fw_entry = ath11k_get_custom_macs(); | ||||
| +		if (fw_entry) { | ||||
| +			int num = ath11k_get_custom_macs_num(ab->num_radios); | ||||
| +			printk("applying ath11k-macs\n"); | ||||
| +			if (fw_entry->size >= (ab->num_radios * 6)) { | ||||
| +			if (fw_entry->size >= ((num + ab->num_radios) * 6)) { | ||||
| +				for (i = 0; i < ab->num_radios; i++) { | ||||
| +					pdev = &ab->pdevs[i]; | ||||
| +		                        ether_addr_copy(pdev->mac_addr, &fw_entry->data[i * 6]); | ||||
| +		                        ether_addr_copy(pdev->mac_addr, &fw_entry->data[(num + i) * 6]); | ||||
| +				} | ||||
| +			} | ||||
| +			ab->pdevs_macaddr_valid = true; | ||||
|   | ||||
| @@ -1,16 +1,16 @@ | ||||
| From 1749748819caa03e249e8a5df1311498550cbd3b Mon Sep 17 00:00:00 2001 | ||||
| From c931a11e400ddf501f6796c62ba512195a1561ce Mon Sep 17 00:00:00 2001 | ||||
| From: John Crispin <john@phrozen.org> | ||||
| Date: Sat, 18 Jul 2020 08:53:44 +0200 | ||||
| Subject: [PATCH 68/83] ipq807x: add the Qualcomm AX target support | ||||
| Subject: [PATCH] ipq807x: add the Qualcomm AX target support | ||||
|  | ||||
| Signed-off-by: John Crispin <john@phrozen.org> | ||||
| --- | ||||
|  config/Config-kernel.in                   |  9 ++++++ | ||||
|  include/image.mk                          |  6 +++- | ||||
|  include/kernel-version.mk                 |  2 +- | ||||
|  package/boot/uboot-envtools/Makefile      |  5 --- | ||||
|  package/boot/uboot-envtools/files/ipq807x | 37 +++++++++++++++++++++++ | ||||
|  toolchain/kernel-headers/Makefile         |  8 +++++ | ||||
|  5 files changed, 60 insertions(+), 2 deletions(-) | ||||
|  5 files changed, 52 insertions(+), 7 deletions(-) | ||||
|  create mode 100644 package/boot/uboot-envtools/files/ipq807x | ||||
|  | ||||
| diff --git a/config/Config-kernel.in b/config/Config-kernel.in | ||||
| @@ -70,13 +70,29 @@ index c7aba61cd7..efecf2f919 100644 | ||||
|  LINUX_KERNEL_HASH-4.14.193 = 0b0fb41d4430e1a42738b341cbfd2f41951aa5cd02acabbd53f076119c8b9f03 | ||||
|  LINUX_KERNEL_HASH-5.4.158 = 6e018fecdc8fc24553756e582d83b82d65b10a6b03ef36262a24911f839b8d59 | ||||
|  LINUX_KERNEL_HASH-5.10.27 = d99dc9662951299c53a0a8d8c8d0a72a16ff861d20e927c0f9b14f63282d69d9 | ||||
| diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile | ||||
| index a9eccec0ce..0696c81bea 100644 | ||||
| --- a/package/boot/uboot-envtools/Makefile | ||||
| +++ b/package/boot/uboot-envtools/Makefile | ||||
| @@ -58,11 +58,6 @@ MAKE_FLAGS += \ | ||||
|  	no-dot-config-targets=envtools \ | ||||
|  	envtools | ||||
|   | ||||
| -define Package/uboot-envtools/conffiles | ||||
| -/etc/config/ubootenv | ||||
| -/etc/fw_env.config | ||||
| -endef | ||||
| - | ||||
|  define Package/uboot-envtools/install | ||||
|  	$(INSTALL_DIR) $(1)/usr/sbin | ||||
|  	$(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/env/fw_printenv $(1)/usr/sbin | ||||
| diff --git a/package/boot/uboot-envtools/files/ipq807x b/package/boot/uboot-envtools/files/ipq807x | ||||
| new file mode 100644 | ||||
| index 0000000000..6c429f1852 | ||||
| index 0000000000..84ed73f288 | ||||
| --- /dev/null | ||||
| +++ b/package/boot/uboot-envtools/files/ipq807x | ||||
| @@ -0,0 +1,37 @@ | ||||
| +[ -e /etc/config/ubootenv ] && exit 0 | ||||
| +[ -e /etc/config/ubootenv ] && rm /etc/config/ubootenv | ||||
| + | ||||
| +touch /etc/config/ubootenv | ||||
| + | ||||
|   | ||||
							
								
								
									
										301
									
								
								patches/ramips/0017-ramips-add-support-for-YunCore-FAP640.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										301
									
								
								patches/ramips/0017-ramips-add-support-for-YunCore-FAP640.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,301 @@ | ||||
| From dbd1fbf93aa42f4bd69ec6af4c4741229f5d7005 Mon Sep 17 00:00:00 2001 | ||||
| From: Volodymyr Puiul <volodymyr.puiul@gmail.com> | ||||
| Date: Thu, 8 Dec 2022 15:20:40 +0100 | ||||
| Subject: [PATCH] ramips: add support for YunCore FAP640 | ||||
|  | ||||
| It is an in-wall 802.11ax (Wi-Fi 6) router, based on MediaTek MT7621A. | ||||
|  | ||||
| Specifications: | ||||
| - SoC: MT7621AT (880MHz, 2 Cores) | ||||
| - RAM: 128 MB | ||||
| - Flash: 16 MB SPI | ||||
| - Wi-Fi: | ||||
|     - MT7915DN + MT7905DAN: 2.4/5 GHz | ||||
| - Ethernet: 5x1GiE via MT7530, 1xWAN with POE and 4xLAN | ||||
| - UART: J4 (115200 baud) | ||||
|     - Pinout: [3V3] (TXD) (RXD) (GND) | ||||
| - Power: 802.11af/at PoE; | ||||
|  | ||||
| - Bootloader: U-Boot | ||||
| - Buttons: | ||||
|     - Reset | ||||
| - LEDs: | ||||
|     - Status - RGB controlled by | ||||
|       - GPIO 14 LOW - green color | ||||
|       - GPIO 15 LOW- red color | ||||
|       - GPIO 16 LOW - blue color | ||||
|     - WAN - gren color, controlled by switch GPIO 12 LOW | ||||
|     - LAN1 - gren color, controlled by switch GPIO 9 HIGH | ||||
|     - LAN2 - gren color, controlled by switch GPIO 6 LOW | ||||
|     - LAN3 - gren color, controlled by switch GPIO 3 LOW | ||||
|     - LAN4 - gren color, controlled by switch GPIO 0 LOW | ||||
|  | ||||
| Installation: | ||||
| OEM firmware is based on LEDE with custom UI and support standard sysupgrade | ||||
| variant of firmware. However it requires "*.ubin" extension for sysupgrade file. | ||||
| Always select "Factory reset" switch on upgrade to OpenWRT, otherwise | ||||
| router will not boot. | ||||
|  | ||||
| MAC addresses with OEM firmware: | ||||
| vendor   source | ||||
| lan      factory 0x4 (label) | ||||
| 5g       factory 0x4 (label) | ||||
| 2g       label with flipped bits bit in 1-st byte and bits 5, 6, 7 in | ||||
|   4-th byte | ||||
|  | ||||
| Example | ||||
| label:  44:xx:xx:b7:xx:xx | ||||
| lan:    44:xx:xx:b7:xx:xx | ||||
| 2g      46:xx:xx:c7:xx:xx | ||||
| 5g      44:xx:xx:b7:xx:xx | ||||
|  | ||||
| Signed-off-by: Volodymyr Puiul <volodymyr.puiul@gmail.com> | ||||
| --- | ||||
|  .../ramips/dts/mt7621_yuncore_fap640.dts      | 198 ++++++++++++++++++ | ||||
|  target/linux/ramips/image/mt7621.mk           |  10 + | ||||
|  .../etc/hotplug.d/ieee80211/10_fix_wifi_mac   |   5 + | ||||
|  3 files changed, 213 insertions(+) | ||||
|  create mode 100644 target/linux/ramips/dts/mt7621_yuncore_fap640.dts | ||||
|  | ||||
| diff --git a/target/linux/ramips/dts/mt7621_yuncore_fap640.dts b/target/linux/ramips/dts/mt7621_yuncore_fap640.dts | ||||
| new file mode 100644 | ||||
| index 0000000000..b48546d825 | ||||
| --- /dev/null | ||||
| +++ b/target/linux/ramips/dts/mt7621_yuncore_fap640.dts | ||||
| @@ -0,0 +1,198 @@ | ||||
| +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT | ||||
| + | ||||
| +#include "mt7621.dtsi" | ||||
| + | ||||
| +#include <dt-bindings/gpio/gpio.h> | ||||
| +#include <dt-bindings/input/input.h> | ||||
| + | ||||
| +/ { | ||||
| +	compatible = "yuncore,fap640", "mediatek,mt7621-soc"; | ||||
| +	model = "YunCore FAP640"; | ||||
| + | ||||
| +	aliases { | ||||
| +		led-boot = &led_status_blue; | ||||
| +		led-failsafe = &led_status_red; | ||||
| +		led-running = &led_status_green; | ||||
| +		led-upgrade = &led_status_red; | ||||
| +		label-mac-device = &gmac0; | ||||
| +	}; | ||||
| + | ||||
| +	chosen { | ||||
| +		bootargs = "console=ttyS0,115200"; | ||||
| +	}; | ||||
| + | ||||
| +	leds { | ||||
| +		compatible = "gpio-leds"; | ||||
| + | ||||
| +		led_status_green: status_green { | ||||
| +			label = "green:status"; | ||||
| +			gpios = <&gpio 14 GPIO_ACTIVE_LOW>; | ||||
| +		}; | ||||
| + | ||||
| +		led_status_red: status_red { | ||||
| +			label = "red:status"; | ||||
| +			gpios = <&gpio 15 GPIO_ACTIVE_LOW>; | ||||
| +		}; | ||||
| + | ||||
| +		led_status_blue: status_blue { | ||||
| +			label = "blue:status"; | ||||
| +			gpios = <&gpio 16 GPIO_ACTIVE_LOW>; | ||||
| +		}; | ||||
| + | ||||
| +		wan { | ||||
| +			label = "green:wan"; | ||||
| +			gpios = <&switch0 12 GPIO_ACTIVE_LOW>; | ||||
| +			linux,default-trigger = "mt7530-0:04:link"; | ||||
| +		}; | ||||
| + | ||||
| +		lan1 { | ||||
| +			label = "green:lan1"; | ||||
| +			gpios = <&switch0 9 GPIO_ACTIVE_HIGH>; | ||||
| +			linux,default-trigger = "mt7530-0:03:link"; | ||||
| +		}; | ||||
| + | ||||
| +		lan2 { | ||||
| +			label = "green:lan2"; | ||||
| +			gpios = <&switch0 6 GPIO_ACTIVE_LOW>; | ||||
| +			linux,default-trigger = "mt7530-0:02:link"; | ||||
| +		}; | ||||
| + | ||||
| +		lan3 { | ||||
| +			label = "green:lan3"; | ||||
| +			gpios = <&switch0 3 GPIO_ACTIVE_LOW>; | ||||
| +			linux,default-trigger = "mt7530-0:01:link"; | ||||
| +		}; | ||||
| + | ||||
| +		lan4 { | ||||
| +			label = "green:lan4"; | ||||
| +			gpios = <&switch0 0 GPIO_ACTIVE_LOW>; | ||||
| +			linux,default-trigger = "mt7530-0:00:link"; | ||||
| +		}; | ||||
| +	}; | ||||
| + | ||||
| +	watchdog { | ||||
| +		compatible = "linux,wdt-gpio"; | ||||
| +		gpios = <&gpio 0 GPIO_ACTIVE_LOW>; | ||||
| +		hw_algo = "toggle"; | ||||
| +		hw_margin_ms = <200>; | ||||
| +		always-running; | ||||
| +	}; | ||||
| + | ||||
| +	keys { | ||||
| +		compatible = "gpio-keys"; | ||||
| + | ||||
| +		reset { | ||||
| +			label = "reset"; | ||||
| +			gpios = <&gpio 18 GPIO_ACTIVE_LOW>; | ||||
| +			linux,code = <KEY_RESTART>; | ||||
| +		}; | ||||
| +	}; | ||||
| +}; | ||||
| + | ||||
| +&spi0 { | ||||
| +	status = "okay"; | ||||
| + | ||||
| +	flash@0 { | ||||
| +		compatible = "jedec,spi-nor"; | ||||
| +		reg = <0>; | ||||
| +		spi-max-frequency = <80000000>; | ||||
| +		m25p,fast-read; | ||||
| + | ||||
| +		partitions { | ||||
| +			compatible = "fixed-partitions"; | ||||
| +			#address-cells = <1>; | ||||
| +			#size-cells = <1>; | ||||
| + | ||||
| +			partition@0 { | ||||
| +				label = "Bootloader"; | ||||
| +				reg = <0x0 0x30000>; | ||||
| +				read-only; | ||||
| +			}; | ||||
| + | ||||
| +			partition@30000 { | ||||
| +				label = "Config"; | ||||
| +				reg = <0x30000 0x10000>; | ||||
| +				read-only; | ||||
| +			}; | ||||
| + | ||||
| +			/* range 0x40000 to 0x50000 is empty in vendor | ||||
| +			 * firmware, so we do not use it either | ||||
| +			 */ | ||||
| + | ||||
| +			factory: partition@50000 { | ||||
| +				label = "Factory"; | ||||
| +				reg = <0x50000 0x40000>; | ||||
| +				read-only; | ||||
| +			}; | ||||
| + | ||||
| +			partition@90000 { | ||||
| +				compatible = "denx,uimage"; | ||||
| +				label = "firmware"; | ||||
| +				reg = <0x90000 0xf60000>; | ||||
| +			}; | ||||
| + | ||||
| +			partition@ff0000 { | ||||
| +				label = "certificates"; | ||||
| +				reg = <0xff0000 0x10000>; | ||||
| +			}; | ||||
| +		}; | ||||
| +	}; | ||||
| +}; | ||||
| + | ||||
| +&pcie { | ||||
| +	status = "okay"; | ||||
| +}; | ||||
| + | ||||
| +&pcie1 { | ||||
| +	wifi@0,0 { | ||||
| +		compatible = "mediatek,mt76"; | ||||
| +		reg = <0x0000 0 0 0 0>; | ||||
| +		mediatek,mtd-eeprom = <&factory 0x0>; | ||||
| +		mediatek,disable-radar-background; | ||||
| +	}; | ||||
| +}; | ||||
| + | ||||
| +&gmac0 { | ||||
| +	mtd-mac-address = <&factory 0x4>; | ||||
| +}; | ||||
| + | ||||
| +&switch0 { | ||||
| +	gpio-controller; | ||||
| +	#gpio-cells = <2>; | ||||
| + | ||||
| +	ports { | ||||
| +		port@0 { | ||||
| +			status = "okay"; | ||||
| +			label = "lan4"; | ||||
| +		}; | ||||
| + | ||||
| +		port@1 { | ||||
| +			status = "okay"; | ||||
| +			label = "lan3"; | ||||
| +		}; | ||||
| + | ||||
| +		port@2 { | ||||
| +			status = "okay"; | ||||
| +			label = "lan2"; | ||||
| +		}; | ||||
| + | ||||
| +		port@3 { | ||||
| +			status = "okay"; | ||||
| +			label = "lan1"; | ||||
| +		}; | ||||
| + | ||||
| +		port@4 { | ||||
| +			status = "okay"; | ||||
| +			label = "wan"; | ||||
| +			mtd-mac-address = <&factory 0x4>; | ||||
| +			mtd-mac-address-increment = <1>; | ||||
| +		}; | ||||
| +	}; | ||||
| +}; | ||||
| + | ||||
| +&state_default { | ||||
| +	gpio { | ||||
| +		groups = "jtag", "wdt"; | ||||
| +		function = "gpio"; | ||||
| +	}; | ||||
| +}; | ||||
| diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk | ||||
| index 9e1eed024b..a528a257d4 100644 | ||||
| --- a/target/linux/ramips/image/mt7621.mk | ||||
| +++ b/target/linux/ramips/image/mt7621.mk | ||||
| @@ -1637,6 +1637,16 @@ define Device/youku_yk-l2 | ||||
|  endef | ||||
|  TARGET_DEVICES += youku_yk-l2 | ||||
|   | ||||
| +define Device/yuncore_fap640 | ||||
| +  $(Device/dsa-migration) | ||||
| +  $(Device/uimage-lzma-loader) | ||||
| +  IMAGE_SIZE := 15808k | ||||
| +  DEVICE_VENDOR := YunCore | ||||
| +  DEVICE_MODEL := FAP640 | ||||
| +  DEVICE_PACKAGES := kmod-mt7915e | ||||
| +endef | ||||
| +TARGET_DEVICES += yuncore_fap640 | ||||
| + | ||||
|  define Device/zbtlink_zbt-we1326 | ||||
|    $(Device/dsa-migration) | ||||
|    $(Device/uimage-lzma-loader) | ||||
| diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac | ||||
| index 157e706534..be7b226c32 100644 | ||||
| --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac | ||||
| +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac | ||||
| @@ -38,4 +38,9 @@ case "$board" in | ||||
|  		[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress | ||||
|  		[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress | ||||
|  		;; | ||||
| +	yuncore,fap640) | ||||
| +		hw_mac_addr="$(mtd_get_mac_binary Factory 0x4)" | ||||
| +		[ "$PHYNBR" = "0" ] && macaddr_setbit_la "$hw_mac_addr" > /sys${DEVPATH}/macaddress | ||||
| +		[ "$PHYNBR" = "1" ] && echo -n "$hw_mac_addr" > /sys${DEVPATH}/macaddress | ||||
| +		;; | ||||
|  esac | ||||
| --  | ||||
| 2.25.1 | ||||
|  | ||||
							
								
								
									
										8
									
								
								profiles/yuncore_fap640.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								profiles/yuncore_fap640.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| --- | ||||
| profile: yuncore_fap640 | ||||
| target: ramips | ||||
| subtarget: mt7621 | ||||
| description: Build image for the Yuncore FAP640 | ||||
| image: bin/targets/ramips/mt7621/openwrt-ramips-mt7621-yuncore_fap640-squashfs-sysupgrade.bin | ||||
| include: | ||||
|   - ucentral-ap | ||||
							
								
								
									
										12
									
								
								profiles/yuncore_fap650.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								profiles/yuncore_fap650.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| --- | ||||
| profile: yuncore_fap650 | ||||
| target: ipq807x | ||||
| subtarget: ipq60xx | ||||
| description: Build image for the YunCore FAP650 | ||||
| image: bin/targets/ipq807x/ipq60xx/openwrt-ipq807x-yuncore_fap650-squashfs-sysupgrade.tar | ||||
| feeds: | ||||
|   - name: ipq807x | ||||
|     path: ../../feeds/ipq807x | ||||
| include: | ||||
|   - wifi-ax | ||||
|   - ucentral-ap | ||||
		Reference in New Issue
	
	Block a user