layerscape: add Traverse LS1043-S support
authorMathew McBride <matt@traverse.com.au>
Mon, 30 Apr 2018 12:42:39 +0000 (22:42 +1000)
committerJohn Crispin <john@phrozen.org>
Mon, 30 Jul 2018 08:53:57 +0000 (10:53 +0200)
The Traverse LS1043-S board is a router board based on
NXP/Freescale's LS1043 SoC, with 4x1GBase-T, 1 SFP and 1 SFP+,
as well as miniPCIe and M.2 LTE.

Unlike the Layerscape reference boards, the LS1043-S board has
NAND flash and uses the mainline U-Boot.

This patch implements support for the LS1043-S board, as well as
the earlier LS1043-V board. It is our intention that all boards
in this family (LS1043-S and later, Five64) will boot the same binary.

Not included in this patchset are the hwmon drivers not in the kernel
(emc1704,pac1934) or the bootloader.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
target/linux/layerscape/base-files/etc/board.d/01_led [new file with mode: 0755]
target/linux/layerscape/base-files/etc/board.d/02_network [new file with mode: 0755]
target/linux/layerscape/base-files/etc/board.d/03_gpio_switches [new file with mode: 0755]
target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth [new file with mode: 0644]
target/linux/layerscape/base-files/lib/upgrade/platform.sh [new file with mode: 0644]
target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043s.dts [new file with mode: 0644]
target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043v.dts [new file with mode: 0644]
target/linux/layerscape/image/Makefile
target/linux/layerscape/patches-4.9/304-dts-layerscape-add-traverse-ls1043.patch [new file with mode: 0644]
target/linux/layerscape/patches-4.9/820-rgmii-fixed-link.patch
target/linux/layerscape/patches-4.9/821-add-esdhc-vsel-to-ls1043.patch [new file with mode: 0644]

