| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
The debug_ll_write_reg function takes first the register
and secondly the value to write, which in this call were
inverted. Fix the argument order.
Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
Link: https://lore.barebox.org/20211004073842.14809-1-jmaselbas@kalray.eu
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This adds the suitable SPDX-License-Identifier to all files in drivers/
that previously lacked one.
To aid manual inspection, following heuristics can be used:
* No changes outside of comments/whitespace:
git show -U0 HEAD | rg -v '^(@@|diff|index)|[-+]([-+]|//|#|[\s/]\*)'
* -or-later come in pairs:
git show --inter-hunk-context=19 HEAD | \
perl -0777 -F'/^@/gm' -ne 'for (@F) { @m = /later/g; print if @m & 1 }'
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211030175632.2276077-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
An assigned-clock-parents referring to a fixed-clock will result in a
warning:
WARNING: clk: couldn't get parent clock 0 for /ethernet@fe300000
That's because the device for the fixed clock is created on demand and
even after ensuring probe, no driver will have bound against it as
CLK_OF_DECLARE operates outside the driver model.
Fix this by creating devices and binding the dummy driver while
iterating over the CLK_OF_DECLARE list. No functional change for
systems not enabling deep-probe.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211108075209.2366770-7-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
On several SoCs barebox is written to the raw device in front of the
first partition. So far we blindly trust that there is enough space
available for the barebox image. Start changing this by adding a
function that retrieves the available space.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.barebox.org/20211012073352.4071559-8-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Add driver_data pointer to be able to port more of kernel code for
micrel phy.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.barebox.org/20211013121825.4278-1-o.rempel@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Linux defines this macro at multiple places. We define it once, but in
<common.h>, which is a bit heavy weight. Move it next to the
ARRAY_SIZE() definition.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211030141739.2207431-5-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
<asm-generic/bug.h> so far depended on a preceding <common.h> to get the
dump_stack() definition. Move dump_stack() to the new printk.h and drop
the remaining puts() use to make header self-contained.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211030141739.2207431-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Including <stdio.h> for printf is a bit problematic, because it pulls in
other headers for <console.h>, which includes quite a few more headers
as well. To make it easier to share code between barebox and host tools
make <printk.h> the new minimal header for printf and move the extra
logging stuff into <linux/printk.h>.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211030141739.2207431-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There are no definitions for __sw_hweight*, so no point in keeping the
prototypes around. The scripts version of the header also ultimately
tries to access non-existing normal headers, so fix that up as well.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211030141739.2207431-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| | |
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Link: https://lore.barebox.org/20211028012816.929611-4-antonynpavlov@gmail.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
| |
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Link: https://lore.barebox.org/20211028012816.929611-2-antonynpavlov@gmail.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The dfu command now uses the composite multi gadget to register the usb
functionality. This allows the removal of the usb composite driver from
dfu.c
As the dfu command is blocking the command slice must be released while
the dfu gadget is running in order to do operations on the file system.
The usb_dfu_register() function is replaced with usb_dfu_detached() for
the dfu command to return a different value depending on if it has been
interrupted with CTRL-C or if the gadget has been detached.
Tested-by: Anže Lešnik <anze.lesnik@norik.com>
Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
Link: https://lore.barebox.org/20210910102931.26078-1-jmaselbas@kalray.eu
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
The parent_device member is unused anywhere, so drop it.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Link: https://lore.barebox.org/20210913083019.364599-1-ahmad@a3f.at
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This gives virtio-enabled boards an easy route to network connectivity:
qemu-system-aarch64 -M virt -serial mon:stdio -trace file=/dev/null \
-kernel images/barebox-dt-2nd.img -cpu cortex-a57 -nographic \
-device virtio-net-device,netdev=network0 -netdev tap,id=network0,ifname=tap0
The tap0 interface created by QEMU can then be bridged/listened on.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add CONFIG_CONSOLE_DISABLE_INPUT to initialize the consoles without
input support, making default bootup effectively non-interactive.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Tested-by: Christian Melki <christian.melki@t2data.com>
Link: https://lore.barebox.org/20210915123644.1292607-1-ahmad@a3f.at
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Move the usbgadget parse() function to file_list and rename it to
file_list_parse_null() which will return a NULL pointer instead of an
error. Also adjust the callers in the usbgadget code.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Link: https://lore.barebox.org/20210810052928.101783-1-r.czerwinski@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Add the NXP IFC nand driver support. This driver
can be used with the NXP QorIQ cores.
Originally, derived from U-boot commit cce573e (2015-10)
Signed-off-by: Renaud Barbier <renaud.barbier@abaco.com>
Link: https://lore.barebox.org/1628842608-17031-3-git-send-email-renaud.barbier@abaco.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In preparation for the introduction of the FSL IFC nand driver
for the layerscape CPU, add 64-bit counter support.
Remove functions calling undefined functions.
Signed-off-by: Renaud Barbier <renaud.barbier@abaco.com>
Link: https://lore.barebox.org/1628842608-17031-2-git-send-email-renaud.barbier@abaco.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
There are DDR3L, DDR4 and LPDDR4 variants of the i.MX8M* SoMs used with
the NXP EVKs. So far, we only supported LPDDR4. For DDR4, we just need
different PHY training code. Encode the DRAM variant information
into a new dram_timing_info::dram_type and adjust the driver to make use
of it. The new CONFIG_FIRMWARE_IMX_DDR4_PMU_TRAIN Kconfig symbol can
co-exist with CONFIG_FIRMWARE_IMX_LPDDR4_PMU_TRAIN, allowing the same
barebox binary to target different memory types, provided board code
can determine what kind of DRAM is fitted.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211001100949.6891-7-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
DRAM setup on i.MX8MP is the same as on the i.MX8MP, except for
DDRC_DDR_SS_GPR0, which the vendor's U-Boot port explicitly skips
on the nano, irrespective of the configured DRAM type. Do likewise.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211001100949.6891-6-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The problem with the BootROM is that the SRC registers are not set
accordingly in case of a failed primary boot. E.g. if the device is
configured to boot from an eMMC and the eMMC is empty or image is
corrupt, the BootROM goes into 'recovery boot mode' (reference manual
Figure 8-1) and the last possible recovery option is the serial
downloader. In such case the SRC registers still indicate that the
device was booted from an eMMC instead of serial-download.
This commit ports the U-Boot commit [1] with slightly adaptions suggested
by Ahmad to Barebox. Also we need to reorder the imx6_init() else we
reset the otg-controller to early.
[1] https://source.denx.de/u-boot/u-boot/-/commit/e203dcf23e9eabc2e4f3d0b079457cd1516f2081
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210812083651.3576-1-m.felsch@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
firmware_set_searchpath() is used to temporarily extend firmware search
path when parsing boot spec files. It does so by first freeing the
original firmware pointer and then storing a pointer to a copy of the
new search path.
firmware_get_searchpath() returns this pointer without copying meaning
that following sequence causes a use-after-free:
old_fws = firmware_get_searchpath();
firmware_set_searchpath(fws); /* calls free(old_fws) */
firmware_set_searchpath(old_fws);
Fix this by keeping around a copy of the search path.
Fixes: dfebbb0a5944 ("blspec: Set firmware searchpath")
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Link: https://lore.barebox.org/20210913082957.364440-1-ahmad@a3f.at
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
virtio parent device drivers (e.g. PCI and MMIO) create child devices
and free them on remove. The virtio drivers for the child devices (e.g.
block and console) however don't unregister with their respective
subsystems in the remove callbacks. So these subsystems may have stale
pointers pointing at removed devices. This is especially problematic for
the console driver, because the virtio console device_d will be removed,
but the console itself remains registered leading to a use-after-free
as soon as printf is invoked for the previously active console.
This leads to a crash when typing reset in
https://www.barebox.org/jsbarebox/?graphic=0
Fix this for all virtio drivers.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210916093458.21102-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds crypto_memneq() from Linux for the same reason it is present
in Linux. From the commit message adding it:
When comparing MAC hashes, AEAD authentication tags, or other hash
values in the context of authentication or integrity checking, it
is important not to leak timing information to a potential attacker,
i.e. when communication happens over a network.
Bytewise memory comparisons (such as memcmp) are usually optimized so
that they return a nonzero value as soon as a mismatch is found. E.g,
on x86_64/i5 for 512 bytes this can be ~50 cyc for a full mismatch
and up to ~850 cyc for a full match (cold). This early-return behavior
can leak timing information as a side channel, allowing an attacker to
iteratively guess the correct result.
This patch adds a new method crypto_memneq ("memory not equal to each
other") to the crypto API that compares memory areas of the same length
in roughly "constant time" (cache misses could change the timing, but
since they don't reveal information about the content of the strings
being compared, they are effectively benign). Iow, best and worst case
behaviour take the same amount of time to complete (in contrast to
memcmp).
Note that crypto_memneq (unlike memcmp) can only be used to test for
equality or inequality, NOT for lexicographical order. This, however,
is not an issue for its use-cases within the crypto API.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The device tree nodes for both barebox environment and state can have
phandles that reference partitions. Environment runs at late_initcall
level, so deep probe will have populated the device by the time the
probe is called. barebox-state however is probed at device_initcall
level and thus must take care itself to ensure the partition provider is
probed. Add a new of_partition_ensure_probed that does this. It can
handle both legacy and new style (fixed) partitions.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210628064517.28636-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When bthread were first merged, they could be scheduled in any context
and bthread_stop could just keep rescheduling until the bthread in
question exits after which it would return the exit code.
Now that bthreads are only scheduled in command context, bthread_stop
also can only be scheduled in command context, making it much less
useful and easier to shoot yourself in the foot with.
Avoid this by introducing a bthread_cancel function instead that will
asynchronously terminate the thread. For most purposes that should be
fine, because bthread_stop is used to synchronize cleanup and we can
move the cleanup into the thread instead.
The only exception is the bthread command, which relies on being able to
wait on bthreads to complete. For these __bthread_stop remains available,
but should not be used in new code.
This fixes a hang that is encountered when the usb mass storage gadget
unbind is called from a poller leading barebox to wait indefinitely.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210628070732.16812-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Follow-up commit will replace blocking bthread_stop with non-blocking
bthread_cancel. Prepare for this by dropping exit codes. This is not
much of a loss, because most users of bthreads will only call
bthread_stop at cleanup time. bthread command is an exception, so have
it take manual care of passing around exit codes.
As we touch the bthread_stop prototype anyway, rename it to
__bthread_stop. This will make it clearer in the future, that it's not
meant for driver use.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210628070732.16812-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This driver is based on the f_mass_storage drivers in Linux v5.11 and
U-Boot v2021.01.
Unlike the U-Boot version, it runs asynchronously without blocking the
bootloader from doing other tasks, like exporting other USB gadgets at
the same time or enabling shell access.
With pollers and workqueues, enabling this would need a large rework
of the code to be completely callback based, whenever the original
Linux code sleeps waiting for events. With the new bthread support,
we can actually sleep and handover control to other bthreads until
there is actual work to do.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210622082617.18011-9-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
usbgadget_register currently takes 6 arguments. Instead of increasing
them to 8 to support the new usb mass storage gadget, rewrite it to
accept a pointer to a struct with all the options instead.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210622082617.18011-8-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
So far, completions made sense only in one direction: The main thread
can wait for pollers, but the other way around didn't work. With the new
bthread support, any bthread can wait for another to complete().
Wrap this up using the Linux completion API to make porting threaded
code easier.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210622082617.18011-6-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Originally, I envisioned bthreads as replacement for pollers and
workqueues. But even without preemption, having functions you call
possibly accessing structures you are iterating over can corrupt
memory. This problem exists with pollers as well, but because of their
limited scope, it's harder to shoot your foot with them, as you
don't keep implicit state between poller activations unlike bthreads,
which maintain their stack across context switches.
Limit bthread scope instead to be a replacement for workqueues. This
still allows us to port some classes of state-machine-in-kthread kernel
code, while avoding the aforementioned pitfalls.
Cc: Jan Luebbe <j.luebbe@pengutronix.de>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210622082617.18011-5-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Workqueues are run out of poller_call, not because of a dependency, but
because when they were added, poller_call was directly called from
is_timeout.
With the addition of bthreads, there is now a general resched() function
that runs pollers and switches between bthreads. It makes sense to move
workqueue handling there as well to keep scheduling matter contained in
a single function. Do so.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210622082617.18011-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This adds basic support for the Rockchip rk3568 SoC.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.barebox.org/20210615141641.31577-8-s.hauer@pengutronix.de
Link: https://lore.barebox.org/20210621092802.27275-8-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Newer Rockchip SoCs boot images starting with the magic "RKNS". There
are older image formats currently not supported, this one is at least
supported on the RK3568.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.barebox.org/20210615141641.31577-4-s.hauer@pengutronix.de
Link: https://lore.barebox.org/20210621092802.27275-4-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
At some places a clk name may be known without having a struct clk *
directly. Add some convenience functions to handle this situation and
use them in the clk commands.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.barebox.org/20210615141641.31577-2-s.hauer@pengutronix.de
Link: https://lore.barebox.org/20210621092802.27275-2-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Fixes: 6f92e74e5b94d8e6 ("clk: add initial StarFive clock support")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210624150931.891123-1-geert@linux-m68k.org
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This imports support for the StarFive GPIO controller from the vendor's
kernel tree.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210619045055.779-28-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Some StarFive peripherals have 5 resets that need to be triggered in
order. Add a helper to simplify this. The Linux way of doing this would
be to import the reset_control_array API, but device_reset_all as
implemented here saves us from this boilerplate.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210619045055.779-27-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The StarFive SoC has a single reset controller, which seems to control
reset of all clocks and peripherals. It differs from the ones supported
by the Linux reset-simple driver in that it has a dedicated status
registers that needs to be polled to verify the reset has completed.
Also special is that most resets (> 70) are synchronous. As the reset
status poll would just time out without the clock, have the reset
controller enable the clock as part of the reset. OS can decide later,
which clocks to disable again.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210619045055.779-24-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
All clocks seem to share a common format:
struct starfive_clk {
u32 divisor : 24; /* LSB */
u32 mux : 6;
u32 invert : 1;
u32 enable : 1; /* MSB */
};
There is no documentation, what the acceptable divisor values are, but
we could already register gates and muxes, do so for now until
documentation is available.
The bulk of this code has been machine-generated by parsing the macros
in the vendor U-Boot <asm/arch-vic7100/clkgen_ctrl_macro.h>.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210619045055.779-23-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|