From 75ca3357cfdbf01ad90bac567239c8b4e45ffe12 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 15 Oct 2019 23:22:31 +0200 Subject: [PATCH] mpc85xx: add support for HP MSM 460 --- .../mpc85xx/base-files/etc/board.d/02_network | 3 + target/linux/mpc85xx/config-5.4 | 1 + .../files/arch/powerpc/boot/dts/msm460.dts | 156 ++++++++++++++++++ .../arch/powerpc/platforms/85xx/msm460.c | 91 ++++++++++ target/linux/mpc85xx/image/p1020.mk | 10 +- target/linux/mpc85xx/p1020/config-default | 1 + target/linux/mpc85xx/p2020/config-default | 1 + .../107-powerpc-85xx-msm460-support.patch | 63 +++++++ 8 files changed, 325 insertions(+), 1 deletion(-) create mode 100644 target/linux/mpc85xx/files/arch/powerpc/boot/dts/msm460.dts create mode 100644 target/linux/mpc85xx/files/arch/powerpc/platforms/85xx/msm460.c create mode 100644 target/linux/mpc85xx/patches-5.4/107-powerpc-85xx-msm460-support.patch 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 aa33a4af96..407db24d03 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,9 @@ case "$board" in aerohive,hiveap-330) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; +hp,msm460) + ucidef_set_interfaces_lan "eth0" + ;; ocedo,panda) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ diff --git a/target/linux/mpc85xx/config-5.4 b/target/linux/mpc85xx/config-5.4 index 8e01def3f9..95bff28943 100644 --- a/target/linux/mpc85xx/config-5.4 +++ b/target/linux/mpc85xx/config-5.4 @@ -193,6 +193,7 @@ CONFIG_MPIC=y # CONFIG_MPIC_MSGR is not set CONFIG_MPIC_TIMER=y CONFIG_MPILIB=y +# CONFIG_MSM460 is not set # CONFIG_MTD_CFI is not set CONFIG_MTD_M25P80=y CONFIG_MTD_RAW_NAND=y diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/msm460.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/msm460.dts new file mode 100644 index 0000000000..23608a90c5 --- /dev/null +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/msm460.dts @@ -0,0 +1,156 @@ +// SPDX-License-Identifier: GPL-2.0-or-later or MIT + +/include/ "fsl/p1020si-pre.dtsi" +/ { + model = "Hewlett-Packard MSM460"; + compatible = "hp,msm460"; + + chosen { + /* Needed for initramfs */ + bootargs = "console=ttyS0,9600"; + bootargs-override = "console=ttyS0,9600"; + }; + + 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>; + + gpio0: gpio-controller@fc00 { + }; + + mdio@24000 { + phy0: ethernet-phy@0 { + reg = <0x0>; + }; + }; + + mdio@25000 { + status = "disabled"; + }; + + mdio@26000 { + status = "disabled"; + }; + + enet0: ethernet@b0000 { + phy-connection-type = "rgmii"; + phy-handle = <&phy0>; + }; + + enet1: ethernet@b1000 { + status = "disabled"; + }; + + enet2: ethernet@b2000 { + status = "disabled"; + }; + + usb@22000 { + status = "disabled"; + }; + + 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 = "msm460:green:power"; + }; + + wlan0 { + gpios = <&gpio0 1 0>; + label = "msm460:green:ethernet"; + }; + + wlan1 { + gpios = <&gpio0 2 0>; + label = "msm460:green:radio0"; + }; + + tbd_orange { + gpios = <&gpio0 3 0>; + label = "msm460:green:radio1"; + }; + }; + */ +}; +/include/ "fsl/p1020si-post.dtsi" diff --git a/target/linux/mpc85xx/files/arch/powerpc/platforms/85xx/msm460.c b/target/linux/mpc85xx/files/arch/powerpc/platforms/85xx/msm460.c new file mode 100644 index 0000000000..207ceaa986 --- /dev/null +++ b/target/linux/mpc85xx/files/arch/powerpc/platforms/85xx/msm460.c @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/* + * Hewlett-Packard MSM460 Board Setup + * + * Copyright (C) 2019 David Bauer + * + * 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 +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "smp.h" + +#include "mpc85xx.h" + +void __init msm460_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 msm460_setup_arch(void) +{ + if (ppc_md.progress) + ppc_md.progress("msm460_setup_arch()", 0); + + mpc85xx_smp_init(); + + fsl_pci_assign_primary(); + + pr_info("MSM460 board from Hewlett-Packard\n"); +} + +machine_arch_initcall(msm460, mpc85xx_common_publish_devices); + +/* + * Called very early, device-tree isn't unflattened + */ +static int __init msm460_probe(void) +{ + if (of_machine_is_compatible("hp,msm460")) + return 1; + return 0; +} + +define_machine(msm460) { + .name = "P1020 RDB", + .probe = msm460_probe, + .setup_arch = msm460_setup_arch, + .init_IRQ = msm460_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/p1020.mk b/target/linux/mpc85xx/image/p1020.mk index a127723e89..2ffaaf2eb1 100644 --- a/target/linux/mpc85xx/image/p1020.mk +++ b/target/linux/mpc85xx/image/p1020.mk @@ -25,6 +25,15 @@ define Device/enterasys_ws-ap3710i endef TARGET_DEVICES += enterasys_ws-ap3710i +define Device/hp_msm460 + DEVICE_VENDOR := Hewlett-Packard + DEVICE_MODEL := MSM460 + KERNEL = kernel-bin | gzip | fit gzip $(KDIR)/image-$$(DEVICE_DTS).dtb + IMAGES := sysupgrade.bin + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += hp_msm460 + define Device/ocedo_panda DEVICE_VENDOR := OCEDO DEVICE_MODEL := Panda @@ -38,4 +47,3 @@ define Device/ocedo_panda IMAGE/fdt.bin := append-dtb endef TARGET_DEVICES += ocedo_panda - diff --git a/target/linux/mpc85xx/p1020/config-default b/target/linux/mpc85xx/p1020/config-default index c4c102ca45..a83abc1c8d 100644 --- a/target/linux/mpc85xx/p1020/config-default +++ b/target/linux/mpc85xx/p1020/config-default @@ -18,6 +18,7 @@ CONFIG_LOCK_SPIN_ON_OWNER=y # CONFIG_MAX77620_WATCHDOG is not set CONFIG_MFD_CORE=y CONFIG_MFD_MAX77620=y +CONFIG_MSM460=y CONFIG_MTD_CFI=y CONFIG_MTD_NAND_FSL_ELBC=y CONFIG_MTD_PHYSMAP=y diff --git a/target/linux/mpc85xx/p2020/config-default b/target/linux/mpc85xx/p2020/config-default index be75f36814..fd31130727 100644 --- a/target/linux/mpc85xx/p2020/config-default +++ b/target/linux/mpc85xx/p2020/config-default @@ -6,6 +6,7 @@ CONFIG_GENERIC_TBSYNC=y CONFIG_HAVE_RCU_TABLE_FREE=y CONFIG_LOCK_SPIN_ON_OWNER=y CONFIG_MPC85xx_RDB=y +CONFIG_MSM460=y CONFIG_MTD_CFI=y CONFIG_MTD_NAND_BCH=y CONFIG_MTD_NAND_ECC_BCH=y diff --git a/target/linux/mpc85xx/patches-5.4/107-powerpc-85xx-msm460-support.patch b/target/linux/mpc85xx/patches-5.4/107-powerpc-85xx-msm460-support.patch new file mode 100644 index 0000000000..8c704e1a4e --- /dev/null +++ b/target/linux/mpc85xx/patches-5.4/107-powerpc-85xx-msm460-support.patch @@ -0,0 +1,63 @@ +--- a/arch/powerpc/boot/Makefile ++++ b/arch/powerpc/boot/Makefile +@@ -165,6 +165,7 @@ src-plat-$(CONFIG_PPC_POWERNV) += pserie + src-plat-$(CONFIG_PPC_IBM_CELL_BLADE) += pseries-head.S + src-plat-$(CONFIG_MVME7100) += motload-head.S mvme7100.c + src-plat-$(CONFIG_TL_WDR4900_V1) += simpleboot.c fixed-head.S ++src-plat-$(CONFIG_MSM460) += simpleboot.c fixed-head.S + + src-wlib := $(sort $(src-wlib-y)) + src-plat := $(sort $(src-plat-y)) +@@ -345,6 +346,7 @@ image-$(CONFIG_TQM8560) += cuImage.tqm + image-$(CONFIG_SBC8548) += cuImage.sbc8548 + image-$(CONFIG_KSI8560) += cuImage.ksi8560 + image-$(CONFIG_TL_WDR4900_V1) += simpleImage.tl-wdr4900-v1 ++image-$(CONFIG_MSM460) += simpleImage.msm460 + # Board ports in arch/powerpc/platform/86xx/Kconfig + image-$(CONFIG_MVME7100) += dtbImage.mvme7100 + +--- a/arch/powerpc/boot/wrapper ++++ b/arch/powerpc/boot/wrapper +@@ -307,6 +307,11 @@ simpleboot-tl-wdr4900-v1) + link_address='0x1000000' + binary=y + ;; ++simpleboot-msm460) ++ platformo="$object/fixed-head.o $object/simpleboot.o" ++ link_address='0x1000000' ++ binary=y ++ ;; + simpleboot-virtex405-*) + platformo="$object/virtex405-head.o $object/simpleboot.o $object/virtex.o" + binary=y +--- a/arch/powerpc/platforms/85xx/Kconfig ++++ b/arch/powerpc/platforms/85xx/Kconfig +@@ -213,6 +213,18 @@ config STX_GP3 + select CPM2 + select DEFAULT_UIMAGE + ++config MSM460 ++ bool "Hewlett-Packard MSM460" ++ select DEFAULT_UIMAGE ++ select ARCH_REQUIRE_GPIOLIB ++ select GPIO_MPC8XXX ++ select SWIOTLB ++ help ++ This option enables support for the HP MSM460 board. ++ ++ This board is a Concurrent Dual-Band wireless router with a ++ Freescale P1020 SoC. ++ + config TL_WDR4900_V1 + bool "TP-Link TL-WDR4900 v1" + select DEFAULT_UIMAGE +--- a/arch/powerpc/platforms/85xx/Makefile ++++ b/arch/powerpc/platforms/85xx/Makefile +@@ -31,6 +31,7 @@ obj-$(CONFIG_RED_15W_REV1) += red15w_rev + obj-$(CONFIG_STX_GP3) += stx_gp3.o + obj-$(CONFIG_TQM85xx) += tqm85xx.o + obj-$(CONFIG_TL_WDR4900_V1) += tl_wdr4900_v1.o ++obj-$(CONFIG_MSM460) += msm460.o + obj-$(CONFIG_SBC8548) += sbc8548.o + obj-$(CONFIG_PPA8548) += ppa8548.o + obj-$(CONFIG_SOCRATES) += socrates.o socrates_fpga_pic.o -- 2.30.2