summaryrefslogtreecommitdiffstats
path: root/drivers/clk
Commit message (Collapse)AuthorAgeFilesLines
* clk: imx8mp: Remove non existing pcie clocksSascha Hauer2021-05-171-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Adoption of Linux commit: | commit 1840518ae7de0e1eeb9075069cbe632fde16c88d | Author: Richard Zhu <hongxing.zhu@nxp.com> | Date: Mon Mar 15 16:17:47 2021 +0800 | | clk: imx8mp: Remove the none exist pcie clocks | | In the i.MX8MP PCIe design, the PCIe PHY REF clock comes from external | OSC or internal system PLL. It is configured in the IOMUX_GPR14 register | directly, and can't be contolled by CCM at all. | Remove the PCIE PHY clock from clock driver to clean up codes. | There is only one PCIe in i.MX8MP, remove the none exist second PCIe | related clocks. | Remove the none exsits clocks IDs together. | | Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> | Reviewed-by: Jason Liu <jason.hui.liu@nxp.com> | Signed-off-by: Abel Vesa <abel.vesa@nxp.com> Needed for upcoming dts update to v5.13-rc1 Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2021-04-151-1/+10
|\
| * clk: imx: clk-pllv1: fix wrong PLL recalc on i.MX1/i.MX21Ahmad Fatoum2021-03-251-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding -Wtype-limits to the build correctly detects that the first branch (mfn < 0) is never taken as mfn is unsigned. Import the Linux v5.11 bits that correctly checks the sign of the sign/magnitude integer. Unlike Linux, we don't need to check whether it's an i.MX1 or i.MX21 here, because an #ifdef earlier normalizes the value to be aligned with the i.MX27's. This however means that a multi-image barebox wasn't and will remain not able to properly target both <= i.MX21 and newer SoCs at the same time. This is just build-time tested. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: divider: fix divider setting with CLK_SET_RATE_PARENTSascha Hauer2021-04-131-7/+5
|/ | | | | | | | | When CLK_SET_RATE_PARENT is set for a divider then clk_divider_bestdiv() is called which returns the best parent rate. This best parent rate must be fed into divider_get_val(), not the unchanged original parent rate. Fixes: 47b432c697 ("clk: divider: export clk_div_mask() helper") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: include <linux/math64.h> wrapper instead of <asm-generic/div64.h>Ahmad Fatoum2021-02-1916-16/+16
| | | | | | | | | | | <asm-generic/div64.h> isn't meant for direct usage as <asm/div64.h> may override this on a per-architecture basis. We don't do that currently, but in the future we might. Include the <linux/math64.h> instead. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mips'Sascha Hauer2020-12-113-0/+154
|\
| * clk: ls1b200: add clk driver for loongson 1bDu Huanpeng2020-11-133-0/+154
| | | | | | | | | | | | | | add "pll" and "oscillator" node to devicetree. Signed-off-by: Du Huanpeng <u74147@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: imx6: demote warning about ldb_di_clk reparentingAhmad Fatoum2020-11-241-2/+2
|/ | | | | | | | | | Linux logging this is justified, because it alerts to problems in the boot firmware. barebox warning about it serves no real purpose other than indicating that barebox was chainloaded. Make it a debug log to not clutter the log. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* dts: update to v5.10-rc1Sascha Hauer2020-11-091-2/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/remoteproc' into masterSascha Hauer2020-10-141-0/+5
|\
| * clk: i.MX8MQ: Add Cortex-M4 clkSascha Hauer2020-10-071-0/+5
| | | | | | | | | | | | Needed for the remoteproc driver on this SoC. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/percent_pe' into masterSascha Hauer2020-10-141-1/+1
|\ \
| * | vsprintf: retire strerrorp in favor of %peAhmad Fatoum2020-09-291-1/+1
| |/ | | | | | | | | | | | | | | | | strerrorp() is only used along with printf. We now have a format specifier for printing error pointers directly, so use that and remove strerrorp. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / treewide: Use driver macroSascha Hauer2020-09-2923-130/+35
|/ | | | | | | We have several macros for a oneline driver registration. Add some missing and use them consistently where possible througout the tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc' into masterSascha Hauer2020-09-254-7/+127
|\
| * clk: Add clk_bulk_[get|put]_all()Sascha Hauer2020-09-241-0/+80
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * clk_dump command: Allow printing a single clockSascha Hauer2020-09-231-5/+45
| | | | | | | | | | | | | | | | So far the clk_dump command can only print all clocks. With this patch we can limit the output to ancestors and children of a given clock. This makes it easier to find the desired information in big clock trees. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * treewide: s/filed/field/Sascha Hauer2020-08-242-2/+2
| | | | | | | | | | | | Fix typos. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/imx' into masterSascha Hauer2020-09-255-407/+503
|\ \
| * | clk: imx8mp: update clk driver from Linux kernelSascha Hauer2020-08-201-392/+397
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This updates the clock driver to the Linux driver as of v5.9-rc1. The patch is bigger than it needs to be, but this time care has been taken to minimize the diff against the Linux driver to make future updates easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | clk: imx: Add Linux function namesSascha Hauer2020-08-201-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add some function names used in Linux as define to the corresponding functions in barebox. This is done to be able to use the Linux function names in barebox in order to reduce the diff size between the barebox and Linux clock drivers. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | clk: imx: Add imx_clk_gate4_flagsSascha Hauer2020-08-201-0/+6
| | | | | | | | | | | | | | | | | | Needed for further clock driver updates, taken from Linux Kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | clk: imx. clk-composite-8m: Update from Linux KernelSascha Hauer2020-08-202-4/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update clk-composite-8m to Linux as of v5.9-rc2. This is a combination of Linux commits: 0e40198dc28b6 ("clk: imx: add imx8m_clk_hw_composite_bus") f90b68d6c8b00 ("clk: imx: add mux ops for i.MX8M composite clk") 62668b68dc8e7 ("clk: imx: composite-8m: add imx8m_clk_hw_composite_core") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | clk: imx-cpu: Add missing CLK_IS_CRITICALSascha Hauer2020-08-201-1/+1
| | | | | | | | | | | | | | | | | | | | | The CPU clock should never be disabled, mark it as critical as done in the Kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | clk: imx: clk-pll14xx: remove debug leftoverSascha Hauer2020-08-201-2/+1
| | | | | | | | | | | | | | | | | | The printfs were never meant to go upstream. Remove them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | clk: imx: make string arrays const char * const *Sascha Hauer2020-08-202-8/+8
| |/ | | | | | | | | | | | | arrays of pointers to strings should be of type const char * const *, so that not only the arrays of pointers are const, but also the strings. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: imx: clk-frac-pll: Use do_div for 64bit divisionSascha Hauer2020-09-181-1/+1
| | | | | | | | | | | | Use do_div() to avoid undefined references to `__aeabi_uldivmod' Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: at91: sama5d2: fix buffer overflow of clk parent_namesAhmad Fatoum2020-09-147-19/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The upstream implementation passes the clock's parent_names as an address of a local array to the core. That's ok because data contained in struct clk_init_data is duplicated and stored with a proper lifetime. We don't have that in barebox, so the clock providers themselves are responsible for allocating an array with suitable lifetime. Most at91 clk drivers did this by having a fixed size array in the clock's private data struct. Since 47475fa5e0e1 ("clk: at91: add sama5d2 audio PLL support"), we are overflowing struct clk_programmable::parent_names on the sama5d2, because there it has 6 parents, while only space for 5 were allocated. Make the parent_names member of variable size to fix this and to avoid such errors in future. Fixes: 47475fa5e0e1 ("clk: at91: add sama5d2 audio PLL support") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: imx8mm: fix CPU clockLucas Stach2020-08-211-4/+9
|/ | | | | | | | | This is a port of the Linux kernel commit d3b70cd87e77 (clk: imx: imx8mm: fix a53 cpu cloc). This allows the reparenting as specified in the new DTs to succeed. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: imx-imx8mp: Mark arm_a53_core clk as criticalSascha Hauer2020-08-191-1/+1
| | | | | | | | | | | Changes in imx8mp.dtsi for v5.8-rc1 added some clock reparenting to the device tree. IMX8MP_CLK_A53_CORE is reparented to IMX8MP_ARM_PLL_OUT. The latter is not enabled in hardware, so the CPU clock is disabled locking up the system. Mark IMX8MP_CLK_A53_CORE as critical so that the new parent gets enabled before reparenting. Fixes: abef60363d ("dts: update to v5.8-rc1") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: imx7: add IMX7D_OCOTP_CLKRouven Czerwinski2020-08-101-0/+2
| | | | | | | | Otherwise barebox is not able to resolve the clock from the device tree node. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2020-07-271-3/+1
|\
| * treewide: Convert files covered by ARM copyright to SPDXUwe Kleine-König2020-07-141-3/+1
| | | | | | | | | | | | | | | | | | | | According to Marc Zyngier, former employee at ARM, the company owns the copyright for code created by its employees. Convert accordingly to SPDX with the usual rearrangements. Also dropped Marc's email address which doesn't work any more. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/imx'Sascha Hauer2020-07-272-0/+722
|\ \
| * | clk: imx: Add imx8mp clk driverOleksij Rempel2020-07-142-0/+722
| |/ | | | | | | | | | | This adds clock support for the i.MX8MP, taken from Linux-5.7. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
* | Merge branch 'for-next/dts'Sascha Hauer2020-07-2715-791/+1020
|\ \
| * | clk: at91: remove now-duplicate crutch #definesAhmad Fatoum2020-07-051-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | As the code comment describes, these #defines were only needed temporarily till dts/ is synced vs Linux v5.8-rc1. This is now the case, so drop them again. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | clk: at91: remove no-longer needed dt-compat codeAhmad Fatoum2020-07-052-732/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dt-compat.c implemented bindings for following compatibles: atmel,at91rm9200-clk-main-osc atmel,at91sam9x5-clk-main-rc-osc atmel,at91rm9200-clk-main atmel,at91sam9x5-clk-main atmel,at91rm9200-clk-master atmel,at91sam9x5-clk-master atmel,at91rm9200-clk-peripheral atmel,at91sam9x5-clk-peripheral atmel,at91rm9200-clk-pll atmel,sama5d3-clk-pll atmel,at91sam9x5-clk-plldiv atmel,at91rm9200-clk-programmable atmel,at91sam9g45-clk-programmable atmel,at91sam9x5-clk-programmable atmel,at91sam9x5-clk-smd atmel,at91rm9200-clk-system atmel,at91sam9x5-clk-usb atmel,at91sam9n12-clk-usb atmel,at91rm9200-clk-usb atmel,at91sam9x5-clk-utmi With the recent v5.8-rc1 sync, we no longer have any device trees in the barebox repository that use these. Unlike Linux, we don't need to support probing from old device trees, so drop the now unused code. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | clk: at91: sync with Linux v5.8-rc1Ahmad Fatoum2020-07-0514-63/+1025
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ports over a couple of changes that accrued upstream between v5.6, when we last synchronized, and v5.8-rc1: 5bf7f4a24938 clk: at91: sam9x60: Don't use audio PLL b0ecf1c6c6e8 clk: at91: usb: continue if clk_hw_round_rate() return zero 43b203d32b77 clk: at91: sam9x60: fix usb clock parents d7a83d67a169 clk: at91: usb: use proper usbs_mask 9962fb0d1995 clk: at91: usb: introduce num_parents in driver's structure 12dc8d3be9d8 clk: at91: add at91sam9g45 pmc driver 0969b242f7b8 clk: at91: add sama5d3 pmc driver 143e04dab6b4 clk: at91: add at91sam9n12 pmc driver 02ff48e4d7f7 clk: at91: add at91rm9200 pmc driver 99e107439eea clk: at91: Add peripheral clock for PTC f6363c437dc6 clk: at91: pmc: do not continue if compatible not located 7425f246f725 clk: at91: optimize pmc data allocation 99767cd4406f clk: at91: allow setting PCKx parent via DT 03a1ee1dad0e clk: at91: allow setting all PMC clock parents via DT Besides fixes, mostly around sam9x60, this adds support for the new a91 device tree clock bindings that were extended to the sama5d3 in v5.8-rc1. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / clk: sync of_clk_get_parent_name with upstreamAhmad Fatoum2020-06-231-5/+44
|/ | | | | | | | | | | | | Upstream of_clk_get_parent_name only resorts to node name as a fallback. Instead, it uses the name supplied for registered clocks whenever possible. On the sama5d2, this results in sckc@f8048050 and slowck, respectively. So far, sckc@f8048050 in the parents array couldn't be matched with any existing clock, leading to an inaccurate clock tree. Port over the v5.8-rc1 state of the function to fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: mxs: Use device tree provided clock lookupsSascha Hauer2020-05-061-19/+26
| | | | | | | | When probing from the device tree use the device tree provided clock lookups. So far we only used the clock lookups based on the physical base address of the device, but these should go sooner or later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk imx28: Add USB clocksSascha Hauer2020-05-061-0/+13
| | | | | | | The USB clocks are missing, add them to make USB work as part of the i.MX chipidea driver. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: mxs: Fix clock numberingSascha Hauer2020-05-061-2/+2
| | | | | | | | The device tree clock lookups use the position in the clks array, hence they must match. fec_sleep is a barebox specific clock and is in between other clocks. Put the clock at the end of the array. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: mxs: Do not enable enet_out clockSascha Hauer2020-05-061-1/+0
| | | | | | | | | | | | | | The enet_out clock gate is wrongly abstracted. The bit it is controlling is not just a bit to enable the clock, it also controls the direction of the ethernet reference clock. When the bit is cleared, the ethernet reference clock must be fed into the SoC from an external oscillator; when it's set then the ethernet reference clock is generated internally. The correct setting depends on the board, so we must not set the bit unconditionally during probe of the clock driver. Whether or not the clock is enabled can be selected by the board by removing the clock from the FEC in its dts. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: at91: sckc: fix off-by-1000 in udelay()Ahmad Fatoum2020-04-151-1/+1
| | | | | | | | SECOND is the number of nanoseconds in a second, but we need the number of microseconds for use in udelay. Use USEC_PER_SEC. Signed-off-by: Ahmad Fatoum <a.fatoum@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-1517-214/+1085
| | | | | | | | | | | | 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 sama5d2 audio PLL supportAhmad Fatoum2020-04-157-5/+669
| | | | | | | | | | | | | | | | | Commit 7310b976 ("clk: at91: fix compilation errors in sama5d2.c") and follow-up commit ca3077068c ("clk: at91: delete dead i2s/audio code") had deleted the i2s/audio clock related parts of the upstream driver. This was mostly due to unwillingness on my part to understand the code enough for porting them and because I deemed them unnecessary to support in barebox. The former has changed and the latter is not totally true as audio PLL derived clocks may be muxed as inputs for programmable and generated clocks. Port them over and mimize the diff to upstream. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: at91: allow 24 Mhz clock as input for PLLEugen Hristev2020-04-151-1/+1
| | | | | | | | | | | | | | The PLL input range needs to be able to allow 24 Mhz crystal as input Update the range accordingly in plla characteristics struct Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com> Link: https://lkml.kernel.org/r/1568183622-7858-1-git-send-email-eugen.hristev@microchip.com Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Fixes: c561e41ce4d2 ("clk: at91: add sama5d2 PMC driver") Signed-off-by: Stephen Boyd <sboyd@kernel.org> [afa: ported to barebox from Linux commit 81a6b601f9f49] Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: at91: Mark struct clk_range as constStephen Boyd2020-04-156-12/+12
| | | | | | | | | | | It's just some static data that doesn't get changed after being used. Mark it const everywhere. Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org> [afa: ported to barebox from Linux commit 7b4c162e03d47e0] 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-1512-38/+38
| | | | | | | | 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>