diff --git a/Documentation/boards/imx/Phytec-phyCORE-i.MX35.rst b/Documentation/boards/imx/Phytec-phyCORE-i.MX35.rst new file mode 100644 index 000000000..adf5d2638 --- /dev/null +++ b/Documentation/boards/imx/Phytec-phyCORE-i.MX35.rst @@ -0,0 +1,7 @@ +Phytec phyCORE-i.MX35 +===================== + +Building the bootloader image for this target is covered by the ``phytec-phycore-imx35_defconfig``. + +Use the corresponding ``barebox.bin`` file for this target. This image can be +used for booting in ``internal mode`` from NAND or NOR memory. diff --git a/Documentation/boards/mxs.rst b/Documentation/boards/mxs.rst index cfcd4c70d..ad10b87a0 100644 --- a/Documentation/boards/mxs.rst +++ b/Documentation/boards/mxs.rst @@ -3,7 +3,7 @@ Freescale i.MXs Freescale i.MXs or MXS are a SoC family which consists of the i.MX23 and the i.MX28. These are quite different from the regular i.MX SoCs -and thus are represented by its own architecture in both the Kernel +and thus are represented by their own architecture in both the Kernel and barebox. Bootlets @@ -36,11 +36,11 @@ the internal PMIC and the SDRAM. The second image is usually the bootloader itself. In case of barebox the bootstream is composed out of the self extracting barebox image (pblx) and the prepare stage for setting up the SDRAM. - + The bootstream image itself is useful for USB boot, but for booting from SD cards or NAND a BCB header has to be prepended to the image. In case of SD boot the image has the .mxssd file extension in barebox. - + Since the bootstream images are encrypted they are not suitable for 2nd stage execution. For this purpose the 2nd stage images are generated. @@ -67,7 +67,7 @@ The SD images are suitable for booting from SD cards. SD cards need a special partitioning which can be created with the following fdisk sequence (using /dev/sdg as example):: - fdisk /dev/sdg + fdisk /dev/sdg Welcome to fdisk (util-linux 2.25.1). Changes will remain in memory only, until you decide to write them. @@ -83,17 +83,17 @@ partitioning which can be created with the following fdisk sequence (using e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): 1 - First sector (2048-7829503, default 2048): + First sector (2048-7829503, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-7829503, default 7829503): +1M Created a new partition 1 of type 'Linux' and of size 1 MiB. - Command (m for help): t + Command (m for help): t Selected partition 1 Hex code (type L to list all codes): 53 Changed type of partition 'Linux' to 'OnTrack DM6 Aux3'. - Command (m for help): + Command (m for help): Command (m for help): w @@ -101,16 +101,16 @@ After writing the new partition table the image can be written directly to the partition:: cat images/barebox-karo-tx28-sd.img > /dev/sdg1 - + ** NOTE ** The MXS SoCs require a special partition of type 0x53 (OnTrack DM6 Aux) which contains the BCB header. For some unknown reason the BCB header is inside a partition, but contains the sector number of the raw device from -which the rest of the image is read from. With standard settings booting -from SD card only works if the partition containing the bootloader starts -at sector 2048 (the standard for fdisk). See the -p parameter to the -mxsboot tool which changes this sector number in the image. +which the rest of the image is read. With standard settings booting from +SD card only works if the partition containing the bootloader starts at +sector 2048 (the standard for fdisk). See the -p parameter to the mxsboot +tool which changes this sector number in the image. Booting second stage -------------------- diff --git a/Documentation/boards/powerpc.rst b/Documentation/boards/powerpc.rst new file mode 100644 index 000000000..94b272c61 --- /dev/null +++ b/Documentation/boards/powerpc.rst @@ -0,0 +1,11 @@ +PowerPC boards +-------------- + +Not all supported boards have a description here. + +.. toctree:: + :glob: + :numbered: + :maxdepth: 1 + + powerpc/* diff --git a/Documentation/boards/powerpc/Phytec-phyCORE-MPC5200-Tiny b/Documentation/boards/powerpc/Phytec-phyCORE-MPC5200-Tiny new file mode 100644 index 000000000..697002731 --- /dev/null +++ b/Documentation/boards/powerpc/Phytec-phyCORE-MPC5200-Tiny @@ -0,0 +1,6 @@ +Phytec phyCORE-MPC5200-Tiny +=========================== + +Building the bootloader image for this target is covered by the ``pcm030_defconfig``. + +Use the corresponding ``barebox.bin`` file for this target. diff --git a/Documentation/boards/pxa.rst b/Documentation/boards/pxa.rst new file mode 100644 index 000000000..da848a095 --- /dev/null +++ b/Documentation/boards/pxa.rst @@ -0,0 +1,11 @@ +PXA boards +---------- + +Not all supported boards have a description here. + +.. toctree:: + :glob: + :numbered: + :maxdepth: 1 + + pxa/* diff --git a/Documentation/boards/pxa/Phytec-phyCORE-PXA270.rst b/Documentation/boards/pxa/Phytec-phyCORE-PXA270.rst new file mode 100644 index 000000000..23b2829fa --- /dev/null +++ b/Documentation/boards/pxa/Phytec-phyCORE-PXA270.rst @@ -0,0 +1,6 @@ +Phytec phyCORE-PXA270 +===================== + +Building the bootloader image for this target is covered by the ``phytec-phycore-pxa270_defconfig``. + +Use the corresponding ``barebox.bin`` file for this target. diff --git a/arch/arm/Makefile b/arch/arm/Makefile index c10d47188..96c9f5797 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -105,10 +105,12 @@ CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) # Add cleanup flags CPPFLAGS += -fdata-sections -ffunction-sections -LDFLAGS_barebox += -static --gc-sections +LDFLAGS_barebox += --gc-sections ifdef CONFIG_RELOCATABLE LDFLAGS_barebox += -pie +else +LDFLAGS_barebox += -static endif ifdef CONFIG_IMAGE_COMPRESSION diff --git a/arch/arm/boards/at91sam9m10ihd/env/nv/linux.bootargs.base b/arch/arm/boards/at91sam9m10ihd/env/nv/linux.bootargs.console similarity index 100% rename from arch/arm/boards/at91sam9m10ihd/env/nv/linux.bootargs.base rename to arch/arm/boards/at91sam9m10ihd/env/nv/linux.bootargs.console diff --git a/arch/arm/boards/avnet-zedboard/env/nv/linux.bootargs.base b/arch/arm/boards/avnet-zedboard/env/nv/linux.bootargs.console similarity index 100% rename from arch/arm/boards/avnet-zedboard/env/nv/linux.bootargs.base rename to arch/arm/boards/avnet-zedboard/env/nv/linux.bootargs.console diff --git a/arch/arm/boards/beagle/env/nv/linux.bootargs.base b/arch/arm/boards/beagle/env/nv/linux.bootargs.base deleted file mode 100644 index 5fef726ba..000000000 --- a/arch/arm/boards/beagle/env/nv/linux.bootargs.base +++ /dev/null @@ -1 +0,0 @@ -console=ttyO2,115200 diff --git a/arch/arm/boards/ccxmx51/env/nv/linux.bootargs.base b/arch/arm/boards/ccxmx51/env/nv/linux.bootargs.base deleted file mode 100644 index d83eb9414..000000000 --- a/arch/arm/boards/ccxmx51/env/nv/linux.bootargs.base +++ /dev/null @@ -1 +0,0 @@ -earlyprintk console=ttymxc0,115200n8 diff --git a/arch/arm/boards/clep7212/env/nv/linux.bootargs.base b/arch/arm/boards/clep7212/env/nv/linux.bootargs.console similarity index 100% rename from arch/arm/boards/clep7212/env/nv/linux.bootargs.base rename to arch/arm/boards/clep7212/env/nv/linux.bootargs.console diff --git a/arch/arm/boards/crystalfontz-cfa10036/env/nv/linux.bootargs.base b/arch/arm/boards/crystalfontz-cfa10036/env/nv/linux.bootargs.console similarity index 100% rename from arch/arm/boards/crystalfontz-cfa10036/env/nv/linux.bootargs.base rename to arch/arm/boards/crystalfontz-cfa10036/env/nv/linux.bootargs.console diff --git a/arch/arm/boards/efika-mx-smartbook/env/nv/linux.bootargs.base b/arch/arm/boards/efika-mx-smartbook/env/nv/linux.bootargs.console similarity index 100% rename from arch/arm/boards/efika-mx-smartbook/env/nv/linux.bootargs.base rename to arch/arm/boards/efika-mx-smartbook/env/nv/linux.bootargs.console diff --git a/arch/arm/boards/guf-vincell/env/nv/linux.bootargs.base b/arch/arm/boards/guf-vincell/env/nv/linux.bootargs.base deleted file mode 100644 index d775310b4..000000000 --- a/arch/arm/boards/guf-vincell/env/nv/linux.bootargs.base +++ /dev/null @@ -1 +0,0 @@ -console=ttymxc0,115200 diff --git a/arch/arm/boards/highbank/env/nv/bootargs.base b/arch/arm/boards/highbank/env/nv/linux.bootargs.console similarity index 100% rename from arch/arm/boards/highbank/env/nv/bootargs.base rename to arch/arm/boards/highbank/env/nv/linux.bootargs.console diff --git a/arch/arm/boards/imx233-olinuxino/defaultenv-imx233-olinuxino/nv/linux.bootargs.base b/arch/arm/boards/imx233-olinuxino/defaultenv-imx233-olinuxino/nv/linux.bootargs.console similarity index 100% rename from arch/arm/boards/imx233-olinuxino/defaultenv-imx233-olinuxino/nv/linux.bootargs.base rename to arch/arm/boards/imx233-olinuxino/defaultenv-imx233-olinuxino/nv/linux.bootargs.console diff --git a/arch/arm/boards/lubbock/env/nv/linux.bootargs.base b/arch/arm/boards/lubbock/env/nv/linux.bootargs.console similarity index 100% rename from arch/arm/boards/lubbock/env/nv/linux.bootargs.base rename to arch/arm/boards/lubbock/env/nv/linux.bootargs.console diff --git a/arch/arm/boards/mx31moboard/env/nv/linux.bootargs.base b/arch/arm/boards/mx31moboard/env/nv/linux.bootargs.base deleted file mode 100644 index 84e488d45..000000000 --- a/arch/arm/boards/mx31moboard/env/nv/linux.bootargs.base +++ /dev/null @@ -1 +0,0 @@ -console=ttymxc0,921600 diff --git a/arch/arm/boards/panda/env/nv/linux.bootargs.base b/arch/arm/boards/panda/env/nv/linux.bootargs.base deleted file mode 100644 index 5fef726ba..000000000 --- a/arch/arm/boards/panda/env/nv/linux.bootargs.base +++ /dev/null @@ -1 +0,0 @@ -console=ttyO2,115200 diff --git a/arch/arm/boards/phytec-phycard-imx6/defaultenv-phycard-imx6/nv/bootargs.base b/arch/arm/boards/phytec-phycard-imx6/defaultenv-phycard-imx6/nv/bootargs.base deleted file mode 100644 index 6b62c99db..000000000 --- a/arch/arm/boards/phytec-phycard-imx6/defaultenv-phycard-imx6/nv/bootargs.base +++ /dev/null @@ -1 +0,0 @@ -console=ttymxc2,115200 diff --git a/arch/arm/boards/phytec-phycore-imx31/env/nv/linux.bootargs.base b/arch/arm/boards/phytec-phycore-imx31/env/nv/linux.bootargs.base deleted file mode 100644 index d775310b4..000000000 --- a/arch/arm/boards/phytec-phycore-imx31/env/nv/linux.bootargs.base +++ /dev/null @@ -1 +0,0 @@ -console=ttymxc0,115200 diff --git a/arch/arm/boards/phytec-phycore-imx35/env/nv/linux.bootargs.base b/arch/arm/boards/phytec-phycore-imx35/env/nv/linux.bootargs.base deleted file mode 100644 index d775310b4..000000000 --- a/arch/arm/boards/phytec-phycore-imx35/env/nv/linux.bootargs.base +++ /dev/null @@ -1 +0,0 @@ -console=ttymxc0,115200 diff --git a/arch/arm/boards/phytec-phycore-pxa270/env/config b/arch/arm/boards/phytec-phycore-pxa270/env/config deleted file mode 100644 index d42780090..000000000 --- a/arch/arm/boards/phytec-phycore-pxa270/env/config +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -eth0.serverip= -user= - -# use 'dhcp' to do dhcp in barebox and in kernel -# use 'none' if you want to skip kernel ip autoconfiguration -ip=dhcp - -# or set your networking parameters here -#eth0.ipaddr=a.b.c.d -#eth0.netmask=a.b.c.d -#eth0.gateway=a.b.c.d -#eth0.serverip=a.b.c.d - -# can be either 'nfs', 'tftp', 'nor' or 'nand' -kernel_loc=tftp -# can be either 'net', 'nor', 'nand' or 'initrd' -rootfs_loc=net - -# can be either 'jffs2' or 'ubifs' -rootfs_type=ubifs -rootfsimage=root-${global.hostname}.$rootfs_type - -kernelimage=zImage-${global.hostname} -#kernelimage=uImage-${global.hostname} -#kernelimage=Image-${global.hostname} -#kernelimage=Image-${global.hostname}.lzo - -if [ -n $user ]; then - kernelimage="$user"-"$kernelimage" - nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}" - rootfsimage="$user"-"$rootfsimage" -else - nfsroot="$eth0.serverip:/path/to/nfs/root" -fi - -autoboot_timeout=3 - -bootargs="console=ttyS0,115200" - -nor_parts="512k(barebox)ro,256k(bareboxenv),4M(kernel),-(root)" -rootfs_mtdblock_nor=3 - -PS1="\e[1;32mbarebox@\e[1;31m\h:\w\e[0m " diff --git a/arch/arm/boards/phytec-phycore-pxa270/env/init/mtdparts-nor b/arch/arm/boards/phytec-phycore-pxa270/env/init/mtdparts-nor new file mode 100644 index 000000000..e617cbaab --- /dev/null +++ b/arch/arm/boards/phytec-phycore-pxa270/env/init/mtdparts-nor @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ "$1" = menu ]; then + init-menu-add-entry "$0" "NOR partitions" + exit +fi + +mtdparts="512k(nor0.barebox),256k(nor0.bareboxenv),4M(nor0.kernel),-(nor0.root)" +kernelname="physmap-flash.0" + +mtdparts-add -d nor0 -k ${kernelname} -p ${mtdparts} diff --git a/arch/arm/boards/telit-evk-pro3/env/nv/bootargs.base b/arch/arm/boards/phytec-phycore-pxa270/env/nv/linux.bootargs.base similarity index 100% rename from arch/arm/boards/telit-evk-pro3/env/nv/bootargs.base rename to arch/arm/boards/phytec-phycore-pxa270/env/nv/linux.bootargs.base diff --git a/arch/arm/boards/phytec-phyflex-imx6/defaultenv-phyflex-imx6/nv/linux.bootargs.base b/arch/arm/boards/phytec-phyflex-imx6/defaultenv-phyflex-imx6/nv/linux.bootargs.base deleted file mode 100644 index c61c6032c..000000000 --- a/arch/arm/boards/phytec-phyflex-imx6/defaultenv-phyflex-imx6/nv/linux.bootargs.base +++ /dev/null @@ -1 +0,0 @@ -console=ttymxc3,115200 diff --git a/arch/arm/boards/radxa-rock/env/nv/linux.bootargs.base b/arch/arm/boards/radxa-rock/env/nv/linux.bootargs.console similarity index 100% rename from arch/arm/boards/radxa-rock/env/nv/linux.bootargs.base rename to arch/arm/boards/radxa-rock/env/nv/linux.bootargs.console diff --git a/arch/arm/boards/telit-evk-pro3/env/nv/linux.bootargs.console b/arch/arm/boards/telit-evk-pro3/env/nv/linux.bootargs.console new file mode 100644 index 000000000..476b1fbe4 --- /dev/null +++ b/arch/arm/boards/telit-evk-pro3/env/nv/linux.bootargs.console @@ -0,0 +1 @@ +console=ttyS0,115200 diff --git a/arch/arm/boards/versatile/env/nv/linux.bootargs.base b/arch/arm/boards/versatile/env/nv/linux.bootargs.console similarity index 100% rename from arch/arm/boards/versatile/env/nv/linux.bootargs.base rename to arch/arm/boards/versatile/env/nv/linux.bootargs.console diff --git a/arch/arm/configs/phytec-phycore-pxa270_defconfig b/arch/arm/configs/phytec-phycore-pxa270_defconfig index 57eaff09e..304624bc2 100644 --- a/arch/arm/configs/phytec-phycore-pxa270_defconfig +++ b/arch/arm/configs/phytec-phycore-pxa270_defconfig @@ -8,50 +8,48 @@ CONFIG_MMU=y CONFIG_MALLOC_SIZE=0x1000000 CONFIG_MALLOC_TLSF=y CONFIG_KALLSYMS=y -CONFIG_LONGHELP=y -CONFIG_GLOB=y CONFIG_HUSH_FANCY_PROMPT=y CONFIG_CMDLINE_EDITING=y CONFIG_AUTO_COMPLETE=y CONFIG_PARTITION=y -CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y +CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/phytec-phycore-pxa270/env" CONFIG_DEBUG_INFO=y -CONFIG_CMD_EDIT=y -CONFIG_CMD_SLEEP=y -CONFIG_CMD_SAVEENV=y -CONFIG_CMD_EXPORT=y -CONFIG_CMD_PRINTENV=y -CONFIG_CMD_READLINE=y -CONFIG_CMD_TIME=y -CONFIG_CMD_AUTOMOUNT=y -CONFIG_CMD_ECHO_E=y -CONFIG_CMD_MEMINFO=y +CONFIG_LONGHELP=y CONFIG_CMD_IOMEM=y -CONFIG_CMD_FLASH=y +CONFIG_CMD_MEMINFO=y CONFIG_CMD_BOOTM_SHOW_TYPE=y CONFIG_CMD_BOOTM_VERBOSE=y CONFIG_CMD_BOOTM_INITRD=y CONFIG_CMD_BOOTM_OFTREE=y CONFIG_CMD_BOOTM_OFTREE_UIMAGE=y -CONFIG_CMD_UIMAGE=y -# CONFIG_CMD_BOOTZ is not set # CONFIG_CMD_BOOTU is not set -CONFIG_CMD_RESET=y CONFIG_CMD_GO=y -CONFIG_CMD_OFTREE=y -CONFIG_CMD_TIMEOUT=y +CONFIG_CMD_RESET=y +CONFIG_CMD_UIMAGE=y CONFIG_CMD_PARTITION=y +CONFIG_CMD_EXPORT=y +CONFIG_CMD_PRINTENV=y CONFIG_CMD_MAGICVAR=y CONFIG_CMD_MAGICVAR_HELP=y -CONFIG_CMD_SPLASH=y -CONFIG_CMD_GPIO=y +CONFIG_CMD_SAVEENV=y CONFIG_CMD_UNCOMPRESS=y -CONFIG_NET=y +CONFIG_CMD_SLEEP=y CONFIG_CMD_DHCP=y CONFIG_CMD_PING=y CONFIG_CMD_TFTP=y -CONFIG_FS_TFTP=y +CONFIG_CMD_ECHO_E=y +CONFIG_CMD_EDIT=y +CONFIG_CMD_SPLASH=y +CONFIG_CMD_READLINE=y +CONFIG_CMD_TIMEOUT=y +CONFIG_CMD_CRC=y +CONFIG_CMD_CRC_CMP=y +CONFIG_CMD_FLASH=y +CONFIG_CMD_GPIO=y +CONFIG_CMD_OFTREE=y +CONFIG_CMD_TIME=y +CONFIG_NET=y CONFIG_DRIVER_SERIAL_PXA=y CONFIG_DRIVER_NET_SMC91111=y # CONFIG_SPI is not set @@ -59,4 +57,5 @@ CONFIG_MTD=y CONFIG_DRIVER_CFI=y CONFIG_VIDEO=y CONFIG_DRIVER_VIDEO_PXA=y +CONFIG_FS_TFTP=y CONFIG_LZO_DECOMPRESS=y diff --git a/arch/arm/cpu/exceptions.S b/arch/arm/cpu/exceptions.S index 167c8d1fe..f17f1e11e 100644 --- a/arch/arm/cpu/exceptions.S +++ b/arch/arm/cpu/exceptions.S @@ -88,6 +88,21 @@ movs pc, lr .endm + .macro try_data_abort + ldr r13, =arm_ignore_data_abort @ check try mode + ldr r13, [r13] + cmp r13, #0 + beq do_abort_\@ + ldr r13, =arm_data_abort_occurred + str r13, [r13] + mrs r13, spsr @ read saved CPSR + tst r13, #1<<5 @ check Thumb mode + subeq lr, #4 @ next ARM instr + subne lr, #6 @ next Thumb instr + movs pc, lr +do_abort_\@: + .endm + .macro get_irq_stack @ setup IRQ stack ldr sp, IRQ_STACK_START .endm @@ -122,6 +137,7 @@ prefetch_abort: .align 5 data_abort: + try_data_abort get_bad_stack bad_save_user_regs bl do_data_abort @@ -202,5 +218,11 @@ _fiq: .word fiq .section .data .align 4 +.global arm_ignore_data_abort +arm_ignore_data_abort: +.word arm_ignore_data_abort /* When != 0 data aborts are ignored */ +.global arm_data_abort_occurred +arm_data_abort_occurred: +.word arm_data_abort_occurred /* set != 0 by the data abort handler */ abort_stack: .space 8 diff --git a/arch/arm/cpu/interrupts.c b/arch/arm/cpu/interrupts.c index 6e60adc43..c437af718 100644 --- a/arch/arm/cpu/interrupts.c +++ b/arch/arm/cpu/interrupts.c @@ -23,6 +23,7 @@ */ #include +#include #include #include @@ -161,3 +162,19 @@ void do_irq (struct pt_regs *pt_regs) printf ("interrupt request\n"); do_exception(pt_regs); } + +extern volatile int arm_ignore_data_abort; +extern volatile int arm_data_abort_occurred; + +void data_abort_mask(void) +{ + arm_data_abort_occurred = 0; + arm_ignore_data_abort = 1; +} + +int data_abort_unmask(void) +{ + arm_ignore_data_abort = 0; + + return arm_data_abort_occurred != 0; +} diff --git a/arch/arm/include/asm/barebox.h b/arch/arm/include/asm/barebox.h index 2b08d6890..31a8e1563 100644 --- a/arch/arm/include/asm/barebox.h +++ b/arch/arm/include/asm/barebox.h @@ -5,4 +5,8 @@ #define ARCH_HAS_STACK_DUMP #endif +#ifdef CONFIG_ARM_EXCEPTIONS +#define ARCH_HAS_DATA_ABORT_MASK +#endif + #endif /* _BAREBOX_H_ */ diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index a45e01a70..67d1f4b5a 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig @@ -64,6 +64,7 @@ config MACH_MIOA701 bool "Mitac Mio A701" select BCH_CONST_PARAMS select PWM + select POLLER help Say Y here if you are using a Mitac Mio A701 smartphone diff --git a/arch/arm/pbl/Makefile b/arch/arm/pbl/Makefile index 1b90b377a..4c1788dd9 100644 --- a/arch/arm/pbl/Makefile +++ b/arch/arm/pbl/Makefile @@ -31,10 +31,11 @@ $(obj)/zbarebox.S: $(obj)/zbarebox FORCE $(call if_changed,disasm) PBL_CPPFLAGS += -fdata-sections -ffunction-sections -LDFLAGS_zbarebox := -Map $(obj)/zbarebox.map -LDFLAGS_zbarebox += -static --gc-sections +LDFLAGS_zbarebox := -Map $(obj)/zbarebox.map --gc-sections ifdef CONFIG_PBL_RELOCATABLE LDFLAGS_zbarebox += -pie +else +LDFLAGS_zbarebox += -static endif zbarebox-common := $(barebox-pbl-common) $(obj)/$(piggy_o) zbarebox-lds := $(obj)/zbarebox.lds diff --git a/arch/ppc/boards/pcm030/env/init/mtdparts-nor b/arch/ppc/boards/pcm030/env/init/mtdparts-nor new file mode 100644 index 000000000..e900a3b22 --- /dev/null +++ b/arch/ppc/boards/pcm030/env/init/mtdparts-nor @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ "$1" = menu ]; then + init-menu-add-entry "$0" "NOR partitions" + exit +fi + +mtdparts="512k(nor0.bareboxlow),4M(nor0.kernel),512k(nor0.oftree),26M(nor0.root),512k(nor0.barebox),512k(nor0.bareboxenv)" +kernelname="physmap-flash.0" + +mtdparts-add -d nor0 -k ${kernelname} -p ${mtdparts} diff --git a/arch/ppc/boards/pcm030/env/nv/linux.bootargs.base b/arch/ppc/boards/pcm030/env/nv/linux.bootargs.base new file mode 100644 index 000000000..31ce0e71e --- /dev/null +++ b/arch/ppc/boards/pcm030/env/nv/linux.bootargs.base @@ -0,0 +1 @@ +console=ttyPSC0,115200 diff --git a/arch/ppc/configs/pcm030_defconfig b/arch/ppc/configs/pcm030_defconfig index 204f946f1..7b84e2f3b 100644 --- a/arch/ppc/configs/pcm030_defconfig +++ b/arch/ppc/configs/pcm030_defconfig @@ -1,42 +1,42 @@ CONFIG_TEXT_BASE=0x3e00000 CONFIG_MALLOC_SIZE=0x1000000 -CONFIG_LONGHELP=y -CONFIG_GLOB=y CONFIG_HUSH_FANCY_PROMPT=y CONFIG_CMDLINE_EDITING=y CONFIG_AUTO_COMPLETE=y CONFIG_PARTITION=y -CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y -CONFIG_CMD_EDIT=y -CONFIG_CMD_SLEEP=y -CONFIG_CMD_SAVEENV=y -CONFIG_CMD_LOADENV=y -CONFIG_CMD_EXPORT=y -CONFIG_CMD_READLINE=y -CONFIG_CMD_TIME=y -CONFIG_CMD_ECHO_E=y -CONFIG_CMD_MEMINFO=y +CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y +CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/ppc/boards/pcm030/env" +CONFIG_LONGHELP=y CONFIG_CMD_IOMEM=y -CONFIG_CMD_FLASH=y +CONFIG_CMD_MEMINFO=y CONFIG_CMD_BOOTM_SHOW_TYPE=y -CONFIG_CMD_UIMAGE=y -CONFIG_CMD_RESET=y CONFIG_CMD_GO=y -CONFIG_CMD_OFTREE=y -CONFIG_CMD_TIMEOUT=y +CONFIG_CMD_RESET=y +CONFIG_CMD_UIMAGE=y CONFIG_CMD_PARTITION=y +CONFIG_CMD_EXPORT=y +CONFIG_CMD_LOADENV=y CONFIG_CMD_MAGICVAR=y CONFIG_CMD_MAGICVAR_HELP=y +CONFIG_CMD_SAVEENV=y CONFIG_CMD_UNCOMPRESS=y -CONFIG_NET=y +CONFIG_CMD_SLEEP=y CONFIG_CMD_DHCP=y CONFIG_CMD_PING=y CONFIG_CMD_TFTP=y -CONFIG_FS_TFTP=y -CONFIG_ARCH_MPC5XXX=y -CONFIG_MACH_PHYCORE_MPC5200B_TINY=y +CONFIG_CMD_ECHO_E=y +CONFIG_CMD_EDIT=y +CONFIG_CMD_READLINE=y +CONFIG_CMD_TIMEOUT=y +CONFIG_CMD_CRC=y +CONFIG_CMD_CRC_CMP=y +CONFIG_CMD_FLASH=y +CONFIG_CMD_OFTREE=y +CONFIG_CMD_TIME=y +CONFIG_NET=y CONFIG_DRIVER_NET_MPC5200=y CONFIG_MTD=y CONFIG_DRIVER_CFI=y CONFIG_CFI_BUFFER_WRITE=y +CONFIG_FS_TFTP=y CONFIG_ZLIB=y diff --git a/commands/saveenv.c b/commands/saveenv.c index 43f16dc49..6f210b7ec 100644 --- a/commands/saveenv.c +++ b/commands/saveenv.c @@ -27,7 +27,7 @@ static int do_saveenv(int argc, char *argv[]) { int ret, opt; unsigned envfs_flags = 0; - char *filename, *dirname; + char *filename = NULL, *dirname = NULL; printf("saving environment\n"); while ((opt = getopt(argc, argv, "z")) > 0) { @@ -39,15 +39,11 @@ static int do_saveenv(int argc, char *argv[]) } /* destination and source are given? */ - if (argc - optind < 2) - dirname = "/env"; - else + if (argc - optind > 1) dirname = argv[optind + 1]; /* destination only given? */ - if (argc - optind < 1) - filename = default_environment_path_get(); - else + if (argc - optind > 0) filename = argv[optind]; ret = envfs_save(filename, dirname, envfs_flags); diff --git a/common/Kconfig b/common/Kconfig index 62d82c6e0..8a8912a14 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -414,6 +414,7 @@ config AUTO_COMPLETE config MENU bool prompt "Menu Framework" + depends on !SHELL_NONE select PROCESS_ESCAPE_SEQUENCE help a menu framework that allow us to create list menu to simplify diff --git a/common/bootargs.c b/common/bootargs.c index 6624f72eb..803736fc9 100644 --- a/common/bootargs.c +++ b/common/bootargs.c @@ -38,7 +38,7 @@ static int linux_bootargs_overwritten; */ const char *linux_bootargs_get(void) { - char *bootargs, *mtdparts; + char *bootargs, *parts; if (linux_bootargs_overwritten) return linux_bootargs; @@ -49,14 +49,21 @@ const char *linux_bootargs_get(void) if (!strlen(bootargs)) return getenv("bootargs"); - mtdparts = globalvar_get_match("linux.mtdparts.", ";"); + linux_bootargs = bootargs; - if (strlen(mtdparts)) { - linux_bootargs = asprintf("%s mtdparts=%s", bootargs, mtdparts); - free(bootargs); - free(mtdparts); - } else { - free(mtdparts); + parts = globalvar_get_match("linux.mtdparts.", ";"); + if (strlen(parts)) { + bootargs = asprintf("%s mtdparts=%s", linux_bootargs, parts); + free(linux_bootargs); + free(parts); + linux_bootargs = bootargs; + } + + parts = globalvar_get_match("linux.blkdevparts.", ";"); + if (strlen(parts)) { + bootargs = asprintf("%s blkdevparts=%s", linux_bootargs, parts); + free(linux_bootargs); + free(parts); linux_bootargs = bootargs; } @@ -78,3 +85,4 @@ int linux_bootargs_overwrite(const char *bootargs) BAREBOX_MAGICVAR_NAMED(global_linux_bootargs_, global.linux.bootargs.*, "Linux bootargs variables"); BAREBOX_MAGICVAR_NAMED(global_linux_mtdparts_, global.linux.mtdparts.*, "Linux mtdparts variables"); +BAREBOX_MAGICVAR_NAMED(global_linux_blkdevparts_, global.linux.blkdevparts.*, "Linux blkdevparts variables"); diff --git a/common/console_common.c b/common/console_common.c index d88e678aa..41a6929db 100644 --- a/common/console_common.c +++ b/common/console_common.c @@ -97,7 +97,7 @@ void log_clean(unsigned int limit) } } -void pr_puts(int level, const char *str) +static void pr_puts(int level, const char *str) { struct log_entry *log; diff --git a/common/environment.c b/common/environment.c index 7e176b3a7..f6fd781a8 100644 --- a/common/environment.c +++ b/common/environment.c @@ -256,6 +256,12 @@ int envfs_save(const char *filename, const char *dirname, unsigned flags) void *buf = NULL, *wbuf; struct envfs_entry *env; + if (!filename) + filename = default_environment_path_get(); + + if (!dirname) + dirname = "/env"; + data.writep = NULL; data.base = dirname; @@ -543,6 +549,12 @@ int envfs_load(const char *filename, const char *dir, unsigned flags) int ret = 0; size_t size, rsize; + if (!filename) + filename = default_environment_path_get(); + + if (!dir) + dir = "/env"; + envfd = open(filename, O_RDONLY); if (envfd < 0) { printf("environment load %s: %s\n", filename, errno_str()); diff --git a/common/imd.c b/common/imd.c index 2c837d6f2..f84e34473 100644 --- a/common/imd.c +++ b/common/imd.c @@ -22,6 +22,13 @@ #include #include #include + +#ifndef CONFIG_CMD_IMD +int imd_command_setenv(const char *variable_name, const char *value) +{ + return -ENOSYS; +} +#endif #endif /* diff --git a/common/memory_display.c b/common/memory_display.c index c8ae57a59..7b1d35ec4 100644 --- a/common/memory_display.c +++ b/common/memory_display.c @@ -1,5 +1,6 @@ #include #include +#include #define DISP_LINE_LEN 16 @@ -26,18 +27,41 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int for (i = 0; i < linebytes; i += size) { if (size == 4) { u32 res; - res = (*uip++ = *((uint *)addr)); + data_abort_mask(); + res = *((uint *)addr); if (swab) res = __swab32(res); - count -= printf(" %08x", res); + if (data_abort_unmask()) { + res = 0xffffffff; + count -= printf(" xxxxxxxx"); + } else { + count -= printf(" %08x", res); + } + *uip++ = res; } else if (size == 2) { u16 res; - res = (*usp++ = *((ushort *)addr)); + data_abort_mask(); + res = *((ushort *)addr); if (swab) res = __swab16(res); - count -= printf(" %04x", res); + if (data_abort_unmask()) { + res = 0xffff; + count -= printf(" xxxx"); + } else { + count -= printf(" %04x", res); + } + *usp++ = res; } else { - count -= printf(" %02x", (*ucp++ = *((u_char *)addr))); + u8 res; + data_abort_mask(); + res = *((u_char *)addr); + if (data_abort_unmask()) { + res = 0xff; + count -= printf(" xx"); + } else { + count -= printf(" %02x", res); + } + *ucp++ = res; } addr += size; offs += size; diff --git a/defaultenv/defaultenv-2-base/bin/init b/defaultenv/defaultenv-2-base/bin/init index 34807bcf5..30651e55d 100644 --- a/defaultenv/defaultenv-2-base/bin/init +++ b/defaultenv/defaultenv-2-base/bin/init @@ -37,6 +37,7 @@ fi # allow to stop the boot before execute the /env/init/* # but without waiting timeout -s -a -v key 0 +autoboot="$?" if [ "${key}" = "q" ]; then ${login_cmd} @@ -57,8 +58,10 @@ fi [ -n ${login_cmd} ] && global.console.input_allow=1 -timeout -a $global.autoboot_timeout -v key -autoboot="$?" +if [ "$autoboot" = 0 ]; then + timeout -a $global.autoboot_timeout -v key + autoboot="$?" +fi [ -n ${login_cmd} ] && global.console.input_allow=0 diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 584e2f324..1f11bb368 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -44,6 +44,9 @@ int clk_enable(struct clk *clk) { int ret; + if (!clk) + return 0; + if (IS_ERR(clk)) return PTR_ERR(clk); @@ -68,6 +71,9 @@ int clk_enable(struct clk *clk) void clk_disable(struct clk *clk) { + if (!clk) + return; + if (IS_ERR(clk)) return; @@ -89,10 +95,15 @@ unsigned long clk_get_rate(struct clk *clk) struct clk *parent; unsigned long parent_rate = 0; + if (!clk) + return 0; + if (IS_ERR(clk)) return 0; parent = clk_get_parent(clk); + + if (!IS_ERR_OR_NULL(parent)) parent_rate = clk_get_rate(parent); @@ -107,6 +118,9 @@ long clk_round_rate(struct clk *clk, unsigned long rate) unsigned long parent_rate = 0; struct clk *parent; + if (!clk) + return 0; + if (IS_ERR(clk)) return 0; @@ -125,6 +139,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate) struct clk *parent; unsigned long parent_rate = 0; + if (!clk) + return 0; + if (IS_ERR(clk)) return PTR_ERR(clk); diff --git a/drivers/firmware/altera_serial.c b/drivers/firmware/altera_serial.c index c5ffbb639..4527d27c5 100644 --- a/drivers/firmware/altera_serial.c +++ b/drivers/firmware/altera_serial.c @@ -25,6 +25,7 @@ #include #include + /* * Physical requirements: * - three free GPIOs for the signals nCONFIG, CONFIGURE_DONE, nSTATUS @@ -67,13 +68,19 @@ static int altera_spi_open(struct firmware_handler *fh) * after about 2 µs the FPGA must acknowledge with * STATUS and CONFIG DONE lines at low level */ - ret = wait_on_timeout(2 * USECOND, + if (gpio_is_valid(this->nstat_gpio)) { + ret = wait_on_timeout(2 * USECOND, (gpio_get_value(this->nstat_gpio) == 0) && (gpio_get_value(this->confd_gpio) == 0)); + } else { + ret = wait_on_timeout(2 * USECOND, + (gpio_get_value(this->confd_gpio) == 0)); + } + if (ret != 0) { dev_err(dev, "FPGA does not acknowledge the programming initiation\n"); - if (gpio_get_value(this->nstat_gpio)) + if (gpio_is_valid(this->nstat_gpio) && gpio_get_value(this->nstat_gpio)) dev_err(dev, "STATUS is still high!\n"); if (gpio_get_value(this->confd_gpio)) dev_err(dev, "CONFIG DONE is still high!\n"); @@ -90,11 +97,16 @@ static int altera_spi_open(struct firmware_handler *fh) * after about 1506 µs the FPGA must acknowledge this step * with the STATUS line at high level */ - ret = wait_on_timeout(1600 * USECOND, + + if (gpio_is_valid(this->nstat_gpio)) { + ret = wait_on_timeout(1600 * USECOND, gpio_get_value(this->nstat_gpio) == 1); - if (ret != 0) { - dev_err(dev, "FPGA does not acknowledge the programming start\n"); - return ret; + if (ret != 0) { + dev_err(dev, "FPGA does not acknowledge the programming start\n"); + return ret; + } + } else { + udelay(1600); } dev_dbg(dev, "Initiating passed\n"); @@ -177,16 +189,24 @@ static int altera_spi_close(struct firmware_handler *fh) * when programming was successful, * both status lines should be at high level */ - ret = wait_on_timeout(10 * USECOND, + if (gpio_is_valid(this->nstat_gpio)) { + ret = wait_on_timeout(10 * USECOND, (gpio_get_value(this->nstat_gpio) == 1) && (gpio_get_value(this->confd_gpio) == 1)); + } else { + ret = wait_on_timeout(10 * USECOND, + (gpio_get_value(this->confd_gpio) == 1)); + + } + if (ret == 0) { dev_dbg(dev, "Programming successful\n"); return ret; } dev_err(dev, "Programming failed due to time out\n"); - if (gpio_get_value(this->nstat_gpio) == 0) + if (gpio_is_valid(this->nstat_gpio) && + gpio_get_value(this->nstat_gpio) == 0) dev_err(dev, "STATUS is still low!\n"); if (gpio_get_value(this->confd_gpio) == 0) dev_err(dev, "CONFIG DONE is still low!\n"); @@ -201,10 +221,15 @@ static int altera_spi_of(struct device_d *dev, struct fpga_spi *this) int ret; name = "nstat-gpio"; - this->nstat_gpio = of_get_named_gpio(n, name, 0); - if (this->nstat_gpio < 0) { - ret = this->nstat_gpio; - goto out; + if (!of_get_property(n, name, NULL)) { + dev_info(dev, "nstat-gpio is not specified, assuming it is not connected\n"); + this->nstat_gpio = -1; + } else { + this->nstat_gpio = of_get_named_gpio(n, name, 0); + if (this->nstat_gpio < 0) { + ret = this->nstat_gpio; + goto out; + } } name = "confd-gpio"; @@ -225,9 +250,13 @@ static int altera_spi_of(struct device_d *dev, struct fpga_spi *this) ret = gpio_direction_output(this->nconfig_gpio, 1); if (ret) return ret; - ret = gpio_direction_input(this->nstat_gpio); - if (ret) - return ret; + + if (gpio_is_valid(this->nstat_gpio)) { + ret = gpio_direction_input(this->nstat_gpio); + if (ret) + return ret; + } + ret = gpio_direction_input(this->confd_gpio); if (ret) return ret; diff --git a/drivers/led/led-gpio.c b/drivers/led/led-gpio.c index a1a661724..ae3f13f45 100644 --- a/drivers/led/led-gpio.c +++ b/drivers/led/led-gpio.c @@ -204,6 +204,7 @@ static int led_gpio_of_probe(struct device_d *dev) for_each_child_of_node(dev->device_node, child) { struct gpio_led *gled; + const char *default_state; enum of_gpio_flags flags; int gpio; const char *label; @@ -225,6 +226,13 @@ static int led_gpio_of_probe(struct device_d *dev) led_gpio_register(gled); led_of_parse_trigger(&gled->led, child); + + if (!of_property_read_string(child, "default-state", &default_state)) { + if (!strcmp(default_state, "on")) + led_gpio_set(&gled->led, 1); + else if (!strcmp(default_state, "off")) + led_gpio_set(&gled->led, 0); + } } return 0; diff --git a/drivers/net/designware.c b/drivers/net/designware.c index 49ed0b192..29a6047c7 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -406,6 +406,9 @@ static void dwc_version(struct device_d *dev, u32 hwid) static int dwc_probe_dt(struct device_d *dev, struct dw_eth_dev *priv) { + if (!IS_ENABLED(CONFIG_OFTREE)) + return -ENODEV; + priv->phy_addr = -1; priv->interface = of_get_phy_mode(dev->device_node); diff --git a/images/Makefile b/images/Makefile index 7c3aaf762..f7e978cde 100644 --- a/images/Makefile +++ b/images/Makefile @@ -54,7 +54,7 @@ $(pbl-lds): $(obj)/../arch/$(ARCH)/lib/pbl.lds.S FORCE $(call if_changed_dep,cpp_lds_S) quiet_cmd_elf__ ?= LD $@ - cmd_elf__ ?= $(LD) $(LDFLAGS) -static --gc-sections -pie \ + cmd_elf__ ?= $(LD) $(LDFLAGS) --gc-sections -pie \ -e $(2) -Map $@.map $(LDFLAGS_$(@F)) -o $@ \ -T $(pbl-lds) \ --start-group $(barebox-pbl-common) --end-group diff --git a/include/abort.h b/include/abort.h new file mode 100644 index 000000000..7f14cb0bb --- /dev/null +++ b/include/abort.h @@ -0,0 +1,37 @@ +#ifndef __ABORT_H +#define __ABORT_H + +#include + +#ifdef ARCH_HAS_DATA_ABORT_MASK + +/* + * data_abort_mask - ignore data aborts + * + * If data aborts are ignored the data abort handler + * will just return. + */ +void data_abort_mask(void); + +/* + * data_abort_unmask - Enable data aborts + * + * returns true if a data abort has happened between calling data_abort_mask() + * and data_abort_unmask() + */ +int data_abort_unmask(void); + +#else + +static inline void data_abort_mask(void) +{ +} + +static inline int data_abort_unmask(void) +{ + return 0; +} + +#endif + +#endif /* __ABORT_H */