diff --git a/target/linux/layerscape/base-files/etc/board.d/01_led b/target/linux/layerscape/base-files/etc/board.d/01_led
new file mode 100755 (executable)
index 0000000..b9b62a0
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+
+. /lib/functions/uci-defaults.sh
+
+board_config_update
+
+board=$(board_name)
+
+case "$board" in
+traverse,ls1043v)
+       ucidef_set_led_netdev "wan" "WAN LED" "ls1043v:yellow:wan" "eth4"
+       ;;
+traverse,ls1043s)
+       ucidef_set_led_netdev "wan" "WAN LED" "ls1043s:yellow:wan" "eth4"
+       ucidef_set_led_netdev "xgact" "10G Activity" "ls1043s:yellow:10gact" "eth6"
+       ucidef_set_led_netdev "xglink" "10G Link" "ls1043s:green:10glink" "eth6"
+       ;;
+esac
+
+board_config_flush
+
+exit 0
diff --git a/target/linux/layerscape/base-files/etc/board.d/02_network b/target/linux/layerscape/base-files/etc/board.d/02_network
new file mode 100755 (executable)
index 0000000..c50b4a3
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+. /lib/functions/system.sh
+. /lib/functions/uci-defaults.sh
+
+board_config_update
+
+case "$(board_name)" in
+       traverse,ls1043v)
+               ucidef_set_interface_lan "eth0 eth1 eth2 eth3"
+               ucidef_set_interface_wan "eth4"
+               ;;
+       traverse,ls1043s)
+               ucidef_set_interface_lan "eth0 eth1 eth2 eth3 eth6"
+               ucidef_set_interface_wan "eth4"
+               ;;
+esac
+
+board_config_flush
+
+exit 0
diff --git a/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches b/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches
new file mode 100755 (executable)
index 0000000..7f9da08
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+
+. /lib/functions/uci-defaults.sh
+
+board_config_update
+
+board=$(board_name)
+
+case "$board" in
+traverse,ls1043v)
+       ucidef_add_gpio_switch "lte_reset" "LTE Reset" "377"
+       ucidef_add_gpio_switch "lte_disable" "LTE Airplane mode" "378"
+       ;;
+traverse,ls1043s)
+       ucidef_add_gpio_switch "tensfp_txdisable" "SFP+ TX Disable" "378"
+       ucidef_add_gpio_switch "gigsfp_txdisable" "SFP TX Disable" "381"
+       ucidef_add_gpio_switch "lte_reset" "LTE Reset" "502"
+       ucidef_add_gpio_switch "lte_disable" "LTE Airplane Mode" "394"
+       ucidef_add_gpio_switch "lte_power" "LTE Power" "395"
+       ;;
+esac
+
+board_config_flush
+
+exit 0
diff --git a/target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth b/target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth
new file mode 100644 (file)
index 0000000..c4feec4
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+reorder_layerscape_interfaces() {
+       if [ ! -f /tmp/sysinfo/board_name ]; then
+               echo "No board name found, not doing reorder_layerscape_interfaces"
+               return 0
+       fi
+
+       board=$(cat /tmp/sysinfo/board_name)
+       case "$board" in
+       "traverse,ls1043v" | \
+       "traverse,ls1043s")
+
+               # Reorder ethernet interfaces to match the physical order
+               ip link set eth2 name fm1-mac3
+               ip link set eth4 name eth2
+               ip link set eth3 name fm1-mac4
+               ip link set eth5 name eth3
+               ip link set fm1-mac3 name eth4
+               ip link set fm1-mac4 name eth5
+               ;;
+       default)
+               echo "Unknown board $board"
+               ;;
+       esac
+}
+
+boot_hook_add preinit_main reorder_layerscape_interfaces
diff --git a/target/linux/layerscape/base-files/lib/upgrade/platform.sh b/target/linux/layerscape/base-files/lib/upgrade/platform.sh
new file mode 100644 (file)
index 0000000..9cc960a
--- /dev/null
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# Copyright 2015-2018 Traverse Technologies
+#
+platform_do_upgrade_traverse_nandubi() {
+       bootsys=$(fw_printenv bootsys | awk -F= '{{print $2}}')
+       newbootsys=2
+       if [ "$bootsys" -eq "2" ]; then
+               newbootsys=1
+       fi
+       mkdir -p /tmp/image
+       cd /tmp/image
+       get_image "$1" > image.tar
+       ls -la image.tar
+       files=$(tar -tf image.tar)
+       echo "Files in image:"
+       echo $files
+       for f in $files
+       do
+               part_name=$(echo $f | awk -F '/' '{{print $2}}')
+               if [ -z "$part_name" ] || [ "$part_name" = "CONTROL" ]; then
+                       continue
+               fi
+
+               [ "$part_name" = "root" ] && part_name="rootfs"
+
+               volume=$part_name
+               if [ "$part_name" = "kernel" ] || [ "$part_name" = "rootfs" ]; then
+                       volume="${part_name}${newbootsys}"
+               fi
+               volume_id=$(ubinfo -d 0 --name $volume | awk '/Volume ID/ {print $3}')
+               file_size=$(tar -tvf image.tar $f | awk '{{print $3}}')
+               echo "$f size $file_size"
+               tar -xOf image.tar $f | ubiupdatevol -s $file_size /dev/ubi0_$volume_id -
+               
+               echo "$volume upgraded"
+       done
+       fw_setenv bootsys $newbootsys
+       echo "Upgrade complete"
+}
+platform_copy_config() {
+       bootsys=$(fw_printenv bootsys | awk -F= '{{print $2}}')
+       rootvol=rootfs$bootsys
+       volume_id=$(ubinfo -d 0 --name $rootvol | awk '/Volume ID/ {print $3}')
+       mkdir -p /mnt/oldsys
+       mount -t ubifs -o rw,noatime /dev/ubi0_$volume_id /mnt/oldsys
+       cp -af "$CONF_TAR" /mnt/oldsys
+       umount /mnt/oldsys
+}
+platform_check_image() {
+       local board=$(board_name)
+
+       case "$board" in
+       traverse,ls1043v | \
+       traverse,ls1043s | \
+       traverse,five64)
+               local tar_file="$1"
+               local kernel_length=$( (tar xf $tar_file sysupgrade-traverse-five64/kernel -O | wc -c) 2> /dev/null)
+               local rootfs_length=$( (tar xf $tar_file sysupgrade-traverse-five64/root -O | wc -c) 2> /dev/null)
+               [ "$kernel_length" -eq 0 -o "$rootfs_length" -eq 0 ] && {
+                       echo "The upgrade image is corrupt."
+                       return 1
+               }
+               return 0
+               ;;
+       *)
+               echo "Sysupgrade is not currently supported on $board"
+               ;;
+       esac
+
+       return 1
+}
+platform_do_upgrade() {
+       local board=$(board_name)
+
+       case "$board" in
+       traverse,ls1043v | \
+       traverse,ls1043s | \
+       traverse,five64)
+               platform_do_upgrade_traverse_nandubi "$ARGV"
+               ;;
+       *)
+               echo "Sysupgrade is not currently supported on $board"
+               ;;
+       esac
+}
+platform_pre_upgrade() {
+       # Force the creation of fw_printenv.lock
+       mkdir -p /var/lock
+       touch /var/lock/fw_printenv.lock
+       
+       export RAMFS_COPY_BIN="/usr/sbin/fw_printenv /usr/sbin/fw_setenv /usr/sbin/ubinfo /bin/echo ${RAMFS_COPY_BIN}"
+       export RAMFS_COPY_DATA="/etc/fw_env.config /var/lock/fw_printenv.lock ${RAMFS_COPY_DATA}"
+}
diff --git a/target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043s.dts b/target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043s.dts
new file mode 100644 (file)
index 0000000..e2d6bc1
--- /dev/null
@@ -0,0 +1,332 @@
+/*
+ * Device Tree Include file for Traverse LS1043S board.
+ *
+ * Copyright 2014-2015, Freescale Semiconductor
+ * Copyright 2017-2018, Traverse Technologies
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPLv2 or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library 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.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "fsl-ls1043a.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       model = "Traverse LS1043S";
+       compatible = "traverse,ls1043s";
+
+       aliases {
+               crypto = &crypto;
+               ethernet0 = &EMAC0;
+               ethernet1 = &EMAC1;
+               ethernet2 = &EMAC2;
+               ethernet3 = &EMAC3;
+               ethernet4 = &EMAC4;
+               ethernet5 = &EMAC5;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               gpio0 {
+                       label = "ls1043s:green:user0";
+                       gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
+               };
+               gpio1 {
+                       label = "ls1043s:green:user1";
+                       gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>;
+               };
+               /* LED D17 */
+               gpio2 {
+                       label = "ls1043s:green:wan";
+                       gpios = <&gpio1 26 GPIO_ACTIVE_LOW>;
+               };
+               gpio3 {
+                       label = "ls1043s:yellow:wan";
+                       gpios = <&gpio1 27 GPIO_ACTIVE_LOW>;
+               };
+               /* LED D18 */
+               gpio4 {
+                       label = "ls1043s:green:mgmt";
+                       gpios = <&gpio1 28 GPIO_ACTIVE_LOW>;
+               };
+               gpio5 {
+                       label = "ls1043s:yellow:mgmt";
+                       gpios = <&gpio1 29 GPIO_ACTIVE_LOW>;
+               };
+               /* LED D6 */
+               gpio6 {
+                       label = "ls1043s:green:user2";
+                       gpios = <&gpio1 31 GPIO_ACTIVE_HIGH>;
+               };
+
+               /* SFP+ LEDs - these are for chassis
+                * with lightpipes only
+                */
+               teng_act {
+                       label = "ls1043s:yellow:10gact";
+                       gpios = <&gpio4 0 GPIO_ACTIVE_LOW>;
+               };
+
+               teng_link {
+                       label = "ls1043s:green:10glink";
+                       gpios = <&gpio4 1 GPIO_ACTIVE_LOW>;
+               };
+       };
+       
+       gpio-keys-polled {
+               compatible = "gpio-keys-polled";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               poll-interval = <1000>;
+               /* This button may not be loaded on all boards */
+               button@0 {
+                       label = "Front button";
+                       linux,code = <KEY_SETUP>;
+                       gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
+               };
+               /* This is wired to header S3 */
+               button@1 {
+                       label = "Rear button";
+                       linux,code = <KEY_WPS_BUTTON>;
+                       gpios = <&gpio1 30 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&esdhc {
+       mmc-hs200-1_8v;
+       sd-uhs-sdr104;
+       sd-uhs-sdr50;
+       sd-uhs-sdr25;
+       sd-uhs-sdr12;
+};
+
+&i2c0 {
+       status = "okay";
+       rtc@6f {
+               compatible = "intersil,isl1208";
+               reg = <0x6f>;
+       };
+
+       sfp_pca9534: pca9534@24 {
+               compatible = "ti,tca9534", "nxp,pca9534";
+               gpio-controller;
+               #gpio-cells = <2>;
+               reg = <0x24>;
+               gpio-base = <100>;
+       };
+
+       controller@50 {
+               compatible = "traverse,controller";
+               reg = <0x50>;
+       };
+
+       ds125df111@18 {
+               compatible = "ti,ds125df111";
+               reg = <0x18>;
+       };
+
+       emc1704@4c {
+               compatible = "microchip,emc1704";
+               reg = <0x4c>;
+       };
+
+       pac1934@16 {
+               compatible = "microchip,pac1934";
+               reg = <0x16>;
+               /* Monitoring 3.3V, 5V, Vin/12V (voltage only), Vbat/RTC (voltage only) */
+               shunt-resistors = <4000 12000 0 0>;
+       };
+
+       pmic@8 {
+               compatible = "freescale,mc34vr500";
+               reg = <0x08>;
+       };
+};
+
+/* I2C Bus for SFP EEPROM and control
+ * These are multiplexed so
+ * they don't collide when loaded
+ */
+&i2c3 {
+       status = "okay";
+       i2c-switch@70 {
+               compatible = "nxp,pca9540";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0x70>;
+
+               gigsfp_i2c: i2c@0 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0>;
+               };
+               tensfp_i2c: i2c@1 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <1>;
+               };
+       };
+};
+
+&ifc {
+       status = "okay";
+       #address-cells = <2>;
+       #size-cells = <1>;
+       /* Only NAND flash is used on this board */
+       ranges = <0x0 0x0 0x0 0x7e800000 0x00010000>;
+
+       nand@1,0 {
+               compatible = "fsl,ifc-nand";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               reg = <0x0 0x0 0x10000>;
+       };
+};
+
+&duart0 {
+       status = "okay";
+};
+
+&duart1 {
+       status = "okay";
+};
+
+#include "fsl-ls1043-post.dtsi"
+
+&fman0 {
+       EMAC0: ethernet@e0000 {
+               phy-handle = <&qsgmii_phy1>;
+               phy-connection-type = "qsgmii";
+               local-mac-address = [0A 00 00 00 00 01];
+       };
+
+       EMAC1: ethernet@e2000 {
+               phy-handle = <&qsgmii_phy2>;
+               phy-connection-type = "qsgmii";
+               local-mac-address = [0A 00 00 00 00 02];
+       };
+
+       EMAC2: ethernet@e8000 {
+               phy-handle = <&qsgmii_phy3>;
+               phy-connection-type = "qsgmii";
+               local-mac-address = [0A 00 00 00 00 03];
+       };
+
+       EMAC3: ethernet@ea000 {
+               phy-handle = <&qsgmii_phy4>;
+               phy-connection-type = "qsgmii";
+               local-mac-address = [0A 00 00 00 00 04];
+       };
+
+       /* SFP via AR8031
+        * We treat this as a fixed-link as the
+        * AR8031 is hard-configured into
+        * 1000BASE-X mode
+        * Should MII control be desired, remove
+        * fixed-link and add
+        * phy-handle = <&rgmii_phy1>;
+        */
+       EMAC4: ethernet@e4000 {
+               phy-connection-type = "rgmii";
+               local-mac-address = [0A 00 00 00 00 05];
+               fixed-link {
+                       speed = <1000>;
+                       full-duplex;
+               };
+       };
+
+       /* Connection to Expansion (M.2) slot
+        * Future WAN (i.e xDSL) plugin
+        */
+       EMAC5: ethernet@e6000 {
+               phy-connection-type = "rgmii-id";
+               local-mac-address = [00 00 00 00 00 06];
+               fixed-link {
+                       speed = <1000>;
+                       full-duplex;
+               };
+       };
+
+       /* 10G SFP+ interface
+        * This can also run at 1.25 and 2.5G with
+        * the appropriate SerDes protocol setting in RCW
+        */
+       TENSFP: ethernet@f0000 {
+               status = "okay";
+               phy-connection-type = "xgmii";
+               fixed-link {
+                       speed = <10000>;
+                       full-duplex;
+               };
+       };
+
+       mdio@fc000 {
+               rgmii_phy1: ethernet-phy@2 {
+                       reg = <0x2>;
+               };
+               qsgmii_phy1: ethernet-phy@4 {
+                       reg = <0x4>;
+               };
+               qsgmii_phy2: ethernet-phy@5 {
+                       reg = <0x5>;
+               };
+               qsgmii_phy3: ethernet-phy@6 {
+                       reg = <0x6>;
+               };
+               qsgmii_phy4: ethernet-phy@7 {
+                       reg = <0x7>;
+               };
+       };
+};
+
+/* No QUICC engine functions on this board -
+ * pins are used for other functions (GPIO, I2C etc.)
+ */
+&uqe {
+       status = "disabled";
+};
+
+/* LS1043S does not use the QorIQ AHCI
+ * controller.
+ */
+&sata {
+       status = "disabled";
+};
diff --git a/target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043v.dts b/target/linux/layerscape/files/arch/arm64/boot/dts/freescale/traverse-ls1043v.dts
new file mode 100644 (file)
index 0000000..de9aa62
--- /dev/null
@@ -0,0 +1,253 @@
+/*
+ * Device Tree Include file for Traverse LS1043V board.
+ *
+ * Copyright 2014-2015, Freescale Semiconductor
+ * Copyright 2017, Traverse Technologies
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPLv2 or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library 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.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "fsl-ls1043a.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       model = "Traverse LS1043V";
+       compatible = "traverse,ls1043v";
+
+       aliases {
+               crypto = &crypto;
+               ethernet0 = &EMAC0;
+               ethernet1 = &EMAC1;
+               ethernet2 = &EMAC2;
+               ethernet3 = &EMAC3;
+               ethernet4 = &EMAC4;
+               ethernet5 = &EMAC5;
+               pca9555 = &pca9555;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               gpio0 {
+                       label = "ls1043v:green:user0";
+                       gpios = <&pca9555 0 GPIO_ACTIVE_LOW>;
+               };
+               gpio1 {
+                       label = "ls1043v:yellow:user0";
+                       gpios = <&pca9555 1 GPIO_ACTIVE_LOW>;
+               };
+               gpio2 {
+                       label = "ls1043v:green:user1";
+                       gpios = <&pca9555 2 GPIO_ACTIVE_LOW>;
+               };
+               gpio3 {
+                       label = "ls1043v:yellow:user1";
+                       gpios = <&pca9555 3 GPIO_ACTIVE_LOW>;
+               };
+               gpio4 {
+                       label = "ls1043v:green:user2";
+                       gpios = <&pca9555 4 GPIO_ACTIVE_HIGH>;
+               };
+               gpio5 {
+                       label = "ls1043v:yellow:wlan";
+                       gpios = <&pca9555 5 GPIO_ACTIVE_HIGH>;
+               };
+               gpio6 {
+                       label = "ls1043v:yellow:wan";
+                       gpios = <&pca9555 6 GPIO_ACTIVE_HIGH>;
+               };
+       };
+       
+       gpio-keys-polled {
+               compatible = "gpio-keys-polled";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               poll-interval = <1000>;
+               button@0 {
+                       label = "Front button";
+                       linux,code = <KEY_SETUP>;
+                       gpios = <&pca9555 14 GPIO_ACTIVE_LOW>;
+               };
+               button@1 {
+                       label = "Rear button";
+                       linux,code = <KEY_WPS_BUTTON>;
+                       gpios = <&pca9555 15 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&i2c0 {
+       status = "okay";
+       rtc@6f {
+               compatible = "intersil,isl1208";
+               reg = <0x6f>;
+       };
+
+       pca9555: pca9555@20 {
+               compatible = "nxp,pca9555";
+               gpio-controller;
+               #gpio-cells = <2>;
+               reg = <0x20>;
+               gpio-base = <0>;
+       };
+
+       /* CPU core temp sensor and VDD (1.0V) sensor */
+       ltc2990@4c {
+               compatible = "lltc,ltc2990";
+               reg = <0x4C>;
+               lltc,meas-mode = <4 3>;
+       };
+
+       /* 3.3V and 5V monitor (may not be loaded on some SKUs) */
+       ltc2990@4f {
+               compatible = "lltc,ltc2990";
+               reg = <0x4F>;
+               lltc,meas-mode = <6 3>;
+       };
+};
+
+&ifc {
+       status = "okay";
+       #address-cells = <2>;
+       #size-cells = <1>;
+       /* Only NAND flash is used on this board */
+       ranges = <0x0 0x0 0x0 0x7e800000 0x00010000>;
+
+       nand@1,0 {
+               compatible = "fsl,ifc-nand";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               reg = <0x0 0x0 0x10000>;
+       };
+};
+
+&duart0 {
+       status = "okay";
+};
+
+&duart1 {
+       status = "okay";
+};
+
+#include "fsl-ls1043-post.dtsi"
+
+&fman0 {
+       EMAC0: ethernet@e0000 {
+               phy-handle = <&qsgmii_phy1>;
+               phy-connection-type = "qsgmii";
+               local-mac-address = [0A 00 00 00 00 01];
+       };
+
+       EMAC1: ethernet@e2000 {
+               phy-handle = <&qsgmii_phy2>;
+               phy-connection-type = "qsgmii";
+               local-mac-address = [0A 00 00 00 00 02];
+       };
+
+       EMAC2: ethernet@e8000 {
+               phy-handle = <&qsgmii_phy3>;
+               phy-connection-type = "qsgmii";
+               local-mac-address = [0A 00 00 00 00 03];
+       };
+
+       EMAC3: ethernet@ea000 {
+               phy-handle = <&qsgmii_phy4>;
+               phy-connection-type = "qsgmii";
+               local-mac-address = [0A 00 00 00 00 04];
+       };
+       EMAC4: ethernet@e4000 {
+               phy-handle = <&rgmii_phy1>;
+               phy-connection-type = "rgmii";
+               local-mac-address = [0A 00 00 00 00 05];
+       };
+
+       /* Connection to VDSL SoC */
+       EMAC5: ethernet@e6000 {
+               phy-connection-type = "rgmii-id";
+               local-mac-address = [00 00 00 00 00 06];
+               fixed-link {
+                       speed = <1000>;
+                       full-duplex;
+               };
+       };
+
+       /* 10G XFI interface - not in use on this platform */
+       TENSFP: ethernet@f0000 {
+               status = "disabled";
+
+               phy-connection-type = "sgmii";
+               fixed-link {
+                       /* NB: speed = 1000 and sgmii allows forward compatibility
+                       *  with both 1G and 10G, the same is not true
+                       *  in the reverse.
+                       */
+                       speed = <1000>;
+                       full-duplex;
+               };
+       };
+
+       mdio@fc000 {
+               rgmii_phy1: ethernet-phy@3 {
+                       reg = <0x3>;
+               };
+               qsgmii_phy1: ethernet-phy@4 {
+                       reg = <0x4>;
+               };
+               qsgmii_phy2: ethernet-phy@5 {
+                       reg = <0x5>;
+               };
+               qsgmii_phy3: ethernet-phy@6 {
+                       reg = <0x6>;
+               };
+               qsgmii_phy4: ethernet-phy@7 {
+                       reg = <0x7>;
+               };
+       };
+};
+
+/* No QUICC engine functions on this board */
+&uqe {
+       status = "disabled";
+};
+
+/* No SATA/AHCI on this board */
+&sata {
+       status = "disabled";
+};
index fc76ddd2ef745fcf37342b5d12644a1cae27f305..8e1e847f592d02b8afc359da8673c3115d6b0871 100644 (file)
@@ -7,6 +7,8 @@
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/image.mk
 
