diff mbox series

[LEDE-DEV,v2] ipq806x: add ap.dk01.1 board support

Message ID 1508162659-12635-1-git-send-email-roman@advem.lv
State Changes Requested
Delegated to: Mathias Kresin
Headers show
Series [LEDE-DEV,v2] ipq806x: add ap.dk01.1 board support | expand

Commit Message

Roman Yeryomin Oct. 16, 2017, 2:04 p.m. UTC
AP.DK01.1 is QCA dev board with:
- ipq4028 (quad core ARM @710MHz, 2x2 dual an+ac radios)
- 256MB RAM
- 32MB SPI flash
- QCA8075 ethernet switch (WAN port, 4x LAN ports)

First installation via u-boot:
sf probe
sf erase 0x180000 0x1a00000
tftpboot 0x84000000 lede-ipq806x-AP-DK01.1-C1-squashfs-sysupgrade.bin
sf write 0x84000000 0x180000 0x1a00000

Further via sysupgrade.

Changes:
- add partitions
- enable wifi and ethernet
- set max cpu speed to 710MHz
- set memory size to 256MB
- add image generation
- extract pre-cal data from ART partition

Wirespeed NAT can be achieved with spreading rx interrupts over different
cores. Wifi needs love -- too slow. Could be that latest ath10k helps,
didn't test yet.

Changes since v1:
- add hw description and install instruction

Signed-off-by: Roman Yeryomin <roman@advem.lv>
---
 .../etc/hotplug.d/firmware/11-ath10k-caldata       |  6 ++
 target/linux/ipq806x/base-files/lib/ipq806x.sh     |  3 +
 target/linux/ipq806x/image/Makefile                | 18 ++++-
 ...s-ipq4019-ap.dk01.1-add-256MB-memory-node.patch | 14 ++++
 ...2-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch | 15 ++++
 ...4-03-dts-ipq4019-ap.dk01.1-add-partitions.patch | 72 ++++++++++++++++++
 ...pq4019-ap.dk01.1-enable-wifi-and-ethernet.patch | 87 ++++++++++++++++++++++
 7 files changed, 214 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ipq806x/patches-4.9/864-01-dts-ipq4019-ap.dk01.1-add-256MB-memory-node.patch
 create mode 100644 target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch
 create mode 100644 target/linux/ipq806x/patches-4.9/864-03-dts-ipq4019-ap.dk01.1-add-partitions.patch
 create mode 100644 target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch

Comments

Christian Lamparter Oct. 16, 2017, 5:32 p.m. UTC | #1
Added John, maybe he has more comments.

On Monday, October 16, 2017 5:04:19 PM CEST Roman Yeryomin wrote:
> AP.DK01.1 is QCA dev board with:
> - ipq4028 (quad core ARM @710MHz, 2x2 dual an+ac radios)
                           ^^ might not be correct. more to this below.
> - 256MB RAM
> - 32MB SPI flash
> - QCA8075 ethernet switch (WAN port, 4x LAN ports)
> 
> First installation via u-boot:
> sf probe
> sf erase 0x180000 0x1a00000
> tftpboot 0x84000000 lede-ipq806x-AP-DK01.1-C1-squashfs-sysupgrade.bin
> sf write 0x84000000 0x180000 0x1a00000
From what I know, tftpboot sets $filesize enviroment variable. This has
the advantage that you don't need to write all the random?/uninitialized
memory to the flash. After all 0x1a00000 is like 26MiB.

> Changes:
> - add partitions
> - enable wifi and ethernet
> - set max cpu speed to 710MHz
> - set memory size to 256MB
> - add image generation
> - extract pre-cal data from ART partition
> 
> Wirespeed NAT can be achieved with spreading rx interrupts over different
> cores. Wifi needs love -- too slow. Could be that latest ath10k helps,
> didn't test yet.
That "Wifi needs love" stinks of board-2.bin issues. And we had to deal
with this before:
<http://lists.infradead.org/pipermail/ath10k/2016-November/008763.html>

Verify that you have the correct (and up to date) board-2.bin for the board.
please add the board's board-2.bin to the ipq-wifi package.
> Changes since v1:
> - add hw description and install instruction
> 
> Signed-off-by: Roman Yeryomin <roman@advem.lv>
> ---
>  .../etc/hotplug.d/firmware/11-ath10k-caldata       |  6 ++
>  target/linux/ipq806x/base-files/lib/ipq806x.sh     |  3 +
>  target/linux/ipq806x/image/Makefile                | 18 ++++-
>  ...s-ipq4019-ap.dk01.1-add-256MB-memory-node.patch | 14 ++++
>  ...2-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch | 15 ++++
>  ...4-03-dts-ipq4019-ap.dk01.1-add-partitions.patch | 72 ++++++++++++++++++
>  ...pq4019-ap.dk01.1-enable-wifi-and-ethernet.patch | 87 ++++++++++++++++++++++
>  7 files changed, 214 insertions(+), 1 deletion(-)
>  create mode 100644 target/linux/ipq806x/patches-4.9/864-01-dts-ipq4019-ap.dk01.1-add-256MB-memory-node.patch
>  create mode 100644 target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch
>  create mode 100644 target/linux/ipq806x/patches-4.9/864-03-dts-ipq4019-ap.dk01.1-add-partitions.patch
>  create mode 100644 target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch
> 
> diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile
> index 3a76c7f..60b3a71 100644
> --- a/target/linux/ipq806x/image/Makefile
> +++ b/target/linux/ipq806x/image/Makefile
> @@ -264,7 +264,23 @@ define Device/AP-DK04.1-C1
>  	DEVICE_TITLE := QCA AP-DK04.1-C1
>  endef
>  
> +define Device/AP-DK01.1-C1
> +	PROFILES += $$(DEVICE_NAME)
> +	DEVICE_TITLE := QCA AP-DK01.1-C1
> +	BOARD_NAME := ap-dk01.1-c1
> +	DEVICE_DTS := qcom-ipq4019-ap.dk01.1-c1
   This "qcom-ipq4019-ap.dk01.1-c1" is important later on.

> +	KERNEL_LOADADDR := 0x80208000
> +	KERNEL_INSTALL := 1
> +	KERNEL_SIZE := 4096k
> +	IMAGE_SIZE := 26624k
> +	FILESYSTEMS := squashfs
> +	$(call Device/FitImage)
Any reason why this include is not at the top of the define?

> +	IMAGES := sysupgrade.bin
> +	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$${KERNEL_SIZE} | append-rootfs | pad-rootfs | append-metadata
> +	DEVICE_PACKAGES := ath10k-firmware-qca4019
> +endef
> +
>  TARGET_DEVICES += AP148 AP148-legacy C2600 D7800 DB149 EA8500 FRITZ4040 R7500 \
> -		  R7500v2 R7800 NBG6817 VR2600v AP-DK04.1-C1
> +		  R7500v2 R7800 NBG6817 VR2600v AP-DK04.1-C1 AP-DK01.1-C1
>  
>  $(eval $(call BuildImage))
> diff --git a/target/linux/ipq806x/patches-4.9/864-01-dts-ipq4019-ap.dk01.1-add-256MB-memory-node.patch b/target/linux/ipq806x/patches-4.9/864-01-dts-ipq4019-ap.dk01.1-add-256MB-memory-node.patch
> new file mode 100644
> index 0000000..8a80979
> --- /dev/null
> +++ b/target/linux/ipq806x/patches-4.9/864-01-dts-ipq4019-ap.dk01.1-add-256MB-memory-node.patch
> @@ -0,0 +1,14 @@
> +--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
> ++++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
Why are you patching the qcom-ipq4019-ap.dk01.1.dtsi?
And not the qcom-ipq4019-ap.dk01.1-c1.dts?

