[LEDE-DEV] [PATCH] Lantiq Amazon-SE SoC / ADSL Modem Allnet All0333CJ Rev.C
Tino Reichardt
list-lede at mcmilk.de
Fri Feb 24 04:12:19 PST 2017
Hello,
some time ago I made an RFC for an dsl modem device with the Lantiq
Amazon-SE SoC. You can find it here:
http://lists.infradead.org/pipermail/lede-dev/2016-November/003818.html
I have finished this in december 2016, but wanted to do some testing...
this is not done until yet, but maybe others want to try amazon-se
targets as well.. so I post the current patch for review and finishing.
I have created a small homepage for the patch, it is located here:
https://mcmilk.de/projects/all0333cj/
And here is a github page with Amazon-SE Firmwares I have found in the
source code of allnet and netgear:
https://github.com/mcmilk/Amazon-SE-Firmware
Patch details: (patch is done with git diff, on current lede master)
target/linux/lantiq/Makefile
- added a new subtarget "ase" in Lantiq
lantiq/base-files/etc/board.d/01_leds + 02_network
- added the model ALL0333CJ for led stuff + mac addres from uboot
environment
target/linux/lantiq/dts/amazonse.dtsi
- the amazonse.dtsi had some problems which are solved now:
1) the memory at 0 section was not present
2) localbus at 0 section was also not there
3) some irq's are not correct I think, but the current amazonse.dtsi
works now... additional stuff could be done later
target/linux/generic/patches-4.4/308-mips32r2_tune.patch
- this patch adds cflags, which compiles code, which can not run on my
device (is there a way for disabling this generic patch for my special
mips target?)
If I should make a pull request via github, just tell me.
--
Best regards, TR
-------------- next part --------------
diff --git a/target/linux/generic/patches-4.4/308-mips32r2_tune.patch b/target/linux/generic/patches-4.4/308-mips32r2_tune.patch
deleted file mode 100644
index f4ab89ef28..0000000000
--- a/target/linux/generic/patches-4.4/308-mips32r2_tune.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Add -mtune=34kc to MIPS CFLAGS when building for mips32r2
-This provides a good tradeoff across at least 24Kc-74Kc, while also
-producing smaller code.
-
-Signed-off-by: Felix Fietkau <nbd at nbd.name>
-
---- a/arch/mips/Makefile
-+++ b/arch/mips/Makefile
-@@ -145,7 +145,7 @@ cflags-$(CONFIG_CPU_R4X00) += -march=r46
- cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap
- cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \
- -Wa,-mips32 -Wa,--trap
--cflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \
-+cflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2 -mtune=34kc,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \
- -Wa,-mips32r2 -Wa,--trap
- cflags-$(CONFIG_CPU_MIPS32_R6) += -march=mips32r6 -Wa,--trap
- cflags-$(CONFIG_CPU_MIPS64_R1) += $(call cc-option,-march=mips64,-mips64 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) \
diff --git a/target/linux/lantiq/Makefile b/target/linux/lantiq/Makefile
index 3e4f48e7b1..3b89ca0c8f 100644
--- a/target/linux/lantiq/Makefile
+++ b/target/linux/lantiq/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
BOARD:=lantiq
BOARDNAME:=Lantiq
FEATURES:=squashfs
-SUBTARGETS:=xrx200 xway xway_legacy falcon
+SUBTARGETS:=ase falcon xrx200 xway xway_legacy
MAINTAINER:=John Crispin <john at phrozen.org>
KERNEL_PATCHVER:=4.4
diff --git a/target/linux/lantiq/ase/config-default b/target/linux/lantiq/ase/config-default
new file mode 100644
index 0000000000..11255f7b45
--- /dev/null
+++ b/target/linux/lantiq/ase/config-default
@@ -0,0 +1,32 @@
+CONFIG_ADM6996_PHY=y
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_CRC16=y
+CONFIG_CRYPTO_DEFLATE=y
+CONFIG_CRYPTO_LZO=y
+CONFIG_DECOMPRESS_XZ=y
+# CONFIG_DEFAULT_DEADLINE is not set
+CONFIG_DEFAULT_IOSCHED="noop"
+CONFIG_DEFAULT_NOOP=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_FIRMWARE_MEMMAP=y
+CONFIG_GPIO_GENERIC=y
+CONFIG_GPIO_GENERIC_PLATFORM=y
+CONFIG_IMAGE_CMDLINE_HACK=y
+# CONFIG_ISDN is not set
+CONFIG_JUMP_LABEL=y
+# CONFIG_LBDAF is not set
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
+CONFIG_MIPS_FPU_EMULATOR=y
+# CONFIG_PSB6970_PHY is not set
+CONFIG_RD_XZ=y
+# CONFIG_RTL8366_SMI is not set
+CONFIG_SOC_AMAZON_SE=y
+# CONFIG_SOC_XWAY is not set
+# CONFIG_SPI is not set
+CONFIG_USB_SUPPORT=y
+# CONFIG_WIRELESS is not set
+# CONFIG_WLAN is not set
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_ZLIB_INFLATE=y
diff --git a/target/linux/lantiq/ase/profiles/00-default.mk b/target/linux/lantiq/ase/profiles/00-default.mk
new file mode 100644
index 0000000000..26bc8b502b
--- /dev/null
+++ b/target/linux/lantiq/ase/profiles/00-default.mk
@@ -0,0 +1,9 @@
+define Profile/Default
+ NAME:=Default Profile
+ PRIORITY:=1
+endef
+
+define Profile/Default/Description
+ Default package set compatible with most boards.
+endef
+$(eval $(call Profile,Default))
diff --git a/target/linux/lantiq/ase/target.mk b/target/linux/lantiq/ase/target.mk
new file mode 100644
index 0000000000..28694e6d44
--- /dev/null
+++ b/target/linux/lantiq/ase/target.mk
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2016 LEDE Project
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+ARCH:=mips
+SUBTARGET:=ase
+BOARDNAME:=Amazon-SE
+FEATURES:=squashfs atm mips16
+# ramdisk small_flash
+CPU_TYPE:=4kec
+
+DEFAULT_PACKAGES+=kmod-leds-gpio kmod-gpio-button-hotplug \
+ kmod-ltq-adsl-ase kmod-ltq-adsl-ase-mei \
+ kmod-ltq-adsl-ase-fw-b kmod-ltq-atm-ase \
+ ltq-adsl-app ppp-mod-pppoe luci_git
+
+# DEVICE_PACKAGES := kmod-ltq-adsl-ase kmod-ltq-adsl-ase-mei \
+# kmod-ltq-adsl-ase-fw-b kmod-ltq-atm-ase \
+# ltq-adsl-app ppp-mod-pppoe
+
+define Target/Description
+ Lantiq Amazon-SE Boards
+endef
diff --git a/target/linux/lantiq/base-files/etc/board.d/01_leds b/target/linux/lantiq/base-files/etc/board.d/01_leds
index 0698d6cc59..221815d683 100755
--- a/target/linux/lantiq/base-files/etc/board.d/01_leds
+++ b/target/linux/lantiq/base-files/etc/board.d/01_leds
@@ -35,6 +35,9 @@ led_internet="$(lantiq_get_dt_led internet)"
board=$(lantiq_board_name)
case "$board" in
+ALL0333CJ)
+ ucidef_set_led_netdev "lan" "lan" "all0333cj:green:lan" "eth0.1"
+ ;;
ARV4525PW)
ucidef_set_led_netdev "wifi" "wifi" "arv4525pw:green:wlan" "wlan0"
;;
diff --git a/target/linux/lantiq/base-files/etc/board.d/02_network b/target/linux/lantiq/base-files/etc/board.d/02_network
index 576bb7d86b..8f223b2ab9 100755
--- a/target/linux/lantiq/base-files/etc/board.d/02_network
+++ b/target/linux/lantiq/base-files/etc/board.d/02_network
@@ -26,6 +26,13 @@ ACMP252|GIGASX76X)
"1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t at eth0"
;;
+ALL0333CJ)
+ annex="b"
+ lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
+ wan_mac=$(macaddr_add "$lan_mac" 1)
+ ucidef_set_interface_lan 'eth0'
+ ;;
+
ARV4510PW)
lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
wan_mac=$(macaddr_add "$lan_mac" 1)
@@ -183,4 +190,3 @@ ucidef_set_interface_wan "$interface_wan" "pppoe"
board_config_flush
exit 0
-
diff --git a/target/linux/lantiq/dts/ALL0333CJ.dts b/target/linux/lantiq/dts/ALL0333CJ.dts
new file mode 100644
index 0000000000..e613923ff7
--- /dev/null
+++ b/target/linux/lantiq/dts/ALL0333CJ.dts
@@ -0,0 +1,131 @@
+/dts-v1/;
+
+#include "amazonse.dtsi"
+
+/ {
+ model = "ALL0333CJ - Allnet ALL0333CJ DSL Modem";
+
+ chosen {
+ bootargs = "console=ttyLTQ0,115200";
+
+ aliases {
+ led-boot = &power;
+ led-failsafe = &power;
+ led-running = &power;
+
+ led-dsl = &dsl;
+ led-internet = &online_green;
+ };
+
+ };
+
+ memory at 0 {
+ reg = <0x0 0x1000000>; // 16MB
+ };
+
+ // does not work at fpi at 10000000 /TR
+ fpi at b0000000 {
+ etop at E180000 {
+ phy-mode = "mii";
+ };
+ };
+
+ fpi at 10000000 {
+ gpio: pinmux at E100B10 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&state_default>;
+
+ state_default: pinmux {
+ asc {
+ lantiq,groups = "asc";
+ lantiq,function = "asc";
+ };
+ keys_in {
+ lantiq,pins = "io0",/* "io25", */"io29";
+ lantiq,pull = <2>;
+ lantiq,open-drain = <1>;
+ };
+ };
+ };
+
+ // nor chips like: Spansion S29GL032
+ localbus at 0 {
+ nor-boot at 0 {
+ compatible = "lantiq,nor";
+ bank-width = <2>;
+ reg = <0 0x0 0x400000>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition at 0 {
+ label = "uboot";
+ reg = <0x00000 0x10000>;
+ read-only;
+ };
+
+ partition at 10000 {
+ label = "firmware";
+ reg = <0x10000 0x3ef200>;
+ };
+
+ partition at 3ff200 {
+ label = "uboot_env";
+ reg = <0x3ff200 0xc00>;
+ read-only;
+ };
+
+ partition at 3ffe00 {
+ label = "dummy_rootfs";
+ reg = <0x3ffe00 0x200>;
+ read-only;
+ };
+ };
+ };
+ };
+ };
+
+ /**
+ * gpios:
+ * 1=dsl (1=off, 0=on)
+ * 3=ethernet (1=off, 0=on)
+ * 4=online red (1=off, 0=on) - right most
+ * 12=online green (1=off, 0=on) - right most
+ * 13=power (1=red, 0=green) - left most
+ */
+
+ gpio-leds {
+ compatible = "gpio-leds";
+
+ /* POWER: two led's: 1x green, 1x red */
+ power: power {
+ label = "all0333cj:green:power";
+ gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+ default-state = "keep";
+ };
+
+ lan: lan {
+ label = "all0333cj:green:lan";
+ gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
+ default-state = "keep";
+ };
+
+ dsl: dsl {
+ label = "all0333cj:green:dsl";
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+ };
+
+ online_green: online {
+ label = "all0333cj:green:online";
+ gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+ };
+ online_red {
+ label = "all0333cj:red:online";
+ gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
+ };
+ };
+};
diff --git a/target/linux/lantiq/dts/amazonse.dtsi b/target/linux/lantiq/dts/amazonse.dtsi
index 2b8ad08140..f7e49fd2e2 100644
--- a/target/linux/lantiq/dts/amazonse.dtsi
+++ b/target/linux/lantiq/dts/amazonse.dtsi
@@ -19,6 +19,10 @@
};
};
+ memory at 0 {
+ device_type = "memory";
+ };
+
biu at 1F800000 {
#address-cells = <1>;
#size-cells = <1>;
@@ -52,6 +56,7 @@
eiu0: eiu at 101000 {
#interrupt-cells = <1>;
+ interrupt-controller;
compatible = "lantiq,eiu-xway";
reg = <0x101000 0x1000>;
interrupt-parent = <&icu0>;
@@ -82,6 +87,14 @@
ranges = <0x0 0x10000000 0xEEFFFFF>;
reg = <0x10000000 0xEF00000>;
+ localbus at 0 {
+ #address-cells = <2>;
+ #size-cells = <1>;
+ ranges = <0 0 0x0 0x3ffffff /* addrsel0 */
+ 1 0 0x4000000 0x4000010>; /* addsel1 */
+ compatible = "lantiq,localbus", "simple-bus";
+ };
+
spi at E100800 {
compatible = "lantiq,ase-spi";
reg = <0xE100800 0x100>;
diff --git a/target/linux/lantiq/image/Makefile b/target/linux/lantiq/image/Makefile
index cdc88b2fc6..a6f0cbe7f2 100644
--- a/target/linux/lantiq/image/Makefile
+++ b/target/linux/lantiq/image/Makefile
@@ -106,6 +106,31 @@ define Device/AVM
KERNEL := kernel-bin | append-dtb | lzma | eva-image
endef
+ifeq ($(SUBTARGET),ase)
+
+define Device/ALL0333CJ
+ IMAGE_SIZE := 3000k
+ DEVICE_DTS := ALL0333CJ
+ DEVICE_TITLE := Allnet ALL0333CJ
+ DEVICE_PACKAGES := kmod-ltq-adsl-ase kmod-ltq-adsl-ase-mei \
+ kmod-ltq-adsl-ase-fw-b kmod-ltq-atm-ase \
+ ltq-adsl-app ppp-mod-pppoe
+endef
+TARGET_DEVICES += ALL0333CJ
+
+# TODO: add wlan/usb stuff
+define Device/DGN1000B
+ IMAGE_SIZE := 6000k
+ DEVICE_DTS := DGN1000B
+ DEVICE_TITLE := Netgear DGN1000B
+ DEVICE_PACKAGES := kmod-ltq-adsl-ase kmod-ltq-adsl-ase-mei \
+ kmod-ltq-adsl-ase-fw-b kmod-ltq-atm-ase \
+ ltq-adsl-app ppp-mod-pppoe
+endef
+TARGET_DEVICES += DGN1000B
+
+endif
+
ifeq ($(SUBTARGET),xway_legacy)
define Device/ARV4520PW
More information about the Lede-dev
mailing list