[OpenWrt-Devel] [PATCH 1/2] Add support for the apm821xx Device Target
Chris Blake
chrisrblake93 at gmail.com
Sun Apr 3 20:56:26 EDT 2016
This adds a new target for PowerPC APM821xx (464-based) boards, as well
as adds support for the booke-wdt watchdog package.
Signed-off-by: Chris Blake <chrisrblake93 at gmail.com>
---
include/target.mk | 1 +
package/kernel/linux/modules/other.mk | 2 +-
target/linux/apm821xx/Makefile | 29 ++
.../apm821xx/base-files/etc/board.d/02_network | 22 ++
.../lib/preinit/03_preinit_do_apm821xx.sh | 12 +
.../lib/preinit/05_set_preinit_iface_apm821xx | 12 +
target/linux/apm821xx/config-4.4 | 298 +++++++++++++++++++++
target/linux/apm821xx/image/Makefile | 24 ++
.../700-powerpc_ibm_phy_add_ar8035.patch | 41 +++
.../800-ppc4xx-rng-fix-crash-during-init.patch | 117 ++++++++
target/linux/apm821xx/profiles/00-default.mk | 16 ++
11 files changed, 573 insertions(+), 1 deletion(-)
create mode 100644 target/linux/apm821xx/Makefile
create mode 100755 target/linux/apm821xx/base-files/etc/board.d/02_network
create mode 100644 target/linux/apm821xx/base-files/lib/preinit/03_preinit_do_apm821xx.sh
create mode 100644 target/linux/apm821xx/base-files/lib/preinit/05_set_preinit_iface_apm821xx
create mode 100644 target/linux/apm821xx/config-4.4
create mode 100644 target/linux/apm821xx/image/Makefile
create mode 100644 target/linux/apm821xx/patches-4.4/700-powerpc_ibm_phy_add_ar8035.patch
create mode 100644 target/linux/apm821xx/patches-4.4/800-ppc4xx-rng-fix-crash-during-init.patch
create mode 100644 target/linux/apm821xx/profiles/00-default.mk
diff --git a/include/target.mk b/include/target.mk
index 76fbd99..5bdb7bf 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -253,6 +253,7 @@ ifeq ($(DUMP),1)
CPU_CFLAGS_8540:=-mcpu=8540
CPU_CFLAGS_405:=-mcpu=405
CPU_CFLAGS_440:=-mcpu=440
+ CPU_CFLAGS_464fp:=-mcpu=464fp
endif
ifeq ($(ARCH),sparc)
CPU_TYPE = sparc
diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk
index 528d32f..6624353 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -517,7 +517,7 @@ $(eval $(call KernelPackage,wdt-orion))
define KernelPackage/booke-wdt
SUBMENU:=$(OTHER_MENU)
TITLE:=PowerPC Book-E Watchdog Timer
- DEPENDS:=@(TARGET_mpc85xx||TARGET_ppc40x||TARGET_ppc44x)
+ DEPENDS:=@(TARGET_apm821xx||TARGET_mpc85xx||TARGET_ppc40x||TARGET_ppc44x)
KCONFIG:=CONFIG_BOOKE_WDT
FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/booke_wdt.ko
AUTOLOAD:=$(call AutoLoad,50,booke_wdt,1)
diff --git a/target/linux/apm821xx/Makefile b/target/linux/apm821xx/Makefile
new file mode 100644
index 0000000..d48dab0
--- /dev/null
+++ b/target/linux/apm821xx/Makefile
@@ -0,0 +1,29 @@
+#
+# Copyright (C) 2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+ARCH:=powerpc
+BOARD:=apm821xx
+BOARDNAME:=AppliedMicro APM821xx
+CPU_TYPE:=464fp
+FEATURES:=squashfs nand rtc fpu ramdisk
+MAINTAINER:=Imre Kaloz <kaloz at openwrt.org>
+
+KERNEL_PATCHVER:=4.4
+
+include $(INCLUDE_DIR)/target.mk
+
+KERNELNAME:=uImage
+
+DEFAULT_PACKAGES += \
+ kmod-leds-gpio kmod-booke-wdt wpad-mini
+
+define Target/Description
+ Build images for AppliedMicro APM821xx based boards.
+endef
+
+$(eval $(call BuildTarget))
diff --git a/target/linux/apm821xx/base-files/etc/board.d/02_network b/target/linux/apm821xx/base-files/etc/board.d/02_network
new file mode 100755
index 0000000..c7d067b
--- /dev/null
+++ b/target/linux/apm821xx/base-files/etc/board.d/02_network
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Copyright (C) 2016 OpenWrt.org
+#
+
+. /lib/functions/system.sh
+. /lib/functions/uci-defaults.sh
+. /lib/apm821xx.sh
+
+board_config_update
+
+board=$(apm821xx_board_name)
+
+case "$board" in
+*)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ;;
+esac
+
+board_config_flush
+
+exit 0
diff --git a/target/linux/apm821xx/base-files/lib/preinit/03_preinit_do_apm821xx.sh b/target/linux/apm821xx/base-files/lib/preinit/03_preinit_do_apm821xx.sh
new file mode 100644
index 0000000..53ca2f5
--- /dev/null
+++ b/target/linux/apm821xx/base-files/lib/preinit/03_preinit_do_apm821xx.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+# Copyright (C) 2016 OpenWrt.org
+#
+
+do_apm821xx() {
+ . /lib/apm821xx.sh
+
+ apm821xx_board_detect
+}
+
+boot_hook_add preinit_main do_apm821xx
diff --git a/target/linux/apm821xx/base-files/lib/preinit/05_set_preinit_iface_apm821xx b/target/linux/apm821xx/base-files/lib/preinit/05_set_preinit_iface_apm821xx
new file mode 100644
index 0000000..5ccd8b6
--- /dev/null
+++ b/target/linux/apm821xx/base-files/lib/preinit/05_set_preinit_iface_apm821xx
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+# Copyright (C) 2016 OpenWrt.org
+#
+
+. /lib/apm821xx.sh
+
+apm821xx_set_preinit_iface() {
+ ifname=eth0
+}
+
+boot_hook_add preinit_main apm821xx_set_preinit_iface
diff --git a/target/linux/apm821xx/config-4.4 b/target/linux/apm821xx/config-4.4
new file mode 100644
index 0000000..0c1657b
--- /dev/null
+++ b/target/linux/apm821xx/config-4.4
@@ -0,0 +1,298 @@
+# CONFIG_40x is not set
+CONFIG_44x=y
+CONFIG_4xx=y
+CONFIG_4xx_SOC=y
+# CONFIG_ADVANCED_OPTIONS is not set
+# CONFIG_ARCHES is not set
+CONFIG_ARCH_DMA_ADDR_T_64BIT=y
+CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
+CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
+CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK=y
+CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
+CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
+CONFIG_ARCH_HAS_ILOG2_U32=y
+CONFIG_ARCH_HAS_SG_CHAIN=y
+CONFIG_ARCH_HAS_WALK_MEMORY=y
+CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
+CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
+CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
+# CONFIG_ARCH_RANDOM is not set
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
+CONFIG_ARCH_SUPPORTS_UPROBES=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARCH_USE_BUILTIN_BSWAP=y
+CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+CONFIG_AT803X_PHY=y
+CONFIG_AUDIT_ARCH=y
+# CONFIG_BAMBOO is not set
+CONFIG_BCH=y
+# CONFIG_BLUESTONE is not set
+CONFIG_BOOKE=y
+CONFIG_BOUNCE=y
+# CONFIG_CANYONLANDS is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_CLONE_BACKWARDS=y
+CONFIG_CMDLINE="rootfstype=squashfs noinitrd"
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CONSISTENT_SIZE=0x00200000
+CONFIG_CPU_BIG_ENDIAN=y
+CONFIG_CRC16=y
+CONFIG_CRYPTO_DEFLATE=y
+CONFIG_CRYPTO_DEV_PPC4XX=y
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_HW=y
+CONFIG_CRYPTO_LZO=y
+CONFIG_CRYPTO_MD5_PPC=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_SHA1_PPC=y
+CONFIG_CRYPTO_WORKQUEUE=y
+CONFIG_CRYPTO_XZ=y
+CONFIG_DECOMPRESS_GZIP=y
+# CONFIG_DEFAULT_UIMAGE is not set
+CONFIG_DTC=y
+# CONFIG_E200 is not set
+CONFIG_EARLY_PRINTK=y
+# CONFIG_EBONY is not set
+CONFIG_EDAC_ATOMIC_SCRUB=y
+CONFIG_EDAC_SUPPORT=y
+# CONFIG_EIGER is not set
+# CONFIG_EPAPR_BOOT is not set
+CONFIG_EXTRA_TARGETS="uImage"
+# CONFIG_FSL_ULI1575 is not set
+CONFIG_GENERIC_ATOMIC64=y
+CONFIG_GENERIC_BUG=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+# CONFIG_GENERIC_CSUM is not set
+CONFIG_GENERIC_IO=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
+CONFIG_GENERIC_ISA_DMA=y
+CONFIG_GENERIC_MSI_IRQ=y
+CONFIG_GENERIC_NVRAM=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GENERIC_SMP_IDLE_THREAD=y
+CONFIG_GENERIC_STRNCPY_FROM_USER=y
+CONFIG_GENERIC_STRNLEN_USER=y
+# CONFIG_GENERIC_TBSYNC is not set
+CONFIG_GENERIC_TIME_VSYSCALL_OLD=y
+# CONFIG_GEN_RTC is not set
+# CONFIG_GE_FPGA is not set
+# CONFIG_GLACIER is not set
+CONFIG_GPIOLIB=y
+CONFIG_GPIO_DEVRES=y
+CONFIG_HAS_DMA=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT_MAP=y
+# CONFIG_HAS_RAPIDIO is not set
+# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
+CONFIG_HAVE_ARCH_AUDITSYSCALL=y
+# CONFIG_HAVE_ARCH_BITREVERSE is not set
+CONFIG_HAVE_ARCH_JUMP_LABEL=y
+CONFIG_HAVE_ARCH_KGDB=y
+CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
+CONFIG_HAVE_ARCH_TRACEHOOK=y
+# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
+CONFIG_HAVE_BPF_JIT=y
+CONFIG_HAVE_DEBUG_KMEMLEAK=y
+CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
+CONFIG_HAVE_GENERIC_RCU_GUP=y
+CONFIG_HAVE_IDE=y
+CONFIG_HAVE_IOREMAP_PROT=y
+CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
+CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
+CONFIG_HAVE_NET_DSA=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
+CONFIG_HW_RANDOM=y
+CONFIG_HW_RANDOM_PPC4XX=y
+CONFIG_HZ=1000
+# CONFIG_HZ_100 is not set
+CONFIG_HZ_1000=y
+CONFIG_HZ_PERIODIC=y
+CONFIG_IBM_EMAC=y
+CONFIG_IBM_EMAC_POLL_WEIGHT=32
+CONFIG_IBM_EMAC_RXB=128
+CONFIG_IBM_EMAC_RX_COPY_THRESHOLD=256
+CONFIG_IBM_EMAC_RX_SKB_HEADROOM=0
+CONFIG_IBM_EMAC_TXB=128
+# CONFIG_ICON is not set
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_IOMMU_HELPER is not set
+# CONFIG_IPIC is not set
+CONFIG_IRQCHIP=y
+CONFIG_IRQ_DOMAIN=y
+CONFIG_IRQ_FORCED_THREADING=y
+CONFIG_IRQ_WORK=y
+CONFIG_ISA_DMA_API=y
+# CONFIG_KATMAI is not set
+CONFIG_KERNEL_START=0xc0000000
+CONFIG_LIBFDT=y
+CONFIG_LOWMEM_SIZE=0x30000000
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
+# CONFIG_MATH_EMULATION is not set
+CONFIG_MDIO_BOARDINFO=y
+# CONFIG_MMIO_NVRAM is not set
+CONFIG_MODULES_USE_ELF_RELA=y
+# CONFIG_MPIC is not set
+# CONFIG_MPIC_U3_HT_IRQS is not set
+# CONFIG_MPIC_WEIRD is not set
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+# CONFIG_MTD_CFI_GEOMETRY is not set
+CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND_BCH=y
+CONFIG_MTD_NAND_ECC=y
+CONFIG_MTD_NAND_ECC_BCH=y
+CONFIG_MTD_NAND_ECC_SMC=y
+CONFIG_MTD_NAND_NDFC=y
+CONFIG_MTD_SPLIT_FIRMWARE=y
+CONFIG_MTD_SPLIT_UIMAGE_FW=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_NEED_DMA_MAP_STATE=y
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
+CONFIG_NEED_PER_CPU_KM=y
+CONFIG_NEED_SG_DMA_LENGTH=y
+# CONFIG_NONSTATIC_KERNEL is not set
+CONFIG_NOT_COHERENT_CACHE=y
+CONFIG_NO_BOOTMEM=y
+CONFIG_NR_IRQS=512
+CONFIG_OF=y
+CONFIG_OF_ADDRESS=y
+CONFIG_OF_ADDRESS_PCI=y
+CONFIG_OF_EARLY_FLATTREE=y
+CONFIG_OF_FLATTREE=y
+CONFIG_OF_GPIO=y
+CONFIG_OF_IRQ=y
+CONFIG_OF_MDIO=y
+CONFIG_OF_MTD=y
+CONFIG_OF_NET=y
+CONFIG_OF_PCI=y
+CONFIG_OF_PCI_IRQ=y
+CONFIG_OF_RESERVED_MEM=y
+CONFIG_OLD_SIGACTION=y
+CONFIG_OLD_SIGSUSPEND=y
+CONFIG_PAGE_OFFSET=0xc0000000
+CONFIG_PCI=y
+CONFIG_PCIEAER=y
+CONFIG_PCIEPORTBUS=y
+CONFIG_PCI_BUS_ADDR_T_64BIT=y
+CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
+CONFIG_PCI_DOMAINS=y
+CONFIG_PCI_MSI=y
+CONFIG_PGTABLE_LEVELS=2
+CONFIG_PHYLIB=y
+CONFIG_PHYSICAL_START=0x00000000
+CONFIG_PHYS_64BIT=y
+CONFIG_PHYS_ADDR_T_64BIT=y
+CONFIG_PPC=y
+CONFIG_PPC32=y
+CONFIG_PPC44x_SIMPLE=y
+CONFIG_PPC4xx_GPIO=y
+# CONFIG_PPC4xx_HSTA_MSI is not set
+# CONFIG_PPC4xx_MSI is not set
+CONFIG_PPC4xx_OCM=y
+# CONFIG_PPC4xx_PCI_EXPRESS is not set
+# CONFIG_PPC64 is not set
+# CONFIG_PPC_47x is not set
+# CONFIG_PPC_85xx is not set
+# CONFIG_PPC_8xx is not set
+# CONFIG_PPC_970_NAP is not set
+CONFIG_PPC_ADV_DEBUG_DACS=2
+CONFIG_PPC_ADV_DEBUG_DAC_RANGE=y
+CONFIG_PPC_ADV_DEBUG_DVCS=2
+CONFIG_PPC_ADV_DEBUG_IACS=4
+CONFIG_PPC_ADV_DEBUG_REGS=y
+# CONFIG_PPC_BOOK3S_32 is not set
+# CONFIG_PPC_CELL is not set
+# CONFIG_PPC_CELL_NATIVE is not set
+# CONFIG_PPC_COPRO_BASE is not set
+CONFIG_PPC_DCR=y
+# CONFIG_PPC_DCR_MMIO is not set
+CONFIG_PPC_DCR_NATIVE=y
+# CONFIG_PPC_DOORBELL is not set
+# CONFIG_PPC_EARLY_DEBUG is not set
+# CONFIG_PPC_EPAPR_HV_PIC is not set
+# CONFIG_PPC_I8259 is not set
+# CONFIG_PPC_ICP_HV is not set
+# CONFIG_PPC_ICP_NATIVE is not set
+# CONFIG_PPC_ICS_RTAS is not set
+CONFIG_PPC_INDIRECT_PCI=y
+CONFIG_PPC_LIB_RHEAP=y
+CONFIG_PPC_MMU_NOHASH=y
+# CONFIG_PPC_MM_SLICES is not set
+# CONFIG_PPC_MPC106 is not set
+# CONFIG_PPC_P7_NAP is not set
+CONFIG_PPC_PCI_CHOICE=y
+# CONFIG_PPC_RTAS is not set
+CONFIG_PPC_UDBG_16550=y
+CONFIG_PPC_WERROR=y
+# CONFIG_PPC_XICS is not set
+# CONFIG_PQ2ADS is not set
+CONFIG_PTE_64BIT=y
+# CONFIG_RAINIER is not set
+CONFIG_RAS=y
+# CONFIG_RCU_STALL_COMMON is not set
+CONFIG_RD_GZIP=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+# CONFIG_SAM440EP is not set
+CONFIG_SCHED_HRTICK=y
+# CONFIG_SCHED_INFO is not set
+# CONFIG_SCSI_DMA is not set
+# CONFIG_SEQUOIA is not set
+CONFIG_SERIAL_8250_EXTENDED=y
+CONFIG_SERIAL_8250_FSL=y
+CONFIG_SERIAL_8250_SHARE_IRQ=y
+CONFIG_SERIAL_OF_PLATFORM=y
+CONFIG_SIMPLE_GPIO=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_SRCU=y
+# CONFIG_STRICT_MM_TYPECHECKS is not set
+# CONFIG_SWIOTLB is not set
+CONFIG_SYSCTL_EXCEPTION_TRACE=y
+# CONFIG_TAISHAN is not set
+CONFIG_TASK_SIZE=0xc0000000
+CONFIG_TICK_CPU_ACCOUNTING=y
+CONFIG_UBIFS_FS=y
+# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
+CONFIG_UBIFS_FS_LZO=y
+CONFIG_UBIFS_FS_XZ=y
+CONFIG_UBIFS_FS_ZLIB=y
+CONFIG_USB_SUPPORT=y
+CONFIG_VDSO32=y
+# CONFIG_WARP is not set
+CONFIG_WORD_SIZE=32
+# CONFIG_XILINX_SYSACE is not set
+# CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set
+CONFIG_XZ_DEC_BCJ=y
+CONFIG_XZ_DEC_POWERPC=y
+# CONFIG_YOSEMITE is not set
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_ZLIB_INFLATE=y
diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile
new file mode 100644
index 0000000..a9608e7
--- /dev/null
+++ b/target/linux/apm821xx/image/Makefile
@@ -0,0 +1,24 @@
+#
+# Copyright (C) 2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/image.mk
+
+IMAGE_PROFILE:=$(if $(PROFILE),$(PROFILE),Default)
+
+DEVICE_VARS += DTS IMAGE_SIZE
+
+define Device/Default
+ BOARDNAME :=
+ DEVICE_PROFILE = $$(BOARDNAME)
+ PROFILES = Default $$(DEVICE_PROFILE)
+ KERNEL_DEPENDS = $$(wildcard ../dts/$$(DTS).dts)
+ KERNEL := kernel-bin | lzma | uImage lzma
+ KERNEL_INITRAMFS := kernel-bin | lzma | uImage lzma
+endef
+TARGET_DEVICES += Default
+
+$(eval $(call BuildImage))
diff --git a/target/linux/apm821xx/patches-4.4/700-powerpc_ibm_phy_add_ar8035.patch b/target/linux/apm821xx/patches-4.4/700-powerpc_ibm_phy_add_ar8035.patch
new file mode 100644
index 0000000..b0c1eeb
--- /dev/null
+++ b/target/linux/apm821xx/patches-4.4/700-powerpc_ibm_phy_add_ar8035.patch
@@ -0,0 +1,41 @@
+--- a/drivers/net/ethernet/ibm/emac/phy.c
++++ b/drivers/net/ethernet/ibm/emac/phy.c
+@@ -470,12 +470,38 @@ static struct mii_phy_def m88e1112_phy_d
+ .ops = &m88e1112_phy_ops,
+ };
+
++static int ar8035_init(struct mii_phy *phy)
++{
++ phy_write(phy, 0x1d, 0x5); /* Address debug register 5 */
++ phy_write(phy, 0x1e, 0x2d47); /* ?? Value copied from u-boot */
++ phy_write(phy, 0x1d, 0xb); /* Address hib ctrl */
++ phy_write(phy, 0x1e, 0xbc20); /* Another poorly documented register */
++
++ return 0;
++}
++
++static struct mii_phy_ops ar8035_phy_ops = {
++ .init = ar8035_init,
++ .setup_aneg = genmii_setup_aneg,
++ .setup_forced = genmii_setup_forced,
++ .poll_link = genmii_poll_link,
++ .read_link = genmii_read_link,
++};
++
++static struct mii_phy_def ar8035_phy_def = {
++ .phy_id = 0x004dd070,
++ .phy_id_mask = 0xfffffff0,
++ .name = "Atheros 8035 Gigabit Ethernet",
++ .ops = &ar8035_phy_ops,
++};
++
+ static struct mii_phy_def *mii_phy_table[] = {
+ &et1011c_phy_def,
+ &cis8201_phy_def,
+ &bcm5248_phy_def,
+ &m88e1111_phy_def,
+ &m88e1112_phy_def,
++ &ar8035_phy_def,
+ &genmii_phy_def,
+ NULL
+ };
diff --git a/target/linux/apm821xx/patches-4.4/800-ppc4xx-rng-fix-crash-during-init.patch b/target/linux/apm821xx/patches-4.4/800-ppc4xx-rng-fix-crash-during-init.patch
new file mode 100644
index 0000000..6eed32f
--- /dev/null
+++ b/target/linux/apm821xx/patches-4.4/800-ppc4xx-rng-fix-crash-during-init.patch
@@ -0,0 +1,117 @@
+From 2159e200fcb68f88a94b1d5570d6000c100133a8 Mon Sep 17 00:00:00 2001
+From: Christian Lamparter <chunkeey at googlemail.com>
+Date: Fri, 25 Mar 2016 19:00:05 +0100
+Subject: [PATCH] ppc4xx-rng: fix crash during init
+
+This patch fixes a crash that happens in the ppc4xx-rng driver
+when accessing the main crypto core to enable the true random
+number generator.
+
+Signed-off-by: Christian Lamparter <chunkeey at googlemail.com>
+---
+ drivers/char/hw_random/ppc4xx-rng.c | 42 ---------------------------------
+ drivers/crypto/amcc/crypto4xx_core.c | 1 +
+ drivers/crypto/amcc/crypto4xx_reg_def.h | 1 +
+ 3 files changed, 2 insertions(+), 42 deletions(-)
+
+diff --git a/drivers/char/hw_random/ppc4xx-rng.c b/drivers/char/hw_random/ppc4xx-rng.c
+index c0db438..a9a8a29 100644
+--- a/drivers/char/hw_random/ppc4xx-rng.c
++++ b/drivers/char/hw_random/ppc4xx-rng.c
+@@ -17,9 +17,6 @@
+ #include <linux/of_platform.h>
+ #include <asm/io.h>
+
+-#define PPC4XX_TRNG_DEV_CTRL 0x60080
+-
+-#define PPC4XX_TRNGE 0x00020000
+ #define PPC4XX_TRNG_CTRL 0x0008
+ #define PPC4XX_TRNG_CTRL_DALM 0x20
+ #define PPC4XX_TRNG_STAT 0x0004
+@@ -51,40 +48,6 @@ static int ppc4xx_rng_data_read(struct hwrng *rng, u32 *data)
+ return 4;
+ }
+
+-static int ppc4xx_rng_enable(int enable)
+-{
+- struct device_node *ctrl;
+- void __iomem *ctrl_reg;
+- int err = 0;
+- u32 val;
+-
+- /* Find the main crypto device node and map it to turn the TRNG on */
+- ctrl = of_find_compatible_node(NULL, NULL, "amcc,ppc4xx-crypto");
+- if (!ctrl)
+- return -ENODEV;
+-
+- ctrl_reg = of_iomap(ctrl, 0);
+- if (!ctrl_reg) {
+- err = -ENODEV;
+- goto out;
+- }
+-
+- val = in_le32(ctrl_reg + PPC4XX_TRNG_DEV_CTRL);
+-
+- if (enable)
+- val |= PPC4XX_TRNGE;
+- else
+- val = val & ~PPC4XX_TRNGE;
+-
+- out_le32(ctrl_reg + PPC4XX_TRNG_DEV_CTRL, val);
+- iounmap(ctrl_reg);
+-
+-out:
+- of_node_put(ctrl);
+-
+- return err;
+-}
+-
+ static struct hwrng ppc4xx_rng = {
+ .name = MODULE_NAME,
+ .data_present = ppc4xx_rng_data_present,
+@@ -100,10 +63,6 @@ static int ppc4xx_rng_probe(struct platform_device *dev)
+ if (!rng_regs)
+ return -ENODEV;
+
+- err = ppc4xx_rng_enable(1);
+- if (err)
+- return err;
+-
+ out_le32(rng_regs + PPC4XX_TRNG_CTRL, PPC4XX_TRNG_CTRL_DALM);
+ ppc4xx_rng.priv = (unsigned long) rng_regs;
+
+@@ -117,7 +76,6 @@ static int ppc4xx_rng_remove(struct platform_device *dev)
+ void __iomem *rng_regs = (void __iomem *) ppc4xx_rng.priv;
+
+ hwrng_unregister(&ppc4xx_rng);
+- ppc4xx_rng_enable(0);
+ iounmap(rng_regs);
+
+ return 0;
+diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
+index 62134c8..cb0b262 100644
+--- a/drivers/crypto/amcc/crypto4xx_core.c
++++ b/drivers/crypto/amcc/crypto4xx_core.c
+@@ -90,6 +90,7 @@ static void crypto4xx_hw_init(struct crypto4xx_device *dev)
+ writel(ring_ctrl.w, dev->ce_base + CRYPTO4XX_RING_CTRL);
+ device_ctrl = readl(dev->ce_base + CRYPTO4XX_DEVICE_CTRL);
+ device_ctrl |= PPC4XX_DC_3DES_EN;
++ device_ctrl |= PPC4XX_TRNGE;
+ writel(device_ctrl, dev->ce_base + CRYPTO4XX_DEVICE_CTRL);
+ writel(dev->gdr_pa, dev->ce_base + CRYPTO4XX_GATH_RING_BASE);
+ writel(dev->sdr_pa, dev->ce_base + CRYPTO4XX_SCAT_RING_BASE);
+diff --git a/drivers/crypto/amcc/crypto4xx_reg_def.h b/drivers/crypto/amcc/crypto4xx_reg_def.h
+index 5f5fbc0..914efc6 100644
+--- a/drivers/crypto/amcc/crypto4xx_reg_def.h
++++ b/drivers/crypto/amcc/crypto4xx_reg_def.h
+@@ -124,6 +124,7 @@
+ #define PPC4XX_BYTE_ORDER 0x22222
+ #define PPC4XX_INTERRUPT_CLR 0x3ffff
+ #define PPC4XX_PRNG_CTRL_AUTO_EN 0x3
++#define PPC4XX_TRNGE 0x00020000
+ #define PPC4XX_DC_3DES_EN 1
+ #define PPC4XX_INT_DESCR_CNT 4
+ #define PPC4XX_INT_TIMEOUT_CNT 0
+--
+2.8.0.rc3
+
diff --git a/target/linux/apm821xx/profiles/00-default.mk b/target/linux/apm821xx/profiles/00-default.mk
new file mode 100644
index 0000000..acd1fdf
--- /dev/null
+++ b/target/linux/apm821xx/profiles/00-default.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/Default
+ NAME:=Default Profile (all drivers)
+ PACKAGES:=kmod-usb-core kmod-usb2 kmod-usb2-fsl
+endef
+
+define Profile/Default/Description
+ Default package set compatible with most boards.
+endef
+$(eval $(call Profile,Default))
--
2.1.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list