> +@@ -20,6 +20,11 @@
> + 	model = "Qualcomm Technologies, Inc. IPQ4019/AP-DK01.1";
> + 	compatible = "qcom,ipq4019";
I think this should be "qcom,ipq4019-ap.dk01.1-c1", "qcom,ipq4019".
The device-tree folks stick to their rules in the 
usage-model.txt / 2.2 Platform Identification
<https://www.kernel.org/doc/Documentation/devicetree/usage-model.txt>

> + 
> ++	memory {
> ++		device_type = "memory";
> ++		reg = <0x80000000 0x10000000>;
> ++	};
> ++
This shouldn't be in the .dtsi. Not all IPQ4019 have 256MiBs of RAM.
The ASUS RT-AC58U only has 128 MiB. And on the other side of the
spectrum, qualcomm's says the chip supports up to 1GiB.
<https://www.qualcomm.com/products/ipq4019>

> + 	clocks {
> +                 xo: xo {
> +                         compatible = "fixed-clock";
> diff --git a/target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch b/target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch
> new file mode 100644
> index 0000000..e9540f4
> --- /dev/null
> +++ b/target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch
> @@ -0,0 +1,15 @@
> +--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
> ++++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
> +@@ -135,3 +135,12 @@
> + 		};
> + 	};
> + };
> ++
> ++&cpu0_opp_table {
> ++	/delete-node/ opp@666000000;
> ++
> ++	opp@710000000 {
> ++		opp-hz = /bits/ 64 <710000000>;
> ++		clock-latency-ns = <256000>;
> ++	};
> ++};
This looks rather familiar. Like exactly a 1:1 copy from the FB4040's dts
right here:
https://github.com/lede-project/source/blob/master/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq4019-fritz4040.dts#L286
Is this true?

There's a reason to stick with the 666MHz rate though. You should check
if the device produces messages like:
[    1.399981] cpufreq: cpufreq_online: CPU0: Running at unlisted freq: 666000 KHz
[    1.400256] cpufreq: cpufreq_online: CPU0: Unlisted initial frequency changed to: 710000 KHz
(From what I know, the SBL actually sets it to 666MHz)

But there's more. If you look at qualcomm's page, it's says that the
CPU Clock Speed is 717 MHz: <https://www.qualcomm.com/products/ipq4028>

Since you are working for a OEM/ODM. You could please ask what is the
right MHz table for these devices? Unfortunately, Qualcomm never got
around to fix this upstream and without an official statement from them
it's very difficult to push stuff like this upstream.

> diff --git a/target/linux/ipq806x/patches-4.9/864-03-dts-ipq4019-ap.dk01.1-add-partitions.patch b/target/linux/ipq806x/patches-4.9/864-03-dts-ipq4019-ap.dk01.1-add-partitions.patch
> new file mode 100644
> index 0000000..a7861cd
> --- /dev/null
> +++ b/target/linux/ipq806x/patches-4.9/864-03-dts-ipq4019-ap.dk01.1-add-partitions.patch
> @@ -0,0 +1,72 @@
> +--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
> ++++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
> +@@ -93,6 +93,69 @@
> + 				reg = <0>;
> + 				compatible = "mx25l25635e";
The mx25l25635e has been "not for new designs" for a couple of years now?!
<http://www.macronix.com/en-us/products/NOR-Flash/Serial-NOR-Flash/Pages/spec.aspx?p=MX25L25635E>
Are you sure this device is really a mx25l25635e and not the newer mx25l25635f?

> + 				spi-max-frequency = <24000000>;
> ++
> ++				SBL1@0 {
> ++					label = "SBL1";
> ++					reg = <0x0 0x40000>;
> ++					read-only;
> ++				};
> ++
> ++				MIBIB@40000 {
> ++					label = "MIBIB";
> ++					reg = <0x40000 0x20000>;
> ++					read-only;
> ++				};
> ++
> ++				QSEE@60000 {
> ++					label = "QSEE";
> ++					reg = <0x60000 0x60000>;
> ++					read-only;
> ++				};
> ++
> ++				CDT@c0000 {
> ++					label = "CDT";
> ++					reg = <0xc0000 0x10000>;
> ++					read-only;
> ++				};
> ++
> ++				DDRPARAMS@d0000 {
> ++					label = "DDRPARAMS";
> ++					reg = <0xd0000 0x10000>;
> ++					read-only;
> ++				};
> ++
> ++				APPSBLENV@e0000 {
> ++					label = "APPSBLENV";
> ++					reg = <0xe0000 0x10000>;
> ++					read-only;
> ++				};
> ++
> ++				APPSBL@f0000 {
> ++					label = "APPSBL";
> ++					reg = <0xf0000 0x80000>;
> ++					read-only;
> ++				};
> ++
> ++				ART@170000 {
> ++					label = "ART";
> ++					reg = <0x170000 0x10000>;
> ++					read-only;
> ++				};
> ++
> ++				kernel@180000 {
> ++					label = "kernel";
> ++					reg = <0x180000 0x400000>;
> ++				};
> ++
> ++				rootfs@580000 {
> ++					label = "rootfs";
> ++					reg = <0x580000 0x1600000>;
> ++				};
> ++
> ++				firmware@180000 {
> ++					label = "firmware";
> ++					reg = <0x180000 0x1a00000>;
> ++				};
> + 			};
> + 		};
> + 
Please move this to the qcom-ipq4019-ap.dk01.1-c1.dts.
And preferably, this should also be pushed to 
linux-arm-kernel@lists.infradead.org

<https://lists.infradead.org/mailman/listinfo/linux-arm-kernel>
> diff --git a/target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch b/target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch
> new file mode 100644
> index 0000000..cc90475
> --- /dev/null
> +++ b/target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch
> @@ -0,0 +1,87 @@
> +--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
> ++++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
> +@@ -15,6 +15,7 @@
> +  */
> + 
> + #include "qcom-ipq4019.dtsi"
> ++#include <dt-bindings/soc/qcom,tcsr.h>
please move this to the qcom-ipq4019-ap.dk01.1-c1.dts.

> + 
> + / {
> + 	model = "Qualcomm Technologies, Inc. IPQ4019/AP-DK01.1";
> +@@ -25,6 +26,27 @@
> + 		reg = <0x80000000 0x10000000>;
> + 	};
> + 
> ++	reserved-memory {
> ++		#address-cells = <0x1>;
> ++		#size-cells = <0x1>;
> ++		ranges;
> ++
> ++		rsvd1@87000000 {
> ++			reg = <0x87000000 0x0500000>;
> ++			no-map;
> ++		};
> ++
> ++		wifi_dump@87500000 {
> ++			reg = <0x87500000 0x600000>;
> ++			no-map;
> ++		};
> ++
> ++		rsvd2@87B00000 {
> ++			reg = <0x87b00000 0x500000>;
> ++			no-map;
> ++		};
> ++	};

The wifi_dump area is not needed by the ath10k driver.
Furthermore, the you could probably get away with reserving
less memory. From what I know, you only need to reserve space
for the "QSEE environment", which is located betwenn
0x87e00000 and 0x88000000.

