summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/x86'Sascha Hauer2021-05-171-0/+3
|\
| * PCI: support PCI BIOS preassigned busesAhmad Fatoum2021-05-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running under UEFI, barebox should no redo PCI enumeration, because the UEFI implementation will likely already have drivers that won't cope with e.g. BAR addresses changing. The user-visible effect of this is that likely the framebuffer will stop working because the UEFI driver won't be able to access it any longer. Support this configuration by changing the PCI code to consult the new pcibios_assign_all_busses(). When it's true, there is no change to previous behavior. When it's false, reconfiguration is omitted and instead current configuration is read back from the bus. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20210416062436.332665-3-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/usb-gadget'Sascha Hauer2021-05-1711-4/+136
|\ \
| * | file_list: add file_list_detect_all()Ahmad Fatoum2021-05-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a common theme along the code that uses file_lists. Add a function that abstracts it. This could later be used to simplify this operation in the fastboot code. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-15-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | bbu: add function to directly add handlers into file_listAhmad Fatoum2021-05-121-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bbu_handlers_iterate() is only used for merging handlers into a file_list. This can be useful for other update mechanisms as well. Export a bbu_append_handlers_to_file_list that does this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-14-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fastboot/dfu: use system partitions as fall backAhmad Fatoum2021-05-123-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the new system partitions infrastructure to have fastboot and DFU fall back to using the same partitions if the global.usbgadget.dfu_function and global.fastboot_partitions are not set, respectively. No functional change intended for configurations that have SYSTEM_PARTITIONS disabled. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-13-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: add generic system partitions interfaceAhmad Fatoum2021-05-122-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both Fastboot and DFU have their own global variables that allow specifying the partitions that can be flashed via the environment. With the upcoming addition of the USB mass storage gadget, we will need some way to define the partitions there as well. Instead of adding yet another way download method-specific variable, add a generic global.system.partitions variable that can be specified on a per-board basis and can be used for all methods. Existing variables will still remain for backwards-compatibility, but when unset, it should fall back to this new parameter. This is done in the follow-up patches. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | param: introduce file-list parameter typeAhmad Fatoum2021-05-123-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DFU, fastboot and incoming mass storage support all use file lists as input, but individually check syntax correctness only on use. A dedicated file list parameter would improve the user experience and makes the code using it easier to handle: the struct file_list can be passed around directly instead of having to parse it first on use. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | string: implement strstarts along with strendsAhmad Fatoum2021-05-032-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both can be useful when parsing file paths. They are added to different files, because only one of them is available in upstream <linux/string.h>. The other we add to <string.h>, which contains more barebox-specific string functions. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: console: add log_writefile to write log into new fileAhmad Fatoum2021-05-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It can be useful to dump the log into the file, e.g. when doing an update from a USB flash drive with no serial peer attached. Add a function to facilitate this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | show_progress: add system wide progress stage notifierAhmad Fatoum2021-05-031-0/+43
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use case is e.g. board code that wants to register a client to light status LEDs to indicate system state when no serial output is available. This functionality doesn't increase code size due to linker GC when CONFIG_PROGRESS_NOTIFIER is disabled. There is a generic progress notifier provided that just logs the status. This could be shared with the booted kernel via pstore or the log as a whole written to a system setup USB drive. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/riscv'Sascha Hauer2021-05-176-3/+107
|\ \
| * | bootm: move ARM64 Linux image parsing to common directoryAhmad Fatoum2021-05-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux on RISC-V adopts the same structure as on ARM64 for both 32- and 64-bit kernel images and it's likely future architectures will as well. In preparation for adding RISC-V Linux boot support, move the bulk of the code to a common location for reusability. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210504104513.2640-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | gpio: generic: sync with upstream Linux gpio-mmio driverAhmad Fatoum2021-05-102-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The gpio-mmio driver in Linux v5.12 has evolved quite a bit since the last sync. It now supports big endian byte order, 64-bit registers as well as controllers that have both a dirin and dirout register. The latter is particularly interesting, because it's required for the SiFive GPIO controller ported in a later patch. This commit also touches gpio-mpc8xxx used on the LS1046A. Because bit and byte endianness can now be configured separately, the driver needs adjustment. We don't seem to support any boards that have the peripheral as little-endian, but this is fixed by this commit. Comparing other bgpio_init users with Linux shows no need for further fixups. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210427202309.32077-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | debug_ll: support <asm/debug_ll.h> to get rid of mach directoriesAhmad Fatoum2021-05-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux support has no arch/riscv/mach-* directories. If we can get rid of them, we could multi-image build all images at once. Only thing holding us back is <mach/debug_ll.h>. Add <asm/debug_ll.h> as alternative. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210427202309.32077-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | clk: add SiFive PRCI clock controller supportAhmad Fatoum2021-05-031-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Import U74 and U54 clock controller support from Linux v5.12. Unlike Linux, dependency wrpll-cln28hpc.c is compiled in unconditionally. Linker garbage collection will take care to omit it if unreferenced. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210427202309.32077-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | PBL: fdt: implement fdt_device_get_match_dataAhmad Fatoum2021-05-031-0/+9
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Currently, the generic DT image can't properly have a PBL console, because it's only known at runtime what system we are running on. As we already parse the FDT in the PBL to get the memory regions, we could extract the board compatible as well and determine which UART to use. Add a helper to achieve this. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20210410110638.2106658-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / driver: add flag to check if cdev is an mci deviceMarco Felsch2021-05-121-0/+6
|/ | | | | | | | | | We need this during mount() to check if the cdev is an mmc/mci main|user hardware partition device. Later on we add the feature to pass "root=/dev/mmcblkXpN" as kernel command line. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20210510102523.7147-1-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/virtio'Sascha Hauer2021-04-154-0/+179
|\
| * input: add virtio input driverAhmad Fatoum2021-04-134-0/+179
| | | | | | | | | | | | | | | | | | | | | | We already support Linux event codes, because they are used in the device tree bindings for e.g. gpio-keys. Virtio input devices report events using the same codes, so a driver just has to shovel the codes from virtqueue into the input layer. Do so. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2021-04-152-2/+11
|\ \
| * | atmel_lcdfb: fix atmel,lcd-wiring-mode; BGR => BRGSam Ravnborg2021-04-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fix spelling error that prevented us from getting the atmel,lcd-wiring-mode The Bindings mandate the use of BRG. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
| * | resource: enable use of iomem command on EFI systemsAhmad Fatoum2021-04-131-0/+9
| |/ | | | | | | | | | | | | | | | | | | | | | | iomem was so far unimplemented for EFI, because barebox didn't know what to put there as the UEFI implementation does the heavy lifting. Add an initcall that uses the EFI get_memory_map entry point to remedy this. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.pengutronix.de/20210410110355.2105448-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/gpio'Sascha Hauer2021-04-151-0/+26
|\ \
| * | gpiolib: add Linux-like gpiod_get() helperAhmad Fatoum2021-04-131-0/+26
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Many Linux drivers use [devm_]gpiod_get to get appropriately configured GPIO descriptors out with little code. Make porting such Linux code easier by providing a semi-compatible gpiod_get function. Main differences: - It returns a gpio index, so it can be passed to any gpio_ function - It's device-tree only, so it should only be used from drivers that themselves probe from device tree. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.pengutronix.de/20210410103511.2073504-1-ahmad@a3f.at
* / clock: Change cyc2ns return type to uint64_tJules Maselbas2021-03-261-1/+1
|/ | | | | | | | | | | Using an uint32_t to count nanosec will overflow every ~4sec, this means that if get_time_ns is not called often enough the time keeping will be wrong. By changing the return type to uint64_t doesn't fix the underlying overflow issue but it will take more than 500 years to happen and I think it's safe to assume this won't be an issue. Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: detect RISC-V imagesAhmad Fatoum2021-03-231-0/+2
| | | | | | | | | | We still have no boot support for RISC-V, take the first step by enabling barebox to detect both a RISC-V Linux kernel and barebox image. The header format is aligned with that of arm64, but they differ in the signature magic. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* RISC-V: add cacheless HAS_DMA supportAhmad Fatoum2021-03-231-0/+1
| | | | | | | | Define some stubs, so we can get virtio MMIO working on RISC-V in QEMU. As we don't yet have MMU support, this is sufficient. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: make ARM_USE_COMPRESSED_DTB available for other archesAhmad Fatoum2021-03-231-0/+33
| | | | | | | | | | Other PBL-enabled architecture can benefit from compressed dtbs as well. Move symbol and code to a comm place to be able to use it from RISC-V in a later commit. In order not to break out of tree boards at runtime, the old symbol name is maintained for ARM. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/virtio'Sascha Hauer2021-03-234-13/+221
|\
| * virtio: support virtio-based device drivers over PCIAhmad Fatoum2021-03-041-0/+208
| | | | | | | | | | | | | | | | | | This driver provides support for virtio based paravirtual device drivers over PCI. This is useful with Qemu for boards that barebox has PCI support for, e.g. MIPS Malta. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * PCI: port Linux pci_find_capabilityAhmad Fatoum2021-03-041-0/+5
| | | | | | | | | | | | | | Incomding Linux virtio_pci code uses these functions, so port them over. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * virtio: fix support for big-endian clientsAhmad Fatoum2021-03-041-1/+2
| | | | | | | | | | | | | | | | With virtio 1.0 everything is little endian. Add back the Version 1.0 check that got lost during porting virtio to barebox. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * virtio: ring: fix erroneous behavior around caches and MMUAhmad Fatoum2021-03-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | The U-Boot code assumes 1:1 phys2virt mapping and either disabled caches or a lot of luck. Use the DMA API to get appropriate addresses for DMA and use coherent/streaming DMA mappings where appropriate. This is required for proper operation on MIPS. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * virtio: remove unused, left-over, virtio_config_ops::set_featuresAhmad Fatoum2021-03-011-7/+0
| | | | | | | | | | | | | | | | | | Linux finalize_features was renamed to set_features in the U-Boot port. We adhere to the Linux naming and set_features is unused anywhere. Drop it. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * virtio: align virtio_config_ops::generation return type with LinuxAhmad Fatoum2021-03-011-5/+4
| | | | | | | | | | | | | | | | The U-Boot return type for the function differs from Linux. We use the Linux API elsewhere, so use it here as well. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/usb'Sascha Hauer2021-03-231-0/+5
|\ \
| * | usb: storage: add support for drivers larger than 2TiBAhmad Fatoum2021-03-011-0/+5
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Consumer USB disks usually have emulated 512 byte sectors at the USB/SCSI level, which means SCSI Read/Write/Capacity 10 can only handle up to 2TiB USB disks. Add support for the optional 16 byte command variants to handle disks larger than that. Disks smaller than 2 TiB should not be affected. Tested with 2 different 4TiB disks as well as one 2TiB disk. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/riscv'Sascha Hauer2021-03-231-0/+2
|\ \
| * | bootm: add RISC-V image typeAntony Pavlov2021-03-151-0/+2
| | | | | | | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/misc'Sascha Hauer2021-03-234-19/+48
|\ \ \
| * | | reset: Remove WARN_ON when CONFIG_RESET_CONTROLLER=nJules Maselbas2021-03-161-7/+0
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | fs: delete unused members in <linux/stat.h>Ahmad Fatoum2021-03-161-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of the struct is stuff we don't use and likely won't any time soon. Drop them. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | stringlist: Initialize HEAD str member to NULLSascha Hauer2021-03-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | HEAD str member should be unused, but when it's used accidently then at least make sure we do not use an uninitialized string. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | stringlist: Add adding sort uniqSascha Hauer2021-03-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Function to add an entry sorted to a string list only when it doesn't exist. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | video: add simplefb driverAhmad Fatoum2021-03-011-0/+46
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | barebox has support to fix up a framebuffer it has set up as simplefb into the device tree of a kernel it boots. Add the counterpart to this, so barebox itself can reuse an already set up frame buffer. This is done to support the framebuffer device on the tinyemu RISC-V machine. 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-234-8/+79
|\ \ \
| * | | common: introduce bthreads, co-operative barebox threadsAhmad Fatoum2021-03-224-8/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the new setjmp/longjmp/initjmp support, we have all the architecture support in place to have suspendable green threads in barebox. These are expected to replace pollers and workqueues. For now we still have a differentiation between the main and secondary threads. The main thread is allowed I/O access unconditionally. If it's in a delay loop, a secondary thread running needs to be wary of not entering the same driver and doing hardware manipulation. We already have slices as mechanism to guard against this, but they aren't used as widely as needed. Preferably, in the end, threads will automatically yield until they can claim a resource (i.e. lock a mutex). Until we are there, take the same care when using bthreads as with pollers. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | common: poller: replace explicit calls to poller_call() with resched()Ahmad Fatoum2021-03-171-0/+12
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We won't replace pollers with bthreads completely over night. To make migration easier, replace explicit calls to poller_call with a new resched() function. This can be made to call bthread_reschedule() in future and eventually replaced with bthread_reschedule() once pollers are removed. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | glob: use empty globfree when compiling without CONFIG_GLOBAhmad Fatoum2021-03-221-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already return an error code unconditionally when building with !CONFIG_GLOB. We need to do the same for globfree. Otherwise, we run risk of corrupting memory. This issue exists since the code was first added, but it became more acute with 90cde3b9ff46 ("startup: Execute init scripts in alphabetical order"), which added a globfree into the shell init. Configuration without CONFIG_GLOB would from then on experience memory corruption during startup. Reported-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>