diff options
author | David Bauer <mail@david-bauer.net> | 2019-01-17 00:43:13 +0100 |
---|---|---|
committer | Christian Lamparter <chunkeey@gmail.com> | 2019-01-26 17:10:19 +0100 |
commit | b368373fab45f31963cd2bc1c6ab90e0a577e611 (patch) | |
tree | f2685991617a235bd9a7a2af0a84076e7927b82f | |
parent | 90bfbed7c2b2977776154010459cecb03b239ec0 (diff) | |
download | upstream-b368373fab45f31963cd2bc1c6ab90e0a577e611.tar.gz upstream-b368373fab45f31963cd2bc1c6ab90e0a577e611.tar.bz2 upstream-b368373fab45f31963cd2bc1c6ab90e0a577e611.zip |
mpc85xx: add support for OCEDO Panda
CPU: FSL P1020 (2x 800MHz E500 PPC)
RAM: 1GB DDR3
FLASH: 256MiB NAND
WiFi: 2x Atheros AR9382 2x2:2 abgn
ETH: 2x BCM54616S - 1x BCM53128 8-port switch
LED: 5x LEDs (Power, WiFi1, WiFi2, N/D, SYS)
BTN: 1x RESET
Installation
------------
1. Download initrams kernel image, dtb binary and sysupgrade image.
2. Place initramfs kernel into tftp root directory. Rename to
"panda-uimage-factory".
3. Place dtb binary into tftp root directory. Rename to "panda.fdt".
4. Start tftp server on 192.168.100.8/24.
5. Power up the device with the reset button pressed. It will download
the initrams and dtb via tftp and boot into OpenWRT in RAM.
6. SSH into the device and remove the factory partitions.
> ubirmvol /dev/ubi0 --name=kernel1
> ubirmvol /dev/ubi0 --name=rootfs1
> ubirmvol /dev/ubi0 --name=devicetree1
You will have around 60 MiB of free space with that.
You can also delete "kernel2", "devicetree2", "rootfs2" and "storage"
respectively in case you do not want to go back to the vendor firmware.
7. Modify the U-Boot bootcmd to allow for booting OpenWRT
> fw_setenv bootcmd_owrt "ubi part ubi && ubi read 0x1000000 kernel
&& bootm 0x1000000"
> fw_setenv bootargs_owrt "setenv bootargs console=ttyS0,115200
ubi.mtd=3,2048"
> fw_setenv bootcmd "run bootargs_owrt; run bootcmd_owrt"
8. Transfer the sysupgrade image via scp into the /tmp directory.
9. Upgrade the device
> sysupgrade -n /tmp/<imagename>
Signed-off-by: David Bauer <mail@david-bauer.net>
12 files changed, 494 insertions, 0 deletions
diff --git a/package/boot/uboot-envtools/files/mpc85xx b/package/boot/uboot-envtools/files/mpc85xx new file mode 100644 index 0000000000..d219b57cb1 --- /dev/null +++ b/package/boot/uboot-envtools/files/mpc85xx @@ -0,0 +1,22 @@ +#!/bin/sh + +[ -e /etc/config/ubootenv ] && exit 0 + +touch /etc/config/ubootenv + +. /lib/uboot-envtools.sh +. /lib/functions.sh + +board=$(board_name) + +case "$board" in +ocedo,panda) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" + ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x20000" + ;; +esac + +config_load ubootenv +config_foreach ubootenv_add_app_config ubootenv + +exit 0 diff --git a/target/linux/mpc85xx/base-files/etc/board.d/02_network b/target/linux/mpc85xx/base-files/etc/board.d/02_network index 19f01a6589..d6b4eebf14 100755 --- a/target/linux/mpc85xx/base-files/etc/board.d/02_network +++ b/target/linux/mpc85xx/base-files/etc/board.d/02_network @@ -13,6 +13,11 @@ case "$board" in aerohive,hiveap-330) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; +ocedo,panda) + ucidef_set_interface_wan "eth1" + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "6:lan" "7:lan" "8u@eth0" + ;; tplink,tl-wdr4900-v1) ucidef_add_switch "switch0" \ "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan" diff --git a/target/linux/mpc85xx/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac b/target/linux/mpc85xx/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac index 3092cebfc9..f153b53c8e 100644 --- a/target/linux/mpc85xx/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac +++ b/target/linux/mpc85xx/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac @@ -12,6 +12,11 @@ PHYNBR=${DEVPATH##*/phy} board=$(board_name) case "$board" in +ocedo,panda) + WMAC=wmac$(($PHYNBR + 1)) + MAC=$(mtd_get_mac_ascii uboot-env0 ${WMAC}) + echo ${MAC} > /sys${DEVPATH}/macaddress + ;; sophos,red-15w-rev1) echo $(mtd_get_mac_ascii u-boot-env ethaddr) > /sys${DEVPATH}/macaddress ;; diff --git a/target/linux/mpc85xx/base-files/lib/upgrade/platform.sh b/target/linux/mpc85xx/base-files/lib/upgrade/platform.sh index 9f49d0ddce..0e9a68ebdf 100755 --- a/target/linux/mpc85xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/mpc85xx/base-files/lib/upgrade/platform.sh @@ -13,6 +13,7 @@ platform_do_upgrade() { local board=$(board_name) case "$board" in + ocedo,panda|\ sophos,red-15w-rev1) nand_do_upgrade "$ARGV" ;; diff --git a/target/linux/mpc85xx/config-4.14 b/target/linux/mpc85xx/config-4.14 index b60133e30e..f057e5c910 100644 --- a/target/linux/mpc85xx/config-4.14 +++ b/target/linux/mpc85xx/config-4.14 @@ -242,6 +242,7 @@ CONFIG_OLD_SIGSUSPEND=y # CONFIG_P1022_RDK is not set # CONFIG_P1023_RDB is not set CONFIG_PAGE_OFFSET=0xc0000000 +# CONFIG_PANDA is not set CONFIG_PCI=y CONFIG_PCIEAER=y CONFIG_PCIEASPM=y diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/panda.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/panda.dts new file mode 100644 index 0000000000..1dcaa7d296 --- /dev/null +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/panda.dts @@ -0,0 +1,264 @@ +// SPDX-License-Identifier: GPL-2.0-or-later or MIT + +/include/ "fsl/p1020si-pre.dtsi" +/ { + model = "OCEDO Panda"; + compatible = "ocedo,panda"; + + aliases { + led-boot = &system_blue; + led-failsafe = &system_blue; + led-running = &system_blue; + led-upgrade = &system_blue; + }; + + chosen { + /* Needed for initramfs */ + bootargs-override = "console=ttyS0,115200 ubi.mtd=3,2048"; + }; + + memory { + device_type = "memory"; + }; + + lbc: localbus@ffe05000 { + reg = <0 0xffe05000 0 0x1000>; + ranges = <0x0 0x0 0x0 0xec000000 0x04000000 + 0x1 0x0 0x0 0xff800000 0x00040000 + 0x2 0x0 0x0 0xffa00000 0x00020000 + 0x3 0x0 0x0 0xffb00000 0x00020000>; + + nand@1,0 { + compatible = "fsl,p1020-fcm-nand", "fsl,elbc-fcm-nand"; + reg = <0x1 0x0 0x40000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0xa0000>; + label = "uboot"; + read-only; + }; + + partition@a0000 { + reg = <0xa0000 0x20000>; + label = "uboot-env0"; + }; + + partition@c0000 { + reg = <0xc0000 0x40000>; + label = "uboot-env1"; + }; + + partition@100000 { + reg = <0x100000 0xff00000>; + label = "ubi"; + }; + }; + }; + }; + + soc: soc@ffe00000 { + ranges = <0x0 0x0 0xffe00000 0x100000>; + + i2c@3000 { + rtc@68 { + compatible = "dallas,ds1339"; + reg = <0x68>; + }; + }; + + gpio0: gpio-controller@fc00 { + }; + + mdio@24000 { + phy0: ethernet-phy@8 { + reg = <0x8>; + }; + + phy1: ethernet-phy@9 { + reg = <0x9>; + }; + + switch0: ethernet-phy@0 { + reg = <0x0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + port@4 { + reg = <4>; + label = "lan5"; + }; + + port@5 { + reg = <5>; + label = "lan6"; + }; + + port@6 { + reg = <6>; + label = "lan7"; + }; + + port@7 { + reg = <7>; + label = "lan8"; + }; + + port@8 { + reg = <8>; + label = "cpu"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; + }; + }; + + mdio@25000 { + tbi_phy0: tbi-phy@11 { + reg = <0x11>; + }; + }; + + mdio@26000 { + tbi_phy1: tbi-phy@11 { + reg = <0x11>; + }; + }; + + enet0: ethernet@b0000 { + phy-connection-type = "rgmii-id"; + phy-handle = <&switch0>; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + + enet1: ethernet@b1000 { + phy-connection-type = "sgmii"; + phy-handle = <&phy0>; + + tbi-handle = <&tbi_phy0>; + }; + + enet2: ethernet@b2000 { + phy-connection-type = "sgmii"; + phy-handle = <&phy1>; + + tbi-handle = <&tbi_phy1>; + }; + + usb@22000 { + phy_type = "ulpi"; + dr_mode = "host"; + }; + + usb@23000 { + status = "disabled"; + }; + }; + + pci0: pcie@ffe09000 { + ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000 + 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>; + reg = <0 0xffe09000 0 0x1000>; + pcie@0 { + ranges = <0x2000000 0x0 0xa0000000 + 0x2000000 0x0 0xa0000000 + 0x0 0x20000000 + + 0x1000000 0x0 0x0 + 0x1000000 0x0 0x0 + 0x0 0x100000>; + }; + }; + + pci1: pcie@ffe0a000 { + reg = <0 0xffe0a000 0 0x1000>; + ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x20000000 + 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>; + pcie@0 { + ranges = <0x2000000 0x0 0x80000000 + 0x2000000 0x0 0x80000000 + 0x0 0x20000000 + + 0x1000000 0x0 0x0 + 0x1000000 0x0 0x0 + 0x0 0x100000>; + }; + }; + + leds { + compatible = "gpio-leds"; + + power { + gpios = <&gpio0 0 0>; + label = "panda:green:power"; + default-state = "on"; + }; + + wlan0 { + gpios = <&gpio0 1 0>; + label = "panda:yellow:wlan0"; + linux,default-trigger = "phy0tpt"; + }; + + wlan1 { + gpios = <&gpio0 2 0>; + label = "panda:red:wlan1"; + linux,default-trigger = "phy1tpt"; + }; + + tbd_orange { + gpios = <&gpio0 3 0>; + label = "panda:orange:tbd"; + }; + + system_blue: system { + gpios = <&gpio0 4 0>; + label = "panda:blue:system"; + }; + }; + + buttons { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + gpios = <&gpio0 6 1>; + linux,code = <0x198>; + }; + }; +}; +/include/ "fsl/p1020si-post.dtsi" diff --git a/target/linux/mpc85xx/files/arch/powerpc/platforms/85xx/panda.c b/target/linux/mpc85xx/files/arch/powerpc/platforms/85xx/panda.c new file mode 100644 index 0000000000..9f17f20ffc --- /dev/null +++ b/target/linux/mpc85xx/files/arch/powerpc/platforms/85xx/panda.c @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/* + * OCEDO Panda Board Setup + * + * Copyright (C) 2019 David Bauer <mail@david-bauer.net> + * + * Based on: + * mpc85xx_rdb.c: + * MPC85xx RDB Board Setup + * Copyright 2013 Freescale Semiconductor Inc. + * + * This program 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. + */ + +#include <linux/stddef.h> +#include <linux/kernel.h> +#include <linux/delay.h> +#include <linux/interrupt.h> +#include <linux/of_platform.h> + +#include <asm/time.h> +#include <asm/machdep.h> +#include <asm/pci-bridge.h> +#include <mm/mmu_decl.h> +#include <asm/prom.h> +#include <asm/udbg.h> +#include <asm/mpic.h> + +#include <sysdev/fsl_soc.h> +#include <sysdev/fsl_pci.h> +#include "smp.h" + +#include "mpc85xx.h" + +void __init panda_pic_init(void) +{ + struct mpic *mpic; + + mpic = mpic_alloc(NULL, 0, + MPIC_BIG_ENDIAN | + MPIC_SINGLE_DEST_CPU, + 0, 256, " OpenPIC "); + + BUG_ON(mpic == NULL); + mpic_init(mpic); +} + +/* + * Setup the architecture + */ +static void __init panda_setup_arch(void) +{ + if (ppc_md.progress) + ppc_md.progress("panda_setup_arch()", 0); + + mpc85xx_smp_init(); + + fsl_pci_assign_primary(); + + pr_info("Panda board from OCEDO\n"); +} + +machine_arch_initcall(panda, mpc85xx_common_publish_devices); + +/* + * Called very early, device-tree isn't unflattened + */ +static int __init panda_probe(void) +{ + if (of_machine_is_compatible("ocedo,panda")) + return 1; + return 0; +} + +define_machine(panda) { + .name = "P1020 RDB", + .probe = panda_probe, + .setup_arch = panda_setup_arch, + .init_IRQ = panda_pic_init, +#ifdef CONFIG_PCI + .pcibios_fixup_bus = fsl_pcibios_fixup_bus, + .pcibios_fixup_phb = fsl_pcibios_fixup_phb, +#endif + .get_irq = mpic_get_irq, + .calibrate_decr = generic_calibrate_decr, + .progress = udbg_progress, +}; diff --git a/target/linux/mpc85xx/image/Makefile b/target/linux/mpc85xx/image/Makefile index e803cabcbe..57f1fba499 100644 --- a/target/linux/mpc85xx/image/Makefile +++ b/target/linux/mpc85xx/image/Makefile @@ -90,6 +90,20 @@ define Device/hiveap-330 endef TARGET_DEVICES += hiveap-330 +define Device/panda + DEVICE_TITLE := OCEDO Panda + DEVICE_PACKAGES := kmod-rtc-ds1307 kmod-usb2 uboot-envtools + KERNEL = kernel-bin | gzip | fit gzip $(KDIR)/image-$$(DEVICE_DTS).dtb + PAGESIZE := 2048 + SUBPAGESIZE := 512 + BLOCKSIZE := 128k + SUPPORTED_DEVICES := ocedo,panda + IMAGES := fdt.bin sysupgrade.bin + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE/fdt.bin := append-dtb +endef +TARGET_DEVICES += panda + endif ifeq ($(SUBTARGET),p2020) diff --git a/target/linux/mpc85xx/p1020/config-default b/target/linux/mpc85xx/p1020/config-default index fd9433b59a..01c18e4d59 100644 --- a/target/linux/mpc85xx/p1020/config-default +++ b/target/linux/mpc85xx/p1020/config-default @@ -1,13 +1,16 @@ CONFIG_ARCH_HAS_TICK_BROADCAST=y CONFIG_AT803X_PHY=y +CONFIG_BROADCOM_PHY=y CONFIG_CMDLINE_OVERRIDE=y CONFIG_CPU_RMAP=y CONFIG_EEPROM_LEGACY=y +# CONFIG_FSL_CORENET_CF is not set CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_TBSYNC=y # CONFIG_GPIO_MAX77620 is not set CONFIG_HAVE_RCU_TABLE_FREE=y CONFIG_HIVEAP_330=y +CONFIG_PANDA=y CONFIG_I2C_CHARDEV=y CONFIG_LEDS_LP5521=y CONFIG_LEDS_LP55XX_COMMON=y @@ -16,7 +19,16 @@ CONFIG_LOCK_SPIN_ON_OWNER=y CONFIG_MFD_CORE=y CONFIG_MFD_MAX77620=y CONFIG_MTD_CFI=y +CONFIG_MTD_NAND=y +CONFIG_MTD_NAND_ECC=y +CONFIG_MTD_NAND_FSL_ELBC=y CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_BEB_LIMIT=20 +CONFIG_MTD_UBI_BLOCK=y +# CONFIG_MTD_UBI_FASTMAP is not set +# CONFIG_MTD_UBI_GLUEBI is not set +CONFIG_MTD_UBI_WL_THRESHOLD=4096 CONFIG_MUTEX_SPIN_ON_OWNER=y CONFIG_NET_FLOW_LIMIT=y CONFIG_NR_CPUS=2 @@ -28,5 +40,15 @@ CONFIG_RPS=y # CONFIG_RTC_DRV_MAX77686 is not set CONFIG_RWSEM_SPIN_ON_OWNER=y CONFIG_SMP=y +CONFIG_SWCONFIG_B53=y +# CONFIG_SWCONFIG_B53_MMAP_DRIVER is not set +CONFIG_SWCONFIG_B53_PHY_DRIVER=y +# CONFIG_SWCONFIG_B53_PHY_FIXUP is not set +# CONFIG_SWCONFIG_B53_SPI_DRIVER is not set +# CONFIG_SWCONFIG_B53_SRAB_DRIVER is not set CONFIG_TREE_RCU=y +CONFIG_UBIFS_FS=y +CONFIG_UBIFS_FS_ADVANCED_COMPR=y +CONFIG_UBIFS_FS_LZO=y +CONFIG_UBIFS_FS_ZLIB=y CONFIG_XPS=y diff --git a/target/linux/mpc85xx/p1020/target.mk b/target/linux/mpc85xx/p1020/target.mk index 000fc64644..a25409eebb 100644 --- a/target/linux/mpc85xx/p1020/target.mk +++ b/target/linux/mpc85xx/p1020/target.mk @@ -1,4 +1,5 @@ BOARDNAME:=P1020 +FEATURES+=nand define Target/Description Build firmware images for Freescale P1020 based boards. diff --git a/target/linux/mpc85xx/patches-4.14/106-powerpc-85xx-panda-support.patch b/target/linux/mpc85xx/patches-4.14/106-powerpc-85xx-panda-support.patch new file mode 100644 index 0000000000..5844b80f42 --- /dev/null +++ b/target/linux/mpc85xx/patches-4.14/106-powerpc-85xx-panda-support.patch @@ -0,0 +1,34 @@ +Index: linux-4.14.82/arch/powerpc/platforms/85xx/Kconfig +=================================================================== +--- linux-4.14.82.orig/arch/powerpc/platforms/85xx/Kconfig ++++ linux-4.14.82/arch/powerpc/platforms/85xx/Kconfig +@@ -60,6 +60,17 @@ config HIVEAP_330 + This board is a Concurrent Dual-Band wireless access point with a + Freescale P1020 SoC. + ++config PANDA ++ bool "OCEDO PANDA" ++ select DEFAULT_UIMAGE ++ select ARCH_REQUIRE_GPIOLIB ++ select GPIO_MPC8XXX ++ help ++ This option enables support for the OCEDO PANDA board. ++ ++ This board is a Concurrent Dual-Band wireless access point with a ++ Freescale P1020 SoC. ++ + config MPC8540_ADS + bool "Freescale MPC8540 ADS" + select DEFAULT_UIMAGE +Index: linux-4.14.82/arch/powerpc/platforms/85xx/Makefile +=================================================================== +--- linux-4.14.82.orig/arch/powerpc/platforms/85xx/Makefile ++++ linux-4.14.82/arch/powerpc/platforms/85xx/Makefile +@@ -22,6 +22,7 @@ obj-$(CONFIG_P1010_RDB) += p1010rdb.o + obj-$(CONFIG_P1022_DS) += p1022_ds.o + obj-$(CONFIG_P1022_RDK) += p1022_rdk.o + obj-$(CONFIG_P1023_RDB) += p1023_rdb.o ++obj-$(CONFIG_PANDA) += panda.o + obj-$(CONFIG_TWR_P102x) += twr_p102x.o + obj-$(CONFIG_CORENET_GENERIC) += corenet_generic.o + obj-$(CONFIG_FB_FSL_DIU) += t1042rdb_diu.o diff --git a/target/linux/mpc85xx/patches-4.19/105-powerpc-85xx-panda-support.patch b/target/linux/mpc85xx/patches-4.19/105-powerpc-85xx-panda-support.patch new file mode 100644 index 0000000000..5844b80f42 --- /dev/null +++ b/target/linux/mpc85xx/patches-4.19/105-powerpc-85xx-panda-support.patch @@ -0,0 +1,34 @@ +Index: linux-4.14.82/arch/powerpc/platforms/85xx/Kconfig +=================================================================== +--- linux-4.14.82.orig/arch/powerpc/platforms/85xx/Kconfig ++++ linux-4.14.82/arch/powerpc/platforms/85xx/Kconfig +@@ -60,6 +60,17 @@ config HIVEAP_330 + This board is a Concurrent Dual-Band wireless access point with a + Freescale P1020 SoC. + ++config PANDA ++ bool "OCEDO PANDA" ++ select DEFAULT_UIMAGE ++ select ARCH_REQUIRE_GPIOLIB ++ select GPIO_MPC8XXX ++ help ++ This option enables support for the OCEDO PANDA board. ++ ++ This board is a Concurrent Dual-Band wireless access point with a ++ Freescale P1020 SoC. ++ + config MPC8540_ADS + bool "Freescale MPC8540 ADS" + select DEFAULT_UIMAGE +Index: linux-4.14.82/arch/powerpc/platforms/85xx/Makefile +=================================================================== +--- linux-4.14.82.orig/arch/powerpc/platforms/85xx/Makefile ++++ linux-4.14.82/arch/powerpc/platforms/85xx/Makefile +@@ -22,6 +22,7 @@ obj-$(CONFIG_P1010_RDB) += p1010rdb.o + obj-$(CONFIG_P1022_DS) += p1022_ds.o + obj-$(CONFIG_P1022_RDK) += p1022_rdk.o + obj-$(CONFIG_P1023_RDB) += p1023_rdb.o ++obj-$(CONFIG_PANDA) += panda.o + obj-$(CONFIG_TWR_P102x) += twr_p102x.o + obj-$(CONFIG_CORENET_GENERIC) += corenet_generic.o + obj-$(CONFIG_FB_FSL_DIU) += t1042rdb_diu.o |