+ITB_BOARDS = traverse-five64
+
 define Build/append-ls-rcw
        rm -f $@
        dd if=$(STAGING_DIR_IMAGE)/$(1)-rcw.bin >> $@
@@ -45,6 +47,16 @@ define Build/append-ls-dtb
        dd if=$(DTS_DIR)/$(1).dtb >> $@
 endef
 
+define Build/traverse-fit
+       ./mkits-multiple-config.sh -o $@.its -A $(LINUX_KARCH) -v $(LINUX_VERSION) \
+               -k $@ -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
+               -C gzip -c 1 -c 2 \
+               -d $(DEVICE_DTS_DIR)/freescale/traverse-ls1043s.dtb -D "Traverse_LS1043S" -n "ls1043s" -a $(FDT_LOADADDR) -c 1 \
+               -d $(DEVICE_DTS_DIR)/freescale/traverse-ls1043v.dtb -D "Traverse_LS1043V" -n "ls1043v" -a $(FDT_LOADADDR) -c 2
+       PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
+       @mv -f $@.new $@
+endef
+
 define Device/Default
   PROFILES = Default
   FILESYSTEMS := squashfs
@@ -62,6 +74,7 @@ ifeq ($(SUBTARGET),armv8_32b)
   KERNEL_LOADADDR = 0x80008000
   KERNEL_ENTRY_POINT = 0x80008000
 endif
