From b2e8ce4b7607b3c69d716b6b0a03fc7f22368c8b Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Wed, 17 Dec 2014 11:58:11 +0100 Subject: [PATCH 01/24] imd: provide dummy imd_command_setenv If CONFIG_CMD_IMD is not set there is no imd_command_setenv in the barebox binary that can be linked to. Although the whole imd infrastructure will be removed by the linker later in the build process as soon as it figures out that nothing inside barebox is using it, we still have to provide a dummy function to keep the build going. Fixes: In function `imd_command': undefined reference to `imd_command_setenv' Signed-off-by: Lucas Stach Signed-off-by: Sascha Hauer --- common/imd.c | 7 +++++++ 1 file changed, 7 insertions(+) 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 /* From 3170dc3885f4a96a26ec7cecdbfee5f569f08ea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich=20=C3=96lmann?= Date: Thu, 12 Feb 2015 08:52:01 +0100 Subject: [PATCH 02/24] docs: remove trailing whitespaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ulrich Ölmann Signed-off-by: Sascha Hauer --- Documentation/boards/mxs.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Documentation/boards/mxs.rst b/Documentation/boards/mxs.rst index cfcd4c70d..d6406e56a 100644 --- a/Documentation/boards/mxs.rst +++ b/Documentation/boards/mxs.rst @@ -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,7 +101,7 @@ 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) From d3f4ae5614c4d5beeb5f469102a181af1cef70f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich=20=C3=96lmann?= Date: Thu, 12 Feb 2015 08:52:02 +0100 Subject: [PATCH 03/24] docs: fix typos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ulrich Ölmann Signed-off-by: Sascha Hauer --- Documentation/boards/mxs.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/boards/mxs.rst b/Documentation/boards/mxs.rst index d6406e56a..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 @@ -107,10 +107,10 @@ the partition:: 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 -------------------- From f52cf03aad13b49c6ff756610e7d3a777e8ee15e Mon Sep 17 00:00:00 2001 From: Hubert Feurstein Date: Mon, 16 Feb 2015 14:03:18 +0100 Subject: [PATCH 04/24] common/bootargs: add blkdevparts variables The kernel command line option blkdevparts works like mtdparts, but for all block devices. So it can be used for eMMC devices without the need of a traditional partition table. Signed-off-by: Hubert Feurstein Signed-off-by: Sascha Hauer --- common/bootargs.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) 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"); From acc69bdddc50262b8f91034c248279d8dc734284 Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Mon, 16 Feb 2015 12:23:31 +0100 Subject: [PATCH 05/24] defaultenv-2: init: don't call timeout again if the user intervened With autoboot_timeout=0 the second 'timeout' might not get another character even if the user keeps a key pressed. So just reuse the key from the first call. Signed-off-by: Michael Olbrich Signed-off-by: Sascha Hauer --- defaultenv/defaultenv-2-base/bin/init | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 From 79b40a630d6e28a7453eedbe7a0b96084d678e29 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Tue, 17 Feb 2015 20:54:40 -0800 Subject: [PATCH 06/24] firmware: altera: Make nSTAT GPIO optional By taking parts of the programming handshaking protocol on faith it is possible to make due with only two GPIO for programming Altera FPGAs. This is not a very advisable practice, but sometime unavoidable in GPIO constrained designs. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/firmware/altera_serial.c | 59 ++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 15 deletions(-) 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; From fc0f289e74edb2fee15b1b0b8203e18493e55723 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 23 Feb 2015 08:46:54 +0100 Subject: [PATCH 07/24] OMAP and i.MX boards: do not set console= commandline parameter in environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is not necessary since for OMAP and i.MX the console= parameter is initialized by the serial driver. Signed-off-by: Sascha Hauer Suggested-by: Teresa Gámez --- arch/arm/boards/beagle/env/nv/linux.bootargs.base | 1 - arch/arm/boards/ccxmx51/env/nv/linux.bootargs.base | 1 - arch/arm/boards/guf-vincell/env/nv/linux.bootargs.base | 1 - arch/arm/boards/mx31moboard/env/nv/linux.bootargs.base | 1 - arch/arm/boards/panda/env/nv/linux.bootargs.base | 1 - arch/arm/boards/phytec-phycore-imx31/env/nv/linux.bootargs.base | 1 - arch/arm/boards/phytec-phycore-imx35/env/nv/linux.bootargs.base | 1 - .../defaultenv-phyflex-am335x/nv/linux.bootargs.base | 1 - .../defaultenv-phyflex-imx6/nv/linux.bootargs.base | 1 - 9 files changed, 9 deletions(-) delete mode 100644 arch/arm/boards/beagle/env/nv/linux.bootargs.base delete mode 100644 arch/arm/boards/ccxmx51/env/nv/linux.bootargs.base delete mode 100644 arch/arm/boards/guf-vincell/env/nv/linux.bootargs.base delete mode 100644 arch/arm/boards/mx31moboard/env/nv/linux.bootargs.base delete mode 100644 arch/arm/boards/panda/env/nv/linux.bootargs.base delete mode 100644 arch/arm/boards/phytec-phycore-imx31/env/nv/linux.bootargs.base delete mode 100644 arch/arm/boards/phytec-phycore-imx35/env/nv/linux.bootargs.base delete mode 100644 arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/nv/linux.bootargs.base delete mode 100644 arch/arm/boards/phytec-phyflex-imx6/defaultenv-phyflex-imx6/nv/linux.bootargs.base 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/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/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-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-phyflex-am335x/defaultenv-phyflex-am335x/nv/linux.bootargs.base b/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/nv/linux.bootargs.base deleted file mode 100644 index d7b01a168..000000000 --- a/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/nv/linux.bootargs.base +++ /dev/null @@ -1 +0,0 @@ -console=ttyO0,115200 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 From 86759346bac4477c6b3b34bbfc47bb42c46046a1 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 23 Feb 2015 08:52:36 +0100 Subject: [PATCH 08/24] boards: Use nv.linux.bootargs.console for setting the console= commandline parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using a dedicated variable makes it easier to change the console= parameter without affecting other values. Also the linux.bootargs.console variable is already used by common/console.c. Using the same variable in the environment avoids giving duplicate console= twice to the kernel Signed-off-by: Sascha Hauer Suggested-by: Teresa Gámez --- .../env/nv/{linux.bootargs.base => linux.bootargs.console} | 0 .../env/nv/{linux.bootargs.base => linux.bootargs.console} | 0 .../env/nv/{linux.bootargs.base => linux.bootargs.console} | 0 .../env/nv/{linux.bootargs.base => linux.bootargs.console} | 0 .../env/nv/{linux.bootargs.base => linux.bootargs.console} | 0 .../nv/{linux.bootargs.base => linux.bootargs.console} | 0 .../env/nv/{linux.bootargs.base => linux.bootargs.console} | 0 .../env/nv/{linux.bootargs.base => linux.bootargs.console} | 0 .../env/nv/{linux.bootargs.base => linux.bootargs.console} | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename arch/arm/boards/at91sam9m10ihd/env/nv/{linux.bootargs.base => linux.bootargs.console} (100%) rename arch/arm/boards/avnet-zedboard/env/nv/{linux.bootargs.base => linux.bootargs.console} (100%) rename arch/arm/boards/clep7212/env/nv/{linux.bootargs.base => linux.bootargs.console} (100%) rename arch/arm/boards/crystalfontz-cfa10036/env/nv/{linux.bootargs.base => linux.bootargs.console} (100%) rename arch/arm/boards/efika-mx-smartbook/env/nv/{linux.bootargs.base => linux.bootargs.console} (100%) rename arch/arm/boards/imx233-olinuxino/defaultenv-imx233-olinuxino/nv/{linux.bootargs.base => linux.bootargs.console} (100%) rename arch/arm/boards/lubbock/env/nv/{linux.bootargs.base => linux.bootargs.console} (100%) rename arch/arm/boards/radxa-rock/env/nv/{linux.bootargs.base => linux.bootargs.console} (100%) rename arch/arm/boards/versatile/env/nv/{linux.bootargs.base => linux.bootargs.console} (100%) 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/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/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/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/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 From b42a3e2f68f97464d60110c58ba5f5f0e4bc333b Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 26 Feb 2015 13:44:50 +0100 Subject: [PATCH 09/24] ARM: Allow to mask data aborts Sometimes it's useful to test if a memory operation works or aborts. This adds data_abort_mask() to ignore data aborts and data_abort_unmask() to enable them again. This is used in the next step for the 'md' command so that illegal addresses just show 'xxxxxxxx' instead of crashing the system. Signed-off-by: Sascha Hauer --- arch/arm/cpu/exceptions.S | 22 ++++++++++++++++++++ arch/arm/cpu/interrupts.c | 17 ++++++++++++++++ arch/arm/include/asm/barebox.h | 4 ++++ include/abort.h | 37 ++++++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 include/abort.h 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/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 */ From d8a6e1c2662aad2f5d9b4050a276b8e6b9fbb3b1 Mon Sep 17 00:00:00 2001 From: Jan Luebbe Date: Sun, 3 Aug 2014 17:51:38 +0200 Subject: [PATCH 10/24] ARM/mem: handle data aborts gracefully for md Sometimes memory ranges contain inaccessible registers which trigger a data abort when accessed. To handle this gracefully, we extend the data abort exception handler to ignore the exception when configured to do so. This allows detecting inaccessible memory from the md command. It will show XX for unreadable bytes instead. The previous behaviour: barebox@TI AM335x BeagleBone:/ md 0x50000000 unable to handle paging request at address 0x500000ac pc : [<8fe2e0dc>] lr : [<8fe2e0b9>] sp : 8ffff898 ip : 00000024 fp : 00000000 r10: 8bfa0204 r9 : 00000000 r8 : 8bfa0204 r7 : 00000100 r6 : 50000000 r5 : 8bfa0204 r4 : 00000004 r3 : 00000f00 r2 : 000000ac r1 : 00000004 r0 : 00000014 Flags: nZCv IRQs off FIQs on Mode SVC_32 [<8fe2e0dc>] (memcpy_sz+0x40/0x48) from [<8fe2f337>] (mem_read+0x3b/0x48) [<8fe2f337>] (mem_read+0x3b/0x48) from [<8fe2bb13>] (cdev_read+0x25/0x2e) [<8fe2bb13>] (cdev_read+0x25/0x2e) from [<8fe2c15b>] (devfs_read+0x1b/0x1e) [<8fe2c15b>] (devfs_read+0x1b/0x1e) from [<8fe2df5b>] (__read+0x43/0x5c) [<8fe2df5b>] (__read+0x43/0x5c) from [<8fe2e61f>] (read+0x2b/0x48) [<8fe2e61f>] (read+0x2b/0x48) from [<8fe1e4a5>] (do_mem_md+0xc1/0x144) [<8fe1e4a5>] (do_mem_md+0xc1/0x144) from [<8fe02889>] (execute_command+0x21/0x48) [<8fe02889>] (execute_command+0x21/0x48) from [<8fe061c1>] (run_list_real+0x549/0x634) [<8fe061c1>] (run_list_real+0x549/0x634) from [<8fe05b43>] (parse_stream_outer+0xdb/0x174) [<8fe05b43>] (parse_stream_outer+0xdb/0x174) from [<8fe06435>] (run_shell+0x29/0x54) [<8fe06435>] (run_shell+0x29/0x54) from [<8fe02889>] (execute_command+0x21/0x48) [<8fe02889>] (execute_command+0x21/0x48) from [<8fe061c1>] (run_list_real+0x549/0x634) [<8fe061c1>] (run_list_real+0x549/0x634) from [<8fe05efb>] (run_list_real+0x283/0x634) [<8fe31e1d>] (unwind_backtrace+0x1/0x64) from [<8fe24e61>] (panic+0x1d/0x34) [<8fe24e61>] (panic+0x1d/0x34) from [<8fe322c1>] (do_exception+0xd/0x10) [<8fe322c1>] (do_exception+0xd/0x10) from [<8fe32329>] (do_data_abort+0x21/0x2c) [<8fe32329>] (do_data_abort+0x21/0x2c) from [<8fe31fe8>] (data_abort+0x48/0x60) The new behaviour: barebox@TI AM335x BeagleBone:/ md 0x50000000 50000000: 00000060 00000000 00000000 00000000 `............... 50000010: 00000000 00000001 00000000 00000000 ................ 50000020: 00000000 00000000 00000000 00000000 ................ 50000030: 00000000 00000000 00000000 00000000 ................ 50000040: 00001ff0 400000ac 00000211 00000000 .......@........ 50000050: 00000a00 00000001 00000000 00000000 ................ 50000060: 00000000 00101001 22060514 10057016 ...........".p.. 50000070: 010f1111 8f070000 00000f40 00000000 ........@....... 50000080: 00000000 00000000 00000000 00000000 ................ 50000090: 00001000 00101001 22060514 10057016 ...........".p.. 500000a0: 010f1111 8f070000 00000f00 XXXXXXXX ................ 500000b0: XXXXXXXX XXXXXXXX 00000000 00000000 ................ 500000c0: 00001000 00101001 22060514 10057016 ...........".p.. 500000d0: 010f1111 8f070000 00000f00 XXXXXXXX ................ 500000e0: XXXXXXXX XXXXXXXX 00000000 00000000 ................ 500000f0: 00001000 00101001 22060514 10057016 ...........".p.. The current implementation breaks everything except ARM and takes several shortcuts which need to be implemented more cleanly. Suggestions are very welcome! Signed-off-by: Jan Luebbe Signed-off-by: Sascha Hauer --- common/memory_display.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) 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; From 977ce4d9e194228fbe47d69484109802b0cd22c4 Mon Sep 17 00:00:00 2001 From: Juergen Borleis Date: Fri, 27 Feb 2015 15:07:29 +0100 Subject: [PATCH 11/24] Docs: add some info about the Phytec's phyCORE-i.MX35 Signed-off-by: Juergen Borleis Signed-off-by: Sascha Hauer --- Documentation/boards/imx/Phytec-phyCORE-i.MX35.rst | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Documentation/boards/imx/Phytec-phyCORE-i.MX35.rst 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. From e0a076fa663cb6989b83b4da88d7db6a1431dabd Mon Sep 17 00:00:00 2001 From: Juergen Borleis Date: Fri, 27 Feb 2015 15:07:30 +0100 Subject: [PATCH 12/24] phyCORE-PXA270: switch to the new environment template Signed-off-by: Juergen Borleis Signed-off-by: Sascha Hauer --- .../boards/phytec-phycore-pxa270/env/config | 45 ------------------- .../env/init/mtdparts-nor | 11 +++++ .../env/nv/linux.bootargs.base | 1 + .../configs/phytec-phycore-pxa270_defconfig | 45 +++++++++---------- 4 files changed, 34 insertions(+), 68 deletions(-) delete mode 100644 arch/arm/boards/phytec-phycore-pxa270/env/config create mode 100644 arch/arm/boards/phytec-phycore-pxa270/env/init/mtdparts-nor create mode 100644 arch/arm/boards/phytec-phycore-pxa270/env/nv/linux.bootargs.base 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/phytec-phycore-pxa270/env/nv/linux.bootargs.base b/arch/arm/boards/phytec-phycore-pxa270/env/nv/linux.bootargs.base new file mode 100644 index 000000000..476b1fbe4 --- /dev/null +++ b/arch/arm/boards/phytec-phycore-pxa270/env/nv/linux.bootargs.base @@ -0,0 +1 @@ +console=ttyS0,115200 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 From f8e3c792ee9f323cf77a96bf88cb11141d21b86a Mon Sep 17 00:00:00 2001 From: Juergen Borleis Date: Fri, 27 Feb 2015 15:07:31 +0100 Subject: [PATCH 13/24] Docs: add some info about the Phytec's phyCORE-PXA270 Signed-off-by: Juergen Borleis Signed-off-by: Sascha Hauer --- Documentation/boards/pxa.rst | 11 +++++++++++ Documentation/boards/pxa/Phytec-phyCORE-PXA270.rst | 6 ++++++ 2 files changed, 17 insertions(+) create mode 100644 Documentation/boards/pxa.rst create mode 100644 Documentation/boards/pxa/Phytec-phyCORE-PXA270.rst 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. From 0cf58878d52cabd982d17682bb4a6242ad6e0f88 Mon Sep 17 00:00:00 2001 From: Juergen Borleis Date: Fri, 27 Feb 2015 15:07:32 +0100 Subject: [PATCH 14/24] phyCORE-MPC5200-Tiny: switch to the new environment template Signed-off-by: Juergen Borleis Signed-off-by: Sascha Hauer --- arch/ppc/boards/pcm030/env/init/mtdparts-nor | 11 +++++ .../boards/pcm030/env/nv/linux.bootargs.base | 1 + arch/ppc/configs/pcm030_defconfig | 42 +++++++++---------- 3 files changed, 33 insertions(+), 21 deletions(-) create mode 100644 arch/ppc/boards/pcm030/env/init/mtdparts-nor create mode 100644 arch/ppc/boards/pcm030/env/nv/linux.bootargs.base 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 From 8f455cd24bac834de66da1715546379b30f97b0f Mon Sep 17 00:00:00 2001 From: Juergen Borleis Date: Fri, 27 Feb 2015 15:07:33 +0100 Subject: [PATCH 15/24] Docs: add some info about the Phytec's phyCORE-MPC5200-Tiny Signed-off-by: Juergen Borleis Signed-off-by: Sascha Hauer --- Documentation/boards/powerpc.rst | 11 +++++++++++ .../boards/powerpc/Phytec-phyCORE-MPC5200-Tiny | 6 ++++++ 2 files changed, 17 insertions(+) create mode 100644 Documentation/boards/powerpc.rst create mode 100644 Documentation/boards/powerpc/Phytec-phyCORE-MPC5200-Tiny 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. From 5adb65518eae2ed93381f05dc83d2502d660133f Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Sun, 1 Mar 2015 14:12:37 +0100 Subject: [PATCH 16/24] ARM: do not specify -static and -pie at the same time PIE is a form of dynamic linking and thus inherently incompatible with -static. It worked ok as the current behavior of ld.bfd is to not respect -static if -pie has been specified. ld.gold and future versions of ld.bfd will fail to link if both of those incompatible switches are specified at the same time. Signed-off-by: Lucas Stach Signed-off-by: Sascha Hauer --- arch/arm/Makefile | 4 +++- arch/arm/pbl/Makefile | 5 +++-- images/Makefile | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index f0133d416..b3abcae46 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/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/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 From 32a629976e7fb4e098c5ee3213464520e2446ae4 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Sun, 1 Mar 2015 22:06:35 +0100 Subject: [PATCH 17/24] net: designware: don't depend on CONFIG_OFTREE This driver is written in a way that is should also work without DT, but it had a compile time dependency on CONFIG_OFTREE. Fixes: drivers/built-in.o: In function `dwc_probe_dt': drivers/net/designware.c:413: undefined reference to `of_get_phy_mode' Signed-off-by: Lucas Stach Signed-off-by: Sascha Hauer --- drivers/net/designware.c | 3 +++ 1 file changed, 3 insertions(+) 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); From 43f133f68b931c7aad318343aca56975690dd628 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Sun, 1 Mar 2015 22:06:36 +0100 Subject: [PATCH 18/24] menu: depend on !CONFIG_SHELL_NONE It doesn't make much sense to have the menuframework but no shell. Fixes: In function `menu_action_command': undefined reference to `run_command' Signed-off-by: Lucas Stach Signed-off-by: Sascha Hauer --- common/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/common/Kconfig b/common/Kconfig index d4373431a..cf197076d 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 From ec1b1b9eaa5e8653ec68f96669fe5025d2086962 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Sun, 1 Mar 2015 22:06:37 +0100 Subject: [PATCH 19/24] ARM: MIOA701: select POLLER Fixes: In function `gpio0_poweroff_probe': undefined reference to `poller_register' Signed-off-by: Lucas Stach Signed-off-by: Sascha Hauer --- arch/arm/mach-pxa/Kconfig | 1 + 1 file changed, 1 insertion(+) 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 From 6e9767f73c69b73b3b87c763436c2181fdafa26b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Teresa=20G=C3=A1mez?= Date: Fri, 27 Feb 2015 08:59:34 +0100 Subject: [PATCH 20/24] ARM: Fix nv variable bootargs.base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some console parameters where faulty named bootargs.base. Which does not have any effect. Removed them where possible and renamed the others to linux.bootargs.console. Signed-off-by: Teresa Gámez Signed-off-by: Sascha Hauer --- .../highbank/env/nv/{bootargs.base => linux.bootargs.console} | 0 .../phytec-phycard-imx6/defaultenv-phycard-imx6/nv/bootargs.base | 1 - .../env/nv/{bootargs.base => linux.bootargs.console} | 0 3 files changed, 1 deletion(-) rename arch/arm/boards/highbank/env/nv/{bootargs.base => linux.bootargs.console} (100%) delete mode 100644 arch/arm/boards/phytec-phycard-imx6/defaultenv-phycard-imx6/nv/bootargs.base rename arch/arm/boards/telit-evk-pro3/env/nv/{bootargs.base => linux.bootargs.console} (100%) 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/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/telit-evk-pro3/env/nv/bootargs.base b/arch/arm/boards/telit-evk-pro3/env/nv/linux.bootargs.console similarity index 100% rename from arch/arm/boards/telit-evk-pro3/env/nv/bootargs.base rename to arch/arm/boards/telit-evk-pro3/env/nv/linux.bootargs.console From e2290aef3139b9a987855f7f3bb887516483c052 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 4 Mar 2015 11:32:36 +0100 Subject: [PATCH 21/24] console: Make locally used function static Signed-off-by: Sascha Hauer --- common/console_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From 3d61b7b6a9b9967f4d3e64a985abd2500abb202d Mon Sep 17 00:00:00 2001 From: Hubert Feurstein Date: Wed, 4 Mar 2015 10:52:04 +0100 Subject: [PATCH 22/24] led: gpio: add support for default-state dt-property This patch adds support for the default-state device tree property. Signed-off-by: Hubert Feurstein Signed-off-by: Sascha Hauer --- drivers/led/led-gpio.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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; From 85799d1b755ad3ea1fd80cecd913eea6b00a5c87 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 5 Mar 2015 15:13:41 +0100 Subject: [PATCH 23/24] clk: Treat NULL as dummy clocks NULL pointers should be treated as dummy clocks as done in the kernel. Using a not fully filled in clk * array for of_clk_add_provider may result in NULL clks. When these are passed into the clk framework we should not crash. Signed-off-by: Sascha Hauer --- drivers/clk/clk.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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); From 7033089ddf4c62fa2cfd4549d2bbfe0c101c65d1 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Thu, 5 Mar 2015 15:37:14 +0100 Subject: [PATCH 24/24] environment: envfs_{load, save}: add possibility to call with filename and dirname == NULL This patch moves fallback to default into the envfs_{load,save} functions. Signed-off-by: Marc Kleine-Budde Signed-off-by: Sascha Hauer --- commands/saveenv.c | 10 +++------- common/environment.c | 12 ++++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) 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/environment.c b/common/environment.c index 2639411e2..eed4833c8 100644 --- a/common/environment.c +++ b/common/environment.c @@ -253,6 +253,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; @@ -540,6 +546,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());