(please move this to the qcom-ipq4019-ap.dk01.1-c1.dts.)
> ++
> + 	clocks {
> +                 xo: xo {
> +                         compatible = "fixed-clock";
> +@@ -196,6 +218,48 @@
> + 		usb2: usb2@60f8800 {
> + 			status = "ok";
> + 		};
> ++
> ++		wifi@a000000 {
> ++			status = "okay";
> ++		};
> ++
> ++		wifi@a800000 {
> ++			status = "okay";
> ++		};
> ++
> ++		ess-switch@c000000 {
> ++			status = "okay";
> ++		};
> ++
> ++		ess-psgmii@98000 {
> ++			status = "okay";
> ++		};
> ++
> ++		edma@c080000 {
> ++			status = "okay";
> ++		};
> ++
> ++		mdio@90000 {
> ++			status = "okay";
> ++		};
> ++
> ++		ess_tcsr@1953000 {
> ++			compatible = "qcom,tcsr";
> ++			reg = <0x1953000 0x1000>;
> ++			qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
> ++		};
> ++
> ++		tcsr@1949000 {
> ++			compatible = "qcom,tcsr";
> ++			reg = <0x1949000 0x100>;
> ++			qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
> ++		};
> ++
> ++		tcsr@1957000 {
> ++			compatible = "qcom,tcsr";
> ++			reg = <0x1957000 0x100>;
> ++			qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
> ++		};
> + 	};
> + };
> + 
please move this to the qcom-ipq4019-ap.dk01.1-c1.dts.
Roman Yeryomin Oct. 16, 2017, 7:10 p.m. UTC | #2
On 2017-10-16 20:32, Christian Lamparter wrote:
> Added John, maybe he has more comments.
> 
> On Monday, October 16, 2017 5:04:19 PM CEST Roman Yeryomin wrote:
>> AP.DK01.1 is QCA dev board with:
>> - ipq4028 (quad core ARM @710MHz, 2x2 dual an+ac radios)
>                            ^^ might not be correct. more to this below.
>> - 256MB RAM
>> - 32MB SPI flash
>> - QCA8075 ethernet switch (WAN port, 4x LAN ports)
>> 
>> First installation via u-boot:
>> sf probe
>> sf erase 0x180000 0x1a00000
>> tftpboot 0x84000000 lede-ipq806x-AP-DK01.1-C1-squashfs-sysupgrade.bin
>> sf write 0x84000000 0x180000 0x1a00000
> From what I know, tftpboot sets $filesize enviroment variable. This has
> the advantage that you don't need to write all the 
> random?/uninitialized
> memory to the flash. After all 0x1a00000 is like 26MiB.

I didn't actually, but also didn't know about $filesize, thanks for the 
hint

>> Changes:
>> - add partitions
>> - enable wifi and ethernet
>> - set max cpu speed to 710MHz
>> - set memory size to 256MB
>> - add image generation
>> - extract pre-cal data from ART partition
>> 
>> Wirespeed NAT can be achieved with spreading rx interrupts over 
>> different
>> cores. Wifi needs love -- too slow. Could be that latest ath10k helps,
>> didn't test yet.
> That "Wifi needs love" stinks of board-2.bin issues. And we had to deal
> with this before:
> <http://lists.infradead.org/pipermail/ath10k/2016-November/008763.html>
> 
> Verify that you have the correct (and up to date) board-2.bin for the 
> board.
> please add the board's board-2.bin to the ipq-wifi package.

I was going to deal with wifi related issues later.

>> Changes since v1:
>> - add hw description and install instruction
>> 
>> Signed-off-by: Roman Yeryomin <roman@advem.lv>
>> ---
>>  .../etc/hotplug.d/firmware/11-ath10k-caldata       |  6 ++
>>  target/linux/ipq806x/base-files/lib/ipq806x.sh     |  3 +
>>  target/linux/ipq806x/image/Makefile                | 18 ++++-
>>  ...s-ipq4019-ap.dk01.1-add-256MB-memory-node.patch | 14 ++++
>>  ...2-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch | 15 ++++
>>  ...4-03-dts-ipq4019-ap.dk01.1-add-partitions.patch | 72 
>> ++++++++++++++++++
>>  ...pq4019-ap.dk01.1-enable-wifi-and-ethernet.patch | 87 
>> ++++++++++++++++++++++
>>  7 files changed, 214 insertions(+), 1 deletion(-)
>>  create mode 100644 
>> target/linux/ipq806x/patches-4.9/864-01-dts-ipq4019-ap.dk01.1-add-256MB-memory-node.patch
>>  create mode 100644 
>> target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch
>>  create mode 100644 
>> target/linux/ipq806x/patches-4.9/864-03-dts-ipq4019-ap.dk01.1-add-partitions.patch
>>  create mode 100644 
>> target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch
>> 
>> diff --git a/target/linux/ipq806x/image/Makefile 
>> b/target/linux/ipq806x/image/Makefile
>> index 3a76c7f..60b3a71 100644
>> --- a/target/linux/ipq806x/image/Makefile
>> +++ b/target/linux/ipq806x/image/Makefile
>> @@ -264,7 +264,23 @@ define Device/AP-DK04.1-C1
>>  	DEVICE_TITLE := QCA AP-DK04.1-C1
>>  endef
>> 
>> +define Device/AP-DK01.1-C1
>> +	PROFILES += $$(DEVICE_NAME)
>> +	DEVICE_TITLE := QCA AP-DK01.1-C1
>> +	BOARD_NAME := ap-dk01.1-c1
>> +	DEVICE_DTS := qcom-ipq4019-ap.dk01.1-c1
>    This "qcom-ipq4019-ap.dk01.1-c1" is important later on.
> 
>> +	KERNEL_LOADADDR := 0x80208000
>> +	KERNEL_INSTALL := 1
>> +	KERNEL_SIZE := 4096k
>> +	IMAGE_SIZE := 26624k
>> +	FILESYSTEMS := squashfs
>> +	$(call Device/FitImage)
> Any reason why this include is not at the top of the define?

This is kernel image generation, right before full image.
Actually I don't understand why it's put on top.

>> +	IMAGES := sysupgrade.bin
>> +	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$${KERNEL_SIZE} | 
>> append-rootfs | pad-rootfs | append-metadata
>> +	DEVICE_PACKAGES := ath10k-firmware-qca4019
>> +endef
>> +
>>  TARGET_DEVICES += AP148 AP148-legacy C2600 D7800 DB149 EA8500 
>> FRITZ4040 R7500 \
>> -		  R7500v2 R7800 NBG6817 VR2600v AP-DK04.1-C1
>> +		  R7500v2 R7800 NBG6817 VR2600v AP-DK04.1-C1 AP-DK01.1-C1
>> 
>>  $(eval $(call BuildImage))
>> diff --git 
>> a/target/linux/ipq806x/patches-4.9/864-01-dts-ipq4019-ap.dk01.1-add-256MB-memory-node.patch 
>> b/target/linux/ipq806x/patches-4.9/864-01-dts-ipq4019-ap.dk01.1-add-256MB-memory-node.patch
>> new file mode 100644
>> index 0000000..8a80979
>> --- /dev/null
>> +++ 
>> b/target/linux/ipq806x/patches-4.9/864-01-dts-ipq4019-ap.dk01.1-add-256MB-memory-node.patch
>> @@ -0,0 +1,14 @@
>> +--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
>> ++++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
> Why are you patching the qcom-ipq4019-ap.dk01.1.dtsi?
> And not the qcom-ipq4019-ap.dk01.1-c1.dts?

Hmm, missed that one.

>> +@@ -20,6 +20,11 @@
>> + 	model = "Qualcomm Technologies, Inc. IPQ4019/AP-DK01.1";
>> + 	compatible = "qcom,ipq4019";
> I think this should be "qcom,ipq4019-ap.dk01.1-c1", "qcom,ipq4019".
> The device-tree folks stick to their rules in the
> usage-model.txt / 2.2 Platform Identification
> <https://www.kernel.org/doc/Documentation/devicetree/usage-model.txt>

I didn't change that. And will not in v3, since I'm going to patch 
qcom-ipq4019-ap.dk01.1-c1.dts

