- 07 Dec, 2015 2 commits
-
-
Bernhard Nortmann authored
This patch introduces a new function aw_write_buffer() to allow a better distinction between FEL write operations. aw_fel_write() is meant for "privileged" internal use, while aw_write_buffer() now represents the preferred entry point for user code like the "write", "fill" or "clear" commands. There is some deliberate code duplication here that makes sense when combined with the next patch, where the aw_usb_write() call will differ. We want aw_fel_write() to enforce no progress update/callback, while aw_write_buffer() will (optionally) support it. Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de> Reviewed-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-
Bernhard Nortmann authored
This patch adds two new source files that will deal with code related to progress callbacks and display. I have decided to keep this separate, as there will be many smaller routines involved, which otherwise would bloat fel.c unnecessarily. For starters, let's also move the gettime() function there. Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de> Reviewed-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-
- 24 Nov, 2015 3 commits
-
-
Siarhei Siamashka authored
When the CPU clock speed is set to 480 MHz by the U-Boot SPL, the performance of 'sunxi-fel write' transfers to DRAM improves from ~95 KB/s to ~510 KB/s. When the CPU clock speed is set to 1008 MHz by the U-Boot SPL, the performance of 'sunxi-fel write' transfers to DRAM improves from ~180 KB/s to ~510 KB/s. This means that the CPU is not a bottleneck for FEL transfers anymore. Further performance improvements are possible by increasing the AHB1 clock speed in the U-Boot SPL (up to something like ~900 KB/s). Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Peter Korsgaard <peter@korsgaard.com>
-
Siarhei Siamashka authored
The BROM in newer SoC variants doesn't enable MMU by default anymore. So in order to benefit from e4b3da2b ("fel: Faster USB transfers via 'fel write' to DRAM"), we need to be able to enable it from the 'sunxi-fel' tool. This patch can be interpreted as simply reverting the changes done by Allwinner and bringing back the MMU support in roughly the same way as it was before. That's why the values in the hardware registers and the translation table entries replicate the A20 setup. Additionally, the code is now more defensive and introduces new "canary" checks for certain known magic values in the coprocessor registers in order to safeguard against any unpleasant surprises. MMU tuning for A80 and A64 will probably need a more sophisticated setup with a second level page table. Because both the SRAM and the BROM reside in the same 1MB section there and we need finer granularity. In other words, enabling the MMU on A80 and A64 is not supported yet. Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Peter Korsgaard <peter@korsgaard.com>
-
Siarhei Siamashka authored
This helps to reduce code duplication if we want to read and write many different kinds of coprocessor registers. Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Peter Korsgaard <peter@korsgaard.com>
-
- 19 Nov, 2015 2 commits
-
-
Bernhard Nortmann authored
Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de> Acked-by: Peter Korsgaard <peter@korsgaard.com>
-
Bernhard Nortmann authored
- get rid of double includes - fix U-Boot source reference - get rid of "uboot_autostart" variable Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de> Acked-by: Peter Korsgaard <peter@korsgaard.com>
-
- 27 Oct, 2015 1 commit
-
-
Peter Korsgaard authored
So it doesn't error out if the symlink already exists (E.G. is pointing to the old name). Also add the -n option for consistency with the install target. Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Acked-by: Ian Campbell <ijc@hellion.org.uk>
-
- 23 Oct, 2015 3 commits
-
-
Ian Campbell authored
Allow for separate installation of tools and target-tools, to aid in packaging. By default everything the tools are installed into /usr/local/bin but this can be overridden using PREFIX= or BINDIR= on the make invocation. To enable this it was necessary to split fex2bin and bin2fex out from $(TOOLS) into $(FEXC_LINKS), because install(1) does not seem to have a mode which preserves symlinks so it needs to be done separately. Supports DESTDIR to allow for convenient installation into a staging dir for distro packaging convenience. Signed-off-by: Ian Campbell <ijc@hellion.org.uk> Acked-by: Peter Korsgaard <peter@korsgaard.com>
-
Ian Campbell authored
Target tools are those which are only useful on a target sunxi system (i.e. which probe hardware etc). Currently this is only sunxi-pio. At first I thought sunxi-nand-part might be included, but I think that is useful on NAND images as well as actual devices. This will allow for easier packaging, by letting packagers only include the target tools when building for a suitable ARM architecture. Signed-off-by: Ian Campbell <ijc@hellion.org.uk> Acked-by: Peter Korsgaard <peter@korsgaard.com>
-
Ian Campbell authored
Several of the tools here are too generic and/or short for distro packaging purposes (which like to try and avoid naming clashes in $PATH). Prefix the following with "sunxi-": - fexc - bootinfo - fel - pio - meminfo Do not prefix any of the fel "payloads" or raw binaries since they would not normally be installed in $PATH. Do not prefix "phoenix_info", since "phoenix" already seems like an appropriate prefix for this particular tool. Update in-tree callers, README and .gitignore accordingly. Signed-off-by: Ian Campbell <ijc@hellion.org.uk> Acked-by: Peter Korsgaard <peter@korsgaard.com>
-
- 03 Oct, 2015 3 commits
-
-
Bernhard Nortmann authored
This patch makes use of a new sunxi SPL header format, where fields for passing data to U-Boot are reserved. This allows the "fel" utility to provide specific pieces of information by setting these fields (which will be evaluated by U-Boot then). For now, we provide the memory location of the boot script file (boot.scr) this way. A suitably modified U-Boot can adjust the boot process accordingly and will auto-execute the script. Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de> Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-
Bernhard Nortmann authored
Information about the SoC-specific memory layout may be required across several places in the fel utility code. To avoid having to retrieve this information repeatedly, this patch modifies the aw_fel_get_sram_info() function to cache its result (via an internal static pointer). This makes it safe to call aw_fel_get_sram_info() wherever needed, while avoiding additional aw_fel_get_version() lookups, and potential surplus "no 'soc_sram_info' data for your SoC" warnings. Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de> Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-
Bernhard Nortmann authored
This patch moves retrieving the image header type into a function of its own. The idea is that fel "write" can and will also make use of this function to detect boot scripts (by IH_TYPE_SCRIPT). Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de> Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-
- 13 Sep, 2015 2 commits
-
-
Bernhard Nortmann authored
With glibc 2.20 (and newer), defining _BSD_SOURCE (only) will now generate compiler warnings similar to: /usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp] See the glibc 2.20 release notes, https://lwn.net/Articles/611162/ . This patch adds the required _DEFAULT_SOURCE. Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de> Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-
Bernhard Nortmann authored
Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de> Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-
- 08 Sep, 2015 7 commits
-
-
Siarhei Siamashka authored
Add a new field 'spl_addr' to the SoC description structure and adjust the code to honor it. This is needed for supporting Allwinner A80. Tested on Allwinner A20 by changing the 'spl_addr' to 0x28000 in the 'fel' tool and using a custom build of U-Boot (CONFIG_SPL_TEXT_BASE changed from 0x20 to 0x28020). Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com>
-
Siarhei Siamashka authored
Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com>
-
Siarhei Siamashka authored
The exit code path after detecting that the cache is enabled does not need to swap FEL stacks and backup buffers. This way we get the error actually reported by the 'fel' tool instead of the device getting locked up. The thunk code refuses to work if the caches are enabled because we don't want to deal with the instructions/data cache coherency yet. The caches are initially in a disabled state upon activating FEL mode on all currently known Allwinner processors. Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com>
-
Siarhei Siamashka authored
The safe area to upload and execute code via FEL may be different for different SoC variants (0x12000 for A80, 0x2000 for everything else), so we can't have it as a global compile time constant, but need need to treat it as a property of the SoC. This patch changes the code to pass the SoC info structure to a number of functions and adds a new 'scrath_addr' struct field to it. Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com>
-
Siarhei Siamashka authored
This is may be useful when adding support for new SoC variants. We want to be sure that the IRQ stack and the regular stack both reside at predictable locations in SRAM and such extra diagnostic message can confirm this. Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com>
-
Siarhei Siamashka authored
Fixes https://github.com/linux-sunxi/sunxi-tools/pull/32 Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com>
-
Siarhei Siamashka authored
It was designed to be used with the legacy u-boot-sunxi bootloader and has many assumptions, which are specific to it (a special FEL configuration, hardcoded addresses, etc.) The mainline U-Boot can now be booted over USB with the "fel uboot u-boot-sunxi-with-spl.bin" command. And this makes the old 'usb-boot' script obsolete. The presence of the 'usb-boot' script in the repository may confuse the users, so we are removing it now. The users of the old u-boot-sunxi bootloader still can always get this script from one of the old sunxi-tools tags. Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com>
-
- 29 Aug, 2015 2 commits
-
-
Bernhard Nortmann authored
Narrow down the scope of the "uboot_autostart" variable. The flag can be made local to main(), there's no need to keep it global. Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de> Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-
Bernhard Nortmann authored
This patch is to prevent the call to aw_fel_write_uboot_image() with insufficient file size. If a user passes a boot file smaller than 32K, e.g. on "fel spl sunxi-spl.bin", the expression (size - SPL_LEN_LIMIT) would end up negative, and causes a numeric underflow when passed to aw_fel_write_uboot_image() as "size_t len". This might incorrectly let that function assume a u-boot binary was passed, when actually it isn't supposed to act on the buffer at all. Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de> Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-
- 19 Aug, 2015 4 commits
-
-
Vishnu Patekar authored
Added fel spl support for H3. For H3 MMU is not enabled by BROM. This is tested on Orange Pi H3 Board. Reported-by: Cam Hutchison <camh@xdna.net> Signed-off-by: Vishnu Patekar <vishnupatekar0510@gmail.com> Tested-by: Cam Hutchison <camh@xdna.net> Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-
Vishnu Patekar authored
For A83T MMU is not enabled by BROM. U-boot SPL support is not yet added for A83T. tested using A33 u-boot binary. $fel spl u-boot-sunxi-with-spl.bin U-Boot SPL 2015.10-rc1-g1a8cf6d (Aug 17 2015 - 15:14:46) DRAM:Timeout initialising DRAM. it jumped to SPL and on serial it displayed above log from SPL. I'll try to add U-boot SPL support for A83T soon. Signed-off-by: Vishnu Patekar <vishnupatekar0510@gmail.com> Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-
Vishnu Patekar authored
Signed-off-by: Vishnu Patekar <vishnupatekar0510@gmail.com> Tested-by: Vishnu Patekar <vishnupatekar0510@gmail.com> Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-
Vishnu Patekar authored
On allwinner SOCs A33,H3, A83T MMU is not enabled by BROM, so don't exit if MMU is not enabled by BROM and return NULL. It was reported on A33 tablet and Orange Pi H3 Board. I've tested it on A33 tablet and A83T Dev Board by allwinner. Signed-off-by: VishnuPatekar <vishnupatekar0510@gmail.com> Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-
- 18 Aug, 2015 1 commit
-
-
Ian Campbell authored
A cross-binutils is generally a bit easier to get hold of, and in particular binutils-none-eabi (and binutils-arm-linux-gnueabi{,hf}) are available in Debian Jessie while the equivalent cross gcc is not. The only reason gcc/cpp are required are to strip the embedded Ruby code out before handing to the assembler, we can achieve the same by opening a multiline comment around the ruby instead. Care needs to be taken not to close the comment prematurely hence "*/" is written in the one place it is used as "\x2a/" (i.e. encoding the * in hex). Having done this we can pass the .S file directly to the cross-as. There is no change to the resulting header file. Signed-off-by: Ian Campbell <ijc@hellion.org.uk> Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-
- 01 Aug, 2015 1 commit
-
-
Bernhard Nortmann authored
A patch to extend the "fel spl" command to properly handle not only the SPL part of a combined u-boot-sunxi-with-spl.bin boot file, but additionally also transfer the main u-boot binary (image) contained within the second part of such files. This can simplify the boot process / steps required to get a proper FEL setup - e.g. it avoids having to select u-boot.bin vs. u-boot-dtb.bin, see e.g. http://lists.denx.de/pipermail/u-boot/2015-June/217476.html On top of that a new "fel uboot" command is introduced. As per suggestions on the mailing list, it will take such a combined (SPL + U-Boot) file and actually start U-Boot execution before the program exits. "uboot" may thus also be combined with other "write" commands to transfer additional files required for the boot (e.g. boot script, kernel, initrd). Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de> Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-
- 26 Feb, 2015 6 commits
-
-
Hans de Goede authored
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-
Siarhei Siamashka authored
This is needed to have feature parity with the normal boot mode, where the L2EN bit in the CP15 Auxiliary Control Register is set by the BROM code right from the start. And if L2EN is not set, then the Linux system ends up booted with the L2 cache disabled. According to the Cortex-A8 TRM, the L2 cache is only enabled when both L2EN bit and the C bit from the CP15 Control Register c1 are set. Because the BROM does not set the C bit, this change should not affect the functionality of the FEL mode in any way. Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com>
-
Siarhei Siamashka authored
Trying to use oversized initrd files (20 MB or more) can fail with the "libusb usb_bulk_send error -1" error message. To address this problem, we can split the transfer into smaller chunks and the problem disappears. Effectively, this is a revert of the older "fel: Increase timeout to 60 seconds instead of splitting bulk transfers" commmit. Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com>
-
Siarhei Siamashka authored
By adjusting the MMU translation table before restoring it and by enabling the I-cache with branch prediction, we can improve performance. The DRAM area (0x40000000-0xC0000000) becomes write-combine mapped and the BROM code becomes mapped as cacheable memory. This is expected to be safe and should not cause any coherency problems. Transfer speed improvements: A10 : ~330 KB/s -> ~600 KB/s A13 : ~330 KB/s -> ~600 KB/s A20 : ~320 KB/s -> ~960 KB/s A31s : ~250 KB/s -> ~510 KB/s Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com>
-
Siarhei Siamashka authored
The FEL BROM code has the MMU enabled for some reason (while I-cache and D-cache are disabled). Most likely the intention was to get a somewhat better performance. Everything is mapped as TEXCB=00000 (strongly ordered), except for the 0x00000000 (SRAM) and 0xFFF00000 (BROM) sections, which are mapped as TEXCB=00100 (normal uncached memory). This becomes a problem for the A13 SoC, because it has less SRAM than the other chips. A13 stores the MMU addresses translation table at 0x8000 and uses up 16 KiB of the SRAM space there (while the A10, A20 and A31s keep the MMU table in the secure SRAM at 0x20000). And because the 'spl' command needs space for backing up the FEL stacks, it was clashing with the MMU table. The solution is simple. We just backup the addresses translation table and disable the MMU before running the SPL. And then restore it back to the original state. This fixes problems on A13. Re-enabling the MMU in the end is only necessary to avoid performance losses. For example, the transfer speed of the 'fel write' command on A20 would drop from ~320 KB/s to ~260 KB/s without MMU. Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com>
-
Siarhei Siamashka authored
This allows to measure the USB data transfer speed for performance tuning purposes. Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com>
-
- 11 Feb, 2015 2 commits
-
-
Siarhei Siamashka authored
Now it is possible to load and execute the same U-Boot SPL, as used for booting from SD cards. Just a different delivery method (a USB OTG cable instead of an SD card) for handling exactly the same content. The only argument for this new command is the name of the SPL binary file (with a eGON header generated by the 'mksunxiboot' tool). Now the 'fel' tool can be run as: fel spl u-boot-sunxi-with-spl.bin Before this change, the SPL was only able to use the memory between addresses 0x2000 and ~0x5D00, totalling to something like ~15 KiB. This is the biggest contiguous area in SRAM, which is not used by the FEL code from the BROM. Unfortunately, it is rather small. And also the unusual starting offset was making it difficult to use the same SPL binary for booting from the SD card and via FEL. There are surely more unused parts of SRAM, but they are scattered across multiple locations, primarily because the FEL code from the BROM sets up two stacks at inconvenient locations (the IRQ handler stack at 0x2000, and a regular stack at 0x7000). Essentially, the problem to solve here is to ensure a sufficiently large and consistent SRAM address space for the SPL without any potentially SoC specific holes in the case of booting over USB via FEL. This is achieved by injecting special entry/exit thunk code, which is moving the data in SRAM to provide a contiguous space for the SPL at the beginning of SRAM, while still preserving the the data from the BROM elsewhere. When the SPL tries to return control back to the FEL code in the BROM, the thunk code moves the data back to its original place. Additionally, the eGON checksum is verified to ensure that no data corruption has happened due to some unexpected clash with the FEL protocol code from the BROM. So the thunk code takes care of the address space allocation uglyness and provides the U-Boot SPL with a somewhat nicer abstraction. Now the FEL booted SPL on A10/A13/A20/A31 can use up to 32 KiB of SRAM because the BROM data is saved to different SRAM section. There is also generic code, which does not rely on extra SRAM sections, but just glues together the unused free space from both BROM FEL stacks to provide something like ~21 KiB to the SPL. Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com>
-
Siarhei Siamashka authored
Now aw_fel_get_version() can get the SoC ID for internal usage from the other functions. And aw_fel_print_version() is used to print the formatted string to stdout. Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com>
-
- 24 Jan, 2015 1 commit
-
-
Olliver Schinagl authored
Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
-