summaryrefslogtreecommitdiffstats
path: root/drivers/clk/at91/clk-main.c
Commit message (Collapse)AuthorAgeFilesLines
* clk: at91: sync drivers with LinuxAhmad Fatoum2024-02-161-100/+135
| | | | | | | | | | | | | | | | | | | During bug hunt of a clocking issue that ultimately turned out to be unrelated, I resynced AT91 clk support with Linux. The changes look more extensive than they really are, because I first imported the clock drivers before a major overhaul of the barebox clock framework to be more compatible with the more recent kernel API changes. Most of the diff is due to that, but this resync also fixes at least a USB issue for the at91rm9200 and adds support for the new SAMA7 SoC as well as more clocks for the SAM9x60. Both these SoCs aren't supported by barebox yet, but this at least adds clock driver support. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240215121837.251013-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: switch regmap.h include to linux/regmap.hAhmad Fatoum2023-10-261-1/+1
| | | | | | | | | | | | | | | Now that there are no longer any users of regmap.h in headers, let's switch all users in the source files to linux/regmap.h. That way, the only users of regmap.h whether directly or indirectly will be out-of-tree code, which will fail with an error if they are dependent on the old semantics of regmap_bulk_read and regmap_bulk_write. After a transitory period, we can then drop regmap.h. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231020071853.2826528-12-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: introduce struct clk_hwSascha Hauer2021-06-071-63/+63
| | | | | | | | | | | | | | | | | | | In Linux the ops in struct clk_ops take a struct clk_hw * argument instead of a struct clk * argument as in barebox. With this taking new clk drivers from Linux requires a lot of mechanical conversions. Instead of doing this over and over again swallow the pill once and convert the existing barebox code over to clk_hw. The implementation is a little different from Linux. In Linux struct clk is only known to the core clock code. In barebox struct clk is publically known and it is embedded into struct clk_hw. This allows us to still use struct clk members in the clock drivers which we currently still need, because otherwise this patch would be even bigger. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-5-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: rename clk_register() to bclk_register()Sascha Hauer2021-06-071-4/+4
| | | | | | | | | | | | Linux has a clk_register() function with a different semantics than barebox. Rename this function to bclk_register() so that we later can introduce a clk_register() function with the same semantics as Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210602095507.24609-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: at91: port Linux v5.6 SAM9X60 (new ARM926EJ-S) clock supportAhmad Fatoum2020-04-151-3/+7
| | | | | | | | | | | | During a bug hunt that ultimately turned out unrelated to the state of the barebox at91 clk driver, I synchronized its state with Linux v5.6. Bug fixes and clean up to minimize the diff were split out in separate prior commits. This last commit imports the rest, which is basically support for Microchip's new ARM926EJ-S SoC, the SAM9x60. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: at91: add __init marker where appropriateAhmad Fatoum2020-04-151-4/+4
| | | | | | | | While redundant in barebox, it makes our diff to the upstream driver smaller when synchronizing, so add it back. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: migrate to SPDX-License-Identifier useAhmad Fatoum2020-04-151-6/+1
| | | | | | | | | | | | Some of these are a product of source sync with Linux, the other were done with macro assistance by searching for /later/, deleting license text, adding appropriate SPDX-License-Identifier and manual post-review. Devices without a license indicated where assumed GPL-2.0-only according with the project's license. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: at91: fix warning about missing const-safetyAhmad Fatoum2019-05-271-2/+1
| | | | | | | | | | | | | | | | | compiling clk-main.c and clk-generated.c results in: warning: passing argument 1 of 'memcpy' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] memcpy(clkmain->clk.parent_names, parent_names, parents_array_size); ~~~~~~~~~~~~^~~~~~~~~~~~~ Avoid this by replacing the xzalloc+memcpy pair with xmemdup. Zero-initialization of the buffer isn't necessary, because memcpy spans the whole buffer. Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: at91: update to PMC bindingsSam Ravnborg2019-02-251-107/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on kernel 5.0-rc6 update at91 clk support to match the new PMC bindings. Manually added all changes done in the kernel from 4.9-rc3 to 5.0-rc6. New drivers required was added as seperate commits. This includes dt-compat code required to support at91sam5d3, as this is not yet ported to use the new PMC bindings. clk-programmable saw some extra changes - it had never been bulit. It is used only by at91sama5d2 - and barebox has no board support for this cpu (yet). The CONFIG_SOC symbols is used to select the relevant drivers. CONFIG_SOC_SAM9 selects several drivers, and in the future this can be split to keep the image size down. In the kernel CLK_OF_DECLARE_DRIVER() can be used for a two step init. In barebox this is a simple one step init. It was added to have less differences between the kernel and the barebox versions of the drivers. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Tested-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: at91: fix clk-mainSam Ravnborg2017-07-201-0/+1
| | | | | | | | | | | | | Following warning was reported during boot with at91sam9263ek with DT enabled. "Main crystal frequency not set, using approximate value" This occured due to a missing parent in clk_rm9200_main. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* clk: at91: Port at91 DT clock codeAndrey Smirnov2017-03-301-0/+576
Port at91 DT clock code from Linux 4.9-rc3. Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>