>> +
>> ++	memory {
>> ++		device_type = "memory";
>> ++		reg = <0x80000000 0x10000000>;
>> ++	};
>> ++
> This shouldn't be in the .dtsi. Not all IPQ4019 have 256MiBs of RAM.
> The ASUS RT-AC58U only has 128 MiB. And on the other side of the
> spectrum, qualcomm's says the chip supports up to 1GiB.
> <https://www.qualcomm.com/products/ipq4019>
> 
>> + 	clocks {
>> +                 xo: xo {
>> +                         compatible = "fixed-clock";
>> diff --git 
>> a/target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch 
>> b/target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch
>> new file mode 100644
>> index 0000000..e9540f4
>> --- /dev/null
>> +++ 
>> b/target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch
>> @@ -0,0 +1,15 @@
>> +--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
>> ++++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
>> +@@ -135,3 +135,12 @@
>> + 		};
>> + 	};
>> + };
>> ++
>> ++&cpu0_opp_table {
>> ++	/delete-node/ opp@666000000;
>> ++
>> ++	opp@710000000 {
>> ++		opp-hz = /bits/ 64 <710000000>;
>> ++		clock-latency-ns = <256000>;
>> ++	};
>> ++};
> This looks rather familiar. Like exactly a 1:1 copy from the FB4040's 
> dts
> right here:
> https://github.com/lede-project/source/blob/master/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq4019-fritz4040.dts#L286
> Is this true?
> 
> There's a reason to stick with the 666MHz rate though. You should check
> if the device produces messages like:
> [    1.399981] cpufreq: cpufreq_online: CPU0: Running at unlisted
> freq: 666000 KHz
> [    1.400256] cpufreq: cpufreq_online: CPU0: Unlisted initial
> frequency changed to: 710000 KHz
> (From what I know, the SBL actually sets it to 666MHz)
> 
> But there's more. If you look at qualcomm's page, it's says that the
> CPU Clock Speed is 717 MHz: <https://www.qualcomm.com/products/ipq4028>
> 
> Since you are working for a OEM/ODM. You could please ask what is the
> right MHz table for these devices? Unfortunately, Qualcomm never got
> around to fix this upstream and without an official statement from them
> it's very difficult to push stuff like this upstream.

Hmm...

>> diff --git 
>> a/target/linux/ipq806x/patches-4.9/864-03-dts-ipq4019-ap.dk01.1-add-partitions.patch 
>> b/target/linux/ipq806x/patches-4.9/864-03-dts-ipq4019-ap.dk01.1-add-partitions.patch
>> new file mode 100644
>> index 0000000..a7861cd
>> --- /dev/null
>> +++ 
>> b/target/linux/ipq806x/patches-4.9/864-03-dts-ipq4019-ap.dk01.1-add-partitions.patch
>> @@ -0,0 +1,72 @@
>> +--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
>> ++++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
>> +@@ -93,6 +93,69 @@
>> + 				reg = <0>;
>> + 				compatible = "mx25l25635e";
> The mx25l25635e has been "not for new designs" for a couple of years 
> now?!
> <http://www.macronix.com/en-us/products/NOR-Flash/Serial-NOR-Flash/Pages/spec.aspx?p=MX25L25635E>
> Are you sure this device is really a mx25l25635e and not the newer 
> mx25l25635f?
> 
>> + 				spi-max-frequency = <24000000>;
>> ++
>> ++				SBL1@0 {
>> ++					label = "SBL1";
>> ++					reg = <0x0 0x40000>;
>> ++					read-only;
>> ++				};
>> ++
>> ++				MIBIB@40000 {
>> ++					label = "MIBIB";
>> ++					reg = <0x40000 0x20000>;
>> ++					read-only;
>> ++				};
>> ++
>> ++				QSEE@60000 {
>> ++					label = "QSEE";
>> ++					reg = <0x60000 0x60000>;
>> ++					read-only;
>> ++				};
>> ++
>> ++				CDT@c0000 {
>> ++					label = "CDT";
>> ++					reg = <0xc0000 0x10000>;
>> ++					read-only;
>> ++				};
>> ++
>> ++				DDRPARAMS@d0000 {
>> ++					label = "DDRPARAMS";
>> ++					reg = <0xd0000 0x10000>;
>> ++					read-only;
>> ++				};
>> ++
>> ++				APPSBLENV@e0000 {
>> ++					label = "APPSBLENV";
>> ++					reg = <0xe0000 0x10000>;
>> ++					read-only;
>> ++				};
>> ++
>> ++				APPSBL@f0000 {
>> ++					label = "APPSBL";
>> ++					reg = <0xf0000 0x80000>;
>> ++					read-only;
>> ++				};
>> ++
>> ++				ART@170000 {
>> ++					label = "ART";
>> ++					reg = <0x170000 0x10000>;
>> ++					read-only;
>> ++				};
>> ++
>> ++				kernel@180000 {
>> ++					label = "kernel";
>> ++					reg = <0x180000 0x400000>;
>> ++				};
>> ++
>> ++				rootfs@580000 {
>> ++					label = "rootfs";
>> ++					reg = <0x580000 0x1600000>;
>> ++				};
>> ++
>> ++				firmware@180000 {
>> ++					label = "firmware";
>> ++					reg = <0x180000 0x1a00000>;
>> ++				};
>> + 			};
>> + 		};
>> +
> Please move this to the qcom-ipq4019-ap.dk01.1-c1.dts.
> And preferably, this should also be pushed to
> linux-arm-kernel@lists.infradead.org

ok

> <https://lists.infradead.org/mailman/listinfo/linux-arm-kernel>
>> diff --git 
>> a/target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch 
>> b/target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch
>> new file mode 100644
>> index 0000000..cc90475
>> --- /dev/null
>> +++ 
>> b/target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch
>> @@ -0,0 +1,87 @@
>> +--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
>> ++++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
>> +@@ -15,6 +15,7 @@
>> +  */
>> +
>> + #include "qcom-ipq4019.dtsi"
>> ++#include <dt-bindings/soc/qcom,tcsr.h>
> please move this to the qcom-ipq4019-ap.dk01.1-c1.dts.
> 
>> +
>> + / {
>> + 	model = "Qualcomm Technologies, Inc. IPQ4019/AP-DK01.1";
>> +@@ -25,6 +26,27 @@
>> + 		reg = <0x80000000 0x10000000>;
>> + 	};
>> +
>> ++	reserved-memory {
>> ++		#address-cells = <0x1>;
>> ++		#size-cells = <0x1>;
>> ++		ranges;
>> ++
>> ++		rsvd1@87000000 {
>> ++			reg = <0x87000000 0x0500000>;
>> ++			no-map;
>> ++		};
>> ++
>> ++		wifi_dump@87500000 {
>> ++			reg = <0x87500000 0x600000>;
>> ++			no-map;
>> ++		};
>> ++
>> ++		rsvd2@87B00000 {
>> ++			reg = <0x87b00000 0x500000>;
>> ++			no-map;
>> ++		};
>> ++	};
> 
> The wifi_dump area is not needed by the ath10k driver.
> Furthermore, the you could probably get away with reserving
> less memory. From what I know, you only need to reserve space
> for the "QSEE environment", which is located betwenn
> 0x87e00000 and 0x88000000.

I have no information about those.
I think there should be also NSS region...

