summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* firmware: Fix device_node matchingSascha Hauer2021-06-251-0/+1
| | | | | | | | | | | | firmwaremgr_find_by_node() matches against the device node of the parent of the device associated to the handler. This is correct for the socfpga and zyncmp driver, but not for the altera_serial driver. Add a device_node argument to the handler which is set by the drivers to the correct device node and match against that. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-9-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* firmware: Add search pathSascha Hauer2021-06-251-0/+12
| | | | | | | | | | | | This adds a colon separated search path for firmware files. When the firmware we are searching is not an absolute path then look in the search path first. This will be useful later when the bootloader spec implementation shall look for firmware files relative to the provided root. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-8-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* firmware: consolidate ifdefsSascha Hauer2021-06-251-6/+3
| | | | | | | | | Instead of having multiple #ifdef CONFIG_FIRMWARE in a single file move the code together inside a single #ifdef. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-7-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* libbb: Add find_path functionSascha Hauer2021-06-251-1/+3
| | | | | | | | | | | libbb contains a find_execable() function to find an executable in a colon separated path. The code can be reused by making the environment variable name and the is-executable test parameters. Do this and add a find_path() Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-6-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* firmware: make device_node argument non constSascha Hauer2021-06-251-2/+2
| | | | | | | | | | | | firmwaremgr_find_by_node() takes a const pointer to a device tree node. Most functions that take a device tree node take a non const pointer though, so we can't call them from there. It might be worth looking into making the pointers const for other functions, but we are not there yet. Make the pointer non const for now. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-5-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fdt: Check blob size during unflatteningSascha Hauer2021-06-251-2/+2
| | | | | | | | | | | of_unflatten_dtb() doesn't check the size of the device tree blob passed to it. Add a size argument end add checks for the size. Some callers have no idea of the buffer size themselves, INT_MAX is passed in these cases. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Add function to duplicate a device treeSascha Hauer2021-06-251-0/+1
| | | | | | | | | | | | | | This adds of_dup() to duplicate a device tree. Previously of_copy_node() was used for this, but of_copy_node() has issues with potentially duplicated phandle values when the new tree is inserted to an existing tree, that is when the parent argument of of_copy_node() is non NULL. All users of of_copy_node() with a NULL parent argument are converted to of_dup() which is safe to use leaving only the problematic users of of_copy_node(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* libfile: Add copy_fd()Sascha Hauer2021-06-231-0/+1
| | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210623043359.18391-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Add function to check if a filetype is a compressed fileSascha Hauer2021-06-231-0/+14
| | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210623043359.18391-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* firmware: import fpga-mgr.h from linuxSteffen Trumtrar2021-06-212-0/+103
| | | | | | | | | Instead of defining the fpga-mgr structure in the socfpga driver, import the fpga-mgr.h file from linux v4.13. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Link: https://lore.barebox.org/20210616063246.14900-5-s.trumtrar@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: add fpga bridge frameworkSteffen Trumtrar2021-06-211-0/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Import the fpga bridge framework from linux v4.10-rc2. Description from the initial commit adding this to linux: 21aeda950c5f84a8351b862816d832120b217a9b fpga: add fpga bridge framework This framework adds API functions for enabling/ disabling FPGA bridges under kernel control. This allows the Linux kernel to disable FPGA bridges during FPGA reprogramming and to enable FPGA bridges when FPGA reprogramming is done. This framework is be manufacturer-agnostic, allowing it to be used in interfaces that use the FPGA Manager Framework to reprogram FPGA's. The functions are: * of_fpga_bridge_get * fpga_bridge_put Get/put an exclusive reference to a FPGA bridge. * fpga_bridge_enable * fpga_bridge_disable Enable/Disable traffic through a bridge. * fpga_bridge_register * fpga_bridge_unregister Register/unregister a device-specific low level FPGA Bridge driver. Get an exclusive reference to a bridge and add it to a list: * fpga_bridge_get_to_list To enable/disable/put a set of bridges that are on a list: * fpga_bridges_enable * fpga_bridges_disable * fpga_bridges_put Signed-off-by: Alan Tull <atull@opensource.altera.com> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Link: https://lore.barebox.org/20210616063246.14900-2-s.trumtrar@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset: add of_reset_control_get to headerSteffen Trumtrar2021-06-211-0/+2
| | | | | | Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Link: https://lore.barebox.org/20210616063246.14900-1-s.trumtrar@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nvmem: fix mismatch between extern and inline stub prototypesAhmad Fatoum2021-06-211-1/+1
| | | | | | | | | Building with nvmem cell support disabled shows a mismatch in the stub prototype. Fix it up. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210619033212.3391-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/testing'Sascha Hauer2021-06-162-0/+79
|\
| * test: self: port Linux printf kselftestAhmad Fatoum2021-06-091-0/+5
| | | | | | | | | | | | | | | | | | | | | | Port over the Linux v5.11 selftest for printf sans the parts we don't support. This can be used to catch regressions if changes affecting the printf code are made. Acked-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210604084704.17410-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * test: add basic barebox self-test infrastructureAhmad Fatoum2021-06-091-0/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Self tests is code written to run within barebox to exercise functionality. They offer flexibility to test specific units of barebox instead of the program as a whole. Add a very simple infrastructure for registering and executing self-tests. This is based on the Linux kselftest modules. We don't utilize modules for this, however, because we only have module support on ARM, but we need a generic solution. Selftests can be enabled individually and even tested without shell support to allow tests to happen for size-restricted barebox images as well. Acked-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210604084704.17410-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/overlapping-memory-banks'Sascha Hauer2021-06-163-4/+23
|\ \
| * | of: warn about of_add_memory_bank errorsAhmad Fatoum2021-06-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that errors from of_probe are propagated to the respective initcalls registering the device tree, propagate of_add_memory_bank errors as well. This ensures that clashes of device-tree added regions with previous ones don't go unnoticed. This can e.g. be the case if a device tree happens to have both /memory@X { }; and /memory { }; nodes. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210531071239.30653-5-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-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | memory: fuse overlapping memory banksAhmad Fatoum2021-06-021-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some ARM subarchitectures read back RAM size from the SDRAM controller and use the info to register memory banks. If an overlapping memory region is already registered, e.g. via device tree /memory, this second registration will fail. This is especially annoying as it can regress after a device tree sync: - Kind soul updates upstream device tree to describe minimal available RAM across hardware variants - barebox PBL has enough info about the board to set up larger RAM size and relocates barebox to the end of the RAM - barebox proper starts with new device tree and is upset to find itself outside of registered memory Account for this by growing the existing bank if a bank to be added happens to overlap it. As a special case, if the existing bank completely contains the new memory bank, the function is a no-op. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210531071239.30653-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: memory: allocate all memory devices at onceAhmad Fatoum2021-06-021-1/+0
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow-up commit will fuse overlapping RAM banks. As all memory is supposed to be registered during mem_initcall or before, we can postpone device creation to mmu_initcall, so we can directly allocate devices spanning the correct region. The mem driver and the devinfo command are the only consumers of these devices, so it's ok to register the devices at mmu_initcall. While at it, drop the struct memory_bank::dev member. It's unused anywhere. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210531071239.30653-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mmc'Sascha Hauer2021-06-161-0/+3
|\ \
| * | mci: mci-core: respect disable-wp propertyMichael Tretter2021-06-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Systems without write-protect pin should ignore the write protect logic and assume that an SD card is always read-write. This is expressed by the disable-wp dt property. Respect the disable-wp property and don't call the write protection check in these cases. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Link: https://lore.barebox.org/20210616073957.1872965-2-m.tretter@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mci: sdhci: port over some common functions from LinuxSascha Hauer2021-06-101-0/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds some functions useful for SDHCI drivers from Linux: sdhci_calc_clk() sdhci_set_clock() sdhci_enable_clk() sdhci_read_caps() sdhci_set_bus_width() These functions can be used to further unify our different SDHCI drivers. All the new functions assume the also newly introduced sdhci_setup_host() has been called before using them. The functions are moslty the same as their Linux pendants, only sdhci_calc_clk() takes an addional clock rate argument where Linux uses host->max_clk. This is not suitable for the upcoming Rockchip driver which needs to adjust the input clock using clk_set_rate(), so fixed host->max_clk is not accurate for this driver. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210607104411.23071-5-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2021-06-164-235/+6
|\ \
| * | drivers: drop unused usb_gadget_{map,unmap}_request()Antony Pavlov2021-06-151-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | There is no code that is dependent on usb_gadget_{map,unmap}_request(). Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Link: https://lore.barebox.org/20210614142833.86544-1-antonynpavlov@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | regulator: discard unused struct regulator_init_data handlingAhmad Fatoum2021-06-112-220/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | struct regulator_init_data and the contained regulation_constraints are populated from device tree, but unused anywhere. They are not required for the stpmic driver to operate, so they can just be dropped. No functional change. Tested-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210609084027.13591-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | of: base: constify some property pointersTrent Piepho2021-06-021-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Make the propery pointers in a few OF functions that read data const. They don't modify the property. Signed-off-by: Trent Piepho <tpiepho@gmail.com> Link: https://lore.barebox.org/20210529062541.1123023-1-tpiepho@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | commands: of_dump: implement -p for printing properties onlyAhmad Fatoum2021-05-311-0/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Some boards rewrite root node properties like compatible and serial-number. Checking them can be annoying, because the properties have usually long scrolled by, by the time the device tree was completely dumped. Add a -p option to print only properties. -p -n (print only node names AND only properties) is interpreted to cancel each other out, so the whole device tree is dumped normally. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210527124406.22121-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/i2c'Sascha Hauer2021-06-162-4/+25
|\ \
| * | nvmem: add nvmem_regmap_register helperAhmad Fatoum2021-06-022-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Registering a nvmem device for a regmap involves some boilerplate that doesn't need to change from driver to driver: - Reads are made aligned, to support normal use with md - Writes are passed along as is - nvmem parameters can be extracted from regmap Instead of having to replicate this driver by driver, add one helper to make this adaptation easier. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210531072406.5630-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | nvmem: provider: align read/write callback prototype with upstreamAhmad Fatoum2021-06-021-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | barebox allocates a NVMEM device as part of nvmem_register, which it passes along to the callbacks. Callbacks then use dev->parent->priv to retrieve the driver private data. This indirection makes definition of nvmem helpers inconvenient, because they would need to hijack the ->priv member of the hardware device. Avoid this by passing along some private data pointer defined at registration time, just like Linux does. This will be used in a follow up commit. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210531072406.5630-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | regmap: implement regmap_init_i2cAhmad Fatoum2021-06-021-0/+13
| |/ | | | | | | | | | | | | | | | | Linux offers a helper for creating regmaps over i2c. Add a similar helper for barebox to ease driver porting. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210531072406.5630-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | include: <io.h>: define (read|write)[bwlq]_relaxedAhmad Fatoum2021-06-111-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For Linux, It's always correct to substitute any of the read or write _relaxed functions with their non relaxed counterpart. Define functions that do this. Unlike with Linux, they doesn't per se affect performance: barebox writel doesn't imply memory barriers, instead it depends on the architecture support to map IO memory regions as non-bufferable. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20210611080155.3555976-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: implement clk_bulk_get_optional()Sascha Hauer2021-06-101-0/+20
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210609115316.13627-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | regmap: Add regmap_read_poll_timeoutSascha Hauer2021-06-081-0/+24
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-23-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: implement set/get phaseSascha Hauer2021-06-081-0/+5
| | | | | | | | | | | | | | | | | | | | Linux has clk_set_phase() and clk_get_phase() along with the corresponding callbacks in struct clk_ops. Implement the same for barebox as well. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-22-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: implement CLK_SET_RATE_UNGATESascha Hauer2021-06-081-0/+1
| | | | | | | | | | | | | | | | | | Some clocks need to be turned on in oder to change their rate. Implement CLK_SET_RATE_UNGATE to support these. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-21-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: Rename CLK_GATE_INVERTED to CLK_GATE_SET_TO_DISABLESascha Hauer2021-06-081-1/+1
| | | | | | | | | | | | | | | | Rename CLK_GATE_INVERTED to CLK_GATE_SET_TO_DISABLE as done in Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-20-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: Add CLK_GET_RATE_NOCACHESascha Hauer2021-06-081-0/+1
| | | | | | | | | | | | | | | | | | Just add the flag. We don't need any implementation of this flag as we do not cache the clock rate anyway. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-19-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: Add Linux functions to register a muxSascha Hauer2021-06-071-0/+5
| | | | | | | | | | | | | | | | | | Linux has clk_register_mux(). Add the same function with the same prototype for barebox to ease code porting from Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-18-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: Add Linux functions to register a gateSascha Hauer2021-06-071-0/+4
| | | | | | | | | | | | | | | | | | Linux has clk_register_gate(). Add the same function with the same prototype for barebox to ease code porting from Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-17-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: Add Linux functions to register a fixed factor clockSascha Hauer2021-06-071-0/+3
| | | | | | | | | | | | | | | | | | Linux has clk_register_fixed_factor(). Add the same function with the same prototype for barebox to ease code porting from Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-16-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: Add Linux functions to register a dividerSascha Hauer2021-06-071-0/+9
| | | | | | | | | | | | | | | | | | | | Linux has clk_register_divider() and clk_register_divider_table(). Add the same functions with the same prototypes for barebox to ease code porting from Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-15-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: Add lock to different clock typesSascha Hauer2021-06-071-0/+5
| | | | | | | | | | | | | | | | | | The different clock types in Linux have a spinlock_t *lock field. Add the same in barebox to ease code porting from Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-14-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: Update fractional divider from LinuxSascha Hauer2021-06-071-0/+44
| | | | | | | | | | | | | | | | This updates the fractional divider implementation from Linux-5.12. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-13-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Add rational_best_approximation()Sascha Hauer2021-06-071-0/+20
| | | | | | | | | | | | | | | | | | | | Import rational_best_approximation() from Linux. This is used by an upcoming update of the clk_fractional_divider code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-12-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: move fixed_factor to include/linux/clk.hSascha Hauer2021-06-071-0/+15
| | | | | | | | | | | | | | | | | | In Linux struct clk_fixed_factor is known to clk implementors. Do the same in barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-11-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: mux: Add ro opsSascha Hauer2021-06-071-0/+1
| | | | | | | | | | | | | | | | | | The Linux version of the clk muxr exports a clk_mux_ro_ops. Do the same for barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-10-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: divider: Make clk_mux_ops constSascha Hauer2021-06-071-1/+1
| | | | | | | | | | | | | | | | clk_mux_ops shouldn't be changed, so make it const. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-9-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>