+  FDT_LOADADDR = 0x90000000
 endef
 
 define Device/ls1043ardb
@@ -182,4 +195,28 @@ endef
 TARGET_DEVICES += ls2088ardb
 endif
 
+define Device/traverse-five64
+  KERNEL_NAME := Image
+  KERNEL_SUFFIX := -kernel.itb
+  KERNEL_INSTALL := 1
+  FILESYSTEMS := ubifs
+  DEVICE_TITLE := Traverse LS1043 Boards (Five64, LS1043S)
+  DEVICE_PACKAGES += fman-layerscape-ls1043ardb kmod-i2c-core kmod-rtc-isl1208 uboot-envtools \
+       uboot-traverse-ls1043v uboot-traverse-ls1043v-sdcard \
+       kmod-hwmon-core kmod-hwmon-ltc2990 kmod-gpio-pca953x kmod-input-gpio-keys-polled \
+       kmod-i2c-mux-pca954x kmod-hwmon-pac1934 kmod-hwmon-emc17xx
+  DEVICE_DESCRIPTION = Build images for Traverse LS1043 boards. This generates a single image \
+       capable of booting on any of the boards in this family.
+  DEVICE_DTS = freescale/traverse-ls1043s
+  DEVICE_DTS_DIR = $(LINUX_DIR)/arch/arm64/boot/dts
+  DEVICE_DTS_CONFIG = ls1043s
+  KERNEL := kernel-bin | gzip | traverse-fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb $$(FDT_LOADADDR)
+  KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb $$(FDT_LOADADDR)
+  IMAGES = root sysupgrade.tar
+  IMAGE/root = append-rootfs
+  IMAGE/sysupgrade.tar = sysupgrade-tar
+  UBIFS_OPTS := -m 2048 -e 124KiB -c 4096
+endef
+TARGET_DEVICES += traverse-five64
+
 $(eval $(call BuildImage))
