[LEDE-DEV] [PATCH v2] ipq806x: add ap.dk01.1 board support
Christian Lamparter
chunkeey at gmail.com
Mon Oct 16 10:32:07 PDT 2017
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 at 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 at 666000000;
> ++
> ++ opp at 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 at 0 {
> ++ label = "SBL1";
> ++ reg = <0x0 0x40000>;
> ++ read-only;
> ++ };
> ++
> ++ MIBIB at 40000 {
> ++ label = "MIBIB";
> ++ reg = <0x40000 0x20000>;
> ++ read-only;
> ++ };
> ++
> ++ QSEE at 60000 {
> ++ label = "QSEE";
> ++ reg = <0x60000 0x60000>;
> ++ read-only;
> ++ };
> ++
> ++ CDT at c0000 {
> ++ label = "CDT";
> ++ reg = <0xc0000 0x10000>;
> ++ read-only;
> ++ };
> ++
> ++ DDRPARAMS at d0000 {
> ++ label = "DDRPARAMS";
> ++ reg = <0xd0000 0x10000>;
> ++ read-only;
> ++ };
> ++
> ++ APPSBLENV at e0000 {
> ++ label = "APPSBLENV";
> ++ reg = <0xe0000 0x10000>;
> ++ read-only;
> ++ };
> ++
> ++ APPSBL at f0000 {
> ++ label = "APPSBL";
> ++ reg = <0xf0000 0x80000>;
> ++ read-only;
> ++ };
> ++
> ++ ART at 170000 {
> ++ label = "ART";
> ++ reg = <0x170000 0x10000>;
> ++ read-only;
> ++ };
> ++
> ++ kernel at 180000 {
> ++ label = "kernel";
> ++ reg = <0x180000 0x400000>;
> ++ };
> ++
> ++ rootfs at 580000 {
> ++ label = "rootfs";
> ++ reg = <0x580000 0x1600000>;
> ++ };
> ++
> ++ firmware at 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 at 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 at 87000000 {
> ++ reg = <0x87000000 0x0500000>;
> ++ no-map;
> ++ };
> ++
> ++ wifi_dump at 87500000 {
> ++ reg = <0x87500000 0x600000>;
> ++ no-map;
> ++ };
> ++
> ++ rsvd2 at 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 at 60f8800 {
> + status = "ok";
> + };
> ++
> ++ wifi at a000000 {
> ++ status = "okay";
> ++ };
> ++
> ++ wifi at a800000 {
> ++ status = "okay";
> ++ };
> ++
> ++ ess-switch at c000000 {
> ++ status = "okay";
> ++ };
> ++
> ++ ess-psgmii at 98000 {
> ++ status = "okay";
> ++ };
> ++
> ++ edma at c080000 {
> ++ status = "okay";
> ++ };
> ++
> ++ mdio at 90000 {
> ++ status = "okay";
> ++ };
> ++
> ++ ess_tcsr at 1953000 {
> ++ compatible = "qcom,tcsr";
> ++ reg = <0x1953000 0x1000>;
> ++ qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
> ++ };
> ++
> ++ tcsr at 1949000 {
> ++ compatible = "qcom,tcsr";
> ++ reg = <0x1949000 0x100>;
> ++ qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
> ++ };
> ++
> ++ tcsr at 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.
More information about the Lede-dev
mailing list