diff options
author | Chris Blake <chrisrblake93@gmail.com> | 2016-07-20 15:44:50 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-07-22 09:48:12 +0200 |
commit | 3827ce2c3dc1849033d6de52e58fcbccc7ed74a2 (patch) | |
tree | 19d5d67bd8357f47fce8c318143fdc7d65e59bb6 /target | |
parent | 39f3408732df53e8671426c207f178ae0cf42d01 (diff) | |
download | upstream-3827ce2c3dc1849033d6de52e58fcbccc7ed74a2.tar.gz upstream-3827ce2c3dc1849033d6de52e58fcbccc7ed74a2.tar.bz2 upstream-3827ce2c3dc1849033d6de52e58fcbccc7ed74a2.zip |
apm821xx: add support for the apm821xx device target
This adds a new target for PowerPC APM82181 and APM82161
(464-based) boards, as well as adds support for the booke-wdt
watchdog package.
Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
Diffstat (limited to 'target')
14 files changed, 1177 insertions, 0 deletions
diff --git a/target/linux/apm821xx/Makefile b/target/linux/apm821xx/Makefile new file mode 100644 index 0000000000..5c530d3ca6 --- /dev/null +++ b/target/linux/apm821xx/Makefile @@ -0,0 +1,28 @@ +# +# 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:=fpu dt gpio +MAINTAINER:=Chris Blake <chrisrblake93@gmail.com>, \ + Christian Lamparter <chunkeey@gmail.com> + +KERNEL_PATCHVER:=4.4 + +include $(INCLUDE_DIR)/target.mk + +KERNELNAME:=uImage + +DEFAULT_PACKAGES += \ + kmod-leds-gpio kmod-i2c-core kmod-gpio-button-hotplug + +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/01_leds b/target/linux/apm821xx/base-files/etc/board.d/01_leds new file mode 100755 index 0000000000..eab8b59142 --- /dev/null +++ b/target/linux/apm821xx/base-files/etc/board.d/01_leds @@ -0,0 +1,17 @@ +#!/bin/sh + +. /lib/functions/uci-defaults.sh +. /lib/apm821xx.sh + +board_config_update + +board=$(apm821xx_board_name) + +case "$board" in +*) + ;; +esac + +board_config_flush + +exit 0 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 0000000000..7dbabec11d --- /dev/null +++ b/target/linux/apm821xx/base-files/etc/board.d/02_network @@ -0,0 +1,19 @@ +#!/bin/sh + +. /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/etc/diag.sh b/target/linux/apm821xx/base-files/etc/diag.sh new file mode 100755 index 0000000000..4d6763879b --- /dev/null +++ b/target/linux/apm821xx/base-files/etc/diag.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +. /lib/functions/leds.sh +. /lib/apm821xx.sh + +get_status_led() { + case $(apm821xx_board_name) in + *) + ;; + esac +} + +set_state() { + get_status_led + + case "$1" in + preinit) + status_led_blink_preinit + ;; + + failsafe) + status_led_blink_failsafe + ;; + + preinit_regular) + status_led_blink_preinit_regular + ;; + + done) + status_led_on + ;; + esac +} diff --git a/target/linux/apm821xx/base-files/etc/inittab b/target/linux/apm821xx/base-files/etc/inittab new file mode 100644 index 0000000000..1885787477 --- /dev/null +++ b/target/linux/apm821xx/base-files/etc/inittab @@ -0,0 +1,4 @@ +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K shutdown +::askconsole:/usr/libexec/login.sh +ttyS0::askfirst:/usr/libexec/login.sh diff --git a/target/linux/apm821xx/base-files/lib/apm821xx.sh b/target/linux/apm821xx/base-files/lib/apm821xx.sh new file mode 100755 index 0000000000..8f15ced8ca --- /dev/null +++ b/target/linux/apm821xx/base-files/lib/apm821xx.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +APM821XX_BOARD_NAME= +APM821XX_MODEL= + +apm821xx_board_detect() { + local model + local name + + model=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /model/ {print $2}' /proc/cpuinfo) + + case "$model" in + *) + name="unknown" + ;; + esac + + [ -z "$name" ] && name="unknown" + + [ -z "$APM821XX_BOARD_NAME" ] && APM821XX_BOARD_NAME="$name" + [ -z "$APM821XX_MODEL" ] && APM821XX_MODEL="$model" + + [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" + + echo "$APM821XX_BOARD_NAME" > /tmp/sysinfo/board_name + echo "$APM821XX_MODEL" > /tmp/sysinfo/model +} + +apm821xx_board_name() { + local name + + [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name) + [ -z "$name" ] && name="unknown" + + echo "$name" +} 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 0000000000..5675357533 --- /dev/null +++ b/target/linux/apm821xx/base-files/lib/preinit/03_preinit_do_apm821xx.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +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 0000000000..97ef6dc68f --- /dev/null +++ b/target/linux/apm821xx/base-files/lib/preinit/05_set_preinit_iface_apm821xx @@ -0,0 +1,9 @@ +#!/bin/sh + +. /lib/apm821xx.sh + +apm821xx_set_preinit_iface() { + ifname=eth0 +} + +boot_hook_add preinit_main apm821xx_set_preinit_iface diff --git a/target/linux/apm821xx/base-files/lib/upgrade/platform.sh b/target/linux/apm821xx/base-files/lib/upgrade/platform.sh new file mode 100755 index 0000000000..2406113bad --- /dev/null +++ b/target/linux/apm821xx/base-files/lib/upgrade/platform.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +. /lib/apm821xx.sh + +PART_NAME=firmware +RAMFS_COPY_DATA=/lib/apm821xx.sh + +platform_check_image() { + local board=$(apm821xx_board_name) + + [ "$#" -gt 1 ] && return 1 + + case "$board" in + *) + ;; + esac + + echo "Sysupgrade is not yet supported on $board." + return 1 +} + +platform_pre_upgrade() { + local board=$(apm821xx_board_name) + + case "$board" in + *) + ;; + esac +} + +platform_do_upgrade() { + local board=$(apm821xx_board_name) + + case "$board" in + *) + default_do_upgrade "$ARGV" + ;; + esac +} + +platform_copy_config() { + local board=$(apm821xx_board_name) + + case "$board" in + *) + ;; + esac +} + +disable_watchdog() { + killall watchdog + ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && { + echo 'Could not disable watchdog' + return 1 + } +} + +append sysupgrade_pre_upgrade disable_watchdog diff --git a/target/linux/apm821xx/config-4.4 b/target/linux/apm821xx/config-4.4 new file mode 100644 index 0000000000..31235996c8 --- /dev/null +++ b/target/linux/apm821xx/config-4.4 @@ -0,0 +1,328 @@ +# CONFIG_40x is not set +CONFIG_44x=y +CONFIG_4xx=y +CONFIG_4xx_SOC=y +# CONFIG_ADVANCED_OPTIONS is not set +CONFIG_APM821xx=y +# 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_AUDIT_ARCH=y +# CONFIG_BAMBOO is not set +CONFIG_BCH=y +# CONFIG_BLUESTONE is not set +CONFIG_BOOKE=y +CONFIG_BOOKE_WDT=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_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set +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_FREEZER=y +# 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_GLOB=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_GPIO_GENERIC=y +CONFIG_GPIO_GENERIC_PLATFORM=y +CONFIG_GPIO_SYSFS=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_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_IBM_IIC=y +CONFIG_IBM_EMAC=y +CONFIG_IBM_EMAC_EMAC4=y +CONFIG_IBM_EMAC_POLL_WEIGHT=32 +CONFIG_IBM_EMAC_RGMII=y +CONFIG_IBM_EMAC_RXB=128 +CONFIG_IBM_EMAC_RX_COPY_THRESHOLD=256 +CONFIG_IBM_EMAC_RX_SKB_HEADROOM=0 +CONFIG_IBM_EMAC_TAH=y +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 is not set +# CONFIG_MTD_SPLIT_FIRMWARE_NAME is not set +# CONFIG_MTD_SPLIT_SQUASHFS_ROOT is not set +# CONFIG_MTD_SPLIT_SUPPORT is not set +# CONFIG_MTD_UBI is not set +# CONFIG_MTD_UBI_BEB_LIMIT is not set +# CONFIG_MTD_UBI_BLOCK is not set +# CONFIG_MTD_UBI_FASTMAP is not set +# CONFIG_MTD_UBI_GLUEBI is not set +# CONFIG_MTD_UBI_WL_THRESHOLD is not set +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_PCIE_PME=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_PM=y +CONFIG_PM_AUTOSLEEP=y +# CONFIG_PM_DEBUG is not set +CONFIG_PM_SLEEP=y +CONFIG_PM_WAKELOCKS=y +CONFIG_PM_WAKELOCKS_GC=y +CONFIG_PM_WAKELOCKS_LIMIT=100 +CONFIG_PPC=y +CONFIG_PPC32=y +# CONFIG_PPC44x_SIMPLE is not set +CONFIG_PPC4xx_CPM=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_FPU=y +# 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_MSI_BITMAP 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_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +# 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 is not set +# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set +# CONFIG_UBIFS_FS_LZO is not set +# CONFIG_UBIFS_FS_XZ is not set +# CONFIG_UBIFS_FS_ZLIB is not set +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 +# CONFIG_JFFS2_FS is not set diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile new file mode 100644 index 0000000000..48ada70d3f --- /dev/null +++ b/target/linux/apm821xx/image/Makefile @@ -0,0 +1,22 @@ +# +# 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/001-crypto4xx-integrate-ppc4xx-rng-into-crypto4xx.patch b/target/linux/apm821xx/patches-4.4/001-crypto4xx-integrate-ppc4xx-rng-into-crypto4xx.patch new file mode 100644 index 0000000000..b395f0f7a3 --- /dev/null +++ b/target/linux/apm821xx/patches-4.4/001-crypto4xx-integrate-ppc4xx-rng-into-crypto4xx.patch @@ -0,0 +1,507 @@ +From 5343e674f32fb82b7a80a24b5a84eee62d3fe624 Mon Sep 17 00:00:00 2001 +From: Christian Lamparter <chunkeey@googlemail.com> +Date: Mon, 18 Apr 2016 12:57:41 +0200 +Subject: [PATCH] crypto4xx: integrate ppc4xx-rng into crypto4xx + +This patch integrates the ppc4xx-rng driver into the existing +crypto4xx. This is because the true random number generator +is controlled and part of the security core. + +Signed-off-by: Christian Lamparter <chunkeey@googlemail.com> +Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> +--- + drivers/char/hw_random/Kconfig | 13 --- + drivers/char/hw_random/Makefile | 1 - + drivers/char/hw_random/ppc4xx-rng.c | 147 -------------------------------- + drivers/crypto/Kconfig | 8 ++ + drivers/crypto/amcc/Makefile | 1 + + drivers/crypto/amcc/crypto4xx_core.c | 7 +- + drivers/crypto/amcc/crypto4xx_core.h | 4 + + drivers/crypto/amcc/crypto4xx_reg_def.h | 1 + + drivers/crypto/amcc/crypto4xx_trng.c | 131 ++++++++++++++++++++++++++++ + drivers/crypto/amcc/crypto4xx_trng.h | 34 ++++++++ + 10 files changed, 184 insertions(+), 163 deletions(-) + delete mode 100644 drivers/char/hw_random/ppc4xx-rng.c + create mode 100644 drivers/crypto/amcc/crypto4xx_trng.c + create mode 100644 drivers/crypto/amcc/crypto4xx_trng.h + +diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig +index c76a88d..ac51149 100644 +--- a/drivers/char/hw_random/Kconfig ++++ b/drivers/char/hw_random/Kconfig +@@ -268,19 +268,6 @@ config HW_RANDOM_NOMADIK + + If unsure, say Y. + +-config HW_RANDOM_PPC4XX +- tristate "PowerPC 4xx generic true random number generator support" +- depends on PPC && 4xx +- default HW_RANDOM +- ---help--- +- This driver provides the kernel-side support for the TRNG hardware +- found in the security function of some PowerPC 4xx SoCs. +- +- To compile this driver as a module, choose M here: the +- module will be called ppc4xx-rng. +- +- If unsure, say N. +- + config HW_RANDOM_PSERIES + tristate "pSeries HW Random Number Generator support" + depends on PPC64 && IBMVIO +diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile +index e09305b..63022b4 100644 +--- a/drivers/char/hw_random/Makefile ++++ b/drivers/char/hw_random/Makefile +@@ -22,7 +22,6 @@ obj-$(CONFIG_HW_RANDOM_TX4939) += tx4939-rng.o + obj-$(CONFIG_HW_RANDOM_MXC_RNGA) += mxc-rnga.o + obj-$(CONFIG_HW_RANDOM_OCTEON) += octeon-rng.o + obj-$(CONFIG_HW_RANDOM_NOMADIK) += nomadik-rng.o +-obj-$(CONFIG_HW_RANDOM_PPC4XX) += ppc4xx-rng.o + obj-$(CONFIG_HW_RANDOM_PSERIES) += pseries-rng.o + obj-$(CONFIG_HW_RANDOM_POWERNV) += powernv-rng.o + obj-$(CONFIG_HW_RANDOM_EXYNOS) += exynos-rng.o +diff --git a/drivers/char/hw_random/ppc4xx-rng.c b/drivers/char/hw_random/ppc4xx-rng.c +deleted file mode 100644 +index c0db438..0000000 +--- a/drivers/char/hw_random/ppc4xx-rng.c ++++ /dev/null +@@ -1,147 +0,0 @@ +-/* +- * Generic PowerPC 44x RNG driver +- * +- * Copyright 2011 IBM Corporation +- * +- * 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; version 2 of the License. +- */ +- +-#include <linux/module.h> +-#include <linux/kernel.h> +-#include <linux/platform_device.h> +-#include <linux/hw_random.h> +-#include <linux/delay.h> +-#include <linux/of_address.h> +-#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 +-#define PPC4XX_TRNG_STAT_B 0x1 +-#define PPC4XX_TRNG_DATA 0x0000 +- +-#define MODULE_NAME "ppc4xx_rng" +- +-static int ppc4xx_rng_data_present(struct hwrng *rng, int wait) +-{ +- void __iomem *rng_regs = (void __iomem *) rng->priv; +- int busy, i, present = 0; +- +- for (i = 0; i < 20; i++) { +- busy = (in_le32(rng_regs + PPC4XX_TRNG_STAT) & PPC4XX_TRNG_STAT_B); +- if (!busy || !wait) { +- present = 1; +- break; +- } +- udelay(10); +- } +- return present; +-} +- +-static int ppc4xx_rng_data_read(struct hwrng *rng, u32 *data) +-{ +- void __iomem *rng_regs = (void __iomem *) rng->priv; +- *data = in_le32(rng_regs + PPC4XX_TRNG_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, +- .data_read = ppc4xx_rng_data_read, +-}; +- +-static int ppc4xx_rng_probe(struct platform_device *dev) +-{ +- void __iomem *rng_regs; +- int err = 0; +- +- rng_regs = of_iomap(dev->dev.of_node, 0); +- 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; +- +- err = hwrng_register(&ppc4xx_rng); +- +- return err; +-} +- +-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; +-} +- +-static const struct of_device_id ppc4xx_rng_match[] = { +- { .compatible = "ppc4xx-rng", }, +- { .compatible = "amcc,ppc460ex-rng", }, +- { .compatible = "amcc,ppc440epx-rng", }, +- {}, +-}; +-MODULE_DEVICE_TABLE(of, ppc4xx_rng_match); +- +-static struct platform_driver ppc4xx_rng_driver = { +- .driver = { +- .name = MODULE_NAME, +- .of_match_table = ppc4xx_rng_match, +- }, +- .probe = ppc4xx_rng_probe, +- .remove = ppc4xx_rng_remove, +-}; +- +-module_platform_driver(ppc4xx_rng_driver); +- +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Josh Boyer <jwboyer@linux.vnet.ibm.com>"); +-MODULE_DESCRIPTION("HW RNG driver for PPC 4xx processors"); +diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig +index 0a22ac7..12fd499 100644 +--- a/drivers/crypto/Kconfig ++++ b/drivers/crypto/Kconfig +@@ -279,6 +279,14 @@ config CRYPTO_DEV_PPC4XX + help + This option allows you to have support for AMCC crypto acceleration. + ++config HW_RANDOM_PPC4XX ++ bool "PowerPC 4xx generic true random number generator support" ++ depends on CRYPTO_DEV_PPC4XX && HW_RANDOM ++ default y ++ ---help--- ++ This option provides the kernel-side support for the TRNG hardware ++ found in the security function of some PowerPC 4xx SoCs. ++ + config CRYPTO_DEV_OMAP_SHAM + tristate "Support for OMAP MD5/SHA1/SHA2 hw accelerator" + depends on ARCH_OMAP2PLUS +diff --git a/drivers/crypto/amcc/Makefile b/drivers/crypto/amcc/Makefile +index 5c0c62b..b955399 100644 +--- a/drivers/crypto/amcc/Makefile ++++ b/drivers/crypto/amcc/Makefile +@@ -1,2 +1,3 @@ + obj-$(CONFIG_CRYPTO_DEV_PPC4XX) += crypto4xx.o + crypto4xx-y := crypto4xx_core.o crypto4xx_alg.o crypto4xx_sa.o ++crypto4xx-$(CONFIG_HW_RANDOM_PPC4XX) += crypto4xx_trng.o +diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c +index 62134c8..dae1e39 100644 +--- a/drivers/crypto/amcc/crypto4xx_core.c ++++ b/drivers/crypto/amcc/crypto4xx_core.c +@@ -40,6 +40,7 @@ + #include "crypto4xx_reg_def.h" + #include "crypto4xx_core.h" + #include "crypto4xx_sa.h" ++#include "crypto4xx_trng.h" + + #define PPC4XX_SEC_VERSION_STR "0.5" + +@@ -1225,6 +1226,7 @@ static int crypto4xx_probe(struct platform_device *ofdev) + if (rc) + goto err_start_dev; + ++ ppc4xx_trng_probe(core_dev); + return 0; + + err_start_dev: +@@ -1252,6 +1254,8 @@ static int crypto4xx_remove(struct platform_device *ofdev) + struct device *dev = &ofdev->dev; + struct crypto4xx_core_device *core_dev = dev_get_drvdata(dev); + ++ ppc4xx_trng_remove(core_dev); ++ + free_irq(core_dev->irq, dev); + irq_dispose_mapping(core_dev->irq); + +@@ -1272,7 +1276,7 @@ MODULE_DEVICE_TABLE(of, crypto4xx_match); + + static struct platform_driver crypto4xx_driver = { + .driver = { +- .name = "crypto4xx", ++ .name = MODULE_NAME, + .of_match_table = crypto4xx_match, + }, + .probe = crypto4xx_probe, +@@ -1284,4 +1288,3 @@ module_platform_driver(crypto4xx_driver); + MODULE_LICENSE("GPL"); + MODULE_AUTHOR("James Hsiao <jhsiao@amcc.com>"); + MODULE_DESCRIPTION("Driver for AMCC PPC4xx crypto accelerator"); +- +diff --git a/drivers/crypto/amcc/crypto4xx_core.h b/drivers/crypto/amcc/crypto4xx_core.h +index bac0bde..ecfdcfe 100644 +--- a/drivers/crypto/amcc/crypto4xx_core.h ++++ b/drivers/crypto/amcc/crypto4xx_core.h +@@ -24,6 +24,8 @@ + + #include <crypto/internal/hash.h> + ++#define MODULE_NAME "crypto4xx" ++ + #define PPC460SX_SDR0_SRST 0x201 + #define PPC405EX_SDR0_SRST 0x200 + #define PPC460EX_SDR0_SRST 0x201 +@@ -72,6 +74,7 @@ struct crypto4xx_device { + char *name; + u64 ce_phy_address; + void __iomem *ce_base; ++ void __iomem *trng_base; + + void *pdr; /* base address of packet + descriptor ring */ +@@ -106,6 +109,7 @@ struct crypto4xx_core_device { + struct device *device; + struct platform_device *ofdev; + struct crypto4xx_device *dev; ++ struct hwrng *trng; + u32 int_status; + u32 irq; + struct tasklet_struct tasklet; +diff --git a/drivers/crypto/amcc/crypto4xx_reg_def.h b/drivers/crypto/amcc/crypto4xx_reg_def.h +index 5f5fbc0..46fe57c 100644 +--- a/drivers/crypto/amcc/crypto4xx_reg_def.h ++++ b/drivers/crypto/amcc/crypto4xx_reg_def.h +@@ -125,6 +125,7 @@ + #define PPC4XX_INTERRUPT_CLR 0x3ffff + #define PPC4XX_PRNG_CTRL_AUTO_EN 0x3 + #define PPC4XX_DC_3DES_EN 1 ++#define PPC4XX_TRNG_EN 0x00020000 + #define PPC4XX_INT_DESCR_CNT 4 + #define PPC4XX_INT_TIMEOUT_CNT 0 + #define PPC4XX_INT_CFG 1 +diff --git a/drivers/crypto/amcc/crypto4xx_trng.c b/drivers/crypto/amcc/crypto4xx_trng.c +new file mode 100644 +index 0000000..677ca17 +--- /dev/null ++++ b/drivers/crypto/amcc/crypto4xx_trng.c +@@ -0,0 +1,131 @@ ++/* ++ * Generic PowerPC 44x RNG driver ++ * ++ * Copyright 2011 IBM Corporation ++ * ++ * 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; version 2 of the License. ++ */ ++ ++#include <linux/module.h> ++#include <linux/kernel.h> ++#include <linux/interrupt.h> ++#include <linux/platform_device.h> ++#include <linux/hw_random.h> ++#include <linux/delay.h> ++#include <linux/of_address.h> ++#include <linux/of_platform.h> ++#include <linux/io.h> ++ ++#include "crypto4xx_core.h" ++#include "crypto4xx_trng.h" ++#include "crypto4xx_reg_def.h" ++ ++#define PPC4XX_TRNG_CTRL 0x0008 ++#define PPC4XX_TRNG_CTRL_DALM 0x20 ++#define PPC4XX_TRNG_STAT 0x0004 ++#define PPC4XX_TRNG_STAT_B 0x1 ++#define PPC4XX_TRNG_DATA 0x0000 ++ ++static int ppc4xx_trng_data_present(struct hwrng *rng, int wait) ++{ ++ struct crypto4xx_device *dev = (void *)rng->priv; ++ int busy, i, present = 0; ++ ++ for (i = 0; i < 20; i++) { ++ busy = (in_le32(dev->trng_base + PPC4XX_TRNG_STAT) & ++ PPC4XX_TRNG_STAT_B); ++ if (!busy || !wait) { ++ present = 1; ++ break; ++ } ++ udelay(10); ++ } ++ return present; ++} ++ ++static int ppc4xx_trng_data_read(struct hwrng *rng, u32 *data) ++{ ++ struct crypto4xx_device *dev = (void *)rng->priv; ++ *data = in_le32(dev->trng_base + PPC4XX_TRNG_DATA); ++ return 4; ++} ++ ++static void ppc4xx_trng_enable(struct crypto4xx_device *dev, bool enable) ++{ ++ u32 device_ctrl; ++ ++ device_ctrl = readl(dev->ce_base + CRYPTO4XX_DEVICE_CTRL); ++ if (enable) ++ device_ctrl |= PPC4XX_TRNG_EN; ++ else ++ device_ctrl &= ~PPC4XX_TRNG_EN; ++ writel(device_ctrl, dev->ce_base + CRYPTO4XX_DEVICE_CTRL); ++} ++ ++static const struct of_device_id ppc4xx_trng_match[] = { ++ { .compatible = "ppc4xx-rng", }, ++ { .compatible = "amcc,ppc460ex-rng", }, ++ { .compatible = "amcc,ppc440epx-rng", }, ++ {}, ++}; ++ ++void ppc4xx_trng_probe(struct crypto4xx_core_device *core_dev) ++{ ++ struct crypto4xx_device *dev = core_dev->dev; ++ struct device_node *trng = NULL; ++ struct hwrng *rng = NULL; ++ int err; ++ ++ /* Find the TRNG device node and map it */ ++ trng = of_find_matching_node(NULL, ppc4xx_trng_match); ++ if (!trng || !of_device_is_available(trng)) ++ return; ++ ++ dev->trng_base = of_iomap(trng, 0); ++ of_node_put(trng); ++ if (!dev->trng_base) ++ goto err_out; ++ ++ rng = kzalloc(sizeof(*rng), GFP_KERNEL); ++ if (!rng) ++ goto err_out; ++ ++ rng->name = MODULE_NAME; ++ rng->data_present = ppc4xx_trng_data_present; ++ rng->data_read = ppc4xx_trng_data_read; ++ rng->priv = (unsigned long) dev; ++ core_dev->trng = rng; ++ ppc4xx_trng_enable(dev, true); ++ out_le32(dev->trng_base + PPC4XX_TRNG_CTRL, PPC4XX_TRNG_CTRL_DALM); ++ err = devm_hwrng_register(core_dev->device, core_dev->trng); ++ if (err) { ++ ppc4xx_trng_enable(dev, false); ++ dev_err(core_dev->device, "failed to register hwrng (%d).\n", ++ err); ++ goto err_out; ++ } ++ return; ++ ++err_out: ++ of_node_put(trng); ++ iounmap(dev->trng_base); ++ kfree(rng); ++ dev->trng_base = NULL; ++ core_dev->trng = NULL; ++} ++ ++void ppc4xx_trng_remove(struct crypto4xx_core_device *core_dev) ++{ ++ if (core_dev && core_dev->trng) { ++ struct crypto4xx_device *dev = core_dev->dev; ++ ++ devm_hwrng_unregister(core_dev->device, core_dev->trng); ++ ppc4xx_trng_enable(dev, false); ++ iounmap(dev->trng_base); ++ kfree(core_dev->trng); ++ } ++} ++ ++MODULE_ALIAS("ppc4xx_rng"); +diff --git a/drivers/crypto/amcc/crypto4xx_trng.h b/drivers/crypto/amcc/crypto4xx_trng.h +new file mode 100644 +index 0000000..931d225 +--- /dev/null ++++ b/drivers/crypto/amcc/crypto4xx_trng.h +@@ -0,0 +1,34 @@ ++/** ++ * AMCC SoC PPC4xx Crypto Driver ++ * ++ * Copyright (c) 2008 Applied Micro Circuits Corporation. ++ * All rights reserved. James Hsiao <jhsiao@amcc.com> ++ * ++ * 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. ++ * ++ * This program 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. ++ * ++ * This file defines the security context ++ * associate format. ++ */ ++ ++#ifndef __CRYPTO4XX_TRNG_H__ ++#define __CRYPTO4XX_TRNG_H__ ++ ++#ifdef CONFIG_HW_RANDOM_PPC4XX ++void ppc4xx_trng_probe(struct crypto4xx_core_device *core_dev); ++void ppc4xx_trng_remove(struct crypto4xx_core_device *core_dev); ++#else ++static inline void ppc4xx_trng_probe( ++ struct crypto4xx_device *dev __maybe_unused) { } ++static inline void ppc4xx_trng_remove( ++ struct crypto4xx_device *dev __maybe_unused) { } ++#endif ++ ++#endif +-- +2.8.1 + diff --git a/target/linux/apm821xx/patches-4.4/300-fix-atheros-nics-on-apm82181.patch b/target/linux/apm821xx/patches-4.4/300-fix-atheros-nics-on-apm82181.patch new file mode 100644 index 0000000000..b9e5fb07c6 --- /dev/null +++ b/target/linux/apm821xx/patches-4.4/300-fix-atheros-nics-on-apm82181.patch @@ -0,0 +1,51 @@ +--- a/arch/powerpc/sysdev/ppc4xx_pci.c 2016-05-30 17:23:34.543707092 +0200 ++++ b/arch/powerpc/sysdev/ppc4xx_pci.c 2016-05-30 17:31:02.497707885 +0200 +@@ -1066,15 +1066,24 @@ static int __init apm821xx_pciex_init_po + u32 val; + + /* +- * Do a software reset on PCIe ports. +- * This code is to fix the issue that pci drivers doesn't re-assign +- * bus number for PCIE devices after Uboot +- * scanned and configured all the buses (eg. PCIE NIC IntelPro/1000 +- * PT quad port, SAS LSI 1064E) ++ * Only reset the PHY when no link is currently established. ++ * This is for the Atheros PCIe board which has problems to establish ++ * the link (again) after this PHY reset. All other currently tested ++ * PCIe boards don't show this problem. + */ +- +- mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x0); +- mdelay(10); ++ val = mfdcri(SDR0, port->sdr_base + PESDRn_LOOP); ++ if (!(val & 0x00001000)) { ++ /* ++ * Do a software reset on PCIe ports. ++ * This code is to fix the issue that pci drivers doesn't re-assign ++ * bus number for PCIE devices after Uboot ++ * scanned and configured all the buses (eg. PCIE NIC IntelPro/1000 ++ * PT quad port, SAS LSI 1064E) ++ */ ++ ++ mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x0); ++ mdelay(10); ++ } + + if (port->endpoint) + val = PTYPE_LEGACY_ENDPOINT << 20; +@@ -1091,9 +1100,12 @@ static int __init apm821xx_pciex_init_po + mtdcri(SDR0, PESDR0_460EX_L0DRV, 0x00000130); + mtdcri(SDR0, PESDR0_460EX_L0CLK, 0x00000006); + +- mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x10000000); +- mdelay(50); +- mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x30000000); ++ val = mfdcri(SDR0, port->sdr_base + PESDRn_LOOP); ++ if (!(val & 0x00001000)) { ++ mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x10000000); ++ mdelay(50); ++ mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x30000000); ++ } + + mtdcri(SDR0, port->sdr_base + PESDRn_RCSSET, + mfdcri(SDR0, port->sdr_base + PESDRn_RCSSET) | diff --git a/target/linux/apm821xx/patches-4.4/701-powerpc_ibm_apm82181_phyclk_fix.patch b/target/linux/apm821xx/patches-4.4/701-powerpc_ibm_apm82181_phyclk_fix.patch new file mode 100644 index 0000000000..ec9de179a4 --- /dev/null +++ b/target/linux/apm821xx/patches-4.4/701-powerpc_ibm_apm82181_phyclk_fix.patch @@ -0,0 +1,56 @@ +diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c +index 5d7db6c..01bed2e 100644 +--- a/drivers/net/ethernet/ibm/emac/core.c ++++ b/drivers/net/ethernet/ibm/emac/core.c +@@ -129,6 +129,7 @@ static inline void emac_report_timeout_error(struct emac_instance *dev, + { + if (emac_has_feature(dev, EMAC_FTR_440GX_PHY_CLK_FIX | + EMAC_FTR_460EX_PHY_CLK_FIX | ++ EMAC_FTR_APM821XX_PHY_CLK_FIX | + EMAC_FTR_440EP_PHY_CLK_FIX)) + DBG(dev, "%s" NL, error); + else if (net_ratelimit()) +@@ -146,6 +147,10 @@ static inline void emac_rx_clk_tx(struct emac_instance *dev) + if (emac_has_feature(dev, EMAC_FTR_440EP_PHY_CLK_FIX)) + dcri_clrset(SDR0, SDR0_MFR, + 0, SDR0_MFR_ECS >> dev->cell_index); ++ ++ if (emac_has_feature(dev, EMAC_FTR_APM821XX_PHY_CLK_FIX)) ++ dcri_clrset(SDR0, SDR0_ETH_CFG, ++ 0, 0x00000100 >> dev->cell_index); + #endif + } + +@@ -155,6 +160,10 @@ static inline void emac_rx_clk_default(struct emac_instance *dev) + if (emac_has_feature(dev, EMAC_FTR_440EP_PHY_CLK_FIX)) + dcri_clrset(SDR0, SDR0_MFR, + SDR0_MFR_ECS >> dev->cell_index, 0); ++ ++ if (emac_has_feature(dev, EMAC_FTR_APM821XX_PHY_CLK_FIX)) ++ dcri_clrset(SDR0, SDR0_ETH_CFG, ++ 0x00000100 >> dev->cell_index, 0); + #endif + } + +@@ -2587,7 +2596,7 @@ static int emac_init_config(struct emac_instance *dev) + if (of_device_is_compatible(np, "ibm,emac-apm821xx")) { + dev->features |= (EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE | + EMAC_FTR_APM821XX_NO_HALF_DUPLEX | +- EMAC_FTR_460EX_PHY_CLK_FIX); ++ EMAC_FTR_APM821XX_PHY_CLK_FIX); + } + } else if (of_device_is_compatible(np, "ibm,emac4")) { + dev->features |= EMAC_FTR_EMAC4; +diff --git a/drivers/net/ethernet/ibm/emac/core.h b/drivers/net/ethernet/ibm/emac/core.h +index 93ae114..072176a 100644 +--- a/drivers/net/ethernet/ibm/emac/core.h ++++ b/drivers/net/ethernet/ibm/emac/core.h +@@ -333,6 +333,8 @@ struct emac_instance { + */ + #define EMAC_FTR_APM821XX_NO_HALF_DUPLEX 0x00001000 + ++#define EMAC_FTR_APM821XX_PHY_CLK_FIX 0x000002000 ++ + /* Right now, we don't quite handle the always/possible masks on the + * most optimal way as we don't have a way to say something like + * always EMAC4. Patches welcome. |