diff --git a/target/linux/layerscape/patches-4.9/304-dts-layerscape-add-traverse-ls1043.patch b/target/linux/layerscape/patches-4.9/304-dts-layerscape-add-traverse-ls1043.patch
new file mode 100644 (file)
index 0000000..6c1c28f
--- /dev/null
@@ -0,0 +1,89 @@
+From c0612164b379ebc8964da6bc6f6ced9736dce488 Mon Sep 17 00:00:00 2001
+From: Mathew McBride <matt@traverse.com.au>
+Date: Tue, 17 Apr 2018 10:01:03 +1000
+Subject: [PATCH] add DTS for Traverse LS1043 Boards
+
+Signed-off-by: Mathew McBride <matt@traverse.com.au>
+---
+ arch/arm64/boot/dts/freescale/Makefile |    5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+ create mode 100644 arch/arm64/boot/dts/freescale/traverse-ls1043v.dts
+
+--- a/arch/arm64/boot/dts/freescale/Makefile
++++ b/arch/arm64/boot/dts/freescale/Makefile
+@@ -20,7 +20,10 @@ dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls2
+ dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls2080a-simu.dtb
+ dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls2088a-qds.dtb
+ dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls2088a-rdb.dtb
+- 
++
++dtb-$(CONFIG_ARCH_LAYERSCAPE) += traverse-ls1043v.dtb
++dtb-$(CONFIG_ARCH_LAYERSCAPE) += traverse-ls1043s.dtb
++
+ always                := $(dtb-y)
+ subdir-y      := $(dts-dirs)
+ clean-files   := *.dtb
+--- a/arch/arm64/boot/dts/freescale/traverse-ls1043s.dts
++++ b/arch/arm64/boot/dts/freescale/traverse-ls1043s.dts
+@@ -337,3 +337,29 @@
+ &sata {
+       status = "disabled";
+ };
++
++/* Additions for Layerscape SDK (4.4/4.9) Kernel only
++ * These kernels need additional setup for FMan/QMan DMA shared memory
++ */
++
++&bman_fbpr {
++      compatible = "fsl,bman-fbpr";
++      alloc-ranges = <0 0 0x10000 0>;
++};
++&qman_fqd {
++      compatible = "fsl,qman-fqd";
++      alloc-ranges = <0 0 0x10000 0>;
++};
++&qman_pfdr {
++      compatible = "fsl,qman-pfdr";
++      alloc-ranges = <0 0 0x10000 0>;
++};
++
++&soc {
++#include "qoriq-dpaa-eth.dtsi"
++#include "qoriq-fman3-0-6oh.dtsi"
++};
++
++&fman0 {
++      compatible = "fsl,fman", "simple-bus";
++};
+--- a/arch/arm64/boot/dts/freescale/traverse-ls1043v.dts
++++ b/arch/arm64/boot/dts/freescale/traverse-ls1043v.dts
+@@ -313,3 +313,29 @@
+ &sata {
+        status = "disabled";
+ };
++
++/* Additions for Layerscape SDK (4.4/4.9) Kernel only
++ * These kernels need additional setup for FMan/QMan DMA shared memory
++ */
++
++&bman_fbpr {
++      compatible = "fsl,bman-fbpr";
++      alloc-ranges = <0 0 0x10000 0>;
++};
++&qman_fqd {
++      compatible = "fsl,qman-fqd";
++      alloc-ranges = <0 0 0x10000 0>;
++};
++&qman_pfdr {
++      compatible = "fsl,qman-pfdr";
++      alloc-ranges = <0 0 0x10000 0>;
++};
++
++&soc {
++#include "qoriq-dpaa-eth.dtsi"
++#include "qoriq-fman3-0-6oh.dtsi"
++};
++
++&fman0 {
++      compatible = "fsl,fman", "simple-bus";
++};
index b867b1805a900374fb3f0816ea25d9fe21d9abb4..593bd3e79a99566e251042d563c27b1577cf2a07 100644 (file)
@@ -5,8 +5,8 @@ Subject: [PATCH] Recognize when an RGMII Link is set as fixed (in the device
  tree) and set up the MAC accordingly
 
 ---