> (please move this to the qcom-ipq4019-ap.dk01.1-c1.dts.)
>> ++
>> + 	clocks {
>> +                 xo: xo {
>> +                         compatible = "fixed-clock";
>> +@@ -196,6 +218,48 @@
>> + 		usb2: usb2@60f8800 {
>> + 			status = "ok";
>> + 		};
>> ++
>> ++		wifi@a000000 {
>> ++			status = "okay";
>> ++		};
>> ++
>> ++		wifi@a800000 {
>> ++			status = "okay";
>> ++		};
>> ++
>> ++		ess-switch@c000000 {
>> ++			status = "okay";
>> ++		};
>> ++
>> ++		ess-psgmii@98000 {
>> ++			status = "okay";
>> ++		};
>> ++
>> ++		edma@c080000 {
>> ++			status = "okay";
>> ++		};
>> ++
>> ++		mdio@90000 {
>> ++			status = "okay";
>> ++		};
>> ++
>> ++		ess_tcsr@1953000 {
>> ++			compatible = "qcom,tcsr";
>> ++			reg = <0x1953000 0x1000>;
>> ++			qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
>> ++		};
>> ++
>> ++		tcsr@1949000 {
>> ++			compatible = "qcom,tcsr";
>> ++			reg = <0x1949000 0x100>;
>> ++			qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
>> ++		};
>> ++
>> ++		tcsr@1957000 {
>> ++			compatible = "qcom,tcsr";
>> ++			reg = <0x1957000 0x100>;
>> ++			qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
>> ++		};
>> + 	};
>> + };
>> +
> please move this to the qcom-ipq4019-ap.dk01.1-c1.dts.
> 
> 
> 
> 
> _______________________________________________
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev

Why do I receive emails two times?
One with this signature ^^^ and another without?

Regards,
Roman
Christian Lamparter Oct. 16, 2017, 8:30 p.m. UTC | #3
On Monday, October 16, 2017 10:10:52 PM CEST Roman Yeryomin wrote:
> On 2017-10-16 20:32, Christian Lamparter wrote:
> > Added John, maybe he has more comments.
(This time with the right mail address - sorry)

> >> Changes:
> >> - add partitions
> >> - enable wifi and ethernet
> >> - set max cpu speed to 710MHz
> >> - set memory size to 256MB
> >> - add image generation
> >> - extract pre-cal data from ART partition
> >> 
> >> Wirespeed NAT can be achieved with spreading rx interrupts over 
> >> different
> >> cores. Wifi needs love -- too slow. Could be that latest ath10k helps,
> >> didn't test yet.
> > That "Wifi needs love" stinks of board-2.bin issues. And we had to deal
> > with this before:
> > <http://lists.infradead.org/pipermail/ath10k/2016-November/008763.html>
> > 
> > Verify that you have the correct (and up to date) board-2.bin for the 
> > board.
> > please add the board's board-2.bin to the ipq-wifi package.
> 
> I was going to deal with wifi related issues later.
Please don't defere the wireless issue. Fix it now.

In the mail, Michal Kazior who was working for Qualcomm Atheros at the time
stated quite clearly:

"Please don't do that. Your basically pushing bogus data as board data
to the device. I'm a ltittle surprised firmware didn't notice. Anyway,
expect the device to misbehave (crash, hang, regulatory violations)
with this "board.bin"."

and also:

"board-2 is a key-value store of actual board files. Some devices,
notably qca61x4 hw3+ and qca4019 need distinct board files to be
uploaded. Otherwise they fail in various ways."

> >> 
> >> +define Device/AP-DK01.1-C1
> >> +	PROFILES += $$(DEVICE_NAME)
> >> +	DEVICE_TITLE := QCA AP-DK01.1-C1
> >> +	BOARD_NAME := ap-dk01.1-c1
> >> +	DEVICE_DTS := qcom-ipq4019-ap.dk01.1-c1
> >    This "qcom-ipq4019-ap.dk01.1-c1" is important later on.
> > 
> >> +	KERNEL_LOADADDR := 0x80208000
> >> +	KERNEL_INSTALL := 1
> >> +	KERNEL_SIZE := 4096k
> >> +	IMAGE_SIZE := 26624k
> >> +	FILESYSTEMS := squashfs
> >> +	$(call Device/FitImage)
> > Any reason why this include is not at the top of the define?
> 
> This is kernel image generation, right before full image.
> Actually I don't understand why it's put on top.
But you did notice that all other devices definitions have it on top as well?
Are you really sure, that you really want to trigger people with OCD to do
make a "cleanup" patch later? You could avoid this altogether right now.

[...]

> >> +@@ -20,6 +20,11 @@
> >> + 	model = "Qualcomm Technologies, Inc. IPQ4019/AP-DK01.1";
> >> + 	compatible = "qcom,ipq4019";
> > I think this should be "qcom,ipq4019-ap.dk01.1-c1", "qcom,ipq4019".
> > The device-tree folks stick to their rules in the
> > usage-model.txt / 2.2 Platform Identification
> > <https://www.kernel.org/doc/Documentation/devicetree/usage-model.txt>
> 
> I didn't change that. And will not in v3, since I'm going to patch 
> qcom-ipq4019-ap.dk01.1-c1.dts
This has to be done! Again the usage-model.txt clearly states that:
"The 'compatible' property contains a sorted list of strings starting
with the *exact name of the machine*, followed by an optional list of
boards it is compatible with sorted from most compatible to least."
(Read the rest of 2.2 Platform Identification as well)

Also, Mathias Kresin has plans to use the first "compatible" entry
as an unique identifier for the userspace scripts. (And remove
ipq806x current custom board identifier script that relies on the
model)

part of this work has already been merged see:
https://github.com/lede-project/source/blob/master/package/base-files/files/lib/preinit/02_sysinfo
 
Since the "qcom,ipq4019" compatible is already used by the AP-DK04.1-C1,
this will cause a conflict with your "AP-DK01.1-C1"... And then the
userspace won't know "which is which".

> >> + 	clocks {
> >> +                 xo: xo {
> >> +                         compatible = "fixed-clock";
> >> diff --git 
> >> a/target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch 
> >> b/target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch
> >> new file mode 100644
> >> index 0000000..e9540f4
> >> --- /dev/null
> >> +++ 
> >> b/target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch
> >> @@ -0,0 +1,15 @@
> >> +--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
> >> ++++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
> >> +@@ -135,3 +135,12 @@
> >> + 		};
> >> + 	};
> >> + };
> >> ++
> >> ++&cpu0_opp_table {
> >> ++	/delete-node/ opp@666000000;
> >> ++
> >> ++	opp@710000000 {
> >> ++		opp-hz = /bits/ 64 <710000000>;
> >> ++		clock-latency-ns = <256000>;
> >> ++	};
> >> ++};
> > This looks rather familiar. Like exactly a 1:1 copy from the FB4040's 
> > dts
> > right here:
> > https://github.com/lede-project/source/blob/master/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq4019-fritz4040.dts#L286
> > Is this true?
> > 
> > There's a reason to stick with the 666MHz rate though. You should check
> > if the device produces messages like:
> > [    1.399981] cpufreq: cpufreq_online: CPU0: Running at unlisted
> > freq: 666000 KHz
> > [    1.400256] cpufreq: cpufreq_online: CPU0: Unlisted initial
> > frequency changed to: 710000 KHz
> > (From what I know, the SBL actually sets it to 666MHz)
> > 
> > But there's more. If you look at qualcomm's page, it's says that the
> > CPU Clock Speed is 717 MHz: <https://www.qualcomm.com/products/ipq4028>
> > 
> > Since you are working for a OEM/ODM. You could please ask what is the
> > right MHz table for these devices? Unfortunately, Qualcomm never got
> > around to fix this upstream and without an official statement from them
> > it's very difficult to push stuff like this upstream.
> 
> Hmm...
Could you please ask Qualcomm?
(Also to consider: there are IPQ40XX devices with and without an heat-sink.
It could be that devices w/o a heat-sink have to have lower clocks prevent
overheating.)

