summaryrefslogtreecommitdiffstats
path: root/arch/sandbox
Commit message (Collapse)AuthorAgeFilesLines
...
* sandbox: Fix stickypage.bin dependenciesSascha Hauer2021-10-112-8/+6
| | | | | | | | | | | stickypage.o is included in the build process once in arch/sandbox/board/Makefile using extra-y += stickypage.o and once again in arch/sandbox/Makefile using stickypage.bin: arch/sandbox/board/stickypage.o This doesn't work as expected. With parallel builds it can happen that the file is built twice confusing the build system. Create stickypage.bin in a single directory only. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/targettools'Sascha Hauer2021-10-071-0/+9
|\
| * scripts: allow building USB loader tools for target as wellAhmad Fatoum2021-10-021-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently build the USB loader tools only for the host (build) system, but it can be useful to cross compile them as well for the target. We already have some target tools, but support for those is easier, because they don't link against libraries. We use pkg-config to get cc and ld flags, but we always assume that pkg-config is for the host system and there is no well-defined way to request pkg-config for the target system. Support this by introducing a new CROSS_PKG_CONFIG. This will be consulted only for target tools and default to $(CROSS_COMPILE)pkgconfig. Users can override it as necessary, for example, with Yocto, pkg-config will be for the cross environment, so target tools can now be built with: export ARCH=sandbox CROSS_COMPILE=aarch64-linux-gnu- export CROSS_PKG_CONFIG=pkg-config scripts make targettools_defconfig make scripts Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210917174127.23345-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | asm-generic: include bitio.h from io.hAhmad Fatoum2021-08-231-1/+0
|/ | | | | | | | | | | | | | This is currently used on ARM and sandbox, but it's relevant for other platforms like x86 as well if driver code wants to make use of the functions defined within. MIPS and PowerPC already defines the symbols, but that's ok because <bitio.h> doesn't override existing macros. This works for MIPS, but not PowerPC, where those aren't macros. Fix that up. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210812121944.4419-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Revert "sandbox: hostfile: move initcall to earlier postcore level"Ahmad Fatoum2021-07-181-1/+1
| | | | | | | | | | | | | | The hostfile driver provides nvmem cells, which are consumed optionally by power and watchdog driver. Without deep probe there was no way to differentiate between a nvmem cell that has no provider at all and one with a provider that wasn't yet probed. The workaround is to move hostfile driver probe to an earlier initcall level. Now with deep probe support, this is no longer needed, thus revert commit 33be33ea617514df622a2a468b426e8a628c87e8. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210628064517.28636-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sandbox: turn into deep probe platformAhmad Fatoum2021-07-181-2/+14
| | | | | | | | | With previous commits sorting out the few remaining issues holding sandbox back from using deep probe, we can now enable it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210628064517.28636-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sandbox: fix probe order dependency between watchdog and powerAhmad Fatoum2021-07-181-8/+6
| | | | | | | | | | | | | | | | With incoming changes to enable deep probe for sandbox, watchdog driver may be probed before power driver, which so far didn't happen. Because the watchdog driver writes the same NVMEM cell read by the power driver, the original value of the nvmem cell (used for $global.system.reset) will be lost. Work around this by writing the WDG reset reason only at first watchdog enable which is guaranteed to happen after power driver probe. We don't need to reset the nvmem cell on watchdog disable, because all other reset methods will already overwrite the cell with the correct value. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210628064517.28636-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sandbox: power: set $global.system.reset=POR on poweroffAhmad Fatoum2021-07-181-3/+11
| | | | | | | | | | | | | | | | Now that the stickypage is a regular hostfile, it survives poweroff. This $global.system.reset will only be POR on first boot. For subsequent boots, the power driver must itself take care to write POR to the nvmem cell. While at it remove two minor issues: - src_offset is unused - len is used to store a length into. Its original value is unused Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210628064517.28636-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sandbox: ship sample environmentAhmad Fatoum2021-07-039-70/+84
| | | | | | | | | | | | | | | | | | | | The idea of the stickypage was to have a 4K memory region persistent over resets. This region was implemented as mmap of a temporary hostfile, which was created on first barebox start and maintained over resets. Usability was a bit lacking however: - The temporary files weren't deleted - state always showed warnings and errors on first boot. The banner telling users to ignore this wasn't best user experience - In the same vein, the power driver had logic to handle a fresh (zeroed) stickypage and interpret that as POR boot We can avoid all that, by just shipping a default stickypage and referencing that from DT. Do that. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210629063730.7001-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sandbox: hostfile: move initcall to earlier postcore levelAhmad Fatoum2021-06-211-1/+1
| | | | | | | | | | | | | | | Follow-up changes will have the hostfile provide nvmem cells to other drivers, which run at coredevice_ and device_ initcall levels. These drivers can't defer probe though, because access to the NVMEM cell is optional. Move the hostfile initcall earlier to allow for this. Once deep probe support is merged and enabled for sanbox, it should be possible to revert this commit and see no nvmem cell related warnings. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210619034516.6737-11-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sandbox: dts: fix unit-address for state partitionAhmad Fatoum2021-06-211-1/+1
| | | | | | Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210619034516.6737-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sandbox: use nvmem-reboot-mode instead of syscon-reboot-modeAhmad Fatoum2021-06-212-6/+11
| | | | | | | | | | | We have some syscon-reboot-mode users in tree, but no nvmem-reboot-mode yet. Use the new nvmem-cells binding to remedy this. Added benefit is that we no longer access unpartitioned space; The reboot mode is now clearly described in the device tree. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210619034516.6737-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sandbox: use nvmem on top of stickypage for reset reasonAhmad Fatoum2021-06-213-28/+45
| | | | | | | | | | | Watchdog and system reset driver use a byte in the sticky page to persist reset reason over reexec. So far, this was a byte outside partitioned space. With the new nvmem-cells binding, a partition can be dedicated to holding nvmem cells. Use that instead. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210619034516.6737-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: propagate errors inside barebox_register_{of, fdt} into initcallsAhmad Fatoum2021-06-021-3/+1
| | | | | | | | | | | | | | | Errors during device tree registration, while uncommon, are really annoying, because the system may limp along and it's not clear where the misbehavior originates from. Failing the initcall of the device tree would improve user experience in that error case. There is intentionally no early exit on error cases to give barebox a chance to probe the serial driver to actually report errors when DEBUG_LL is disabled. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210531071239.30653-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sandbox: watchdog: don't return positive values from set_timeoutAhmad Fatoum2021-05-031-1/+2
| | | | | | | | | | | | | | | | | | linux_watchdog_set_timeout() does return alarm(), which can never fail and returns either zero or a positive value. watchdog::set_timeout on the other hand should return either 0 or a negative number on error. Ignore linux_watchdog_set_timeout()'s return value, so watchdog_set_timeout propagates the correct value. This fixes an issue where seconds_to_expire wasn't updated on subsequent pings of this watchdog. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210426113408.24903-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sandbox: state: reword warning about initial state errorsAhmad Fatoum2021-04-131-4/+5
| | | | | | | | | The message didn't explicitly say it is expected behavior to not find barebox-state on startup. Reword the message to make this clearer. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.pengutronix.de/20210404111831.592821-2-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sandbox: env: set nv.autoboot=abort to drop to shellAhmad Fatoum2021-04-131-0/+1
| | | | | | | | | | | | | | barebox on sandbox defaults to network boot, which fails either due to missing TAP support (like not having CAP_NET_ADMIN) or because the files couldn't be fetched. Arguably, the most user-friendly thing is to drop to shell. Do so. Users can still override nv.autoboot if they want to boot differently. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.pengutronix.de/20210404111831.592821-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/virtio'Sascha Hauer2021-03-231-11/+0
|\
| * dma: move dma_map/unmap_single from ARM to common codeAhmad Fatoum2021-03-041-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There's nothing ARM specific about these functions. Move them to a common location, so other arches can use them as well. This also fixes a bug on ARM MMU=n configurations: Previously these two functions these functions only respected dma-ranges translation when compiled with MMU support. DMA address translation is applicable regardless of CPU use of MMU though. Now, dma-ranges should be respected unconditionally. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2021-03-233-0/+72
|\ \
| * | sandbox: add Xterm escape sequence backed LED driverAhmad Fatoum2021-03-163-0/+72
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is value in testing LED trigger conditions in sandbox, especially with the coming bthread work that should replace pollers, like the one used by the heartbeat trigger. To make this testable on sandbox as well, add a simple LED driver. It supports 5 brightness levels, which are reflected as dots in the terminal title. This requires a Xterm compatible terminal, but the LED is inactive by default, so other terminals aren't affected if they lack support. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/bthreads'Sascha Hauer2021-03-235-4/+207
|\ \
| * | bthread: disable ASan accounting for fibers on 32-bit sandboxAhmad Fatoum2021-03-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the sandbox architecture, we use __sanitizer_start_switch_fiber and __sanitizer_finish_switch_fiber to tell ASan when we switch stacks. If we don't, ASan complains that: ==2472828==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0xff9fc000; bottom 0xf3be8000; size: 0x0be14000 (199311360) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 This works on 64-bit sandbox, but 32-bit sandbox currently crashes on bthread -v: ==2469590==AddressSanitizer CHECK failed: ../../../../../src/libsanitizer/asan/asan_poisoning.cpp:37 "((AddrIsAlignedByGranularity(addr + size))) != (0)" (0x0, 0x0) #0 0xf7a4aa46 in AsanCheckFailed ../../../../../src/libsanitizer/asan/asan_rtl.cpp:73 #1 0xf7a6b5cf in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) ../../../../../src/libsanitizer/sanitizer_common/sanitizer_termination.cpp:78 #2 0xf7a4489f in __asan::PoisonShadow(unsigned long, unsigned long, unsigned char) ../../../../../src/libsanitizer/asan/asan_poisoning.cpp:37 #3 0xf7a4c81b in __asan_handle_no_return ../../../../../src/libsanitizer/asan/asan_rtl.cpp:595 #4 0x566a1ce7 in bthread_schedule /home/a3f/dl/barebox-stm32mp/common/bthread.c:178 #5 0x566a1d54 in bthread_reschedule /home/a3f/dl/barebox-stm32mp/common/bthread.c:165 #6 0x566a1d80 in bthread_trampoline /home/a3f/dl/barebox-stm32mp/common/bthread.c:56 #7 0x567f5bfb in coroutine_bootstrap (/home/a3f/dl/build/barebox/sandbox/barebox+0x1bdbfb) #8 0x567f5c4b in coroutine_trampoline (/home/a3f/dl/build/barebox/sandbox/barebox+0x1bdc4b) #9 0xf7f7056f (linux-gate.so.1+0x56f) #10 0xf7f70558 (linux-gate.so.1+0x558) #11 0x56892fff (/home/a3f/dl/build/barebox/sandbox/barebox+0x25afff) Just disable the special ASan accounting there until this is figured out. bthreads still function there, but ASan may yield false positives according to the message. This does not affect non-sandbox platforms. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | sandbox: asm: implement setjmp/longjmp/initjmpAhmad Fatoum2021-03-175-4/+204
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To extend incoming bthread support to sandbox, implement setjmp, longjmp and initjmp. Unlike bare metal platforms, setjmp() and longjmp() are readily provided on standard-conforming hosted platforms. initjmp() on the other hand requires us to be able to invoke a function with a user-supplied stack pointer, which isn't possible in standard C. For POSIX systems, there are two methods to portably achieve this though: - Use makecontext(2) to set up a new context. makecontext(2) was however removed in POSIX.1-2008 and at least GCC 10.2.1 ASan complains that it "doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!" - Use sigaltstack to set a new signal stack, raise the signal call, setjmp in the signal handler to store the new stack pointer, return regularly from signal handler and then longjmp back Both methods are implemented in QEMU. While QEMU uses the makecontext method by default, for the reasons described, import the second implementation and use it implement initjmp. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / sandbox: fix use of initialized variable in error pathAhmad Fatoum2021-03-221-2/+2
|/ | | | | | | | fd could be uninitialized in some error paths. Give it a value that close can be called on without adverse effect. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/sound'Sascha Hauer2021-02-227-77/+147
|\
| * sound: add SDL 2.0 sound driverAhmad Fatoum2021-02-084-0/+54
| | | | | | | | | | | | | | | | | | SDL 2.0.4 features SDL_QueueAudio, which we could use to just queue buffers for audio playback. Use it to implement the new sound API for the sandbox architecture. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * sandbox: migrate to SDL 2.0Ahmad Fatoum2021-02-085-80/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SDL 2.0 has been released more than 7 years ago and should be available everywhere. Replace barebox's SDL 1.2 with SDL 2.0 instead: - better maintained - At least on Debian, you can't install x86_64 and i386 libsdl-dev at the same time, which makes a quick use of CONFIG_SANDBOX_LINUX_I386 harder as the user needs to reinstall libraries. With SDL 2.0, it works - SDL 2.0 has easier audio API, which will be used in a later commit - Wayland support for sandbox video driver Port to SDL 2.0 and as we touch everything anyway, rename the sdl_ functions to start with sdl_video_ to differentiate from upcoming sdl_sound_. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2021-02-225-13/+11
|\ \
| * | sandbox: support 64-bit file IO in 32-bit buildAhmad Fatoum2021-02-164-13/+10
| | | | | | | | | | | | | | | | | | | | | | | | This allows an easy way to test upcoming changes to the barebox block layer to support 64-bit block IO. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | sandbox: increase MALLOC_SIZE from 4M to 16MAhmad Fatoum2021-02-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 4M of malloc space is quite limited when comparing this to the systems that run Linux and use barebox for bootstrap. Increase the malloc size in sandbox to be better able to test code that does bigger allocations. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | block: use 64-bit types for sector offset and count on all platformsAhmad Fatoum2021-02-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | barebox' use of int for the sector offset puts an upper bound of 1TB on the size of supported block devices, which is already exceeded by common place USB mass storage. Increasing the sizes involved to 64 bit like Linux does won't magically add missing driver support, but it gives us at least a fighting chance. Do so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | sandbox: fix unreliable block device detectionAhmad Fatoum2021-02-121-1/+1
| |/ |/| | | | | | | | | | | | | | | | | | | | | If barebox detects that an --image file is a block device, it will try to represent it as a block device internally as well, provided that the user didn't explicitly specify that it should be mapped as a character device instead. The hf_info::is_cdev member used to indicate this override wasn't initialized though, so detection was unreliable, Fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | sandbox: Kconfig: select all of PARTITION_DISK's dependenciesAhmad Fatoum2021-02-041-0/+1
|/ | | | | | | | | `make hosttools_defconfig` shows that PARTITION_DISK was selected without all its dependencies being enabled as well. Select the missing PARTITION symbol to fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sandbox: retire CONFIG_LINUX symbol in favor of CONFIG_SANDBOXAhmad Fatoum2020-11-271-5/+1
| | | | | | | | | | | | | 5211e428cbab ("image: Convert the IH_... values to enums") removed the IH_ARCH_LINUX enumeration value leading to breakage of sandbox configurations that enable bootm. Instead of reinstating IH_ARCH_LINUX, just use IH_ARCH_SANDBOX and remove mention of CONFIG_LINUX altogether, it's always true anyway when CONFIG_SANDBOX is true. Fixes: 5211e428cbab ("image: Convert the IH_... values to enums") Cc: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2020-11-101-1/+0
|\
| * sandbox: remove MXS tools from hosttools_defconfigRoland Hieber2020-11-091-1/+0
| | | | | | | | | | | | | | | | | | CONFIG_MXS_HOSTTOOLS currently only builds the tools mxsimage and mxsboot, which are both only needed to create bootable images for the MXS platform, and are not really useful as stand-alone host tools. Signed-off-by: Roland Hieber <rhi@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | sandbox: fix link error when UBSAN is selected without ASANAhmad Fatoum2020-10-191-6/+1
|/ | | | | | | | | | | | | dc7f1fce6747 ("sandbox: fix SANDBOX_UNWIND dependency to be KASAN only") already restricted ARCH_HAS_STACK_DUMP to be dependent only on AddressSanitizer being available. This change got lost by an erroneous merge conflict resolution in 39bdcdfb814a ("Merge branch 'for-next/misc' into master"). Fix it up. Fixes: 39bdcdfb814a ("Merge branch 'for-next/misc' into master") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/sandbox' into masterSascha Hauer2020-10-1417-184/+513
|\
| * sandbox: defconfig: enable new generic featuresAhmad Fatoum2020-10-131-2/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent commits have modified sandbox for easier support of many common features: - block devices - watchdogs - reset source - reboot mode - barebox state Enable those in defconfig along with some other useful options. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * sandbox: dts: include state node by defaultAhmad Fatoum2020-10-133-50/+47
| | | | | | | | | | | | | | | | | | | | | | | | For testing barebox-state, it would be nice to have a state pre-configured out-of-the-box. Add one to sandbox.dts. Because the barebox message on an non-configured state can looks quite scary, add an init script that tells the user that all is well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * sandbox: add watchdog driverAhmad Fatoum2020-10-135-0/+117
| | | | | | | | | | | | | | | | Add SIGALRM based watchdog driver. This can reset barebox if stuck and plays nicely with $global.system.reset. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * sandbox: dts: implement reboot modeAhmad Fatoum2020-10-131-1/+11
| | | | | | | | | | | | | | | | Having a default reboot mode in the device tree allows testing the functionality out of sandbox without prior setup. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * sandbox: power: implement reset source supportAhmad Fatoum2020-10-132-1/+25
| | | | | | | | | | | | | | | | We can differentiate between POR and RST by explicitly storing RST as reset reason when we invoke the reset handler. Do so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * sandbox: poweroff: migrate to driver probed from device treeAhmad Fatoum2020-10-134-43/+66
| | | | | | | | | | | | | | | | | | | | Follow-up will extend the poweroff driver to support system reset source. Set the stage by renaming the driver to power (as it does reset as well) and make it probe from device tree, so it can point at the system reset source syscon via phandle. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * sandbox: dts: define default environment nodeAhmad Fatoum2020-10-131-0/+20
| | | | | | | | | | | | | | | | | | Now that we can define a hostfile that's persistent over barebox resets, but does not rely on a hard coded filename, we can have an always-on environment node. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * sandbox: hostfile: maintain created temp files over resetAhmad Fatoum2020-10-133-9/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, hostfils without a barebox,filename are assigned a new temporary file on every start. For use of a hostfile syscon for reboot mode or reset source, we will need to persist the changes over a regular reset. This can easily be done by passing through all automatically created temporary file with an explicit --image option on subsequent runs. Do so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * sandbox: hostfile: support anonymous hostfiles in device treeAhmad Fatoum2020-10-133-5/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far use of hostfile in the device tree required us to hard code a file name. If we instead create a temporary file on demand, we can support: - environment - barebox-state - syscon for reset source and reboot mode out of the box with no dependency on external files. Do the necessary, so a hostfile device tree node without a barebox,filename gets a temporary file generated with the appropriate size. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * sandbox: hostfile: unify --image and direct device tree probeAhmad Fatoum2020-10-134-40/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 801b7cff0210 ("sandbox: hostfile: allow probing from device tree") added initial support for probing hostfiles out of a non-fixed up device tree. This was achieved by having the driver probe call linux_open if the device tree node doesn't contain a valid barebox,fd property. A mmap did not happen in that case and as such the node couldn't be used as a syscon. Fix this by unifying the binding for hostfiles added by --image and ones already in the device tree. Both will result in a device node with just a barebox,filename property. On pure init level, both kinds of hostfiles will be iterated through and filenames will be opened and mmaped. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * sandbox: dts: retire skeleton.dtsiAhmad Fatoum2020-10-122-15/+14
| | | | | | | | | | | | | | | | | | Follow up commits will flesh out the sandbox.dts and make most of what's in the skeleton.dtsi redundant. Merge the .dtsi with the .dts to have all the code at one place. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>