- drivers/net/ethernet/freescale/sdk_dpaa/mac.c               |  1 +
.../ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac.c  | 13 +++++++++++++
+ drivers/net/ethernet/freescale/sdk_dpaa/mac.c                      |    1 
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac.c |   13 ++++++++++
  2 files changed, 14 insertions(+)
 
 --- a/drivers/net/ethernet/freescale/sdk_dpaa/mac.c
@@ -43,19 +43,19 @@ Subject: [PATCH] Recognize when an RGMII Link is set as fixed (in the device
  {
      t_Memac     *p_Memac = (t_Memac *)h_Memac;
  
-+      struct mac_device *mac_dev = (struct mac_device *)p_Memac->h_App;
++    struct mac_device *mac_dev = (struct mac_device *)p_Memac->h_App;
 +
      SANITY_CHECK_RETURN_ERROR(p_Memac, E_INVALID_HANDLE);
      SANITY_CHECK_RETURN_ERROR(!p_Memac->p_MemacDriverParam, E_INVALID_STATE);
  
      fman_memac_enable(p_Memac->p_MemMap, (mode & e_COMM_MODE_RX), (mode & e_COMM_MODE_TX));
  
-+      if (ENET_INTERFACE_FROM_MODE(p_Memac->enetMode) == e_ENET_IF_RGMII) {
-+              if (mac_dev->fixed_link) {
-+                      printk("This is a fixed-link, forcing speed %d duplex %d\n",mac_dev->fixed_link->speed,mac_dev->fixed_link->duplex);
-+                      MemacAdjustLink(h_Memac,mac_dev->fixed_link->speed,mac_dev->fixed_link->duplex);
-+              }
++    if (ENET_INTERFACE_FROM_MODE(p_Memac->enetMode) == e_ENET_IF_RGMII) {
++      if (mac_dev->fixed_link) {
++              printk(KERN_INFO "This is a fixed-link, forcing speed %d duplex %d\n",mac_dev->fixed_link->speed,mac_dev->fixed_link->duplex);
++              MemacAdjustLink(h_Memac,mac_dev->fixed_link->speed,mac_dev->fixed_link->duplex);
 +      }
++    }
 +
      return E_OK;
  }
diff --git a/target/linux/layerscape/patches-4.9/821-add-esdhc-vsel-to-ls1043.patch b/target/linux/layerscape/patches-4.9/821-add-esdhc-vsel-to-ls1043.patch
new file mode 100644 (file)
index 0000000..c45c6b4
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/drivers/mmc/host/sdhci-of-esdhc.c
++++ b/drivers/mmc/host/sdhci-of-esdhc.c
+@@ -619,6 +619,7 @@ static void esdhc_reset(struct sdhci_hos
+ static const struct of_device_id scfg_device_ids[] = {
+       { .compatible = "fsl,t1040-scfg", },
+       { .compatible = "fsl,ls1012a-scfg", },
++      { .compatible = "fsl,ls1043a-scfg", },
+       { .compatible = "fsl,ls1046a-scfg", },
+       {}
+ };