> >> diff --git 
> >> a/target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch 
> >> b/target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch
> >> new file mode 100644
> >> index 0000000..cc90475
> >> --- /dev/null
> >> +++ 
> >> b/target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch
> >> @@ -0,0 +1,87 @@
> >> +--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
> >> ++++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
> >> +@@ -15,6 +15,7 @@
> >> +  */
> >> +
> >> + #include "qcom-ipq4019.dtsi"
> >> ++#include <dt-bindings/soc/qcom,tcsr.h>
> > please move this to the qcom-ipq4019-ap.dk01.1-c1.dts.
> > 
> >> +
> >> + / {
> >> + 	model = "Qualcomm Technologies, Inc. IPQ4019/AP-DK01.1";
> >> +@@ -25,6 +26,27 @@
> >> + 		reg = <0x80000000 0x10000000>;
> >> + 	};
> >> +
> >> ++	reserved-memory {
> >> ++		#address-cells = <0x1>;
> >> ++		#size-cells = <0x1>;
> >> ++		ranges;
> >> ++
> >> ++		rsvd1@87000000 {
> >> ++			reg = <0x87000000 0x0500000>;
> >> ++			no-map;
> >> ++		};
> >> ++
> >> ++		wifi_dump@87500000 {
> >> ++			reg = <0x87500000 0x600000>;
> >> ++			no-map;
> >> ++		};
> >> ++
> >> ++		rsvd2@87B00000 {
> >> ++			reg = <0x87b00000 0x500000>;
> >> ++			no-map;
> >> ++		};
> >> ++	};
> > 
> > The wifi_dump area is not needed by the ath10k driver.
> > Furthermore, the you could probably get away with reserving
> > less memory. From what I know, you only need to reserve space
> > for the "QSEE environment", which is located between
> > 0x87e00000 and 0x88000000.
> 
> I have no information about those.
> I think there should be also NSS region...
Do you know, if the IPQ40XX actually has a NSS?

Qualcomm's IPQ40[1|2][89] pages don't mention anything about a NSS.
And there isn't any special NSS driver in the GPL dumps I have seen.

From what I know these Network Subsystem (NSS) are only a thing for
the IPQ8064, IPQ8065 and the upcoming IPQ8074 tier.

