ipq806x: add ipq4019 fritz4040 support

This patch adds support for AVM FRITZ!Box 4040.

hardware highlights:

SOC:	IPQ4018 / QCA Dakota
CPU:	Quad-Core ARMv7 Processor rev 5 (v7l) Cortex-A7
DRAM:	256 MiB Nanya NT5CC128M16IP
FLASH:	32 MiB MXIC MX25L25635FMI
ETH:	Qualcomm Atheros QCA8075 Gigabit Switch (4 x LAN, 1 x WAN)
USB:	1 x 3.0 (via Synopsys DesignWare DWC3 controller in the SoC)
	1 x 2.0 (via Synopsys DesignWare DWC3 controller in the SoC)
WLAN1:	Qualcomm Atheros QCA4018 2.4GHz 802.11bgn 2:2x2
WLAN2:	Qualcomm Atheros QCA4018 5GHz 802.11a/n/ac 2:2x2
INPUT:	one WLAN and one WPS button
LEDS:	Power, WAN/Internet, WIFI, INFO (red and amber) and LAN.
Serial:
	WARNING: The serial port needs a TTL/RS-232 v3.3 level converter!
        The Serial setting is 115200-8-N-1. The SoC's serial port is right
	next to the MXIC FLASH chip. The board has a unpopulated 1x4 0.1"
	header for it. Use a multimeter to figure out the pinout!

This board currently needs an additional u-boot image in order to boot
properly. Booting with EVA isn't possible ATM.

Install Procedure:
 0. It's highly recommended to connect to the serial port.
    The serial settings are listed above.
 1. install a u-boot image for AVM Fritz!Box 4040
    (see <https://github.com/chunkeey/FritzBox-4040-UBOOT/releases> and
    <https://github.com/chunkeey/FritzBox-4040-UBOOT/blob/master/upload-to-f4040.sh>)
 2. upload the initramfs.itb image via tftp (u-boot listens to
    192.168.1.1 - use binary transfer mode!)
 3. connect to the FB4040 and use sysupgrade sysupgrade.bin
    to install the image.

Works:
	- Switch and Ethernet (99%)
        - Buttons (WLAN, WPS)
        - FLASH (1 x 32MiB NOR Chip)
        - WLAN2G and WLAN5G
        - CPUFREQ scaling
        - PRNG
        - serial
        - Crypto Accelerator
        - sysupgrade (Read the flash instructions to avoid bricking)
        - full LEDE Install (Read the flash instructions to avoid bricking)
	- LEDs (Power, WAN, Info (red and amber), LAN)
          The LEDs are connected to the QCA8075 LED ports.
	  The AR40xx driver contains a gpio-controller to
	  handle these special "GPIOs".
        - USB Both 3.0 and 2.0 ports
        - many packages from other ARMv7 boards
          (This does include the RaspberryPi Model 2!)
        - ...

Not planned:
	- WAN<->LAN short-cut
	- Qualcomm Secure Execution Environment
        - ...

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
Christian Lamparter 2017-03-14 17:04:28 +01:00 committed by John Crispin
parent c2d50bdeb3
commit 1cb406d019
7 changed files with 55 additions and 4 deletions

View file

@ -26,6 +26,11 @@ r7800)
ucidef_set_led_netdev "wan" "WAN" "${board}:white:wan" "eth0" ucidef_set_led_netdev "wan" "WAN" "${board}:white:wan" "eth0"
ucidef_set_led_ide "esata" "eSATA" "${board}:white:esata" ucidef_set_led_ide "esata" "eSATA" "${board}:white:esata"
;; ;;
fritz4040)
ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt" "phy1tpt"
ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth1"
ucidef_set_led_switch "lan" "LAN" "${board}:green:lan" "switch0" "0x1e"
;;
nbg6817) nbg6817)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:amber:wifi2g" "phy1tpt" ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:amber:wifi2g" "phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:amber:wifi5g" "phy0tpt" ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:amber:wifi5g" "phy0tpt"

View file

@ -36,6 +36,11 @@ ea8500)
ucidef_set_interface_macaddr "lan" "$hw_mac_addr" ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
ucidef_set_interface_macaddr "wan" "$hw_mac_addr" ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
;; ;;
fritz4040)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
;;
nbg6817) nbg6817)
hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr) hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \

View file

@ -46,6 +46,21 @@ board=$(ipq806x_board_name)
case "$FIRMWARE" in case "$FIRMWARE" in
"ath10k/pre-cal-ahb-a000000.wifi.bin")
case "$board" in
fritz4040)
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
;;
esac
;;
"ath10k/pre-cal-ahb-a800000.wifi.bin")
case "$board" in
fritz4040)
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
;;
esac
;;
"ath10k/cal-pci-0000:01:00.0.bin") "ath10k/cal-pci-0000:01:00.0.bin")
case $board in case $board in
c2600) c2600)

