mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 18:38:10 +00:00 
			
		
		
		
	Compare commits
	
		
			517 Commits
		
	
	
		
			v2.5.0-rc2
			...
			v2.9.0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 85ff703e2f | ||
|   | ebd7c79e65 | ||
|   | b3493bcf55 | ||
|   | 2b767fb84f | ||
|   | 560e9f326d | ||
|   | 3da1530926 | ||
|   | abcf6dd1fd | ||
|   | 2bcedafe0d | ||
|   | 71fc375a72 | ||
|   | 95bfa265ee | ||
|   | c0cf066900 | ||
|   | 6462efd6bc | ||
|   | 0bce7dc7a4 | ||
|   | a3f0fb23b7 | ||
|   | b9d20e083c | ||
|   | 725899248a | ||
|   | c8685f2352 | ||
|   | 7d10d77e35 | ||
|   | 96c391eaac | ||
|   | c700795895 | ||
|   | 8bcb4c2063 | ||
|   | fce075bd2c | ||
|   | ea95356ebd | ||
|   | 8111566f35 | ||
|   | c952b34858 | ||
|   | 792e3a8a2e | ||
|   | ae75067938 | ||
|   | 81b66ad44b | ||
|   | e193250291 | ||
|   | dc0dae6284 | ||
|   | 7c535de60d | ||
|   | 26192989cd | ||
|   | 317aaadcbd | ||
|   | c670733ea5 | ||
|   | f92617f24a | ||
|   | 337a68cf1d | ||
|   | e09633fc2a | ||
|   | d838391850 | ||
|   | d59e58b794 | ||
|   | ee7bf9671a | ||
|   | c4f0f367bc | ||
|   | 5f649ea1f4 | ||
|   | 397c6df34a | ||
|   | 7a37e9bf0b | ||
|   | e4ed881dd7 | ||
|   | 9aff26b7fb | ||
|   | 5603442a37 | ||
|   | 8a86ae3b7d | ||
|   | 9997af10a5 | ||
|   | 5fec90d4ca | ||
|   | f1a56edd09 | ||
|   | 3f03cfa7c4 | ||
|   | f34db0bb24 | ||
|   | 94d154c628 | ||
|   | 071962440e | ||
|   | 5171b52570 | ||
|   | fb282e2aff | ||
|   | 5013b9c7fe | ||
|   | 0e2fcfcb95 | ||
|   | a7ea6ef398 | ||
|   | b4a2291dce | ||
|   | 9348c426e5 | ||
|   | 678c4db8f0 | ||
|   | e979df64d1 | ||
|   | 43fa167f14 | ||
|   | 2a8858a3a2 | ||
|   | 977d16557a | ||
|   | 3db254c306 | ||
|   | 9274c3a719 | ||
|   | 993ff2624e | ||
|   | 60f6565d18 | ||
|   | 924d30af74 | ||
|   | c55d19c3c5 | ||
|   | 9221c3e7e7 | ||
|   | eb862cf2d2 | ||
|   | 1e3cef1a26 | ||
|   | 50fd49fd3d | ||
|   | 8e8a763485 | ||
|   | ab47566e82 | ||
|   | e9a834c205 | ||
|   | 6dc524e67b | ||
|   | b61b3aa06f | ||
|   | b9d43eb897 | ||
|   | c069ba71cc | ||
|   | df01a9acc0 | ||
|   | e0aa0eec98 | ||
|   | 2a145ba46a | ||
|   | 9f34e57df8 | ||
|   | 9c8affad09 | ||
|   | cd76797336 | ||
|   | feb26f21fd | ||
|   | 5ff23ce3cf | ||
|   | cacb8a23dd | ||
|   | f5604d42f6 | ||
|   | 8f74933b37 | ||
|   | 2d92eeab07 | ||
|   | c44ab8b4e6 | ||
|   | d3ad594940 | ||
|   | 8f53da4f79 | ||
|   | 1cc9673e8c | ||
|   | 258e484d5f | ||
|   | 7edbe99599 | ||
|   | fbcfddfbdc | ||
|   | 0e75b82eb6 | ||
|   | 492db67f64 | ||
|   | 6129f525d5 | ||
|   | 2ec381534e | ||
|   | 29d6d9f1ea | ||
|   | a530af9354 | ||
|   | e42fd1e3a4 | ||
|   | 30cfc34e1c | ||
|   | 0737a706ec | ||
|   | b3589c92dc | ||
|   | 0f40cb8e77 | ||
|   | a051edcd00 | ||
|   | 18b19c92be | ||
|   | a2eabf35e3 | ||
|   | 0dfe43f1e6 | ||
|   | 20cda84f47 | ||
|   | 0228173d53 | ||
|   | 0db604ad1e | ||
|   | c53d342b6a | ||
|   | 42e77e6f5a | ||
|   | e8bd819e39 | ||
|   | 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 | ||
|   | 9d82d88a0c | ||
|   | 0e264203de | ||
|   | 469443da2a | ||
|   | 692958d2fd | ||
|   | e65fa74071 | ||
|   | fb64d45c39 | ||
|   | 71e5c8f441 | ||
|   | 8e34f6653c | ||
|   | bee060b9bb | ||
|   | e3e94fe520 | ||
|   | 237c090cb4 | ||
|   | 74ea7a7a1e | ||
|   | 330dbd49e6 | ||
|   | a84b047061 | ||
|   | 3795060bf2 | ||
|   | e61ab97815 | ||
|   | 0162828df8 | ||
|   | 73cfef1203 | ||
|   | 3eb6360054 | ||
|   | 47e4bc585a | ||
|   | 3746722a4d | ||
|   | 5828971cfe | ||
|   | dd911cbf21 | ||
|   | f167553348 | ||
|   | d483c55c14 | ||
|   | d9815c0f62 | ||
|   | daadf043d8 | ||
|   | 1a56d5820d | ||
|   | 8e2f2fcce3 | ||
|   | fc5a841563 | ||
|   | d511a338df | ||
|   | a3d348b664 | ||
|   | b48506b156 | ||
|   | 17bb88b67a | ||
|   | 578a616b00 | ||
|   | 93f603e27c | ||
|   | 09b513550c | ||
|   | 5e451461cf | ||
|   | fd33396acb | ||
|   | 3bdfa68ff5 | ||
|   | 3dbc070f2c | ||
|   | b48e5eb057 | ||
|   | 3501bd9c11 | ||
|   | 70635ac911 | ||
|   | f9a00b7ebd | ||
|   | 5bec28b7e5 | ||
|   | e41818470f | ||
|   | a31422d3d7 | ||
|   | bea3d2c4f8 | ||
|   | 4c4cb58027 | ||
|   | 4312a42b62 | ||
|   | 011e5b6e1a | ||
|   | 8233c10569 | ||
|   | fb73d889ed | ||
|   | 80bfb8671d | ||
|   | 521df1a142 | ||
|   | 72a75b72ac | ||
|   | c22dce10d3 | ||
|   | 8eb801a0cc | ||
|   | 6eaef7adad | ||
|   | 0272d4bcad | ||
|   | 41c64e9978 | ||
|   | 9c2f0a098d | ||
|   | 0bb8d0dcc0 | ||
|   | a542660072 | ||
|   | 8ee15d0053 | ||
|   | 311515867c | ||
|   | 16bbcddd40 | ||
|   | a4b663b824 | ||
|   | 736ab2b803 | ||
|   | cd2fbd11f2 | ||
|   | 708fe70e75 | ||
|   | 0c9499c085 | ||
|   | d52d4ff627 | ||
|   | 324df56861 | ||
|   | a21a08e8bf | ||
|   | 393db0ec2a | ||
|   | ca26d347eb | ||
|   | c56b7adea8 | ||
|   | 84d31765db | ||
|   | fb617ea136 | ||
|   | 47468145c6 | ||
|   | 854c8a44d4 | ||
|   | 86948e1052 | ||
|   | 39053d366d | ||
|   | daaed910da | ||
|   | bf6abd80dd | ||
|   | e74e22e184 | ||
|   | b8f5e17e38 | ||
|   | 956a31db8f | ||
|   | 9eeefa2fbf | ||
|   | c33705ca60 | ||
|   | ba41e6773b | ||
|   | 8ebf884436 | ||
|   | 7d4353caf0 | ||
|   | fa6220a615 | ||
|   | 26517bb6ae | ||
|   | ea4c4b3fe5 | ||
|   | 00f273000e | ||
|   | 6014d3a04d | ||
|   | 08f082acfe | ||
|   | 12e5efcda4 | ||
|   | 26be5ba20e | ||
|   | dc2feb3cc7 | ||
|   | ed397f5ce4 | ||
|   | 19f0260c0a | ||
|   | 49c55bdec5 | ||
|   | 2ab86ee29d | ||
|   | 888aa40057 | ||
|   | 2291ccf198 | ||
|   | 1d031a0535 | ||
|   | cb7ed7a37b | ||
|   | e692aea19e | ||
|   | a8bb06fb1c | ||
|   | 63b5803086 | ||
|   | 68689674b7 | ||
|   | fccdccdba3 | ||
|   | 21176badf7 | ||
|   | 87adc56e60 | ||
|   | 0f8be3bbde | ||
|   | a3fc407f25 | ||
|   | 30c2c68579 | ||
|   | 736e3e58cf | ||
|   | b38cd9bb9f | ||
|   | d69a8f159d | ||
|   | baaa31f445 | ||
|   | cf18242ee5 | ||
|   | fdcfffd81d | ||
|   | c9a76b8d76 | ||
|   | 9bd53e7d91 | ||
|   | 812fb18160 | ||
|   | 0571cc73da | ||
|   | 6bdd93ce0f | ||
|   | 0603953d9f | ||
|   | 098c81376f | ||
|   | 7ef10fcfb4 | ||
|   | 823ac590ff | ||
|   | 9b68205dc0 | ||
|   | d8216dc583 | ||
|   | 2e3c52160c | ||
|   | 8686846a09 | ||
|   | 8de22ca44b | ||
|   | 3e692ed95a | ||
|   | 128bd3a17e | ||
|   | cc54c8654f | ||
|   | 200f627a9c | ||
|   | 0134c1cb64 | ||
|   | 5519ab913b | ||
|   | 530332fb51 | ||
|   | 8bb8c16b34 | ||
|   | a6a7d82607 | ||
|   | f78dc0cd77 | ||
|   | aaf830ae27 | ||
|   | 555e1a2b1b | ||
|   | 0fbe2e9089 | ||
|   | e87c1ca2dd | ||
|   | c0b3e38215 | ||
|   | 0bf5ea74b3 | ||
|   | 1c4c82a9df | ||
|   | 4d1022f29b | ||
|   | a652e6c8d2 | ||
|   | 7b91863cba | ||
|   | c7ad6eaf2c | ||
|   | c06923a022 | ||
|   | d9a8e771ae | ||
|   | 7e2cec9d91 | ||
|   | 84add765fe | ||
|   | f050d53ed4 | ||
|   | 26be8ab162 | ||
|   | 3f93f7c972 | ||
|   | 7bab50dd3c | ||
|   | cf657dbd94 | ||
|   | 33c9876760 | ||
|   | 4d6d7405d6 | ||
|   | e249701c34 | ||
|   | 0d50975152 | ||
|   | 6d87847d15 | ||
|   | eebe021780 | ||
|   | c6e0384f21 | ||
|   | 23ae850f72 | ||
|   | 708cf2dec6 | ||
|   | a95745d95b | ||
|   | 83ccea0abf | ||
|   | bfeaf89238 | ||
|   | 7439217b3c | ||
|   | ae2377f4d2 | ||
|   | b81d0aaf0e | ||
|   | 1546bef93f | ||
|   | 32b1aade42 | ||
|   | 2a92b75fe1 | ||
|   | cb30d9e20a | ||
|   | 588206b93b | ||
|   | 6399649038 | ||
|   | aa3cb95233 | ||
|   | 3ea06dac40 | ||
|   | a70dda4a8e | ||
|   | a01f1add81 | ||
|   | 57849591d7 | ||
|   | b4a09e7167 | ||
|   | 96bb8b1372 | ||
|   | 99ea9da785 | ||
|   | bfe7fadfc5 | ||
|   | ad1dcc4f45 | ||
|   | f371c789d0 | ||
|   | 386eca1f65 | ||
|   | 8b9047952d | ||
|   | 5a105ef06e | ||
|   | c60dc1e045 | ||
|   | 1e1bd19429 | ||
|   | cfe07f6e15 | ||
|   | a64039db20 | ||
|   | 7f81ddb8cc | ||
|   | 3c0d495334 | ||
|   | 38a7c54cce | ||
|   | 1aead07444 | ||
|   | d2f44cbb12 | ||
|   | 43d7ca31d6 | ||
|   | 0985c573b0 | ||
|   | d9ed861c1d | ||
|   | 8ef9989147 | ||
|   | 7d5eab4bf3 | ||
|   | 5e03e04bbd | ||
|   | 6fabaeca53 | ||
|   | be4ca445f5 | ||
|   | e99c8b27e1 | ||
|   | e9055b4f08 | ||
|   | cfcafb676b | ||
|   | 899b4d6bfd | ||
|   | 2003632ddb | ||
|   | d4a14106b7 | ||
|   | 85af9d7e0b | ||
|   | d4442efbfe | ||
|   | 3a26ae2695 | ||
|   | 09af596e85 | ||
|   | 5985187316 | ||
|   | 33ac83a309 | ||
|   | 921c1b553d | ||
|   | d160507230 | ||
|   | 7368620fd2 | ||
|   | a910e297a3 | ||
|   | f819bb8753 | ||
|   | cc0d4bded2 | ||
|   | e3b2b7f232 | ||
|   | c8dde50eba | ||
|   | 3c355f96eb | ||
|   | 93dd24ef6e | ||
|   | 107bc8ef65 | ||
|   | 9a8278afcc | ||
|   | 1c48765913 | ||
|   | c6a45184fd | ||
|   | 18d5b8cba7 | ||
|   | 65c08ade18 | ||
|   | 3f6fee91e9 | ||
|   | d29c4e49b3 | ||
|   | f162000749 | ||
|   | c804333bc0 | ||
|   | 449795db97 | ||
|   | af92a2c7aa | ||
|   | b68affdf6a | ||
|   | 7a95f9ac2d | ||
|   | 8b5d9d84de | ||
|   | 93d93c7708 | ||
|   | b35232ab4a | ||
|   | 770a2bdd36 | ||
|   | 9650f8eaa8 | ||
|   | 63ab76bb30 | ||
|   | fcb21ca0b6 | ||
|   | d6d5422152 | ||
|   | 5b970a3f12 | ||
|   | a4a7c1f9f3 | ||
|   | 5cbac23e3f | ||
|   | 172c0d3690 | ||
|   | 535f41d58b | ||
|   | 2be18091a4 | ||
|   | 73f42e3c6f | ||
|   | cff778d8ca | ||
|   | 94d4498a2d | ||
|   | eb0ab17f58 | ||
|   | 1ab99d50b2 | ||
|   | dfeddc0d89 | ||
|   | efde86be9d | ||
|   | 739e8c12fb | ||
|   | 3fdbbff9f7 | ||
|   | 0a56755bef | ||
|   | c35290772d | ||
|   | cedcbcbc2b | ||
|   | 9de96deca8 | ||
|   | 19dbb1d5e3 | ||
|   | 83b6ccf562 | ||
|   | ea86593835 | ||
|   | 36b5478005 | ||
|   | 1ad19297c1 | ||
|   | f5357f7854 | ||
|   | 8a3140b89b | ||
|   | 16e0724ace | ||
|   | 17ff9eecf5 | ||
|   | 4b870f978c | ||
|   | 8b83365961 | ||
|   | c6ebb5537a | ||
|   | 6ebe189d71 | ||
|   | 98b56551d5 | ||
|   | 606e27e256 | ||
|   | 94fe14b9f9 | ||
|   | 58388f84b6 | ||
|   | 79ea04af49 | ||
|   | 396e2bd06c | ||
|   | 1a484c7f39 | ||
|   | e6b1030991 | ||
|   | 6e32e68302 | ||
|   | 0f13f7f5cd | ||
|   | 2ac4f9ef1d | ||
|   | f1a75c25f9 | ||
|   | ff8d70753d | ||
|   | caea6baecd | ||
|   | 2e914c9b35 | ||
|   | da65d7e06f | ||
|   | d18eef480c | ||
|   | f3532c66e5 | ||
|   | 9678b1d6a5 | ||
|   | 379a4e2382 | ||
|   | edb33cd560 | ||
|   | 2ff425ddeb | ||
|   | 7d016ac27f | ||
|   | 9790377dec | ||
|   | 597c547101 | ||
|   | 73b2645027 | ||
|   | 8d58387d15 | ||
|   | 54dac4d348 | ||
|   | a0880ed0f1 | ||
|   | ed6d683980 | ||
|   | 4c72c6a35a | ||
|   | 125d56866e | ||
|   | a70a767ec0 | ||
|   | b8a6764207 | ||
|   | 98c9fcfd5d | ||
|   | eac5504fec | ||
|   | c2c75b67eb | ||
|   | ef3eacefa7 | ||
|   | ef7481596a | ||
|   | 6f4e00aa46 | ||
|   | be65578a7f | ||
|   | 20d4bd0c7d | ||
|   | 531f4eb811 | ||
|   | 3b0dae7189 | ||
|   | 79395593ba | ||
|   | 61248b98e0 | ||
|   | 72b5abb72a | ||
|   | 673a029a02 | ||
|   | 7efb85180f | ||
|   | f95eadaa8f | ||
|   | 6f6b40a94f | ||
|   | d84982f161 | ||
|   | 4b07afe59f | ||
|   | 5d53d138b0 | ||
|   | e40631b8cd | ||
|   | 22135129bd | ||
|   | de4b3c4edc | ||
|   | e3b1fe36e5 | ||
|   | 5af7e1e7d8 | ||
|   | 057ebb8660 | ||
|   | 17fe72c6e9 | ||
|   | 834ff2fe4f | ||
|   | ce3849e131 | ||
|   | 66640cdd1a | ||
|   | 300924a4be | ||
|   | 8fb088bcc8 | 
							
								
								
									
										39
									
								
								.github/actions/create-ami-from-image/action.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								.github/actions/create-ami-from-image/action.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| name: Create AMI from firmware image in S3 bucket | ||||
|  | ||||
| inputs: | ||||
|   firmware_image_name: | ||||
|     description: Name of the firmware image | ||||
|     required: true | ||||
|   firmware_image_s3_bucket: | ||||
|     description: Name of the S3 bucket where the image resides | ||||
|     required: true | ||||
|  | ||||
| runs: | ||||
|   using: "composite" | ||||
|   steps: | ||||
|     - name: Import snapshot based on firmware image | ||||
|       id: import_snapshot | ||||
|       shell: bash | ||||
|       run: | | ||||
|         echo "import_task_id=$(aws ec2 import-snapshot --description '${{ inputs.firmware_image_name }}' --disk-container 'Format=raw,UserBucket={S3Bucket=${{ inputs.firmware_image_s3_bucket }},S3Key=${{ inputs.firmware_image_name }}}' | jq -r '.ImportTaskId')" >> $GITHUB_OUTPUT | ||||
|  | ||||
|     - name: Wait for import task to complete and get snapshot ID | ||||
|       id: get_snapshot_id | ||||
|       shell: bash | ||||
|       run: | | ||||
|         IMPORT_TASK_STATUS="" | ||||
|         while [[ $IMPORT_TASK_STATUS != 'completed' ]]; do | ||||
|           IMPORT_TASK_STATUS=$(aws ec2 describe-import-snapshot-tasks --import-task-ids ${{ steps.import_snapshot.outputs.import_task_id }} | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.Status') | ||||
|           echo "Import task status is $IMPORT_TASK_STATUS, waiting for completion." | ||||
|         done | ||||
|         echo "id=$(aws ec2 describe-import-snapshot-tasks --import-task-ids ${{ steps.import_snapshot.outputs.import_task_id }} | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.SnapshotId')" >> $GITHUB_OUTPUT | ||||
|  | ||||
|     - name: Tag snapshot with image name | ||||
|       shell: bash | ||||
|       run: | | ||||
|         aws ec2 create-tags --resources ${{ steps.get_snapshot_id.outputs.id }} --tags 'Key=Name,Value=${{ inputs.firmware_image_name }}' | ||||
|  | ||||
|     - name: Register AMI based on snapshot | ||||
|       shell: bash | ||||
|       run: | | ||||
|         aws ec2 register-image --name '${{ inputs.firmware_image_name }}' --root-device-name /dev/xvda --block-device-mappings 'DeviceName=/dev/xvda,Ebs={SnapshotId=${{ steps.get_snapshot_id.outputs.id }}}' | ||||
							
								
								
									
										38
									
								
								.github/workflows/build-dev.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										38
									
								
								.github/workflows/build-dev.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,5 +1,13 @@ | ||||
| name: Build OpenWrt/uCentral images | ||||
|  | ||||
| env: | ||||
|   AWS_DEFAULT_OUTPUT: json | ||||
|   AWS_DEFAULT_REGION: us-east-1 | ||||
|   AWS_S3_BUCKET_NAME: ucentral-ap-firmware | ||||
|   AWS_ACCOUNT_ID: ${{ secrets.UCENTRAL_S3_ACCOUNT_ID }} | ||||
|   AWS_ACCESS_KEY_ID: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_ID }} | ||||
|   AWS_SECRET_ACCESS_KEY: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_SECRET }} | ||||
|  | ||||
| on: | ||||
|   push: | ||||
|     branches: [ main, next, staging-* ] | ||||
| @@ -8,13 +16,15 @@ on: | ||||
| jobs: | ||||
|   build: | ||||
|     runs-on: ubuntu-latest | ||||
|     outputs: | ||||
|       x64_vm_image_name: ${{ steps.package_and_upload_image.outputs.x64_vm_image_name }} | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         target: ['actiontec_web7200', 'cig_wf188n', 'cig_wf194c', 'cig_wf194c4', 'cig_wf160d', 'cig_wf808', 'cybertan_eww622-a1', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_eap104', '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' ] | ||||
|         target: ['actiontec_web7200', 'cig_wf188n', 'cig_wf194c4', 'cig_wf196-us', 'cig_wf196-ca', 'cig_wf610d', 'cig_wf660a', '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@v2 | ||||
|     - uses: actions/checkout@v3 | ||||
|  | ||||
|     - name: Build image for ${{ matrix.target }} | ||||
|       id: build | ||||
| @@ -24,17 +34,12 @@ jobs: | ||||
|         make -j TARGET=${{ matrix.target }} | ||||
|  | ||||
|     - name: Package and upload image for ${{ matrix.target }} | ||||
|       id: package_and_upload_image | ||||
|       env: | ||||
|           GH_BUILD_USERNAME: ${{ secrets.GH_BUILD_USERNAME }} | ||||
|           GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} | ||||
|           ARTIFACTORY_USERNAME: cicd-indoor-main | ||||
|           ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} | ||||
|           AWS_S3_BUCKET_NAME: ucentral-ap-firmware | ||||
|           AWS_DEFAULT_OUTPUT: json | ||||
|           AWS_DEFAULT_REGION: us-east-1 | ||||
|           AWS_ACCOUNT_ID: ${{ secrets.UCENTRAL_S3_ACCOUNT_ID }} | ||||
|           AWS_ACCESS_KEY_ID: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_ID }} | ||||
|           AWS_SECRET_ACCESS_KEY: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_SECRET }} | ||||
|       run: | | ||||
|         LOWERCASE_TARGET=`echo ${{ matrix.target }} | tr '[:upper:]' '[:lower:]'` | ||||
|         HASH=$(git rev-parse --short HEAD) | ||||
| @@ -66,6 +71,10 @@ jobs: | ||||
|         [ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/json" "latest-upgrade.json" "s3://$AWS_S3_BUCKET_NAME/$JSON_NAME" | ||||
|         [ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$JSON_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}" | ||||
|  | ||||
|         if [ ${{ matrix.target }} == 'x64_vm' ]; then | ||||
|           echo "x64_vm_image_name=$(echo $IMG_NAME)" >> $GITHUB_OUTPUT | ||||
|         fi | ||||
|  | ||||
|   trigger-testing: | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: build | ||||
| @@ -78,3 +87,16 @@ jobs: | ||||
|         repository: Telecominfraproject/wlan-testing | ||||
|         event-type: new-ap-release | ||||
|         client-payload: '{"ref": "${GITHUB_REF#refs/tags/}", "sha": "${{ github.sha }}"}' | ||||
|  | ||||
|   create-x64_vm-ami: | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: build | ||||
|     if: startsWith(github.ref, 'refs/tags/v') | ||||
|     steps: | ||||
|     - uses: actions/checkout@v3 | ||||
|  | ||||
|     - name: Use create-ami-from-image composite action | ||||
|       uses: ./.github/actions/create-ami-from-image | ||||
|       with: | ||||
|         firmware_image_name: ${{ needs.build.outputs.x64_vm_image_name }} | ||||
|         firmware_image_s3_bucket: ${{ env.AWS_S3_BUCKET_NAME }} | ||||
|   | ||||
							
								
								
									
										88
									
								
								.github/workflows/x64_vm-build-test.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								.github/workflows/x64_vm-build-test.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,88 @@ | ||||
| name: Test x64_vm build and AMI creation | ||||
|  | ||||
| env: | ||||
|   AWS_DEFAULT_OUTPUT: json | ||||
|   AWS_DEFAULT_REGION: us-east-1 | ||||
|   AWS_S3_BUCKET_NAME: ucentral-ap-firmware | ||||
|   AWS_ACCOUNT_ID: ${{ secrets.UCENTRAL_S3_ACCOUNT_ID }} | ||||
|   AWS_ACCESS_KEY_ID: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_ID }} | ||||
|   AWS_SECRET_ACCESS_KEY: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_SECRET }} | ||||
|  | ||||
| on: | ||||
|   workflow_dispatch: | ||||
|  | ||||
| jobs: | ||||
|   build: | ||||
|     runs-on: ubuntu-latest | ||||
|     outputs: | ||||
|       x64_vm_image_name: ${{ steps.package_and_upload_image.outputs.x64_vm_image_name }} | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         target: ['x64_vm'] | ||||
|  | ||||
|     steps: | ||||
|     - uses: actions/checkout@v3 | ||||
|  | ||||
|     - name: Build image for ${{ matrix.target }} | ||||
|       id: build | ||||
|       run: | | ||||
|         git config --global user.email "you@example.com" | ||||
|         git config --global user.name "Your Name" | ||||
|         make -j TARGET=${{ matrix.target }} | ||||
|  | ||||
|     - name: Package and upload image for ${{ matrix.target }} | ||||
|       id: package_and_upload_image | ||||
|       env: | ||||
|         GH_BUILD_USERNAME: ${{ secrets.GH_BUILD_USERNAME }} | ||||
|         GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }} | ||||
|         ARTIFACTORY_USERNAME: cicd-indoor-main | ||||
|         ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} | ||||
|       run: | | ||||
|         LOWERCASE_TARGET=`echo ${{ matrix.target }} | tr '[:upper:]' '[:lower:]'` | ||||
|         HASH=$(git rev-parse --short HEAD) | ||||
|  | ||||
|         if [[ ${GITHUB_REF} == "refs/heads/"* ]] | ||||
|         then | ||||
|           REF=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '-') | ||||
|           IS_RELEASE="false" | ||||
|         else | ||||
|           REF=$(echo ${GITHUB_REF#refs/tags/} | tr '/' '-') | ||||
|           IS_RELEASE="true" | ||||
|         fi | ||||
|  | ||||
|         BASENAME="$(date +%Y%m%d)-$LOWERCASE_TARGET-$REF-$HASH" | ||||
|         TAR_NAME="$BASENAME.tar.gz" | ||||
|         IMG_NAME="$BASENAME-upgrade.bin"; | ||||
|         JSON_NAME="$BASENAME.json"; | ||||
|  | ||||
|         tar cfz "$TAR_NAME" -C openwrt/bin/targets/ . | ||||
|         curl -s -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "$TAR_NAME" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/"$TAR_NAME"" | ||||
|         IMG_NAME="$BASENAME-upgrade.bin"; | ||||
|         TIP_VERSION="$(grep DISTRIB_TIP= openwrt/tmp/openwrt_release | cut -d\' -f2)" | ||||
|         echo -e "{\n\t\"image\":\""${IMG_NAME}"\",\n\t\"revision\": \""${TIP_VERSION}"\",\n\t\"timestamp\":\""$(date +%s)"\",\n\t\"compatible\": \""${LOWERCASE_TARGET}"\"\n}" > latest-upgrade.json | ||||
|         [ -f openwrt/tmp/image-file ] && curl -s -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "openwrt/$(cat openwrt/tmp/image-file)" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/"$IMG_NAME"" | ||||
|         [ -f openwrt/tmp/image-file ] && curl -s -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "latest-upgrade.json" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/latest-upgrade.json" | ||||
|  | ||||
|         [ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/octet-stream" "openwrt/$(cat openwrt/tmp/image-file)" "s3://$AWS_S3_BUCKET_NAME/$IMG_NAME" | ||||
|         [ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$IMG_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}" | ||||
|         [ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/json" "latest-upgrade.json" "s3://$AWS_S3_BUCKET_NAME/$JSON_NAME" | ||||
|         [ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$JSON_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}" | ||||
|  | ||||
|         if [[ ${{ matrix.target }} == 'x64_vm' ]]; then | ||||
|             echo "x64_vm_image_name=$(echo $IMG_NAME)" >> $GITHUB_OUTPUT | ||||
|         fi | ||||
|  | ||||
|   create-x64_vm-ami: | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: build | ||||
|     steps: | ||||
|     - uses: actions/checkout@v3 | ||||
|       with: | ||||
|         ref: WIFI-7206-add-workflow-to-build-virtual-ap-image | ||||
|  | ||||
|     - name: Use create-ami-from-image composite action | ||||
|       uses: ./.github/actions/create-ami-from-image | ||||
|       with: | ||||
|         firmware_image_name: ${{ needs.build.outputs.x64_vm_image_name }} | ||||
|         firmware_image_s3_bucket: ${{ env.AWS_S3_BUCKET_NAME }} | ||||
							
								
								
									
										85
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										85
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,20 +1,83 @@ | ||||
| # Setting up your build machine | ||||
| # OpenWiFi AP NOS | ||||
|  | ||||
| Requires a recent linux installation. Older systems without python 3.7 will have trouble.  See this link for details: https://openwrt.org/docs/guide-developer/quickstart-build-images | ||||
| OpenWrt-based access point network operating system (AP NOS) for TIP OpenWiFi. | ||||
| Read more at [openwifi.tip.build](https://openwifi.tip.build/). | ||||
|  | ||||
| Install build packages:  sudo apt install build-essential libncurses5-dev gawk git libssl-dev gettext zlib1g-dev swig unzip time rsync python3 python3-setuptools python3-yaml. | ||||
| ## Building | ||||
|  | ||||
| # Doing a native build on Linux | ||||
| First we need to clone and setup our tree. This will result in an openwrt/. | ||||
| ### Setting up your build machine | ||||
|  | ||||
| Building requires a recent Linux installation. Older systems without Python 3.7 | ||||
| will have trouble. See this guide for details: | ||||
| https://openwrt.org/docs/guide-developer/toolchain/beginners-build-guide | ||||
|  | ||||
| Install build packages on Debian/Ubuntu (or see above guide for other systems): | ||||
| ``` | ||||
| ./setup.py --setup | ||||
| sudo apt install build-essential libncurses5-dev gawk git libssl-dev gettext zlib1g-dev swig unzip time rsync python3 python3-setuptools python3-yaml | ||||
| ``` | ||||
| Next we need to select the profile and base package selection. This setup will install the feeds, packages and generate the .config file. | ||||
|  | ||||
| ### Doing a native build on Linux | ||||
|  | ||||
| Use `./build.sh <target>`, or follow the manual steps below: | ||||
|  | ||||
| 1. Clone and set up the tree. This will create an `openwrt/` directory. | ||||
| ```shell | ||||
| ./setup.py --setup    # for subsequent builds, use --rebase instead | ||||
| ``` | ||||
|  | ||||
| 2. Select the profile and base package selection. This setup will install the | ||||
|    feeds and packages and generate the `.config` file. | ||||
| ```shell | ||||
| cd openwrt | ||||
| ./scripts/gen_config.py ea8300 | ||||
| ./scripts/gen_config.py linksys_ea8300 | ||||
| ``` | ||||
| Finally we can build the tree. | ||||
| ``` | ||||
| make -j X V=s | ||||
|  | ||||
| 3. Build the tree (replace `-j 8` with the number of cores to use). | ||||
| ```shell | ||||
| make -j 8 V=s | ||||
| ``` | ||||
|  | ||||
| ### Build output | ||||
|  | ||||
| The build results are located in the `openwrt/bin/` directory: | ||||
|  | ||||
| | Type             | Path                                                 | | ||||
| | ---------------- | ---------------------------------------------------- | | ||||
| | Firmware images  | `openwrt/bin/targets/<target>/<subtarget>/`          | | ||||
| | Kernel modules   | `openwrt/bin/targets/<target>/<subtarget>/packages/` | | ||||
| | Package binaries | `openwrt/bin/packages/<platform>/<feed>/`            | | ||||
|  | ||||
| ## Developer Notes | ||||
|  | ||||
| ### Branching model | ||||
|  | ||||
| - `main` - Stable dev branch | ||||
| - `next` - Integration branch | ||||
| - `staging-*` - Feature/bug branches | ||||
| - `release/v#.#.#` - Release branches (*major.minor.patch*) | ||||
|  | ||||
| ### Repository structure | ||||
|  | ||||
| Build files: | ||||
| - `Makefile` - Calls Docker environment per target | ||||
| - `dock-run.sh` - Dockerized build environment | ||||
| - `docker/Dockerfile` - Dockerfile for build image | ||||
| - `build.sh` - Build script | ||||
| - `setup.py` - Clone and set up the tree | ||||
| - `config.yml` - Specifies OpenWrt version and patches to apply | ||||
|  | ||||
| Directories: | ||||
| - `feeds/` - OpenWiFi feeds | ||||
| - `patches/` - OpenWiFi patches applied during builds | ||||
| - `profiles/` - Per-target kernel configs, packages, and feeds | ||||
|     - [wifi-ax](profiles/wifi-ax.yml): Wi-Fi AX packages | ||||
|     - [ucentral-ap](profiles/ucentral-ap.yml): uCentral packages | ||||
|     - [x64_vm](profiles/x64_vm.yml): x86-64 VM image | ||||
|  | ||||
| ### uCentral packages | ||||
|  | ||||
| AP-NOS packages implementing the uCentral protocol include the following | ||||
| repositories (refer to the [ucentral](feeds/ucentral/) feed for a full list): | ||||
| - ucentral-client: https://github.com/Telecominfraproject/wlan-ucentral-client | ||||
| - ucentral-schema: https://github.com/Telecominfraproject/wlan-ucentral-schema | ||||
| - ucentral-wifi: https://github.com/blogic/ucentral-wifi | ||||
|   | ||||
| @@ -14,3 +14,4 @@ patch_folders: | ||||
|   - patches/ipq807x | ||||
|   - patches/rtkmipsel | ||||
|   - patches/rest | ||||
|   - patches/x86 | ||||
|   | ||||
| @@ -1,77 +0,0 @@ | ||||
| # Copyright (c) Facebook, Inc. and its affiliates. | ||||
| # All rights reserved. | ||||
| # | ||||
| # This source code is licensed under the license found in the | ||||
| # LICENSE file in the root directory of this source tree. | ||||
| # | ||||
|  | ||||
|  | ||||
| include $(TOPDIR)/rules.mk | ||||
|  | ||||
| PKG_NAME:=fbwifi | ||||
| PKG_VERSION:=2 | ||||
| PKG_RELEASE:=0 | ||||
| PKG_LICENSE:=GPL-2.0 | ||||
|  | ||||
| PKG_MAINTAINER:=Simon Kinane <skinane@fb.com> | ||||
|  | ||||
| PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) | ||||
|  | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
|  | ||||
| define Package/fbwifi | ||||
|   SUBMENU:=Captive Portals | ||||
|   SECTION:=net | ||||
|   CATEGORY:=Network | ||||
|   DEPENDS:=+iptables +luasec +luasocket \ | ||||
| 	+libuci-lua +luaposix \ | ||||
| 	+lua-cjson +uhttpd | ||||
|   TITLE:=Facebook Wi-Fi | ||||
|   PKGARCH:=all | ||||
| endef | ||||
|  | ||||
| define Package/fbwifi/description | ||||
|   Facebook Wi-Fi, an AP authorisation solution | ||||
| endef | ||||
|  | ||||
|  | ||||
| define Package/luci-app-fbwifi | ||||
|   SUBMENU:=3. Applications | ||||
|   SECTION:=luci | ||||
|   CATEGORY:=LuCI | ||||
|   TITLE:=LuCI support for Facebook Wi-Fi | ||||
|   DEPENDS:= \ | ||||
| 	+fbwifi \ | ||||
| 	+luci-base +luci-mod-network +luci-mod-status +luci-theme-bootstrap | ||||
| endef | ||||
|  | ||||
| define Package/luci-app-fbwifi/description | ||||
|   LuCI support for Facebook Wi-Fi | ||||
| endef | ||||
|  | ||||
|  | ||||
| define Package/fbwifi/conffiles | ||||
| /etc/config/fbwifi | ||||
| endef | ||||
|  | ||||
| define Build/Prepare | ||||
| endef | ||||
|  | ||||
| define Build/Configure | ||||
| endef | ||||
|  | ||||
| define Build/Compile | ||||
| endef | ||||
|  | ||||
| define Package/fbwifi/install | ||||
| 	$(INSTALL_DIR) $(1) | ||||
| 	$(CP) ./files/fbwifi/* $(1)/ | ||||
| endef | ||||
|  | ||||
| define Package/luci-app-fbwifi/install | ||||
| 	$(INSTALL_DIR) $(1) | ||||
| 	$(CP) ./files/luci-app-fbwifi/* $(1) | ||||
| endef | ||||
|  | ||||
| $(eval $(call BuildPackage,fbwifi)) | ||||
| $(eval $(call BuildPackage,luci-app-fbwifi)) | ||||
| @@ -1,22 +0,0 @@ | ||||
| # Facebook Wi-Fi v2.0 Reference Implementation for OpenWrt  | ||||
|  | ||||
| ## Getting started | ||||
|  | ||||
| Case studies for OEM customers are available at the official page of [Facebook Wi-Fi](https://www.facebook.com/facebook-wifi). | ||||
|  | ||||
| For OEM engineers, start by reading the init script in [files/etc/init.d/fbwifi](https://github.com/facebookincubator/fbc_owrt_feed/blob/master/fbwifi/files/etc/init.d/fbwifi) | ||||
|  | ||||
| To enable Facebook Wi-Fi, configure the gateway_token in `/etc/config/fbwifi`, and run `fbwifi enable`. | ||||
| To disable Facebook Wi-Fi, run `fbwifi disable`. | ||||
|  | ||||
| ## Contents | ||||
|  | ||||
| The 'files' subdirectory contains two subdirectories, one for the fbwifi | ||||
| package that implements the Facebook Wi-Fi v2.0 standard for OpenWrt, and | ||||
| another one containing a LuCI application to configure Facebook Wi-Fi. | ||||
|  | ||||
| The folder structures follow *nix conventions: | ||||
| - 'etc' is the boot time scripts and configuration | ||||
| - 'usr' contains procedural scripts, lua common code module and GUI prototype for luci | ||||
| - 'www' contains the HTTP endpoints as CGI handlers  | ||||
|  | ||||
| @@ -1,6 +0,0 @@ | ||||
| config fbwifi 'main' | ||||
| 	option enabled '0' | ||||
| 	option gateway_token 'FBWIFI:GATEWAY|123456789|0123456789|abcdeABCDE123456789' | ||||
| 	option http_port '2060' | ||||
| 	option https_port '2061' | ||||
| 	option zone 'lan' | ||||
| @@ -1,10 +0,0 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| [ "$ACTION" = ifup ] || exit 0 | ||||
|  | ||||
| /etc/init.d/fbwifi enabled || exit 0 | ||||
|  | ||||
| ip route get fibmatch 1.1.1.1 | grep -q "$DEVICE" || exit 0 | ||||
|  | ||||
| logger -t fbwifi "Reloading fbwifi due to $ACTION of $INTERFACE ($DEVICE)" | ||||
| /etc/init.d/fbwifi restart | ||||
| @@ -1,43 +0,0 @@ | ||||
| #!/bin/sh /etc/rc.common | ||||
|  | ||||
| START=90 | ||||
|  | ||||
| USE_PROCD=1 | ||||
|  | ||||
| reload_service() { | ||||
| 	restart | ||||
| } | ||||
|  | ||||
| service_triggers() { | ||||
| 	procd_add_reload_trigger fbwifi | ||||
| } | ||||
|  | ||||
| start_service() { | ||||
|  | ||||
| 	config_load fbwifi | ||||
| 	config_get_bool enabled 'main' 'enabled' '0' | ||||
| 	[ "$enabled" -eq 0 ] && return | ||||
|  | ||||
| 	config_get http_port main http_port | ||||
| 	[ -z "$http_port" ] && { | ||||
| 		logger -t fbwifi "required option http_port not set" | ||||
| 		exit 1 | ||||
| 	} | ||||
|  | ||||
| 	config_get https_port main https_port | ||||
| 	[ -z "$https_port" ] && { | ||||
| 		logger -t fbwifi "required option https_port not set" | ||||
| 		exit 1 | ||||
| 	} | ||||
|  | ||||
| 	logger "[fbwifi] Enabled; starting" | ||||
|  | ||||
| 	mkdir -p /tmp/fbwifi | ||||
|  | ||||
| 	/usr/sbin/fbwifi reload | ||||
|  | ||||
| 	procd_open_instance | ||||
| 	procd_set_param command /usr/sbin/fbwifi_validate_token_db | ||||
| 	procd_set_param respawn 1 300 0 | ||||
| 	procd_close_instance | ||||
| } | ||||
| @@ -1,156 +0,0 @@ | ||||
| -- SPDX-License-Identifier: GPL-2.0-only | ||||
| -- Copyright (c) Facebook, Inc. and its affiliates. | ||||
| -- | ||||
| -- FBWIFI Lua library | ||||
| -- function table | ||||
| local fbwifi = {} | ||||
|  | ||||
| local http = require("ssl.https") | ||||
| local json = require("cjson") | ||||
| local log = require("posix.syslog") | ||||
| local uci = require("uci") | ||||
|  | ||||
| function fbwifi.gateway_token() | ||||
| 	token = uci.get("fbwifi.main.gateway_token") | ||||
| 	if token and string.len(token) > 0 then | ||||
| 		return token | ||||
| 	else | ||||
| 		log.syslog( log.LOG_WARNING, "[fbwifi] UCI option fbwifi.main.gateway_token is missing" ) | ||||
| 		return nil | ||||
| 	end  | ||||
| end | ||||
|  | ||||
| function fbwifi.validate_token( token ) | ||||
|  | ||||
| 	local valid = false | ||||
|  | ||||
| 	if string.len(token or '' ) > 0 then | ||||
|  | ||||
| 	        GATEWAY_TOKEN = fbwifi.gateway_token() | ||||
|  | ||||
| 	        URL="https://api.fbwifi.com/v2.0/token" | ||||
| 	        BODY="token="..token | ||||
| 	        body, code, headers = http.request(URL.."?access_token="..GATEWAY_TOKEN, BODY) | ||||
|  | ||||
| 	        if code==200 then | ||||
| 	                valid = true | ||||
| 	        else | ||||
| 	                log.syslog(log.LOG_WARNING, "[fbwifi] validate_token:"..body) | ||||
| 	        end | ||||
|  | ||||
| 	end | ||||
|  | ||||
| 	return valid | ||||
| end | ||||
|  | ||||
| local mac_to_purge='' | ||||
| function remove_client_by_mac(client) | ||||
| 	state = uci.cursor("/var/state", "/tmp/fbwifi") | ||||
|  | ||||
| 	for key, value in pairs(client) do | ||||
| 		if | ||||
| 			key == 'mac' and | ||||
| 			value == mac_to_purge | ||||
| 		then | ||||
| 			log.syslog(log.LOG_INFO, string.format("[fbwifi] Purging DB entry %s for MAC %s", client['.name'] or 'unknown', mac_to_purge) ) | ||||
| 			state:delete("fbwifi", client['.name']) | ||||
| 			return | ||||
| 		end | ||||
| 	end | ||||
| end | ||||
|  | ||||
| function fbwifi.instate_client_rule( token, client_mac ) | ||||
|  | ||||
| 	log.syslog(log.LOG_INFO, "[fbwifi] Validating client "..client_mac) | ||||
|  | ||||
| 	state = uci.cursor("/var/state", "/tmp/fbwifi") | ||||
| 	state_name = "token_" .. token | ||||
|  | ||||
| 	RULE_COND="iptables -w -L FBWIFI_CLIENT_TO_INTERNET -t mangle | grep -i -q \"%s\"" | ||||
| 	RULE_FMT="iptables -w -t mangle -%s FBWIFI_CLIENT_TO_INTERNET -m mac --mac-source \"%s\" -j MARK --set-mark 0xfb" | ||||
| 	local RULE | ||||
|  | ||||
| 	log.syslog(log.LOG_INFO, string.format("[fbwifi] Cleaning DB for MAC %s", client_mac) ) | ||||
| 	mac_to_purge = client_mac | ||||
| 	state:foreach("fbwifi", "client", remove_client_by_mac) | ||||
| 	 | ||||
| 		 | ||||
| 	log.syslog(log.LOG_INFO, string.format("[fbwifi] Adding DB entry %s for MAC %s", state_name, client_mac) ) | ||||
| 	state:set("fbwifi", state_name, "client") | ||||
| 	state:set("fbwifi", state_name, "token", token) | ||||
| 	state:set("fbwifi", state_name, "mac", client_mac) | ||||
| 	state:set("fbwifi", state_name, "authenticated", "true") | ||||
| 				 | ||||
| 	-- verify a rule exists for the given client MAC,  | ||||
| 	--   OR install it | ||||
| 	RULE=string.format(RULE_COND.." || "..RULE_FMT, client_mac, "A", client_mac) | ||||
|  | ||||
| 	log.syslog(log.LOG_INFO, string.format( "[fbwifi] Opening iptables for %s", client_mac ) ) | ||||
| 	res = os.execute(RULE) | ||||
| 	if res ~= 0 then  | ||||
| 		log.syslog(log.LOG_WARNING, string.format( "[fbwifi] Failed to update iptables (%s)", res ) ) | ||||
| 	end | ||||
| 	log.syslog(log.LOG_INFO, "[fbwifi] "..RULE) | ||||
|  | ||||
| 	state:save('fbwifi') | ||||
| 	state:commit('fbwifi') | ||||
| end | ||||
|  | ||||
| function fbwifi.revoke_client_rule( token ) | ||||
|          | ||||
|         if (token == nil) then | ||||
|                 log.syslog(log.LOG_INFO, "[fbwifi] Invalidating token, but token is Nil") | ||||
|                 return | ||||
|         end | ||||
|  | ||||
| 	log.syslog(log.LOG_INFO, string.format( "[fbwifi] Invalidating token (%s)", token) ) | ||||
|  | ||||
| 	state = uci.cursor("/var/state", "/tmp/fbwifi") | ||||
| 	state_name = "token_" .. token | ||||
| 	 | ||||
| 	client_mac = state:get("fbwifi", state_name, "mac") | ||||
|  | ||||
| 	if client_mac then | ||||
| 		RULE_COND="iptables -w -L FBWIFI_CLIENT_TO_INTERNET -t mangle | grep -i -q \"%s\"" | ||||
| 		RULE_FMT="iptables -w -t mangle -%s FBWIFI_CLIENT_TO_INTERNET -m mac --mac-source \"%s\" -j MARK --set-mark 0xfb" | ||||
|  | ||||
| 		-- verify a rule exists for the given client MAC,  | ||||
| 		--  AND delete it | ||||
| 		RULE=string.format(RULE_COND.." && "..RULE_FMT, client_mac, "D", client_mac) | ||||
|  | ||||
| 		res = os.execute(RULE) | ||||
| 		if res ~= 0 then  | ||||
| 			log.syslog(log.LOG_WARNING, string.format( "[fbwifi] Failed to update iptables (%s)", res ) ) | ||||
| 		end | ||||
| 		log.syslog(log.LOG_INFO, "[fbwifi] "..RULE) | ||||
|  | ||||
| 		state:delete("fbwifi", state_name) | ||||
| 		state:save('fbwifi') | ||||
| 		state:commit('fbwifi') | ||||
| 	else | ||||
| 		log.syslog(log.LOG_WARNING, string.format( "[fbwifi] Client MAC not found in DB (%s)", state_name ) ) | ||||
| 	end | ||||
| end | ||||
|  | ||||
| function fbwifi.reset() | ||||
|  | ||||
| 	local success = false | ||||
|         GATEWAY_TOKEN = fbwifi.gateway_token() | ||||
|         URL="https://api.fbwifi.com/v2.0/gateway/reset" | ||||
| 	BODY="{}" | ||||
|         body, code, headers = http.request(URL.."?access_token="..GATEWAY_TOKEN, BODY) | ||||
|  | ||||
|         if code==200 then | ||||
|                 log.syslog(log.LOG_INFO, "[fbwifi] Reset committed") | ||||
|                 success = true | ||||
|         else | ||||
|                 log.syslog(log.LOG_WARNING, "[fbwifi] Reset failed : "..body) | ||||
|         end | ||||
|  | ||||
| 	return success | ||||
| end | ||||
|  | ||||
| -- | ||||
| -- Return the function table to the host script | ||||
| -- | ||||
| return fbwifi | ||||
| @@ -1,58 +0,0 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| case "$1" in | ||||
| disable) | ||||
| 	uci set fbwifi.main.enabled=0 | ||||
|  | ||||
| 	uci delete firewall.fbwifi | ||||
|  | ||||
| 	uci delete uhttpd.fbwifi_redirect | ||||
|  | ||||
| 	uci delete uhttpd.main.json_script | ||||
| 	uci set uhttpd.main.cert='/etc/uhttpd.crt' | ||||
| 	uci set uhttpd.main.key='/etc/uhttpd.key' | ||||
| 	uci set uhttpd.main.rfc1918_filter=1 | ||||
| 	;; | ||||
| enable) | ||||
| 	uci set fbwifi.main.enabled=1 | ||||
|  | ||||
| 	uci set firewall.fbwifi=include | ||||
| 	uci set firewall.fbwifi.enabled=1 | ||||
| 	uci set firewall.fbwifi.family=ipv4 | ||||
| 	uci set firewall.fbwifi.path=/usr/share/fbwifi/firewall.include | ||||
| 	uci set firewall.fbwifi.reload=1 | ||||
| 	uci set firewall.fbwifi.type=script | ||||
|  | ||||
| 	uci set uhttpd.fbwifi_redirect=uhttpd | ||||
| 	uci set uhttpd.fbwifi_redirect.enabled=1 | ||||
| 	uci set uhttpd.fbwifi_redirect.cert='/tmp/fbwifi/https_server_cert' | ||||
| 	uci set uhttpd.fbwifi_redirect.home='/dev/null' | ||||
| 	uci set uhttpd.fbwifi_redirect.json_script='/tmp/fbwifi/uhttpd-redirect.json' | ||||
| 	uci set uhttpd.fbwifi_redirect.key='/tmp/fbwifi/https_server_key' | ||||
| 	uci set uhttpd.fbwifi_redirect.listen_http='0.0.0.0:2060' | ||||
| 	uci set uhttpd.fbwifi_redirect.listen_https='0.0.0.0:2061' | ||||
|  | ||||
| 	uci set uhttpd.main.cert='/tmp/fbwifi/https_server_cert' | ||||
| 	uci set uhttpd.main.json_script='/usr/share/fbwifi/uhttpd.json' | ||||
| 	uci set uhttpd.main.key='/tmp/fbwifi/https_server_key' | ||||
| 	uci set uhttpd.main.rfc1918_filter=0 | ||||
| 	;; | ||||
| reload) | ||||
| 	/usr/sbin/fbwifi_get_config | ||||
|  | ||||
| 	login_url=$(uci -c /var/state get fbwifi.main.captive_portal_url) | ||||
| 	[ -z "$login_url" ] && { | ||||
| 		logger -t fbwifi "captive_portal_url not available yet" | ||||
| 		exit 1 | ||||
| 	} | ||||
| 	printf '{ "request": [ ["redirect", "%s", 302] ] }' "$login_url" > /tmp/fbwifi/uhttpd-redirect.json | ||||
|  | ||||
| 	/etc/init.d/uhttpd restart | ||||
|  | ||||
| 	exit 0 | ||||
| 	;; | ||||
| esac | ||||
|  | ||||
| uci commit | ||||
| /etc/init.d/uhttpd restart | ||||
| reload_config | ||||
| @@ -1,8 +0,0 @@ | ||||
| echo -e "Runtime configuration and token DB\n" | ||||
| uci -c /var/state export fbwifi | ||||
|  | ||||
| echo -e "\nDynamic firewall flow rules\n" | ||||
| iptables -t mangle -L FBWIFI_CLIENT_TO_INTERNET | ||||
|  | ||||
| echo -e "\nDHCP leases\n" | ||||
| cat /tmp/dhcp.leases | ||||
| @@ -1,39 +0,0 @@ | ||||
| #!/usr/bin/lua | ||||
|  | ||||
| http = require("ssl.https") | ||||
| json = require("cjson") | ||||
| log = require("posix.syslog") | ||||
| socket = require("socket") | ||||
| require("uci") | ||||
| fbwifi = require("fbwifi") | ||||
|  | ||||
| GATEWAY_TOKEN = fbwifi.gateway_token() | ||||
| state = uci.cursor("/var/state", "/tmp/fbwifi") | ||||
|  | ||||
| payload="name="..socket.dns.gethostname() | ||||
|  | ||||
| function queue_ssid_update(iface) | ||||
| 	bssid_file="/sys/class/net/br-"..iface["network"].."/address" | ||||
| 	local file = io.open(bssid_file) | ||||
|         if file then | ||||
|             for line in file:lines() do | ||||
| 		payload=payload.."&bssid[]="..line | ||||
|             end | ||||
| 	    file:close() | ||||
| 	    payload=payload.."ssid[]="..iface["ssid"] | ||||
|         else | ||||
| 	    log.syslog(log.LOG_WARNING, "[fbwifi] Failed to find BSSID for interface br-"..iface["network"]) | ||||
|         end | ||||
| end | ||||
|  | ||||
| state:foreach("wireless", "wifi-iface", queue_ssid_update) | ||||
|  | ||||
| URL="https://api.fbwifi.com/v2.0/gateway" | ||||
| body, code, headers = http.request(URL.."?access_token="..GATEWAY_TOKEN, payload) | ||||
| if code == 200 then  | ||||
| 	log.syslog(log.LOG_INFO, "[fbwifi] gateway information updated "..body) | ||||
| 	os.exit(0) | ||||
| else | ||||
| 	log.syslog(log.LOG_WARNING, "[fbwifi] gateway API failed "..body) | ||||
| 	os.exit(code) | ||||
| end | ||||
| @@ -1,111 +0,0 @@ | ||||
| #!/usr/bin/lua | ||||
| http = require("ssl.https") | ||||
| json = require("cjson") | ||||
| require("uci") | ||||
| log = require("posix.syslog") | ||||
| fbwifi = require("fbwifi") | ||||
|  | ||||
| GATEWAY_TOKEN = fbwifi.gateway_token() | ||||
|  | ||||
| http_port = uci.get("fbwifi.main.http_port") | ||||
| https_port = uci.get("fbwifi.main.https_port") | ||||
|  | ||||
| statefile = assert(io.open("/var/state/fbwifi", "a"), "could not create state file") | ||||
| statefile:close() | ||||
|  | ||||
| state = uci.cursor("/var/state", "/tmp/fbwifi") | ||||
|  | ||||
| URL="https://api.fbwifi.com/v2.0/gateway" | ||||
| body, code, headers = http.request(URL.."?access_token="..GATEWAY_TOKEN.."&fields=config,config_version") | ||||
|  | ||||
| if code == 200 then | ||||
| 	log.syslog(log.LOG_INFO, "[fbwifi] Got gateway config ("..code..")") | ||||
| else | ||||
| 	log.syslog(log.LOG_CRIT, "[fbwifi] Failed to get gateway config ("..code..")") | ||||
| 	os.exit(1) | ||||
| end | ||||
|  | ||||
| obj = json.decode(body) | ||||
|  | ||||
| function save_cert(name, value) | ||||
| 	log.syslog(log.LOG_INFO, "[fbwifi] Saving cert "..name) | ||||
| 	local f = assert(io.open("/tmp/fbwifi/"..name, "w")) | ||||
| 	f:write(value) | ||||
| 	f:close() | ||||
| end | ||||
|  | ||||
| function process_redirect(ix, host) | ||||
| 	IP_SET = "ip addr replace dev lo "..host | ||||
| 	local result = os.execute(IP_SET) | ||||
| 	if result == 0 then | ||||
| 		log.syslog(log.LOG_INFO, "[fbwifi] Redirect address applied "..host) | ||||
| 	else | ||||
| 		log.syslog(log.LOG_WARNING, "[fbwifi] Failed to apply redirect address "..host) | ||||
| 	end | ||||
|  | ||||
| 	ip = string.match(host, '([0-9\.]*)/([0-9]*)') | ||||
| 	RULE_FMT="grep -q \"%s\" /etc/hosts || echo \"%s\tstar.fbwifigateway.net\" >> /etc/hosts" | ||||
| 	HOSTS_RULE = string.format(RULE_FMT, ip, ip) | ||||
| 	result = os.execute(HOSTS_RULE) | ||||
| 	if result == 0 then | ||||
| 		log.syslog(log.LOG_INFO, "[fbwifi] Cached redirect host for DNS") | ||||
| 	else | ||||
| 		log.syslog(log.LOG_WARNING, "[fbwifi] Failed to amend /etc/hosts") | ||||
| 		log.syslog(log.LOG_INFO, "[fbwifi] "..HOSTS_RULE) | ||||
| 	end | ||||
|  | ||||
| 	result = os.execute("iptables -t nat -A FBWIFI_HOST_REDIRLIST -p tcp --dport 80 -d "..ip.." -j ACCEPT # REDIRECT --to-ports "..http_port) | ||||
| 	--print(result) | ||||
| 	result = os.execute("iptables -t nat -A FBWIFI_HOST_REDIRLIST -p tcp --dport 443 -d "..ip.."  -j ACCEPT # REDIRECT --to-ports "..https_port) | ||||
| 	--print(result) | ||||
| end | ||||
|  | ||||
| save_cert("https_server_cert", obj['config']['https_server_cert']) | ||||
| save_cert("https_server_key", obj['config']['https_server_key']) | ||||
|  | ||||
| result = os.execute("iptables -t nat -F FBWIFI_HOST_REDIRLIST") | ||||
| --print(result) | ||||
| table.foreach(obj['config']['host_redirect_ips'], process_redirect) | ||||
|  | ||||
| RULE_FORMAT = "iptables -t mangle -A FBWIFI_TRAFFIC_ALLOWLIST -d %s -p %s --dport %s -j MARK --set-mark 0xfb" | ||||
| function process_traffic_rule(ix, rule) | ||||
| 	log.syslog(log.LOG_INFO, "[fbwifi] Traffic rule "..ix) | ||||
| 	 | ||||
| 	if rule["protocol"] == 6 then | ||||
| 		PROTO = "tcp" | ||||
| 	elseif rule["protocol"] == 17 then | ||||
| 		PROTO = "udp" | ||||
| 	end | ||||
| 	RULE = string.format(RULE_FORMAT, rule["ip"], PROTO, rule["port"]) | ||||
| 	local result = os.execute(RULE) | ||||
| 	if result == 0 then | ||||
| 		log.syslog(log.LOG_INFO, "[fbwifi] Traffic rule "..ix) | ||||
| 	else | ||||
| 		log.syslog(log.LOG_WARNING, "[fbwifi] Failed to install traffic rule ; "..RULE) | ||||
| 	end | ||||
| end | ||||
|  | ||||
| local cross_origin_list = {} | ||||
| function process_cross_origin_rule(ix, url) | ||||
| 	log.syslog(log.LOG_INFO, "[fbwifi] Cross origin rule "..url) | ||||
| 	table.insert(cross_origin_list, url) | ||||
| end | ||||
|  | ||||
| function process_url(url_purpose, fqdn) | ||||
| 	log.syslog(log.LOG_INFO, "[fbwifi] Caching "..url_purpose) | ||||
| 	state:set("fbwifi", "main", url_purpose, fqdn)	 | ||||
| end | ||||
|  | ||||
| state:set("fbwifi", "main", "config") | ||||
|  | ||||
| result = os.execute("iptables -t mangle -F FBWIFI_TRAFFIC_ALLOWLIST ") | ||||
| --print(result) | ||||
| table.foreach(obj['config']['traffic_allowlist'], process_traffic_rule) | ||||
| table.foreach(obj['config']['cross_origin_allowlist'], process_cross_origin_rule) | ||||
| table.foreach(obj['config']['urls'], process_url) | ||||
|  | ||||
| state:set("fbwifi", "main", "cross_origin_allow_rules", cross_origin_list) | ||||
| state:set("fbwifi", "main", "config_version", obj['config_version']) | ||||
|  | ||||
| state:save('fbwifi') | ||||
| state:commit('fbwifi') | ||||
| @@ -1,75 +0,0 @@ | ||||
| #!/usr/bin/lua | ||||
|  | ||||
| https = require("ssl.https") | ||||
| json = require("cjson") | ||||
| log = require("posix.syslog") | ||||
| fbwifi = require("fbwifi") | ||||
| require("uci") | ||||
|  | ||||
| state = uci.cursor("/var/state", "/tmp/fbwifi") | ||||
| GATEWAY_TOKEN = fbwifi.gateway_token() | ||||
|  | ||||
| request = {  | ||||
| 	tokens = {},  | ||||
| 	traffic_type = "total", | ||||
| 	config_version = state:get("fbwifi", "main", "config_version") | ||||
| } | ||||
|  | ||||
| function queue_token(client) | ||||
|  | ||||
| 	request.tokens[client.token]={ | ||||
| 		incoming = json.null, | ||||
| 		outgoing = json.null, | ||||
| 		connected_time_sec = json.null, | ||||
| 		inactive_time_sec = json.null, | ||||
| 		signal_rssi_dbm = json.null, | ||||
| 		--expected_tpus_mbps = json.null, | ||||
| 		is_connected = true | ||||
| 	} | ||||
|  | ||||
| end | ||||
|  | ||||
| state:foreach("fbwifi", "client", queue_token) | ||||
| print( "\nRequest:\n"..json.encode(request) ) | ||||
|  | ||||
| URL="https://api.fbwifi.com/v2.0/tokens" | ||||
| BODY=string.format( | ||||
| 	"tokens=%s&traffic_type=%s&config_version=%s", | ||||
| 	json.encode(request.tokens), | ||||
| 	"total", | ||||
| 	state:get("fbwifi", "main", "config_version") | ||||
| ) | ||||
|  | ||||
| body, code, headers = https.request(URL.."?access_token="..GATEWAY_TOKEN, BODY) | ||||
|  | ||||
| if code then | ||||
| 	print( "\nResponse:\n"..body ) | ||||
| end | ||||
|  | ||||
| response = json.decode(body) | ||||
| --print(response) | ||||
| --table.foreach(response,print) | ||||
| --table.foreach(response.tokens,print) | ||||
|  | ||||
| if response.config_valid then | ||||
| 	log.syslog(log.LOG_INFO, "[fbwifi] Config validated") | ||||
| else | ||||
| 	log.syslog(log.LOG_WARNING, "[fbwifi] config is stale, refreshing config") | ||||
|         local result = os.execute("/usr/sbin/fbwifi reload") | ||||
|         if result == 0 then | ||||
|                 log.syslog(log.LOG_INFO, "[fbwifi] successfully fetched and loaded new config ") | ||||
|         else | ||||
|                 log.syslog(log.LOG_WARNING, "[fbwifi] failed to fetch and load new config, possible stale config") | ||||
|         end | ||||
| end | ||||
|  | ||||
| function process_token(token, metadata) | ||||
| 	table.foreach(metadata,print) | ||||
| 	if metadata.valid then | ||||
| 		print("OK: "..token)	 | ||||
| 	else | ||||
| 		print("Nok: "..token)	 | ||||
| 		fbwifi.revoke_client_rule( token ) | ||||
| 	end | ||||
| end | ||||
| table.foreach(response.tokens,process_token) | ||||
| @@ -1,75 +0,0 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| # SPDX-License-Identifier: GPL-2.0-only | ||||
| # Copyright (c) Facebook, Inc. and its affiliates. | ||||
|  | ||||
| IPT4="/usr/sbin/iptables" | ||||
|  | ||||
| set -- --wait 1 --wait-interval 100 | ||||
|  | ||||
| fbwifi_http_port="$(uci get fbwifi.main.http_port)" | ||||
| [ -n "$fbwifi_http_port" ] || { | ||||
| 	logger -t fbwifi "required option http_port not set" | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| fbwifi_https_port="$(uci get fbwifi.main.https_port)" | ||||
| [ -n "$fbwifi_https_port" ] || { | ||||
| 	logger -t fbwifi "required option https_port not set" | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| fbwifi_zone="$(uci get fbwifi.main.zone)" | ||||
| [ -n "$fbwifi_zone" ] || { | ||||
| 	logger -t fbwifi "required option zone  not set" | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| fbwifi_ifaces="$(fw3 -q zone "$fbwifi_zone")" | ||||
|  | ||||
| ## Create custom chains | ||||
| "$IPT4" "$@" -t filter -N FBWIFI_FORWARD 2>/dev/null | ||||
| "$IPT4" "$@" -t filter -N FBWIFI_INPUT 2>/dev/null | ||||
| "$IPT4" "$@" -t mangle -N FBWIFI_CLIENT_TO_INTERNET 2>/dev/null | ||||
| "$IPT4" "$@" -t mangle -N FBWIFI_PREROUTING 2>/dev/null | ||||
| "$IPT4" "$@" -t mangle -N FBWIFI_TRAFFIC_ALLOWLIST 2>/dev/null | ||||
| "$IPT4" "$@" -t nat -N FBWIFI_CLIENT_TO_INTERNET 2>/dev/null | ||||
| "$IPT4" "$@" -t nat -N FBWIFI_PREROUTING 2>/dev/null | ||||
| "$IPT4" "$@" -t nat -N FBWIFI_HOST_REDIRLIST 2>/dev/null | ||||
|  | ||||
| ## Flush custom chains | ||||
| "$IPT4" "$@" -t filter -F FBWIFI_FORWARD | ||||
| "$IPT4" "$@" -t filter -F FBWIFI_INPUT | ||||
| "$IPT4" "$@" -t mangle -F FBWIFI_CLIENT_TO_INTERNET | ||||
| "$IPT4" "$@" -t mangle -F FBWIFI_PREROUTING | ||||
| "$IPT4" "$@" -t mangle -F FBWIFI_TRAFFIC_ALLOWLIST | ||||
| "$IPT4" "$@" -t nat -F FBWIFI_CLIENT_TO_INTERNET | ||||
| "$IPT4" "$@" -t nat -F FBWIFI_PREROUTING | ||||
| "$IPT4" "$@" -t nat -F FBWIFI_HOST_REDIRLIST | ||||
|  | ||||
| ## Populate custom chains | ||||
| "$IPT4" "$@" -t filter -A FBWIFI_FORWARD -p udp --dport 53 -m conntrack --ctstate NEW -j ACCEPT | ||||
| "$IPT4" "$@" -t filter -A FBWIFI_FORWARD -m conntrack --ctstate NEW -m mark --mark 0xfb -j ACCEPT | ||||
| "$IPT4" "$@" -t filter -A FBWIFI_FORWARD -j REJECT | ||||
| "$IPT4" "$@" -t filter -A FBWIFI_INPUT -p tcp --dport "$fbwifi_http_port" -m conntrack --ctstate NEW -j ACCEPT | ||||
| "$IPT4" "$@" -t filter -A FBWIFI_INPUT -p tcp --dport "$fbwifi_https_port"  -m conntrack --ctstate NEW -j ACCEPT | ||||
| "$IPT4" "$@" -t filter -A FBWIFI_INPUT -p tcp --dport 443 -m conntrack --ctstate NEW -j ACCEPT | ||||
| "$IPT4" "$@" -t mangle -A FBWIFI_PREROUTING -j FBWIFI_CLIENT_TO_INTERNET | ||||
| "$IPT4" "$@" -t mangle -A FBWIFI_PREROUTING -j FBWIFI_TRAFFIC_ALLOWLIST | ||||
| "$IPT4" "$@" -t nat -A FBWIFI_PREROUTING -j FBWIFI_CLIENT_TO_INTERNET | ||||
| "$IPT4" "$@" -t nat -A FBWIFI_CLIENT_TO_INTERNET -p tcp --dport 80 -m conntrack --ctstate NEW -j FBWIFI_HOST_REDIRLIST | ||||
| "$IPT4" "$@" -t nat -A FBWIFI_CLIENT_TO_INTERNET -p tcp --dport 443 -m conntrack --ctstate NEW -j FBWIFI_HOST_REDIRLIST | ||||
| "$IPT4" "$@" -t nat -A FBWIFI_CLIENT_TO_INTERNET -p udp --dport 443 -m conntrack --ctstate NEW -j FBWIFI_HOST_REDIRLIST | ||||
| "$IPT4" "$@" -t nat -A FBWIFI_CLIENT_TO_INTERNET -p tcp --dport 80 -m conntrack --ctstate NEW -m mark --mark 0xfb -j ACCEPT | ||||
| "$IPT4" "$@" -t nat -A FBWIFI_CLIENT_TO_INTERNET -p tcp --dport 443 -m conntrack --ctstate NEW -m mark --mark 0xfb -j ACCEPT | ||||
| "$IPT4" "$@" -t nat -A FBWIFI_CLIENT_TO_INTERNET -p udp --dport 443 -m conntrack --ctstate NEW -m mark --mark 0xfb -j ACCEPT | ||||
| "$IPT4" "$@" -t nat -A FBWIFI_CLIENT_TO_INTERNET -p tcp --dport 80 -m conntrack --ctstate NEW -j REDIRECT --to-ports "$fbwifi_http_port" | ||||
|  | ||||
| ## Hook custom chains in firewall3 chains | ||||
| "$IPT4" "$@" -t filter -I "zone_${fbwifi_zone}_input" 2 -j FBWIFI_INPUT | ||||
| "$IPT4" "$@" -t filter -I "zone_${fbwifi_zone}_forward" 2 -j FBWIFI_FORWARD | ||||
| "$IPT4" "$@" -t nat -I "zone_${fbwifi_zone}_prerouting" 2 -j FBWIFI_PREROUTING | ||||
| # There are no firewall3 zone chains in the mangle table so we need to do this for all interfaces in the zone | ||||
| for iface in $fbwifi_ifaces; do | ||||
| 	"$IPT4" "$@" -t mangle -I PREROUTING -i "$iface" -j FBWIFI_PREROUTING | ||||
| done | ||||
| @@ -1,8 +0,0 @@ | ||||
| { | ||||
|   "request": [ | ||||
|     [ "if", | ||||
|       [ "regex", "REQUEST_URI", "^/fbwifi" ], | ||||
|       [ "rewrite", "/cgi-bin%REQUEST_URI%" ] | ||||
|     ] | ||||
|   ] | ||||
| } | ||||
| @@ -1,70 +0,0 @@ | ||||
| #!/usr/bin/lua | ||||
| require("uci") | ||||
| log = require("posix.syslog") | ||||
| fbwifi = require("fbwifi") | ||||
|  | ||||
| state = uci.cursor("/var/state", "/tmp/fbwifi") | ||||
| function process_cors() | ||||
| 	origin = os.getenv("HTTP_ORIGIN") | ||||
| 	log.syslog(log.LOG_INFO, string.format("[fbwifi] [auth] process_cors origin %s", origin or 'not found') ) | ||||
| 	if string.len(origin or '') > 0 then | ||||
| 		allow_list = state:get("fbwifi", "main", "cross_origin_allow_rules") | ||||
| 		for _, value in pairs(allow_list) do | ||||
|     			if value == origin then | ||||
| 				log.syslog(log.LOG_INFO, "[fbwifi] [auth] process_cors Appending CORS Headers to HTTP") | ||||
| 				print("Access-Control-Allow-Origin: "..origin) | ||||
| 				print("Vary: Origin") | ||||
| 				break | ||||
| 			end | ||||
| 		end | ||||
| 	else	 | ||||
| 		log.syslog(log.LOG_INFO, "[fbwifi] [auth] process_cors No CORS Headers added to Response") | ||||
| 	end | ||||
| end | ||||
|  | ||||
| method = os.getenv("REQUEST_METHOD") | ||||
| if method == 'GET' then | ||||
| 	log.syslog(log.LOG_INFO, "[fbwifi] [auth] GET handler") | ||||
| 	print("Status: 302 Found") | ||||
| 	print("Location: "..state:get("fbwifi", "main", "landing_page_url")) | ||||
| 	process_cors() | ||||
| 	print ('\n') | ||||
|  | ||||
| elseif method == 'POST' then | ||||
| 	local token | ||||
| 	 | ||||
| 	log.syslog(log.LOG_INFO, "[fbwifi] [auth] POST handler") | ||||
| 	process_cors() | ||||
| 	print("Status: 200 OK") | ||||
|  | ||||
| 	form_data=io.read() | ||||
| 	while form_data do | ||||
| 		token = string.match(form_data, '[%d]+') | ||||
| 		if string.len(token or '') > 14 then | ||||
|  | ||||
| 			client = os.getenv("REMOTE_ADDR") | ||||
| 			f = io.popen("awk '/"..client..".*0x2/ { printf(\"%s\", $4) }' /proc/net/arp", 'r') | ||||
| 			client_mac = assert(f:read('*a')) | ||||
| 			f:close() | ||||
|  | ||||
| 			if fbwifi.validate_token(token) then | ||||
|                                 log.syslog(log.LOG_INFO, string.format( "[fbwifi] [auth] POST handler : Validating Token (%s) for MAC (%s)", token or 'nil', client_mac or 'nil') ) | ||||
| 				fbwifi.instate_client_rule(token, client_mac) | ||||
| 				print("\n{\"valid\":true}\n") | ||||
| 			else | ||||
|                                 log.syslog(log.LOG_WARNING, string.format( "[fbwifi] [auth] POST handler : ! Invalid token (%s) for mac (%s) !", token or 'nil', client_mac or 'nil') ) | ||||
| 				fbwifi.revoke_client_rule(token) | ||||
| 				print("\n{\"valid\":false}\n") | ||||
| 			end | ||||
| 			log.syslog(log.LOG_INFO, "[fbwifi] [auth] POST handler completed") | ||||
| 			return | ||||
| 		end | ||||
|  | ||||
| 		form_data=io.read() | ||||
| 	end | ||||
| 	print ('\n') | ||||
|  | ||||
| 	log.syslog(log.LOG_WARNING, string.format("[fbwifi] [auth] POST handler : token not found" )) | ||||
| 	fbwifi.revoke_client_rule(token) | ||||
| 	print("\n{\"valid\":false}\n") | ||||
| end | ||||
| @@ -1,42 +0,0 @@ | ||||
| #!/usr/bin/lua | ||||
| json = require("cjson") | ||||
| require("uci") | ||||
|  | ||||
| state = uci.cursor("/var/state", "/tmp/fbwifi") | ||||
| client_mac = "" | ||||
| token = "" | ||||
|  | ||||
| response = {} | ||||
| response['venue-info-url'] = state:get("fbwifi", "main", "capport_venue_info_url") | ||||
|  | ||||
| function map_remote_mac_to_token(client) | ||||
|         for key, value in pairs(client) do | ||||
|                 if | ||||
|                         key == 'mac' and | ||||
|                         value == client_mac | ||||
|                 then | ||||
| 			token = client.token | ||||
|                         return false | ||||
|                 end | ||||
|         end | ||||
| end | ||||
|  | ||||
| function hasValidToken(client_ip) | ||||
| 	f = io.popen("awk '/"..client_ip..".*0x2/ { printf(\"%s\", $4) }' /proc/net/arp", 'r') | ||||
| 	client_mac = assert(f:read('*a')) | ||||
| 	f:close() | ||||
| 	state:foreach("fbwifi", "client", map_remote_mac_to_token) | ||||
|  | ||||
| 	return 0 < string.len(token) | ||||
| end | ||||
|  | ||||
| print("Content-type: application/captive+json; charset=utf-8\n") | ||||
|  | ||||
| client = os.getenv("REMOTE_ADDR") | ||||
| response['captive'] = not hasValidToken(client) | ||||
|  | ||||
| if response['captive'] then | ||||
| 	response['user-portal-url'] = state:get("fbwifi", "main", "captive_portal_url") | ||||
| end | ||||
|  | ||||
| print( json.encode(response) ) | ||||
| @@ -1,57 +0,0 @@ | ||||
| #!/usr/bin/lua | ||||
| json = require("cjson") | ||||
| fbwifi = require("fbwifi") | ||||
|  | ||||
| state = uci.cursor("/var/state", "/tmp/fbwifi") | ||||
| GATEWAY_TOKEN = fbwifi.gateway_token() | ||||
|  | ||||
| response = { api_version = "2.0", token = json.null } | ||||
| client_mac = "" | ||||
|  | ||||
| function process_cors() | ||||
|         origin = os.getenv("HTTP_ORIGIN") | ||||
|         if string.len(origin or '') > 0 then | ||||
|                 allow_list = state:get("fbwifi", "main", "cross_origin_allow_rules") | ||||
|                 for _, value in pairs(allow_list) do | ||||
|                         if value == origin then | ||||
|                                 print("Access-Control-Allow-Origin: "..origin) | ||||
|                                 print("Vary: Origin") | ||||
|                                 break | ||||
|                         end | ||||
|                 end | ||||
|         end | ||||
| end | ||||
|  | ||||
| function map_remote_mac_to_token(client) | ||||
|  | ||||
| 	for key, value in pairs(client) do | ||||
| 		if | ||||
| 			key == 'mac' and | ||||
| 			value == client_mac | ||||
| 		then | ||||
| 			response.token = client.token | ||||
| 			return false -- escape outer loop | ||||
| 		end | ||||
| 	end | ||||
| end | ||||
|  | ||||
| function getClientToken(client_ip) | ||||
| 	f = io.popen("awk '/"..client_ip..".*0x2/ { printf(\"%s\", $4) }' /proc/net/arp", 'r') | ||||
| 	client_mac = assert(f:read('*a')) | ||||
| 	f:close() | ||||
|  | ||||
| 	state:foreach("fbwifi", "client", map_remote_mac_to_token) | ||||
| end | ||||
|  | ||||
| function getGatewayId() | ||||
| 	id = string.match(GATEWAY_TOKEN, 'FBWIFI:GATEWAY|[0-9]*|([0-9]*)') | ||||
| 	return id | ||||
| end | ||||
|  | ||||
| process_cors() | ||||
| print("Content-type: application/json; charset=utf-8\n") | ||||
|  | ||||
| getClientToken(os.getenv("REMOTE_ADDR")) | ||||
| response.gateway_id = getGatewayId() | ||||
|  | ||||
| print( json.encode(response) ) | ||||
| @@ -1,12 +0,0 @@ | ||||
| -- SPDX-License-Identifier: GPL-2.0-only | ||||
| -- Copyright (c) Facebook, Inc. and its affiliates. | ||||
|  | ||||
| module("luci.controller.fbwifi", package.seeall) | ||||
|  | ||||
| sys = require "luci.sys" | ||||
| ut = require "luci.util" | ||||
|  | ||||
| function index() | ||||
|     entry({"admin", "network", "fbwifi"}, template("fbwifi"), "Facebook Wi-Fi", 90).dependent=false | ||||
| end | ||||
|  | ||||
| @@ -1,16 +0,0 @@ | ||||
| <%# | ||||
|  Copyright | ||||
|  Licensed to the public under the GNU General Public License v2. | ||||
| -%> | ||||
|  | ||||
| <%+header%> | ||||
|  | ||||
| <h1>Facebook Wi-Fi</h1> | ||||
| <% | ||||
| 	require("uci") | ||||
| 	state = uci.cursor("/var/state", "/tmp/fbwifi") | ||||
| 	url = state:get("fbwifi", "main", "captive_portal_config_url") | ||||
| %> | ||||
| <a href="<% print(url) %>">Configure FB business page</a> | ||||
|  | ||||
| <%+footer%> | ||||
| @@ -34,11 +34,27 @@ edgecore,eap104) | ||||
|         ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy1tpt" | ||||
| 	ucidef_set_led_netdev "wan" "wan" "yellow:uplink" "eth0" | ||||
| 	;; | ||||
| liteon,wpx8324) | ||||
| 	ucidef_set_led_wlan "wlan2g" "WLAN2G" "orange:wifi2" "phy0tpt" | ||||
| 	ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy1tpt" | ||||
| 	ucidef_set_led_netdev "wan" "wan" "blue:uplink" "eth0" | ||||
| 	;; | ||||
| hfcl,ion4xi|\ | ||||
| hfcl,ion4x|\ | ||||
| hfcl,ion4x_2|\ | ||||
| hfcl,ion4xe) | ||||
|         ucidef_set_led_wlan "wlan5g" "WLAN5G" "blue:wifi5" "phy0tpt" | ||||
|         ucidef_set_led_wlan "wlan2g" "WLAN2G" "blue:wifi2" "phy1tpt" | ||||
| 	;; | ||||
| 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" | ||||
| 	;; | ||||
| esac | ||||
|  | ||||
| board_config_flush | ||||
|   | ||||
| @@ -13,6 +13,8 @@ qcom_setup_interfaces() | ||||
|  | ||||
| 	case $board in | ||||
| 	hfcl,ion4xi|\ | ||||
| 	hfcl,ion4x|\ | ||||
| 	hfcl,ion4x_2|\ | ||||
| 	hfcl,ion4xe) | ||||
| 		ucidef_set_interface_wan "eth0 eth1" | ||||
| 		ucidef_set_interface_lan "" | ||||
| @@ -31,28 +33,47 @@ qcom_setup_interfaces() | ||||
| 	cig,wf194c|\ | ||||
| 	cig,wf194c4|\ | ||||
| 	edgecore,eap106|\ | ||||
| 	indio,um-310ax-v1|\ | ||||
| 	indio,um-510axp-v1|\ | ||||
| 	indio,um-510axm-v1|\ | ||||
| 	qcom,ipq5018-mp03.3|\ | ||||
| 	sercomm,wallaby) | ||||
| 	yuncore,ax840|\ | ||||
| 	motorola,q14|\ | ||||
| 	sercomm,wallaby|\ | ||||
| 	plasmacloud,pax1800-v1|\ | ||||
| 	plasmacloud,pax1800-v2) | ||||
| 		ucidef_set_interface_lan "eth0" | ||||
| 		ucidef_set_interface_wan "eth1" | ||||
| 		;; | ||||
| 	edgecore,eap101) | ||||
| 	edgecore,eap101|\ | ||||
| 	glinet,axt1800) | ||||
| 		ucidef_set_interface_lan "eth1 eth2" | ||||
| 		ucidef_set_interface_wan "eth0" | ||||
| 		;; | ||||
| 	edgecore,eap102|\ | ||||
| 	edgecore,eap104|\ | ||||
| 	liteon,wpx8324|\ | ||||
| 	wallys,dr6018|\ | ||||
| 	cig,wf188n|\ | ||||
| 	cig,wf196) | ||||
| 	cig,wf196|\ | ||||
| 	muxi,ap3220l) | ||||
| 		ucidef_set_interface_lan "eth1" | ||||
| 		ucidef_set_interface_wan "eth0" | ||||
| 		;; | ||||
|        cig,wf660a) | ||||
|                 ucidef_set_interface_lan "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" | ||||
| 		;; | ||||
| 	wallys,dr6018-v4) | ||||
| 	wallys,dr6018-v4|\ | ||||
| 	glinet,ax1800|\ | ||||
| 	meshpp,s618-cp03|\ | ||||
| 	meshpp,s618-cp01) | ||||
| 		ucidef_set_interface_lan "eth1 eth2 eth3 eth4" | ||||
| 		ucidef_set_interface_wan "eth0" | ||||
| 		;; | ||||
| @@ -64,6 +85,12 @@ qcom_setup_interfaces() | ||||
| 		ucidef_add_switch_attr "switch1" "enable" "false" | ||||
| 		ucidef_add_switch_attr "switch1" "reset" "true" | ||||
| 		;; | ||||
| 	edgecore,eap104) | ||||
| 		ucidef_set_interface_lan "lan1 lan2 lan3 lan4" | ||||
| 		ucidef_set_interface_wan "eth0" | ||||
| 		ucidef_add_switch "switch1" \ | ||||
| 			"6@eth1" "1:lan1" "2:lan2" "3:lan3" "4:lan4" | ||||
| 		;; | ||||
| 	esac | ||||
| } | ||||
|  | ||||
| @@ -72,15 +99,62 @@ qcom_setup_macs() | ||||
| 	local board="$1" | ||||
|  | ||||
| 	case $board in | ||||
| 	cig,wf188n|\ | ||||
| 	cig,wf194c|\ | ||||
| 	cig,wf194c4) | ||||
| 		mac=$(grep BaseMacAddress= /dev/mtd14 | cut -dx -f2) | ||||
| 		mtd=$(find_mtd_chardev "0:APPSBLENV") | ||||
| 		[ -z "$mtd" ] && return; | ||||
| 		mac=$(grep BaseMacAddress= $mtd | cut -dx -f2) | ||||
| 		[ -z "$mac" ] && return; | ||||
| 		wan_mac=$(macaddr_canonicalize $mac) | ||||
| 		lan_mac=$(macaddr_add "$wan_mac" 1) | ||||
| 		ucidef_set_network_device_mac eth0 $lan_mac | ||||
| 		ucidef_set_network_device_mac eth1 $wan_mac | ||||
| 		ip link set eth0 address $lan_mac | ||||
| 		ip link set eth1 address $wan_mac | ||||
| 		ucidef_set_label_macaddr $wan_mac | ||||
| 		;; | ||||
| 	cig,wf196) | ||||
| 		mtd=$(find_mtd_chardev "0:APPSBLENV") | ||||
| 		[ -z "$mtd" ] && return; | ||||
| 		mac=$(grep BaseMacAddress= $mtd | cut -dx -f2) | ||||
| 		[ -z "$mac" ] && return; | ||||
| 		wan_mac=$(macaddr_canonicalize $mac) | ||||
| 		lan_mac=$(macaddr_add "$wan_mac" 1) | ||||
| 		ucidef_set_network_device_mac eth1 $lan_mac | ||||
| 		ucidef_set_network_device_mac eth0 $wan_mac | ||||
| 		ip link set eth0 address $wan_mac | ||||
| 		ip link set eth1 address $lan_mac | ||||
| 		ucidef_set_label_macaddr $wan_mac | ||||
| 		;; | ||||
| 	cybertan,eww622-a1) | ||||
| 	        mac=$(grep -i -m 1 mac_addr_base= /dev/`cat /proc/mtd | grep devinfo | cut -d: -f1` | cut -d= -f2) | ||||
| 	        [ -z "$mac"] && mac="00:11:22:33:44:55" | ||||
| 		wan_mac=$(macaddr_canonicalize $mac) | ||||
| 		lan_mac=$(macaddr_add "$wan_mac" 1) | ||||
| 		ucidef_set_network_device_mac eth0 $wan_mac | ||||
| 		ucidef_set_network_device_mac eth1 $lan_mac | ||||
| 		ucidef_set_label_macaddr $wan_mac | ||||
| 		;; | ||||
| 	indio,um-310ax-v1|\ | ||||
| 	indio,um-510axp-v1|\ | ||||
| 	indio,um-510axm-v1|\ | ||||
| 	yuncore,ax840) | ||||
| 		wan_mac=$(cat /sys/class/net/eth1/address) | ||||
| 		lan_mac=$(macaddr_add "$wan_mac" 1) | ||||
| 		;; | ||||
| 	yuncore,fap650) | ||||
| 		wan_mac=$(cat /sys/class/net/eth4/address) | ||||
| 		lan_mac=$(macaddr_add "$wan_mac" 1) | ||||
| 		;; | ||||
| 	muxi,ap3220l) | ||||
| 		wan_mac=$(mtd_get_mac_binary 0:Product_Info 0x5b) | ||||
| 		lan_mac=$(macaddr_add "$wan_mac" 1) | ||||
| 		ucidef_set_network_device_mac eth0 $wan_mac | ||||
| 		ucidef_set_network_device_mac eth1 $lan_mac | ||||
| 		ip link set eth0 address $wan_mac | ||||
| 		ip link set eth1 address $lan_mac | ||||
| 		;; | ||||
| 	*) | ||||
| 		wan_mac=$(cat /sys/class/net/eth0/address) | ||||
| 		lan_mac=$(macaddr_add "$wan_mac" 1) | ||||
| @@ -88,6 +162,7 @@ qcom_setup_macs() | ||||
| 	esac | ||||
| 	[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac | ||||
| 	[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac | ||||
| 	[ -n "$wan_mac" ] && ucidef_set_label_macaddr "$wan_mac" | ||||
| } | ||||
|  | ||||
| board_config_update | ||||
|   | ||||
| @@ -49,6 +49,15 @@ ath11k_generate_macs_ion4x() { | ||||
| 	echo -ne \\x${wifimac2//:/\\x} >> /lib/firmware/ath11k-macs | ||||
| } | ||||
|  | ||||
| ath11k_generate_macs_pax1800() { | ||||
| 	touch /lib/firmware/ath11k-macs | ||||
| 	eth=$(cat /sys/class/net/eth0/address) | ||||
| 	mac1=$(macaddr_add $eth 10) | ||||
| 	mac2=$(macaddr_add $eth 2) | ||||
| 	echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs | ||||
| 	echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs | ||||
| } | ||||
|  | ||||
| caldata_die() { | ||||
|         echo "caldata: " "$*" | ||||
|         exit 1 | ||||
| @@ -61,6 +70,9 @@ caldata_extract() { | ||||
|         local mtd | ||||
|  | ||||
|         mtd=$(find_mtd_chardev $part) | ||||
|         if [ -z "$mtd" ]; then                                  | ||||
|                 mtd=/dev/$(echo $(find_mmc_part $part) | sed 's/^.\{5\}//') | ||||
|         fi                	 | ||||
|         [ -n "$mtd" ] || caldata_die "no mtd device found for partition $part" | ||||
|  | ||||
|         dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \ | ||||
| @@ -77,6 +89,9 @@ case "$FIRMWARE" in | ||||
| 	cig,wf196|\ | ||||
| 	edgecore,eap102 |\ | ||||
| 	edgecore,eap106 |\ | ||||
| 	indio,um-310ax-v1|\ | ||||
| 	indio,um-510axp-v1|\ | ||||
| 	indio,um-510axm-v1|\ | ||||
| 	qcom,ipq807x-hk01|\ | ||||
| 	qcom,ipq807x-hk14|\ | ||||
| 	tplink,ex227|\ | ||||
| @@ -90,13 +105,24 @@ case "$FIRMWARE" in | ||||
| 	case "$board" in | ||||
| 	cig,wf188|\ | ||||
| 	cig,wf188n|\ | ||||
| 	cig,wf660a|\ | ||||
| 	edgecore,eap101|\ | ||||
| 	hfcl,ion4xi|\ | ||||
| 	hfcl,ion4x_2|\ | ||||
| 	hfcl,ion4x|\ | ||||
| 	hfcl,ion4xe|\ | ||||
| 	wallys,dr6018|\ | ||||
| 	wallys,dr6018-v4|\ | ||||
| 	meshpp,ipq6018-cp01|\ | ||||
| 	meshpp,ipq6018-cp03|\ | ||||
| 	qcom,ipq6018-cp03|\ | ||||
| 	qcom,ipq6018-cp01|\ | ||||
| 	xiaomi,ax1800) | ||||
| 	xiaomi,ax1800|\ | ||||
| 	glinet,ax1800|\ | ||||
| 	yuncore,ax840|\ | ||||
| 	yuncore,fap650|\ | ||||
| 	plasmacloud,pax1800-v1|\ | ||||
| 	plasmacloud,pax1800-v2) | ||||
|                 caldata_extract "0:ART" 0x1000 0x20000   | ||||
| 		;; | ||||
| 	esac | ||||
| @@ -105,21 +131,37 @@ ath11k/IPQ5018/hw1.0/caldata.bin) | ||||
| 	case "$board" in | ||||
| 	cybertan,eww622-a1|\ | ||||
| 	edgecore,eap104|\ | ||||
| 	liteon,wpx8324|\ | ||||
| 	motorola,q14|\ | ||||
| 	muxi,ap3220l|\ | ||||
| 	qcom,ipq5018-mp03.1) | ||||
|                 caldata_extract "0:ART" 0x1000 0x20000   | ||||
| 		;; | ||||
| 	esac | ||||
| 	;; | ||||
| ath11k/qcn6122/hw1.0/caldata_1.bin) | ||||
| 	case "$board" in | ||||
| 	motorola,q14) | ||||
|                 caldata_extract "0:ART" 0x26800 0x20000   | ||||
| 		;; | ||||
| 	esac | ||||
| 	;; | ||||
| ath11k/qcn6122/hw1.0/caldata_2.bin) | ||||
| 	case "$board" in | ||||
| 	edgecore,eap104) | ||||
| 	motorola,q14|\ | ||||
| 	edgecore,eap104|\ | ||||
| 	liteon,wpx8324) | ||||
|                 caldata_extract "0:ART" 0x4c000 0x20000   | ||||
| 		;; | ||||
| 	muxi,ap3220l) | ||||
| 		caldata_extract "0:ART" 0x26800 0x20000 | ||||
| 		;; | ||||
| 	esac | ||||
| 	;; | ||||
| ath11k/QCN9074/hw1.0/caldata_1.bin) | ||||
| 	case "$board" in | ||||
| 	cig,wf196|\ | ||||
| 	wallys,dr6018-v4|\ | ||||
| 	cybertan,eww622-a1|\ | ||||
| 	qcom,ipq5018-mp03.1|\ | ||||
| 	qcom,ipq807x-hk14) | ||||
| @@ -138,21 +180,34 @@ ath11k/QCN9074/hw1.0/caldata_2.bin) | ||||
| ath11k-macs) | ||||
| 	case "$board" in | ||||
| 	hfcl,ion4xi|\ | ||||
| 	hfcl,ion4x|\ | ||||
| 	hfcl,ion4x_2|\ | ||||
| 	hfcl,ion4xe)                                                | ||||
| 		ath11k_generate_macs_ion4x | ||||
| 		;; | ||||
| 	edgecore,eap101) | ||||
| 		ath11k_generate_macs_eap101 | ||||
| 		;; | ||||
| 	yuncore,ax840|\ | ||||
| 	edgecore,eap102|\ | ||||
| 	edgecore,eap104|\ | ||||
| 	edgecore,eap106|\ | ||||
| 	indio,um-310ax-v1|\ | ||||
| 	indio,um-510axp-v1|\ | ||||
| 	indio,um-510axm-v1|\ | ||||
| 	cig,wf660a|\ | ||||
| 	cig,wf188n) | ||||
| 		ath11k_generate_macs | ||||
| 		;; | ||||
| 	cig,wf194c|\ | ||||
| 	cig,wf194c) | ||||
| 	cig,wf194c4|\ | ||||
| 	cig,wf196) | ||||
| 		ath11k_generate_macs_wf194 | ||||
| 		;; | ||||
| 	plasmacloud,pax1800-v1|\ | ||||
| 	plasmacloud,pax1800-v2) | ||||
| 		ath11k_generate_macs_pax1800 | ||||
| 		;; | ||||
| 	esac | ||||
| 	;; | ||||
| *) | ||||
|   | ||||
| @@ -1,67 +0,0 @@ | ||||
| #!/bin/sh | ||||
| [ "$ACTION" = add ] || exit | ||||
|  | ||||
| NPROCS="$(grep -c "^processor.*:" /proc/cpuinfo)" | ||||
| [ "$NPROCS" -gt 1 ] || exit | ||||
|  | ||||
| PROC_MASK="$(( (1 << $NPROCS) - 1 ))" | ||||
|  | ||||
| find_irq_cpu() { | ||||
| 	local dev="$1" | ||||
| 	local match="$(grep -m 1 "$dev\$" /proc/interrupts)" | ||||
| 	local cpu=0 | ||||
|  | ||||
| 	[ -n "$match" ] && { | ||||
| 		set -- $match | ||||
| 		shift | ||||
| 		for cur in `seq 1 $NPROCS`; do | ||||
| 			[ "$1" -gt 0 ] && { | ||||
| 				cpu=$(($cur - 1)) | ||||
| 				break | ||||
| 			} | ||||
| 			shift | ||||
| 		done | ||||
| 	} | ||||
|  | ||||
| 	echo "$cpu" | ||||
| } | ||||
|  | ||||
| set_hex_val() { | ||||
| 	local file="$1" | ||||
| 	local val="$2" | ||||
| 	val="$(printf %x "$val")" | ||||
| 	[ -n "$DEBUG" ] && echo "$file = $val" | ||||
| 	echo "$val" > "$file" | ||||
| } | ||||
|  | ||||
| default_ps="$(uci get "network.@globals[0].default_ps")" | ||||
| [ -n "$default_ps" -a "$default_ps" != 1 ] && exit 0 | ||||
|  | ||||
| exec 512>/var/lock/smp_tune.lock | ||||
| flock 512 || exit 1 | ||||
|  | ||||
| for dev in /sys/class/net/*; do | ||||
| 	[ -d "$dev" ] || continue | ||||
|  | ||||
| 	# ignore virtual interfaces | ||||
| 	[ -n "$(ls "${dev}/" | grep '^lower_')" ] && continue | ||||
| 	[ -d "${dev}/device" ] || continue | ||||
|  | ||||
| 	device="$(readlink "${dev}/device")" | ||||
| 	device="$(basename "$device")" | ||||
| 	irq_cpu="$(find_irq_cpu "$device")" | ||||
| 	irq_cpu_mask="$((1 << $irq_cpu))" | ||||
|  | ||||
| 	for q in ${dev}/queues/rx-*; do | ||||
| 		set_hex_val "$q/rps_cpus" "$(($PROC_MASK & ~$irq_cpu_mask))" | ||||
| 	done | ||||
|  | ||||
| 	ntxq="$(ls -d ${dev}/queues/tx-* | wc -l)" | ||||
|  | ||||
| 	idx=$(($irq_cpu + 1)) | ||||
| 	for q in ${dev}/queues/tx-*; do | ||||
| 		set_hex_val "$q/xps_cpus" "$((1 << $idx))" | ||||
| 		let "idx = idx + 1" | ||||
| 		[ "$idx" -ge "$NPROCS" ] && idx=0 | ||||
| 	done | ||||
| done | ||||
| @@ -1,3 +1,3 @@ | ||||
| #!/bin/sh | ||||
| mac=$(cat /etc/board.json | jsonfilter -e '@["network-device"]["'$DEVICENAME'"]'.macaddr) | ||||
| mac=$(cat /etc/board.json | jsonfilter -e '@["network_device"]["'$DEVICENAME'"]'.macaddr) | ||||
| [ -n "$mac" ] && ip link set $DEVICENAME address $mac | ||||
|   | ||||
| @@ -19,4 +19,12 @@ boot() { | ||||
| 		ssdk_sh debug phy set 8 0x4004c441 0x8 | ||||
| 		;; | ||||
| 	esac | ||||
|  | ||||
| 	case "$(board_name)" in | ||||
| 	cig,wf196) | ||||
| 		# setup the leds | ||||
| 		ssdk_sh debug phy set 0 0x401ec431 0xc00f | ||||
| 		ssdk_sh debug phy set 0 0x401ec430 0x806f | ||||
| 		;; | ||||
| 	esac | ||||
| } | ||||
|   | ||||
| @@ -4,8 +4,14 @@ START=99 | ||||
|  | ||||
| boot() { | ||||
| 	case "$(board_name)" in | ||||
| 	hfcl,ion4xe|\ | ||||
| 	hfcl,ion4xi) | ||||
| 		fw_setenv boot_count 0 | ||||
| 		;;		 | ||||
| 	edgecore,eap101|\ | ||||
| 	edgecore,eap102) | ||||
| 		avail=$(fw_printenv -n upgrade_available) | ||||
| 		[ "${avail}" -eq 1 ] || fw_setenv upgrade_available 1 | ||||
| 		fw_setenv bootcount 0 | ||||
| 		;; | ||||
| 	esac | ||||
|   | ||||
| @@ -1,58 +0,0 @@ | ||||
| #!/bin/sh /etc/rc.common | ||||
|  | ||||
| START=80 | ||||
|  | ||||
| set_affinity() { | ||||
| 	local affinity=$1 | ||||
| 	local name=$2 | ||||
| 	local irq=`grep -E -m1 $name /proc/interrupts | cut -d ':' -f 1 | tail -n1 | tr -d ' '` | ||||
|         [ -n "$irq" ] && { | ||||
| 		logger ath11k setting affinity for $name/$irq to $affinity | ||||
| 		echo $affinity > /proc/irq/$irq/smp_affinity | ||||
| 	} | ||||
| } | ||||
|  | ||||
| boot() { | ||||
| 	. /lib/functions/system.sh | ||||
|  | ||||
| 	board=$(board_name) | ||||
| 	case $board in | ||||
| 	cig,wf196) | ||||
| 		set_affinity 1 reo2host-destination-ring2 | ||||
| 		set_affinity 2 reo2host-destination-ring1 | ||||
| 		;; | ||||
| 	*) | ||||
| 		set_affinity 2 reo2host-destination-ring2 | ||||
| 		set_affinity 1 reo2host-destination-ring1 | ||||
| 		;; | ||||
| 	esac | ||||
|  | ||||
| 	case $board in | ||||
| 	maple) | ||||
| 		;; | ||||
| 	*) | ||||
| 		set_affinity 8 reo2host-destination-ring4 | ||||
| 		set_affinity 4 reo2host-destination-ring3 | ||||
| 	 | ||||
| 		set_affinity 8 wbm2host-tx-completions-ring3 | ||||
| 		set_affinity 4 wbm2host-tx-completions-ring2 | ||||
| 		set_affinity 2 wbm2host-tx-completions-ring1 | ||||
|  | ||||
| 		set_affinity 8 ppdu-end-interrupts-mac1 | ||||
| 		set_affinity 8 rxdma2host-monitor-status-ring-mac1 | ||||
| 		set_affinity 8 rxdma2host-monitor-destination-mac1 | ||||
| 		set_affinity 8 host2rxdma-monitor-ring1 | ||||
| 		;; | ||||
| 	esac | ||||
|  | ||||
| 	set_affinity 4 ppdu-end-interrupts-mac2 | ||||
| 	set_affinity 4 rxdma2host-monitor-status-ring-mac2 | ||||
| 	set_affinity 4 rxdma2host-monitor-destination-mac2 | ||||
| 	set_affinity 4 host2rxdma-monitor-ring2 | ||||
|  | ||||
| 	set_affinity 2 ppdu-end-interrupts-mac3 | ||||
| 	set_affinity 2 rxdma2host-monitor-status-ring-mac3 | ||||
| 	set_affinity 2 rxdma2host-monitor-destination-mac3 | ||||
| 	set_affinity 2 host2rxdma-monitor-ring3 | ||||
| } | ||||
|  | ||||
							
								
								
									
										126
									
								
								feeds/ipq807x/ipq807x/base-files/lib/upgrade/dualboot_datachk.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								feeds/ipq807x/ipq807x/base-files/lib/upgrade/dualboot_datachk.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,126 @@ | ||||
| # The U-Boot loader with the datachk patchset for dualbooting requires image | ||||
| # sizes and checksums to be provided in the U-Boot environment. | ||||
| # The devices come with 2 main partitions - while one is active | ||||
| # sysupgrade will flash the other. The boot order is changed to boot the | ||||
| # newly flashed partition. If the new partition can't be booted due to | ||||
| # upgrade failures the previously used partition is loaded. | ||||
|  | ||||
| platform_post_upgrade_sanity_check() | ||||
| { | ||||
| 	local part_name=$1 | ||||
| 	local inactive_mtd=$2 | ||||
| 	local cfg_md5=$3 | ||||
| 	local part_offset=$4 | ||||
| 	local part_size=$5 | ||||
|  | ||||
| 	md5_part_disk=$(dd if=/dev/${inactive_mtd} bs=$((64*1024)) skip=$((part_offset / (64*1024))) count=$((part_size / (64*1024))) 2>&- | md5sum | awk '{print $1}') | ||||
|  | ||||
| 	if [ "${cfg_md5}" != "${md5_part_disk}" ]; then | ||||
| 	      echo "post-flashing checksum mismatch: ${part_name}" >&2 | ||||
| 	      echo "${cfg_md5} != ${md5_part_disk}" | ||||
| 	      return 1 | ||||
| 	fi | ||||
|  | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| platform_do_upgrade_dualboot_datachk() { | ||||
| 	local tar_file="$1" | ||||
| 	local restore_backup | ||||
| 	local primary_kernel_mtd | ||||
|  | ||||
| 	local setenv_script="/tmp/fw_env_upgrade" | ||||
|  | ||||
| 	local kernel_mtd="$(find_mtd_index $PART_NAME)" | ||||
| 	local kernel_offset="$(cat /sys/class/mtd/mtd${kernel_mtd}/offset)" | ||||
| 	local total_size="$(cat /sys/class/mtd/mtd${kernel_mtd}/size)" | ||||
|  | ||||
| 	# detect to which flash region the new image is written to. | ||||
| 	# | ||||
| 	# 1. check what is the mtd index for the first flash region on this | ||||
| 	#    device | ||||
| 	# 2. check if the target partition ("inactive") has the mtd index of | ||||
| 	#    the first flash region | ||||
| 	# | ||||
| 	#    - when it is: the new bootseq will be 1,2 and the first region is | ||||
| 	#      modified | ||||
| 	#    - when it isnt: bootseq will be 2,1 and the second region is | ||||
| 	#      modified | ||||
| 	# | ||||
| 	# The detection has to be done via the hardcoded mtd partition because | ||||
| 	# the current boot might be done with the fallback region. Let us | ||||
| 	# assume that the current bootseq is 1,2. The bootloader detected that | ||||
| 	# the image in flash region 1 is corrupt and thus switches to flash | ||||
| 	# region 2. The bootseq in the u-boot-env is now still the same and | ||||
| 	# the sysupgrade code can now only rely on the actual mtd indexes and | ||||
| 	# not the bootseq variable to detect the currently booted flash | ||||
| 	# region/image. | ||||
| 	# | ||||
| 	# In the above example, an implementation which uses bootseq ("1,2") to | ||||
| 	# detect the currently booted image would assume that region 1 is booted | ||||
| 	# and then overwrite the variables for the wrong flash region (aka the | ||||
| 	# one which isn't modified). This could result in a device which doesn't | ||||
| 	# boot anymore to Linux until it was reflashed with ap51-flash. | ||||
| 	local next_boot_part="1" | ||||
| 	case "$(board_name)" in | ||||
| 	plasmacloud,pax1800-v1|\ | ||||
| 	plasmacloud,pax1800-v2) | ||||
| 		primary_kernel_mtd=9 | ||||
| 		;; | ||||
| 	*) | ||||
| 		echo "failed to detect primary kernel mtd partition for board" | ||||
| 		return 1 | ||||
| 		;; | ||||
| 	esac | ||||
| 	[ "$kernel_mtd" = "$primary_kernel_mtd" ] || next_boot_part="2" | ||||
|  | ||||
| 	local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$') | ||||
| 	board_dir=${board_dir%/} | ||||
|  | ||||
| 	local kernel_length=$(tar xf $tar_file ${board_dir}/kernel -O | wc -c) | ||||
| 	local rootfs_length=$(tar xf $tar_file ${board_dir}/root -O | wc -c) | ||||
| 	# rootfs without EOF marker | ||||
| 	rootfs_length=$((rootfs_length-4)) | ||||
|  | ||||
| 	local kernel_md5=$(tar xf $tar_file ${board_dir}/kernel -O | md5sum); kernel_md5="${kernel_md5%% *}" | ||||
| 	# md5 checksum of rootfs with EOF marker | ||||
| 	local rootfs_md5=$(tar xf $tar_file ${board_dir}/root -O | dd bs=1 count=$rootfs_length | md5sum); rootfs_md5="${rootfs_md5%% *}" | ||||
|  | ||||
| 	# | ||||
| 	# add tar support to get_image() to use default_do_upgrade() instead? | ||||
| 	# | ||||
|  | ||||
| 	# take care of restoring a saved config | ||||
| 	[ -n "$UPGRADE_BACKUP" ] && restore_backup="${MTD_CONFIG_ARGS} -j ${UPGRADE_BACKUP}" | ||||
|  | ||||
| 	mtd -q erase inactive | ||||
| 	tar xf $tar_file ${board_dir}/root -O | mtd -n -p $kernel_length $restore_backup write - $PART_NAME | ||||
| 	tar xf $tar_file ${board_dir}/kernel -O | mtd -n write - $PART_NAME | ||||
|  | ||||
| 	platform_post_upgrade_sanity_check "kernel" "mtd${kernel_mtd}" $kernel_md5 0 $kernel_length || return 1 | ||||
| 	platform_post_upgrade_sanity_check "rootfs" "mtd${kernel_mtd}" $rootfs_md5 $kernel_length $rootfs_length || return 1 | ||||
|  | ||||
| 	# prepare new u-boot env | ||||
| 	if [ "$next_boot_part" = "1" ]; then | ||||
| 		echo "bootseq 1,2" > $setenv_script | ||||
| 	else | ||||
| 		echo "bootseq 2,1" > $setenv_script | ||||
| 	fi | ||||
|  | ||||
| 	printf "kernel_size_%i 0x%08x\n" $next_boot_part $kernel_length >> $setenv_script | ||||
| 	printf "vmlinux_start_addr 0x%08x\n" ${kernel_offset} >> $setenv_script | ||||
| 	printf "vmlinux_size 0x%08x\n" ${kernel_length} >> $setenv_script | ||||
| 	printf "vmlinux_checksum %s\n" ${kernel_md5} >> $setenv_script | ||||
|  | ||||
| 	printf "rootfs_size_%i 0x%08x\n" $next_boot_part $((total_size-kernel_length)) >> $setenv_script | ||||
| 	printf "rootfs_start_addr 0x%08x\n" $((kernel_offset+kernel_length)) >> $setenv_script | ||||
| 	printf "rootfs_size 0x%08x\n" ${rootfs_length} >> $setenv_script | ||||
| 	printf "rootfs_checksum %s\n" ${rootfs_md5} >> $setenv_script | ||||
|  | ||||
| 	# store u-boot env changes | ||||
| 	mkdir -p /var/lock | ||||
| 	fw_setenv -s $setenv_script || { | ||||
| 		echo "failed to update U-Boot environment" | ||||
| 		return 1 | ||||
| 	} | ||||
| } | ||||
| @@ -1,5 +1,9 @@ | ||||
| . /lib/functions/system.sh | ||||
|  | ||||
|  | ||||
| RAMFS_COPY_BIN='fw_setenv' | ||||
| RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock /tmp/downgrade' | ||||
|  | ||||
| qca_do_upgrade() { | ||||
|         local tar_file="$1" | ||||
|  | ||||
| @@ -16,26 +20,102 @@ qca_do_upgrade() { | ||||
|         fi | ||||
| } | ||||
|  | ||||
| find_mmc_part() { | ||||
| 	local DEVNAME PARTNAME | ||||
|  | ||||
| 	if grep -q "$1" /proc/mtd; then | ||||
| 		echo "" && return 0 | ||||
| 	fi | ||||
|  | ||||
| 	for DEVNAME in /sys/block/mmcblk*/mmcblk*p*; do | ||||
| 		PARTNAME=$(grep PARTNAME ${DEVNAME}/uevent | cut -f2 -d'=') | ||||
| 		[ "$PARTNAME" = "$1" ] && echo "/dev/$(basename $DEVNAME)" && return 0 | ||||
| 	done | ||||
| } | ||||
|  | ||||
| do_flash_emmc() { | ||||
| 	local tar_file=$1 | ||||
| 	local emmcblock=$(find_mmc_part $2) | ||||
| 	local board_dir=$3 | ||||
| 	local part=$4 | ||||
|  | ||||
| 	[ -z "$emmcblock" ] && { | ||||
| 		echo failed to find $2 | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	echo erase $4 | ||||
| 	dd if=/dev/zero of=${emmcblock} 2> /dev/null | ||||
| 	echo flash $4 | ||||
| 	tar Oxf $tar_file ${board_dir}/$part | dd of=${emmcblock} | ||||
| } | ||||
|  | ||||
| emmc_do_upgrade_cig() { | ||||
|         local tar_file="$1" | ||||
|  | ||||
|         local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$') | ||||
|         board_dir=${board_dir%/} | ||||
| 	 | ||||
|         do_flash_emmc $tar_file '0:HLOS_1' $board_dir kernel | ||||
|         do_flash_emmc $tar_file 'rootfs_1' $board_dir root | ||||
|  | ||||
|         local emmcblock="$(find_mmc_part "rootfs_data")" | ||||
|         if [ -e "$emmcblock" ]; then | ||||
|                 mkfs.ext4 -F "$emmcblock" | ||||
|         fi | ||||
| } | ||||
|  | ||||
|  | ||||
| emmc_do_upgrade() { | ||||
| 	local tar_file="$1" | ||||
|  | ||||
| 	local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$') | ||||
| 	board_dir=${board_dir%/} | ||||
| 	do_flash_emmc $tar_file '0:HLOS' $board_dir kernel | ||||
| 	do_flash_emmc $tar_file 'rootfs' $board_dir root | ||||
|  | ||||
| 	local emmcblock="$(find_mmc_part "rootfs_data")" | ||||
|         if [ -e "$emmcblock" ]; then | ||||
|                 mkfs.ext4 -F "$emmcblock" | ||||
|         fi | ||||
| } | ||||
|  | ||||
| platform_check_image() { | ||||
| 	local magic_long="$(get_magic_long "$1")" | ||||
| 	board=$(board_name) | ||||
| 	case $board in | ||||
| 	cig,wf188|\ | ||||
| 	cig,wf660a|\ | ||||
| 	cig,wf188n|\ | ||||
| 	cig,wf194c|\ | ||||
| 	cig,wf194c4|\ | ||||
| 	cig,wf196|\ | ||||
| 	cybertan,eww622-a1|\ | ||||
| 	glinet,ax1800|\ | ||||
| 	glinet,axt1800|\ | ||||
| 	indio,um-310ax-v1|\ | ||||
| 	indio,um-510axp-v1|\ | ||||
| 	indio,um-510axm-v1|\ | ||||
| 	wallys,dr6018|\ | ||||
| 	wallys,dr6018-v4|\ | ||||
| 	edgecore,eap101|\ | ||||
| 	edgecore,eap102|\ | ||||
| 	edgecore,eap104|\ | ||||
| 	liteon,wpx8324|\ | ||||
| 	edgecore,eap106|\ | ||||
| 	hfcl,ion4xi|\ | ||||
| 	hfcl,ion4x|\ | ||||
| 	hfcl,ion4x_2|\ | ||||
| 	hfcl,ion4xe|\ | ||||
| 	muxi,ap3220l|\ | ||||
| 	plasmacloud,pax1800-v1|\ | ||||
| 	plasmacloud,pax1800-v2|\ | ||||
| 	tplink,ex227|\ | ||||
| 	tplink,ex447|\ | ||||
| 	yuncore,ax840|\ | ||||
| 	yuncore,fap650|\ | ||||
| 	motorola,q14|\ | ||||
| 	muxi,ap3220l|\ | ||||
| 	qcom,ipq6018-cp01|\ | ||||
| 	qcom,ipq807x-hk01|\ | ||||
| 	qcom,ipq807x-hk14|\ | ||||
| @@ -56,30 +136,79 @@ platform_do_upgrade() { | ||||
| 	cig,wf188) | ||||
| 		qca_do_upgrade $1 | ||||
| 		;; | ||||
| 	cig,wf660a) | ||||
| 		emmc_do_upgrade_cig $1 | ||||
| 		;; | ||||
| 	motorola,q14) | ||||
| 		emmc_do_upgrade $1 | ||||
| 		;; | ||||
| 	cig,wf188n|\ | ||||
| 	cig,wf194c|\ | ||||
| 	cig,wf194c4|\ | ||||
| 	cig,wf196|\ | ||||
| 	cybertan,eww622-a1|\ | ||||
| 	edgecore,eap104|\ | ||||
| 	hfcl,ion4xi|\ | ||||
| 	hfcl,ion4xe|\ | ||||
| 	glinet,ax1800|\ | ||||
| 	glinet,axt1800|\ | ||||
| 	indio,um-310ax-v1|\ | ||||
| 	indio,um-510axp-v1|\ | ||||
| 	indio,um-510axm-v1|\ | ||||
| 	qcom,ipq6018-cp01|\ | ||||
| 	qcom,ipq807x-hk01|\ | ||||
| 	qcom,ipq807x-hk14|\ | ||||
| 	qcom,ipq5018-mp03.3|\ | ||||
| 	wallys,dr6018|\ | ||||
| 	wallys,dr6018-v4|\ | ||||
| 	yuncore,ax840|\ | ||||
| 	yuncore,fap650|\ | ||||
| 	tplink,ex447|\ | ||||
| 	tplink,ex227)	 | ||||
| 	tplink,ex227|\ | ||||
| 	meshpp,s618-cp03|\ | ||||
| 	meshpp,s618-cp01) | ||||
| 		nand_upgrade_tar "$1" | ||||
| 		;; | ||||
| 	edgecore,eap106|\ | ||||
| 	edgecore,eap102|\ | ||||
| 	edgecore,eap101) | ||||
| 	hfcl,ion4xi|\ | ||||
| 	hfcl,ion4x|\ | ||||
| 	hfcl,ion4x_2|\ | ||||
| 	hfcl,ion4xe) | ||||
| 		if grep -q rootfs_1 /proc/cmdline; then | ||||
| 			CI_UBIPART="rootfs" | ||||
| 			fw_setenv primary 0 || exit 1 | ||||
| 		else | ||||
| 			CI_UBIPART="rootfs_1" | ||||
| 			fw_setenv primary 1 || exit 1 | ||||
| 		fi | ||||
| 		nand_upgrade_tar "$1" | ||||
| 		;; | ||||
| 	edgecore,eap104|\ | ||||
| 	liteon,wpx8324|\ | ||||
| 	edgecore,eap106) | ||||
| 		CI_UBIPART="rootfs1" | ||||
| 		[ "$(find_mtd_chardev rootfs)" ] && CI_UBIPART="rootfs" | ||||
| 		nand_upgrade_tar "$1" | ||||
| 		;; | ||||
| 	edgecore,eap101|\ | ||||
| 	edgecore,eap102) | ||||
| 		if [ "$(find_mtd_chardev rootfs)" ]; then | ||||
| 			CI_UBIPART="rootfs" | ||||
| 		else | ||||
| 			if [ -e /tmp/downgrade ]; then | ||||
| 				CI_UBIPART="rootfs1" | ||||
| 				fw_setenv active 1 || exit 1 | ||||
| 				fw_setenv upgrade_available 0 || exit 1 | ||||
| 			elif grep -q rootfs1 /proc/cmdline; then | ||||
| 				CI_UBIPART="rootfs2" | ||||
| 				fw_setenv active 2 || exit 1 | ||||
| 			else | ||||
| 				CI_UBIPART="rootfs1" | ||||
| 				fw_setenv active 1 || exit 1 | ||||
| 			fi | ||||
| 		fi | ||||
| 		nand_upgrade_tar "$1" | ||||
| 		;; | ||||
| 	plasmacloud,pax1800-v1|\ | ||||
| 	plasmacloud,pax1800-v2) | ||||
| 		PART_NAME="inactive" | ||||
| 		platform_do_upgrade_dualboot_datachk "$1" | ||||
| 		;; | ||||
| 	esac | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,23 @@ | ||||
| /* | ||||
|  * Copyright (c) 2018-2020, 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-ipq5018-liteon-wpx8324.dts" | ||||
|  | ||||
| / { | ||||
| 	pmuv8: pmu { | ||||
| 		compatible = "arm,cortex-a7-pmu"; | ||||
| 	}; | ||||
| }; | ||||
| @@ -0,0 +1,23 @@ | ||||
| /* | ||||
|  * Copyright (c) 2018-2020, 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-ipq5018-muxi-ap3220l.dts" | ||||
|  | ||||
| / { | ||||
| 	pmuv8: pmu { | ||||
| 		compatible = "arm,cortex-a7-pmu"; | ||||
| 	}; | ||||
| }; | ||||
| @@ -0,0 +1,23 @@ | ||||
| /* | ||||
|  * Copyright (c) 2018-2020, 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-ipq5018-q14.dts" | ||||
|  | ||||
| / { | ||||
| 	pmuv8: pmu { | ||||
| 		compatible = "arm,cortex-a7-pmu"; | ||||
| 	}; | ||||
| }; | ||||
| @@ -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-cig-wf660a.dts" | ||||
| #include "qcom-ipq6018.dtsi" | ||||
| @@ -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-gl-ax1800.dts" | ||||
| #include "qcom-ipq6018.dtsi" | ||||
| @@ -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-gl-axt1800.dts" | ||||
| #include "qcom-ipq6018.dtsi" | ||||
| @@ -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-hfcl-ion4x.dts" | ||||
| #include "qcom-ipq6018.dtsi" | ||||
| @@ -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-hfcl-ion4x_2.dts" | ||||
| #include "qcom-ipq6018.dtsi" | ||||
| @@ -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-indio-um-310ax-v1.dts" | ||||
| #include "qcom-ipq6018.dtsi" | ||||
| @@ -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-indio-um-510axm-v1.dts" | ||||
| #include "qcom-ipq6018.dtsi" | ||||
| @@ -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-indio-um-510axp-v1.dts" | ||||
| #include "qcom-ipq6018.dtsi" | ||||
| @@ -0,0 +1,2 @@ | ||||
| #include "../../../arm64/boot/dts/qcom/qcom-ipq6018-meshpp-s618-cp01.dts" | ||||
| #include "qcom-ipq6018.dtsi" | ||||
| @@ -0,0 +1,2 @@ | ||||
| #include "../../../arm64/boot/dts/qcom/qcom-ipq6018-meshpp-s618-cp03.dts" | ||||
| #include "qcom-ipq6018.dtsi" | ||||
| @@ -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-pax1800-v1.dts" | ||||
| #include "qcom-ipq6018.dtsi" | ||||
| @@ -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-pax1800-v2.dts" | ||||
| #include "qcom-ipq6018.dtsi" | ||||
| @@ -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-ax840.dts" | ||||
| #include "qcom-ipq6018.dtsi" | ||||
| @@ -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" | ||||
| @@ -32,6 +32,10 @@ | ||||
| 		serial1 = &blsp1_uart2; | ||||
| 		ethernet0 = "/soc/dp1"; | ||||
| 		ethernet1 = "/soc/dp2"; | ||||
| 	        led-boot = &led_sys; | ||||
| 		led-failsafe = &led_sys; | ||||
| 		led-running = &led_sys; | ||||
| 		led-upgrade = &led_sys; | ||||
| 	}; | ||||
|  | ||||
| 	chosen { | ||||
| @@ -708,32 +712,20 @@ | ||||
| 		pinctrl-0 = <&leds_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		led@1 { | ||||
| 		led_sys: led@1 { | ||||
| 			label = "sys:blue"; | ||||
| 			gpios = <&tlmm 1 GPIO_ACTIVE_HIGH>;  /* GPIO_1 */ | ||||
| 		/*	default-state="on"; */ | ||||
| 			linux,default-trigger = "timer"; | ||||
| 			active-delay = <700>; | ||||
| 			inactive-delay = <700>; | ||||
| 			default-state="on"; | ||||
| 		}; | ||||
| 		led@35 { | ||||
| 			label = "sys:green"; | ||||
| 			gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>;  /* GPIO_35 */ | ||||
| 			default-state="off"; | ||||
| 		/*	linux,default-trigger = "timer"; | ||||
| 			active-delay = <700>; | ||||
| 			inactive-delay = <700>; | ||||
| 			default-state="on";		*/ | ||||
| 		}; | ||||
| 		led@31 { | ||||
| 			label = "sys:red"; | ||||
| 			gpios = <&tlmm 31 GPIO_ACTIVE_HIGH>;  /* GPIO_31 */ | ||||
| 			default-state="off"; | ||||
| 		/*	linux,default-trigger = "timer"; | ||||
| 			active-delay = <700>; | ||||
| 			inactive-delay = <700>; | ||||
| 			default-state="on";		*/ | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|   | ||||
| @@ -0,0 +1,812 @@ | ||||
| /dts-v1/; | ||||
| /* Copyright (c) 2018-2020, 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-ipq5018.dtsi" | ||||
|  | ||||
| / { | ||||
| 	#address-cells = <0x2>; | ||||
| 	#size-cells = <0x2>; | ||||
| 	model = "Liteon WPX8324"; | ||||
| 	compatible = "liteon,wpx8324", "qcom,ipq5018-mp03.5-c1", "qcom,ipq5018"; | ||||
| 	interrupt-parent = <&intc>; | ||||
|  | ||||
| 	aliases { | ||||
| 		sdhc1 = &sdhc_1; /* SDC1 eMMC slot */ | ||||
| 		serial0 = &blsp1_uart1; | ||||
| 		/*serial1 = &blsp1_uart2;*/ | ||||
| 		ethernet0 = "/soc/dp1"; | ||||
| 		ethernet1 = "/soc/dp2"; | ||||
| 	}; | ||||
|  | ||||
| 	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 | ||||
| 		stdout-path = "serial0"; | ||||
| 	}; | ||||
|  | ||||
| 	reserved-memory { | ||||
| 	#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 	/*                   256 MB Profile | ||||
| 	 * +==========+==============+=========================+ | ||||
| 	 * |          |              |                         | | ||||
| 	 * |  Region  | Start Offset |          Size           | | ||||
| 	 * |          |              |                         | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    NSS   |  0x40000000  |           8MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   Linux  |  0x40800000  | Depends on total memory | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   uboot  |  0x4A600000  |           4MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    SBL   |  0x4AA00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   smem   |  0x4AB00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    TZ    |  0x4AC00000  |           4MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    Q6    |              |                         | | ||||
| 	 * |   code/  |  0x4B000000  |          20MB           | | ||||
| 	 * |   data   |              |                         | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |   data   |  0x4C400000  |          13MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |  M3 Dump |  0x4D100000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |   QDSS   |  0x4D200000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |   data   |  0x4D300000  |          15MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |  M3 Dump |  0x4E200000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |   QDSS   |  0x4E300000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |   data   |  0x4E400000  |          15MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |  M3 Dump |  0x4F300000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |   QDSS   |  0x4F400000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |                                                   | | ||||
| 	 * |            Rest of the memory for Linux           | | ||||
| 	 * |                                                   | | ||||
| 	 * +===================================================+ | ||||
| 	 */ | ||||
| 		q6_mem_regions: q6_mem_regions@4B000000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4B000000 0x0 0x4500000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_code_data: q6_code_data@4B000000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4B000000 0x0 0x1400000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_ipq5018_data: q6_ipq5018_data@4C400000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4C400000 0x0 0xD00000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump: m3_dump@4D100000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D100000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_etr_region: q6_etr_dump@4D200000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D200000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_data1: q6_qcn6122_data1@4D300000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D300000 0x0 0xF00000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E200000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E300000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_data2: q6_qcn6122_data2@4E400000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E400000 0x0 0xF00000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump_qcn6122_2: m3_dump_qcn6122_2@4F300000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4F300000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F400000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4F400000 0x0 0x100000>; | ||||
| 		}; | ||||
| 	#else | ||||
| 	/*                 512MB/1GB Profiles | ||||
| 	 * +==========+==============+=========================+ | ||||
| 	 * |          |              |                         | | ||||
| 	 * |  Region  | Start Offset |          Size           | | ||||
| 	 * |          |              |                         | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    NSS   |  0x40000000  |          16MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   Linux  |  0x41000000  | Depends on total memory | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   uboot  |  0x4A600000  |           4MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    SBL   |  0x4AA00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   smem   |  0x4AB00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    TZ    |  0x4AC00000  |           4MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    Q6    |              |                         | | ||||
| 	 * |   code/  |  0x4B000000  |          20MB           | | ||||
| 	 * |   data   |              |                         | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |   data   |  0x4C400000  |          14MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |  M3 Dump |  0x4D200000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |   QDSS   |  0x4D300000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |  Caldb   |  0x4D400000  |           2MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |   data   |  0x4D600000  |          16MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |  M3 Dump |  0x4E600000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |   QDSS   |  0x4E700000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |  Caldb   |  0x4E800000  |           5MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |   data   |  0x4ED00000  |          16MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |  M3 Dump |  0x4FD00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |   QDSS   |  0x4FE00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |  Caldb   |  0x4FF00000  |           5MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |                                                   | | ||||
| 	 * |            Rest of the memory for Linux           | | ||||
| 	 * |                                                   | | ||||
| 	 * +===================================================+ | ||||
| 	 */ | ||||
| 		q6_mem_regions: q6_mem_regions@4B000000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4B000000 0x0 0x5400000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_code_data: q6_code_data@4B000000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4B000000 0x0 01400000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_ipq5018_data: q6_ipq5018_data@4C400000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4C400000 0x0 0xE00000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump: m3_dump@4D200000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D200000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_etr_region: q6_etr_dump@4D300000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D300000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_caldb_region: q6_caldb_region@4D400000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D400000 0x0 0x200000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_data1: q6_qcn6122_data1@4D600000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D600000 0x0 0x1000000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E600000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E600000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E700000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E700000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E800000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E800000 0x0 0x500000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_data2: q6_qcn6122_data2@4E900000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4ED00000 0x0 0x1000000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump_qcn6122_2: m3_dump_qcn6122_2@4FD00000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4FD00000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_etr_2: q6_qcn6122_etr_2@4FE00000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4FE00000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_caldb_2: q6_qcn6122_caldb_2@4FF00000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4FF00000 0x0 0x500000>; | ||||
| 		}; | ||||
|  | ||||
| 	#endif | ||||
| 	}; | ||||
|  | ||||
| 	soc { | ||||
| 		serial@78af000 { | ||||
| 			status = "ok"; | ||||
| 		}; | ||||
| 		qpic_bam: dma@7984000{ | ||||
| 			status = "ok"; | ||||
| 		}; | ||||
|  | ||||
| 		nand: qpic-nand@79b0000 { | ||||
| 			pinctrl-0 = <&qspi_nand_pins>; | ||||
| 			pinctrl-names = "default"; | ||||
| 			status = "ok"; | ||||
| 		}; | ||||
|  | ||||
| 		spi_0: spi@78b5000 { /* BLSP1 QUP0 */ | ||||
| 			pinctrl-0 = <&blsp0_spi_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; | ||||
| 			}; | ||||
| 		}; | ||||
|  | ||||
| 		spi_2: spi@78b7000 { /* BLSP1 QUP2 */ | ||||
| 			pinctrl-0 = <&blsp2_spi0_pins>; | ||||
| 			pinctrl-names = "default"; | ||||
| 			cs-select = <0>; | ||||
| 			status = "ok"; | ||||
|  | ||||
| 			tpm0: slb9670@0 { | ||||
| 				#address-cells = <1>; | ||||
| 				#size-cells = <1>; | ||||
| 				reg = <1>;	/* CE1 */ | ||||
| 				compatible = "infineon,slb9670"; | ||||
| 				linux,modalias = "slb9670", "slb9670a11"; | ||||
| 				spi-max-frequency = <50000000>; | ||||
| 				use-default-sizes; | ||||
|  			}; | ||||
| 		}; | ||||
|  | ||||
| 		mdio0: mdio@88000 { | ||||
| 			status = "ok"; | ||||
|  | ||||
| 			ethernet-phy@0 { | ||||
| 				reg = <7>; | ||||
| 			}; | ||||
| 		}; | ||||
|  | ||||
| 		mdio1: mdio@90000 { | ||||
| 			status = "ok"; | ||||
| 			pinctrl-0 = <&mdio1_pins>; | ||||
| 			pinctrl-names = "default"; | ||||
| 			phy-reset-gpio = <&tlmm 26 0>; | ||||
|  | ||||
| 			ethernet-phy@0 { | ||||
| 				reg = <28>; | ||||
| 			}; | ||||
| 		}; | ||||
|  | ||||
| 		ess-instance { | ||||
| 			num_devices = <0x1>; | ||||
| 			ess-switch@0x39c00000 { | ||||
| 				switch_mac_mode = <0xf>; /* mac mode for uniphy instance*/ | ||||
| 				cmnblk_clk = "internal_96MHz"; /* cmnblk clk*/ | ||||
| 				qcom,port_phyinfo { | ||||
| 					port@0 { | ||||
| 						port_id = <1>; | ||||
| 						phy_address = <7>; | ||||
| 						mdiobus = <&mdio0>; | ||||
| 					}; | ||||
| 					port@1 { | ||||
| 						port_id = <2>; | ||||
| 						phy_address = <0x1c>; | ||||
| 						mdiobus = <&mdio1>; | ||||
| 						port_mac_sel = "QGMAC_PORT"; | ||||
| 					}; | ||||
| 				}; | ||||
| 				led_source@0 { | ||||
| 					source = <0>; | ||||
| 					mode = "normal"; | ||||
| 					speed = "all"; | ||||
| 					blink_en = "enable"; | ||||
| 					active = "high"; | ||||
| 				}; | ||||
| 			}; | ||||
| 		}; | ||||
| 		wifi0: wifi@c000000 { | ||||
| 			status = "ok"; | ||||
| 		}; | ||||
|  | ||||
| 		dp1 { | ||||
| 			device_type = "network"; | ||||
| 			compatible = "qcom,nss-dp"; | ||||
| 			clocks = <&gcc GCC_SNOC_GMAC0_AXI_CLK>; | ||||
| 			clock-names = "nss-snoc-gmac-axi-clk"; | ||||
| 			qcom,id = <1>; | ||||
| 			reg = <0x39C00000 0x10000>; | ||||
| 			interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>; | ||||
| 			qcom,mactype = <2>; | ||||
| 			qcom,link-poll = <1>; | ||||
| 			qcom,phy-mdio-addr = <7>; | ||||
| 			mdio-bus = <&mdio0>; | ||||
| 			local-mac-address = [000000000000]; | ||||
| 			phy-mode = "sgmii"; | ||||
| 		}; | ||||
|  | ||||
| 		dp2 { | ||||
| 			device_type = "network"; | ||||
| 			compatible = "qcom,nss-dp"; | ||||
| 			clocks = <&gcc GCC_SNOC_GMAC1_AXI_CLK>; | ||||
| 			clock-names = "nss-snoc-gmac-axi-clk"; | ||||
| 			qcom,id = <2>; | ||||
| 			reg = <0x39D00000 0x10000>; | ||||
| 			interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>; | ||||
| 			qcom,mactype = <2>; | ||||
| 			qcom,link-poll = <1>; | ||||
| 			qcom,phy-mdio-addr = <28>; | ||||
| 			mdio-bus = <&mdio1>; | ||||
| 			local-mac-address = [000000000000]; | ||||
| 			phy-mode = "sgmii"; | ||||
| 		}; | ||||
|  | ||||
| 		qcom,test@0 { | ||||
| 			status = "ok"; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	thermal-zones { | ||||
| 		status = "ok"; | ||||
| 	}; | ||||
| 	leds { | ||||
| 		compatible = "gpio-leds"; | ||||
| 		pinctrl-0 = <&leds_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		led_blue: led@19 { | ||||
| 			label = "blue:uplink"; | ||||
| 			gpios = <&tlmm 19 GPIO_ACTIVE_HIGH>; | ||||
| 			default-state = "on"; | ||||
| 		}; | ||||
| 		led_orange: led@18 { | ||||
| 			label = "orange:wifi2"; | ||||
| 			gpios = <&tlmm 18 GPIO_ACTIVE_HIGH>; | ||||
| 			default-state = "on"; | ||||
| 		}; | ||||
| 		led_green: led@39 { | ||||
| 			label = "green:wifi5"; | ||||
| 			gpios = <&tlmm 39 GPIO_ACTIVE_HIGH>; | ||||
| 			default-state = "on"; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &tlmm { | ||||
| 	pinctrl-0 = <&blsp0_uart_pins &phy_led_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
|  | ||||
| 	leds_pins: leds_pins { | ||||
| 		led_blue { | ||||
| 			pins = "gpio19"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		led_orange { | ||||
| 			pins = "gpio18"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		led_green { | ||||
| 			pins = "gpio39"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
| 	blsp0_uart_pins: uart_pins { | ||||
| 		blsp0_uart_rx_tx { | ||||
| 			pins = "gpio20", "gpio21"; | ||||
| 			function = "blsp0_uart0"; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	blsp0_spi_pins: blsp0_spi_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio10", "gpio11", "gpio12", "gpio13"; | ||||
| 			function = "blsp0_spi"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	blsp2_spi0_pins: blsp2_spi0_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio31", "gpio32", "gpio33", "gpio34"; | ||||
| 			function = "blsp2_spi0"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	qspi_nand_pins: qspi_nand_pins { | ||||
| 		qspi_clock { | ||||
| 			pins = "gpio9"; | ||||
| 			function = "qspi_clk"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 		qspi_cs { | ||||
| 			pins = "gpio8"; | ||||
| 			function = "qspi_cs"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 		qspi_data_0 { | ||||
| 			pins = "gpio7"; | ||||
| 			function = "qspi0"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 		qspi_data_1 { | ||||
| 			pins = "gpio6"; | ||||
| 			function = "qspi1"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 		qspi_data_2 { | ||||
| 			pins = "gpio5"; | ||||
| 			function = "qspi2"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 		qspi_data_3 { | ||||
| 			pins = "gpio4"; | ||||
| 			function = "qspi3"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	mdio1_pins: mdio_pinmux { | ||||
| 		mux_0 { | ||||
| 			pins = "gpio36"; | ||||
| 			function = "mdc"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
|  | ||||
| 		mux_1 { | ||||
| 			pins = "gpio37"; | ||||
| 			function = "mdio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	phy_led_pins: phy_led_pins { | ||||
| 		gephy_led_pin { | ||||
| 			pins = "gpio18", "gpio19", "gpio39"; | ||||
| 			/* function = "led0"; */ | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	i2c_pins: i2c_pins { | ||||
| 		i2c_scl { | ||||
| 			pins = "gpio25"; | ||||
| 			function = "blsp2_i2c1"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
|  | ||||
| 		i2c_sda { | ||||
| 			pins = "gpio26"; | ||||
| 			function = "blsp2_i2c1"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	button_pins: button_pins { | ||||
| 		wps_button { | ||||
| 			pins = "gpio29"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
| 	gpio_keys { | ||||
| 		compatible = "gpio-keys"; | ||||
| 		pinctrl-0 = <&button_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		button@1 { | ||||
| 			label = "wps"; | ||||
| 			linux,code = <KEY_WPS_BUTTON>; | ||||
| 			gpios = <&tlmm 29 GPIO_ACTIVE_LOW>; | ||||
| 			linux,input-type = <1>; | ||||
| 			debounce-interval = <60>; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &usb3 { | ||||
| 	status = "ok"; | ||||
| 	device-power-gpio = <&tlmm 28 0>; | ||||
| }; | ||||
|  | ||||
| &eud { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &pcie_x1 { | ||||
| 	status = "disabled"; | ||||
| 	perst-gpio = <&tlmm 18 1>; | ||||
| }; | ||||
|  | ||||
| &pcie_x2 { | ||||
| 	status = "disabled"; | ||||
| 	perst-gpio = <&tlmm 15 1>; | ||||
| }; | ||||
|  | ||||
| &dwc_0 { | ||||
| 	/delete-property/ #phy-cells; | ||||
| 	/delete-property/ phys; | ||||
| 	/delete-property/ phy-names; | ||||
| }; | ||||
|  | ||||
| &hs_m31phy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &pcie_x1phy { | ||||
| 	status = "disabled"; | ||||
| }; | ||||
|  | ||||
| &pcie_x2phy { | ||||
| 	status = "disabled"; | ||||
| }; | ||||
|  | ||||
| &pcie_x1_rp { | ||||
|         status = "disabled"; | ||||
|  | ||||
| 	mhi_0: qcom,mhi@0 { | ||||
| 		reg = <0 0 0 0 0 >; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &pcie_x2_rp { | ||||
|         status = "disabled"; | ||||
|  | ||||
| 	mhi_1: qcom,mhi@1 { | ||||
| 		reg = <0 0 0 0 0 >; | ||||
|  | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &qfprom { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &tsens { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qcom_q6v5_wcss { | ||||
| 	qcom,multipd_arch; | ||||
| 	memory-region = <&q6_mem_regions>; | ||||
| 	qcom,share_bootargs; | ||||
| 	qcom,bootargs_smem = <507>; | ||||
| 	boot-args = <0x1 0x4 0x3 0x0F 0x0 0x0>, | ||||
| 			<0x2 0x4 0x2 0x12 0x0 0x0>; | ||||
| 	/* IPQ5018 */ | ||||
| 	q6v5_wcss_userpd1 { | ||||
| 		m3_firmware = "IPQ5018/m3_fw.mdt"; | ||||
| 		interrupts-extended = <&wcss_smp2p_in 8 0>, | ||||
| 			<&wcss_smp2p_in 9 0>, | ||||
| 			<&wcss_smp2p_in 12 0>, | ||||
| 			<&wcss_smp2p_in 11 0>; | ||||
| 		interrupt-names ="fatal", | ||||
| 			"ready", | ||||
| 			"spawn_ack", | ||||
| 			"stop-ack"; | ||||
| 		qcom,smem-states = <&wcss_smp2p_out 8>, | ||||
| 			<&wcss_smp2p_out 9>, | ||||
| 			<&wcss_smp2p_out 10>; | ||||
| 		qcom,smem-state-names = "shutdown", | ||||
| 			"stop", | ||||
| 			"spawn"; | ||||
| 		qca,asid = <1>; | ||||
| 		qca,auto-restart; | ||||
| 		qca,int_radio; | ||||
| 		#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 		memory-region = <&q6_ipq5018_data>, <&m3_dump>, | ||||
| 				<&q6_etr_region>; | ||||
| 		#else | ||||
| 		memory-region = <&q6_ipq5018_data>, <&m3_dump>, | ||||
| 				<&q6_etr_region>, <&q6_caldb_region>; | ||||
| 		#endif | ||||
| 	}; | ||||
|  | ||||
| 	/* QCN6122 6G */ | ||||
| 	q6v5_wcss_userpd2 { | ||||
| 		m3_firmware = "qcn6122/m3_fw.mdt"; | ||||
| 		interrupts-extended = <&wcss_smp2p_in 16 0>, | ||||
| 			<&wcss_smp2p_in 17 0>, | ||||
| 			<&wcss_smp2p_in 20 0>, | ||||
| 			<&wcss_smp2p_in 19 0>; | ||||
| 		interrupt-names ="fatal", | ||||
| 			"ready", | ||||
| 			"spawn_ack", | ||||
| 			"stop-ack"; | ||||
| 		qcom,smem-states = <&wcss_smp2p_out 16>, | ||||
| 			<&wcss_smp2p_out 17>, | ||||
| 			<&wcss_smp2p_out 18>; | ||||
| 		qcom,smem-state-names = "shutdown", | ||||
| 			"stop", | ||||
| 			"spawn"; | ||||
| 		qca,asid = <2>; | ||||
| 		qca,auto-restart; | ||||
| 		#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 		memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>, | ||||
| 				<&q6_qcn6122_etr_1>; | ||||
| 		#else | ||||
| 		memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>, | ||||
| 				<&q6_qcn6122_etr_1>, <&q6_qcn6122_caldb_1>; | ||||
| 		#endif | ||||
| 	}; | ||||
|  | ||||
| 	/* QCN6122 5G */ | ||||
| 	q6v5_wcss_userpd3 { | ||||
| 		m3_firmware = "qcn6122/m3_fw.mdt"; | ||||
| 		interrupts-extended = <&wcss_smp2p_in 24 0>, | ||||
| 			<&wcss_smp2p_in 25 0>, | ||||
| 			<&wcss_smp2p_in 28 0>, | ||||
| 			<&wcss_smp2p_in 27 0>; | ||||
| 		interrupt-names ="fatal", | ||||
| 			"ready", | ||||
| 			"spawn_ack", | ||||
| 			"stop-ack"; | ||||
| 		qcom,smem-states = <&wcss_smp2p_out 24>, | ||||
| 			<&wcss_smp2p_out 25>, | ||||
| 			<&wcss_smp2p_out 26>; | ||||
| 		qcom,smem-state-names = "shutdown", | ||||
| 			"stop", | ||||
| 			"spawn"; | ||||
| 		qca,asid = <3>; | ||||
| 		qca,auto-restart; | ||||
| 		#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 		memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>, | ||||
| 				<&q6_qcn6122_etr_2>; | ||||
| 		#else | ||||
| 		memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>, | ||||
| 				<&q6_qcn6122_etr_2>, <&q6_qcn6122_caldb_2>; | ||||
| 		#endif | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &qgic_msi_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qgic_msi_1 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &wifi0 { | ||||
| 	/* IPQ5018 */ | ||||
| 	qcom,multipd_arch; | ||||
| 	qcom,userpd-subsys-name = "q6v5_wcss_userpd1"; | ||||
| #ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 	qcom,tgt-mem-mode = <2>; | ||||
| #else | ||||
| 	qcom,tgt-mem-mode = <1>; | ||||
| #endif | ||||
| 	qcom,board_id = <0x24>; | ||||
| 	qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0>; | ||||
| #ifdef __CNSS2__ | ||||
| 	qcom,caldb-addr = <0x4D400000 0x4D400000 0 0 0>; | ||||
| #else | ||||
| 	qcom,caldb-addr = <0x4D400000>; | ||||
| 	m3-dump-addr = <0x4D200000>; | ||||
| #endif | ||||
| 	qcom,caldb-size = <0x200000>; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &wifi1 { | ||||
| 	/* QCN6122 5G */ | ||||
| 	qcom,multipd_arch; | ||||
| 	qcom,userpd-subsys-name = "q6v5_wcss_userpd3"; | ||||
| #ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 	qcom,tgt-mem-mode = <2>; | ||||
| #else | ||||
| 	qcom,tgt-mem-mode = <1>; | ||||
| #endif | ||||
| 	qcom,board_id = <0x60>; | ||||
| 	qcom,bdf-addr = <0x4ED00000 0x4ED00000 0x4E400000 0x0 0x0>; | ||||
| #ifdef __CNSS2__ | ||||
| 	qcom,caldb-addr = <0x4FF00000 0x4FF00000 0 0 0>; | ||||
| #else | ||||
| 	qcom,caldb-addr = <0x4FF00000>; | ||||
| 	m3-dump-addr = <0x4FD00000>; | ||||
| #endif | ||||
| 	qcom,caldb-size = <0x500000>; | ||||
| 	status = "ok"; | ||||
| }; | ||||
| @@ -0,0 +1,891 @@ | ||||
| /dts-v1/; | ||||
| /* Copyright (c) 2018-2020, 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-ipq5018.dtsi" | ||||
|  | ||||
| / { | ||||
| 	#address-cells = <0x2>; | ||||
| 	#size-cells = <0x2>; | ||||
| 	model = "MUXI AP3220L"; | ||||
| 	compatible = "muxi,ap3220l", "qcom,ipq5018-mp03.5-c1", "qcom,ipq5018"; | ||||
| 	interrupt-parent = <&intc>; | ||||
|  | ||||
| 	aliases { | ||||
| 		serial0 = &blsp1_uart1; | ||||
| 		serial1 = &blsp1_uart2; | ||||
| 		ethernet0 = "/soc/dp1"; | ||||
| 		ethernet1 = "/soc/dp2"; | ||||
|  | ||||
| 		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 | ||||
| 		stdout-path = "serial0"; | ||||
| 	}; | ||||
|  | ||||
| 	reserved-memory { | ||||
| 	#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 	/*                   256 MB Profile | ||||
| 	 * +==========+==============+=========================+ | ||||
| 	 * |          |              |                         | | ||||
| 	 * |  Region  | Start Offset |          Size           | | ||||
| 	 * |          |              |                         | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    NSS   |  0x40000000  |           8MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   Linux  |  0x40800000  | Depends on total memory | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   uboot  |  0x4A600000  |           4MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    SBL   |  0x4AA00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   smem   |  0x4AB00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    TZ    |  0x4AC00000  |           4MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    Q6    |              |                         | | ||||
| 	 * |   code/  |  0x4B000000  |          20MB           | | ||||
| 	 * |   data   |              |                         | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |   data   |  0x4C400000  |          13MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |  M3 Dump |  0x4D100000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |   QDSS   |  0x4D200000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |   data   |  0x4D300000  |          15MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |  M3 Dump |  0x4E200000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |   QDSS   |  0x4E300000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |   data   |  0x4E400000  |          15MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |  M3 Dump |  0x4F300000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |   QDSS   |  0x4F400000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |                                                   | | ||||
| 	 * |            Rest of the memory for Linux           | | ||||
| 	 * |                                                   | | ||||
| 	 * +===================================================+ | ||||
| 	 */ | ||||
| 		q6_mem_regions: q6_mem_regions@4B000000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4B000000 0x0 0x4500000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_code_data: q6_code_data@4B000000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4B000000 0x0 0x1400000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_ipq5018_data: q6_ipq5018_data@4C400000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4C400000 0x0 0xD00000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump: m3_dump@4D100000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D100000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_etr_region: q6_etr_dump@4D200000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D200000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_data1: q6_qcn6122_data1@4D300000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D300000 0x0 0xF00000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E200000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E300000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_data2: q6_qcn6122_data2@4E400000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E400000 0x0 0xF00000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump_qcn6122_2: m3_dump_qcn6122_2@4F300000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4F300000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F400000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4F400000 0x0 0x100000>; | ||||
| 		}; | ||||
| 	#else | ||||
| 	/*                 512MB/1GB Profiles | ||||
| 	 * +==========+==============+=========================+ | ||||
| 	 * |          |              |                         | | ||||
| 	 * |  Region  | Start Offset |          Size           | | ||||
| 	 * |          |              |                         | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    NSS   |  0x40000000  |          16MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   Linux  |  0x41000000  | Depends on total memory | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   uboot  |  0x4A600000  |           4MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    SBL   |  0x4AA00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   smem   |  0x4AB00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    TZ    |  0x4AC00000  |           4MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    Q6    |              |                         | | ||||
| 	 * |   code/  |  0x4B000000  |          20MB           | | ||||
| 	 * |   data   |              |                         | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |   data   |  0x4C400000  |          14MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |  M3 Dump |  0x4D200000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |   QDSS   |  0x4D300000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |  Caldb   |  0x4D400000  |           2MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |   data   |  0x4D600000  |          16MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |  M3 Dump |  0x4E600000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |   QDSS   |  0x4E700000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |  Caldb   |  0x4E800000  |           5MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |   data   |  0x4ED00000  |          16MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |  M3 Dump |  0x4FD00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |   QDSS   |  0x4FE00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |  Caldb   |  0x4FF00000  |           5MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |                                                   | | ||||
| 	 * |            Rest of the memory for Linux           | | ||||
| 	 * |                                                   | | ||||
| 	 * +===================================================+ | ||||
| 	 */ | ||||
| 		q6_mem_regions: q6_mem_regions@4B000000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4B000000 0x0 0x5400000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_code_data: q6_code_data@4B000000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4B000000 0x0 01400000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_ipq5018_data: q6_ipq5018_data@4C400000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4C400000 0x0 0xE00000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump: m3_dump@4D200000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D200000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_etr_region: q6_etr_dump@4D300000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D300000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_caldb_region: q6_caldb_region@4D400000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D400000 0x0 0x200000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_data1: q6_qcn6122_data1@4D600000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D600000 0x0 0x1000000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E600000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E600000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E700000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E700000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E800000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E800000 0x0 0x500000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_data2: q6_qcn6122_data2@4E900000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4ED00000 0x0 0x1000000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump_qcn6122_2: m3_dump_qcn6122_2@4FD00000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4FD00000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_etr_2: q6_qcn6122_etr_2@4FE00000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4FE00000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_caldb_2: q6_qcn6122_caldb_2@4FF00000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4FF00000 0x0 0x500000>; | ||||
| 		}; | ||||
|  | ||||
| 	#endif | ||||
| 	}; | ||||
|  | ||||
| 	soc { | ||||
|  | ||||
| 		blsp1_uart1: serial@78af000 { | ||||
| 			pinctrl-0 = <&blsp0_uart_pins>; | ||||
| 			pinctrl-names = "default"; | ||||
| 			status = "okay"; | ||||
| 		}; | ||||
|  | ||||
| 		blsp1_uart2: serial@78b0000 { | ||||
| 			pinctrl-0 = <&blsp1_uart_pins>; | ||||
| 			pinctrl-names = "default"; | ||||
| 			status = "disabled"; | ||||
| 		}; | ||||
|  | ||||
| 		qpic_bam: dma@7984000{ | ||||
| 			status = "ok"; | ||||
| 		}; | ||||
|  | ||||
| 		nand: qpic-nand@79b0000 { | ||||
| 			pinctrl-0 = <&qspi_nand_pins>; | ||||
| 			pinctrl-names = "default"; | ||||
| 			status = "ok"; | ||||
| 		}; | ||||
|  | ||||
| 		spi_0: spi@78b5000 { /* BLSP1 QUP0 */ | ||||
| 			pinctrl-0 = <&blsp0_spi_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; | ||||
| 			}; | ||||
| 		}; | ||||
|  | ||||
| 		mdio0: mdio@88000 { | ||||
| 			status = "ok"; | ||||
|  | ||||
| 			ethernet-phy@0 { | ||||
| 				reg = <7>; | ||||
| 			}; | ||||
| 		}; | ||||
|  | ||||
| 		mdio1: mdio@90000 { | ||||
| 			status = "ok"; | ||||
| 			pinctrl-0 = <&mdio1_pins &phy_pins>; | ||||
| 			pinctrl-names = "default"; | ||||
| 			phy-reset-gpio = <&tlmm 39 0>; | ||||
|  | ||||
| 			ethernet-phy@0 { | ||||
| 				reg = <0>; | ||||
| 			}; | ||||
|  | ||||
| 			ethernet-phy@1 { | ||||
| 				reg = <1>; | ||||
| 			}; | ||||
|  | ||||
| 			ethernet-phy@2 { | ||||
| 				reg = <2>; | ||||
| 			}; | ||||
|  | ||||
| 			ethernet-phy@3 { | ||||
| 				reg = <3>; | ||||
| 			}; | ||||
| 		}; | ||||
|  | ||||
| 		ess-instance { | ||||
| 			num_devices = <0x2>; | ||||
| 			ess-switch@0x39c00000 { | ||||
| 				compatible = "qcom,ess-switch-ipq50xx"; | ||||
| 				device_id = <0>; | ||||
| 				switch_mac_mode = <0xf>; /* mac mode for uniphy instance*/ | ||||
| 				cmnblk_clk = "internal_96MHz"; /* cmnblk clk*/ | ||||
| 				qcom,port_phyinfo { | ||||
| 					port@0 { | ||||
| 						port_id = <1>; | ||||
| 						phy_address = <7>; | ||||
| 					}; | ||||
| 					port@1 { | ||||
| 						port_id = <2>; | ||||
| 						forced-speed = <1000>; | ||||
| 						forced-duplex = <1>; | ||||
| 					}; | ||||
| 				}; | ||||
| 				/* | ||||
| 				led_source@0 { | ||||
| 					source = <0>; | ||||
| 					mode = "normal"; | ||||
| 					speed = "all"; | ||||
| 					blink_en = "enable"; | ||||
| 					active = "high"; | ||||
| 				}; | ||||
| 				*/ | ||||
| 			}; | ||||
| 			ess-switch1@1 { | ||||
| 				compatible = "qcom,ess-switch-qca83xx"; | ||||
| 				device_id = <1>; | ||||
| 				switch_access_mode = "mdio"; | ||||
| 				mdio-bus = <&mdio1>; | ||||
| 				reset_gpio = <0x27>; | ||||
| 				switch_cpu_bmp = <0x40>;  /* cpu port bitmap */ | ||||
| 				switch_lan_bmp = <0x1e>; /* lan port bitmap */ | ||||
| 				switch_wan_bmp = <0x0>;  /* wan port bitmap */ | ||||
| 				qca,ar8327-initvals = < | ||||
| 						0x00004 0x7600000   /* PAD0_MODE */ | ||||
| 						0x00008 0x1000000   /* PAD5_MODE */ | ||||
| 						0x0000c 0x80        /* PAD6_MODE */ | ||||
| 						0x00010 0x2613a0    /* PORT6 FORCE MODE*/ | ||||
| 						0x000e4 0xaa545     /* MAC_POWER_SEL */ | ||||
| 						0x000e0 0xc74164de  /* SGMII_CTRL */ | ||||
| 						0x0007c 0x4e        /* PORT0_STATUS */ | ||||
| 						0x00094 0x4e        /* PORT6_STATUS */ | ||||
| 				>; | ||||
| 				qcom,port_phyinfo { | ||||
| 					port@0 { | ||||
| 						port_id = <1>; | ||||
| 						phy_address = <0>; | ||||
| 					}; | ||||
| 					port@1 { | ||||
| 						port_id = <2>; | ||||
| 						phy_address = <1>; | ||||
| 					}; | ||||
| 					port@2 { | ||||
| 						port_id = <3>; | ||||
| 						phy_address = <2>; | ||||
| 					}; | ||||
| 					port@3 { | ||||
| 						port_id = <4>; | ||||
| 						phy_address = <3>; | ||||
| 					}; | ||||
| 				}; | ||||
| 			}; | ||||
| 		}; | ||||
|  | ||||
| 		ess-uniphy@98000 { | ||||
| 			status = "disabled"; | ||||
| 		}; | ||||
|  | ||||
| 		dp1 { | ||||
| 			device_type = "network"; | ||||
| 			compatible = "qcom,nss-dp"; | ||||
| 			clocks = <&gcc GCC_SNOC_GMAC0_AXI_CLK>; | ||||
| 			clock-names = "nss-snoc-gmac-axi-clk"; | ||||
| 			qcom,id = <1>; | ||||
| 			reg = <0x39C00000 0x10000>; | ||||
| 			interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>; | ||||
| 			qcom,mactype = <2>; | ||||
| 			qcom,link-poll = <1>; | ||||
| 			qcom,phy-mdio-addr = <7>; | ||||
| 			mdio-bus = <&mdio0>; | ||||
| 			local-mac-address = [000000000000]; | ||||
| 			phy-mode = "sgmii"; | ||||
| 		}; | ||||
|  | ||||
| 		dp2 { | ||||
| 			device_type = "network"; | ||||
| 			compatible = "qcom,nss-dp"; | ||||
| 			clocks = <&gcc GCC_SNOC_GMAC1_AXI_CLK>; | ||||
| 			clock-names = "nss-snoc-gmac-axi-clk"; | ||||
| 			qcom,id = <2>; | ||||
| 			reg = <0x39D00000 0x10000>; | ||||
| 			interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>; | ||||
| 			qcom,mactype = <2>; | ||||
| 			qcom,link-poll = <1>; | ||||
| 			qcom,phy-mdio-addr = <3>; | ||||
| 			mdio-bus = <&mdio1>; | ||||
| 			local-mac-address = [000000000000]; | ||||
| 			phy-mode = "sgmii"; | ||||
| 		}; | ||||
|  | ||||
| 		qcom,test@0 { | ||||
| 			status = "ok"; | ||||
| 		}; | ||||
|  | ||||
| 	}; | ||||
|  | ||||
| 	thermal-zones { | ||||
| 		status = "ok"; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &tlmm { | ||||
| 	//pinctrl-0 = <&phy_led_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
|  | ||||
| 	blsp0_uart_pins: uart_pins { | ||||
| 		blsp0_uart_rx_tx { | ||||
| 			pins = "gpio20", "gpio21"; | ||||
| 			function = "blsp0_uart0"; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	blsp1_uart_pins: blsp1_uart_pins { | ||||
| 		blsp1_uart_rx_tx { | ||||
| 			pins = "gpio23", "gpio25"; | ||||
| 			function = "blsp1_uart2"; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	blsp0_spi_pins: blsp0_spi_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio10", "gpio11", "gpio12", "gpio13"; | ||||
| 			function = "blsp0_spi"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	qspi_nand_pins: qspi_nand_pins { | ||||
| 		qspi_clock { | ||||
| 				pins = "gpio9"; | ||||
| 				function = "qspi_clk"; | ||||
| 				drive-strength = <8>; | ||||
| 				bias-disable; | ||||
| 			}; | ||||
| 		qspi_cs { | ||||
| 				pins = "gpio8"; | ||||
| 				function = "qspi_cs"; | ||||
| 				drive-strength = <8>; | ||||
| 				bias-disable; | ||||
| 			}; | ||||
| 		qspi_data_0 { | ||||
| 				pins = "gpio7"; | ||||
| 				function = "qspi0"; | ||||
| 				drive-strength = <8>; | ||||
| 				bias-disable; | ||||
| 			}; | ||||
| 		qspi_data_1 { | ||||
| 				pins = "gpio6"; | ||||
| 				function = "qspi1"; | ||||
| 				drive-strength = <8>; | ||||
| 				bias-disable; | ||||
| 			}; | ||||
| 		qspi_data_2 { | ||||
| 				pins = "gpio5"; | ||||
| 				function = "qspi2"; | ||||
| 				drive-strength = <8>; | ||||
| 				bias-disable; | ||||
| 			}; | ||||
| 		qspi_data_3 { | ||||
| 				pins = "gpio4"; | ||||
| 				function = "qspi3"; | ||||
| 				drive-strength = <8>; | ||||
| 				bias-disable; | ||||
| 			}; | ||||
| 	}; | ||||
|  | ||||
| 	phy_pins: phy_pins { | ||||
| 		phy_intr { | ||||
| 			pins = "gpio29"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 		phy_reset { | ||||
| 			pins = "gpio39"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 			output-low; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	mdio1_pins: mdio_pinmux { | ||||
| 		mux_0 { | ||||
| 			pins = "gpio36"; | ||||
| 			function = "mdc"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
|  | ||||
| 		mux_1 { | ||||
| 			pins = "gpio37"; | ||||
| 			function = "mdio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	phy_led_pins: phy_led_pins { | ||||
| 		gephy_led_pin { | ||||
| 			//pins = "gpio46"; | ||||
| 			function = "led0"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	button_pins: button_pins { | ||||
| 		reset_button { | ||||
| 			pins = "gpio32"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	led_pins: led_pins { | ||||
| 		led_pwr { | ||||
| 			pins = "gpio26"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		led_2g { | ||||
| 			pins = "gpio31"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		led_5g { | ||||
| 			pins = "gpio33"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
| 	gpio_keys { | ||||
| 		compatible = "gpio-keys"; | ||||
| 		pinctrl-0 = <&button_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		button@1 { | ||||
| 			label = "reset_button"; | ||||
| 			linux,code = <KEY_RESTART>; | ||||
| 			gpios = <&tlmm 32 GPIO_ACTIVE_LOW>; | ||||
| 			linux,input-type = <1>; | ||||
| 			debounce-interval = <60>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	leds { | ||||
| 		compatible = "gpio-leds"; | ||||
| 		pinctrl-0 = <&led_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 			led_power: led_pwr { | ||||
| 				label = "green:led_pwr"; | ||||
| 				gpios = <&tlmm 26 GPIO_ACTIVE_HIGH>; | ||||
| 				default-state = "on"; | ||||
| 				linux,default-trigger = "led_pwr"; | ||||
| 			}; | ||||
|  | ||||
| 			led_2g { | ||||
| 				label = "green:wifi2"; | ||||
| 				gpio = <&tlmm 33 GPIO_ACTIVE_HIGH>; | ||||
| 				default-state = "off"; | ||||
| 			}; | ||||
|  | ||||
| 			led_5g { | ||||
| 				label = "green:wifi5"; | ||||
| 				gpio = <&tlmm 31 GPIO_ACTIVE_HIGH>; | ||||
| 				default-state = "off"; | ||||
| 			}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &usb3 { | ||||
| 	status = "ok"; | ||||
| 	device-power-gpio = <&tlmm 30 1>; | ||||
| }; | ||||
|  | ||||
| &eud { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &pcie_x1 { | ||||
| 	status = "disabled"; | ||||
| 	perst-gpio = <&tlmm 18 1>; | ||||
| }; | ||||
|  | ||||
| &pcie_x2 { | ||||
| 	status = "disabled"; | ||||
| 	perst-gpio = <&tlmm 15 1>; | ||||
| }; | ||||
|  | ||||
| &dwc_0 { | ||||
| 	/delete-property/ #phy-cells; | ||||
| 	/delete-property/ phys; | ||||
| 	/delete-property/ phy-names; | ||||
| }; | ||||
|  | ||||
| &hs_m31phy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &pcie_x1phy { | ||||
| 	status = "disabled"; | ||||
| }; | ||||
|  | ||||
| &pcie_x2phy { | ||||
| 	status = "disabled"; | ||||
| }; | ||||
|  | ||||
| &pcie_x1_rp { | ||||
|         status = "disabled"; | ||||
|  | ||||
| 	mhi_0: qcom,mhi@0 { | ||||
| 		reg = <0 0 0 0 0 >; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &pcie_x2_rp { | ||||
|         status = "disabled"; | ||||
|  | ||||
| 	mhi_1: qcom,mhi@1 { | ||||
| 		reg = <0 0 0 0 0 >; | ||||
|  | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &qfprom { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &tsens { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qcom_q6v5_wcss { | ||||
| 	qcom,multipd_arch; | ||||
| 	memory-region = <&q6_mem_regions>; | ||||
| 	qcom,share_bootargs; | ||||
| 	qcom,bootargs_smem = <507>; | ||||
| 	boot-args = <0x2 0x4 0x2 0xF 0x0 0x0>; | ||||
|  | ||||
| 	/* IPQ5018 */ | ||||
| 	q6v5_wcss_userpd1 { | ||||
| 		m3_firmware = "IPQ5018/m3_fw.mdt"; | ||||
| 		interrupts-extended = <&wcss_smp2p_in 8 0>, | ||||
| 			<&wcss_smp2p_in 9 0>, | ||||
| 			<&wcss_smp2p_in 12 0>, | ||||
| 			<&wcss_smp2p_in 11 0>; | ||||
| 		interrupt-names ="fatal", | ||||
| 			"ready", | ||||
| 			"spawn_ack", | ||||
| 			"stop-ack"; | ||||
| 		qcom,smem-states = <&wcss_smp2p_out 8>, | ||||
| 			<&wcss_smp2p_out 9>, | ||||
| 			<&wcss_smp2p_out 10>; | ||||
| 		qcom,smem-state-names = "shutdown", | ||||
| 			"stop", | ||||
| 			"spawn"; | ||||
| 		qca,asid = <1>; | ||||
| 		qca,auto-restart; | ||||
| 		qca,int_radio; | ||||
| 		#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 		memory-region = <&q6_ipq5018_data>, <&m3_dump>, | ||||
| 				<&q6_etr_region>; | ||||
| 		#else | ||||
| 		memory-region = <&q6_ipq5018_data>, <&m3_dump>, | ||||
| 				<&q6_etr_region>, <&q6_caldb_region>; | ||||
| 		#endif | ||||
| 	}; | ||||
|  | ||||
| 	/* QCN6122 6G */ | ||||
| 	q6v5_wcss_userpd2 { | ||||
| 		m3_firmware = "qcn6122/m3_fw.mdt"; | ||||
| 		interrupts-extended = <&wcss_smp2p_in 16 0>, | ||||
| 			<&wcss_smp2p_in 17 0>, | ||||
| 			<&wcss_smp2p_in 20 0>, | ||||
| 			<&wcss_smp2p_in 19 0>; | ||||
| 		interrupt-names ="fatal", | ||||
| 			"ready", | ||||
| 			"spawn_ack", | ||||
| 			"stop-ack"; | ||||
| 		qcom,smem-states = <&wcss_smp2p_out 16>, | ||||
| 			<&wcss_smp2p_out 17>, | ||||
| 			<&wcss_smp2p_out 18>; | ||||
| 		qcom,smem-state-names = "shutdown", | ||||
| 			"stop", | ||||
| 			"spawn"; | ||||
| 		qca,asid = <2>; | ||||
| 		qca,auto-restart; | ||||
| 		#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 		memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>, | ||||
| 				<&q6_qcn6122_etr_1>; | ||||
| 		#else | ||||
| 		memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>, | ||||
| 				<&q6_qcn6122_etr_1>, <&q6_qcn6122_caldb_1>; | ||||
| 		#endif | ||||
| 	}; | ||||
|  | ||||
| 	/* QCN6122 5G */ | ||||
| 	q6v5_wcss_userpd3 { | ||||
| 		m3_firmware = "qcn6122/m3_fw.mdt"; | ||||
| 		interrupts-extended = <&wcss_smp2p_in 24 0>, | ||||
| 			<&wcss_smp2p_in 25 0>, | ||||
| 			<&wcss_smp2p_in 28 0>, | ||||
| 			<&wcss_smp2p_in 27 0>; | ||||
| 		interrupt-names ="fatal", | ||||
| 			"ready", | ||||
| 			"spawn_ack", | ||||
| 			"stop-ack"; | ||||
| 		qcom,smem-states = <&wcss_smp2p_out 24>, | ||||
| 			<&wcss_smp2p_out 25>, | ||||
| 			<&wcss_smp2p_out 26>; | ||||
| 		qcom,smem-state-names = "shutdown", | ||||
| 			"stop", | ||||
| 			"spawn"; | ||||
| 		qca,asid = <3>; | ||||
| 		qca,auto-restart; | ||||
| 		#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 		memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>, | ||||
| 				<&q6_qcn6122_etr_2>; | ||||
| 		#else | ||||
| 		memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>, | ||||
| 				<&q6_qcn6122_etr_2>, <&q6_qcn6122_caldb_2>; | ||||
| 		#endif | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &qgic_msi_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qgic_msi_1 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &wifi0 { | ||||
| 	/* IPQ5018 */ | ||||
| 	qcom,multipd_arch; | ||||
| 	qcom,userpd-subsys-name = "q6v5_wcss_userpd1"; | ||||
| #ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 	qcom,tgt-mem-mode = <2>; | ||||
| #else | ||||
| 	qcom,tgt-mem-mode = <1>; | ||||
| #endif | ||||
| 	qcom,board_id = <0x24>; | ||||
| 	qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0>; | ||||
| #ifdef __CNSS2__ | ||||
| 	qcom,caldb-addr = <0x4D400000 0x4D400000 0 0 0>; | ||||
| #else | ||||
| 	qcom,caldb-addr = <0x4D400000>; | ||||
| 	m3-dump-addr = <0x4D200000>; | ||||
| #endif | ||||
| 	qcom,caldb-size = <0x200000>; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &wifi1 { | ||||
| 	/* QCN6122 6G */ | ||||
| 	qcom,multipd_arch; | ||||
| 	qcom,userpd-subsys-name = "q6v5_wcss_userpd2"; | ||||
| #ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 	qcom,tgt-mem-mode = <2>; | ||||
| #else | ||||
| 	qcom,tgt-mem-mode = <1>; | ||||
| #endif | ||||
| 	qcom,board_id = <0x60>; | ||||
| 	qcom,bdf-addr = <0x4D600000 0x4D600000 0x4D300000 0x0 0x0>; | ||||
| #ifdef __CNSS2__ | ||||
| 	qcom,caldb-addr = <0x4E800000 0x4E800000 0 0 0>; | ||||
| #else | ||||
| 	qcom,caldb-addr = <0x4E800000>; | ||||
| 	m3-dump-addr = <0x4E600000>; | ||||
| #endif | ||||
| 	qcom,caldb-size = <0x500000>; | ||||
| 	status = "disabled"; | ||||
| }; | ||||
|  | ||||
| &wifi2 { | ||||
| 	/* QCN6122 5G */ | ||||
| 	qcom,multipd_arch; | ||||
| 	qcom,userpd-subsys-name = "q6v5_wcss_userpd3"; | ||||
| #ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 	qcom,tgt-mem-mode = <2>; | ||||
| #else | ||||
| 	qcom,tgt-mem-mode = <1>; | ||||
| #endif | ||||
| 	qcom,board_id = <0x60>; | ||||
| 	qcom,bdf-addr = <0x4ED00000 0x4ED00000 0x4E400000 0x0 0x0>; | ||||
| #ifdef __CNSS2__ | ||||
| 	qcom,caldb-addr = <0x4FF00000 0x4FF00000 0 0 0>; | ||||
| #else | ||||
| 	qcom,caldb-addr = <0x4FF00000>; | ||||
| 	m3-dump-addr = <0x4FD00000>; | ||||
| #endif | ||||
| 	qcom,caldb-size = <0x500000>; | ||||
| 	status = "ok"; | ||||
| }; | ||||
							
								
								
									
										886
									
								
								feeds/ipq807x/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq5018-q14.dts
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										886
									
								
								feeds/ipq807x/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq5018-q14.dts
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,886 @@ | ||||
| /dts-v1/; | ||||
| /* Copyright (c) 2018-2020, 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-ipq5018.dtsi" | ||||
|  | ||||
| / { | ||||
| 	#address-cells = <0x2>; | ||||
| 	#size-cells = <0x2>; | ||||
| 	model = "Motorola Q14"; | ||||
| 	compatible = "motorola,q14", "qcom,ipq5018-mp03.5-c1", "qcom,ipq5018"; | ||||
| 	interrupt-parent = <&intc>; | ||||
|  | ||||
| 	aliases { | ||||
| 		sdhc1 = &sdhc_1; /* SDC1 eMMC slot */ | ||||
| 		serial0 = &blsp1_uart1; | ||||
| 		serial1 = &blsp1_uart2; | ||||
| 		ethernet0 = "/soc/dp1"; | ||||
| 		ethernet1 = "/soc/dp2"; | ||||
| 	}; | ||||
|  | ||||
| 	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 | ||||
| 		stdout-path = "serial0"; | ||||
| 	}; | ||||
|  | ||||
| 	reserved-memory { | ||||
| 	#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 	/*                   256 MB Profile | ||||
| 	 * +==========+==============+=========================+ | ||||
| 	 * |          |              |                         | | ||||
| 	 * |  Region  | Start Offset |          Size           | | ||||
| 	 * |          |              |                         | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    NSS   |  0x40000000  |           8MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   Linux  |  0x40800000  | Depends on total memory | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   uboot  |  0x4A600000  |           4MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    SBL   |  0x4AA00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   smem   |  0x4AB00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    TZ    |  0x4AC00000  |           4MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    Q6    |              |                         | | ||||
| 	 * |   code/  |  0x4B000000  |          20MB           | | ||||
| 	 * |   data   |              |                         | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |   data   |  0x4C400000  |          13MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |  M3 Dump |  0x4D100000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |   QDSS   |  0x4D200000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |   data   |  0x4D300000  |          15MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |  M3 Dump |  0x4E200000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |   QDSS   |  0x4E300000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |   data   |  0x4E400000  |          15MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |  M3 Dump |  0x4F300000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |   QDSS   |  0x4F400000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |                                                   | | ||||
| 	 * |            Rest of the memory for Linux           | | ||||
| 	 * |                                                   | | ||||
| 	 * +===================================================+ | ||||
| 	 */ | ||||
| 		q6_mem_regions: q6_mem_regions@4B000000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4B000000 0x0 0x4500000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_code_data: q6_code_data@4B000000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4B000000 0x0 0x1400000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_ipq5018_data: q6_ipq5018_data@4C400000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4C400000 0x0 0xD00000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump: m3_dump@4D100000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D100000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_etr_region: q6_etr_dump@4D200000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D200000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_data1: q6_qcn6122_data1@4D300000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D300000 0x0 0xF00000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E200000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E300000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_data2: q6_qcn6122_data2@4E400000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E400000 0x0 0xF00000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump_qcn6122_2: m3_dump_qcn6122_2@4F300000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4F300000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F400000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4F400000 0x0 0x100000>; | ||||
| 		}; | ||||
| 	#else | ||||
| 	/*                 512MB/1GB Profiles | ||||
| 	 * +==========+==============+=========================+ | ||||
| 	 * |          |              |                         | | ||||
| 	 * |  Region  | Start Offset |          Size           | | ||||
| 	 * |          |              |                         | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    NSS   |  0x40000000  |          16MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   Linux  |  0x41000000  | Depends on total memory | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   uboot  |  0x4A600000  |           4MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    SBL   |  0x4AA00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |   smem   |  0x4AB00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    TZ    |  0x4AC00000  |           4MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |    Q6    |              |                         | | ||||
| 	 * |   code/  |  0x4B000000  |          20MB           | | ||||
| 	 * |   data   |              |                         | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |   data   |  0x4C400000  |          14MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |  M3 Dump |  0x4D200000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |   QDSS   |  0x4D300000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |  IPQ5018 |              |                         | | ||||
| 	 * |  Caldb   |  0x4D400000  |           2MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |   data   |  0x4D600000  |          16MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |  M3 Dump |  0x4E600000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |   QDSS   |  0x4E700000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_1|              |                         | | ||||
| 	 * |  Caldb   |  0x4E800000  |           5MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |   data   |  0x4ED00000  |          16MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |  M3 Dump |  0x4FD00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |   QDSS   |  0x4FE00000  |           1MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * | QCN6122_2|              |                         | | ||||
| 	 * |  Caldb   |  0x4FF00000  |           5MB           | | ||||
| 	 * +----------+--------------+-------------------------+ | ||||
| 	 * |                                                   | | ||||
| 	 * |            Rest of the memory for Linux           | | ||||
| 	 * |                                                   | | ||||
| 	 * +===================================================+ | ||||
| 	 */ | ||||
| 		q6_mem_regions: q6_mem_regions@4B000000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4B000000 0x0 0x5400000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_code_data: q6_code_data@4B000000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4B000000 0x0 01400000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_ipq5018_data: q6_ipq5018_data@4C400000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4C400000 0x0 0xE00000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump: m3_dump@4D200000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D200000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_etr_region: q6_etr_dump@4D300000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D300000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_caldb_region: q6_caldb_region@4D400000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D400000 0x0 0x200000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_data1: q6_qcn6122_data1@4D600000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4D600000 0x0 0x1000000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E600000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E600000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E700000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E700000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E800000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4E800000 0x0 0x500000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_data2: q6_qcn6122_data2@4E900000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4ED00000 0x0 0x1000000>; | ||||
| 		}; | ||||
|  | ||||
| 		m3_dump_qcn6122_2: m3_dump_qcn6122_2@4FD00000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4FD00000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_etr_2: q6_qcn6122_etr_2@4FE00000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4FE00000 0x0 0x100000>; | ||||
| 		}; | ||||
|  | ||||
| 		q6_qcn6122_caldb_2: q6_qcn6122_caldb_2@4FF00000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x4FF00000 0x0 0x500000>; | ||||
| 		}; | ||||
|  | ||||
| 	#endif | ||||
| 	}; | ||||
|  | ||||
| 	soc { | ||||
| 		serial@78af000 { | ||||
| 			status = "ok"; | ||||
| 		}; | ||||
|  | ||||
| 		blsp1_uart2: serial@78b0000 { | ||||
| 			pinctrl-0 = <&blsp1_uart_pins>; | ||||
| 			pinctrl-names = "default"; | ||||
| 		}; | ||||
|  | ||||
| 		qpic_bam: dma@7984000{ | ||||
| 			status = "ok"; | ||||
| 		}; | ||||
|  | ||||
| 		nand: qpic-nand@79b0000 { | ||||
| 			status = "disabled"; | ||||
| 		}; | ||||
|  | ||||
| 		spi_0: spi@78b5000 { /* BLSP1 QUP0 */ | ||||
| 			pinctrl-0 = <&blsp0_spi_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; | ||||
| 			}; | ||||
| 		}; | ||||
|  | ||||
| 		mdio0: mdio@88000 { | ||||
| 			status = "ok"; | ||||
|  | ||||
| 			ethernet-phy@0 { | ||||
| 				reg = <7>; | ||||
| 			}; | ||||
| 		}; | ||||
|  | ||||
| 		mdio1: mdio@90000 { | ||||
| 			status = "ok"; | ||||
| 			pinctrl-0 = <&mdio1_pins>; | ||||
| 			pinctrl-names = "default"; | ||||
| 			phy-reset-gpio = <&tlmm 39 0>; | ||||
|  | ||||
| 			ethernet-phy@0 { | ||||
| 				reg = <28>; | ||||
| 			}; | ||||
| 		}; | ||||
|  | ||||
| 		ess-instance { | ||||
| 			num_devices = <0x1>; | ||||
| 			ess-switch@0x39c00000 { | ||||
| 				switch_mac_mode = <0xf>; /* mac mode for uniphy instance*/ | ||||
| 				cmnblk_clk = "internal_96MHz"; /* cmnblk clk*/ | ||||
| 				qcom,port_phyinfo { | ||||
| 					port@0 { | ||||
| 						port_id = <1>; | ||||
| 						phy_address = <7>; | ||||
| 						mdiobus = <&mdio0>; | ||||
| 					}; | ||||
| 					port@1 { | ||||
| 						port_id = <2>; | ||||
| 						phy_address = <0x1c>; | ||||
| 						mdiobus = <&mdio1>; | ||||
| 						port_mac_sel = "QGMAC_PORT"; | ||||
| 					}; | ||||
| 				}; | ||||
| 				led_source@0 { | ||||
| 					source = <0>; | ||||
| 					mode = "normal"; | ||||
| 					speed = "all"; | ||||
| 					blink_en = "enable"; | ||||
| 					active = "high"; | ||||
| 				}; | ||||
| 			}; | ||||
| 		}; | ||||
|  | ||||
| 		dp1 { | ||||
| 			device_type = "network"; | ||||
| 			compatible = "qcom,nss-dp"; | ||||
| 			clocks = <&gcc GCC_SNOC_GMAC0_AXI_CLK>; | ||||
| 			clock-names = "nss-snoc-gmac-axi-clk"; | ||||
| 			qcom,id = <1>; | ||||
| 			reg = <0x39C00000 0x10000>; | ||||
| 			interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>; | ||||
| 			qcom,mactype = <2>; | ||||
| 			qcom,link-poll = <1>; | ||||
| 			qcom,phy-mdio-addr = <7>; | ||||
| 			mdio-bus = <&mdio0>; | ||||
| 			local-mac-address = [000000000000]; | ||||
| 			phy-mode = "sgmii"; | ||||
| 		}; | ||||
|  | ||||
| 		dp2 { | ||||
| 			device_type = "network"; | ||||
| 			compatible = "qcom,nss-dp"; | ||||
| 			clocks = <&gcc GCC_SNOC_GMAC1_AXI_CLK>; | ||||
| 			clock-names = "nss-snoc-gmac-axi-clk"; | ||||
| 			qcom,id = <2>; | ||||
| 			reg = <0x39D00000 0x10000>; | ||||
| 			interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>; | ||||
| 			qcom,mactype = <2>; | ||||
| 			qcom,link-poll = <1>; | ||||
| 			qcom,phy-mdio-addr = <28>; | ||||
| 			mdio-bus = <&mdio1>; | ||||
| 			local-mac-address = [000000000000]; | ||||
| 			phy-mode = "sgmii"; | ||||
| 		}; | ||||
|  | ||||
| 		qcom,test@0 { | ||||
| 			status = "ok"; | ||||
| 		}; | ||||
|  | ||||
| 		nss-macsec1 { | ||||
| 			compatible = "qcom,nss-macsec"; | ||||
| 			phy_addr = <0x1c>; | ||||
| 			mdiobus = <&mdio1>; | ||||
| 		}; | ||||
|  | ||||
| 		lpass: lpass@0xA000000{ | ||||
| 			status = "disabled"; | ||||
| 		}; | ||||
|  | ||||
| 		pcm: pcm@0xA3C0000{ | ||||
| 			pinctrl-0 = <&audio_pins>; | ||||
| 			pinctrl-names = "default"; | ||||
| 			status = "disabled"; | ||||
| 		}; | ||||
|  | ||||
| 		pcm_lb: pcm_lb@0 { | ||||
| 			status = "disabled"; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	thermal-zones { | ||||
| 		status = "ok"; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &sdhc_1 { | ||||
| 	pinctrl-0 = <&emmc_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	qcom,clk-rates = <400000 25000000 50000000 100000000 \ | ||||
| 			 192000000 384000000>; | ||||
| 	qcom,bus-speed-mode = "HS200_1p8v", "DDR_1p8v"; | ||||
| 	qcom,nonremovable; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &tlmm { | ||||
| 	pinctrl-0 = <&blsp0_uart_pins &phy_led_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
|  | ||||
| 	blsp0_uart_pins: uart_pins { | ||||
| 		blsp0_uart_rx_tx { | ||||
| 			pins = "gpio20", "gpio21"; | ||||
| 			function = "blsp0_uart0"; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	blsp1_uart_pins: blsp1_uart_pins { | ||||
| 		blsp1_uart_rx_tx { | ||||
| 			pins = "gpio23", "gpio25", "gpio24", "gpio26"; | ||||
| 			function = "blsp1_uart2"; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	blsp0_spi_pins: blsp0_spi_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio10", "gpio11", "gpio12", "gpio13"; | ||||
| 			function = "blsp0_spi"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	emmc_pins: emmc_pins { | ||||
| 		emmc_clk { | ||||
| 				pins = "gpio9"; | ||||
| 				function = "sdc1_clk"; | ||||
| 				drive-strength = <8>; | ||||
| 				bias-disable; | ||||
| 			}; | ||||
| 		emmc_cmd { | ||||
| 				pins = "gpio8"; | ||||
| 				function = "sdc1_cmd"; | ||||
| 				drive-strength = <8>; | ||||
| 				bias-pull-up; | ||||
| 			}; | ||||
| 		emmc_data_0 { | ||||
| 				pins = "gpio7"; | ||||
| 				function = "sdc10"; | ||||
| 				drive-strength = <8>; | ||||
| 				bias-disable; | ||||
| 			}; | ||||
| 		emmc_data_1 { | ||||
| 				pins = "gpio6"; | ||||
| 				function = "sdc11"; | ||||
| 				drive-strength = <8>; | ||||
| 				bias-disable; | ||||
| 			}; | ||||
| 		emmc_data_2 { | ||||
| 				pins = "gpio5"; | ||||
| 				function = "sdc12"; | ||||
| 				drive-strength = <8>; | ||||
| 				bias-disable; | ||||
| 			}; | ||||
| 		emmc_data_3 { | ||||
| 				pins = "gpio4"; | ||||
| 				function = "sdc13"; | ||||
| 				drive-strength = <8>; | ||||
| 				bias-disable; | ||||
| 			}; | ||||
| 	}; | ||||
|  | ||||
| 	mdio1_pins: mdio_pinmux { | ||||
| 		mux_0 { | ||||
| 			pins = "gpio36"; | ||||
| 			function = "mdc"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
|  | ||||
| 		mux_1 { | ||||
| 			pins = "gpio37"; | ||||
| 			function = "mdio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	phy_led_pins: phy_led_pins { | ||||
| 		gephy_led_pin { | ||||
| 			pins = "gpio46"; | ||||
| 			function = "led0"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	i2c_pins: i2c_pins { | ||||
| 		i2c_scl { | ||||
| 			pins = "gpio25"; | ||||
| 			function = "blsp2_i2c1"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
|  | ||||
| 		i2c_sda { | ||||
| 			pins = "gpio26"; | ||||
| 			function = "blsp2_i2c1"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	button_pins: button_pins { | ||||
| 		wps_button { | ||||
| 			pins = "gpio38"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 		 | ||||
| 		reset_button { | ||||
| 			pins = "gpio31"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		};		 | ||||
| 		 | ||||
| 	}; | ||||
|  | ||||
| 	audio_pins: audio_pinmux { | ||||
| 		mux_1 { | ||||
| 			pins = "gpio24"; | ||||
| 			function = "audio_rxbclk"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		mux_2 { | ||||
| 			pins = "gpio25"; | ||||
| 			function = "audio_rxfsync"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		mux_3 { | ||||
| 			pins = "gpio26"; | ||||
| 			function = "audio_rxd"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		mux_4 { | ||||
| 			pins = "gpio27"; | ||||
| 			function = "audio_txmclk"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		mux_5 { | ||||
| 			pins = "gpio28"; | ||||
| 			function = "audio_txbclk"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		mux_6 { | ||||
| 			pins = "gpio29"; | ||||
| 			function = "audio_txfsync"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		mux_7 { | ||||
| 			pins = "gpio30"; | ||||
| 			function = "audio_txd"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
| 	gpio_keys { | ||||
| 		compatible = "gpio-keys"; | ||||
| 		pinctrl-0 = <&button_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		button@1 { | ||||
| 			label = "wps"; | ||||
| 			linux,code = <KEY_WPS_BUTTON>; | ||||
| 			gpios = <&tlmm 38 GPIO_ACTIVE_LOW>; | ||||
| 			linux,input-type = <1>; | ||||
| 			debounce-interval = <60>; | ||||
| 		}; | ||||
| 		 | ||||
| 		button@2 { | ||||
| 			label = "reset"; | ||||
| 			linux,code = <KEY_RESTART>; | ||||
| 			gpios = <&tlmm 31 GPIO_ACTIVE_LOW>; | ||||
| 			linux,input-type = <1>; | ||||
| 			debounce-interval = <60>; | ||||
| 		};			 | ||||
| 		 | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &usb3 { | ||||
| 	status = "ok"; | ||||
| 	device-power-gpio = <&tlmm 24 1>; | ||||
| }; | ||||
|  | ||||
| &eud { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &pcie_x1 { | ||||
| 	status = "ok"; | ||||
| 	perst-gpio = <&tlmm 18 1>; | ||||
| }; | ||||
|  | ||||
| &pcie_x2 { | ||||
| 	status = "ok"; | ||||
| 	perst-gpio = <&tlmm 15 1>; | ||||
| }; | ||||
|  | ||||
| &dwc_0 { | ||||
| 	/delete-property/ #phy-cells; | ||||
| 	/delete-property/ phys; | ||||
| 	/delete-property/ phy-names; | ||||
| }; | ||||
|  | ||||
| &hs_m31phy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &pcie_x1phy { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &pcie_x2phy { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &pcie_x1_rp { | ||||
|         status = "ok"; | ||||
|  | ||||
| 	mhi_0: qcom,mhi@0 { | ||||
| 		reg = <0 0 0 0 0 >; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &pcie_x2_rp { | ||||
|         status = "ok"; | ||||
|  | ||||
| 	mhi_1: qcom,mhi@1 { | ||||
| 		reg = <0 0 0 0 0 >; | ||||
|  | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &qfprom { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &tsens { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qcom_q6v5_wcss { | ||||
| 	qcom,multipd_arch; | ||||
| 	memory-region = <&q6_mem_regions>; | ||||
| 	qcom,share_bootargs; | ||||
| 	qcom,bootargs_smem = <507>; | ||||
| boot-args = <0x1 0x4 0x3 0x0F 0x0 0x0>, | ||||
| 			<0x2 0x4 0x2 0x12 0x0 0x0>;	 | ||||
| 			 | ||||
| 	/* IPQ5018 */ | ||||
| 	q6v5_wcss_userpd1 { | ||||
| 		m3_firmware = "IPQ5018/m3_fw.mdt"; | ||||
| 		interrupts-extended = <&wcss_smp2p_in 8 0>, | ||||
| 			<&wcss_smp2p_in 9 0>, | ||||
| 			<&wcss_smp2p_in 12 0>, | ||||
| 			<&wcss_smp2p_in 11 0>; | ||||
| 		interrupt-names ="fatal", | ||||
| 			"ready", | ||||
| 			"spawn_ack", | ||||
| 			"stop-ack"; | ||||
| 		qcom,smem-states = <&wcss_smp2p_out 8>, | ||||
| 			<&wcss_smp2p_out 9>, | ||||
| 			<&wcss_smp2p_out 10>; | ||||
| 		qcom,smem-state-names = "shutdown", | ||||
| 			"stop", | ||||
| 			"spawn"; | ||||
| 		qca,asid = <1>; | ||||
| 		qca,auto-restart; | ||||
| 		qca,int_radio; | ||||
| 		#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 		memory-region = <&q6_ipq5018_data>, <&m3_dump>, | ||||
| 				<&q6_etr_region>; | ||||
| 		#else | ||||
| 		memory-region = <&q6_ipq5018_data>, <&m3_dump>, | ||||
| 				<&q6_etr_region>, <&q6_caldb_region>; | ||||
| 		#endif | ||||
| 	}; | ||||
|  | ||||
| 	/* QCN6122 6G */ | ||||
| 	q6v5_wcss_userpd2 { | ||||
| 		m3_firmware = "qcn6122/m3_fw.mdt"; | ||||
| 		interrupts-extended = <&wcss_smp2p_in 16 0>, | ||||
| 			<&wcss_smp2p_in 17 0>, | ||||
| 			<&wcss_smp2p_in 20 0>, | ||||
| 			<&wcss_smp2p_in 19 0>; | ||||
| 		interrupt-names ="fatal", | ||||
| 			"ready", | ||||
| 			"spawn_ack", | ||||
| 			"stop-ack"; | ||||
| 		qcom,smem-states = <&wcss_smp2p_out 16>, | ||||
| 			<&wcss_smp2p_out 17>, | ||||
| 			<&wcss_smp2p_out 18>; | ||||
| 		qcom,smem-state-names = "shutdown", | ||||
| 			"stop", | ||||
| 			"spawn"; | ||||
| 		qca,asid = <2>; | ||||
| 		qca,auto-restart; | ||||
| 		#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 		memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>, | ||||
| 				<&q6_qcn6122_etr_1>; | ||||
| 		#else | ||||
| 		memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>, | ||||
| 				<&q6_qcn6122_etr_1>, <&q6_qcn6122_caldb_1>; | ||||
| 		#endif | ||||
| 	}; | ||||
|  | ||||
| 	/* QCN6122 5G */ | ||||
| 	q6v5_wcss_userpd3 { | ||||
| 		m3_firmware = "qcn6122/m3_fw.mdt"; | ||||
| 		interrupts-extended = <&wcss_smp2p_in 24 0>, | ||||
| 			<&wcss_smp2p_in 25 0>, | ||||
| 			<&wcss_smp2p_in 28 0>, | ||||
| 			<&wcss_smp2p_in 27 0>; | ||||
| 		interrupt-names ="fatal", | ||||
| 			"ready", | ||||
| 			"spawn_ack", | ||||
| 			"stop-ack"; | ||||
| 		qcom,smem-states = <&wcss_smp2p_out 24>, | ||||
| 			<&wcss_smp2p_out 25>, | ||||
| 			<&wcss_smp2p_out 26>; | ||||
| 		qcom,smem-state-names = "shutdown", | ||||
| 			"stop", | ||||
| 			"spawn"; | ||||
| 		qca,asid = <3>; | ||||
| 		qca,auto-restart; | ||||
| 		#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 		memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>, | ||||
| 				<&q6_qcn6122_etr_2>; | ||||
| 		#else | ||||
| 		memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>, | ||||
| 				<&q6_qcn6122_etr_2>, <&q6_qcn6122_caldb_2>; | ||||
| 		#endif | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &i2c_0 { | ||||
| 	pinctrl-0 = <&i2c_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	status = "disabled"; | ||||
| }; | ||||
|  | ||||
| &qgic_msi_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qgic_msi_1 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &wifi0 { | ||||
| 	/* IPQ5018 */ | ||||
| 	qcom,multipd_arch; | ||||
| 	qcom,userpd-subsys-name = "q6v5_wcss_userpd1"; | ||||
| #ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 	qcom,tgt-mem-mode = <2>; | ||||
| #else | ||||
| 	qcom,tgt-mem-mode = <1>; | ||||
| #endif | ||||
| 	qcom,board_id = <0x24>; | ||||
| 	qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0>; | ||||
| #ifdef __CNSS2__ | ||||
| 	qcom,caldb-addr = <0x4D400000 0x4D400000 0 0 0>; | ||||
| #else | ||||
| 	qcom,caldb-addr = <0x4D400000>; | ||||
| 	m3-dump-addr = <0x4D200000>; | ||||
| 	nss-radio-priority = <0>; | ||||
| #endif | ||||
| 	mem-region = <&q6_ipq5018_data>; | ||||
| 	qcom,caldb-size = <0x200000>; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &wifi1 { | ||||
| 	/* QCN6122 5G */ | ||||
| 	qcom,multipd_arch; | ||||
| 	qcom,userpd-subsys-name = "q6v5_wcss_userpd2"; | ||||
| #ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 	qcom,tgt-mem-mode = <2>; | ||||
| #else | ||||
| 	qcom,tgt-mem-mode = <1>; | ||||
| #endif | ||||
| 	qcom,board_id = <0x60>; | ||||
| 	qcom,bdf-addr = <0x4D600000 0x4D600000 0x4D300000 0x0 0x0>; | ||||
| #ifdef __CNSS2__ | ||||
| 	qcom,caldb-addr = <0x4E800000 0x4E800000 0 0 0>; | ||||
| #else | ||||
| 	qcom,caldb-addr = <0x4E800000>; | ||||
| 	m3-dump-addr = <0x4E600000>; | ||||
| 	nss-radio-priority = <1>; | ||||
| #endif | ||||
| 	mem-region = <&q6_qcn6122_data1>; | ||||
| 	qcom,caldb-size = <0x500000>; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &wifi2 { | ||||
| 	/* QCN6122 6G */ | ||||
| 	qcom,multipd_arch; | ||||
| 	qcom,userpd-subsys-name = "q6v5_wcss_userpd3"; | ||||
| #ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 	qcom,tgt-mem-mode = <2>; | ||||
| #else | ||||
| 	qcom,tgt-mem-mode = <1>; | ||||
| #endif | ||||
| 	qcom,board_id = <0xb0>; | ||||
| 	qcom,bdf-addr = <0x4ED00000 0x4ED00000 0x4E400000 0x0 0x0>; | ||||
| #ifdef __CNSS2__ | ||||
| 	qcom,caldb-addr = <0x4FF00000 0x4FF00000 0 0 0>; | ||||
| #else | ||||
| 	qcom,caldb-addr = <0x4FF00000>; | ||||
| 	m3-dump-addr = <0x4FD00000>; | ||||
| 	nss-radio-priority = <1>; | ||||
| #endif | ||||
| 	mem-region = <&q6_qcn6122_data2>; | ||||
| 	qcom,caldb-size = <0x500000>; | ||||
| 	status = "ok"; | ||||
| }; | ||||
| @@ -0,0 +1,590 @@ | ||||
| /* | ||||
|  * 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 <dt-bindings/input/input.h> | ||||
| #include <dt-bindings/gpio/gpio.h> | ||||
|  | ||||
| / { | ||||
| 	#address-cells = <0x2>; | ||||
| 	#size-cells = <0x2>; | ||||
| 	compatible = "cig,wf660a", "qcom,ipq6018-cp01", "qcom,ipq6018"; | ||||
| 	interrupt-parent = <&intc>; | ||||
| 	qcom,msm-id = <0x192 0x0>, <0x193 0x0>; | ||||
|  | ||||
| 	aliases { | ||||
| 		serial0 = &blsp1_uart3; | ||||
| 		serial1 = &blsp1_uart2; | ||||
| 		sdhc1 = &sdhc_1; | ||||
| 		/* | ||||
| 		 * 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"; | ||||
| 	}; | ||||
|  | ||||
| 	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 | ||||
| 	}; | ||||
|  | ||||
| }; | ||||
|  | ||||
| &tlmm { | ||||
| 	pinctrl-0 = <&sd_ldo_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
|  | ||||
| 	uart_pins: uart_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio44", "gpio45"; | ||||
| 			function = "blsp2_uart"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	sd_ldo_pins: sd_ldo_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio66"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-disable; | ||||
| 			output-low; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	spi_0_pins: spi_0_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio38", "gpio39", "gpio40", "gpio41"; | ||||
| 			function = "blsp0_spi"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	spi_1_pins: spi_1_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio69", "gpio71", "gpio72"; | ||||
| 			function = "blsp1_spi"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		spi_cs { | ||||
| 			pins = "gpio70"; | ||||
| 			function = "blsp1_spi"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 		quartz_interrupt { | ||||
| 			pins = "gpio78"; | ||||
| 			function = "gpio"; | ||||
| 			input; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 		quartz_reset { | ||||
| 			pins = "gpio79"; | ||||
| 			function = "gpio"; | ||||
| 			output-low; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
|  | ||||
| 	}; | ||||
|  | ||||
| 	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; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	sd_pins: sd_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio62"; | ||||
| 			function = "sd_card"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	extcon_usb_pins: extcon_usb_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio26"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	button_pins: button_pins { | ||||
| 		wps_button { | ||||
| 			pins = "gpio9"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 		reset_button { | ||||
| 			pins = "gpio19"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	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; | ||||
| 		}; | ||||
| 		mux_3 { | ||||
| 			pins = "gpio77"; | ||||
| 			function = "gpio"; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	leds_pins: leds_pins { | ||||
| 		led_5g { | ||||
| 			pins = "gpio35"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		led_2g { | ||||
| 			pins = "gpio37"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		led_usb0 { | ||||
| 			pins = "gpio50"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	hsuart_pins: hsuart_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio71", "gpio72"; | ||||
| 			function = "blsp1_uart"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	btcoex_pins: btcoex_pins { | ||||
| 		mux_0 { | ||||
| 			pins = "gpio51"; | ||||
| 			function = "pta1_1"; | ||||
| 			drive-strength = <6>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		mux_1 { | ||||
| 			pins = "gpio53"; | ||||
| 			function = "pta1_0"; | ||||
| 			drive-strength = <6>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		mux_2 { | ||||
| 			pins = "gpio52"; | ||||
| 			function = "pta1_2"; | ||||
| 			drive-strength = <6>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
| 	pwm_pins: pwm_pinmux { | ||||
|         mux_1 { | ||||
|                 pins = "gpio22"; | ||||
|                 function = "pwm02"; | ||||
|                 drive-strength = <8>; | ||||
|         }; | ||||
| 		mux_2 { | ||||
| 			pins = "gpio23"; | ||||
|             function = "pwm12"; | ||||
|             drive-strength = <8>; | ||||
| 		}; | ||||
| 		mux_3 { | ||||
| 			pins = "gpio24"; | ||||
|             function = "pwm22"; | ||||
|             drive-strength = <8>; | ||||
| 		}; | ||||
| 		 | ||||
|         }; | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
| 	pwm { | ||||
|                 pinctrl-0 = <&pwm_pins>; | ||||
|                 pinctrl-names = "default"; | ||||
|                 used-pwm-indices = <1>, <1>, <1>, <0>; | ||||
|                 status = "ok"; | ||||
|         }; | ||||
| 	extcon_usb: extcon_usb { | ||||
| 		pinctrl-0 = <&extcon_usb_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
| 		id-gpio = <&tlmm 26 GPIO_ACTIVE_LOW>; | ||||
| 		status = "ok"; | ||||
| 	}; | ||||
|  | ||||
| 	mdio: mdio@90000 { | ||||
| 		pinctrl-0 = <&mdio_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
| 		phy-reset-gpio = <&tlmm 75 0 &tlmm 77 1>; | ||||
| 		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 = <0x1c>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	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 = <28>; | ||||
| 		phy-mode = "sgmii"; | ||||
| 	}; | ||||
|  | ||||
| 	nss-macsec0 { | ||||
| 		compatible = "qcom,nss-macsec"; | ||||
| 		phy_addr = <0x1c>; | ||||
| 		phy_access_mode = <0>; | ||||
| 		mdiobus = <&mdio>; | ||||
| 	}; | ||||
|  | ||||
| 	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 = <0xf>; /* mac mode for uniphy instance1*/ | ||||
| 		switch_mac_mode2 = <0xff>; /* mac mode for uniphy instance2*/ | ||||
| 		qcom,port_phyinfo { | ||||
| 			port@0 { | ||||
| 				port_id = <1>; | ||||
| 				phy_address = <0>; | ||||
| 			}; | ||||
| 			port@1 { | ||||
| 				port_id = <2>; | ||||
| 				phy_address = <1>; | ||||
| 			}; | ||||
| 			port@2 { | ||||
| 				port_id = <3>; | ||||
| 				phy_address = <2>; | ||||
| 			}; | ||||
| 			port@3 { | ||||
| 				port_id = <4>; | ||||
| 				phy_address = <3>; | ||||
| 			}; | ||||
| 			port@4 { | ||||
| 				port_id = <5>; | ||||
| 				phy_address = <0x1c>; | ||||
| 				port_mac_sel = "QGMAC_PORT"; | ||||
| 			}; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	gpio_keys { | ||||
| 		compatible = "gpio-keys"; | ||||
| 		pinctrl-0 = <&button_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		wps { | ||||
| 			label = "wps"; | ||||
| 			linux,code = <KEY_WPS_BUTTON>; | ||||
| 			gpios = <&tlmm 9 GPIO_ACTIVE_LOW>; | ||||
| 			linux,input-type = <1>; | ||||
| 			debounce-interval = <60>; | ||||
| 		}; | ||||
| 		reset { | ||||
| 			label = "reset"; | ||||
| 			linux,code = <KEY_POWER>; | ||||
| 			gpios = <&tlmm 19 GPIO_ACTIVE_LOW>; | ||||
| 			linux,input-type = <1>; | ||||
| 			debounce-interval = <60>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	leds { | ||||
| 		compatible = "gpio-leds"; | ||||
| 		pinctrl-0 = <&leds_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		led@35 { | ||||
| 			label = "led_5g"; | ||||
| 			gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; | ||||
| 			linux,default-trigger = "led_5g"; | ||||
| 			default-state = "off"; | ||||
| 		}; | ||||
| 		led@37 { | ||||
| 			label = "led_2g"; | ||||
| 			gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; | ||||
| 			linux,default-trigger = "led_2g"; | ||||
| 			default-state = "off"; | ||||
| 		}; | ||||
| 		led@50 { | ||||
| 			label = "led_usb0"; | ||||
| 			gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>; | ||||
| 			linux,default-trigger = "usb-host"; | ||||
| 			default-state = "off"; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| i2c_4: i2c@78b9000 { | ||||
| 	compatible = "qcom,i2c-qup-v2.2.1"; | ||||
| 	#address-cells = <1>; | ||||
| 	#size-cells = <0>; | ||||
| 	reg = <0x78b9000 0x600>; | ||||
| 	interrupts = <GIC_SPI 299 IRQ_TYPE_LEVEL_HIGH>; | ||||
| 	clocks = <&gcc GCC_BLSP1_AHB_CLK>,<&gcc GCC_BLSP1_QUP5_I2C_APPS_CLK>; | ||||
| 	clock-names = "iface", "core"; | ||||
| 	clock-frequency  = <100000>; | ||||
| 	dmas = <&blsp_dma 21>, <&blsp_dma 20>; | ||||
| 	dma-names = "rx", "tx"; | ||||
| 	status = "disabled"; | ||||
| }; | ||||
| }; | ||||
|  | ||||
| &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; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &blsp1_uart2 { | ||||
| 	pinctrl-0 = <&hsuart_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &spi_1 { /* BLSP1 QUP1 */ | ||||
| 	pinctrl-0 = <&spi_1_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	cs-select = <0>; | ||||
| 	quartz-reset-gpio = <&tlmm 79 1>; | ||||
| 	status = "disabled"; | ||||
| 	spidev1: spi@1 { | ||||
| 		compatible = "qca,spidev"; | ||||
| 		reg = <0>; | ||||
| 		spi-max-frequency = <24000000>; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
|  | ||||
| &qpic_bam { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &nand { | ||||
| 	pinctrl-0 = <&qpic_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	status = "disable"; | ||||
| }; | ||||
|  | ||||
| &ssphy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qusb_phy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qusb_phy_1 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &usb2 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &usb3 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &nss_crypto { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &pcie_phy { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &pcie0 { | ||||
| #if defined(__CNSS2__) | ||||
| 	status = "ok"; | ||||
| #endif | ||||
| }; | ||||
|  | ||||
| &qpic_lcd { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qpic_lcd_panel { | ||||
| 	status = "ok"; | ||||
| }; | ||||
							
								
								
									
										120
									
								
								feeds/ipq807x/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-cig-wf660a.dts
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										120
									
								
								feeds/ipq807x/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-cig-wf660a.dts
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,120 @@ | ||||
| /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-cig-wf660a-cp01.dtsi" | ||||
| #include "qcom-ipq6018-rpm-regulator.dtsi" | ||||
| #include "qcom-ipq6018-cpr-regulator.dtsi" | ||||
| #include "qcom-ipq6018-cp-cpu.dtsi" | ||||
|  | ||||
| / { | ||||
| 	model = "Cigtech WF-660a"; | ||||
|  | ||||
| 	/* | ||||
| 	 * +=========+==============+========================+ | ||||
| 	 * |        |              |                         | | ||||
| 	 * | 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 in default memory profile only */ | ||||
| #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 { | ||||
| 	i2c_0_pins: i2c_0_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio69", "gpio70"; | ||||
| 			function = "blsp1_i2c"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
| 	i2c_1_pins: i2c_1_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio42", "gpio43"; | ||||
| 			function = "blsp2_i2c"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
| 	i2c_4_pins: i2c_4_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio55", "gpio56"; | ||||
| 			function = "blsp4_i2c"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	};	 | ||||
| 	 | ||||
| }; | ||||
|  | ||||
| &i2c_0 { | ||||
| 	pinctrl-0 = <&i2c_0_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
|  | ||||
| &i2c_1 { | ||||
| 	pinctrl-0 = <&i2c_1_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &i2c_4 { | ||||
| 	pinctrl-0 = <&i2c_4_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &sdhc_1 { | ||||
| 	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 | ||||
| @@ -0,0 +1,78 @@ | ||||
| /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-gl-ax1800.dtsi" | ||||
|  | ||||
| / { | ||||
| 	model = "GL Technologies, Inc. AX1800"; | ||||
| 	compatible = "glinet,ax1800", "qcom,ipq6018-cp03", "qcom,ipq6018"; | ||||
|  | ||||
| 	aliases { | ||||
| 		ethernet3 = "/soc/dp4"; | ||||
| 		ethernet4 = "/soc/dp5"; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &mdio0 { | ||||
| 	phy3: ethernet-phy@3 { | ||||
| 		reg = <3>; | ||||
| 	}; | ||||
| 	phy4: ethernet-phy@4 { | ||||
| 		reg = <4>; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &ess0 { | ||||
| 	switch_lan_bmp = <0x3c>; /* lan port bitmap */ | ||||
|  | ||||
| 	qcom,port_phyinfo { | ||||
| 		port@3 { | ||||
| 			port_id = <4>; | ||||
| 			phy_address = <3>; | ||||
| 		}; | ||||
| 		port@4 { | ||||
| 			port_id = <5>; | ||||
| 			phy_address = <4>; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
| 	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"; | ||||
| 	}; | ||||
| }; | ||||
| @@ -0,0 +1,364 @@ | ||||
| /* | ||||
|  * 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 <dt-bindings/input/input.h> | ||||
|  | ||||
| / { | ||||
| 	#address-cells = <0x2>; | ||||
| 	#size-cells = <0x2>; | ||||
| 	interrupt-parent = <&intc>; | ||||
| 	qcom,msm-id = <0x1A5 0x0>; | ||||
|  | ||||
| 	aliases { | ||||
| 		ethernet0 = "/soc/dp1"; | ||||
| 		ethernet1 = "/soc/dp2"; | ||||
| 		ethernet2 = "/soc/dp3"; | ||||
|  | ||||
| 		led-boot = &led_run; | ||||
| 		led-failsafe = &led_run; | ||||
| 		led-running = &led_run; | ||||
| 		led-upgrade = &led_run; | ||||
| 	}; | ||||
|  | ||||
| 	chosen { | ||||
| 		bootargs = "console=ttyMSM0,115200,n8 rw init=/init"; | ||||
| 		bootargs-append = " swiotlb=1 coherent_pool=2M"; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &tlmm { | ||||
| 	uart_pins: uart_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio44", "gpio45"; | ||||
| 			function = "blsp2_uart"; | ||||
| 			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 { | ||||
| 		switch_button { | ||||
| 			pins = "gpio9"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 		reset_button { | ||||
| 			pins = "gpio18"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	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 = "gpio74"; | ||||
| 			function = "gpio"; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	leds_pins: leds_pins { | ||||
| 		white { | ||||
| 			pins = "gpio35"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		blue { | ||||
| 			pins = "gpio37"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	usb_pins: usb_pins { | ||||
| 		usb_pwr { | ||||
| 			pins = "gpio0"; | ||||
| 			function = "gpio"; | ||||
| 			bias-pull-up; | ||||
| 			output-high; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
| 	mdio0: mdio@90000 { | ||||
| 		pinctrl-0 = <&mdio_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
| 		phy-reset-gpio = <&tlmm 74 GPIO_ACTIVE_HIGH>; | ||||
| 		status = "ok"; | ||||
| 		phy0: ethernet-phy@0 { | ||||
| 			reg = <0>; | ||||
| 		}; | ||||
| 		phy1: ethernet-phy@1 { | ||||
| 			reg = <1>; | ||||
| 		}; | ||||
| 		phy2: ethernet-phy@2 { | ||||
| 			reg = <2>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	ess0: ess-switch@3a000000 { | ||||
| 		switch_cpu_bmp = <0x1>;  /* cpu port bitmap */ | ||||
| 		switch_lan_bmp = <0x0c>; /* lan port bitmap */ | ||||
| 		switch_wan_bmp = <0x02>; /* 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@0 { | ||||
| 				port_id = <1>; | ||||
| 				phy_address = <0>; | ||||
| 			}; | ||||
| 			port@1 { | ||||
| 				port_id = <2>; | ||||
| 				phy_address = <1>; | ||||
| 			}; | ||||
| 			port@2 { | ||||
| 				port_id = <3>; | ||||
| 				phy_address = <2>; | ||||
| 			}; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	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"; | ||||
| 	}; | ||||
|  | ||||
| 	leds { | ||||
| 		compatible = "gpio-leds"; | ||||
| 		pinctrl-0 = <&leds_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		led_run: led@35 { | ||||
| 			label = "white:sys"; | ||||
| 			gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; | ||||
| 			default-state = "on"; | ||||
| 		}; | ||||
|  | ||||
| 		led@37 { | ||||
| 			label = "blue:wan"; | ||||
| 			gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; | ||||
| 			default-state = "on"; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	gpio_keys { | ||||
| 		compatible = "gpio-keys"; | ||||
| 		pinctrl-0 = <&button_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		switch { | ||||
| 			label = "switch"; | ||||
| 			linux,code = <KEY_WPS_BUTTON>; | ||||
| 			gpios = <&tlmm 9 GPIO_ACTIVE_LOW>; | ||||
| 			linux,input-type = <1>; | ||||
| 			debounce-interval = <60>; | ||||
| 		}; | ||||
| 		reset { | ||||
| 			label = "reset"; | ||||
| 			linux,code = <KEY_RESTART>; | ||||
| 			gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; | ||||
| 			linux,input-type = <1>; | ||||
| 			debounce-interval = <60>; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &blsp1_uart3 { | ||||
| 	pinctrl-0 = <&uart_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qpic_bam { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &nand { | ||||
| 	pinctrl-0 = <&qpic_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &ssphy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qusb_phy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &usb3 { | ||||
| 	pinctrl-0 = <&usb_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &nss_crypto { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &q6_region { | ||||
| 	reg = <0x0 0x4ab00000 0x0 0x05500000>; | ||||
| }; | ||||
|  | ||||
| &CPU0 { | ||||
| 	operating-points = < | ||||
| 		/* kHz   uV (fixed) */ | ||||
| 		864000   1100000 | ||||
| 		1056000  1100000 | ||||
| 		1200000  1100000 | ||||
| 	>; | ||||
| 	clock-latency = <200000>; | ||||
| }; | ||||
|  | ||||
| &CPU1 { | ||||
| 	operating-points = < | ||||
| 		/* kHz   uV (fixed) */ | ||||
| 		864000   1100000 | ||||
| 		1056000  1100000 | ||||
| 		1200000  1100000 | ||||
| 	>; | ||||
| 	clock-latency = <200000>; | ||||
| }; | ||||
|  | ||||
| &CPU2 { | ||||
| 	operating-points = < | ||||
| 		/* kHz   uV (fixed) */ | ||||
| 		864000   1100000 | ||||
| 		1056000  1100000 | ||||
| 		1200000  1100000 | ||||
| 	>; | ||||
| 	clock-latency = <200000>; | ||||
| }; | ||||
|  | ||||
| &CPU3 { | ||||
| 	operating-points = < | ||||
| 		/* kHz   uV (fixed) */ | ||||
| 		864000   1100000 | ||||
| 		1056000  1100000 | ||||
| 		1200000  1100000 | ||||
| 	>; | ||||
| 	clock-latency = <200000>; | ||||
| }; | ||||
| @@ -0,0 +1,94 @@ | ||||
| /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-gl-ax1800.dtsi" | ||||
|  | ||||
| / { | ||||
| 	model = "GL Technologies, Inc. AXT1800"; | ||||
| 	compatible = "glinet,axt1800", "qcom,ipq6018-cp03", "qcom,ipq6018"; | ||||
|  | ||||
| 	aliases { | ||||
| 		sdhc0 = &sdhc_2; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &tlmm { | ||||
| 	sd_pins: sd_pins { | ||||
| 		sd { | ||||
| 			pins = "gpio62"; | ||||
| 			function = "sd_card"; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 		ldo { | ||||
| 			pins = "gpio66"; | ||||
| 			function = "gpio"; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	pwm_pins: pwm_pinmux { | ||||
| 		pwm { | ||||
| 			pins = "gpio30"; | ||||
| 			function = "pwm13"; | ||||
| 			drive-strength = <8>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	fan_pins: fan_pins { | ||||
| 		pwr { | ||||
| 			pins = "gpio29"; | ||||
| 			function = "gpio"; | ||||
| 			bias-pull-up; | ||||
| 			output-high; | ||||
| 		}; | ||||
| 		speed { | ||||
| 			pins = "gpio31"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
| 	pwm:pwm { | ||||
| 		#pwm-cells = <2>; | ||||
| 		pinctrl-0 = <&pwm_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
| 		used-pwm-indices = <0>, <1>, <0>, <0>; | ||||
| 		status = "ok"; | ||||
| 	}; | ||||
|  | ||||
| 	pwm-fan { | ||||
| 		compatible = "pwm-fan"; | ||||
| 		pinctrl-0 = <&fan_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
| 		cooling-min-state = <0>; | ||||
| 		cooling-max-state = <3>; | ||||
| 		#cooling-cells = <2>; | ||||
| 		pwms = <&pwm 1 255>; | ||||
| 		cooling-levels = <0 150 200 255>; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &sdhc_2 { | ||||
| 	pinctrl-0 = <&sd_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	cd-gpios = <&tlmm 62 1>; | ||||
| 	sd-ldo-gpios = <&tlmm 66 1>; | ||||
| 	status = "ok"; | ||||
| }; | ||||
| @@ -0,0 +1,155 @@ | ||||
| /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-cp01-hfcl.dtsi" | ||||
| #include "qcom-ipq6018-rpm-regulator.dtsi" | ||||
| #include "qcom-ipq6018-cpr-regulator.dtsi" | ||||
| #include "qcom-ipq6018-cp-cpu.dtsi" | ||||
|  | ||||
| / { | ||||
| 	model = "HFCL ION4X"; | ||||
| 	compatible = "hfcl,ion4x", "qcom,ipq6018-cp01", "qcom,ipq6018"; | ||||
|  | ||||
| 	/* | ||||
| 	 * +=========+==============+========================+ | ||||
| 	 * |        |              |                         | | ||||
| 	 * | 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 in default memory profile only */ | ||||
| #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 { | ||||
| 	i2c_1_pins: i2c_1_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio42", "gpio43"; | ||||
| 			function = "blsp2_i2c"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
| 	 | ||||
| 	i2c_2_pins: i2c_2_pins { | ||||
|                 mux { | ||||
|                         pins = "gpio55", "gpio56"; | ||||
|                         function = "blsp4_i2c"; | ||||
|                         drive-strength = <8>; | ||||
|                         bias-pull-down; | ||||
|                 }; | ||||
|         }; | ||||
| }; | ||||
|  | ||||
| &i2c_1 { | ||||
| 	pinctrl-0 = <&i2c_1_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	status = "ok"; | ||||
|  | ||||
| 	lm75@48 { | ||||
| 		compatible = "lm75"; | ||||
| 		reg = <0x48>; | ||||
| 		status = "okay"; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &i2c_2 { | ||||
|         pinctrl-0 = <&i2c_2_pins>; | ||||
|         pinctrl-names = "default"; | ||||
|         status = "ok"; | ||||
| }; | ||||
|  | ||||
| &sdhc_2 { | ||||
| 	pinctrl-0 = <&sd_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	cd-gpios = <&tlmm 62 1>; | ||||
| 	sd-ldo-gpios = <&tlmm 66 0>; | ||||
| 	vqmmc-supply = <&ipq6018_l2_corner>; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
|         leds { | ||||
|                 compatible = "gpio-leds"; | ||||
|                 pinctrl-0 = <&leds_pins>; | ||||
|                 pinctrl-names = "default"; | ||||
|  | ||||
|                 led@60 { | ||||
|                         label = "blue:wifi5"; | ||||
|                         gpios = <&tlmm 60 GPIO_ACTIVE_LOW>; | ||||
|                         linux,default-trigger = "led_5g"; | ||||
|                         default-state = "off"; | ||||
|                 }; | ||||
|                 led@61 { | ||||
|                         label = "blue:wifi2"; | ||||
|                         gpios = <&tlmm 61 GPIO_ACTIVE_LOW>; | ||||
|                         linux,default-trigger = "led_2g"; | ||||
|                         default-state = "off"; | ||||
|                 }; | ||||
|         }; | ||||
| }; | ||||
|  | ||||
| &tlmm { | ||||
| 	leds_pins: leds_pins { | ||||
| 		led_5g { | ||||
| 			pins = "gpio60"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		led_2g { | ||||
| 			pins = "gpio61"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| /* 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 | ||||
| @@ -0,0 +1,155 @@ | ||||
| /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-cp01-hfcl.dtsi" | ||||
| #include "qcom-ipq6018-rpm-regulator.dtsi" | ||||
| #include "qcom-ipq6018-cpr-regulator.dtsi" | ||||
| #include "qcom-ipq6018-cp-cpu.dtsi" | ||||
|  | ||||
| / { | ||||
| 	model = "HFCL ION4X_2"; | ||||
| 	compatible = "hfcl,ion4x_2", "qcom,ipq6018-cp01", "qcom,ipq6018"; | ||||
|  | ||||
| 	/* | ||||
| 	 * +=========+==============+========================+ | ||||
| 	 * |        |              |                         | | ||||
| 	 * | 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 in default memory profile only */ | ||||
| #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 { | ||||
| 	i2c_1_pins: i2c_1_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio42", "gpio43"; | ||||
| 			function = "blsp2_i2c"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
| 	 | ||||
| 	i2c_2_pins: i2c_2_pins { | ||||
|                 mux { | ||||
|                         pins = "gpio55", "gpio56"; | ||||
|                         function = "blsp4_i2c"; | ||||
|                         drive-strength = <8>; | ||||
|                         bias-pull-down; | ||||
|                 }; | ||||
|         }; | ||||
| }; | ||||
|  | ||||
| &i2c_1 { | ||||
| 	pinctrl-0 = <&i2c_1_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	status = "ok"; | ||||
|  | ||||
| 	lm75@48 { | ||||
| 		compatible = "lm75"; | ||||
| 		reg = <0x48>; | ||||
| 		status = "okay"; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &i2c_2 { | ||||
|         pinctrl-0 = <&i2c_2_pins>; | ||||
|         pinctrl-names = "default"; | ||||
|         status = "ok"; | ||||
| }; | ||||
|  | ||||
| &sdhc_2 { | ||||
| 	pinctrl-0 = <&sd_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	cd-gpios = <&tlmm 62 1>; | ||||
| 	sd-ldo-gpios = <&tlmm 66 0>; | ||||
| 	vqmmc-supply = <&ipq6018_l2_corner>; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
|         leds { | ||||
|                 compatible = "gpio-leds"; | ||||
|                 pinctrl-0 = <&leds_pins>; | ||||
|                 pinctrl-names = "default"; | ||||
|  | ||||
|                 led@60 { | ||||
|                         label = "blue:wifi5"; | ||||
|                         gpios = <&tlmm 60 GPIO_ACTIVE_LOW>; | ||||
|                         linux,default-trigger = "led_5g"; | ||||
|                         default-state = "off"; | ||||
|                 }; | ||||
|                 led@61 { | ||||
|                         label = "blue:wifi2"; | ||||
|                         gpios = <&tlmm 61 GPIO_ACTIVE_LOW>; | ||||
|                         linux,default-trigger = "led_2g"; | ||||
|                         default-state = "off"; | ||||
|                 }; | ||||
|         }; | ||||
| }; | ||||
|  | ||||
| &tlmm { | ||||
| 	leds_pins: leds_pins { | ||||
| 		led_5g { | ||||
| 			pins = "gpio60"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		led_2g { | ||||
| 			pins = "gpio61"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| /* 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 | ||||
| @@ -0,0 +1,379 @@ | ||||
| // SPDX-License-Identifier: GPL-2.0-or-later OR MIT | ||||
| /dts-v1/; | ||||
|  | ||||
| #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> | ||||
|  | ||||
| / { | ||||
| 	model = "Indio UM-310AX V1"; | ||||
| 	compatible = "indio,um-310ax-v1", "qcom,ipq6018-cp03", "qcom,ipq6018"; | ||||
|  | ||||
| 	#address-cells = <0x2>; | ||||
| 	#size-cells = <0x2>; | ||||
| 	interrupt-parent = <&intc>; | ||||
|  | ||||
| 	aliases { | ||||
| 		/* Aliases as required by u-boot to patch MAC addresses */ | ||||
| 		ethernet0 = "/soc/dp2"; | ||||
| 		ethernet1 = "/soc/dp1"; | ||||
|  | ||||
| 		serial0 = &blsp1_uart3; | ||||
| 		serial1 = &blsp1_uart2; | ||||
|  | ||||
| 		led-boot = &led_system; | ||||
| 		led-failsafe = &led_system; | ||||
| 		led-running = &led_system; | ||||
| 		led-upgrade = &led_system; | ||||
| 	}; | ||||
|  | ||||
| 	chosen { | ||||
| 		bootargs = "console=ttyMSM0,115200,n8 rw init=/init"; | ||||
| 		bootargs-append = " swiotlb=1 coherent_pool=2M"; | ||||
| 	}; | ||||
|  | ||||
| /* 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 { | ||||
| 		rst_button { | ||||
| 			pins = "gpio19"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	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; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	modem_power_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio27"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 			output-high; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	leds_pins: leds_pins { | ||||
| 		led_blue { | ||||
| 			pins = "gpio35"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		led_green { | ||||
| 			pins = "gpio37"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		led_red { | ||||
| 			pins = "gpio32"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
| 	mdio: mdio@90000 { | ||||
| 		status = "ok"; | ||||
|  | ||||
| 		pinctrl-0 = <&mdio_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
| 		phy-reset-gpio = <&tlmm 75 0>; | ||||
|  | ||||
| 		ethernet-phy@0 { | ||||
| 			reg = <0x03>; | ||||
| 		}; | ||||
|  | ||||
| 		ethernet-phy@1 { | ||||
| 			reg = <0x04>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	ess-switch@3a000000 { | ||||
| 		switch_cpu_bmp =   <0x01>; /* cpu port bitmap */ | ||||
| 		switch_lan_bmp =   <0x10>; /* lan port bitmap */ | ||||
| 		switch_wan_bmp =   <0x20>; /* wan port bitmap */ | ||||
| 		switch_inner_bmp = <0x80>; /*inner port bitmap*/ | ||||
| 		switch_mac_mode =  <0x00>; /* 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 = <0x04>; | ||||
| 				phy_address = <0x03>; | ||||
| 			}; | ||||
|  | ||||
| 			port@4 { | ||||
| 				port_id = <0x05>; | ||||
| 				phy_address = <0x04>; | ||||
| 			}; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	dp1 { | ||||
| 		device_type = "network"; | ||||
| 		compatible = "qcom,nss-dp"; | ||||
| 		qcom,id = <0x04>; | ||||
| 		reg = <0x3a001600 0x200>; | ||||
| 		qcom,mactype = <0x00>; | ||||
| 		local-mac-address = [00 00 00 00 00 00]; | ||||
| 		qcom,link-poll = <0x01>; | ||||
| 		qcom,phy-mdio-addr = <0x03>; | ||||
| 		phy-mode = "sgmii"; | ||||
| 	}; | ||||
|  | ||||
| 	dp2 { | ||||
| 		device_type = "network"; | ||||
| 		compatible = "qcom,nss-dp"; | ||||
| 		qcom,id = <0x05>; | ||||
| 		reg = <0x3a001800 0x200>; | ||||
| 		qcom,mactype = <0x00>; | ||||
| 		local-mac-address = [00 00 00 00 00 00]; | ||||
| 		qcom,link-poll = <0x01>; | ||||
| 		qcom,phy-mdio-addr = <0x04>; | ||||
| 		phy-mode = "sgmii"; | ||||
| 	}; | ||||
|  | ||||
| 	gpio_keys { | ||||
| 		compatible = "gpio-keys"; | ||||
|  | ||||
| 		pinctrl-0 = <&button_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		reset { | ||||
| 			label = "reset"; | ||||
| 			linux,code = <KEY_RESTART>; | ||||
| 			gpios = <&tlmm 19 GPIO_ACTIVE_LOW>; | ||||
| 			linux,input-type = <1>; | ||||
| 			debounce-interval = <60>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	leds { | ||||
| 		compatible = "gpio-leds"; | ||||
|  | ||||
| 		pinctrl-0 = <&leds_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		led_system: system { | ||||
| 			label = "green:system"; | ||||
| 			gpio = <&tlmm 37 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
|  | ||||
| 		wlan2g { | ||||
| 			label = "blue:wlan2g"; | ||||
| 			gpio = <&tlmm 35 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
|  | ||||
| 		wlan5g { | ||||
| 			label = "red:wlan5g"; | ||||
| 			gpio = <&tlmm 32 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &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"; | ||||
| }; | ||||
|  | ||||
| &nss_crypto { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &cpu0_opp_table { | ||||
| 	compatible = "operating-points-v2"; | ||||
| 	opp-shared; | ||||
|  | ||||
| 	opp03 { | ||||
| 		opp-hz = /bits/ 64 <1200000000>; | ||||
| 		opp-microvolt = <3>; | ||||
| 		clock-latency-ns = <200000>; | ||||
| 	}; | ||||
|  | ||||
| 	/delete-node/ opp04; | ||||
| 	/delete-node/ opp05; | ||||
| 	/delete-node/ opp06; | ||||
| }; | ||||
|  | ||||
| /* 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 | ||||
|  | ||||
| &ssphy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qusb_phy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qusb_phy_1 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &usb2 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &usb3 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
| @@ -0,0 +1,379 @@ | ||||
| // SPDX-License-Identifier: GPL-2.0-or-later OR MIT | ||||
| /dts-v1/; | ||||
|  | ||||
| #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> | ||||
|  | ||||
| / { | ||||
| 	model = "Indio UM-510AXM V1"; | ||||
| 	compatible = "indio,um-510axm-v1", "qcom,ipq6018-cp03", "qcom,ipq6018"; | ||||
|  | ||||
| 	#address-cells = <0x2>; | ||||
| 	#size-cells = <0x2>; | ||||
| 	interrupt-parent = <&intc>; | ||||
|  | ||||
| 	aliases { | ||||
| 		/* Aliases as required by u-boot to patch MAC addresses */ | ||||
| 		ethernet0 = "/soc/dp2"; | ||||
| 		ethernet1 = "/soc/dp1"; | ||||
|  | ||||
| 		serial0 = &blsp1_uart3; | ||||
| 		serial1 = &blsp1_uart2; | ||||
|  | ||||
| 		led-boot = &led_system; | ||||
| 		led-failsafe = &led_system; | ||||
| 		led-running = &led_system; | ||||
| 		led-upgrade = &led_system; | ||||
| 	}; | ||||
|  | ||||
| 	chosen { | ||||
| 		bootargs = "console=ttyMSM0,115200,n8 rw init=/init"; | ||||
| 		bootargs-append = " swiotlb=1 coherent_pool=2M"; | ||||
| 	}; | ||||
|  | ||||
| /* 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 { | ||||
| 		rst_button { | ||||
| 			pins = "gpio19"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	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; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	modem_power_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio27"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 			output-high; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	leds_pins: leds_pins { | ||||
| 		led_blue { | ||||
| 			pins = "gpio35"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		led_green { | ||||
| 			pins = "gpio37"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		led_red { | ||||
| 			pins = "gpio32"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
| 	mdio: mdio@90000 { | ||||
| 		status = "ok"; | ||||
|  | ||||
| 		pinctrl-0 = <&mdio_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
| 		phy-reset-gpio = <&tlmm 75 0>; | ||||
|  | ||||
| 		ethernet-phy@0 { | ||||
| 			reg = <0x03>; | ||||
| 		}; | ||||
|  | ||||
| 		ethernet-phy@1 { | ||||
| 			reg = <0x04>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	ess-switch@3a000000 { | ||||
| 		switch_cpu_bmp =   <0x01>; /* cpu port bitmap */ | ||||
| 		switch_lan_bmp =   <0x10>; /* lan port bitmap */ | ||||
| 		switch_wan_bmp =   <0x20>; /* wan port bitmap */ | ||||
| 		switch_inner_bmp = <0x80>; /*inner port bitmap*/ | ||||
| 		switch_mac_mode =  <0x00>; /* 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 = <0x04>; | ||||
| 				phy_address = <0x03>; | ||||
| 			}; | ||||
|  | ||||
| 			port@4 { | ||||
| 				port_id = <0x05>; | ||||
| 				phy_address = <0x04>; | ||||
| 			}; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	dp1 { | ||||
| 		device_type = "network"; | ||||
| 		compatible = "qcom,nss-dp"; | ||||
| 		qcom,id = <0x04>; | ||||
| 		reg = <0x3a001600 0x200>; | ||||
| 		qcom,mactype = <0x00>; | ||||
| 		local-mac-address = [00 00 00 00 00 00]; | ||||
| 		qcom,link-poll = <0x01>; | ||||
| 		qcom,phy-mdio-addr = <0x03>; | ||||
| 		phy-mode = "sgmii"; | ||||
| 	}; | ||||
|  | ||||
| 	dp2 { | ||||
| 		device_type = "network"; | ||||
| 		compatible = "qcom,nss-dp"; | ||||
| 		qcom,id = <0x05>; | ||||
| 		reg = <0x3a001800 0x200>; | ||||
| 		qcom,mactype = <0x00>; | ||||
| 		local-mac-address = [00 00 00 00 00 00]; | ||||
| 		qcom,link-poll = <0x01>; | ||||
| 		qcom,phy-mdio-addr = <0x04>; | ||||
| 		phy-mode = "sgmii"; | ||||
| 	}; | ||||
|  | ||||
| 	gpio_keys { | ||||
| 		compatible = "gpio-keys"; | ||||
|  | ||||
| 		pinctrl-0 = <&button_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		reset { | ||||
| 			label = "reset"; | ||||
| 			linux,code = <KEY_RESTART>; | ||||
| 			gpios = <&tlmm 19 GPIO_ACTIVE_LOW>; | ||||
| 			linux,input-type = <1>; | ||||
| 			debounce-interval = <60>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	leds { | ||||
| 		compatible = "gpio-leds"; | ||||
|  | ||||
| 		pinctrl-0 = <&leds_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		led_system: system { | ||||
| 			label = "green:system"; | ||||
| 			gpio = <&tlmm 37 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
|  | ||||
| 		wlan2g { | ||||
| 			label = "blue:wlan2g"; | ||||
| 			gpio = <&tlmm 35 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
|  | ||||
| 		wlan5g { | ||||
| 			label = "red:wlan5g"; | ||||
| 			gpio = <&tlmm 32 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &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"; | ||||
| }; | ||||
|  | ||||
| &nss_crypto { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &cpu0_opp_table { | ||||
| 	compatible = "operating-points-v2"; | ||||
| 	opp-shared; | ||||
|  | ||||
| 	opp03 { | ||||
| 		opp-hz = /bits/ 64 <1200000000>; | ||||
| 		opp-microvolt = <3>; | ||||
| 		clock-latency-ns = <200000>; | ||||
| 	}; | ||||
|  | ||||
| 	/delete-node/ opp04; | ||||
| 	/delete-node/ opp05; | ||||
| 	/delete-node/ opp06; | ||||
| }; | ||||
|  | ||||
| /* 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 | ||||
|  | ||||
| &ssphy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qusb_phy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qusb_phy_1 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &usb2 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &usb3 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
| @@ -0,0 +1,379 @@ | ||||
| // SPDX-License-Identifier: GPL-2.0-or-later OR MIT | ||||
| /dts-v1/; | ||||
|  | ||||
| #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> | ||||
|  | ||||
| / { | ||||
| 	model = "Indio UM-510AXP V1"; | ||||
| 	compatible = "indio,um-510axp-v1", "qcom,ipq6018-cp03", "qcom,ipq6018"; | ||||
|  | ||||
| 	#address-cells = <0x2>; | ||||
| 	#size-cells = <0x2>; | ||||
| 	interrupt-parent = <&intc>; | ||||
|  | ||||
| 	aliases { | ||||
| 		/* Aliases as required by u-boot to patch MAC addresses */ | ||||
| 		ethernet0 = "/soc/dp2"; | ||||
| 		ethernet1 = "/soc/dp1"; | ||||
|  | ||||
| 		serial0 = &blsp1_uart3; | ||||
| 		serial1 = &blsp1_uart2; | ||||
|  | ||||
| 		led-boot = &led_system; | ||||
| 		led-failsafe = &led_system; | ||||
| 		led-running = &led_system; | ||||
| 		led-upgrade = &led_system; | ||||
| 	}; | ||||
|  | ||||
| 	chosen { | ||||
| 		bootargs = "console=ttyMSM0,115200,n8 rw init=/init"; | ||||
| 		bootargs-append = " swiotlb=1 coherent_pool=2M"; | ||||
| 	}; | ||||
|  | ||||
| /* 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 { | ||||
| 		rst_button { | ||||
| 			pins = "gpio19"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	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; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	modem_power_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio27"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 			output-high; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	leds_pins: leds_pins { | ||||
| 		led_blue { | ||||
| 			pins = "gpio35"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		led_green { | ||||
| 			pins = "gpio37"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		led_red { | ||||
| 			pins = "gpio32"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
| 	mdio: mdio@90000 { | ||||
| 		status = "ok"; | ||||
|  | ||||
| 		pinctrl-0 = <&mdio_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
| 		phy-reset-gpio = <&tlmm 75 0>; | ||||
|  | ||||
| 		ethernet-phy@0 { | ||||
| 			reg = <0x03>; | ||||
| 		}; | ||||
|  | ||||
| 		ethernet-phy@1 { | ||||
| 			reg = <0x04>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	ess-switch@3a000000 { | ||||
| 		switch_cpu_bmp =   <0x01>; /* cpu port bitmap */ | ||||
| 		switch_lan_bmp =   <0x10>; /* lan port bitmap */ | ||||
| 		switch_wan_bmp =   <0x20>; /* wan port bitmap */ | ||||
| 		switch_inner_bmp = <0x80>; /*inner port bitmap*/ | ||||
| 		switch_mac_mode =  <0x00>; /* 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 = <0x04>; | ||||
| 				phy_address = <0x03>; | ||||
| 			}; | ||||
|  | ||||
| 			port@4 { | ||||
| 				port_id = <0x05>; | ||||
| 				phy_address = <0x04>; | ||||
| 			}; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	dp1 { | ||||
| 		device_type = "network"; | ||||
| 		compatible = "qcom,nss-dp"; | ||||
| 		qcom,id = <0x04>; | ||||
| 		reg = <0x3a001600 0x200>; | ||||
| 		qcom,mactype = <0x00>; | ||||
| 		local-mac-address = [00 00 00 00 00 00]; | ||||
| 		qcom,link-poll = <0x01>; | ||||
| 		qcom,phy-mdio-addr = <0x03>; | ||||
| 		phy-mode = "sgmii"; | ||||
| 	}; | ||||
|  | ||||
| 	dp2 { | ||||
| 		device_type = "network"; | ||||
| 		compatible = "qcom,nss-dp"; | ||||
| 		qcom,id = <0x05>; | ||||
| 		reg = <0x3a001800 0x200>; | ||||
| 		qcom,mactype = <0x00>; | ||||
| 		local-mac-address = [00 00 00 00 00 00]; | ||||
| 		qcom,link-poll = <0x01>; | ||||
| 		qcom,phy-mdio-addr = <0x04>; | ||||
| 		phy-mode = "sgmii"; | ||||
| 	}; | ||||
|  | ||||
| 	gpio_keys { | ||||
| 		compatible = "gpio-keys"; | ||||
|  | ||||
| 		pinctrl-0 = <&button_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		reset { | ||||
| 			label = "reset"; | ||||
| 			linux,code = <KEY_RESTART>; | ||||
| 			gpios = <&tlmm 19 GPIO_ACTIVE_LOW>; | ||||
| 			linux,input-type = <1>; | ||||
| 			debounce-interval = <60>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	leds { | ||||
| 		compatible = "gpio-leds"; | ||||
|  | ||||
| 		pinctrl-0 = <&leds_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		led_system: system { | ||||
| 			label = "green:system"; | ||||
| 			gpio = <&tlmm 37 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
|  | ||||
| 		wlan2g { | ||||
| 			label = "blue:wlan2g"; | ||||
| 			gpio = <&tlmm 35 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
|  | ||||
| 		wlan5g { | ||||
| 			label = "red:wlan5g"; | ||||
| 			gpio = <&tlmm 32 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &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"; | ||||
| }; | ||||
|  | ||||
| &nss_crypto { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &cpu0_opp_table { | ||||
| 	compatible = "operating-points-v2"; | ||||
| 	opp-shared; | ||||
|  | ||||
| 	opp03 { | ||||
| 		opp-hz = /bits/ 64 <1200000000>; | ||||
| 		opp-microvolt = <3>; | ||||
| 		clock-latency-ns = <200000>; | ||||
| 	}; | ||||
|  | ||||
| 	/delete-node/ opp04; | ||||
| 	/delete-node/ opp05; | ||||
| 	/delete-node/ opp06; | ||||
| }; | ||||
|  | ||||
| /* 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 | ||||
|  | ||||
| &ssphy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qusb_phy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qusb_phy_1 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &usb2 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &usb3 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
| @@ -0,0 +1,23 @@ | ||||
| /dts-v1/; | ||||
| /* | ||||
|  * Copyright (c) 2022, 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-meshpp-s618.dtsi" | ||||
|  | ||||
| / { | ||||
| 	model = "MeshPlusPlus, Inc. S618 CP01"; | ||||
| 	compatible = "meshpp,s618-cp01", "qcom,ipq6018-cp01", "qcom,ipq6018"; | ||||
| }; | ||||
| @@ -0,0 +1,23 @@ | ||||
| /dts-v1/; | ||||
| /* | ||||
|  * Copyright (c) 2022, 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-meshpp-s618.dtsi" | ||||
|  | ||||
| / { | ||||
| 	model = "MeshPlusPlus, Inc. S618 CP01"; | ||||
| 	compatible = "meshpp,s618-cp03", "qcom,ipq6018-cp03", "qcom,ipq6018"; | ||||
| }; | ||||
| @@ -0,0 +1,789 @@ | ||||
| /* | ||||
|  * Copyright (c) 2022, 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 <dt-bindings/input/input.h> | ||||
|  | ||||
| / { | ||||
| 	#address-cells = <0x2>; | ||||
| 	#size-cells = <0x2>; | ||||
| 	interrupt-parent = <&intc>; | ||||
| 	qcom,msm-id = <0x1A5 0x0>; | ||||
|  | ||||
| 	aliases { | ||||
| 		ethernet0 = "/soc/dp1"; | ||||
| 		ethernet1 = "/soc/dp2"; | ||||
| 		ethernet2 = "/soc/dp3"; | ||||
| 		ethernet3 = "/soc/dp4"; | ||||
| 		ethernet4 = "/soc/dp5"; | ||||
|  | ||||
| 		led-boot = &led_green; | ||||
| 		led-running = &led_blue; | ||||
| 		led-upgrade = &led_red; | ||||
| 	}; | ||||
|  | ||||
| 	chosen { | ||||
| 		bootargs = "console=ttyMSM0,115200,n8 rw init=/init"; | ||||
|  | ||||
| #ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
|                 bootargs-append = " console=ttyMSM0,115200n8 panic=10 ubi.mtd=nand root=mtd:ubi_rootfs rootfstype=squashfs swiotlb=1 rootwait"; | ||||
| #else | ||||
|                 bootargs-append = " console=ttyMSM0,115200n8 panic=10 ubi.mtd=nand root=mtd:ubi_rootfs rootfstype=squashfs swiotlb=1 coherent_pool=2M rootwait"; | ||||
| #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 */ | ||||
| 	reserved-memory { | ||||
| #if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__) | ||||
| 		tzapp:tzapp@49B00000 {	/* TZAPPS */ | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x49B00000 0x0 0x00600000>; | ||||
| 		}; | ||||
| #endif | ||||
| 		qcn9000_pcie0@50200000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x50200000 0x0 0x03700000>; | ||||
| 		}; | ||||
|  | ||||
| 		mhi_region0: dma_pool0@53900000 { | ||||
| 			compatible = "shared-dma-pool"; | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x53900000 0x0 0x01800000>; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &tlmm { | ||||
| 	pinctrl-0 = <&sd_ldo_pins &generic_gpios &pcie_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
|  | ||||
| 	uart_pins: uart_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio44", "gpio45"; | ||||
| 			function = "blsp2_uart"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	sd_ldo_pins: sd_ldo_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio66"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-disable; | ||||
| 			output-low; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	spi_0_pins: spi_0_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio38", "gpio39", "gpio40", "gpio41"; | ||||
| 			function = "blsp0_spi"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	spi_1_pins: spi_1_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio69", "gpio71", "gpio72"; | ||||
| 			function = "blsp1_spi"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		spi_cs { | ||||
| 			pins = "gpio70"; | ||||
| 			function = "blsp1_spi"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 		quartz_interrupt { | ||||
| 			pins = "gpio78"; | ||||
| 			function = "gpio"; | ||||
| 			input; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 		quartz_reset { | ||||
| 			pins = "gpio79"; | ||||
| 			function = "gpio"; | ||||
| 			output-low; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	button_pins: button_pins { | ||||
| 		switch_button { | ||||
| 			pins = "gpio9"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 		reset_button { | ||||
| 			pins = "gpio19"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	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; | ||||
| 		}; | ||||
| 		mux_3 { | ||||
| 			pins = "gpio77"; | ||||
| 			function = "gpio"; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	leds_pins: leds_pins { | ||||
| 		led_5g { | ||||
| 			pins = "gpio35"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		led_2g { | ||||
| 			pins = "gpio37"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		m2_1_regulator { | ||||
| 			pins = "gpio29"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		m2_1_pwr_en { | ||||
| 			pins = "gpio49"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		m2_1_reset_n { | ||||
| 			pins = "gpio32"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		led_red: red { | ||||
| 			pins = "gpio50"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		led_green: green { | ||||
| 			pins = "gpio54"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		led_blue: blue { | ||||
| 			pins = "gpio57"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	sd_pins: sd_pins { | ||||
| 		mux_1 { | ||||
| 			pins = "gpio62"; | ||||
| 			function = "sd_card"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
|  | ||||
| 		mux_2 { | ||||
| 			pins = "gpio23"; | ||||
| 			function = "gpio"; | ||||
| 			drive_strength = <8>; | ||||
| 			bias-disable; | ||||
| 			output-high; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	extcon_usb_pins: extcon_usb_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio26"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	generic_gpios: generic_gpios { | ||||
| 		gpio42 { | ||||
| 			pins = "gpio42"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 			output-high; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	pcie_pins: pcie_pins { | ||||
| 		pcie0_enable { | ||||
| 			pins = "gpio34"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 			output-high; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
|         i2c_2_pins: i2c_2_pins { | ||||
|                 mux { | ||||
|                         pins = "gpio55", "gpio56"; | ||||
|                         function = "gpio"; | ||||
|                         drive-strength = <16>; | ||||
|                         bias-pull-up; | ||||
|                         input-enable; | ||||
|                 }; | ||||
|  | ||||
|                 mux_2 { | ||||
|                         pins = "gpio48"; | ||||
|                         function = "gpio"; | ||||
|                         drive_strength = <16>; | ||||
|                         output-high; | ||||
|                 }; | ||||
|  | ||||
|                 mux_3 { | ||||
|                         pins = "gpio73"; | ||||
|                         function = "gpio"; | ||||
|                         drive-stength = <16>; | ||||
|                         output-low; | ||||
|                 }; | ||||
|         }; | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
| 	extcon_usb: extcon_usb { | ||||
| 		pinctrl-0 = <&extcon_usb_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
| 		id-gpio = <&tlmm 26 GPIO_ACTIVE_LOW>; | ||||
| 		status = "ok"; | ||||
| 	}; | ||||
|  | ||||
| 	mdio0: mdio@90000 { | ||||
| 		pinctrl-0 = <&mdio_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
| 		phy-reset-gpio = <&tlmm 75 0 &tlmm 77 1>; | ||||
| 		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>; | ||||
|                 }; | ||||
| 	}; | ||||
|  | ||||
| 	ess0: 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@0 { | ||||
| 				port_id = <1>; | ||||
| 				phy_address = <0>; | ||||
| 			}; | ||||
| 			port@1 { | ||||
| 				port_id = <2>; | ||||
| 				phy_address = <1>; | ||||
| 			}; | ||||
| 			port@2 { | ||||
| 				port_id = <3>; | ||||
| 				phy_address = <2>; | ||||
| 			}; | ||||
| 			port@3 { | ||||
| 				port_id = <4>; | ||||
| 				phy_address = <3>; | ||||
| 			}; | ||||
| 			port@4 { | ||||
| 				port_id = <5>; | ||||
| 				phy_address = <4>; | ||||
| 			}; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	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@29 { | ||||
| 			label = "m2_1_regulator"; | ||||
| 			gpios = <&tlmm 29 GPIO_ACTIVE_HIGH>; | ||||
| 			linux,default-trigger = "none"; | ||||
| 			default-state = "on"; | ||||
| 		}; | ||||
|  | ||||
| 		led@49 { | ||||
| 			label = "m2_1_pwr_en"; | ||||
| 			gpios = <&tlmm 49 GPIO_ACTIVE_HIGH>; | ||||
| 			linux,default-trigger = "none"; | ||||
| 			default-state = "on"; | ||||
| 		}; | ||||
|  | ||||
| 		led@32 { | ||||
| 			label = "m2_1_reset_n"; | ||||
| 			gpios = <&tlmm 32 GPIO_ACTIVE_LOW>; | ||||
| 			linux,default-trigger = "none"; | ||||
| 			default-state = "off"; | ||||
| 		}; | ||||
|  | ||||
| 		led@50 { | ||||
| 			label = "red"; | ||||
| 			gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>; | ||||
| 			linux,default-trigger = "none"; | ||||
| 			default-state = "on"; | ||||
| 		}; | ||||
|  | ||||
| 		led@54 { | ||||
| 			label = "green"; | ||||
| 			gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>; | ||||
| 			linux,default-trigger = "none"; | ||||
| 			default-state = "on"; | ||||
| 		}; | ||||
|  | ||||
| 		led@57 { | ||||
| 			label = "blue"; | ||||
| 			gpios = <&tlmm 57 GPIO_ACTIVE_HIGH>; | ||||
| 			linux,default-trigger = "none"; | ||||
| 			default-state = "off"; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	gpio_keys { | ||||
| 		compatible = "gpio-keys"; | ||||
| 		pinctrl-0 = <&button_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		switch { | ||||
| 			label = "switch"; | ||||
| 			linux,code = <KEY_WPS_BUTTON>; | ||||
| 			gpios = <&tlmm 9 GPIO_ACTIVE_LOW>; | ||||
| 			linux,input-type = <1>; | ||||
| 			debounce-interval = <60>; | ||||
| 		}; | ||||
| 		reset { | ||||
| 			label = "reset"; | ||||
| 			linux,code = <KEY_RESTART>; | ||||
| 			gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; | ||||
| 			linux,input-type = <1>; | ||||
| 			debounce-interval = <60>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	i2c_2: i2c@0 { /* i2c gpio */ | ||||
| 		pinctrl-0 = <&i2c_2_pins>; | ||||
| 	        pinctrl-names = "default"; | ||||
| 		compatible = "i2c-gpio"; | ||||
| 		gpios = <&tlmm 56 0>, <&tlmm 55 0>; | ||||
| 		i2c-gpio,scl-open-drain; | ||||
| 		i2c-gpio,delay-us = <7>; | ||||
| 		#address-cells = <1>; | ||||
| 		#size-cells = <0>; | ||||
| 		status = "ok"; | ||||
| 	}; | ||||
|  | ||||
| 	wifi3: wifi3@f00000 { | ||||
| 		qcom,wlan-ramdump-dynamic = <0x400000>; | ||||
| 		mhi,max-channels = <30>; | ||||
| 		mhi,timeout = <10000>; | ||||
| 		#address-cells = <1>; | ||||
| 		#size-cells = <0>; | ||||
| 		qrtr_node_id = <0x20>; | ||||
| 		qca,auto-restart; | ||||
| #ifdef __IPQ_MEM_PROFILE_512_MB__ | ||||
|  | ||||
| 	      /* QCN9000 tgt-mem-mode=1 layout - 30MB | ||||
| 	       * +=========+==============+=========+ | ||||
| 	       * |  Region | Start Offset |   Size  | | ||||
| 	       * +---------+--------------+---------+ | ||||
| 	       * | BASE    |  0x4E400000  |   20MB  | | ||||
| 	       * +---------+--------------+---------+ | ||||
| 	       * | M3 Dump |  0x4F800000  |   1MB   | | ||||
| 	       * +---------+--------------+---------+ | ||||
| 	       * |  Caldb  |  0x4FA00000  |   8MB   | | ||||
| 	       * +==================================+ | ||||
| 	       */ | ||||
|  | ||||
| 		base-addr = <0x4E400000>; | ||||
| 		m3-dump-addr = <0x4F800000>; | ||||
| 		qcom,caldb-addr = <0x4FA00000>; | ||||
| #else | ||||
|  | ||||
| 	      /* QCN9000 tgt-mem-mode=0 layout - 55MB | ||||
| 	       * +=========+==============+=========+ | ||||
| 	       * |  Region | Start Offset |   Size  | | ||||
| 	       * +---------+--------------+---------+ | ||||
| 	       * | BASE    |  0x50200000  |   45MB  | | ||||
| 	       * +---------+--------------+---------+ | ||||
| 	       * | M3 Dump |  0x52F00000  |   1MB   | | ||||
| 	       * +---------+--------------+---------+ | ||||
| 	       * |  Caldb  |  0x53100000  |   8MB   | | ||||
| 	       * +==================================+ | ||||
| 	       */ | ||||
|  | ||||
| 		base-addr = <0x50200000>; | ||||
| 		m3-dump-addr = <0x52F00000>; | ||||
| 		qcom,caldb-addr = <0x53100000>; | ||||
| #endif | ||||
| 		status = "ok"; | ||||
|  | ||||
| 		mhi_channels { | ||||
| 			mhi_chan@0 { | ||||
| 				reg = <0>; | ||||
| 				label = "LOOPBACK"; | ||||
| 				mhi,num-elements = <32>; | ||||
| 				mhi,event-ring = <1>; | ||||
| 				mhi,chan-dir = <1>; | ||||
| 				mhi,data-type = <0>; | ||||
| 				mhi,doorbell-mode = <2>; | ||||
| 				mhi,ee = <0x14>; | ||||
| 			}; | ||||
|  | ||||
| 			mhi_chan@1 { | ||||
| 				reg = <1>; | ||||
| 				label = "LOOPBACK"; | ||||
| 				mhi,num-elements = <32>; | ||||
| 				mhi,event-ring = <1>; | ||||
| 				mhi,chan-dir = <2>; | ||||
| 				mhi,data-type = <0>; | ||||
| 				mhi,doorbell-mode = <2>; | ||||
| 				mhi,ee = <0x14>; | ||||
| 			}; | ||||
|  | ||||
| 			mhi_chan@4 { | ||||
| 				reg = <4>; | ||||
| 				label = "DIAG"; | ||||
| 				mhi,num-elements = <32>; | ||||
| 				mhi,event-ring = <1>; | ||||
| 				mhi,chan-dir = <1>; | ||||
| 				mhi,data-type = <0>; | ||||
| 				mhi,doorbell-mode = <2>; | ||||
| 				mhi,ee = <0x14>; | ||||
| 			}; | ||||
|  | ||||
| 			mhi_chan@5 { | ||||
| 				reg = <5>; | ||||
| 				label = "DIAG"; | ||||
| 				mhi,num-elements = <32>; | ||||
| 				mhi,event-ring = <1>; | ||||
| 				mhi,chan-dir = <2>; | ||||
| 				mhi,data-type = <0>; | ||||
| 				mhi,doorbell-mode = <2>; | ||||
| 				mhi,ee = <0x14>; | ||||
| 			}; | ||||
|  | ||||
| 			mhi_chan@20 { | ||||
| 				reg = <20>; | ||||
| 				label = "IPCR"; | ||||
| 				mhi,num-elements = <32>; | ||||
| 				mhi,event-ring = <1>; | ||||
| 				mhi,chan-dir = <1>; | ||||
| 				mhi,data-type = <1>; | ||||
| 				mhi,doorbell-mode = <2>; | ||||
| 				mhi,ee = <0x14>; | ||||
| 				mhi,auto-start; | ||||
| 			}; | ||||
|  | ||||
| 			mhi_chan@21 { | ||||
| 				reg = <21>; | ||||
| 				label = "IPCR"; | ||||
| 				mhi,num-elements = <32>; | ||||
| 				mhi,event-ring = <1>; | ||||
| 				mhi,chan-dir = <2>; | ||||
| 				mhi,data-type = <0>; | ||||
| 				mhi,doorbell-mode = <2>; | ||||
| 				mhi,ee = <0x14>; | ||||
| 				mhi,auto-queue; | ||||
| 				mhi,auto-start; | ||||
| 			}; | ||||
| 		}; | ||||
|  | ||||
| 		mhi_events { | ||||
| 			mhi_event@0 { | ||||
| 				mhi,num-elements = <32>; | ||||
| 				mhi,intmod = <1>; | ||||
| 				mhi,msi = <1>; | ||||
| 				mhi,priority = <1>; | ||||
| 				mhi,brstmode = <2>; | ||||
| 				mhi,data-type = <1>; | ||||
| 			}; | ||||
|  | ||||
| 			mhi_event@1 { | ||||
| 				mhi,num-elements = <256>; | ||||
| 				mhi,intmod = <1>; | ||||
| 				mhi,msi = <2>; | ||||
| 				mhi,priority = <1>; | ||||
| 				mhi,brstmode = <2>; | ||||
| 			}; | ||||
| 		}; | ||||
|  | ||||
| 		mhi_devices { | ||||
| 			mhi_qrtr { | ||||
| 				mhi,chan = "IPCR"; | ||||
| 				qcom,net-id = <0>; | ||||
| 			}; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &blsp1_uart3 { | ||||
| 	pinctrl-0 = <&uart_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qpic_bam { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &ssphy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qusb_phy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qusb_phy_1 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &usb2 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &usb3 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &nss_crypto { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &CPU0 { | ||||
| 	operating-points = < | ||||
| 		/* kHz   uV (fixed) */ | ||||
| 		864000   1100000 | ||||
| 		1056000  1100000 | ||||
| 		1200000  1100000 | ||||
| 		1608000  1100000 | ||||
| 	>; | ||||
| 	clock-latency = <200000>; | ||||
| }; | ||||
|  | ||||
| &CPU1 { | ||||
| 	operating-points = < | ||||
| 		/* kHz   uV (fixed) */ | ||||
| 		864000   1100000 | ||||
| 		1056000  1100000 | ||||
| 		1200000  1100000 | ||||
| 		1608000  1100000 | ||||
| 	>; | ||||
| 	clock-latency = <200000>; | ||||
| }; | ||||
|  | ||||
| &CPU2 { | ||||
| 	operating-points = < | ||||
| 		/* kHz   uV (fixed) */ | ||||
| 		864000   1100000 | ||||
| 		1056000  1100000 | ||||
| 		1200000  1100000 | ||||
| 		1608000  1100000 | ||||
| 	>; | ||||
| 	clock-latency = <200000>; | ||||
| }; | ||||
|  | ||||
| &CPU3 { | ||||
| 	operating-points = < | ||||
| 		/* kHz   uV (fixed) */ | ||||
| 		864000   1100000 | ||||
| 		1056000  1100000 | ||||
| 		1200000  1100000 | ||||
| 		1608000  1100000 | ||||
| 	>; | ||||
| 	clock-latency = <200000>; | ||||
| }; | ||||
|  | ||||
| &wifi0 { | ||||
|         qcom,board_id = <0x10>; | ||||
|         status = "ok"; | ||||
| }; | ||||
|  | ||||
| &pcie0 { | ||||
| 	status = "ok"; | ||||
|  | ||||
| 	pcie0_rp { | ||||
| 		reg = <0 0 0 0 0>; | ||||
| 		status = "ok"; | ||||
|  | ||||
| 		mhi_0: qcom,mhi@0 { | ||||
| 			reg = <0 0 0 0 0 >; | ||||
| 			qrtr_instance_id = <0x20>; | ||||
| 			qcom,board_id = <0xa4>; | ||||
| #if !defined(__IPQ_MEM_PROFILE_256_MB__) | ||||
| 			memory-region = <&mhi_region0>; | ||||
| #endif | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &pcie_phy { | ||||
|         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; | ||||
| 	}; | ||||
| }; | ||||
| @@ -0,0 +1,23 @@ | ||||
| /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-pax1800.dtsi" | ||||
|  | ||||
| / { | ||||
| 	model = "Plasma Cloud PAX1800 v1"; | ||||
| 	compatible = "plasmacloud,pax1800-v1", "qcom,ipq6018-cp03", "qcom,ipq6018"; | ||||
| }; | ||||
| @@ -0,0 +1,23 @@ | ||||
| /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-pax1800.dtsi" | ||||
|  | ||||
| / { | ||||
| 	model = "Plasma Cloud PAX1800 v2"; | ||||
| 	compatible = "plasmacloud,pax1800-v2", "qcom,ipq6018-cp03", "qcom,ipq6018"; | ||||
| }; | ||||
| @@ -0,0 +1,315 @@ | ||||
| /* | ||||
|  * 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> | ||||
|  | ||||
| / { | ||||
| 	#address-cells = <0x2>; | ||||
| 	#size-cells = <0x2>; | ||||
|  | ||||
| 	interrupt-parent = <&intc>; | ||||
| 	qcom,msm-id = <0x1A5 0x0>; | ||||
|  | ||||
| 	chosen { | ||||
| 		bootargs = "console=ttyMSM0,115200,n8 rw init=/init"; | ||||
| 		bootargs-append = " swiotlb=1 coherent_pool=2M"; | ||||
| 	}; | ||||
|  | ||||
| 	aliases { | ||||
| 		serial0 = &blsp1_uart3; | ||||
| 		/* | ||||
| 		 * Aliases as required by u-boot | ||||
| 		 * to patch MAC addresses | ||||
| 		 */ | ||||
| 		ethernet0 = "/soc/dp1"; | ||||
| 		ethernet1 = "/soc/dp2"; | ||||
|  | ||||
| 		led-boot = &led_status_green; | ||||
| 		led-failsafe = &led_status_green; | ||||
| 		led-running = &led_status_green; | ||||
| 		led-upgrade = &led_status_green; | ||||
| 		led-uplink = &led_status_blue; | ||||
| 	}; | ||||
|  | ||||
| 	gpio_keys { | ||||
| 		compatible = "gpio-keys"; | ||||
| 		pinctrl-0 = <&button_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		reset { | ||||
| 			label = "reset"; | ||||
| 			linux,code = <KEY_RESTART>; | ||||
| 			gpios = <&tlmm 24 GPIO_ACTIVE_LOW>; | ||||
| 			linux,input-type = <1>; | ||||
| 			debounce-interval = <60>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	leds { | ||||
| 		compatible = "gpio-leds"; | ||||
| 		pinctrl-0 = <&leds_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		status_red { | ||||
| 			label = "red:status"; | ||||
| 			gpios = <&tlmm 25 GPIO_ACTIVE_HIGH>; | ||||
| 			linux,default-trigger = "default-off"; | ||||
| 		}; | ||||
|  | ||||
| 		led_status_green: status_green { | ||||
| 			label = "green:status"; | ||||
| 			gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
|  | ||||
| 		led_status_blue: status_blue { | ||||
| 			label = "blue:status"; | ||||
| 			gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; | ||||
| 			linux,default-trigger = "default-off"; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	watchdog { | ||||
| 		compatible = "linux,wdt-gpio"; | ||||
| 		pinctrl-0 = <&watchdog_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
| 		gpios = <&tlmm 67 GPIO_ACTIVE_LOW>; | ||||
| 		hw_algo = "toggle"; | ||||
| 		hw_margin_ms = <2000>; | ||||
| 		always-running; | ||||
| 	}; | ||||
|  | ||||
| 	/* | ||||
| 	 * +=========+==============+========================+ | ||||
| 	 * |        |              |                         | | ||||
| 	 * | 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; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	button_pins: button_pins { | ||||
| 		reset_button { | ||||
| 			pins = "gpio24"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	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: led_pinmux { | ||||
| 		led_power_green { | ||||
| 			pins = "gpio25"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		led_power_blue { | ||||
| 			pins = "gpio35"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		led_power_red { | ||||
| 			pins = "gpio37"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	watchdog_pins: watchdog_pinmux { | ||||
| 		mux { | ||||
| 			pins = "gpio67"; | ||||
| 			function = "gpio"; | ||||
| 			bias-none; | ||||
| 			output-low; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
| 	mdio@90000 { | ||||
| 		pinctrl-0 = <&mdio_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
| 		phy-reset-gpio = <&tlmm 75 0>; | ||||
| 		status = "ok"; | ||||
| 		phy0: ethernet-phy@0 { | ||||
| 			reg = <3>; | ||||
| 		}; | ||||
| 		phy1: ethernet-phy@1 { | ||||
| 			reg = <4>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	ess-switch@3a000000 { | ||||
| 		switch_cpu_bmp = <0x1>;  /* cpu port bitmap */ | ||||
| 		switch_lan_bmp = <0x08>; /* lan port bitmap */ | ||||
| 		switch_wan_bmp = <0x10>; /* 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 = <3>; | ||||
| 		reg = <0x3a001400 0x200>; | ||||
| 		qcom,mactype = <0>; | ||||
| 		local-mac-address = [000000000000]; | ||||
| 		qcom,link-poll = <1>; | ||||
| 		qcom,phy-mdio-addr = <4>; | ||||
| 		phy-mode = "sgmii"; | ||||
| 	}; | ||||
|  | ||||
| 	dp2 { | ||||
| 		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"; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &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"; | ||||
| }; | ||||
|  | ||||
| &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 | ||||
|  | ||||
| &wifi0 { | ||||
| 	status = "okay"; | ||||
| 	qcom,ath11k-calibration-variant = "PlasmaCloud-PAX1800"; | ||||
| }; | ||||
| @@ -82,14 +82,24 @@ | ||||
| 	 */ | ||||
|  | ||||
| /* TZAPP is enabled only in default memory profile */ | ||||
| #if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__) | ||||
| 	reserved-memory { | ||||
| #if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__) | ||||
| 		tzapp:tzapp@49B00000 {	/* TZAPPS */ | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x49B00000 0x0 0x00600000>; | ||||
| 		}; | ||||
| 	}; | ||||
| #endif | ||||
| 		qcn9000_pcie0@50200000 { | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x50200000 0x0 0x02D00000>; | ||||
| 		}; | ||||
|  | ||||
| 		mhi_region0: dma_pool0@52f00000 { | ||||
| 			compatible = "shared-dma-pool"; | ||||
| 			no-map; | ||||
| 			reg = <0x0 0x52F00000 0x0 0x01800000>; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &tlmm { | ||||
| @@ -490,3 +500,49 @@ | ||||
| 	//vqmmc-supply = <&ipq6018_l2_corner>; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &wifi1 { | ||||
| 	base-addr = <0x50200000>; | ||||
| 	m3-dump-addr = <0x52500000>; | ||||
| 	etr-addr = <0x52600000>; | ||||
| 	caldb-addr = <0x52700000>; | ||||
| 	hremote-size = <0x2300000>; | ||||
| 	tgt-mem-mode = <0x0>; | ||||
| 	board_id = <0xa4>; | ||||
| 	caldb-size = <0x800000>; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &pcie0 { | ||||
| 	status = "ok"; | ||||
| 	interrupts = <0 52 0>, <0 416 0>, <0 417 0>, | ||||
|                      <0 418 0>, <0 419 0>, <0 420 0>, | ||||
|                      <0 421 0>, <0 422 0>, <0 423 0>, | ||||
|                      <0 424 0>, <0 425 0>, <0 426 0>, | ||||
|                      <0 427 0>, <0 428 0>, <0 429 0>, | ||||
|                      <0 430 0>, <0 431 0>; | ||||
|  | ||||
|         interrupt-names = "msi", "msi_0", "msi_1", | ||||
|                           "msi_2", "msi_3", "msi_4", | ||||
|                           "msi_5", "msi_6", "msi_7", | ||||
|                           "msi_8", "msi_9", "msi_10", | ||||
|                           "msi_11", "msi_12", "msi_13", | ||||
|                           "msi_14", "msi_15"; | ||||
|  | ||||
|         qcom,msi-gicm-addr = <0x0B00A040>; | ||||
|         qcom,msi-gicm-base = <0x1c0>; | ||||
| }; | ||||
|  | ||||
| &pcie0_rp { | ||||
|         status = "ok"; | ||||
|  | ||||
|         mhi_0: qcom,mhi@0 { | ||||
|                 reg = <0 0 0 0 0 >; | ||||
|                 qrtr_instance_id = <0x20>; | ||||
|                 memory-region = <&mhi_region0>; | ||||
|         }; | ||||
| }; | ||||
|  | ||||
| &pcie_phy { | ||||
|         status = "ok"; | ||||
| }; | ||||
|   | ||||
| @@ -0,0 +1,379 @@ | ||||
| // SPDX-License-Identifier: GPL-2.0-or-later OR MIT | ||||
| /dts-v1/; | ||||
|  | ||||
| #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> | ||||
|  | ||||
| / { | ||||
| 	model = "YunCore AX840"; | ||||
| 	compatible = "yuncore,ax840", "qcom,ipq6018-cp03", "qcom,ipq6018"; | ||||
|  | ||||
| 	#address-cells = <0x2>; | ||||
| 	#size-cells = <0x2>; | ||||
| 	interrupt-parent = <&intc>; | ||||
|  | ||||
| 	aliases { | ||||
| 		/* Aliases as required by u-boot to patch MAC addresses */ | ||||
| 		ethernet0 = "/soc/dp2"; | ||||
| 		ethernet1 = "/soc/dp1"; | ||||
|  | ||||
| 		serial0 = &blsp1_uart3; | ||||
| 		serial1 = &blsp1_uart2; | ||||
|  | ||||
| 		led-boot = &led_system; | ||||
| 		led-failsafe = &led_system; | ||||
| 		led-running = &led_system; | ||||
| 		led-upgrade = &led_system; | ||||
| 	}; | ||||
|  | ||||
| 	chosen { | ||||
| 		bootargs = "console=ttyMSM0,115200,n8 rw init=/init"; | ||||
| 		bootargs-append = " swiotlb=1 coherent_pool=2M"; | ||||
| 	}; | ||||
|  | ||||
| /* 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 { | ||||
| 		rst_button { | ||||
| 			pins = "gpio19"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-up; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	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; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	modem_power_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio27"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 			output-high; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	leds_pins: leds_pins { | ||||
| 		led_blue { | ||||
| 			pins = "gpio35"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		led_green { | ||||
| 			pins = "gpio37"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
|  | ||||
| 		led_red { | ||||
| 			pins = "gpio32"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <2>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
| 	mdio: mdio@90000 { | ||||
| 		status = "ok"; | ||||
|  | ||||
| 		pinctrl-0 = <&mdio_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
| 		phy-reset-gpio = <&tlmm 75 0>; | ||||
|  | ||||
| 		ethernet-phy@0 { | ||||
| 			reg = <0x03>; | ||||
| 		}; | ||||
|  | ||||
| 		ethernet-phy@1 { | ||||
| 			reg = <0x04>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	ess-switch@3a000000 { | ||||
| 		switch_cpu_bmp =   <0x01>; /* cpu port bitmap */ | ||||
| 		switch_lan_bmp =   <0x10>; /* lan port bitmap */ | ||||
| 		switch_wan_bmp =   <0x20>; /* wan port bitmap */ | ||||
| 		switch_inner_bmp = <0x80>; /*inner port bitmap*/ | ||||
| 		switch_mac_mode =  <0x00>; /* 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 = <0x04>; | ||||
| 				phy_address = <0x03>; | ||||
| 			}; | ||||
|  | ||||
| 			port@4 { | ||||
| 				port_id = <0x05>; | ||||
| 				phy_address = <0x04>; | ||||
| 			}; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	dp1 { | ||||
| 		device_type = "network"; | ||||
| 		compatible = "qcom,nss-dp"; | ||||
| 		qcom,id = <0x04>; | ||||
| 		reg = <0x3a001600 0x200>; | ||||
| 		qcom,mactype = <0x00>; | ||||
| 		local-mac-address = [00 00 00 00 00 00]; | ||||
| 		qcom,link-poll = <0x01>; | ||||
| 		qcom,phy-mdio-addr = <0x03>; | ||||
| 		phy-mode = "sgmii"; | ||||
| 	}; | ||||
|  | ||||
| 	dp2 { | ||||
| 		device_type = "network"; | ||||
| 		compatible = "qcom,nss-dp"; | ||||
| 		qcom,id = <0x05>; | ||||
| 		reg = <0x3a001800 0x200>; | ||||
| 		qcom,mactype = <0x00>; | ||||
| 		local-mac-address = [00 00 00 00 00 00]; | ||||
| 		qcom,link-poll = <0x01>; | ||||
| 		qcom,phy-mdio-addr = <0x04>; | ||||
| 		phy-mode = "sgmii"; | ||||
| 	}; | ||||
|  | ||||
| 	gpio_keys { | ||||
| 		compatible = "gpio-keys"; | ||||
|  | ||||
| 		pinctrl-0 = <&button_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		reset { | ||||
| 			label = "reset"; | ||||
| 			linux,code = <KEY_RESTART>; | ||||
| 			gpios = <&tlmm 19 GPIO_ACTIVE_LOW>; | ||||
| 			linux,input-type = <1>; | ||||
| 			debounce-interval = <60>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	leds { | ||||
| 		compatible = "gpio-leds"; | ||||
|  | ||||
| 		pinctrl-0 = <&leds_pins>; | ||||
| 		pinctrl-names = "default"; | ||||
|  | ||||
| 		led_system: system { | ||||
| 			label = "green:system"; | ||||
| 			gpio = <&tlmm 37 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
|  | ||||
| 		wlan2g { | ||||
| 			label = "blue:wlan2g"; | ||||
| 			gpio = <&tlmm 35 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
|  | ||||
| 		wlan5g { | ||||
| 			label = "red:wlan5g"; | ||||
| 			gpio = <&tlmm 32 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &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"; | ||||
| }; | ||||
|  | ||||
| &nss_crypto { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &cpu0_opp_table { | ||||
| 	compatible = "operating-points-v2"; | ||||
| 	opp-shared; | ||||
|  | ||||
| 	opp03 { | ||||
| 		opp-hz = /bits/ 64 <1200000000>; | ||||
| 		opp-microvolt = <3>; | ||||
| 		clock-latency-ns = <200000>; | ||||
| 	}; | ||||
|  | ||||
| 	/delete-node/ opp04; | ||||
| 	/delete-node/ opp05; | ||||
| 	/delete-node/ opp06; | ||||
| }; | ||||
|  | ||||
| /* 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 | ||||
|  | ||||
| &ssphy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qusb_phy_0 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &qusb_phy_1 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &usb2 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &usb3 { | ||||
| 	status = "ok"; | ||||
| }; | ||||
| @@ -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 = "Yuncore FAP650"; | ||||
| 	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/dp5"; | ||||
| 		ethernet1 = "/soc/dp4"; | ||||
| 		ethernet2 = "/soc/dp3"; | ||||
| 		ethernet3 = "/soc/dp2"; | ||||
| 		ethernet4 = "/soc/dp1"; | ||||
|  | ||||
| 		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 | ||||
| @@ -50,25 +50,78 @@ | ||||
| 			bootargs-append = " swiotlb=1 coherent_pool=2M"; | ||||
| 		#endif | ||||
| 	}; | ||||
|  | ||||
| 	gpio-export { | ||||
| 		compatible = "gpio-export"; | ||||
| 		#size-cells = <0>; | ||||
|  | ||||
| 		mcu-enable { | ||||
| 			gpio-export,name = "mcu-enable"; | ||||
| 			gpio-export,output = <0>; | ||||
| 			gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
|  | ||||
| 		usb-hub-enable { | ||||
| 			gpio-export,name = "usb-hub-enable"; | ||||
| 			gpio-export,output = <1>; | ||||
| 			gpios = <&tlmm 55 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
|  | ||||
| 		usb-rear-power { | ||||
| 			gpio-export,name = "usb-rear-power"; | ||||
| 			gpio-export,output = <1>; | ||||
| 			gpios = <&tlmm 29 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
|  | ||||
| 		usb-side-power { | ||||
| 			gpio-export,name = "usb-side-power"; | ||||
| 			gpio-export,output = <1>; | ||||
| 			gpios = <&tlmm 30 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &tlmm { | ||||
| 	pinctrl-0 = <&btcoex_pins>; | ||||
| 	pinctrl-0 = <&mcu_rst &mcu_rsv &usb_rear_pwr &usb_side_pwr &usb_hub_rst>; | ||||
| 	pinctrl-names = "default"; | ||||
|  | ||||
| 	btcoex_pins: btcoex_pins { | ||||
| 		mux_0 { | ||||
| 			pins = "gpio64"; | ||||
| 			function = "pta1_1"; | ||||
| 			drive-strength = <6>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		mux_1 { | ||||
| 			pins = "gpio65"; | ||||
| 			function = "pta1_2"; | ||||
| 			drive-strength = <6>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	mcu_rst: mcu_rst_pins { | ||||
| 		pins = "gpio54"; | ||||
| 		function = "gpio"; | ||||
| 		drive-strength = <8>; | ||||
| 		bias-disable; | ||||
| 		output-low; | ||||
| 	}; | ||||
|  | ||||
| 	mcu_rsv: mcu_rsv_pins { | ||||
| 		pins = "gpio56"; | ||||
| 		function = "gpio"; | ||||
| 		drive-strength = <8>; | ||||
| 		bias-disable; | ||||
| 	}; | ||||
|  | ||||
| 	usb_rear_pwr: usb_rear_pwr_pins { | ||||
| 		pins = "gpio29"; | ||||
| 		function = "gpio"; | ||||
| 		drive-strength = <8>; | ||||
| 		bias-disable; | ||||
| 		output-high; | ||||
| 	}; | ||||
|  | ||||
| 	usb_side_pwr: usb_side_pwr_pins { | ||||
| 		pins = "gpio30"; | ||||
| 		function = "gpio"; | ||||
| 		drive-strength = <8>; | ||||
| 		bias-disable; | ||||
| 		output-high; | ||||
| 	}; | ||||
|  | ||||
| 	usb_hub_rst: usb_hub_rst_pins { | ||||
| 		pins = "gpio55"; | ||||
| 		function = "gpio"; | ||||
| 		drive-strength = <8>; | ||||
| 		bias-disable; | ||||
| 		output-high; | ||||
| 	}; | ||||
|  | ||||
| 	mdio_pins: mdio_pinmux { | ||||
| @@ -172,17 +225,7 @@ | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	hsuart_pins: hsuart_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio49"; | ||||
| 			function = "blsp2_uart"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	button_pins: button_pins { | ||||
|  | ||||
| 		reset_button { | ||||
| 			pins = "gpio66"; | ||||
| 			function = "gpio"; | ||||
| @@ -220,31 +263,6 @@ | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	usb_mux_sel_pins: usb_mux_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio27"; | ||||
| 			function = "gpio"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	pcie0_pins: pcie_pins { | ||||
| 		pcie0_rst { | ||||
| 			pins = "gpio58"; | ||||
| 			function = "pcie0_rst"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		pcie0_wake { | ||||
| 			pins = "gpio59"; | ||||
| 			function = "pcie0_wake"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
| @@ -733,12 +751,6 @@ | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &serial_blsp2 { | ||||
| 	pinctrl-0 = <&hsuart_pins>; | ||||
| 	pinctrl-names = "default"; | ||||
| 	status = "ok"; | ||||
| }; | ||||
|  | ||||
| &nss0 { | ||||
| 	qcom,low-frequency = <187200000>; | ||||
| 	qcom,mid-frequency = <748800000>; | ||||
| @@ -812,7 +824,7 @@ | ||||
| }; | ||||
|  | ||||
| &pcie0 { | ||||
| 	status = "ok"; | ||||
| 	status = "disabled"; | ||||
| }; | ||||
|  | ||||
| &pcie1 { | ||||
|   | ||||
| @@ -51,10 +51,21 @@ | ||||
| 		#ifdef __IPQ_MEM_PROFILE_256_MB__ | ||||
| 			bootargs-append = " swiotlb=1"; | ||||
| 		#else | ||||
| 			bootargs-append = " swiotlb=1 coherent_pool=2M"; | ||||
| 			bootargs-append = " swiotlb=1 coherent_pool=2M vmalloc=600M"; | ||||
| 		#endif | ||||
| 	}; | ||||
|  | ||||
| 	gpio-export { | ||||
| 		compatible = "gpio-export"; | ||||
| 		#size-cells = <0>; | ||||
|  | ||||
| 		mcu-enable { | ||||
| 			gpio-export,name = "mcu-enable"; | ||||
| 			gpio-export,output = <0>; | ||||
| 			gpios = <&tlmm 34 GPIO_ACTIVE_HIGH>; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	reserved-memory { | ||||
| /* No Pine attach in 256M profile */ | ||||
| #if !defined(__IPQ_MEM_PROFILE_256_MB__) | ||||
| @@ -155,28 +166,15 @@ | ||||
| }; | ||||
|  | ||||
| &tlmm { | ||||
| 	pinctrl-0 = <&btcoex_pins>; | ||||
| 	pinctrl-0 = <&mcu_rst>; | ||||
| 	pinctrl-names = "default"; | ||||
|  | ||||
| 	btcoex_pins: btcoex_pins { | ||||
| 		mux_0 { | ||||
| 			pins = "gpio64"; | ||||
| 			function = "pta1_1"; | ||||
| 			drive-strength = <6>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		mux_1 { | ||||
| 			pins = "gpio65"; | ||||
| 			function = "pta1_2"; | ||||
| 			drive-strength = <6>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 		mux_2 { | ||||
| 			pins = "gpio66"; | ||||
| 			function = "pta1_0"; | ||||
| 			drive-strength = <6>; | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	mcu_rst: mcu_rst_pins { | ||||
| 		pins = "gpio34"; | ||||
| 		function = "gpio"; | ||||
| 		drive-strength = <8>; | ||||
| 		bias-disable; | ||||
| 		output-low; | ||||
| 	}; | ||||
|  | ||||
| 	mdio_pins: mdio_pinmux { | ||||
| @@ -207,14 +205,15 @@ | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	i2c_5_pins: i2c_5_pinmux { | ||||
|                 mux { | ||||
|                         pins = "gpio0", "gpio2"; | ||||
|                         function = "blsp5_i2c"; | ||||
|                         drive-strength = <8>; | ||||
|                         bias-disable; | ||||
|                 }; | ||||
|         }; | ||||
| 		mux { | ||||
| 			pins = "gpio0", "gpio2"; | ||||
| 			function = "blsp5_i2c"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	spi_0_pins: spi_0_pins { | ||||
| 		mux { | ||||
| @@ -225,33 +224,6 @@ | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	spi_3_pins: spi_3_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio50", "gpio52", "gpio53"; | ||||
| 			function = "blsp3_spi"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 		spi_cs { | ||||
| 			pins = "gpio22"; | ||||
| 			function = "blsp3_spi2"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 		quartz_interrupt { | ||||
| 			pins = "gpio47"; | ||||
| 			function = "gpio"; | ||||
| 			input; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 		quartz_reset { | ||||
| 			pins = "gpio21"; | ||||
| 			function = "gpio"; | ||||
| 			output-low; | ||||
| 			bias-disable; | ||||
| 		}; | ||||
| 	}; | ||||
|  | ||||
| 	qpic_pins: qpic_pins { | ||||
| 		data_0 { | ||||
| 			pins = "gpio15"; | ||||
| @@ -312,7 +284,7 @@ | ||||
|  | ||||
| 	hsuart_pins: hsuart_pins { | ||||
| 		mux { | ||||
| 			pins = "gpio46", "gpio47", "gpio48", "gpio49"; | ||||
| 			pins = "gpio48", "gpio49"; | ||||
| 			function = "blsp2_uart"; | ||||
| 			drive-strength = <8>; | ||||
| 			bias-disable; | ||||
| @@ -320,7 +292,6 @@ | ||||
| 	}; | ||||
|  | ||||
| 	button_pins: button_pins { | ||||
|  | ||||
| 		wps_button { | ||||
| 			pins = "gpio67"; | ||||
| 			function = "gpio"; | ||||
| @@ -366,24 +337,24 @@ | ||||
| 			bias-pull-down; | ||||
| 		}; | ||||
| 	}; | ||||
| 	pwm_pins: pwm_pinmux { | ||||
|                 mux_1 { | ||||
|                         pins = "gpio25"; | ||||
|                         function = "pwm02"; | ||||
|                         drive-strength = <8>; | ||||
|                 }; | ||||
| 		mux_2 { | ||||
|                         pins = "gpio26"; | ||||
|                         function = "pwm12"; | ||||
|                         drive-strength = <8>; | ||||
|                 }; | ||||
| 		mux_3 { | ||||
|                         pins = "gpio27"; | ||||
|                         function = "pwm22"; | ||||
|                         drive-strength = <8>; | ||||
|                 }; | ||||
| 	}; | ||||
|  | ||||
| 	pwm_pins: pwm_pinmux { | ||||
| 		mux_1 { | ||||
| 			pins = "gpio25"; | ||||
| 			function = "pwm02"; | ||||
| 			drive-strength = <8>; | ||||
| 		}; | ||||
| 		mux_2 { | ||||
| 			pins = "gpio26"; | ||||
| 			function = "pwm12"; | ||||
| 			drive-strength = <8>; | ||||
| 		}; | ||||
| 		mux_3 { | ||||
| 			pins = "gpio27"; | ||||
| 			function = "pwm22"; | ||||
| 			drive-strength = <8>; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| &soc { | ||||
|   | ||||
| @@ -18,6 +18,35 @@ define Device/edgecore_eap104 | ||||
| endef | ||||
| TARGET_DEVICES += edgecore_eap104 | ||||
|  | ||||
| define Device/liteon_wpx8324 | ||||
|   DEVICE_TITLE := Liteon WPX8324 | ||||
|   DEVICE_DTS := qcom-ipq5018-liteon-wpx8324 | ||||
|   SUPPORTED_DEVICES := liteon,wpx8324 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-liteon-wpx8324 ath11k-firmware-ipq50xx-spruce ath11k-firmware-qcn6122 | ||||
|   DEVICE_DTS_CONFIG := config@mp03.5-c1 | ||||
| endef | ||||
| TARGET_DEVICES += liteon_wpx8324 | ||||
|  | ||||
| define Device/muxi_ap3220l | ||||
|   DEVICE_TITLE := MUXI AP3220L | ||||
|   DEVICE_DTS := qcom-ipq5018-muxi-ap3220l | ||||
|   SUPPORTED_DEVICES := muxi,ap3220l | ||||
|   DEVICE_PACKAGES := ath11k-wifi-muxi-ap3220l ath11k-firmware-ipq50xx-spruce ath11k-firmware-qcn6122 | ||||
|   DEVICE_DTS_CONFIG := config@mp03.5-c1 | ||||
| endef | ||||
| TARGET_DEVICES += muxi_ap3220l | ||||
|  | ||||
| define Device/motorola_q14 | ||||
|   DEVICE_TITLE := Motorola Q14 | ||||
|   DEVICE_DTS := qcom-ipq5018-q14 | ||||
|   SUPPORTED_DEVICES := motorola,q14 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-motorola-q14 ath11k-firmware-ipq50xx-spruce ath11k-firmware-qcn6122 | ||||
|   DEVICE_DTS_CONFIG := config@mp03.5-c1 | ||||
|   IMAGES := sysupgrade.tar mmc-factory.bin | ||||
|   IMAGE/mmc-factory.bin := append-ubi | qsdk-ipq-factory-mmc | ||||
| endef | ||||
| TARGET_DEVICES += motorola_q14 | ||||
|  | ||||
| define Device/qcom_mp03_1 | ||||
|   DEVICE_TITLE := Qualcomm Maple 03.1 | ||||
|   DEVICE_DTS := qcom-ipq5018-mp03.1 | ||||
|   | ||||
| @@ -1,15 +1,17 @@ | ||||
| KERNEL_LOADADDR := 0x41008000 | ||||
|  | ||||
| define Device/cig_wf188 | ||||
|   DEVICE_TITLE := Cigtech WF-188 | ||||
|   DEVICE_DTS := qcom-ipq6018-cig-wf188 | ||||
|   DEVICE_DTS_CONFIG := config@cp03-c1 | ||||
|   SUPPORTED_DEVICES := cig,wf188 | ||||
|   IMAGES := sysupgrade.tar | ||||
|   IMAGE/sysupgrade.tar/squashfs := append-rootfs | pad-rootfs | sysupgrade-tar rootfs=$$$$@ | append-metadata | ||||
|   DEVICE_PACKAGES := ath11k-wifi-cig-wf188 uboot-env | ||||
| DEVICE_VARS += CE_TYPE | ||||
|  | ||||
| define Device/cig_wf660a | ||||
|   DEVICE_TITLE := Cigtech WF-660a | ||||
|   DEVICE_DTS := qcom-ipq6018-cig-wf660a | ||||
|   SUPPORTED_DEVICES := cig,wf660a | ||||
|   DEVICE_DTS_CONFIG := config@cp01-c1 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-cig-wf660a uboot-env uboot-envtools | ||||
|   IMAGES := sysupgrade.tar mmc-factory.bin | ||||
|   IMAGE/mmc-factory.bin := append-ubi | qsdk-ipq-factory-mmc | ||||
| endef | ||||
| TARGET_DEVICES += cig_wf188 | ||||
| TARGET_DEVICES += cig_wf660a | ||||
|  | ||||
| define Device/cig_wf188n | ||||
|   DEVICE_TITLE := Cigtech WF-188n | ||||
| @@ -29,12 +31,30 @@ define Device/hfcl_ion4xe | ||||
| endef | ||||
| TARGET_DEVICES += hfcl_ion4xe | ||||
|  | ||||
| define Device/hfcl_ion4x | ||||
|   DEVICE_TITLE := HFCL ION4X | ||||
|   DEVICE_DTS := qcom-ipq6018-hfcl-ion4x | ||||
|   DEVICE_DTS_CONFIG := config@cp01-c1 | ||||
|   SUPPORTED_DEVICES := hfcl,ion4x | ||||
|   DEVICE_PACKAGES := ath11k-wifi-qcom-ipq6018 uboot-envtools | ||||
| endef | ||||
| TARGET_DEVICES += hfcl_ion4x | ||||
|  | ||||
| define Device/hfcl_ion4x_2 | ||||
|   DEVICE_TITLE := HFCL ION4X_2 | ||||
|   DEVICE_DTS := qcom-ipq6018-hfcl-ion4x_2 | ||||
|   DEVICE_DTS_CONFIG := config@cp01-c1 | ||||
|   SUPPORTED_DEVICES := hfcl,ion4x_2 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-qcom-ipq6018 uboot-envtools | ||||
| endef | ||||
| TARGET_DEVICES += hfcl_ion4x_2 | ||||
|  | ||||
| define Device/hfcl_ion4xi | ||||
|   DEVICE_TITLE := HFCL ION4Xi | ||||
|   DEVICE_DTS := qcom-ipq6018-hfcl-ion4xi | ||||
|   DEVICE_DTS_CONFIG := config@cp01-c1 | ||||
|   SUPPORTED_DEVICES := hfcl,ion4xi | ||||
|   DEVICE_PACKAGES := ath11k-wifi-qcom-ipq6018 uboot-envtools | ||||
|   DEVICE_PACKAGES := ath11k-wifi-hfcl-ion4xi uboot-envtools | ||||
| endef | ||||
| TARGET_DEVICES += hfcl_ion4xi | ||||
|  | ||||
| @@ -43,16 +63,43 @@ define Device/edgecore_eap101 | ||||
|   DEVICE_DTS := qcom-ipq6018-edgecore-eap101 | ||||
|   DEVICE_DTS_CONFIG := config@cp01-c1 | ||||
|   SUPPORTED_DEVICES := edgecore,eap101 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-edgecore-eap101 uboot-envtools | ||||
|   DEVICE_PACKAGES := ath11k-wifi-edgecore-eap101 uboot-envtools -kmod-usb-dwc3-of-simple kmod-usb-dwc3-qcom kmod-usb3 kmod-usb2 | ||||
| endef | ||||
| TARGET_DEVICES += edgecore_eap101 | ||||
|  | ||||
| define Device/indio_um-310ax-v1 | ||||
|   DEVICE_TITLE := Indio UM-310AX V1 | ||||
|   DEVICE_DTS := qcom-ipq6018-indio-um-310ax-v1 | ||||
|   DEVICE_DTS_CONFIG := config@cp03-c1 | ||||
|   SUPPORTED_DEVICES := indio,um-310ax-v1 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-indio-um-310ax-v1 uboot-env | ||||
| endef | ||||
| TARGET_DEVICES += indio_um-310ax-v1 | ||||
|  | ||||
| define Device/indio_um-510axp-v1 | ||||
|   DEVICE_TITLE := Indio UM-510AXP V1 | ||||
|   DEVICE_DTS := qcom-ipq6018-indio-um-510axp-v1 | ||||
|   DEVICE_DTS_CONFIG := config@cp03-c1 | ||||
|   SUPPORTED_DEVICES := indio,um-510axp-v1 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-indio-um-510axp-v1 uboot-env | ||||
| endef | ||||
| TARGET_DEVICES += indio_um-510axp-v1 | ||||
|  | ||||
| define Device/indio_um-510axm-v1 | ||||
|   DEVICE_TITLE := Indio UM-510AXM V1 | ||||
|   DEVICE_DTS := qcom-ipq6018-indio-um-510axm-v1 | ||||
|   DEVICE_DTS_CONFIG := config@cp03-c1 | ||||
|   SUPPORTED_DEVICES := indio,um-510axm-v1 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-indio-um-510axm-v1 uboot-env | ||||
| endef | ||||
| TARGET_DEVICES += indio_um-510axm-v1 | ||||
|  | ||||
| define Device/wallys_dr6018 | ||||
|   DEVICE_TITLE := Wallys DR6018 | ||||
|   DEVICE_DTS := qcom-ipq6018-wallys-dr6018 | ||||
|   DEVICE_DTS_CONFIG := config@cp01-c4 | ||||
|   SUPPORTED_DEVICES := wallys,dr6018 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-wallys-dr6018 uboot-envtools | ||||
|   DEVICE_PACKAGES := ath11k-wifi-wallys-dr6018 uboot-envtools -kmod-usb-dwc3-of-simple kmod-usb-dwc3-qcom kmod-usb3 kmod-usb2 | ||||
| endef | ||||
| TARGET_DEVICES += wallys_dr6018 | ||||
|  | ||||
| @@ -61,7 +108,7 @@ define Device/wallys_dr6018_v4 | ||||
|   DEVICE_DTS := qcom-ipq6018-wallys-dr6018-v4 | ||||
|   DEVICE_DTS_CONFIG := config@cp01-c4 | ||||
|   SUPPORTED_DEVICES := wallys,dr6018-v4 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-wallys-dr6018-v4 uboot-envtools | ||||
|   DEVICE_PACKAGES := ath11k-wifi-wallys-dr6018-v4 uboot-envtools ath11k-firmware-qcn9000 | ||||
| endef | ||||
| TARGET_DEVICES += wallys_dr6018_v4 | ||||
|  | ||||
| @@ -72,3 +119,90 @@ define Device/qcom_cp01_c1 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-qcom-ipq6018 | ||||
| endef | ||||
| TARGET_DEVICES += qcom_cp01_c1 | ||||
|  | ||||
| define Device/glinet_ax1800 | ||||
|   DEVICE_TITLE := GL-iNet AX1800 | ||||
|   DEVICE_DTS := qcom-ipq6018-gl-ax1800 | ||||
|   SUPPORTED_DEVICES := glinet,ax1800 | ||||
|   DEVICE_DTS_CONFIG := config@cp03-c1 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-gl-ax1800 -kmod-usb-dwc3-of-simple kmod-usb-dwc3-qcom kmod-usb3 | ||||
| endef | ||||
| TARGET_DEVICES += glinet_ax1800 | ||||
|  | ||||
| define Device/glinet_axt1800 | ||||
|   DEVICE_TITLE := GL-iNet AXT1800 | ||||
|   DEVICE_DTS := qcom-ipq6018-gl-axt1800 | ||||
|   SUPPORTED_DEVICES := glinet,axt1800 | ||||
|   DEVICE_DTS_CONFIG := config@cp03-c1 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-gl-axt1800 -kmod-usb-dwc3-of-simple kmod-usb-dwc3-qcom kmod-usb3 | ||||
| endef | ||||
| TARGET_DEVICES += glinet_axt1800 | ||||
|  | ||||
| define Device/yuncore_ax840 | ||||
|   DEVICE_TITLE := YunCore AX840 | ||||
|   DEVICE_DTS := qcom-ipq6018-yuncore-ax840 | ||||
|   DEVICE_DTS_CONFIG := config@cp03-c1 | ||||
|   SUPPORTED_DEVICES := yuncore,ax840 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-yuncore-ax840 uboot-env | ||||
| endef | ||||
| TARGET_DEVICES += yuncore_ax840 | ||||
|  | ||||
| define Device/plasmacloud_common_64k | ||||
|   DEVICE_PACKAGES := uboot-envtools | ||||
|   CE_TYPE := | ||||
|   BLOCKSIZE := 64k | ||||
|   IMAGES := sysupgrade.tar factory.bin | ||||
|   IMAGE/factory.bin := append-rootfs | pad-rootfs | openmesh-image ce_type=$$$$(CE_TYPE) | ||||
|   IMAGE/sysupgrade.tar := append-rootfs | pad-rootfs | sysupgrade-tar rootfs=$$$$@ | append-metadata | ||||
|   KERNEL += | pad-to $$(BLOCKSIZE) | ||||
| endef | ||||
|  | ||||
| define Device/plasmacloud_pax1800-v1 | ||||
|   $(Device/plasmacloud_common_64k) | ||||
|   DEVICE_TITLE := Plasma Cloud PAX1800 v1 | ||||
|   DEVICE_DTS := qcom-ipq6018-pax1800-v1 | ||||
|   SUPPORTED_DEVICES := plasmacloud,pax1800-v1 | ||||
|   DEVICE_DTS_CONFIG := config@cp03-c1 | ||||
|   CE_TYPE := PAX1800 | ||||
|   DEVICE_PACKAGES += ath11k-wifi-plasmacloud-pax1800 | ||||
| endef | ||||
| TARGET_DEVICES += plasmacloud_pax1800-v1 | ||||
|  | ||||
| define Device/plasmacloud_pax1800-v2 | ||||
|   $(Device/plasmacloud_common_64k) | ||||
|   DEVICE_TITLE := Plasma Cloud PAX1800 v2 | ||||
|   DEVICE_DTS := qcom-ipq6018-pax1800-v2 | ||||
|   SUPPORTED_DEVICES := plasmacloud,pax1800-v2 | ||||
|   DEVICE_DTS_CONFIG := config@plasmacloud.pax1800v2 | ||||
|   CE_TYPE := PAX1800v2 | ||||
|   DEVICE_PACKAGES += ath11k-wifi-plasmacloud-pax1800 | ||||
| endef | ||||
| TARGET_DEVICES += plasmacloud_pax1800-v2 | ||||
|  | ||||
| define Device/meshpp_s618_cp03 | ||||
|   DEVICE_TITLE := S618 cp03 | ||||
|   DEVICE_DTS := qcom-ipq6018-meshpp-s618-cp03 | ||||
|   SUPPORTED_DEVICES := meshpp,s618-cp03 | ||||
|   DEVICE_DTS_CONFIG := config@cp03-c1 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-meshpp-s618 -kmod-usb-dwc3-of-simple kmod-usb-dwc3-qcom kmod-usb3 | ||||
| endef | ||||
| TARGET_DEVICES += meshpp_s618_cp03 | ||||
|  | ||||
| define Device/meshpp_s618_cp01 | ||||
|   DEVICE_TITLE := S618 cp01 | ||||
|   DEVICE_DTS := qcom-ipq6018-meshpp-s618-cp01 | ||||
|   SUPPORTED_DEVICES := meshpp,s618-cp01 | ||||
|   DEVICE_DTS_CONFIG := config@cp01-c1 | ||||
|   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 | ||||
|  | ||||
|   | ||||
| @@ -36,22 +36,39 @@ define Device/cig_wf194c4 | ||||
| endef | ||||
| TARGET_DEVICES += cig_wf194c4 | ||||
|  | ||||
| define Device/cig_wf196 | ||||
|   DEVICE_TITLE := CIG WF196 | ||||
| define Device/cig_wf196_us | ||||
|   DEVICE_TITLE := CIG WF196 (US) | ||||
|   DEVICE_DTS := qcom-ipq807x-wf196 | ||||
|   DEVICE_DTS_CONFIG=config@hk14 | ||||
|   SUPPORTED_DEVICES := cig,wf196 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-cig-wf196 aq-fw-download uboot-envtools kmod-usb3 kmod-usb2 \ | ||||
|   	ath11k-firmware-qcn9000 ath11k-wifi-cig-wf196_6g | ||||
|   BLOCKSIZE := 256k | ||||
|   PAGESIZE := 4096 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-cig-wf196-us aq-fw-download uboot-envtools kmod-usb3 kmod-usb2 \ | ||||
| 	ath11k-firmware-qcn9000 ath11k-wifi-cig-wf196_6g-us \ | ||||
| 	zephyr-v3.3.x-hci_uart-cig_wf196_nrf52833 | ||||
| endef | ||||
| TARGET_DEVICES += cig_wf196 | ||||
| TARGET_DEVICES += cig_wf196_us | ||||
|  | ||||
| define Device/cig_wf196_ca | ||||
|   DEVICE_TITLE := CIG WF196 (CA) | ||||
|   DEVICE_DTS := qcom-ipq807x-wf196 | ||||
|   DEVICE_DTS_CONFIG=config@hk14 | ||||
|   SUPPORTED_DEVICES := cig,wf196 | ||||
|   BLOCKSIZE := 256k | ||||
|   PAGESIZE := 4096 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-cig-wf196-ca aq-fw-download uboot-envtools kmod-usb3 kmod-usb2 \ | ||||
| 	ath11k-firmware-qcn9000 ath11k-wifi-cig-wf196_6g-ca \ | ||||
| 	zephyr-v3.3.x-hci_uart-cig_wf196_nrf52833 | ||||
| endef | ||||
| TARGET_DEVICES += cig_wf196_ca | ||||
|  | ||||
| define Device/edgecore_eap102 | ||||
|   DEVICE_TITLE := Edgecore EAP102 | ||||
|   DEVICE_DTS := qcom-ipq807x-eap102 | ||||
|   DEVICE_DTS_CONFIG=config@ac02 | ||||
|   SUPPORTED_DEVICES := edgecore,eap102 | ||||
|   DEVICE_PACKAGES := ath11k-wifi-edgecore-eap102 kmod-usb2 kmod-usb3 uboot-envtools | ||||
|   DEVICE_PACKAGES := ath11k-wifi-edgecore-eap102 kmod-usb2 kmod-usb3 uboot-envtools \ | ||||
| 	zephyr-v3.3.x-hci_usb-edgecore_eap102_nrf52840 | ||||
| endef | ||||
| TARGET_DEVICES += edgecore_eap102 | ||||
|  | ||||
|   | ||||
| @@ -111,3 +111,22 @@ define KernelPackage/diag-char/description | ||||
| endef | ||||
|  | ||||
| $(eval $(call KernelPackage,diag-char)) | ||||
|  | ||||
| define KernelPackage/usb-dwc3-qcom | ||||
|   TITLE:=DWC3 Qualcomm USB driver | ||||
|   DEPENDS:=@(!LINUX_4_14) @TARGET_ipq807x +kmod-usb-dwc3 | ||||
|   KCONFIG:= CONFIG_USB_DWC3_QCOM | ||||
|   FILES:= $(LINUX_DIR)/drivers/usb/dwc3/dwc3-qcom.ko \ | ||||
|         $(LINUX_DIR)/drivers/usb/dwc3/dbm.ko | ||||
|   AUTOLOAD:=$(call AutoLoad,53,dwc3-qcom dbm,1) | ||||
|   $(call AddDepends/usb) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/usb-dwc3-qcom/description | ||||
|  Some Qualcomm SoCs use DesignWare Core IP for USB2/3 functionality. | ||||
|  This driver also handles Qscratch wrapper which is needed for | ||||
|  peripheral mode support. | ||||
| endef | ||||
|  | ||||
|  | ||||
| $(eval $(call KernelPackage,usb-dwc3-qcom)) | ||||
|   | ||||
							
								
								
									
										25
									
								
								feeds/ipq807x/ipq807x/patches/001-backport_kbuild_fix.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								feeds/ipq807x/ipq807x/patches/001-backport_kbuild_fix.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| --- a/scripts/Makefile.lib | ||||
| +++ b/scripts/Makefile.lib | ||||
| @@ -96,10 +96,10 @@ obj-dirs	:= $(addprefix $(obj)/,$(obj-di | ||||
|  # Note: Files that end up in two or more modules are compiled without the | ||||
|  #       KBUILD_MODNAME definition. The reason is that any made-up name would | ||||
|  #       differ in different configs. | ||||
| -name-fix = $(subst $(comma),_,$(subst -,_,$1)) | ||||
| -basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" | ||||
| +name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote) | ||||
| +basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget)) | ||||
|  modname_flags  = $(if $(filter 1,$(words $(modname))),\ | ||||
| -                 -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") | ||||
| +                 -DKBUILD_MODNAME=$(call name-fix,$(modname))) | ||||
|   | ||||
|  orig_c_flags   = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \ | ||||
|                   $(ccflags-y) $(CFLAGS_$(basetarget).o) | ||||
| @@ -155,7 +155,7 @@ endif | ||||
|   | ||||
|  c_flags        = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \ | ||||
|  		 $(__c_flags) $(modkern_cflags)                           \ | ||||
| -		 -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) | ||||
| +		 $(basename_flags) $(modname_flags) | ||||
|   | ||||
|  a_flags        = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \ | ||||
|  		 $(__a_flags) $(modkern_aflags) | ||||
| @@ -32856,7 +32856,7 @@ | ||||
| +
 | ||||
| +	new_range = dst_reg->off;
 | ||||
| +	if (range_right_open)
 | ||||
| +		new_range--;
 | ||||
| +		new_range++;
 | ||||
| +
 | ||||
| +	/* Examples for register markings:
 | ||||
| +	 *
 | ||||
|   | ||||
| @@ -0,0 +1,88 @@ | ||||
| From: Felix Fietkau <nbd@nbd.name> | ||||
| Date: Mon, 8 Feb 2021 11:34:08 -0800 | ||||
| Subject: [PATCH] net: extract napi poll functionality to __napi_poll() | ||||
|  | ||||
| This commit introduces a new function __napi_poll() which does the main | ||||
| logic of the existing napi_poll() function, and will be called by other | ||||
| functions in later commits. | ||||
| This idea and implementation is done by Felix Fietkau <nbd@nbd.name> and | ||||
| is proposed as part of the patch to move napi work to work_queue | ||||
| context. | ||||
| This commit by itself is a code restructure. | ||||
|  | ||||
| Signed-off-by: Felix Fietkau <nbd@nbd.name> | ||||
| Signed-off-by: Wei Wang <weiwan@google.com> | ||||
| Reviewed-by: Alexander Duyck <alexanderduyck@fb.com> | ||||
| Signed-off-by: David S. Miller <davem@davemloft.net> | ||||
| --- | ||||
|  | ||||
| --- a/net/core/dev.c | ||||
| +++ b/net/core/dev.c | ||||
| @@ -6322,15 +6322,10 @@ void netif_napi_del(struct napi_struct * | ||||
|  } | ||||
|  EXPORT_SYMBOL(netif_napi_del); | ||||
|   | ||||
| -static int napi_poll(struct napi_struct *n, struct list_head *repoll) | ||||
| +static int __napi_poll(struct napi_struct *n, bool *repoll) | ||||
|  { | ||||
| -	void *have; | ||||
|  	int work, weight; | ||||
|   | ||||
| -	list_del_init(&n->poll_list); | ||||
| - | ||||
| -	have = netpoll_poll_lock(n); | ||||
| - | ||||
|  	weight = n->weight; | ||||
|   | ||||
|  	/* This NAPI_STATE_SCHED test is for avoiding a race | ||||
| @@ -6348,7 +6343,7 @@ static int napi_poll(struct napi_struct | ||||
|  	WARN_ON_ONCE(work > weight); | ||||
|   | ||||
|  	if (likely(work < weight)) | ||||
| -		goto out_unlock; | ||||
| +		return work; | ||||
|   | ||||
|  	/* Drivers must not modify the NAPI state if they | ||||
|  	 * consume the entire weight.  In such cases this code | ||||
| @@ -6357,7 +6352,7 @@ static int napi_poll(struct napi_struct | ||||
|  	 */ | ||||
|  	if (unlikely(napi_disable_pending(n))) { | ||||
|  		napi_complete(n); | ||||
| -		goto out_unlock; | ||||
| +		return work; | ||||
|  	} | ||||
|   | ||||
|  	if (n->gro_bitmask) { | ||||
| @@ -6375,12 +6370,29 @@ static int napi_poll(struct napi_struct | ||||
|  	if (unlikely(!list_empty(&n->poll_list))) { | ||||
|  		pr_warn_once("%s: Budget exhausted after napi rescheduled\n", | ||||
|  			     n->dev ? n->dev->name : "backlog"); | ||||
| -		goto out_unlock; | ||||
| +		return work; | ||||
|  	} | ||||
|   | ||||
| -	list_add_tail(&n->poll_list, repoll); | ||||
| +	*repoll = true; | ||||
| + | ||||
| +	return work; | ||||
| +} | ||||
| + | ||||
| +static int napi_poll(struct napi_struct *n, struct list_head *repoll) | ||||
| +{ | ||||
| +	bool do_repoll = false; | ||||
| +	void *have; | ||||
| +	int work; | ||||
| + | ||||
| +	list_del_init(&n->poll_list); | ||||
| + | ||||
| +	have = netpoll_poll_lock(n); | ||||
| + | ||||
| +	work = __napi_poll(n, &do_repoll); | ||||
| + | ||||
| +	if (do_repoll) | ||||
| +		list_add_tail(&n->poll_list, repoll); | ||||
|   | ||||
| -out_unlock: | ||||
|  	netpoll_poll_unlock(have); | ||||
|   | ||||
|  	return work; | ||||
| @@ -0,0 +1,245 @@ | ||||
| From: Wei Wang <weiwan@google.com> | ||||
| Date: Mon, 8 Feb 2021 11:34:09 -0800 | ||||
| Subject: [PATCH] net: implement threaded-able napi poll loop support | ||||
|  | ||||
| This patch allows running each napi poll loop inside its own | ||||
| kernel thread. | ||||
| The kthread is created during netif_napi_add() if dev->threaded | ||||
| is set. And threaded mode is enabled in napi_enable(). We will | ||||
| provide a way to set dev->threaded and enable threaded mode | ||||
| without a device up/down in the following patch. | ||||
|  | ||||
| Once that threaded mode is enabled and the kthread is | ||||
| started, napi_schedule() will wake-up such thread instead | ||||
| of scheduling the softirq. | ||||
|  | ||||
| The threaded poll loop behaves quite likely the net_rx_action, | ||||
| but it does not have to manipulate local irqs and uses | ||||
| an explicit scheduling point based on netdev_budget. | ||||
|  | ||||
| Co-developed-by: Paolo Abeni <pabeni@redhat.com> | ||||
| Signed-off-by: Paolo Abeni <pabeni@redhat.com> | ||||
| Co-developed-by: Hannes Frederic Sowa <hannes@stressinduktion.org> | ||||
| Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> | ||||
| Co-developed-by: Jakub Kicinski <kuba@kernel.org> | ||||
| Signed-off-by: Jakub Kicinski <kuba@kernel.org> | ||||
| Signed-off-by: Wei Wang <weiwan@google.com> | ||||
| Reviewed-by: Alexander Duyck <alexanderduyck@fb.com> | ||||
| Signed-off-by: David S. Miller <davem@davemloft.net> | ||||
| --- | ||||
|  | ||||
| --- a/include/linux/netdevice.h | ||||
| +++ b/include/linux/netdevice.h | ||||
| @@ -319,6 +319,7 @@ struct napi_struct { | ||||
|  	struct list_head	dev_list; | ||||
|  	struct hlist_node	napi_hash_node; | ||||
|  	unsigned int		napi_id; | ||||
| +	struct task_struct	*thread; | ||||
|  }; | ||||
|   | ||||
|  enum { | ||||
| @@ -326,6 +327,7 @@ enum { | ||||
|  	NAPI_STATE_DISABLE,	/* Disable pending */ | ||||
|  	NAPI_STATE_NPSVC,	/* Netpoll - don't dequeue from poll_list */ | ||||
|  	NAPI_STATE_HASHED,	/* In NAPI hash */ | ||||
| +	NAPI_STATE_THREADED,	/* The poll is performed inside its own thread*/ | ||||
|  }; | ||||
|   | ||||
|  enum gro_result { | ||||
| @@ -501,13 +503,7 @@ void napi_disable(struct napi_struct *n) | ||||
|   * Resume NAPI from being scheduled on this context. | ||||
|   * Must be paired with napi_disable. | ||||
|   */ | ||||
| -static inline void napi_enable(struct napi_struct *n) | ||||
| -{ | ||||
| -	BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); | ||||
| -	smp_mb__before_atomic(); | ||||
| -	clear_bit(NAPI_STATE_SCHED, &n->state); | ||||
| -	clear_bit(NAPI_STATE_NPSVC, &n->state); | ||||
| -} | ||||
| +void napi_enable(struct napi_struct *n); | ||||
|   | ||||
|  /** | ||||
|   *	napi_synchronize - wait until NAPI is not running | ||||
| @@ -1573,6 +1569,8 @@ enum netdev_priv_flags_ext { | ||||
|   *			switch driver and used to set the phys state of the | ||||
|   *			switch port. | ||||
|   * | ||||
| + *	@threaded:	napi threaded mode is enabled | ||||
| + * | ||||
|   *	FIXME: cleanup struct net_device such that network protocol info | ||||
|   *	moves out. | ||||
|   */ | ||||
| @@ -1852,6 +1850,7 @@ struct net_device { | ||||
|  	struct phy_device *phydev; | ||||
|  	struct lock_class_key *qdisc_tx_busylock; | ||||
|  	bool proto_down; | ||||
| +	unsigned		threaded:1; | ||||
|  }; | ||||
|  #define to_net_dev(d) container_of(d, struct net_device, dev) | ||||
|   | ||||
| --- a/net/core/dev.c | ||||
| +++ b/net/core/dev.c | ||||
| @@ -94,6 +94,7 @@ | ||||
|  #include <linux/ethtool.h> | ||||
|  #include <linux/notifier.h> | ||||
|  #include <linux/skbuff.h> | ||||
| +#include <linux/kthread.h> | ||||
|  #include <net/net_namespace.h> | ||||
|  #include <net/sock.h> | ||||
|  #include <linux/rtnetlink.h> | ||||
| @@ -1304,6 +1305,27 @@ void netdev_notify_peers(struct net_devi | ||||
|  } | ||||
|  EXPORT_SYMBOL(netdev_notify_peers); | ||||
|   | ||||
| +static int napi_threaded_poll(void *data); | ||||
| + | ||||
| +static int napi_kthread_create(struct napi_struct *n) | ||||
| +{ | ||||
| +	int err = 0; | ||||
| + | ||||
| +	/* Create and wake up the kthread once to put it in | ||||
| +	 * TASK_INTERRUPTIBLE mode to avoid the blocked task | ||||
| +	 * warning and work with loadavg. | ||||
| +	 */ | ||||
| +	n->thread = kthread_run(napi_threaded_poll, n, "napi/%s-%d", | ||||
| +				n->dev->name, n->napi_id); | ||||
| +	if (IS_ERR(n->thread)) { | ||||
| +		err = PTR_ERR(n->thread); | ||||
| +		pr_err("kthread_run failed with err %d\n", err); | ||||
| +		n->thread = NULL; | ||||
| +	} | ||||
| + | ||||
| +	return err; | ||||
| +} | ||||
| + | ||||
|  static int __dev_open(struct net_device *dev) | ||||
|  { | ||||
|  	const struct net_device_ops *ops = dev->netdev_ops; | ||||
| @@ -3248,6 +3270,21 @@ int weight_p __read_mostly = 64; | ||||
|  static inline void ____napi_schedule(struct softnet_data *sd, | ||||
|  				     struct napi_struct *napi) | ||||
|  { | ||||
| +	struct task_struct *thread; | ||||
| + | ||||
| +	if (test_bit(NAPI_STATE_THREADED, &napi->state)) { | ||||
| +		/* Paired with smp_mb__before_atomic() in | ||||
| +		 * napi_enable(). Use READ_ONCE() to guarantee | ||||
| +		 * a complete read on napi->thread. Only call | ||||
| +		 * wake_up_process() when it's not NULL. | ||||
| +		 */ | ||||
| +		thread = READ_ONCE(napi->thread); | ||||
| +		if (thread) { | ||||
| +			wake_up_process(thread); | ||||
| +			return; | ||||
| +		} | ||||
| +	} | ||||
| + | ||||
|  	list_add_tail(&napi->poll_list, &sd->poll_list); | ||||
|  	__raise_softirq_irqoff(NET_RX_SOFTIRQ); | ||||
|  } | ||||
| @@ -4828,9 +4865,33 @@ void netif_napi_add(struct net_device *d | ||||
|  	napi->poll_owner = -1; | ||||
|  #endif | ||||
|  	set_bit(NAPI_STATE_SCHED, &napi->state); | ||||
| +	/* Create kthread for this napi if dev->threaded is set. | ||||
| +	 * Clear dev->threaded if kthread creation failed so that | ||||
| +	 * threaded mode will not be enabled in napi_enable(). | ||||
| +	 */ | ||||
| +	if (dev->threaded && napi_kthread_create(napi)) | ||||
| +		dev->threaded = 0; | ||||
|  } | ||||
|  EXPORT_SYMBOL(netif_napi_add); | ||||
|   | ||||
| +/** | ||||
| + *	napi_enable - enable NAPI scheduling | ||||
| + *	@n: NAPI context | ||||
| + * | ||||
| + * Resume NAPI from being scheduled on this context. | ||||
| + * Must be paired with napi_disable. | ||||
| + */ | ||||
| +void napi_enable(struct napi_struct *n) | ||||
| +{ | ||||
| +	BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); | ||||
| +	smp_mb__before_atomic(); | ||||
| +	clear_bit(NAPI_STATE_SCHED, &n->state); | ||||
| +	clear_bit(NAPI_STATE_NPSVC, &n->state); | ||||
| +	if (n->dev->threaded && n->thread) | ||||
| +		set_bit(NAPI_STATE_THREADED, &n->state); | ||||
| +} | ||||
| +EXPORT_SYMBOL(napi_enable); | ||||
| + | ||||
|  void napi_disable(struct napi_struct *n) | ||||
|  { | ||||
|  	might_sleep(); | ||||
| @@ -4844,6 +4905,7 @@ void napi_disable(struct napi_struct *n) | ||||
|  	hrtimer_cancel(&n->timer); | ||||
|   | ||||
|  	clear_bit(NAPI_STATE_DISABLE, &n->state); | ||||
| +	clear_bit(NAPI_STATE_THREADED, &n->state); | ||||
|  } | ||||
|  EXPORT_SYMBOL(napi_disable); | ||||
|   | ||||
| @@ -4855,6 +4917,11 @@ void netif_napi_del(struct napi_struct * | ||||
|  	kfree_skb_list(napi->gro_list); | ||||
|  	napi->gro_list = NULL; | ||||
|  	napi->gro_count = 0; | ||||
| + | ||||
| +	if (napi->thread) { | ||||
| +		kthread_stop(napi->thread); | ||||
| +		napi->thread = NULL; | ||||
| +	} | ||||
|  } | ||||
|  EXPORT_SYMBOL(netif_napi_del); | ||||
|   | ||||
| @@ -4940,6 +5007,50 @@ static int napi_poll(struct napi_struct | ||||
|  	return work; | ||||
|  } | ||||
|   | ||||
| +static int napi_thread_wait(struct napi_struct *napi) | ||||
| +{ | ||||
| +	set_current_state(TASK_INTERRUPTIBLE); | ||||
| + | ||||
| +	while (!kthread_should_stop() && !napi_disable_pending(napi)) { | ||||
| +		if (test_bit(NAPI_STATE_SCHED, &napi->state)) { | ||||
| +			WARN_ON(!list_empty(&napi->poll_list)); | ||||
| +			__set_current_state(TASK_RUNNING); | ||||
| +			return 0; | ||||
| +		} | ||||
| + | ||||
| +		schedule(); | ||||
| +		set_current_state(TASK_INTERRUPTIBLE); | ||||
| +	} | ||||
| +	__set_current_state(TASK_RUNNING); | ||||
| +	return -1; | ||||
| +} | ||||
| + | ||||
| +static int napi_threaded_poll(void *data) | ||||
| +{ | ||||
| +	struct napi_struct *napi = data; | ||||
| +	void *have; | ||||
| + | ||||
| +	while (!napi_thread_wait(napi)) { | ||||
| +		for (;;) { | ||||
| +			bool repoll = false; | ||||
| + | ||||
| +			local_bh_disable(); | ||||
| + | ||||
| +			have = netpoll_poll_lock(napi); | ||||
| +			__napi_poll(napi, &repoll); | ||||
| +			netpoll_poll_unlock(have); | ||||
| + | ||||
| +			local_bh_enable(); | ||||
| + | ||||
| +			if (!repoll) | ||||
| +				break; | ||||
| + | ||||
| +			cond_resched(); | ||||
| +		} | ||||
| +	} | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
|  static void net_rx_action(struct softirq_action *h) | ||||
|  { | ||||
|  	struct softnet_data *sd = this_cpu_ptr(&softnet_data); | ||||
| @@ -0,0 +1,156 @@ | ||||
| From: Wei Wang <weiwan@google.com> | ||||
| Date: Mon, 8 Feb 2021 11:34:10 -0800 | ||||
| Subject: [PATCH] net: add sysfs attribute to control napi threaded mode | ||||
|  | ||||
| This patch adds a new sysfs attribute to the network device class. | ||||
| Said attribute provides a per-device control to enable/disable the | ||||
| threaded mode for all the napi instances of the given network device, | ||||
| without the need for a device up/down. | ||||
| User sets it to 1 or 0 to enable or disable threaded mode. | ||||
| Note: when switching between threaded and the current softirq based mode | ||||
| for a napi instance, it will not immediately take effect if the napi is | ||||
| currently being polled. The mode switch will happen for the next time | ||||
| napi_schedule() is called. | ||||
|  | ||||
| Co-developed-by: Paolo Abeni <pabeni@redhat.com> | ||||
| Signed-off-by: Paolo Abeni <pabeni@redhat.com> | ||||
| Co-developed-by: Hannes Frederic Sowa <hannes@stressinduktion.org> | ||||
| Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> | ||||
| Co-developed-by: Felix Fietkau <nbd@nbd.name> | ||||
| Signed-off-by: Felix Fietkau <nbd@nbd.name> | ||||
| Signed-off-by: Wei Wang <weiwan@google.com> | ||||
| Reviewed-by: Alexander Duyck <alexanderduyck@fb.com> | ||||
| Signed-off-by: David S. Miller <davem@davemloft.net> | ||||
| --- | ||||
|  | ||||
| --- a/include/linux/netdevice.h | ||||
| +++ b/include/linux/netdevice.h | ||||
| @@ -496,6 +496,8 @@ void napi_hash_del(struct napi_struct *n | ||||
|   */ | ||||
|  void napi_disable(struct napi_struct *n); | ||||
|   | ||||
| +int dev_set_threaded(struct net_device *dev, bool threaded); | ||||
| + | ||||
|  /** | ||||
|   *	napi_enable - enable NAPI scheduling | ||||
|   *	@n: napi context | ||||
| --- a/net/core/dev.c | ||||
| +++ b/net/core/dev.c | ||||
| @@ -3274,8 +3274,9 @@ static inline void ____napi_schedule(str | ||||
|   | ||||
|  	if (test_bit(NAPI_STATE_THREADED, &napi->state)) { | ||||
|  		/* Paired with smp_mb__before_atomic() in | ||||
| -		 * napi_enable(). Use READ_ONCE() to guarantee | ||||
| -		 * a complete read on napi->thread. Only call | ||||
| +		 * napi_enable()/dev_set_threaded(). | ||||
| +		 * Use READ_ONCE() to guarantee a complete | ||||
| +		 * read on napi->thread. Only call | ||||
|  		 * wake_up_process() when it's not NULL. | ||||
|  		 */ | ||||
|  		thread = READ_ONCE(napi->thread); | ||||
| @@ -4844,6 +4845,49 @@ static enum hrtimer_restart napi_watchdo | ||||
|  	return HRTIMER_NORESTART; | ||||
|  } | ||||
|   | ||||
| +int dev_set_threaded(struct net_device *dev, bool threaded) | ||||
| +{ | ||||
| +	struct napi_struct *napi; | ||||
| +	int err = 0; | ||||
| + | ||||
| +	if (dev->threaded == threaded) | ||||
| +		return 0; | ||||
| + | ||||
| +	if (threaded) { | ||||
| +		list_for_each_entry(napi, &dev->napi_list, dev_list) { | ||||
| +			if (!napi->thread) { | ||||
| +				err = napi_kthread_create(napi); | ||||
| +				if (err) { | ||||
| +					threaded = false; | ||||
| +					break; | ||||
| +				} | ||||
| +			} | ||||
| +		} | ||||
| +	} | ||||
| + | ||||
| +	dev->threaded = threaded; | ||||
| + | ||||
| +	/* Make sure kthread is created before THREADED bit | ||||
| +	 * is set. | ||||
| +	 */ | ||||
| +	smp_mb__before_atomic(); | ||||
| + | ||||
| +	/* Setting/unsetting threaded mode on a napi might not immediately | ||||
| +	 * take effect, if the current napi instance is actively being | ||||
| +	 * polled. In this case, the switch between threaded mode and | ||||
| +	 * softirq mode will happen in the next round of napi_schedule(). | ||||
| +	 * This should not cause hiccups/stalls to the live traffic. | ||||
| +	 */ | ||||
| +	list_for_each_entry(napi, &dev->napi_list, dev_list) { | ||||
| +		if (threaded) | ||||
| +			set_bit(NAPI_STATE_THREADED, &napi->state); | ||||
| +		else | ||||
| +			clear_bit(NAPI_STATE_THREADED, &napi->state); | ||||
| +	} | ||||
| + | ||||
| +	return err; | ||||
| +} | ||||
| + | ||||
|  void netif_napi_add(struct net_device *dev, struct napi_struct *napi, | ||||
|  		    int (*poll)(struct napi_struct *, int), int weight) | ||||
|  { | ||||
| --- a/net/core/net-sysfs.c | ||||
| +++ b/net/core/net-sysfs.c | ||||
| @@ -486,6 +486,45 @@ static ssize_t phys_switch_id_show(struc | ||||
|  } | ||||
|  static DEVICE_ATTR_RO(phys_switch_id); | ||||
|   | ||||
| +static ssize_t threaded_show(struct device *dev, | ||||
| +			     struct device_attribute *attr, char *buf) | ||||
| +{ | ||||
| +	struct net_device *netdev = to_net_dev(dev); | ||||
| +	ssize_t ret = -EINVAL; | ||||
| + | ||||
| +	if (!rtnl_trylock()) | ||||
| +		return restart_syscall(); | ||||
| + | ||||
| +	if (dev_isalive(netdev)) | ||||
| +		ret = sprintf(buf, fmt_dec, netdev->threaded); | ||||
| + | ||||
| +	rtnl_unlock(); | ||||
| +	return ret; | ||||
| +} | ||||
| + | ||||
| +static int modify_napi_threaded(struct net_device *dev, unsigned long val) | ||||
| +{ | ||||
| +	int ret; | ||||
| + | ||||
| +	if (list_empty(&dev->napi_list)) | ||||
| +		return -EOPNOTSUPP; | ||||
| + | ||||
| +	if (val != 0 && val != 1) | ||||
| +		return -EOPNOTSUPP; | ||||
| + | ||||
| +	ret = dev_set_threaded(dev, val); | ||||
| + | ||||
| +	return ret; | ||||
| +} | ||||
| + | ||||
| +static ssize_t threaded_store(struct device *dev, | ||||
| +			      struct device_attribute *attr, | ||||
| +			      const char *buf, size_t len) | ||||
| +{ | ||||
| +	return netdev_store(dev, attr, buf, len, modify_napi_threaded); | ||||
| +} | ||||
| +static DEVICE_ATTR_RW(threaded); | ||||
| + | ||||
|  static struct attribute *net_class_attrs[] = { | ||||
|  	&dev_attr_netdev_group.attr, | ||||
|  	&dev_attr_type.attr, | ||||
| @@ -514,6 +553,7 @@ static struct attribute *net_class_attrs | ||||
|  	&dev_attr_phys_port_name.attr, | ||||
|  	&dev_attr_phys_switch_id.attr, | ||||
|  	&dev_attr_proto_down.attr, | ||||
| +	&dev_attr_threaded.attr, | ||||
|  	NULL, | ||||
|  }; | ||||
|  ATTRIBUTE_GROUPS(net_class); | ||||
| @@ -0,0 +1,118 @@ | ||||
| From: Wei Wang <weiwan@google.com> | ||||
| Date: Mon, 1 Mar 2021 17:21:13 -0800 | ||||
| Subject: [PATCH] net: fix race between napi kthread mode and busy poll | ||||
|  | ||||
| Currently, napi_thread_wait() checks for NAPI_STATE_SCHED bit to | ||||
| determine if the kthread owns this napi and could call napi->poll() on | ||||
| it. However, if socket busy poll is enabled, it is possible that the | ||||
| busy poll thread grabs this SCHED bit (after the previous napi->poll() | ||||
| invokes napi_complete_done() and clears SCHED bit) and tries to poll | ||||
| on the same napi. napi_disable() could grab the SCHED bit as well. | ||||
| This patch tries to fix this race by adding a new bit | ||||
| NAPI_STATE_SCHED_THREADED in napi->state. This bit gets set in | ||||
| ____napi_schedule() if the threaded mode is enabled, and gets cleared | ||||
| in napi_complete_done(), and we only poll the napi in kthread if this | ||||
| bit is set. This helps distinguish the ownership of the napi between | ||||
| kthread and other scenarios and fixes the race issue. | ||||
|  | ||||
| Fixes: 29863d41bb6e ("net: implement threaded-able napi poll loop support") | ||||
| Reported-by: Martin Zaharinov <micron10@gmail.com> | ||||
| Suggested-by: Jakub Kicinski <kuba@kernel.org> | ||||
| Signed-off-by: Wei Wang <weiwan@google.com> | ||||
| Cc: Alexander Duyck <alexanderduyck@fb.com> | ||||
| Cc: Eric Dumazet <edumazet@google.com> | ||||
| Cc: Paolo Abeni <pabeni@redhat.com> | ||||
| Cc: Hannes Frederic Sowa <hannes@stressinduktion.org> | ||||
| --- | ||||
|  | ||||
| --- a/include/linux/netdevice.h | ||||
| +++ b/include/linux/netdevice.h | ||||
| @@ -328,6 +328,7 @@ enum { | ||||
|  	NAPI_STATE_NPSVC,	/* Netpoll - don't dequeue from poll_list */ | ||||
|  	NAPI_STATE_HASHED,	/* In NAPI hash */ | ||||
|  	NAPI_STATE_THREADED,	/* The poll is performed inside its own thread*/ | ||||
| +	NAPI_STATE_SCHED_THREADED,	/* Napi is currently scheduled in threaded mode */ | ||||
|  }; | ||||
|   | ||||
|  enum gro_result { | ||||
| --- a/net/core/dev.c | ||||
| +++ b/net/core/dev.c | ||||
| @@ -3281,6 +3281,8 @@ static inline void ____napi_schedule(str | ||||
|  		 */ | ||||
|  		thread = READ_ONCE(napi->thread); | ||||
|  		if (thread) { | ||||
| +			if (thread->state != TASK_INTERRUPTIBLE) | ||||
| +				set_bit(NAPI_STATE_SCHED_THREADED, &napi->state); | ||||
|  			wake_up_process(thread); | ||||
|  			return; | ||||
|  		} | ||||
| @@ -4745,12 +4747,14 @@ void __napi_complete(struct napi_struct | ||||
|  	list_del_init(&n->poll_list); | ||||
|  	smp_mb__before_atomic(); | ||||
|  	clear_bit(NAPI_STATE_SCHED, &n->state); | ||||
| +	clear_bit(NAPI_STATE_SCHED_THREADED, &n->state); | ||||
|  } | ||||
|  EXPORT_SYMBOL(__napi_complete); | ||||
|   | ||||
|  void napi_complete_done(struct napi_struct *n, int work_done) | ||||
|  { | ||||
|  	unsigned long flags; | ||||
| +	unsigned long val, new; | ||||
|   | ||||
|  	/* | ||||
|  	 * don't let napi dequeue from the cpu poll list | ||||
| @@ -4771,14 +4775,19 @@ void napi_complete_done(struct napi_stru | ||||
|  		else | ||||
|  			napi_gro_flush(n, false); | ||||
|  	} | ||||
| -	if (likely(list_empty(&n->poll_list))) { | ||||
| -		WARN_ON_ONCE(!test_and_clear_bit(NAPI_STATE_SCHED, &n->state)); | ||||
| -	} else { | ||||
| -		/* If n->poll_list is not empty, we need to mask irqs */ | ||||
| -		local_irq_save(flags); | ||||
| -		__napi_complete(n); | ||||
| -		local_irq_restore(flags); | ||||
| -	} | ||||
| + | ||||
| +	/* If n->poll_list is not empty, we need to mask irqs */ | ||||
| +	local_irq_save(flags); | ||||
| +	list_del_init(&n->poll_list); | ||||
| +	local_irq_restore(flags); | ||||
| + | ||||
| +	do { | ||||
| +		val = READ_ONCE(n->state); | ||||
| + | ||||
| +		WARN_ON_ONCE(!(val & BIT(NAPI_STATE_SCHED))); | ||||
| +		new = val & ~(BIT(NAPI_STATE_SCHED) | | ||||
| +			      BIT(NAPI_STATE_SCHED_THREADED)); | ||||
| +	} while (cmpxchg(&n->state, val, new) != val); | ||||
|  } | ||||
|  EXPORT_SYMBOL(napi_complete_done); | ||||
|   | ||||
| @@ -5053,16 +5062,25 @@ static int napi_poll(struct napi_struct | ||||
|   | ||||
|  static int napi_thread_wait(struct napi_struct *napi) | ||||
|  { | ||||
| +	bool woken = false; | ||||
| + | ||||
|  	set_current_state(TASK_INTERRUPTIBLE); | ||||
|   | ||||
|  	while (!kthread_should_stop() && !napi_disable_pending(napi)) { | ||||
| -		if (test_bit(NAPI_STATE_SCHED, &napi->state)) { | ||||
| +		/* Testing SCHED_THREADED bit here to make sure the current | ||||
| +		 * kthread owns this napi and could poll on this napi. | ||||
| +		 * Testing SCHED bit is not enough because SCHED bit might be | ||||
| +		 * set by some other busy poll thread or by napi_disable(). | ||||
| +		 */ | ||||
| +		if (test_bit(NAPI_STATE_SCHED_THREADED, &napi->state) || woken) { | ||||
|  			WARN_ON(!list_empty(&napi->poll_list)); | ||||
|  			__set_current_state(TASK_RUNNING); | ||||
|  			return 0; | ||||
|  		} | ||||
|   | ||||
|  		schedule(); | ||||
| +		/* woken being true indicates this thread owns this napi. */ | ||||
| +		woken = true; | ||||
|  		set_current_state(TASK_INTERRUPTIBLE); | ||||
|  	} | ||||
|  	__set_current_state(TASK_RUNNING); | ||||
| @@ -0,0 +1,53 @@ | ||||
| From: Paolo Abeni <pabeni@redhat.com> | ||||
| Date: Fri, 9 Apr 2021 17:24:17 +0200 | ||||
| Subject: [PATCH] net: fix hangup on napi_disable for threaded napi | ||||
|  | ||||
| napi_disable() is subject to an hangup, when the threaded | ||||
| mode is enabled and the napi is under heavy traffic. | ||||
|  | ||||
| If the relevant napi has been scheduled and the napi_disable() | ||||
| kicks in before the next napi_threaded_wait() completes - so | ||||
| that the latter quits due to the napi_disable_pending() condition, | ||||
| the existing code leaves the NAPI_STATE_SCHED bit set and the | ||||
| napi_disable() loop waiting for such bit will hang. | ||||
|  | ||||
| This patch addresses the issue by dropping the NAPI_STATE_DISABLE | ||||
| bit test in napi_thread_wait(). The later napi_threaded_poll() | ||||
| iteration will take care of clearing the NAPI_STATE_SCHED. | ||||
|  | ||||
| This also addresses a related problem reported by Jakub: | ||||
| before this patch a napi_disable()/napi_enable() pair killed | ||||
| the napi thread, effectively disabling the threaded mode. | ||||
| On the patched kernel napi_disable() simply stops scheduling | ||||
| the relevant thread. | ||||
|  | ||||
| v1 -> v2: | ||||
|   - let the main napi_thread_poll() loop clear the SCHED bit | ||||
|  | ||||
| Reported-by: Jakub Kicinski <kuba@kernel.org> | ||||
| Fixes: 29863d41bb6e ("net: implement threaded-able napi poll loop support") | ||||
| Signed-off-by: Paolo Abeni <pabeni@redhat.com> | ||||
| Reviewed-by: Eric Dumazet <edumazet@google.com> | ||||
| Link: https://lore.kernel.org/r/883923fa22745a9589e8610962b7dc59df09fb1f.1617981844.git.pabeni@redhat.com | ||||
| Signed-off-by: Jakub Kicinski <kuba@kernel.org> | ||||
| --- | ||||
|  | ||||
| --- a/net/core/dev.c | ||||
| +++ b/net/core/dev.c | ||||
| @@ -5066,7 +5066,7 @@ static int napi_thread_wait(struct napi_ | ||||
|   | ||||
|  	set_current_state(TASK_INTERRUPTIBLE); | ||||
|   | ||||
| -	while (!kthread_should_stop() && !napi_disable_pending(napi)) { | ||||
| +	while (!kthread_should_stop()) { | ||||
|  		/* Testing SCHED_THREADED bit here to make sure the current | ||||
|  		 * kthread owns this napi and could poll on this napi. | ||||
|  		 * Testing SCHED bit is not enough because SCHED bit might be | ||||
| @@ -5084,6 +5084,7 @@ static int napi_thread_wait(struct napi_ | ||||
|  		set_current_state(TASK_INTERRUPTIBLE); | ||||
|  	} | ||||
|  	__set_current_state(TASK_RUNNING); | ||||
| + | ||||
|  	return -1; | ||||
|  } | ||||
|   | ||||
| @@ -0,0 +1,439 @@ | ||||
| From: Daniel Borkmann <daniel@iogearbox.net> | ||||
| Date: Thu, 7 Jan 2016 22:29:47 +0100 | ||||
| Subject: [PATCH] net, sched: add clsact qdisc | ||||
|  | ||||
| This work adds a generalization of the ingress qdisc as a qdisc holding | ||||
| only classifiers. The clsact qdisc works on ingress, but also on egress. | ||||
| In both cases, it's execution happens without taking the qdisc lock, and | ||||
| the main difference for the egress part compared to prior version of [1] | ||||
| is that this can be applied with _any_ underlying real egress qdisc (also | ||||
| classless ones). | ||||
|  | ||||
| Besides solving the use-case of [1], that is, allowing for more programmability | ||||
| on assigning skb->priority for the mqprio case that is supported by most | ||||
| popular 10G+ NICs, it also opens up a lot more flexibility for other tc | ||||
| applications. The main work on classification can already be done at clsact | ||||
| egress time if the use-case allows and state stored for later retrieval | ||||
| f.e. again in skb->priority with major/minors (which is checked by most | ||||
| classful qdiscs before consulting tc_classify()) and/or in other skb fields | ||||
| like skb->tc_index for some light-weight post-processing to get to the | ||||
| eventual classid in case of a classful qdisc. Another use case is that | ||||
| the clsact egress part allows to have a central egress counterpart to | ||||
| the ingress classifiers, so that classifiers can easily share state (e.g. | ||||
| in cls_bpf via eBPF maps) for ingress and egress. | ||||
|  | ||||
| Currently, default setups like mq + pfifo_fast would require for this to | ||||
| use, for example, prio qdisc instead (to get a tc_classify() run) and to | ||||
| duplicate the egress classifier for each queue. With clsact, it allows | ||||
| for leaving the setup as is, it can additionally assign skb->priority to | ||||
| put the skb in one of pfifo_fast's bands and it can share state with maps. | ||||
| Moreover, we can access the skb's dst entry (f.e. to retrieve tclassid) | ||||
| w/o the need to perform a skb_dst_force() to hold on to it any longer. In | ||||
| lwt case, we can also use this facility to setup dst metadata via cls_bpf | ||||
| (bpf_skb_set_tunnel_key()) without needing a real egress qdisc just for | ||||
| that (case of IFF_NO_QUEUE devices, for example). | ||||
|  | ||||
| The realization can be done without any changes to the scheduler core | ||||
| framework. All it takes is that we have two a-priori defined minors/child | ||||
| classes, where we can mux between ingress and egress classifier list | ||||
| (dev->ingress_cl_list and dev->egress_cl_list, latter stored close to | ||||
| dev->_tx to avoid extra cacheline miss for moderate loads). The egress | ||||
| part is a bit similar modelled to handle_ing() and patched to a noop in | ||||
| case the functionality is not used. Both handlers are now called | ||||
| sch_handle_ingress() and sch_handle_egress(), code sharing among the two | ||||
| doesn't seem practical as there are various minor differences in both | ||||
| paths, so that making them conditional in a single handler would rather | ||||
| slow things down. | ||||
|  | ||||
| Full compatibility to ingress qdisc is provided as well. Since both | ||||
| piggyback on TC_H_CLSACT, only one of them (ingress/clsact) can exist | ||||
| per netdevice, and thus ingress qdisc specific behaviour can be retained | ||||
| for user space. This means, either a user does 'tc qdisc add dev foo ingress' | ||||
| and configures ingress qdisc as usual, or the 'tc qdisc add dev foo clsact' | ||||
| alternative, where both, ingress and egress classifier can be configured | ||||
| as in the below example. ingress qdisc supports attaching classifier to any | ||||
| minor number whereas clsact has two fixed minors for muxing between the | ||||
| lists, therefore to not break user space setups, they are better done as | ||||
| two separate qdiscs. | ||||
|  | ||||
| I decided to extend the sch_ingress module with clsact functionality so | ||||
| that commonly used code can be reused, the module is being aliased with | ||||
| sch_clsact so that it can be auto-loaded properly. Alternative would have been | ||||
| to add a flag when initializing ingress to alter its behaviour plus aliasing | ||||
| to a different name (as it's more than just ingress). However, the first would | ||||
| end up, based on the flag, choosing the new/old behaviour by calling different | ||||
| function implementations to handle each anyway, the latter would require to | ||||
| register ingress qdisc once again under different alias. So, this really begs | ||||
| to provide a minimal, cleaner approach to have Qdisc_ops and Qdisc_class_ops | ||||
| by its own that share callbacks used by both. | ||||
|  | ||||
| Example, adding qdisc: | ||||
|  | ||||
|    # tc qdisc add dev foo clsact | ||||
|    # tc qdisc show dev foo | ||||
|    qdisc mq 0: root | ||||
|    qdisc pfifo_fast 0: parent :1 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 | ||||
|    qdisc pfifo_fast 0: parent :2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 | ||||
|    qdisc pfifo_fast 0: parent :3 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 | ||||
|    qdisc pfifo_fast 0: parent :4 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 | ||||
|    qdisc clsact ffff: parent ffff:fff1 | ||||
|  | ||||
| Adding filters (deleting, etc works analogous by specifying ingress/egress): | ||||
|  | ||||
|    # tc filter add dev foo ingress bpf da obj bar.o sec ingress | ||||
|    # tc filter add dev foo egress  bpf da obj bar.o sec egress | ||||
|    # tc filter show dev foo ingress | ||||
|    filter protocol all pref 49152 bpf | ||||
|    filter protocol all pref 49152 bpf handle 0x1 bar.o:[ingress] direct-action | ||||
|    # tc filter show dev foo egress | ||||
|    filter protocol all pref 49152 bpf | ||||
|    filter protocol all pref 49152 bpf handle 0x1 bar.o:[egress] direct-action | ||||
|  | ||||
| A 'tc filter show dev foo' or 'tc filter show dev foo parent ffff:' will | ||||
| show an empty list for clsact. Either using the parent names (ingress/egress) | ||||
| or specifying the full major/minor will then show the related filter lists. | ||||
|  | ||||
| Prior work on a mqprio prequeue() facility [1] was done mainly by John Fastabend. | ||||
|  | ||||
|   [1] http://patchwork.ozlabs.org/patch/512949/ | ||||
|  | ||||
| Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> | ||||
| Acked-by: John Fastabend <john.r.fastabend@intel.com> | ||||
| Signed-off-by: David S. Miller <davem@davemloft.net> | ||||
| --- | ||||
|  | ||||
| --- a/include/linux/netdevice.h | ||||
| +++ b/include/linux/netdevice.h | ||||
| @@ -1770,7 +1770,9 @@ struct net_device { | ||||
|  #ifdef CONFIG_XPS | ||||
|  	struct xps_dev_maps __rcu *xps_maps; | ||||
|  #endif | ||||
| - | ||||
| +#ifdef CONFIG_NET_CLS_ACT | ||||
| +	struct tcf_proto __rcu  *egress_cl_list; | ||||
| +#endif | ||||
|  #ifdef CONFIG_NET_SWITCHDEV | ||||
|  	u32			offload_fwd_mark; | ||||
|  #endif | ||||
| --- a/include/linux/rtnetlink.h | ||||
| +++ b/include/linux/rtnetlink.h | ||||
| @@ -84,6 +84,11 @@ void net_inc_ingress_queue(void); | ||||
|  void net_dec_ingress_queue(void); | ||||
|  #endif | ||||
|   | ||||
| +#ifdef CONFIG_NET_EGRESS | ||||
| +void net_inc_egress_queue(void); | ||||
| +void net_dec_egress_queue(void); | ||||
| +#endif | ||||
| + | ||||
|  extern void rtnetlink_init(void); | ||||
|  extern void __rtnl_unlock(void); | ||||
|   | ||||
| --- a/include/uapi/linux/pkt_sched.h | ||||
| +++ b/include/uapi/linux/pkt_sched.h | ||||
| @@ -72,6 +72,10 @@ struct tc_estimator { | ||||
|  #define TC_H_UNSPEC	(0U) | ||||
|  #define TC_H_ROOT	(0xFFFFFFFFU) | ||||
|  #define TC_H_INGRESS    (0xFFFFFFF1U) | ||||
| +#define TC_H_CLSACT	TC_H_INGRESS | ||||
| + | ||||
| +#define TC_H_MIN_INGRESS	0xFFF2U | ||||
| +#define TC_H_MIN_EGRESS		0xFFF3U | ||||
|   | ||||
|  /* Need to corrospond to iproute2 tc/tc_core.h "enum link_layer" */ | ||||
|  enum tc_link_layer { | ||||
| --- a/net/core/dev.c | ||||
| +++ b/net/core/dev.c | ||||
| @@ -1697,6 +1697,22 @@ void net_dec_ingress_queue(void) | ||||
|  EXPORT_SYMBOL_GPL(net_dec_ingress_queue); | ||||
|  #endif | ||||
|   | ||||
| +#ifdef CONFIG_NET_EGRESS | ||||
| +static struct static_key egress_needed __read_mostly; | ||||
| + | ||||
| +void net_inc_egress_queue(void) | ||||
| +{ | ||||
| +	static_key_slow_inc(&egress_needed); | ||||
| +} | ||||
| +EXPORT_SYMBOL_GPL(net_inc_egress_queue); | ||||
| + | ||||
| +void net_dec_egress_queue(void) | ||||
| +{ | ||||
| +	static_key_slow_dec(&egress_needed); | ||||
| +} | ||||
| +EXPORT_SYMBOL_GPL(net_dec_egress_queue); | ||||
| +#endif | ||||
| + | ||||
|  static struct static_key netstamp_needed __read_mostly; | ||||
|  #ifdef HAVE_JUMP_LABEL | ||||
|  static atomic_t netstamp_needed_deferred; | ||||
| @@ -2936,7 +2952,6 @@ static inline int __dev_xmit_skb(struct | ||||
|  	bool contended; | ||||
|  	int rc; | ||||
|   | ||||
| -	qdisc_pkt_len_init(skb); | ||||
|  	qdisc_calculate_pkt_len(skb, q); | ||||
|  	/* | ||||
|  	 * Heuristic to force contended enqueues to serialize on a | ||||
| @@ -3028,6 +3043,49 @@ int dev_loopback_xmit(struct net *net, s | ||||
|  } | ||||
|  EXPORT_SYMBOL(dev_loopback_xmit); | ||||
|   | ||||
| +#ifdef CONFIG_NET_EGRESS | ||||
| +static struct sk_buff * | ||||
| +sch_handle_egress(struct sk_buff *skb, int *ret, struct net_device *dev) | ||||
| +{ | ||||
| +	struct tcf_proto *cl = rcu_dereference_bh(dev->egress_cl_list); | ||||
| +	struct tcf_result cl_res; | ||||
| + | ||||
| +	if (!cl) | ||||
| +		return skb; | ||||
| + | ||||
| +	/* skb->tc_verd and qdisc_skb_cb(skb)->pkt_len were already set | ||||
| +	 * earlier by the caller. | ||||
| +	 */ | ||||
| +	qdisc_bstats_cpu_update(cl->q, skb); | ||||
| + | ||||
| +	switch (tc_classify(skb, cl, &cl_res, false)) { | ||||
| +	case TC_ACT_OK: | ||||
| +	case TC_ACT_RECLASSIFY: | ||||
| +		skb->tc_index = TC_H_MIN(cl_res.classid); | ||||
| +		break; | ||||
| +	case TC_ACT_SHOT: | ||||
| +		qdisc_qstats_cpu_drop(cl->q); | ||||
| +		*ret = NET_XMIT_DROP; | ||||
| +		goto drop; | ||||
| +	case TC_ACT_STOLEN: | ||||
| +	case TC_ACT_QUEUED: | ||||
| +		*ret = NET_XMIT_SUCCESS; | ||||
| +drop: | ||||
| +		kfree_skb(skb); | ||||
| +		return NULL; | ||||
| +	case TC_ACT_REDIRECT: | ||||
| +		/* No need to push/pop skb's mac_header here on egress! */ | ||||
| +		skb_do_redirect(skb); | ||||
| +		*ret = NET_XMIT_SUCCESS; | ||||
| +		return NULL; | ||||
| +	default: | ||||
| +		break; | ||||
| +	} | ||||
| + | ||||
| +	return skb; | ||||
| +} | ||||
| +#endif /* CONFIG_NET_EGRESS */ | ||||
| + | ||||
|  static inline int get_xps_queue(struct net_device *dev, struct sk_buff *skb) | ||||
|  { | ||||
|  #ifdef CONFIG_XPS | ||||
| @@ -3152,6 +3210,17 @@ static int __dev_queue_xmit(struct sk_bu | ||||
|   | ||||
|  	skb_update_prio(skb); | ||||
|   | ||||
| +	qdisc_pkt_len_init(skb); | ||||
| +#ifdef CONFIG_NET_CLS_ACT | ||||
| +	skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_EGRESS); | ||||
| +# ifdef CONFIG_NET_EGRESS | ||||
| +	if (static_key_false(&egress_needed)) { | ||||
| +		skb = sch_handle_egress(skb, &rc, dev); | ||||
| +		if (!skb) | ||||
| +			goto out; | ||||
| +	} | ||||
| +# endif | ||||
| +#endif | ||||
|  	/* If device/qdisc don't need skb->dst, release it right now while | ||||
|  	 * its hot in this cpu cache. | ||||
|  	 */ | ||||
| @@ -3173,9 +3242,6 @@ static int __dev_queue_xmit(struct sk_bu | ||||
|  	txq = netdev_pick_tx(dev, skb, accel_priv); | ||||
|  	q = rcu_dereference_bh(txq->qdisc); | ||||
|   | ||||
| -#ifdef CONFIG_NET_CLS_ACT | ||||
| -	skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_EGRESS); | ||||
| -#endif | ||||
|  	trace_net_dev_queue(skb); | ||||
|  	if (q->enqueue) { | ||||
|  		rc = __dev_xmit_skb(skb, q, dev, txq); | ||||
| @@ -3750,9 +3816,9 @@ int (*br_fdb_test_addr_hook)(struct net_ | ||||
|  EXPORT_SYMBOL_GPL(br_fdb_test_addr_hook); | ||||
|  #endif | ||||
|   | ||||
| -static inline struct sk_buff *handle_ing(struct sk_buff *skb, | ||||
| -					 struct packet_type **pt_prev, | ||||
| -					 int *ret, struct net_device *orig_dev) | ||||
| +static inline struct sk_buff * | ||||
| +sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret, | ||||
| +		   struct net_device *orig_dev) | ||||
|  { | ||||
|  #ifdef CONFIG_NET_CLS_ACT | ||||
|  	struct tcf_proto *cl = rcu_dereference_bh(skb->dev->ingress_cl_list); | ||||
| @@ -3974,7 +4040,7 @@ another_round: | ||||
|  skip_taps: | ||||
|  #ifdef CONFIG_NET_INGRESS | ||||
|  	if (static_key_false(&ingress_needed)) { | ||||
| -		skb = handle_ing(skb, &pt_prev, &ret, orig_dev); | ||||
| +		skb = sch_handle_ingress(skb, &pt_prev, &ret, orig_dev); | ||||
|  		if (!skb) | ||||
|  			goto out; | ||||
|   | ||||
| --- a/net/Kconfig | ||||
| +++ b/net/Kconfig | ||||
| @@ -54,6 +54,9 @@ config COMPAT_NETLINK_MESSAGES | ||||
|  config NET_INGRESS | ||||
|  	bool | ||||
|   | ||||
| +config NET_EGRESS | ||||
| +	bool | ||||
| + | ||||
|  menu "Networking options" | ||||
|   | ||||
|  source "net/packet/Kconfig" | ||||
| --- a/net/sched/cls_bpf.c | ||||
| +++ b/net/sched/cls_bpf.c | ||||
| @@ -291,7 +291,7 @@ static int cls_bpf_prog_from_efd(struct | ||||
|  	prog->bpf_name = name; | ||||
|  	prog->filter = fp; | ||||
|   | ||||
| -	if (fp->dst_needed) | ||||
| +	if (fp->dst_needed && !(tp->q->flags & TCQ_F_INGRESS)) | ||||
|  		netif_keep_dst(qdisc_dev(tp->q)); | ||||
|   | ||||
|  	return 0; | ||||
| --- a/net/sched/Kconfig | ||||
| +++ b/net/sched/Kconfig | ||||
| @@ -342,15 +342,21 @@ config NET_SCH_PIE | ||||
|  	  If unsure, say N. | ||||
|   | ||||
|  config NET_SCH_INGRESS | ||||
| -	tristate "Ingress Qdisc" | ||||
| +	tristate "Ingress/classifier-action Qdisc" | ||||
|  	depends on NET_CLS_ACT | ||||
|  	select NET_INGRESS | ||||
| +	select NET_EGRESS | ||||
|  	---help--- | ||||
| -	  Say Y here if you want to use classifiers for incoming packets. | ||||
| +	  Say Y here if you want to use classifiers for incoming and/or outgoing | ||||
| +	  packets. This qdisc doesn't do anything else besides running classifiers, | ||||
| +	  which can also have actions attached to them. In case of outgoing packets, | ||||
| +	  classifiers that this qdisc holds are executed in the transmit path | ||||
| +	  before real enqueuing to an egress qdisc happens. | ||||
| + | ||||
|  	  If unsure, say Y. | ||||
|   | ||||
| -	  To compile this code as a module, choose M here: the | ||||
| -	  module will be called sch_ingress. | ||||
| +	  To compile this code as a module, choose M here: the module will be | ||||
| +	  called sch_ingress with alias of sch_clsact. | ||||
|   | ||||
|  config NET_SCH_PLUG | ||||
|  	tristate "Plug network traffic until release (PLUG)" | ||||
| --- a/net/sched/sch_ingress.c | ||||
| +++ b/net/sched/sch_ingress.c | ||||
| @@ -1,4 +1,5 @@ | ||||
| -/* net/sched/sch_ingress.c - Ingress qdisc | ||||
| +/* net/sched/sch_ingress.c - Ingress and clsact qdisc | ||||
| + * | ||||
|   *              This program is free software; you can redistribute it and/or | ||||
|   *              modify it under the terms of the GNU General Public License | ||||
|   *              as published by the Free Software Foundation; either version | ||||
| @@ -98,17 +99,100 @@ static struct Qdisc_ops ingress_qdisc_op | ||||
|  	.owner		=	THIS_MODULE, | ||||
|  }; | ||||
|   | ||||
| +static unsigned long clsact_get(struct Qdisc *sch, u32 classid) | ||||
| +{ | ||||
| +	switch (TC_H_MIN(classid)) { | ||||
| +	case TC_H_MIN(TC_H_MIN_INGRESS): | ||||
| +	case TC_H_MIN(TC_H_MIN_EGRESS): | ||||
| +		return TC_H_MIN(classid); | ||||
| +	default: | ||||
| +		return 0; | ||||
| +	} | ||||
| +} | ||||
| + | ||||
| +static unsigned long clsact_bind_filter(struct Qdisc *sch, | ||||
| +					unsigned long parent, u32 classid) | ||||
| +{ | ||||
| +	return clsact_get(sch, classid); | ||||
| +} | ||||
| + | ||||
| +static struct tcf_proto __rcu **clsact_find_tcf(struct Qdisc *sch, | ||||
| +						unsigned long cl) | ||||
| +{ | ||||
| +	struct net_device *dev = qdisc_dev(sch); | ||||
| + | ||||
| +	switch (cl) { | ||||
| +	case TC_H_MIN(TC_H_MIN_INGRESS): | ||||
| +		return &dev->ingress_cl_list; | ||||
| +	case TC_H_MIN(TC_H_MIN_EGRESS): | ||||
| +		return &dev->egress_cl_list; | ||||
| +	default: | ||||
| +		return NULL; | ||||
| +	} | ||||
| +} | ||||
| + | ||||
| +static int clsact_init(struct Qdisc *sch, struct nlattr *opt) | ||||
| +{ | ||||
| +	net_inc_ingress_queue(); | ||||
| +	net_inc_egress_queue(); | ||||
| + | ||||
| +	sch->flags |= TCQ_F_CPUSTATS; | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +static void clsact_destroy(struct Qdisc *sch) | ||||
| +{ | ||||
| +	struct net_device *dev = qdisc_dev(sch); | ||||
| + | ||||
| +	tcf_destroy_chain(&dev->ingress_cl_list); | ||||
| +	tcf_destroy_chain(&dev->egress_cl_list); | ||||
| + | ||||
| +	net_dec_ingress_queue(); | ||||
| +	net_dec_egress_queue(); | ||||
| +} | ||||
| + | ||||
| +static const struct Qdisc_class_ops clsact_class_ops = { | ||||
| +	.leaf		=	ingress_leaf, | ||||
| +	.get		=	clsact_get, | ||||
| +	.put		=	ingress_put, | ||||
| +	.walk		=	ingress_walk, | ||||
| +	.tcf_chain	=	clsact_find_tcf, | ||||
| +	.bind_tcf	=	clsact_bind_filter, | ||||
| +	.unbind_tcf	=	ingress_put, | ||||
| +}; | ||||
| + | ||||
| +static struct Qdisc_ops clsact_qdisc_ops __read_mostly = { | ||||
| +	.cl_ops		=	&clsact_class_ops, | ||||
| +	.id		=	"clsact", | ||||
| +	.init		=	clsact_init, | ||||
| +	.destroy	=	clsact_destroy, | ||||
| +	.dump		=	ingress_dump, | ||||
| +	.owner		=	THIS_MODULE, | ||||
| +}; | ||||
| + | ||||
|  static int __init ingress_module_init(void) | ||||
|  { | ||||
| -	return register_qdisc(&ingress_qdisc_ops); | ||||
| +	int ret; | ||||
| + | ||||
| +	ret = register_qdisc(&ingress_qdisc_ops); | ||||
| +	if (!ret) { | ||||
| +		ret = register_qdisc(&clsact_qdisc_ops); | ||||
| +		if (ret) | ||||
| +			unregister_qdisc(&ingress_qdisc_ops); | ||||
| +	} | ||||
| + | ||||
| +	return ret; | ||||
|  } | ||||
|   | ||||
|  static void __exit ingress_module_exit(void) | ||||
|  { | ||||
|  	unregister_qdisc(&ingress_qdisc_ops); | ||||
| +	unregister_qdisc(&clsact_qdisc_ops); | ||||
|  } | ||||
|   | ||||
|  module_init(ingress_module_init); | ||||
|  module_exit(ingress_module_exit); | ||||
|   | ||||
| +MODULE_ALIAS("sch_clsact"); | ||||
|  MODULE_LICENSE("GPL"); | ||||
| @@ -0,0 +1,75 @@ | ||||
| From: Shmulik Ladkani <shmulik.ladkani@gmail.com> | ||||
| Date: Thu, 13 Oct 2016 09:06:41 +0300 | ||||
| Subject: [PATCH] net/sched: act_mirred: Rename tcfm_ok_push to | ||||
|  tcfm_mac_header_xmit and make it a bool | ||||
|  | ||||
| 'tcfm_ok_push' specifies whether a mac_len sized push is needed upon | ||||
| egress to the target device (if action is performed at ingress). | ||||
|  | ||||
| Rename it to 'tcfm_mac_header_xmit' as this is actually an attribute of | ||||
| the target device (and use a bool instead of int). | ||||
|  | ||||
| This allows to decouple the attribute from the action to be taken. | ||||
|  | ||||
| Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com> | ||||
| Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> | ||||
| Signed-off-by: David S. Miller <davem@davemloft.net> | ||||
| --- | ||||
|  | ||||
| --- a/include/net/tc_act/tc_mirred.h | ||||
| +++ b/include/net/tc_act/tc_mirred.h | ||||
| @@ -7,7 +7,7 @@ struct tcf_mirred { | ||||
|  	struct tcf_common	common; | ||||
|  	int			tcfm_eaction; | ||||
|  	int			tcfm_ifindex; | ||||
| -	int			tcfm_ok_push; | ||||
| +	bool			tcfm_mac_header_xmit; | ||||
|  	struct net_device __rcu	*tcfm_dev; | ||||
|  	struct list_head	tcfm_list; | ||||
|  }; | ||||
| --- a/net/sched/act_mirred.c | ||||
| +++ b/net/sched/act_mirred.c | ||||
| @@ -55,10 +55,11 @@ static int tcf_mirred_init(struct net *n | ||||
|  			   int bind) | ||||
|  { | ||||
|  	struct nlattr *tb[TCA_MIRRED_MAX + 1]; | ||||
| +	bool mac_header_xmit = false; | ||||
|  	struct tc_mirred *parm; | ||||
|  	struct tcf_mirred *m; | ||||
|  	struct net_device *dev; | ||||
| -	int ret, ok_push = 0; | ||||
| +	int ret; | ||||
|   | ||||
|  	if (nla == NULL) | ||||
|  		return -EINVAL; | ||||
| @@ -86,10 +87,10 @@ static int tcf_mirred_init(struct net *n | ||||
|  		case ARPHRD_IPGRE: | ||||
|  		case ARPHRD_VOID: | ||||
|  		case ARPHRD_NONE: | ||||
| -			ok_push = 0; | ||||
| +			mac_header_xmit = false; | ||||
|  			break; | ||||
|  		default: | ||||
| -			ok_push = 1; | ||||
| +			mac_header_xmit = true; | ||||
|  			break; | ||||
|  		} | ||||
|  	} else { | ||||
| @@ -123,7 +124,7 @@ static int tcf_mirred_init(struct net *n | ||||
|  			dev_put(rcu_dereference_protected(m->tcfm_dev, 1)); | ||||
|  		dev_hold(dev); | ||||
|  		rcu_assign_pointer(m->tcfm_dev, dev); | ||||
| -		m->tcfm_ok_push = ok_push; | ||||
| +		m->tcfm_mac_header_xmit = mac_header_xmit; | ||||
|  	} | ||||
|   | ||||
|  	if (ret == ACT_P_CREATED) { | ||||
| @@ -169,7 +170,7 @@ static int tcf_mirred(struct sk_buff *sk | ||||
|  		goto out; | ||||
|   | ||||
|  	if (!(at & AT_EGRESS)) { | ||||
| -		if (m->tcfm_ok_push) | ||||
| +		if (m->tcfm_mac_header_xmit) | ||||
|  			skb_push_rcsum(skb2, skb->mac_len); | ||||
|  	} | ||||
|   | ||||
| @@ -0,0 +1,36 @@ | ||||
| From: Shmulik Ladkani <shmulik.ladkani@gmail.com> | ||||
| Date: Thu, 13 Oct 2016 09:06:42 +0300 | ||||
| Subject: [PATCH] net/sched: act_mirred: Refactor detection whether dev needs | ||||
|  xmit at mac header | ||||
|  | ||||
| Move detection logic that tests whether device expects skb data to point | ||||
| at mac_header upon xmit into a function. | ||||
|  | ||||
| Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com> | ||||
| Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> | ||||
| Signed-off-by: David S. Miller <davem@davemloft.net> | ||||
| --- | ||||
|  | ||||
| --- a/net/sched/act_mirred.c | ||||
| +++ b/net/sched/act_mirred.c | ||||
| @@ -80,19 +80,7 @@ static int tcf_mirred_init(struct net *n | ||||
|  		dev = __dev_get_by_index(net, parm->ifindex); | ||||
|  		if (dev == NULL) | ||||
|  			return -ENODEV; | ||||
| -		switch (dev->type) { | ||||
| -		case ARPHRD_TUNNEL: | ||||
| -		case ARPHRD_TUNNEL6: | ||||
| -		case ARPHRD_SIT: | ||||
| -		case ARPHRD_IPGRE: | ||||
| -		case ARPHRD_VOID: | ||||
| -		case ARPHRD_NONE: | ||||
| -			mac_header_xmit = false; | ||||
| -			break; | ||||
| -		default: | ||||
| -			mac_header_xmit = true; | ||||
| -			break; | ||||
| -		} | ||||
| +		mac_header_xmit = dev_is_mac_header_xmit(dev); | ||||
|  	} else { | ||||
|  		dev = NULL; | ||||
|  	} | ||||
| @@ -0,0 +1,125 @@ | ||||
| From: Shmulik Ladkani <shmulik.ladkani@gmail.com> | ||||
| Date: Thu, 13 Oct 2016 09:06:44 +0300 | ||||
| Subject: [PATCH] net/sched: act_mirred: Implement ingress actions | ||||
|  | ||||
| Up until now, 'action mirred' supported only egress actions (either | ||||
| TCA_EGRESS_REDIR or TCA_EGRESS_MIRROR). | ||||
|  | ||||
| This patch implements the corresponding ingress actions | ||||
| TCA_INGRESS_REDIR and TCA_INGRESS_MIRROR. | ||||
|  | ||||
| This allows attaching filters whose target is to hand matching skbs into | ||||
| the rx processing of a specified device. | ||||
|  | ||||
| Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com> | ||||
| Cc: Jamal Hadi Salim <jhs@mojatatu.com> | ||||
| Cc: Eric Dumazet <eric.dumazet@gmail.com> | ||||
| Cc: Cong Wang <xiyou.wangcong@gmail.com> | ||||
| Tested-by: Jamal Hadi Salim <jhs@mojatatu.com> | ||||
| Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> | ||||
| Signed-off-by: David S. Miller <davem@davemloft.net> | ||||
| --- | ||||
|  | ||||
| --- a/net/sched/act_mirred.c | ||||
| +++ b/net/sched/act_mirred.c | ||||
| @@ -33,6 +33,25 @@ | ||||
|  static LIST_HEAD(mirred_list); | ||||
|  static DEFINE_SPINLOCK(mirred_list_lock); | ||||
|   | ||||
| +static bool tcf_mirred_is_act_redirect(int action) | ||||
| +{ | ||||
| +	return action == TCA_EGRESS_REDIR || action == TCA_INGRESS_REDIR; | ||||
| +} | ||||
| + | ||||
| +static u32 tcf_mirred_act_direction(int action) | ||||
| +{ | ||||
| +	switch (action) { | ||||
| +	case TCA_EGRESS_REDIR: | ||||
| +	case TCA_EGRESS_MIRROR: | ||||
| +		return AT_EGRESS; | ||||
| +	case TCA_INGRESS_REDIR: | ||||
| +	case TCA_INGRESS_MIRROR: | ||||
| +		return AT_INGRESS; | ||||
| +	default: | ||||
| +		BUG(); | ||||
| +	} | ||||
| +} | ||||
| + | ||||
|  static void tcf_mirred_release(struct tc_action *a, int bind) | ||||
|  { | ||||
|  	struct tcf_mirred *m = to_mirred(a); | ||||
| @@ -72,6 +91,8 @@ static int tcf_mirred_init(struct net *n | ||||
|  	switch (parm->eaction) { | ||||
|  	case TCA_EGRESS_MIRROR: | ||||
|  	case TCA_EGRESS_REDIR: | ||||
| +	case TCA_INGRESS_REDIR: | ||||
| +	case TCA_INGRESS_MIRROR: | ||||
|  		break; | ||||
|  	default: | ||||
|  		return -EINVAL; | ||||
| @@ -129,9 +150,12 @@ static int tcf_mirred(struct sk_buff *sk | ||||
|  		      struct tcf_result *res) | ||||
|  { | ||||
|  	struct tcf_mirred *m = a->priv; | ||||
| +	bool m_mac_header_xmit; | ||||
|  	struct net_device *dev; | ||||
|  	struct sk_buff *skb2; | ||||
| -	int retval, err; | ||||
| +	int retval, err = 0; | ||||
| +	int m_eaction; | ||||
| +	int mac_len; | ||||
|  	u32 at; | ||||
|   | ||||
|  	tcf_lastuse_update(&m->tcf_tm); | ||||
| @@ -139,6 +163,8 @@ static int tcf_mirred(struct sk_buff *sk | ||||
|  	bstats_cpu_update(this_cpu_ptr(m->common.cpu_bstats), skb); | ||||
|   | ||||
|  	rcu_read_lock(); | ||||
| +	m_mac_header_xmit = READ_ONCE(m->tcfm_mac_header_xmit); | ||||
| +	m_eaction = READ_ONCE(m->tcfm_eaction); | ||||
|  	retval = READ_ONCE(m->tcf_action); | ||||
|  	dev = rcu_dereference(m->tcfm_dev); | ||||
|  	if (unlikely(!dev)) { | ||||
| @@ -157,24 +183,37 @@ static int tcf_mirred(struct sk_buff *sk | ||||
|  	if (!skb2) | ||||
|  		goto out; | ||||
|   | ||||
| -	if (!(at & AT_EGRESS)) { | ||||
| -		if (m->tcfm_mac_header_xmit) | ||||
| +	/* If action's target direction differs than filter's direction, | ||||
| +	 * and devices expect a mac header on xmit, then mac push/pull is | ||||
| +	 * needed. | ||||
| +	 */ | ||||
| +	if (at != tcf_mirred_act_direction(m_eaction) && m_mac_header_xmit) { | ||||
| +		if (at & AT_EGRESS) { | ||||
| +			/* caught at egress, act ingress: pull mac */ | ||||
| +			mac_len = skb_network_header(skb) - skb_mac_header(skb); | ||||
| +			skb_pull_rcsum(skb2, mac_len); | ||||
| +		} else { | ||||
| +			/* caught at ingress, act egress: push mac */ | ||||
|  			skb_push_rcsum(skb2, skb->mac_len); | ||||
| +		} | ||||
|  	} | ||||
|   | ||||
|  	/* mirror is always swallowed */ | ||||
| -	if (m->tcfm_eaction != TCA_EGRESS_MIRROR) | ||||
| +	if (tcf_mirred_is_act_redirect(m_eaction)) | ||||
|  		skb2->tc_verd = SET_TC_FROM(skb2->tc_verd, at); | ||||
|   | ||||
|  	skb2->skb_iif = skb->dev->ifindex; | ||||
|  	skb2->dev = dev; | ||||
|  	skb_sender_cpu_clear(skb2); | ||||
| -	err = dev_queue_xmit(skb2); | ||||
| +	if (tcf_mirred_act_direction(m_eaction) & AT_EGRESS) | ||||
| +		err = dev_queue_xmit(skb2); | ||||
| +	else | ||||
| +		err = netif_receive_skb(skb2); | ||||
|   | ||||
|  	if (err) { | ||||
|  out: | ||||
|  		qstats_overlimit_inc(this_cpu_ptr(m->common.cpu_qstats)); | ||||
| -		if (m->tcfm_eaction != TCA_EGRESS_MIRROR) | ||||
| +		if (tcf_mirred_is_act_redirect(m_eaction)) | ||||
|  			retval = TC_ACT_SHOT; | ||||
|  	} | ||||
|  	rcu_read_unlock(); | ||||
| @@ -0,0 +1,30 @@ | ||||
| From a0d398a7373b395a2cbdc865815560671d1e8a08 Mon Sep 17 00:00:00 2001 | ||||
| From: Venkat Chimata <venkata@shasta.cloud> | ||||
| Date: Fri, 12 Aug 2022 15:42:40 +0530 | ||||
| Subject: [PATCH] sk_buff's cb should be cleared in the entry point for both | ||||
|  incoming and outgoing packets at each layer. At bridge, it is already handled | ||||
|  in the outgoing path, but not in the incoming path. We have seen cases where | ||||
|  proxyarp_replied was 1 on sk_buffs coming from the WLAN driver and they were | ||||
|  getting dropped in forwarding path. | ||||
|  | ||||
| Signed-off-by: Venkat Chimata <venkata@shasta.cloud> | ||||
| --- | ||||
|  net/bridge/br_input.c | 2 ++ | ||||
|  1 file changed, 2 insertions(+) | ||||
|  | ||||
| diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c | ||||
| index e6b745b7..09cd5b72 100644 | ||||
| --- a/net/bridge/br_input.c | ||||
| +++ b/net/bridge/br_input.c | ||||
| @@ -282,6 +282,8 @@ rx_handler_result_t br_handle_frame(struct sk_buff **pskb) | ||||
|  	if (!skb) | ||||
|  		return RX_HANDLER_CONSUMED; | ||||
|   | ||||
| +	memset(skb->cb, 0, sizeof(struct br_input_skb_cb)); | ||||
| + | ||||
|  	p = br_port_get_rcu(skb->dev); | ||||
|   | ||||
|  	if (unlikely(is_link_local_ether_addr(dest))) { | ||||
| --  | ||||
| 2.34.1 | ||||
|  | ||||
| @@ -0,0 +1,315 @@ | ||||
| From: Jiri Pirko <jiri@mellanox.com> | ||||
| Date: Thu, 21 Jul 2016 12:03:11 +0200 | ||||
| Subject: [PATCH] net/sched: introduce Match-all classifier | ||||
|  | ||||
| The matchall classifier matches every packet and allows the user to apply | ||||
| actions on it. This filter is very useful in usecases where every packet | ||||
| should be matched, for example, packet mirroring (SPAN) can be setup very | ||||
| easily using that filter. | ||||
|  | ||||
| Signed-off-by: Jiri Pirko <jiri@mellanox.com> | ||||
| Signed-off-by: Yotam Gigi <yotamg@mellanox.com> | ||||
| Signed-off-by: David S. Miller <davem@davemloft.net> | ||||
| --- | ||||
|  create mode 100644 net/sched/cls_matchall.c | ||||
|  | ||||
| --- a/include/uapi/linux/pkt_cls.h | ||||
| +++ b/include/uapi/linux/pkt_cls.h | ||||
| @@ -427,6 +427,17 @@ enum { | ||||
|   | ||||
|  #define TCA_FLOWER_MAX (__TCA_FLOWER_MAX - 1) | ||||
|   | ||||
| +/* Match-all classifier */ | ||||
| + | ||||
| +enum { | ||||
| +	TCA_MATCHALL_UNSPEC, | ||||
| +	TCA_MATCHALL_CLASSID, | ||||
| +	TCA_MATCHALL_ACT, | ||||
| +	__TCA_MATCHALL_MAX, | ||||
| +}; | ||||
| + | ||||
| +#define TCA_MATCHALL_MAX (__TCA_MATCHALL_MAX - 1) | ||||
| + | ||||
|  /* Extended Matches */ | ||||
|   | ||||
|  struct tcf_ematch_tree_hdr { | ||||
| --- /dev/null | ||||
| +++ b/net/sched/cls_matchall.c | ||||
| @@ -0,0 +1,248 @@ | ||||
| +/* | ||||
| + * net/sched/cls_matchll.c		Match-all classifier | ||||
| + * | ||||
| + * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com> | ||||
| + * | ||||
| + * This program is free software; you can redistribute it and/or modify | ||||
| + * it under the terms of the GNU General Public License as published by | ||||
| + * the Free Software Foundation; either version 2 of the License, or | ||||
| + * (at your option) any later version. | ||||
| + */ | ||||
| + | ||||
| +#include <linux/kernel.h> | ||||
| +#include <linux/init.h> | ||||
| +#include <linux/module.h> | ||||
| + | ||||
| +#include <net/sch_generic.h> | ||||
| +#include <net/pkt_cls.h> | ||||
| + | ||||
| +struct cls_mall_filter { | ||||
| +	struct tcf_exts exts; | ||||
| +	struct tcf_result res; | ||||
| +	u32 handle; | ||||
| +	struct rcu_head	rcu; | ||||
| +}; | ||||
| + | ||||
| +struct cls_mall_head { | ||||
| +	struct cls_mall_filter *filter; | ||||
| +	struct rcu_head	rcu; | ||||
| +}; | ||||
| + | ||||
| +static int mall_classify(struct sk_buff *skb, const struct tcf_proto *tp, | ||||
| +			 struct tcf_result *res) | ||||
| +{ | ||||
| +	struct cls_mall_head *head = rcu_dereference_bh(tp->root); | ||||
| +	struct cls_mall_filter *f = head->filter; | ||||
| + | ||||
| +	return tcf_exts_exec(skb, &f->exts, res); | ||||
| +} | ||||
| + | ||||
| +static int mall_init(struct tcf_proto *tp) | ||||
| +{ | ||||
| +	struct cls_mall_head *head; | ||||
| + | ||||
| +	head = kzalloc(sizeof(*head), GFP_KERNEL); | ||||
| +	if (!head) | ||||
| +		return -ENOBUFS; | ||||
| + | ||||
| +	rcu_assign_pointer(tp->root, head); | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +static void mall_destroy_filter(struct rcu_head *head) | ||||
| +{ | ||||
| +	struct cls_mall_filter *f = container_of(head, struct cls_mall_filter, rcu); | ||||
| + | ||||
| +	tcf_exts_destroy(&f->exts); | ||||
| +	kfree(f); | ||||
| +} | ||||
| + | ||||
| +static bool mall_destroy(struct tcf_proto *tp, bool force) | ||||
| +{ | ||||
| +	struct cls_mall_head *head = rtnl_dereference(tp->root); | ||||
| + | ||||
| +	if (!force && head->filter) | ||||
| +		return false; | ||||
| + | ||||
| +	if (head->filter) | ||||
| +		call_rcu(&head->filter->rcu, mall_destroy_filter); | ||||
| +	RCU_INIT_POINTER(tp->root, NULL); | ||||
| +	kfree_rcu(head, rcu); | ||||
| +	return true; | ||||
| +} | ||||
| + | ||||
| +static unsigned long mall_get(struct tcf_proto *tp, u32 handle) | ||||
| +{ | ||||
| +	struct cls_mall_head *head = rtnl_dereference(tp->root); | ||||
| +	struct cls_mall_filter *f = head->filter; | ||||
| + | ||||
| +	if (f && f->handle == handle) | ||||
| +		return (unsigned long) f; | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +static const struct nla_policy mall_policy[TCA_MATCHALL_MAX + 1] = { | ||||
| +	[TCA_MATCHALL_UNSPEC]		= { .type = NLA_UNSPEC }, | ||||
| +	[TCA_MATCHALL_CLASSID]		= { .type = NLA_U32 }, | ||||
| +}; | ||||
| + | ||||
| +static int mall_set_parms(struct net *net, struct tcf_proto *tp, | ||||
| +			  struct cls_mall_filter *f, | ||||
| +			  unsigned long base, struct nlattr **tb, | ||||
| +			  struct nlattr *est, bool ovr) | ||||
| +{ | ||||
| +	struct tcf_exts e; | ||||
| +	int err; | ||||
| + | ||||
| +	tcf_exts_init(&e, TCA_MATCHALL_ACT, 0); | ||||
| +	err = tcf_exts_validate(net, tp, tb, est, &e, ovr); | ||||
| +	if (err < 0) | ||||
| +		return err; | ||||
| + | ||||
| +	if (tb[TCA_MATCHALL_CLASSID]) { | ||||
| +		f->res.classid = nla_get_u32(tb[TCA_MATCHALL_CLASSID]); | ||||
| +		tcf_bind_filter(tp, &f->res, base); | ||||
| +	} | ||||
| + | ||||
| +	tcf_exts_change(tp, &f->exts, &e); | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +static int mall_change(struct net *net, struct sk_buff *in_skb, | ||||
| +		       struct tcf_proto *tp, unsigned long base, | ||||
| +		       u32 handle, struct nlattr **tca, | ||||
| +		       unsigned long *arg, bool ovr) | ||||
| +{ | ||||
| +	struct cls_mall_head *head = rtnl_dereference(tp->root); | ||||
| +	struct cls_mall_filter *fold = (struct cls_mall_filter *) *arg; | ||||
| +	struct cls_mall_filter *f; | ||||
| +	struct nlattr *tb[TCA_MATCHALL_MAX + 1]; | ||||
| +	int err; | ||||
| + | ||||
| +	if (!tca[TCA_OPTIONS]) | ||||
| +		return -EINVAL; | ||||
| + | ||||
| +	if (head->filter) | ||||
| +		return -EBUSY; | ||||
| + | ||||
| +	if (fold) | ||||
| +		return -EINVAL; | ||||
| + | ||||
| +	err = nla_parse_nested(tb, TCA_MATCHALL_MAX, | ||||
| +			       tca[TCA_OPTIONS], mall_policy); | ||||
| +	if (err < 0) | ||||
| +		return err; | ||||
| + | ||||
| +	f = kzalloc(sizeof(*f), GFP_KERNEL); | ||||
| +	if (!f) | ||||
| +		return -ENOBUFS; | ||||
| + | ||||
| +	tcf_exts_init(&f->exts, TCA_MATCHALL_ACT, 0); | ||||
| + | ||||
| +	if (!handle) | ||||
| +		handle = 1; | ||||
| +	f->handle = handle; | ||||
| + | ||||
| +	err = mall_set_parms(net, tp, f, base, tb, tca[TCA_RATE], ovr); | ||||
| +	if (err) | ||||
| +		goto errout; | ||||
| + | ||||
| +	*arg = (unsigned long) f; | ||||
| +	rcu_assign_pointer(head->filter, f); | ||||
| + | ||||
| +	return 0; | ||||
| + | ||||
| +errout: | ||||
| +	kfree(f); | ||||
| +	return err; | ||||
| +} | ||||
| + | ||||
| +static int mall_delete(struct tcf_proto *tp, unsigned long arg) | ||||
| +{ | ||||
| +	struct cls_mall_head *head = rtnl_dereference(tp->root); | ||||
| +	struct cls_mall_filter *f = (struct cls_mall_filter *) arg; | ||||
| + | ||||
| +	RCU_INIT_POINTER(head->filter, NULL); | ||||
| +	tcf_unbind_filter(tp, &f->res); | ||||
| +	call_rcu(&f->rcu, mall_destroy_filter); | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +static void mall_walk(struct tcf_proto *tp, struct tcf_walker *arg) | ||||
| +{ | ||||
| +	struct cls_mall_head *head = rtnl_dereference(tp->root); | ||||
| +	struct cls_mall_filter *f = head->filter; | ||||
| + | ||||
| +	if (arg->count < arg->skip) | ||||
| +		goto skip; | ||||
| +	if (arg->fn(tp, (unsigned long) f, arg) < 0) | ||||
| +		arg->stop = 1; | ||||
| +skip: | ||||
| +	arg->count++; | ||||
| +} | ||||
| + | ||||
| +static int mall_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, | ||||
| +		     struct sk_buff *skb, struct tcmsg *t) | ||||
| +{ | ||||
| +	struct cls_mall_filter *f = (struct cls_mall_filter *) fh; | ||||
| +	struct nlattr *nest; | ||||
| + | ||||
| +	if (!f) | ||||
| +		return skb->len; | ||||
| + | ||||
| +	t->tcm_handle = f->handle; | ||||
| + | ||||
| +	nest = nla_nest_start(skb, TCA_OPTIONS); | ||||
| +	if (!nest) | ||||
| +		goto nla_put_failure; | ||||
| + | ||||
| +	if (f->res.classid && | ||||
| +	    nla_put_u32(skb, TCA_MATCHALL_CLASSID, f->res.classid)) | ||||
| +		goto nla_put_failure; | ||||
| + | ||||
| +	if (tcf_exts_dump(skb, &f->exts)) | ||||
| +		goto nla_put_failure; | ||||
| + | ||||
| +	nla_nest_end(skb, nest); | ||||
| + | ||||
| +	if (tcf_exts_dump_stats(skb, &f->exts) < 0) | ||||
| +		goto nla_put_failure; | ||||
| + | ||||
| +	return skb->len; | ||||
| + | ||||
| +nla_put_failure: | ||||
| +	nla_nest_cancel(skb, nest); | ||||
| +	return -1; | ||||
| +} | ||||
| + | ||||
| +static struct tcf_proto_ops cls_mall_ops __read_mostly = { | ||||
| +	.kind		= "matchall", | ||||
| +	.classify	= mall_classify, | ||||
| +	.init		= mall_init, | ||||
| +	.destroy	= mall_destroy, | ||||
| +	.get		= mall_get, | ||||
| +	.change		= mall_change, | ||||
| +	.delete		= mall_delete, | ||||
| +	.walk		= mall_walk, | ||||
| +	.dump		= mall_dump, | ||||
| +	.owner		= THIS_MODULE, | ||||
| +}; | ||||
| + | ||||
| +static int __init cls_mall_init(void) | ||||
| +{ | ||||
| +	return register_tcf_proto_ops(&cls_mall_ops); | ||||
| +} | ||||
| + | ||||
| +static void __exit cls_mall_exit(void) | ||||
| +{ | ||||
| +	unregister_tcf_proto_ops(&cls_mall_ops); | ||||
| +} | ||||
| + | ||||
| +module_init(cls_mall_init); | ||||
| +module_exit(cls_mall_exit); | ||||
| + | ||||
| +MODULE_AUTHOR("Jiri Pirko <jiri@mellanox.com>"); | ||||
| +MODULE_DESCRIPTION("Match-all classifier"); | ||||
| +MODULE_LICENSE("GPL v2"); | ||||
| --- a/net/sched/Kconfig | ||||
| +++ b/net/sched/Kconfig | ||||
| @@ -526,6 +526,16 @@ config NET_CLS_FLOWER | ||||
|  	  To compile this code as a module, choose M here: the module will | ||||
|  	  be called cls_flower. | ||||
|   | ||||
| +config NET_CLS_MATCHALL | ||||
| +	tristate "Match-all classifier" | ||||
| +	select NET_CLS | ||||
| +	---help--- | ||||
| +	  If you say Y here, you will be able to classify packets based on | ||||
| +	  nothing. Every packet will match. | ||||
| + | ||||
| +	  To compile this code as a module, choose M here: the module will | ||||
| +	  be called cls_matchall. | ||||
| + | ||||
|  config NET_EMATCH | ||||
|  	bool "Extended Matches" | ||||
|  	select NET_CLS | ||||
| --- a/net/sched/Makefile | ||||
| +++ b/net/sched/Makefile | ||||
| @@ -58,6 +58,7 @@ obj-$(CONFIG_NET_CLS_FLOW)	+= cls_flow.o | ||||
|  obj-$(CONFIG_NET_CLS_CGROUP)	+= cls_cgroup.o | ||||
|  obj-$(CONFIG_NET_CLS_BPF)	+= cls_bpf.o | ||||
|  obj-$(CONFIG_NET_CLS_FLOWER)	+= cls_flower.o | ||||
| +obj-$(CONFIG_NET_CLS_MATCHALL)	+= cls_matchall.o | ||||
|  obj-$(CONFIG_NET_EMATCH)	+= ematch.o | ||||
|  obj-$(CONFIG_NET_EMATCH_CMP)	+= em_cmp.o | ||||
|  obj-$(CONFIG_NET_EMATCH_NBYTE)	+= em_nbyte.o | ||||
| @@ -0,0 +1,72 @@ | ||||
| From: Stefano Brivio <sbrivio@redhat.com> | ||||
| Date: Tue, 4 Aug 2020 07:53:42 +0200 | ||||
| Subject: [PATCH] ipv4: route: Ignore output interface in FIB lookup for PMTU | ||||
|  route | ||||
|  | ||||
| Currently, processes sending traffic to a local bridge with an | ||||
| encapsulation device as a port don't get ICMP errors if they exceed | ||||
| the PMTU of the encapsulated link. | ||||
|  | ||||
| David Ahern suggested this as a hack, but it actually looks like | ||||
| the correct solution: when we update the PMTU for a given destination | ||||
| by means of updating or creating a route exception, the encapsulation | ||||
| might trigger this because of PMTU discovery happening either on the | ||||
| encapsulation device itself, or its lower layer. This happens on | ||||
| bridged encapsulations only. | ||||
|  | ||||
| The output interface shouldn't matter, because we already have a | ||||
| valid destination. Drop the output interface restriction from the | ||||
| associated route lookup. | ||||
|  | ||||
| For UDP tunnels, we will now have a route exception created for the | ||||
| encapsulation itself, with a MTU value reflecting its headroom, which | ||||
| allows a bridge forwarding IP packets originated locally to deliver | ||||
| errors back to the sending socket. | ||||
|  | ||||
| The behaviour is now consistent with IPv6 and verified with selftests | ||||
| pmtu_ipv{4,6}_br_{geneve,vxlan}{4,6}_exception introduced later in | ||||
| this series. | ||||
|  | ||||
| v2: | ||||
| - reset output interface only for bridge ports (David Ahern) | ||||
| - add and use netif_is_any_bridge_port() helper (David Ahern) | ||||
|  | ||||
| Suggested-by: David Ahern <dsahern@gmail.com> | ||||
| Signed-off-by: Stefano Brivio <sbrivio@redhat.com> | ||||
| Reviewed-by: David Ahern <dsahern@gmail.com> | ||||
| Signed-off-by: David S. Miller <davem@davemloft.net> | ||||
| --- | ||||
|  | ||||
| --- a/include/linux/netdevice.h | ||||
| +++ b/include/linux/netdevice.h | ||||
| @@ -4015,6 +4015,16 @@ static inline bool netif_is_ovs_master(c | ||||
|  	return dev->priv_flags & IFF_OPENVSWITCH; | ||||
|  } | ||||
|   | ||||
| +static inline bool netif_is_ovs_port(const struct net_device *dev) | ||||
| +{ | ||||
| +	return dev->priv_flags & IFF_OVS_DATAPATH; | ||||
| +} | ||||
| + | ||||
| +static inline bool netif_is_any_bridge_port(const struct net_device *dev) | ||||
| +{ | ||||
| +	return netif_is_bridge_port(dev) || netif_is_ovs_port(dev); | ||||
| +} | ||||
| + | ||||
|  static inline bool netif_is_ifb_dev(const struct net_device *dev) | ||||
|  { | ||||
|  	return dev->priv_flags_ext & IFF_EXT_IFB; | ||||
| --- a/net/ipv4/route.c | ||||
| +++ b/net/ipv4/route.c | ||||
| @@ -1004,6 +1004,11 @@ static void ip_rt_update_pmtu(struct dst | ||||
|  	struct flowi4 fl4; | ||||
|   | ||||
|  	ip_rt_build_flow_key(&fl4, sk, skb); | ||||
| + | ||||
| +	/* Don't make lookup fail for bridged encapsulations */ | ||||
| +	if (skb && netif_is_any_bridge_port(skb->dev)) | ||||
| +		fl4.flowi4_oif = 0; | ||||
| + | ||||
|  	__ip_rt_update_pmtu(rt, &fl4, mtu); | ||||
|  } | ||||
|   | ||||
| @@ -0,0 +1,57 @@ | ||||
| From: Matteo Croce <mcroce@redhat.com> | ||||
| Date: Sat, 2 Nov 2019 01:12:03 +0100 | ||||
| Subject: [PATCH] icmp: add helpers to recognize ICMP error packets | ||||
|  | ||||
| Add two helper functions, one for IPv4 and one for IPv6, to recognize | ||||
| the ICMP packets which are error responses. | ||||
| This packets are special because they have as payload the original | ||||
| header of the packet which generated it (RFC 792 says at least 8 bytes, | ||||
| but Linux actually includes much more than that). | ||||
|  | ||||
| Signed-off-by: Matteo Croce <mcroce@redhat.com> | ||||
| Signed-off-by: David S. Miller <davem@davemloft.net> | ||||
| --- | ||||
|  | ||||
| --- a/include/linux/icmp.h | ||||
| +++ b/include/linux/icmp.h | ||||
| @@ -24,4 +24,19 @@ static inline struct icmphdr *icmp_hdr(c | ||||
|  { | ||||
|  	return (struct icmphdr *)skb_transport_header(skb); | ||||
|  } | ||||
| + | ||||
| +static inline bool icmp_is_err(int type) | ||||
| +{ | ||||
| +	switch (type) { | ||||
| +	case ICMP_DEST_UNREACH: | ||||
| +	case ICMP_SOURCE_QUENCH: | ||||
| +	case ICMP_REDIRECT: | ||||
| +	case ICMP_TIME_EXCEEDED: | ||||
| +	case ICMP_PARAMETERPROB: | ||||
| +		return true; | ||||
| +	} | ||||
| + | ||||
| +	return false; | ||||
| +} | ||||
| + | ||||
|  #endif	/* _LINUX_ICMP_H */ | ||||
| --- a/include/linux/icmpv6.h | ||||
| +++ b/include/linux/icmpv6.h | ||||
| @@ -42,4 +42,18 @@ extern void				icmpv6_flow_init(struct s | ||||
|  							 const struct in6_addr *saddr, | ||||
|  							 const struct in6_addr *daddr, | ||||
|  							 int oif); | ||||
| + | ||||
| +static inline bool icmpv6_is_err(int type) | ||||
| +{ | ||||
| +	switch (type) { | ||||
| +	case ICMPV6_DEST_UNREACH: | ||||
| +	case ICMPV6_PKT_TOOBIG: | ||||
| +	case ICMPV6_TIME_EXCEED: | ||||
| +	case ICMPV6_PARAMPROB: | ||||
| +		return true; | ||||
| +	} | ||||
| + | ||||
| +	return false; | ||||
| +} | ||||
| + | ||||
|  #endif | ||||
| @@ -0,0 +1,360 @@ | ||||
| From: Stefano Brivio <sbrivio@redhat.com> | ||||
| Date: Tue, 4 Aug 2020 07:53:43 +0200 | ||||
| Subject: [PATCH] tunnels: PMTU discovery support for directly bridged IP | ||||
|  packets | ||||
|  | ||||
| It's currently possible to bridge Ethernet tunnels carrying IP | ||||
| packets directly to external interfaces without assigning them | ||||
| addresses and routes on the bridged network itself: this is the case | ||||
| for UDP tunnels bridged with a standard bridge or by Open vSwitch. | ||||
|  | ||||
| PMTU discovery is currently broken with those configurations, because | ||||
| the encapsulation effectively decreases the MTU of the link, and | ||||
| while we are able to account for this using PMTU discovery on the | ||||
| lower layer, we don't have a way to relay ICMP or ICMPv6 messages | ||||
| needed by the sender, because we don't have valid routes to it. | ||||
|  | ||||
| On the other hand, as a tunnel endpoint, we can't fragment packets | ||||
| as a general approach: this is for instance clearly forbidden for | ||||
| VXLAN by RFC 7348, section 4.3: | ||||
|  | ||||
|    VTEPs MUST NOT fragment VXLAN packets.  Intermediate routers may | ||||
|    fragment encapsulated VXLAN packets due to the larger frame size. | ||||
|    The destination VTEP MAY silently discard such VXLAN fragments. | ||||
|  | ||||
| The same paragraph recommends that the MTU over the physical network | ||||
| accomodates for encapsulations, but this isn't a practical option for | ||||
| complex topologies, especially for typical Open vSwitch use cases. | ||||
|  | ||||
| Further, it states that: | ||||
|  | ||||
|    Other techniques like Path MTU discovery (see [RFC1191] and | ||||
|    [RFC1981]) MAY be used to address this requirement as well. | ||||
|  | ||||
| Now, PMTU discovery already works for routed interfaces, we get | ||||
| route exceptions created by the encapsulation device as they receive | ||||
| ICMP Fragmentation Needed and ICMPv6 Packet Too Big messages, and | ||||
| we already rebuild those messages with the appropriate MTU and route | ||||
| them back to the sender. | ||||
|  | ||||
| Add the missing bits for bridged cases: | ||||
|  | ||||
| - checks in skb_tunnel_check_pmtu() to understand if it's appropriate | ||||
|   to trigger a reply according to RFC 1122 section 3.2.2 for ICMP and | ||||
|   RFC 4443 section 2.4 for ICMPv6. This function is already called by | ||||
|   UDP tunnels | ||||
|  | ||||
| - a new function generating those ICMP or ICMPv6 replies. We can't | ||||
|   reuse icmp_send() and icmp6_send() as we don't see the sender as a | ||||
|   valid destination. This doesn't need to be generic, as we don't | ||||
|   cover any other type of ICMP errors given that we only provide an | ||||
|   encapsulation function to the sender | ||||
|  | ||||
| While at it, make the MTU check in skb_tunnel_check_pmtu() accurate: | ||||
| we might receive GSO buffers here, and the passed headroom already | ||||
| includes the inner MAC length, so we don't have to account for it | ||||
| a second time (that would imply three MAC headers on the wire, but | ||||
| there are just two). | ||||
|  | ||||
| This issue became visible while bridging IPv6 packets with 4500 bytes | ||||
| of payload over GENEVE using IPv4 with a PMTU of 4000. Given the 50 | ||||
| bytes of encapsulation headroom, we would advertise MTU as 3950, and | ||||
| we would reject fragmented IPv6 datagrams of 3958 bytes size on the | ||||
| wire. We're exclusively dealing with network MTU here, though, so we | ||||
| could get Ethernet frames up to 3964 octets in that case. | ||||
|  | ||||
| v2: | ||||
| - moved skb_tunnel_check_pmtu() to ip_tunnel_core.c (David Ahern) | ||||
| - split IPv4/IPv6 functions (David Ahern) | ||||
|  | ||||
| Signed-off-by: Stefano Brivio <sbrivio@redhat.com> | ||||
| Reviewed-by: David Ahern <dsahern@gmail.com> | ||||
| Signed-off-by: David S. Miller <davem@davemloft.net> | ||||
| --- | ||||
|  | ||||
| --- a/include/net/ip_tunnels.h | ||||
| +++ b/include/net/ip_tunnels.h | ||||
| @@ -279,6 +279,8 @@ int iptunnel_xmit(struct sock *sk, struc | ||||
|  		  u8 tos, u8 ttl, __be16 df, bool xnet); | ||||
|  struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md, | ||||
|  					     gfp_t flags); | ||||
| +int skb_tunnel_check_pmtu(struct sk_buff *skb, struct dst_entry *encap_dst, | ||||
| +			  int headroom, bool reply); | ||||
|   | ||||
|  struct sk_buff *iptunnel_handle_offloads(struct sk_buff *skb, bool gre_csum, | ||||
|  					 int gso_type_mask); | ||||
| --- a/net/ipv4/ip_tunnel_core.c | ||||
| +++ b/net/ipv4/ip_tunnel_core.c | ||||
| @@ -204,6 +204,252 @@ error: | ||||
|  } | ||||
|  EXPORT_SYMBOL_GPL(iptunnel_handle_offloads); | ||||
|   | ||||
| +/** | ||||
| + * iptunnel_pmtud_build_icmp() - Build ICMP error message for PMTUD | ||||
| + * @skb:	Original packet with L2 header | ||||
| + * @mtu:	MTU value for ICMP error | ||||
| + * | ||||
| + * Return: length on success, negative error code if message couldn't be built. | ||||
| + */ | ||||
| +static int iptunnel_pmtud_build_icmp(struct sk_buff *skb, int mtu) | ||||
| +{ | ||||
| +	const struct iphdr *iph = ip_hdr(skb); | ||||
| +	struct icmphdr *icmph; | ||||
| +	struct iphdr *niph; | ||||
| +	struct ethhdr eh; | ||||
| +	int len, err; | ||||
| + | ||||
| +	if (!pskb_may_pull(skb, ETH_HLEN + sizeof(struct iphdr))) | ||||
| +		return -EINVAL; | ||||
| + | ||||
| +	skb_copy_bits(skb, skb_mac_header(skb) - skb->data, &eh, ETH_HLEN); | ||||
| +	pskb_pull(skb, ETH_HLEN); | ||||
| +	skb_reset_network_header(skb); | ||||
| + | ||||
| +	err = pskb_trim(skb, 576 - sizeof(*niph) - sizeof(*icmph)); | ||||
| +	if (err) | ||||
| +		return err; | ||||
| + | ||||
| +	len = skb->len + sizeof(*icmph); | ||||
| +	err = skb_cow(skb, sizeof(*niph) + sizeof(*icmph) + ETH_HLEN); | ||||
| +	if (err) | ||||
| +		return err; | ||||
| + | ||||
| +	icmph = (struct icmphdr *)skb_push(skb, sizeof(*icmph)); | ||||
| +	*icmph = (struct icmphdr) { | ||||
| +		.type			= ICMP_DEST_UNREACH, | ||||
| +		.code			= ICMP_FRAG_NEEDED, | ||||
| +		.checksum		= 0, | ||||
| +		.un.frag.__unused	= 0, | ||||
| +		.un.frag.mtu		= ntohs(mtu), | ||||
| +	}; | ||||
| +	icmph->checksum = ip_compute_csum(icmph, len); | ||||
| +	skb_reset_transport_header(skb); | ||||
| + | ||||
| +	niph = (struct iphdr *)skb_push(skb, sizeof(*niph)); | ||||
| +	*niph = (struct iphdr) { | ||||
| +		.ihl			= sizeof(*niph) / 4u, | ||||
| +		.version 		= 4, | ||||
| +		.tos 			= 0, | ||||
| +		.tot_len		= htons(len + sizeof(*niph)), | ||||
| +		.id			= 0, | ||||
| +		.frag_off		= htons(IP_DF), | ||||
| +		.ttl			= iph->ttl, | ||||
| +		.protocol		= IPPROTO_ICMP, | ||||
| +		.saddr			= iph->daddr, | ||||
| +		.daddr			= iph->saddr, | ||||
| +	}; | ||||
| +	ip_send_check(niph); | ||||
| +	skb_reset_network_header(skb); | ||||
| + | ||||
| +	skb->ip_summed = CHECKSUM_NONE; | ||||
| + | ||||
| +	eth_header(skb, skb->dev, htons(eh.h_proto), eh.h_source, eh.h_dest, 0); | ||||
| +	skb_reset_mac_header(skb); | ||||
| + | ||||
| +	return skb->len; | ||||
| +} | ||||
| + | ||||
| +/** | ||||
| + * iptunnel_pmtud_check_icmp() - Trigger ICMP reply if needed and allowed | ||||
| + * @skb:	Buffer being sent by encapsulation, L2 headers expected | ||||
| + * @mtu:	Network MTU for path | ||||
| + * | ||||
| + * Return: 0 for no ICMP reply, length if built, negative value on error. | ||||
| + */ | ||||
| +static int iptunnel_pmtud_check_icmp(struct sk_buff *skb, int mtu) | ||||
| +{ | ||||
| +	const struct icmphdr *icmph = icmp_hdr(skb); | ||||
| +	const struct iphdr *iph = ip_hdr(skb); | ||||
| + | ||||
| +	if (mtu <= 576 || iph->frag_off != htons(IP_DF)) | ||||
| +		return 0; | ||||
| + | ||||
| +	if (ipv4_is_lbcast(iph->daddr)  || ipv4_is_multicast(iph->daddr) || | ||||
| +	    ipv4_is_zeronet(iph->saddr) || ipv4_is_loopback(iph->saddr)  || | ||||
| +	    ipv4_is_lbcast(iph->saddr)  || ipv4_is_multicast(iph->saddr)) | ||||
| +		return 0; | ||||
| + | ||||
| +	if (iph->protocol == IPPROTO_ICMP && icmp_is_err(icmph->type)) | ||||
| +		return 0; | ||||
| + | ||||
| +	return iptunnel_pmtud_build_icmp(skb, mtu); | ||||
| +} | ||||
| + | ||||
| +#if IS_ENABLED(CONFIG_IPV6) | ||||
| +/** | ||||
| + * iptunnel_pmtud_build_icmpv6() - Build ICMPv6 error message for PMTUD | ||||
| + * @skb:	Original packet with L2 header | ||||
| + * @mtu:	MTU value for ICMPv6 error | ||||
| + * | ||||
| + * Return: length on success, negative error code if message couldn't be built. | ||||
| + */ | ||||
| +static int iptunnel_pmtud_build_icmpv6(struct sk_buff *skb, int mtu) | ||||
| +{ | ||||
| +	const struct ipv6hdr *ip6h = ipv6_hdr(skb); | ||||
| +	struct icmp6hdr *icmp6h; | ||||
| +	struct ipv6hdr *nip6h; | ||||
| +	struct ethhdr eh; | ||||
| +	int len, err; | ||||
| +	__wsum csum; | ||||
| + | ||||
| +	if (!pskb_may_pull(skb, ETH_HLEN + sizeof(struct ipv6hdr))) | ||||
| +		return -EINVAL; | ||||
| + | ||||
| +	skb_copy_bits(skb, skb_mac_header(skb) - skb->data, &eh, ETH_HLEN); | ||||
| +	pskb_pull(skb, ETH_HLEN); | ||||
| +	skb_reset_network_header(skb); | ||||
| + | ||||
| +	err = pskb_trim(skb, IPV6_MIN_MTU - sizeof(*nip6h) - sizeof(*icmp6h)); | ||||
| +	if (err) | ||||
| +		return err; | ||||
| + | ||||
| +	len = skb->len + sizeof(*icmp6h); | ||||
| +	err = skb_cow(skb, sizeof(*nip6h) + sizeof(*icmp6h) + ETH_HLEN); | ||||
| +	if (err) | ||||
| +		return err; | ||||
| + | ||||
| +	icmp6h = (struct icmp6hdr *)skb_push(skb, sizeof(*icmp6h)); | ||||
| +	*icmp6h = (struct icmp6hdr) { | ||||
| +		.icmp6_type		= ICMPV6_PKT_TOOBIG, | ||||
| +		.icmp6_code		= 0, | ||||
| +		.icmp6_cksum		= 0, | ||||
| +		.icmp6_mtu		= htonl(mtu), | ||||
| +	}; | ||||
| +	skb_reset_transport_header(skb); | ||||
| + | ||||
| +	nip6h = (struct ipv6hdr *)skb_push(skb, sizeof(*nip6h)); | ||||
| +	*nip6h = (struct ipv6hdr) { | ||||
| +		.priority		= 0, | ||||
| +		.version		= 6, | ||||
| +		.flow_lbl		= { 0 }, | ||||
| +		.payload_len		= htons(len), | ||||
| +		.nexthdr		= IPPROTO_ICMPV6, | ||||
| +		.hop_limit		= ip6h->hop_limit, | ||||
| +		.saddr			= ip6h->daddr, | ||||
| +		.daddr			= ip6h->saddr, | ||||
| +	}; | ||||
| +	skb_reset_network_header(skb); | ||||
| + | ||||
| +	csum = csum_partial(icmp6h, len, 0); | ||||
| +	icmp6h->icmp6_cksum = csum_ipv6_magic(&nip6h->saddr, &nip6h->daddr, len, | ||||
| +					      IPPROTO_ICMPV6, csum); | ||||
| + | ||||
| +	skb->ip_summed = CHECKSUM_NONE; | ||||
| + | ||||
| +	eth_header(skb, skb->dev, htons(eh.h_proto), eh.h_source, eh.h_dest, 0); | ||||
| +	skb_reset_mac_header(skb); | ||||
| + | ||||
| +	return skb->len; | ||||
| +} | ||||
| + | ||||
| +/** | ||||
| + * iptunnel_pmtud_check_icmpv6() - Trigger ICMPv6 reply if needed and allowed | ||||
| + * @skb:	Buffer being sent by encapsulation, L2 headers expected | ||||
| + * @mtu:	Network MTU for path | ||||
| + * | ||||
| + * Return: 0 for no ICMPv6 reply, length if built, negative value on error. | ||||
| + */ | ||||
| +static int iptunnel_pmtud_check_icmpv6(struct sk_buff *skb, int mtu) | ||||
| +{ | ||||
| +	const struct ipv6hdr *ip6h = ipv6_hdr(skb); | ||||
| +	int stype = ipv6_addr_type(&ip6h->saddr); | ||||
| +	u8 proto = ip6h->nexthdr; | ||||
| +	__be16 frag_off; | ||||
| +	int offset; | ||||
| + | ||||
| +	if (mtu <= IPV6_MIN_MTU) | ||||
| +		return 0; | ||||
| + | ||||
| +	if (stype == IPV6_ADDR_ANY || stype == IPV6_ADDR_MULTICAST || | ||||
| +	    stype == IPV6_ADDR_LOOPBACK) | ||||
| +		return 0; | ||||
| + | ||||
| +	offset = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &proto, | ||||
| +				  &frag_off); | ||||
| +	if (offset < 0 || (frag_off & htons(~0x7))) | ||||
| +		return 0; | ||||
| + | ||||
| +	if (proto == IPPROTO_ICMPV6) { | ||||
| +		struct icmp6hdr *icmp6h; | ||||
| + | ||||
| +		if (!pskb_may_pull(skb, skb_network_header(skb) + | ||||
| +					offset + 1 - skb->data)) | ||||
| +			return 0; | ||||
| + | ||||
| +		icmp6h = (struct icmp6hdr *)(skb_network_header(skb) + offset); | ||||
| +		if (icmpv6_is_err(icmp6h->icmp6_type) || | ||||
| +		    icmp6h->icmp6_type == NDISC_REDIRECT) | ||||
| +			return 0; | ||||
| +	} | ||||
| + | ||||
| +	return iptunnel_pmtud_build_icmpv6(skb, mtu); | ||||
| +} | ||||
| +#endif /* IS_ENABLED(CONFIG_IPV6) */ | ||||
| + | ||||
| +/** | ||||
| + * skb_tunnel_check_pmtu() - Check, update PMTU and trigger ICMP reply as needed | ||||
| + * @skb:	Buffer being sent by encapsulation, L2 headers expected | ||||
| + * @encap_dst:	Destination for tunnel encapsulation (outer IP) | ||||
| + * @headroom:	Encapsulation header size, bytes | ||||
| + * @reply:	Build matching ICMP or ICMPv6 message as a result | ||||
| + * | ||||
| + * L2 tunnel implementations that can carry IP and can be directly bridged | ||||
| + * (currently UDP tunnels) can't always rely on IP forwarding paths to handle | ||||
| + * PMTU discovery. In the bridged case, ICMP or ICMPv6 messages need to be built | ||||
| + * based on payload and sent back by the encapsulation itself. | ||||
| + * | ||||
| + * For routable interfaces, we just need to update the PMTU for the destination. | ||||
| + * | ||||
| + * Return: 0 if ICMP error not needed, length if built, negative value on error | ||||
| + */ | ||||
| +int skb_tunnel_check_pmtu(struct sk_buff *skb, struct dst_entry *encap_dst, | ||||
| +			  int headroom, bool reply) | ||||
| +{ | ||||
| +	struct dst_entry *dst = skb_dst(skb); | ||||
| +	u32 mtu = dst_mtu(encap_dst) - headroom; | ||||
| + | ||||
| +	if ((skb_is_gso(skb) && skb_gso_network_seglen(skb) <= mtu) || | ||||
| +	    (!skb_is_gso(skb) && (skb->len - skb_mac_header_len(skb)) <= mtu)) | ||||
| +		return 0; | ||||
| + | ||||
| +	if (dst && dst->ops->update_pmtu) | ||||
| +		dst->ops->update_pmtu(dst, NULL, skb, mtu); | ||||
| + | ||||
| +	if (!reply || skb->pkt_type == PACKET_HOST) | ||||
| +		return 0; | ||||
| + | ||||
| +	if (skb->protocol == htons(ETH_P_IP)) | ||||
| +		return iptunnel_pmtud_check_icmp(skb, mtu); | ||||
| + | ||||
| +#if IS_ENABLED(CONFIG_IPV6) | ||||
| +	if (skb->protocol == htons(ETH_P_IPV6)) | ||||
| +		return iptunnel_pmtud_check_icmpv6(skb, mtu); | ||||
| +#endif | ||||
| +	return 0; | ||||
| +} | ||||
| +EXPORT_SYMBOL(skb_tunnel_check_pmtu); | ||||
| + | ||||
|  /* Often modified stats are per cpu, other are shared (netdev->stats) */ | ||||
|  struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev, | ||||
|  						struct rtnl_link_stats64 *tot) | ||||
| --- a/drivers/net/vxlan.c | ||||
| +++ b/drivers/net/vxlan.c | ||||
| @@ -2076,6 +2076,8 @@ static void vxlan_xmit_one(struct sk_buf | ||||
|  		/* Reset the skb_iif to Tunnels interface index */ | ||||
|  		skb->skb_iif = dev->ifindex; | ||||
|   | ||||
| +		skb_tunnel_check_pmtu(skb, &rt->dst, VXLAN_HEADROOM, false); | ||||
| + | ||||
|  		tos = ip_tunnel_ecn_encap(tos, old_iph, skb); | ||||
|  		ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); | ||||
|  		err = vxlan_xmit_skb(rt, sk, skb, fl4.saddr, | ||||
| @@ -2141,6 +2143,8 @@ static void vxlan_xmit_one(struct sk_buf | ||||
|  				flags |= VXLAN_F_UDP_ZERO_CSUM6_TX; | ||||
|  		} | ||||
|   | ||||
| +		skb_tunnel_check_pmtu(skb, ndst, VXLAN6_HEADROOM, false); | ||||
| + | ||||
|  		ttl = ttl ? : ip6_dst_hoplimit(ndst); | ||||
|  		err = vxlan6_xmit_skb(ndst, sk, skb, dev, &saddr, &dst->sin6.sin6_addr, | ||||
|  				      0, ttl, src_port, dst_port, htonl(vni << 8), md, | ||||
| @@ -0,0 +1,114 @@ | ||||
| From: pravin shelar <pshelar@ovn.org> | ||||
| Date: Sun, 13 Nov 2016 20:43:56 -0800 | ||||
| Subject: [PATCH] vxlan: simplify RTF_LOCAL handling. | ||||
|  | ||||
| Avoid code duplicate code for handling RTF_LOCAL routes. | ||||
|  | ||||
| Signed-off-by: Pravin B Shelar <pshelar@ovn.org> | ||||
| Acked-by: Jiri Benc <jbenc@redhat.com> | ||||
| Signed-off-by: David S. Miller <davem@davemloft.net> | ||||
| --- | ||||
|  | ||||
| --- a/drivers/net/vxlan.c | ||||
| +++ b/drivers/net/vxlan.c | ||||
| @@ -1946,6 +1946,40 @@ static void vxlan_encap_bypass(struct sk | ||||
|  	} | ||||
|  } | ||||
|   | ||||
| +static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev, | ||||
| +				 struct vxlan_dev *vxlan, union vxlan_addr *daddr, | ||||
| +				 __be32 dst_port, __be32 vni, struct dst_entry *dst, | ||||
| +				 u32 rt_flags) | ||||
| +{ | ||||
| +#if IS_ENABLED(CONFIG_IPV6) | ||||
| +	/* IPv6 rt-flags are checked against RTF_LOCAL, but the value of | ||||
| +	 * RTF_LOCAL is equal to RTCF_LOCAL. So to keep code simple | ||||
| +	 * we can use RTCF_LOCAL which works for ipv4 and ipv6 route entry. | ||||
| +	 */ | ||||
| +	BUILD_BUG_ON(RTCF_LOCAL != RTF_LOCAL); | ||||
| +#endif | ||||
| +	/* Bypass encapsulation if the destination is local */ | ||||
| +	if (rt_flags & RTCF_LOCAL && | ||||
| +	    !(rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))) { | ||||
| +		struct vxlan_dev *dst_vxlan; | ||||
| + | ||||
| +		dst_release(dst); | ||||
| +		dst_vxlan = vxlan_find_vni(vxlan->net, vni, | ||||
| +					   daddr->sa.sa_family, dst_port, | ||||
| +					   vxlan->flags); | ||||
| +		if (!dst_vxlan) { | ||||
| +			dev->stats.tx_errors++; | ||||
| +			kfree_skb(skb); | ||||
| + | ||||
| +			return -ENOENT; | ||||
| +		} | ||||
| +		vxlan_encap_bypass(skb, vxlan, dst_vxlan); | ||||
| +		return 1; | ||||
| +	} | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
|  static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, | ||||
|  			   struct vxlan_rdst *rdst, bool did_rsc) | ||||
|  { | ||||
| @@ -2059,18 +2093,12 @@ static void vxlan_xmit_one(struct sk_buf | ||||
|  		} | ||||
|   | ||||
|  		/* Bypass encapsulation if the destination is local */ | ||||
| -		if (rt->rt_flags & RTCF_LOCAL && | ||||
| -		    !(rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))) { | ||||
| -			struct vxlan_dev *dst_vxlan; | ||||
| - | ||||
| -			ip_rt_put(rt); | ||||
| -			dst_vxlan = vxlan_find_vni(vxlan->net, vni, | ||||
| -						   dst->sa.sa_family, dst_port, | ||||
| -						   vxlan->flags); | ||||
| -			if (!dst_vxlan) | ||||
| -				goto tx_error; | ||||
| -			vxlan_encap_bypass(skb, vxlan, dst_vxlan); | ||||
| -			return; | ||||
| +		if (!info) { | ||||
| +			err = encap_bypass_if_local(skb, dev, vxlan, dst, | ||||
| +						    dst_port, vni, &rt->dst, | ||||
| +						    rt->rt_flags); | ||||
| +			if (err) | ||||
| +				return; | ||||
|  		} | ||||
|   | ||||
|  		/* Reset the skb_iif to Tunnels interface index */ | ||||
| @@ -2096,7 +2124,6 @@ static void vxlan_xmit_one(struct sk_buf | ||||
|  	} else { | ||||
|  		struct dst_entry *ndst; | ||||
|  		struct in6_addr saddr; | ||||
| -		u32 rt6i_flags; | ||||
|   | ||||
|  		if (!vxlan->vn6_sock) | ||||
|  			goto drop; | ||||
| @@ -2121,19 +2148,14 @@ static void vxlan_xmit_one(struct sk_buf | ||||
|  		} | ||||
|   | ||||
|  		/* Bypass encapsulation if the destination is local */ | ||||
| -		rt6i_flags = ((struct rt6_info *)ndst)->rt6i_flags; | ||||
| -		if (rt6i_flags & RTF_LOCAL && | ||||
| -		    !(rt6i_flags & (RTCF_BROADCAST | RTCF_MULTICAST))) { | ||||
| -			struct vxlan_dev *dst_vxlan; | ||||
| +		if (!info) { | ||||
| +			u32 rt6i_flags = ((struct rt6_info *)ndst)->rt6i_flags; | ||||
|   | ||||
| -			dst_release(ndst); | ||||
| -			dst_vxlan = vxlan_find_vni(vxlan->net, vni, | ||||
| -						   dst->sa.sa_family, dst_port, | ||||
| -						   vxlan->flags); | ||||
| -			if (!dst_vxlan) | ||||
| -				goto tx_error; | ||||
| -			vxlan_encap_bypass(skb, vxlan, dst_vxlan); | ||||
| -			return; | ||||
| +			err = encap_bypass_if_local(skb, dev, vxlan, dst, | ||||
| +						    dst_port, vni, ndst, | ||||
| +						    rt6i_flags); | ||||
| +			if (err) | ||||
| +				return; | ||||
|  		} | ||||
|   | ||||
|  		if (info) { | ||||
| @@ -0,0 +1,140 @@ | ||||
| From: Stefano Brivio <sbrivio@redhat.com> | ||||
| Date: Tue, 4 Aug 2020 07:53:44 +0200 | ||||
| Subject: [PATCH] vxlan: Support for PMTU discovery on directly bridged links | ||||
|  | ||||
| If the interface is a bridge or Open vSwitch port, and we can't | ||||
| forward a packet because it exceeds the local PMTU estimate, | ||||
| trigger an ICMP or ICMPv6 reply to the sender, using the same | ||||
| interface to forward it back. | ||||
|  | ||||
| If metadata collection is enabled, reverse destination and source | ||||
| addresses, so that Open vSwitch is able to match this packet against | ||||
| the existing, reverse flow. | ||||
|  | ||||
| v2: Use netif_is_any_bridge_port() (David Ahern) | ||||
|  | ||||
| Signed-off-by: Stefano Brivio <sbrivio@redhat.com> | ||||
| Signed-off-by: David S. Miller <davem@davemloft.net> | ||||
| --- | ||||
|  | ||||
| --- a/drivers/net/vxlan.c | ||||
| +++ b/drivers/net/vxlan.c | ||||
| @@ -1903,7 +1903,7 @@ static struct dst_entry *vxlan6_get_rout | ||||
|   | ||||
|  /* Bypass encapsulation if the destination is local */ | ||||
|  static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan, | ||||
| -			       struct vxlan_dev *dst_vxlan) | ||||
| +			       struct vxlan_dev *dst_vxlan, bool snoop) | ||||
|  { | ||||
|  	struct pcpu_sw_netstats *tx_stats, *rx_stats; | ||||
|  	union vxlan_addr loopback; | ||||
| @@ -1928,7 +1928,7 @@ static void vxlan_encap_bypass(struct sk | ||||
|  #endif | ||||
|  	} | ||||
|   | ||||
| -	if (dst_vxlan->flags & VXLAN_F_LEARN) | ||||
| +	if ((dst_vxlan->flags & VXLAN_F_LEARN) && snoop) | ||||
|  		vxlan_snoop(skb->dev, &loopback, eth_hdr(skb)->h_source); | ||||
|   | ||||
|  	u64_stats_update_begin(&tx_stats->syncp); | ||||
| @@ -1973,7 +1973,7 @@ static int encap_bypass_if_local(struct | ||||
|   | ||||
|  			return -ENOENT; | ||||
|  		} | ||||
| -		vxlan_encap_bypass(skb, vxlan, dst_vxlan); | ||||
| +		vxlan_encap_bypass(skb, vxlan, dst_vxlan, true); | ||||
|  		return 1; | ||||
|  	} | ||||
|   | ||||
| @@ -1990,7 +1990,7 @@ static void vxlan_xmit_one(struct sk_buf | ||||
|  	const struct iphdr *old_iph; | ||||
|  	struct flowi4 fl4; | ||||
|  	union vxlan_addr *dst; | ||||
| -	union vxlan_addr remote_ip; | ||||
| +	union vxlan_addr remote_ip, local_ip; | ||||
|  	struct vxlan_metadata _md; | ||||
|  	struct vxlan_metadata *md = &_md; | ||||
|  	__be16 src_port = 0, dst_port; | ||||
| @@ -2006,6 +2006,7 @@ static void vxlan_xmit_one(struct sk_buf | ||||
|  		dst_port = rdst->remote_port ? rdst->remote_port : vxlan->cfg.dst_port; | ||||
|  		vni = rdst->remote_vni; | ||||
|  		dst = &rdst->remote_ip; | ||||
| +		local_ip = vxlan->cfg.saddr; | ||||
|  	} else { | ||||
|  		if (!info) { | ||||
|  			WARN_ONCE(1, "%s: Missing encapsulation instructions\n", | ||||
| @@ -2015,17 +2016,20 @@ static void vxlan_xmit_one(struct sk_buf | ||||
|  		dst_port = info->key.tp_dst ? : vxlan->cfg.dst_port; | ||||
|  		vni = be64_to_cpu(info->key.tun_id); | ||||
|  		remote_ip.sa.sa_family = ip_tunnel_info_af(info); | ||||
| -		if (remote_ip.sa.sa_family == AF_INET) | ||||
| +		if (remote_ip.sa.sa_family == AF_INET) { | ||||
|  			remote_ip.sin.sin_addr.s_addr = info->key.u.ipv4.dst; | ||||
| -		else | ||||
| +			local_ip.sin.sin_addr.s_addr = info->key.u.ipv4.src; | ||||
| +		} else { | ||||
|  			remote_ip.sin6.sin6_addr = info->key.u.ipv6.dst; | ||||
| +			local_ip.sin6.sin6_addr = info->key.u.ipv6.src; | ||||
| +		} | ||||
|  		dst = &remote_ip; | ||||
|  	} | ||||
|   | ||||
|  	if (vxlan_addr_any(dst)) { | ||||
|  		if (did_rsc) { | ||||
|  			/* short-circuited back to local bridge */ | ||||
| -			vxlan_encap_bypass(skb, vxlan, vxlan); | ||||
| +			vxlan_encap_bypass(skb, vxlan, vxlan, true); | ||||
|  			return; | ||||
|  		} | ||||
|  		goto drop; | ||||
| @@ -2104,7 +2108,23 @@ static void vxlan_xmit_one(struct sk_buf | ||||
|  		/* Reset the skb_iif to Tunnels interface index */ | ||||
|  		skb->skb_iif = dev->ifindex; | ||||
|   | ||||
| -		skb_tunnel_check_pmtu(skb, &rt->dst, VXLAN_HEADROOM, false); | ||||
| +		err = skb_tunnel_check_pmtu(skb, &rt->dst, VXLAN_HEADROOM, | ||||
| +					    netif_is_any_bridge_port(dev)); | ||||
| +		if (err < 0) { | ||||
| +			goto tx_error; | ||||
| +		} else if (err) { | ||||
| +			if (info) { | ||||
| +				struct in_addr src, dst; | ||||
| + | ||||
| +				src = remote_ip.sin.sin_addr; | ||||
| +				dst = local_ip.sin.sin_addr; | ||||
| +				info->key.u.ipv4.src = src.s_addr; | ||||
| +				info->key.u.ipv4.dst = dst.s_addr; | ||||
| +			} | ||||
| +			vxlan_encap_bypass(skb, vxlan, vxlan, false); | ||||
| +			ip_rt_put(rt); | ||||
| +			return; | ||||
| +		} | ||||
|   | ||||
|  		tos = ip_tunnel_ecn_encap(tos, old_iph, skb); | ||||
|  		ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); | ||||
| @@ -2165,7 +2185,24 @@ static void vxlan_xmit_one(struct sk_buf | ||||
|  				flags |= VXLAN_F_UDP_ZERO_CSUM6_TX; | ||||
|  		} | ||||
|   | ||||
| -		skb_tunnel_check_pmtu(skb, ndst, VXLAN6_HEADROOM, false); | ||||
| +		err = skb_tunnel_check_pmtu(skb, ndst, VXLAN6_HEADROOM, | ||||
| +					    netif_is_any_bridge_port(dev)); | ||||
| +		if (err < 0) { | ||||
| +			goto tx_error; | ||||
| +		} else if (err) { | ||||
| +			if (info) { | ||||
| +				struct in6_addr src, dst; | ||||
| + | ||||
| +				src = remote_ip.sin6.sin6_addr; | ||||
| +				dst = local_ip.sin6.sin6_addr; | ||||
| +				info->key.u.ipv6.src = src; | ||||
| +				info->key.u.ipv6.dst = dst; | ||||
| +			} | ||||
| + | ||||
| +			vxlan_encap_bypass(skb, vxlan, vxlan, false); | ||||
| +			ip_rt_put(rt); | ||||
| +			return; | ||||
| +		} | ||||
|   | ||||
|  		ttl = ttl ? : ip6_dst_hoplimit(ndst); | ||||
|  		err = vxlan6_xmit_skb(ndst, sk, skb, dev, &saddr, &dst->sin6.sin6_addr, | ||||
| @@ -0,0 +1,234 @@ | ||||
| From: Sven Eckelmann <sven@open-mesh.com> | ||||
| Date: Wed, 2 Sep 2015 19:47:43 +0200 | ||||
| Subject: generic: Fix per interface nf_call_iptables setting | ||||
|  | ||||
| commit r30917 ("kernel: bypass all netfilter hooks if the sysctls for that | ||||
| functionality have been disabled - eliminates the overhead of enabling | ||||
| CONFIG_BRIDGE_NETFILTER in the kernel config") introduced an optimization | ||||
| which should reduce/eliminate the overhead for traffic send over bridges on | ||||
| kernels compiled with CONFIG_BRIDGE_NETFILTER=y. But this optimization | ||||
| breaks the nf_call_iptables per bridge setting which is more fine grained | ||||
| than the global sysctl net.bridge.bridge-nf-call-iptables setting. | ||||
|  | ||||
| A test reflecting a real world setup was created to identify if this really | ||||
| eliminates the overhead and if per-bridge nf_call_iptables could be used in | ||||
| some setups to increase the throughput. A Qualcomm Atheros QCA9558 based | ||||
| system with one ethernet and an ath9k wifi 3x3 in HT40 mode was used. | ||||
| Cables from the AP to the wifi station were used to reduce interference | ||||
| problems during the tests. | ||||
|  | ||||
| The wlan interface was put in one bridge interface called br-wlan. This | ||||
| bridge usually contains some more wlan interfaces. The eth0 was put in a | ||||
| second bridge called br-lan. This usually contains some other privileged | ||||
| wlan or mesh interfaces. Routing was added between br-lan and br-wlan. | ||||
|  | ||||
| Three kernels were tested: | ||||
|  | ||||
|  * (default) OpenWrt kernel for this device | ||||
|  * (brfilter-global) OpenWrt kernel with CONFIG_BRIDGE_NETFILTER=y | ||||
|  * (brfilter-local)  OpenWrt kernel with CONFIG_BRIDGE_NETFILTER=y and | ||||
|     without 644-bridge_optimize_netfilter_hooks.patch | ||||
|  | ||||
| The changes to the the netfilter settings of the bridge were done via: | ||||
|  | ||||
|  * (brfilter-global) /sbin/sysctl -w net.bridge.bridge-nf-call-iptables=1 | ||||
|  * (brfilter-lobal) echo 1 > /sys/class/net/br-lan/bridge/nf_call_iptables | ||||
|    and/or echo 1 > /sys/class/net/br-wan/bridge/nf_call_iptables | ||||
|  | ||||
| A station connected to the wlan0 (AP) interface was used to send traffic to | ||||
| a PC connected via ethernet. iperf with 3 concurrent transmissions was used | ||||
| to generate the traffic. | ||||
|  | ||||
| | kernel          | br-nf-* global | nf-call* iface | download | upload   | | ||||
| |-----------------|----------------|----------------|----------|----------| | ||||
| | default         | 0              | -              |      209 |      268 | | ||||
| | brfilter-global | 0              | -              |      185 |      243 | | ||||
| | brfilter-local  | 0              | -              |      187 |      243 | | ||||
| | brfilter-local  | 0              | br-lan         |      157 |      226 | | ||||
| | brfilter-local  | 0              | br-lan br-wlan |      139 |      161 | | ||||
| | brfilter-global | 1              | -              |      136 |      162 | | ||||
|  | ||||
| Download/upload results in Mibit/s | ||||
|  | ||||
| It can be seen that the patch doesn't eliminate the overhead. It can also | ||||
| be seen that the throughput of brfilter-global and brfilter-local with | ||||
| disabled filtering is the roughly the same. Also the throughput for | ||||
| brfilter-global and brfilter-local for enabled filtering on all bridges is | ||||
| roughly the same. | ||||
|  | ||||
| But also the brfilter-local throughput is higher when only br-lan requires | ||||
| the filtering. This setting would not be possible with | ||||
| 644-bridge_optimize_netfilter_hooks.patch applied and thus can only be | ||||
| compared with brfilter-global and filtering enabled for all interfaces. | ||||
|  | ||||
| Signed-off-by: Sven Eckelmann <sven@open-mesh.com> | ||||
|  | ||||
| Forwarded: https://patchwork.ozlabs.org/patch/513592/ | ||||
| Applied-Upstream: https://dev.openwrt.org/changeset/46835 | ||||
|  | ||||
| --- a/net/bridge/br_forward.c | ||||
| +++ b/net/bridge/br_forward.c | ||||
| @@ -69,7 +69,7 @@ EXPORT_SYMBOL_GPL(br_dev_queue_push_xmit | ||||
|   | ||||
|  int br_forward_finish(struct net *net, struct sock *sk, struct sk_buff *skb) | ||||
|  { | ||||
| -	return BR_HOOK(NFPROTO_BRIDGE, NF_BR_POST_ROUTING, | ||||
| +	return NF_HOOK(NFPROTO_BRIDGE, NF_BR_POST_ROUTING, | ||||
|  		       net, sk, skb, NULL, skb->dev, | ||||
|  		       br_dev_queue_push_xmit); | ||||
|   | ||||
| @@ -97,7 +97,7 @@ static void __br_deliver(const struct ne | ||||
|  		return; | ||||
|  	} | ||||
|   | ||||
| -	BR_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, | ||||
| +	NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, | ||||
|  		dev_net(skb->dev), NULL, skb,NULL, skb->dev, | ||||
|  		br_forward_finish); | ||||
|  } | ||||
| @@ -121,7 +121,7 @@ static void __br_forward(const struct ne | ||||
|  	skb->dev = to->dev; | ||||
|  	skb_forward_csum(skb); | ||||
|   | ||||
| -	BR_HOOK(NFPROTO_BRIDGE, NF_BR_FORWARD, | ||||
| +	NF_HOOK(NFPROTO_BRIDGE, NF_BR_FORWARD, | ||||
|  		dev_net(indev), NULL, skb, indev, skb->dev, | ||||
|  		br_forward_finish); | ||||
|  } | ||||
| --- a/net/bridge/br_input.c | ||||
| +++ b/net/bridge/br_input.c | ||||
| @@ -70,7 +70,7 @@ int br_pass_frame_up(struct sk_buff *skb | ||||
|  	if (!skb) | ||||
|  		return NET_RX_DROP; | ||||
|   | ||||
| -	return BR_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, | ||||
| +	return NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, | ||||
|  		       dev_net(indev), NULL, skb, indev, NULL, | ||||
|  		       br_netif_receive_skb); | ||||
|  } | ||||
| @@ -320,7 +320,7 @@ rx_handler_result_t br_handle_frame(stru | ||||
|  		} | ||||
|   | ||||
|  		/* Deliver packet to local host only */ | ||||
| -		if (BR_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, | ||||
| +		if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, | ||||
|  			    dev_net(skb->dev), NULL, skb, skb->dev, NULL, | ||||
|  			    br_handle_local_finish)) { | ||||
|  			return RX_HANDLER_CONSUMED; /* consumed by filter */ | ||||
| @@ -337,7 +337,7 @@ forward: | ||||
|  			if (ether_addr_equal(p->br->dev->dev_addr, dest)) | ||||
|  				skb->pkt_type = PACKET_HOST; | ||||
|   | ||||
| -			if (BR_HOOK(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, dev_net(skb->dev), NULL, | ||||
| +			if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, dev_net(skb->dev), NULL, | ||||
|  				skb, skb->dev, NULL, br_handle_local_finish)) | ||||
|  				break; | ||||
|   | ||||
| @@ -361,7 +361,7 @@ forward: | ||||
|  		if (ether_addr_equal(p->br->dev->dev_addr, dest)) | ||||
|  			skb->pkt_type = PACKET_HOST; | ||||
|   | ||||
| -		BR_HOOK(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, | ||||
| +		NF_HOOK(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, | ||||
|  			dev_net(skb->dev), NULL, skb, skb->dev, NULL, | ||||
|  			br_handle_frame_finish); | ||||
|  		break; | ||||
| --- a/net/bridge/br_multicast.c | ||||
| +++ b/net/bridge/br_multicast.c | ||||
| @@ -856,7 +856,7 @@ static void __br_multicast_send_query(st | ||||
|   | ||||
|  	if (port) { | ||||
|  		skb->dev = port->dev; | ||||
| -		BR_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, | ||||
| +		NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, | ||||
|  			dev_net(port->dev), NULL, skb, NULL, skb->dev, | ||||
|  			br_dev_queue_push_xmit); | ||||
|  	} else { | ||||
| --- a/net/bridge/br_netfilter_hooks.c | ||||
| +++ b/net/bridge/br_netfilter_hooks.c | ||||
| @@ -72,15 +72,6 @@ static int brnf_pass_vlan_indev __read_m | ||||
|  #define IS_ARP(skb) \ | ||||
|  	(!skb_vlan_tag_present(skb) && skb->protocol == htons(ETH_P_ARP)) | ||||
|   | ||||
| -int brnf_call_ebtables __read_mostly; | ||||
| -EXPORT_SYMBOL_GPL(brnf_call_ebtables); | ||||
| - | ||||
| -bool br_netfilter_run_hooks(void) | ||||
| -{ | ||||
| -	return brnf_call_iptables | brnf_call_ip6tables | brnf_call_arptables | | ||||
| -		brnf_call_ebtables | brnf_call_custom; | ||||
| -} | ||||
| - | ||||
|  static inline __be16 vlan_proto(const struct sk_buff *skb) | ||||
|  { | ||||
|  	if (skb_vlan_tag_present(skb)) | ||||
| --- a/net/bridge/br_private.h | ||||
| +++ b/net/bridge/br_private.h | ||||
| @@ -909,29 +909,15 @@ extern const struct nf_br_ops __rcu *nf_ | ||||
|   | ||||
|  /* br_netfilter.c */ | ||||
|  #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) | ||||
| -extern int brnf_call_ebtables; | ||||
|  int br_nf_core_init(void); | ||||
|  void br_nf_core_fini(void); | ||||
|  void br_netfilter_rtable_init(struct net_bridge *); | ||||
| -bool br_netfilter_run_hooks(void); | ||||
|  #else | ||||
|  static inline int br_nf_core_init(void) { return 0; } | ||||
|  static inline void br_nf_core_fini(void) {} | ||||
|  #define br_netfilter_rtable_init(x) | ||||
| -#define br_netfilter_run_hooks()	false | ||||
|  #endif | ||||
|   | ||||
| -static inline int | ||||
| -BR_HOOK(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, | ||||
| -	struct sk_buff *skb, struct net_device *in, struct net_device *out, | ||||
| -	int (*okfn)(struct net *, struct sock *, struct sk_buff *)) | ||||
| -{ | ||||
| -	if (!br_netfilter_run_hooks()) | ||||
| -		return okfn(net, sk, skb); | ||||
| - | ||||
| -	return NF_HOOK(pf, hook, net, sk, skb, in, out, okfn); | ||||
| -} | ||||
| - | ||||
|  /* br_stp.c */ | ||||
|  void br_log_state(const struct net_bridge_port *p); | ||||
|  void br_set_state(struct net_bridge_port *p, unsigned int state); | ||||
| --- a/net/bridge/br_stp_bpdu.c | ||||
| +++ b/net/bridge/br_stp_bpdu.c | ||||
| @@ -60,7 +60,7 @@ static void br_send_bpdu(struct net_brid | ||||
|   | ||||
|  	skb_reset_mac_header(skb); | ||||
|   | ||||
| -	BR_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, | ||||
| +	NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, | ||||
|  		dev_net(p->dev), NULL, skb, NULL, skb->dev, | ||||
|  		br_send_bpdu_finish); | ||||
|  } | ||||
| --- a/net/bridge/netfilter/ebtables.c | ||||
| +++ b/net/bridge/netfilter/ebtables.c | ||||
| @@ -2416,13 +2416,11 @@ static int __init ebtables_init(void) | ||||
|  	} | ||||
|   | ||||
|  	printk(KERN_INFO "Ebtables v2.0 registered\n"); | ||||
| -	brnf_call_ebtables = 1; | ||||
|  	return 0; | ||||
|  } | ||||
|   | ||||
|  static void __exit ebtables_fini(void) | ||||
|  { | ||||
| -	brnf_call_ebtables = 0; | ||||
|  	nf_unregister_sockopt(&ebt_sockopts); | ||||
|  	xt_unregister_target(&ebt_standard_target); | ||||
|  	printk(KERN_INFO "Ebtables v2.0 unregistered\n"); | ||||
| --- a/net/ipv4/netfilter/nf_nat_l3proto_ipv4.c | ||||
| +++ b/net/ipv4/netfilter/nf_nat_l3proto_ipv4.c | ||||
| @@ -310,7 +310,7 @@ nf_nat_ipv4_fn(void *priv, struct sk_buf | ||||
|  		 * nf_bridge will be set and nf_bridge->physoutdev is not null, | ||||
|  		 * We can assume that it is not expecting NAT operation. | ||||
|  		 * | ||||
| -		 * when BR_HOOK is enabled, multicast packets will reach | ||||
| +		 * when NF_HOOK is enabled, multicast packets will reach | ||||
|  		 * postrouting twice,the first time is when it is forwarded | ||||
|  		 * between ports of a bridge, the second time is that it is | ||||
|  		 * forwarded to upstream port. | ||||
| @@ -0,0 +1,162 @@ | ||||
| From cc809a441d8f2924f785eb863dfa6aef47a25b0b Mon Sep 17 00:00:00 2001 | ||||
| From: John Crispin <blogic@openwrt.org> | ||||
| Date: Tue, 12 Aug 2014 20:49:27 +0200 | ||||
| Subject: [PATCH 30/36] GPIO: add named gpio exports | ||||
|  | ||||
| Signed-off-by: John Crispin <blogic@openwrt.org> | ||||
| --- a/drivers/gpio/gpiolib-of.c | ||||
| +++ b/drivers/gpio/gpiolib-of.c | ||||
| @@ -23,6 +23,8 @@ | ||||
|  #include <linux/pinctrl/pinctrl.h> | ||||
|  #include <linux/slab.h> | ||||
|  #include <linux/gpio/machine.h> | ||||
| +#include <linux/init.h> | ||||
| +#include <linux/platform_device.h> | ||||
|   | ||||
|  #include "gpiolib.h" | ||||
|   | ||||
| @@ -450,3 +452,72 @@ void of_gpiochip_remove(struct gpio_chip | ||||
|  	gpiochip_remove_pin_ranges(chip); | ||||
|  	of_node_put(chip->of_node); | ||||
|  } | ||||
| + | ||||
| +#ifdef CONFIG_GPIO_SYSFS | ||||
| + | ||||
| +static struct of_device_id gpio_export_ids[] = { | ||||
| +	{ .compatible = "gpio-export" }, | ||||
| +	{ /* sentinel */ } | ||||
| +}; | ||||
| + | ||||
| +static int of_gpio_export_probe(struct platform_device *pdev) | ||||
| +{ | ||||
| +	struct device_node *np = pdev->dev.of_node; | ||||
| +	struct device_node *cnp; | ||||
| +	u32 val; | ||||
| +	int nb = 0; | ||||
| + | ||||
| +	for_each_child_of_node(np, cnp) { | ||||
| +		const char *name = NULL; | ||||
| +		int gpio; | ||||
| +		bool dmc; | ||||
| +		int max_gpio = 1; | ||||
| +		int i; | ||||
| + | ||||
| +		of_property_read_string(cnp, "gpio-export,name", &name); | ||||
| + | ||||
| +		if (!name) | ||||
| +			max_gpio = of_gpio_count(cnp); | ||||
| + | ||||
| +		for (i = 0; i < max_gpio; i++) { | ||||
| +			unsigned flags = 0; | ||||
| +			enum of_gpio_flags of_flags; | ||||
| + | ||||
| +			gpio = of_get_gpio_flags(cnp, i, &of_flags); | ||||
| +			if (!gpio_is_valid(gpio)) | ||||
| +				return gpio; | ||||
| + | ||||
| +			if (of_flags == OF_GPIO_ACTIVE_LOW) | ||||
| +				flags |= GPIOF_ACTIVE_LOW; | ||||
| + | ||||
| +			if (!of_property_read_u32(cnp, "gpio-export,output", &val)) | ||||
| +				flags |= val ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; | ||||
| +			else | ||||
| +				flags |= GPIOF_IN; | ||||
| + | ||||
| +			if (devm_gpio_request_one(&pdev->dev, gpio, flags, name ? name : of_node_full_name(np))) | ||||
| +				continue; | ||||
| + | ||||
| +			dmc = of_property_read_bool(cnp, "gpio-export,direction_may_change"); | ||||
| +			gpio_export_with_name(gpio, dmc, name); | ||||
| +			nb++; | ||||
| +		} | ||||
| +	} | ||||
| + | ||||
| +	dev_info(&pdev->dev, "%d gpio(s) exported\n", nb); | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
| +static struct platform_driver gpio_export_driver = { | ||||
| +	.driver		= { | ||||
| +		.name		= "gpio-export", | ||||
| +		.owner	= THIS_MODULE, | ||||
| +		.of_match_table	= of_match_ptr(gpio_export_ids), | ||||
| +	}, | ||||
| +	.probe		= of_gpio_export_probe, | ||||
| +}; | ||||
| + | ||||
| +module_platform_driver(gpio_export_driver); | ||||
| + | ||||
| +#endif | ||||
| --- a/include/asm-generic/gpio.h | ||||
| +++ b/include/asm-generic/gpio.h | ||||
| @@ -122,6 +122,12 @@ static inline int gpio_export(unsigned g | ||||
|  	return gpiod_export(gpio_to_desc(gpio), direction_may_change); | ||||
|  } | ||||
|   | ||||
| +int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name); | ||||
| +static inline int gpio_export_with_name(unsigned gpio, bool direction_may_change, const char *name) | ||||
| +{ | ||||
| +	return __gpiod_export(gpio_to_desc(gpio), direction_may_change, name); | ||||
| +} | ||||
| + | ||||
|  static inline int gpio_export_link(struct device *dev, const char *name, | ||||
|  				   unsigned gpio) | ||||
|  { | ||||
| --- a/include/linux/gpio/consumer.h | ||||
| +++ b/include/linux/gpio/consumer.h | ||||
| @@ -427,6 +427,7 @@ static inline struct gpio_desc *devm_get | ||||
|   | ||||
|  #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) | ||||
|   | ||||
| +int _gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name); | ||||
|  int gpiod_export(struct gpio_desc *desc, bool direction_may_change); | ||||
|  int gpiod_export_link(struct device *dev, const char *name, | ||||
|  		      struct gpio_desc *desc); | ||||
| @@ -434,6 +435,13 @@ void gpiod_unexport(struct gpio_desc *de | ||||
|   | ||||
|  #else  /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */ | ||||
|   | ||||
| +static inline int _gpiod_export(struct gpio_desc *desc, | ||||
| +			       bool direction_may_change, | ||||
| +			       const char *name) | ||||
| +{ | ||||
| +	return -ENOSYS; | ||||
| +} | ||||
| + | ||||
|  static inline int gpiod_export(struct gpio_desc *desc, | ||||
|  			       bool direction_may_change) | ||||
|  { | ||||
| --- a/drivers/gpio/gpiolib-sysfs.c | ||||
| +++ b/drivers/gpio/gpiolib-sysfs.c | ||||
| @@ -544,7 +544,7 @@ static struct class gpio_class = { | ||||
|   * | ||||
|   * Returns zero on success, else an error. | ||||
|   */ | ||||
| -int gpiod_export(struct gpio_desc *desc, bool direction_may_change) | ||||
| +int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name) | ||||
|  { | ||||
|  	struct gpio_chip	*chip; | ||||
|  	struct gpiod_data	*data; | ||||
| @@ -604,6 +604,8 @@ int gpiod_export(struct gpio_desc *desc, | ||||
|  	offset = gpio_chip_hwgpio(desc); | ||||
|  	if (chip->names && chip->names[offset]) | ||||
|  		ioname = chip->names[offset]; | ||||
| +	if (name) | ||||
| +		ioname = name; | ||||
|   | ||||
|  	dev = device_create_with_groups(&gpio_class, chip->dev, | ||||
|  					MKDEV(0, 0), data, gpio_groups, | ||||
| @@ -625,6 +627,12 @@ err_unlock: | ||||
|  	gpiod_dbg(desc, "%s: status %d\n", __func__, status); | ||||
|  	return status; | ||||
|  } | ||||
| +EXPORT_SYMBOL_GPL(__gpiod_export); | ||||
| + | ||||
| +int gpiod_export(struct gpio_desc *desc, bool direction_may_change) | ||||
| +{ | ||||
| +	return __gpiod_export(desc, direction_may_change, NULL); | ||||
| +} | ||||
|  EXPORT_SYMBOL_GPL(gpiod_export); | ||||
|   | ||||
|  static int match_export(struct device *dev, const void *desc) | ||||
| @@ -0,0 +1,131 @@ | ||||
| From 39385cb5f3274735b03ed1f8e7ff517b02a0beed Mon Sep 17 00:00:00 2001 | ||||
| From: Johan Hedberg <johan.hedberg@intel.com> | ||||
| Date: Sat, 12 Nov 2016 17:03:07 +0200 | ||||
| Subject: [PATCH] Bluetooth: Fix using the correct source address type | ||||
|  | ||||
| The hci_get_route() API is used to look up local HCI devices, however | ||||
| so far it has been incapable of dealing with anything else than the | ||||
| public address of HCI devices. This completely breaks with LE-only HCI | ||||
| devices that do not come with a public address, but use a static | ||||
| random address instead. | ||||
|  | ||||
| This patch exteds the hci_get_route() API with a src_type parameter | ||||
| that's used for comparing with the right address of each HCI device. | ||||
|  | ||||
| Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> | ||||
| Signed-off-by: Marcel Holtmann <marcel@holtmann.org> | ||||
| --- | ||||
|  include/net/bluetooth/hci_core.h |  2 +- | ||||
|  net/bluetooth/6lowpan.c          |  4 ++-- | ||||
|  net/bluetooth/hci_conn.c         | 26 ++++++++++++++++++++++++-- | ||||
|  net/bluetooth/l2cap_core.c       |  2 +- | ||||
|  net/bluetooth/rfcomm/tty.c       |  2 +- | ||||
|  net/bluetooth/sco.c              |  2 +- | ||||
|  6 files changed, 30 insertions(+), 8 deletions(-) | ||||
|  | ||||
| --- a/include/net/bluetooth/hci_core.h | ||||
| +++ b/include/net/bluetooth/hci_core.h | ||||
| @@ -1003,7 +1003,7 @@ static inline void hci_set_drvdata(struc | ||||
|  } | ||||
|   | ||||
|  struct hci_dev *hci_dev_get(int index); | ||||
| -struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src); | ||||
| +struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src, u8 src_type); | ||||
|   | ||||
|  struct hci_dev *hci_alloc_dev(void); | ||||
|  void hci_free_dev(struct hci_dev *hdev); | ||||
| --- a/net/bluetooth/6lowpan.c | ||||
| +++ b/net/bluetooth/6lowpan.c | ||||
| @@ -1102,7 +1102,6 @@ static int get_l2cap_conn(char *buf, bda | ||||
|  { | ||||
|  	struct hci_conn *hcon; | ||||
|  	struct hci_dev *hdev; | ||||
| -	bdaddr_t *src = BDADDR_ANY; | ||||
|  	int n; | ||||
|   | ||||
|  	n = sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx %hhu", | ||||
| @@ -1113,7 +1112,8 @@ static int get_l2cap_conn(char *buf, bda | ||||
|  	if (n < 7) | ||||
|  		return -EINVAL; | ||||
|   | ||||
| -	hdev = hci_get_route(addr, src); | ||||
| +	/* The LE_PUBLIC address type is ignored because of BDADDR_ANY */ | ||||
| +	hdev = hci_get_route(addr, BDADDR_ANY, BDADDR_LE_PUBLIC); | ||||
|  	if (!hdev) | ||||
|  		return -ENOENT; | ||||
|   | ||||
| --- a/net/bluetooth/hci_conn.c | ||||
| +++ b/net/bluetooth/hci_conn.c | ||||
| @@ -609,7 +609,7 @@ int hci_conn_del(struct hci_conn *conn) | ||||
|  	return 0; | ||||
|  } | ||||
|   | ||||
| -struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src) | ||||
| +struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src, uint8_t src_type) | ||||
|  { | ||||
|  	int use_src = bacmp(src, BDADDR_ANY); | ||||
|  	struct hci_dev *hdev = NULL, *d; | ||||
| @@ -630,7 +630,29 @@ struct hci_dev *hci_get_route(bdaddr_t * | ||||
|  		 */ | ||||
|   | ||||
|  		if (use_src) { | ||||
| -			if (!bacmp(&d->bdaddr, src)) { | ||||
| +			bdaddr_t id_addr; | ||||
| +			u8 id_addr_type; | ||||
| + | ||||
| +			if (src_type == BDADDR_BREDR) { | ||||
| +				if (!lmp_bredr_capable(d)) | ||||
| +					continue; | ||||
| +				bacpy(&id_addr, &d->bdaddr); | ||||
| +				id_addr_type = BDADDR_BREDR; | ||||
| +			} else { | ||||
| +				if (!lmp_le_capable(d)) | ||||
| +					continue; | ||||
| + | ||||
| +				hci_copy_identity_address(d, &id_addr, | ||||
| +							  &id_addr_type); | ||||
| + | ||||
| +				/* Convert from HCI to three-value type */ | ||||
| +				if (id_addr_type == ADDR_LE_DEV_PUBLIC) | ||||
| +					id_addr_type = BDADDR_LE_PUBLIC; | ||||
| +				else | ||||
| +					id_addr_type = BDADDR_LE_RANDOM; | ||||
| +			} | ||||
| + | ||||
| +			if (!bacmp(&id_addr, src) && id_addr_type == src_type) { | ||||
|  				hdev = d; break; | ||||
|  			} | ||||
|  		} else { | ||||
| --- a/net/bluetooth/l2cap_core.c | ||||
| +++ b/net/bluetooth/l2cap_core.c | ||||
| @@ -7044,7 +7044,7 @@ int l2cap_chan_connect(struct l2cap_chan | ||||
|  	BT_DBG("%pMR -> %pMR (type %u) psm 0x%2.2x", &chan->src, dst, | ||||
|  	       dst_type, __le16_to_cpu(psm)); | ||||
|   | ||||
| -	hdev = hci_get_route(dst, &chan->src); | ||||
| +	hdev = hci_get_route(dst, &chan->src, chan->src_type); | ||||
|  	if (!hdev) | ||||
|  		return -EHOSTUNREACH; | ||||
|   | ||||
| --- a/net/bluetooth/rfcomm/tty.c | ||||
| +++ b/net/bluetooth/rfcomm/tty.c | ||||
| @@ -178,7 +178,7 @@ static void rfcomm_reparent_device(struc | ||||
|  	struct hci_dev *hdev; | ||||
|  	struct hci_conn *conn; | ||||
|   | ||||
| -	hdev = hci_get_route(&dev->dst, &dev->src); | ||||
| +	hdev = hci_get_route(&dev->dst, &dev->src, BDADDR_BREDR); | ||||
|  	if (!hdev) | ||||
|  		return; | ||||
|   | ||||
| --- a/net/bluetooth/sco.c | ||||
| +++ b/net/bluetooth/sco.c | ||||
| @@ -219,7 +219,7 @@ static int sco_connect(struct sock *sk) | ||||
|   | ||||
|  	BT_DBG("%pMR -> %pMR", &sco_pi(sk)->src, &sco_pi(sk)->dst); | ||||
|   | ||||
| -	hdev = hci_get_route(&sco_pi(sk)->dst, &sco_pi(sk)->src); | ||||
| +	hdev = hci_get_route(&sco_pi(sk)->dst, &sco_pi(sk)->src, BDADDR_BREDR); | ||||
|  	if (!hdev) | ||||
|  		return -EHOSTUNREACH; | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user