> > (please move this to the qcom-ipq4019-ap.dk01.1-c1.dts.)
> >> ++
> >> + 	clocks {
> >> +                 xo: xo {
> >> +                         compatible = "fixed-clock";
> > 
> > 
> > _______________________________________________
> > Lede-dev mailing list
> > Lede-dev@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/lede-dev
> 
> Why do I receive emails two times?
> One with this signature ^^^ and another without?

Probably because, I hit "reply all"? But this is a mailing-list!
If you are not familiar with the pro-and-cons, you can read more
about this duplicated mails topic right here:
<http://david.woodhou.se/reply-to-list.html>.

Regards,
Christian
Roman Yeryomin Oct. 17, 2017, 10:52 a.m. UTC | #4
On 2017-10-16 23:30, Christian Lamparter wrote:
>> > Lede-dev@lists.infradead.org
>> > http://lists.infradead.org/mailman/listinfo/lede-dev
>> 
>> Why do I receive emails two times?
>> One with this signature ^^^ and another without?
> 
> Probably because, I hit "reply all"? But this is a mailing-list!
> If you are not familiar with the pro-and-cons, you can read more
> about this duplicated mails topic right here:
> <http://david.woodhou.se/reply-to-list.html>.


Weird, it was never a problem before...
Maybe it's just my client :/
Roman Yeryomin Oct. 23, 2017, 5:44 p.m. UTC | #5
On 2017-10-16 23:30, Christian Lamparter wrote:
> On Monday, October 16, 2017 10:10:52 PM CEST Roman Yeryomin wrote:
>> On 2017-10-16 20:32, Christian Lamparter wrote:
>> > Added John, maybe he has more comments.
> (This time with the right mail address - sorry)
> 
>> >> Changes:
>> >> - add partitions
>> >> - enable wifi and ethernet
>> >> - set max cpu speed to 710MHz
>> >> - set memory size to 256MB
>> >> - add image generation
>> >> - extract pre-cal data from ART partition
>> >>
>> >> Wirespeed NAT can be achieved with spreading rx interrupts over
>> >> different
>> >> cores. Wifi needs love -- too slow. Could be that latest ath10k helps,
>> >> didn't test yet.
>> > That "Wifi needs love" stinks of board-2.bin issues. And we had to deal
>> > with this before:
>> > <http://lists.infradead.org/pipermail/ath10k/2016-November/008763.html>
>> >
>> > Verify that you have the correct (and up to date) board-2.bin for the
>> > board.
>> > please add the board's board-2.bin to the ipq-wifi package.

I don't think it needs some different board data.
bmi id is 17 for the board (taken from ART partition) which exists in 
board-2.bin
Also now, after fixing CPU speed (again), I'm getting 550Mbps which is 
close to max for open air tests.

>> I was going to deal with wifi related issues later.
> Please don't defere the wireless issue. Fix it now.

Hm? Don't understand this.
There are a lot boards added with something not working. Double 
standards?
And in this case it was actually working.

> In the mail, Michal Kazior who was working for Qualcomm Atheros at the 
> time
> stated quite clearly:
> 
> "Please don't do that. Your basically pushing bogus data as board data
> to the device. I'm a ltittle surprised firmware didn't notice. Anyway,
> expect the device to misbehave (crash, hang, regulatory violations)
> with this "board.bin"."

I don't feed it with board.bin, you refer to irrelevant context.

> and also:
> 
> "board-2 is a key-value store of actual board files. Some devices,

Exactly, that's why board-2.bin just works.

> notably qca61x4 hw3+ and qca4019 need distinct board files to be
> uploaded. Otherwise they fail in various ways."
> 
>> >>
>> >> +define Device/AP-DK01.1-C1
>> >> +	PROFILES += $$(DEVICE_NAME)
>> >> +	DEVICE_TITLE := QCA AP-DK01.1-C1
>> >> +	BOARD_NAME := ap-dk01.1-c1
>> >> +	DEVICE_DTS := qcom-ipq4019-ap.dk01.1-c1
>> >    This "qcom-ipq4019-ap.dk01.1-c1" is important later on.
>> >
>> >> +	KERNEL_LOADADDR := 0x80208000
>> >> +	KERNEL_INSTALL := 1
>> >> +	KERNEL_SIZE := 4096k
>> >> +	IMAGE_SIZE := 26624k
>> >> +	FILESYSTEMS := squashfs
>> >> +	$(call Device/FitImage)
>> > Any reason why this include is not at the top of the define?
>> 
>> This is kernel image generation, right before full image.
>> Actually I don't understand why it's put on top.
> But you did notice that all other devices definitions have it on top as 
> well?
> Are you really sure, that you really want to trigger people with OCD to 
> do
> make a "cleanup" patch later? You could avoid this altogether right 
> now.

I don't understand this.
I would rather clean this up now and move all the other calls lower. So 
they would fit at least some logic.

> [...]
> 
>> >> +@@ -20,6 +20,11 @@
>> >> + 	model = "Qualcomm Technologies, Inc. IPQ4019/AP-DK01.1";
>> >> + 	compatible = "qcom,ipq4019";
>> > I think this should be "qcom,ipq4019-ap.dk01.1-c1", "qcom,ipq4019".
>> > The device-tree folks stick to their rules in the
>> > usage-model.txt / 2.2 Platform Identification
>> > <https://www.kernel.org/doc/Documentation/devicetree/usage-model.txt>
>> 
>> I didn't change that. And will not in v3, since I'm going to patch
>> qcom-ipq4019-ap.dk01.1-c1.dts
> This has to be done! Again the usage-model.txt clearly states that:
> "The 'compatible' property contains a sorted list of strings starting
> with the *exact name of the machine*, followed by an optional list of
> boards it is compatible with sorted from most compatible to least."
> (Read the rest of 2.2 Platform Identification as well)

I think you forgot what you wrote yourself.
This is dtsi, for dts, the one which should be changed (as you noted 
yourself), I agree makes sense, but not dtsi.

> Also, Mathias Kresin has plans to use the first "compatible" entry
> as an unique identifier for the userspace scripts. (And remove
> ipq806x current custom board identifier script that relies on the
> model)

That's good, but I cannot rely on plans and have to add custom board 
identifier.
Once that's introduced he can change every user, as it's always done 
with many other different things.
Currently 01_preinit_do_ipq806x.sh overrides this:

> part of this work has already been merged see:
> https://github.com/lede-project/source/blob/master/package/base-files/files/lib/preinit/02_sysinfo
> 
> Since the "qcom,ipq4019" compatible is already used by the 
> AP-DK04.1-C1,
> this will cause a conflict with your "AP-DK01.1-C1"... And then the
> userspace won't know "which is which".

Sure, but again, not for dtsi

Actually it appeared that the board I have is AP-DK01.2-C1
All ref boards differ either with flash configuration (spi/nand/emmc) or 
SoC (4019/4029/4018/4028).
And actually all of them have same RAM size (so this is going to be in 
dtsi).

>> >> + 	clocks {
>> >> +                 xo: xo {
>> >> +                         compatible = "fixed-clock";
>> >> diff --git
>> >> a/target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch
>> >> b/target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch
>> >> new file mode 100644
>> >> index 0000000..e9540f4
>> >> --- /dev/null
>> >> +++
>> >> b/target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch
>> >> @@ -0,0 +1,15 @@
>> >> +--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
>> >> ++++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
>> >> +@@ -135,3 +135,12 @@
>> >> + 		};
>> >> + 	};
>> >> + };
>> >> ++
>> >> ++&cpu0_opp_table {
>> >> ++	/delete-node/ opp@666000000;
>> >> ++
>> >> ++	opp@710000000 {
>> >> ++		opp-hz = /bits/ 64 <710000000>;
>> >> ++		clock-latency-ns = <256000>;
>> >> ++	};
>> >> ++};
>> > This looks rather familiar. Like exactly a 1:1 copy from the FB4040's
>> > dts
>> > right here:
>> > https://github.com/lede-project/source/blob/master/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq4019-fritz4040.dts#L286
>> > Is this true?
>> >
>> > There's a reason to stick with the 666MHz rate though. You should check

I don't think there is. All ipq40xx CPUs are 716.8MHz at max.
The supported frequencies are: 48, 200, 500 and 716.8 MHz

>> > if the device produces messages like:
>> > [    1.399981] cpufreq: cpufreq_online: CPU0: Running at unlisted
>> > freq: 666000 KHz
>> > [    1.400256] cpufreq: cpufreq_online: CPU0: Unlisted initial
>> > frequency changed to: 710000 KHz
>> > (From what I know, the SBL actually sets it to 666MHz)
>> >
>> > But there's more. If you look at qualcomm's page, it's says that the
>> > CPU Clock Speed is 717 MHz: <https://www.qualcomm.com/products/ipq4028>
>> >
>> > Since you are working for a OEM/ODM. You could please ask what is the
>> > right MHz table for these devices? Unfortunately, Qualcomm never got
>> > around to fix this upstream and without an official statement from them
>> > it's very difficult to push stuff like this upstream.

It looks like it was mostly a limitation introduced by hw instability 
(both IC and boards) in early stages.
Mass production chips (at least should) run at full speed.

>> Hmm...
> Could you please ask Qualcomm?
> (Also to consider: there are IPQ40XX devices with and without an 
> heat-sink.
> It could be that devices w/o a heat-sink have to have lower clocks 
> prevent
> overheating.)

Reference design boards don't have them and they run at full speed.

>> >> diff --git
>> >> a/target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch
>> >> b/target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch
>> >> new file mode 100644
>> >> index 0000000..cc90475
>> >> --- /dev/null
>> >> +++
>> >> b/target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch
>> >> @@ -0,0 +1,87 @@
>> >> +--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
>> >> ++++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
>> >> +@@ -15,6 +15,7 @@
>> >> +  */
>> >> +
>> >> + #include "qcom-ipq4019.dtsi"
>> >> ++#include <dt-bindings/soc/qcom,tcsr.h>
>> > please move this to the qcom-ipq4019-ap.dk01.1-c1.dts.
>> >
>> >> +
>> >> + / {
>> >> + 	model = "Qualcomm Technologies, Inc. IPQ4019/AP-DK01.1";
>> >> +@@ -25,6 +26,27 @@
>> >> + 		reg = <0x80000000 0x10000000>;
>> >> + 	};
>> >> +
>> >> ++	reserved-memory {
>> >> ++		#address-cells = <0x1>;
>> >> ++		#size-cells = <0x1>;
>> >> ++		ranges;
>> >> ++
>> >> ++		rsvd1@87000000 {
>> >> ++			reg = <0x87000000 0x0500000>;
>> >> ++			no-map;
>> >> ++		};
>> >> ++
>> >> ++		wifi_dump@87500000 {
>> >> ++			reg = <0x87500000 0x600000>;
>> >> ++			no-map;
>> >> ++		};
>> >> ++
>> >> ++		rsvd2@87B00000 {
>> >> ++			reg = <0x87b00000 0x500000>;
>> >> ++			no-map;
>> >> ++		};
>> >> ++	};
>> >
>> > The wifi_dump area is not needed by the ath10k driver.
>> > Furthermore, the you could probably get away with reserving
>> > less memory. From what I know, you only need to reserve space
>> > for the "QSEE environment", which is located between
>> > 0x87e00000 and 0x88000000.

wifi_dump == cnss_debug (not sure what this is)
I wouldn't be so sure that it's not needed at all.

QSEE == TZ
And seems your information is incorrect.
Will introduce full map in v3.

>> I have no information about those.
>> I think there should be also NSS region...
> Do you know, if the IPQ40XX actually has a NSS?

I believe it has. Just called differently.

> Qualcomm's IPQ40[1|2][89] pages don't mention anything about a NSS.
> And there isn't any special NSS driver in the GPL dumps I have seen.

There is HWNAT block which I believe is the same.
Looks like they call it edma now, looks like it's same engine with 
different interface.

> From what I know these Network Subsystem (NSS) are only a thing for
> the IPQ8064, IPQ8065 and the upcoming IPQ8074 tier.

I could be wrong though. Still waiting for info.


Regards,
Roman
diff mbox series

Patch

diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 39757eb..271667f 100644
--- a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -50,6 +50,9 @@  case "$FIRMWARE" in
 	fritz4040)
 		/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
 		;;
+	ap-dk01.1-c1)
+		ath10kcal_extract "ART" 4096 12064
+		;;
 	esac
 	;;
 "ath10k/pre-cal-ahb-a800000.wifi.bin")
@@ -57,6 +60,9 @@  case "$FIRMWARE" in
 	fritz4040)
 		/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
 		;;
+	ap-dk01.1-c1)
+		ath10kcal_extract "ART" 20480 12064
+		;;
 	esac
 	;;
 
diff --git a/target/linux/ipq806x/base-files/lib/ipq806x.sh b/target/linux/ipq806x/base-files/lib/ipq806x.sh
index e8ff7ea..940c7ef 100644
--- a/target/linux/ipq806x/base-files/lib/ipq806x.sh
+++ b/target/linux/ipq806x/base-files/lib/ipq806x.sh
@@ -14,6 +14,9 @@  ipq806x_board_detect() {
 	machine=$(cat /proc/device-tree/model)
 
 	case "$machine" in
+	*"AP-DK01.1-C1")
+		name="ap-dk01.1-c1"
+		;;
 	*"AP148")
 		name="ap148"
 		;;
diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile
index 3a76c7f..60b3a71 100644
--- a/target/linux/ipq806x/image/Makefile
+++ b/target/linux/ipq806x/image/Makefile
@@ -264,7 +264,23 @@  define Device/AP-DK04.1-C1
 	DEVICE_TITLE := QCA AP-DK04.1-C1
 endef
 
+define Device/AP-DK01.1-C1
+	PROFILES += $$(DEVICE_NAME)
+	DEVICE_TITLE := QCA AP-DK01.1-C1
+	BOARD_NAME := ap-dk01.1-c1
+	DEVICE_DTS := qcom-ipq4019-ap.dk01.1-c1
+	KERNEL_LOADADDR := 0x80208000
+	KERNEL_INSTALL := 1
+	KERNEL_SIZE := 4096k
+	IMAGE_SIZE := 26624k
+	FILESYSTEMS := squashfs
+	$(call Device/FitImage)
+	IMAGES := sysupgrade.bin
+	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$${KERNEL_SIZE} | append-rootfs | pad-rootfs | append-metadata
+	DEVICE_PACKAGES := ath10k-firmware-qca4019
+endef
+
 TARGET_DEVICES += AP148 AP148-legacy C2600 D7800 DB149 EA8500 FRITZ4040 R7500 \
-		  R7500v2 R7800 NBG6817 VR2600v AP-DK04.1-C1
+		  R7500v2 R7800 NBG6817 VR2600v AP-DK04.1-C1 AP-DK01.1-C1
 
 $(eval $(call BuildImage))
diff --git a/target/linux/ipq806x/patches-4.9/864-01-dts-ipq4019-ap.dk01.1-add-256MB-memory-node.patch b/target/linux/ipq806x/patches-4.9/864-01-dts-ipq4019-ap.dk01.1-add-256MB-memory-node.patch
new file mode 100644
index 0000000..8a80979
--- /dev/null
+++ b/target/linux/ipq806x/patches-4.9/864-01-dts-ipq4019-ap.dk01.1-add-256MB-memory-node.patch
@@ -0,0 +1,14 @@ 
+--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
++++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
+@@ -20,6 +20,11 @@
+ 	model = "Qualcomm Technologies, Inc. IPQ4019/AP-DK01.1";
+ 	compatible = "qcom,ipq4019";
+ 
++	memory {
++		device_type = "memory";
++		reg = <0x80000000 0x10000000>;
++	};
++
+ 	clocks {
+                 xo: xo {
+                         compatible = "fixed-clock";
diff --git a/target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch b/target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch
new file mode 100644
index 0000000..e9540f4
--- /dev/null
+++ b/target/linux/ipq806x/patches-4.9/864-02-dts-ipq4019-ap.dk01.1-fix-max-cpu-speed.patch
@@ -0,0 +1,15 @@ 
+--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
++++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
+@@ -135,3 +135,12 @@
+ 		};
+ 	};
+ };
++
++&cpu0_opp_table {
++	/delete-node/ opp@666000000;
++
++	opp@710000000 {
++		opp-hz = /bits/ 64 <710000000>;
++		clock-latency-ns = <256000>;
++	};
++};
diff --git a/target/linux/ipq806x/patches-4.9/864-03-dts-ipq4019-ap.dk01.1-add-partitions.patch b/target/linux/ipq806x/patches-4.9/864-03-dts-ipq4019-ap.dk01.1-add-partitions.patch
new file mode 100644
index 0000000..a7861cd
--- /dev/null
+++ b/target/linux/ipq806x/patches-4.9/864-03-dts-ipq4019-ap.dk01.1-add-partitions.patch
@@ -0,0 +1,72 @@ 
+--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
++++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
+@@ -93,6 +93,69 @@
+ 				reg = <0>;
+ 				compatible = "mx25l25635e";
+ 				spi-max-frequency = <24000000>;
++
++				SBL1@0 {
++					label = "SBL1";
++					reg = <0x0 0x40000>;
++					read-only;
++				};
++
++				MIBIB@40000 {
++					label = "MIBIB";
++					reg = <0x40000 0x20000>;
++					read-only;
++				};
++
++				QSEE@60000 {
++					label = "QSEE";
++					reg = <0x60000 0x60000>;
++					read-only;
++				};
++
++				CDT@c0000 {
++					label = "CDT";
++					reg = <0xc0000 0x10000>;
++					read-only;
++				};
++
++				DDRPARAMS@d0000 {
++					label = "DDRPARAMS";
++					reg = <0xd0000 0x10000>;
++					read-only;
++				};
++
++				APPSBLENV@e0000 {
++					label = "APPSBLENV";
++					reg = <0xe0000 0x10000>;
++					read-only;
++				};
++
++				APPSBL@f0000 {
++					label = "APPSBL";
++					reg = <0xf0000 0x80000>;
++					read-only;
++				};
++
++				ART@170000 {
++					label = "ART";
++					reg = <0x170000 0x10000>;
++					read-only;
++				};
++
++				kernel@180000 {
++					label = "kernel";
++					reg = <0x180000 0x400000>;
++				};
++
++				rootfs@580000 {
++					label = "rootfs";
++					reg = <0x580000 0x1600000>;
++				};
++
++				firmware@180000 {
++					label = "firmware";
++					reg = <0x180000 0x1a00000>;
++				};
+ 			};
+ 		};
+ 
diff --git a/target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch b/target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch
new file mode 100644
index 0000000..cc90475
--- /dev/null
+++ b/target/linux/ipq806x/patches-4.9/864-04-dts-ipq4019-ap.dk01.1-enable-wifi-and-ethernet.patch
@@ -0,0 +1,87 @@ 
+--- a/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
++++ b/arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi
+@@ -15,6 +15,7 @@
+  */
+ 
+ #include "qcom-ipq4019.dtsi"
++#include <dt-bindings/soc/qcom,tcsr.h>
+ 
+ / {
+ 	model = "Qualcomm Technologies, Inc. IPQ4019/AP-DK01.1";
+@@ -25,6 +26,27 @@
+ 		reg = <0x80000000 0x10000000>;
+ 	};
+ 
++	reserved-memory {
++		#address-cells = <0x1>;
++		#size-cells = <0x1>;
++		ranges;
++
++		rsvd1@87000000 {
++			reg = <0x87000000 0x0500000>;
++			no-map;
++		};
++
++		wifi_dump@87500000 {
++			reg = <0x87500000 0x600000>;
++			no-map;
++		};
++
++		rsvd2@87B00000 {
++			reg = <0x87b00000 0x500000>;
++			no-map;
++		};
++	};
++
+ 	clocks {
+                 xo: xo {
+                         compatible = "fixed-clock";
+@@ -196,6 +218,48 @@
+ 		usb2: usb2@60f8800 {
+ 			status = "ok";
+ 		};
++
++		wifi@a000000 {
++			status = "okay";
++		};
++
++		wifi@a800000 {
++			status = "okay";
++		};
++
++		ess-switch@c000000 {
++			status = "okay";
++		};
++
++		ess-psgmii@98000 {
++			status = "okay";
++		};
++
++		edma@c080000 {
++			status = "okay";
++		};
++
++		mdio@90000 {
++			status = "okay";
++		};
++
++		ess_tcsr@1953000 {
++			compatible = "qcom,tcsr";
++			reg = <0x1953000 0x1000>;
++			qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
++		};
++
++		tcsr@1949000 {
++			compatible = "qcom,tcsr";
++			reg = <0x1949000 0x100>;
++			qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
++		};
++
++		tcsr@1957000 {
++			compatible = "qcom,tcsr";
++			reg = <0x1957000 0x100>;
++			qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
++		};
+ 	};
+ };
+