View file

@ -17,6 +17,9 @@ ipq806x_board_detect() {
*"AP148") *"AP148")
name="ap148" name="ap148"
;; ;;
*"4040")
name="fritz4040"
;;
*"C2600") *"C2600")
name="c2600" name="c2600"
;; ;;

View file

@ -42,6 +42,9 @@ platform_do_upgrade() {
MTD_CONFIG_ARGS="-s 0x200000" MTD_CONFIG_ARGS="-s 0x200000"
default_do_upgrade "$ARGV" default_do_upgrade "$ARGV"
;; ;;
*)
default_do_upgrade "$ARGV"
;;
esac esac
} }

View file

@ -272,7 +272,7 @@
read-only; read-only;
}; };
partition11@2A0000 { partition11@2A0000 {
label = "image"; /* firmware */ label = "firmware";
reg = <0x002A0000 0x01C60000>; reg = <0x002A0000 0x01C60000>;
}; };
partition12@1f00000 { partition12@1f00000 {

View file

@ -5,8 +5,6 @@ include $(INCLUDE_DIR)/image.mk
UBIFS_OPTS = -m 2048 -e 124KiB -c 4096 -U -F UBIFS_OPTS = -m 2048 -e 124KiB -c 4096 -U -F
KERNEL_LOADADDR := 0x42208000
define Image/Prepare define Image/Prepare
$(CP) $(LINUX_DIR)/vmlinux $(KDIR)/$(IMG_PREFIX)-vmlinux.elf $(CP) $(LINUX_DIR)/vmlinux $(KDIR)/$(IMG_PREFIX)-vmlinux.elf
endef endef
@ -30,6 +28,7 @@ define Device/Default
KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts) KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
KERNEL_INITRAMFS_PREFIX := $$(IMG_PREFIX)-$(1)-initramfs KERNEL_INITRAMFS_PREFIX := $$(IMG_PREFIX)-$(1)-initramfs
KERNEL_PREFIX := $$(IMAGE_PREFIX) KERNEL_PREFIX := $$(IMAGE_PREFIX)
KERNEL_LOADADDR = 0x42208000
SUPPORTED_DEVICES = $$(BOARD_NAME) SUPPORTED_DEVICES = $$(BOARD_NAME)
IMAGE/sysupgrade.tar = sysupgrade-tar | append-metadata IMAGE/sysupgrade.tar = sysupgrade-tar | append-metadata
endef endef
@ -46,6 +45,12 @@ define Device/FitImage
KERNEL_NAME := Image KERNEL_NAME := Image
endef endef
define Device/FitImageLzma
KERNEL_SUFFIX := -fit-uImage.itb
KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb
KERNEL_NAME := Image
endef
define Device/UbiFit define Device/UbiFit
KERNEL_IN_UBI := 1 KERNEL_IN_UBI := 1
IMAGES := nand-factory.ubi nand-sysupgrade.tar IMAGES := nand-factory.ubi nand-sysupgrade.tar
@ -165,6 +170,20 @@ define Device/EA8500
DEVICE_PACKAGES := ath10k-firmware-qca99x0 DEVICE_PACKAGES := ath10k-firmware-qca99x0
endef endef
define Device/FRITZ4040
$(call Device/FitImageLzma)
DEVICE_DTS := qcom-ipq4019-fritz4040
KERNEL_LOADADDR := 0x80208000
BLOCKSIZE := 4k
PAGESIZE := 256
BOARD_NAME := fritz4040
DEVICE_TITLE := AVM Fritz!Box 4040
IMAGE_SIZE := 29753344
IMAGES = sysupgrade.bin
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
DEVICE_PACKAGES := kmod-usb-phy-qcom-ipq4019 ipq-wifi-fritz4040 fritz-tools u-boot-fritz4040
endef
define Device/R7500 define Device/R7500
$(call Device/DniImage) $(call Device/DniImage)
DEVICE_DTS := qcom-ipq8064-r7500 DEVICE_DTS := qcom-ipq8064-r7500
@ -231,6 +250,7 @@ define Device/VR2600v
IMAGE/sysupgrade.bin := pad-extra 512 | append-kernel | pad-to $$$${KERNEL_SIZE} | append-rootfs | pad-rootfs | append-metadata IMAGE/sysupgrade.bin := pad-extra 512 | append-kernel | pad-to $$$${KERNEL_SIZE} | append-rootfs | pad-rootfs | append-metadata
endef endef
TARGET_DEVICES += AP148 AP148-legacy C2600 D7800 DB149 EA8500 R7500 R7500v2 R7800 NBG6817 VR2600v TARGET_DEVICES += AP148 AP148-legacy C2600 D7800 DB149 EA8500 FRITZ4040 R7500 \
R7500v2 R7800 NBG6817 VR2600v
$(eval $(call BuildImage)) $(eval $(call BuildImage))