summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* | | printk: fix inverted logic in print_hex_dump_debug()Sascha Hauer2021-03-161-1/+1
| |/ |/| | | | | | | | | | | | | print_hex_dump_debug() shall print a hexdump when debugging is enabled, not when it's disabled. Fixes: 5825231429 ("printk: port over Linux print_hex_dump_bytes/print_hex_dump_debug") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: mmu64: fix build for non-MMU configurationsAhmad Fatoum2021-03-151-1/+1
|/ | | | | | | | | | barebox only catches null pointer dereferences when MMU support is enabled. Thus the empty stubs should always be used on !CONFIG_MMU systems, disregarding whether CONFIG_ARCH_HAS_ZERO_PAGE is selected or not. 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-02-2213-0/+1911
|\
| * block: add VirtIO block device driverAhmad Fatoum2021-02-221-0/+203
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this driver enabled, -device virtio-blk-device can now be passed to Qemu for barebox to detect a VirtIO block device mapping a host file or block device. If barebox is passed as argument to the Qemu -kernel option, no device tree changes are necessary. Example: $ qemu-system-arm -m 256M -M virt -nographic \ -kernel build/images/barebox-dt-2nd.img \ -device virtio-rng-device \ -drive if=none,file=/tmp/first.hdimg,format=raw,id=hd0 \ -device virtio-blk-device,drive=hd0 \ -drive if=none,file=/tmp/second.hdimg,format=raw,id=hd1 \ -device virtio-blk-device,drive=hd1 Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * serial: add basic VirtIO console driverAhmad Fatoum2021-02-221-0/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this driver enabled, -device virtio-serial-device can now be passed to Qemu for barebox to detect a VirtIO console device. If barebox is passed as argument to the Qemu -kernel option, no device tree changes are necessary. Example: $ qemu-system-arm -m 256M -M virt -nographic \ -kernel build/images/barebox-dt-2nd.img \ -device virtio-serial-device \ -chardev socket,path=/tmp/foo,server,nowait,id=foo \ -device virtconsole,chardev=foo,name=console.foo Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * drivers: add support for memory-mapped VirtIO paravirtualizationAhmad Fatoum2021-02-2211-0/+1630
| | | | | | | | | | | | | | | | | | | | | | Sandbox is only useful to test barebox in isolation. For interaction between barebox and firmware/OS, Qemu is the better choice. Qemu supports specifying VirtIO devices on the command line, which it automatically fixes up into the device tree. This is nice. Add support for that. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/usb'Sascha Hauer2021-02-221-6/+0
|\ \
| * | usb: host: ehci: remove duplicated usb_host_detect() callsAhmad Fatoum2021-02-011-6/+0
| |/ | | | | | | | | | | | | | | With the last patch adding a fallback detect, we no longer need the duplication in the host controller drivers. Drop them. 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-224-0/+258
|\ \
| * | sound: add PWM beeper supportAhmad Fatoum2021-02-081-0/+33
| | | | | | | | | | | | | | | | | | | | | This driver can be used to drive a piezo-buzzer attached to a PWM. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | sound: add basic synthesizers for PCM beeper useAhmad Fatoum2021-02-082-0/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For beeping on PCM sound cards, barebox will need to synthesize samples. Add basic sine and square wave synthesizers to achieve this. Client code can either call __synth_F to explicitly select synth F or synth_F, which depending on CONFIG_SYNTH_SQUARES may expand to either __synth_F or a gain-adjusted __synth_generate_square. The latter is mainly useful for slow systems that can't synthesize enough sine samples in a poller without impacting boot performance. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | drivers: add sound card driver supportAhmad Fatoum2021-02-082-0/+49
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add driver core boilerplate for sound support in barebox. Using the provided API in <sound.h>, consumers can play beeps for a fixed duration of time. Playing beeps is not blocking and new beeps can be enqueued while one is already playing. They will be played in succession by a poller, which will also turn off the sound card when the beep tune is over. API is also available for blocking until all beeps are played and for cancelling an underway beep tune. The API could be later extended for arbitrary PCM audio, should the need arise. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/nvmem'Sascha Hauer2021-02-221-5/+38
|\ \
| * | nvmem: make nvmem_device_write/read publicMarco Felsch2021-01-191-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | Those functions already export their symbols so make it public available. Compared to the nvmem_device_cell_read/write() APIs these functions are a bit easier to use. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | nvmem: add missing stubsMarco Felsch2021-01-191-0/+14
| | | | | | | | | | | | | | | | | | | | | Add missing stubs for nvmem_device_cell_read/write(). Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | nvmem: sync stub return values with linux codeMarco Felsch2021-01-191-5/+5
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on linux commit: 8<------------------------------------------------------------------------ commit 20167b70c894f20cd01e2579fad206de440816ef Author: Bartosz Golaszewski <bgolaszewski@baylibre.com> Date: Fri Sep 21 06:40:22 2018 -0700 nvmem: use EOPNOTSUPP instead of ENOSYS Checkpatch emits warnings when using ENOSYS. Some of the frameworks started using EOPNOTSUPP as return values for API functions when given subsystem is disabled in Kconfig. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 8<------------------------------------------------------------------------ Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2021-02-223-1/+7
|\ \
| * | pbl: provide externally visible fdt_find_memAhmad Fatoum2021-02-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | of_find_mem can be used for generic DT images for other architectures as well. To support this, move the definition, so it can be used by others in the future. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>