summaryrefslogtreecommitdiffstats
path: root/include/linux/clk.h
Commit message (Collapse)AuthorAgeFilesLines
* clk: Add support for shared gatesSascha Hauer2017-02-061-0/+3
| | | | | | | | | | | Sometimes a single software control knob controls multiple gates in hardware. This patch adds support for shared gates which help coping this situation. The first gate is registered with the hardware gate as usual, the others are registered as shared gates which does not have hardware control itself, but only switches the real hardware gate. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: implement CLK_OPS_PARENT_ENABLESascha Hauer2017-02-061-0/+2
| | | | | | | | Some clocks may only be modified when their parent clocks are enabled. The kernel has the CLK_OPS_PARENT_ENABLE flag for this purpose. Implement it for barebox aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: add clock command completionSascha Hauer2016-11-081-0/+4
| | | | | | This adds tab completion for the clk_* commands. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: of: fix clk_of_table generationSascha Hauer2015-06-111-1/+1
| | | | | | | | | | | | | | We used to collect all sections beginning with __clk_of_table_ in a single section in the linker using KEEP(*(.__clk_of_table_*)). That the sentinel entry ended up as the last entry was pure luck, but not always the case. Instead of putting all entries in different sections we now put all entries in the same section. Only the sentinel entry gets its own section and is collected by the linker separately. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reported-by: Andreas Willig <andreas.willig@rafi.de> Tested-by: Andreas Willig <andreas.willig@rafi.de>
* of: use 'const void *' for struct of_device_id.dataAntony Pavlov2015-04-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 2011 barebox' of_device_id struct uses unsigned long type for data field: struct of_device_id { char *compatible; unsigned long data; }; Almost always struct of_device_id.data field are used as pointer and need 'unsigned long' casting. E.g. see 'git grep -A 4 of_device_id drivers/' output: drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = { drivers/ata/sata-imx.c- { drivers/ata/sata-imx.c- .compatible = "fsl,imx6q-ahci", drivers/ata/sata-imx.c- .data = (unsigned long)&data_imx6, drivers/ata/sata-imx.c- }, { Here is of_device_id struct in linux kernel v4.0: struct of_device_id { char name[32]; char type[32]; char compatible[128]; const void *data; }; Changing of_device_id.data type to 'const void *data' will increase barebox' linux kernel compatibility and decrease number of 'unsigned long' casts. Part of the patch was done using the 'coccinelle' tool with the following semantic patch: @rule1@ identifier dev; identifier type; identifier func; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type) + dev_get_drvdata(dev, (const void **)&type) ...> } @rule2@ identifier dev; identifier type; identifier func; identifier data; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type->data) + dev_get_drvdata(dev, (const void **)&type->data) ...> } Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* CLK: clk-divider: Respect CLK_DIVIDER_POWER_OF_TWO flagAndrey Panov2015-03-051-0/+1
| | | | | Signed-off-by: Andrey Panov <rockford@yandex.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* CLK: clk-divider: Introduce clk_divider_alloc() and *_free() routinesAndrey Panov2015-03-051-0/+3
| | | | | Signed-off-by: Andrey Panov <rockford@yandex.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* CLK: clk-divider: Respect CLK_DIVIDER_HIWORD_MASK flagAndrey Panov2015-03-051-0/+2
| | | | | | | | It is required for Rockchip SoCs where clock settings registers have write-enable mask in high word. Signed-off-by: Andrey Panov <rockford@yandex.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* CLK: clk-mux: Respect CLK_MUX_HIWORD_MASK flagAndrey Panov2015-03-051-0/+2
| | | | | | | | It is required for Rockchip SoCs where clock settings registers have write-enable mask in high word. Signed-off-by: Andrey Panov <rockford@yandex.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* CLK: Add fractional divider clock support from Linux kernelAndrey Panov2015-03-051-0/+9
| | | | | Signed-off-by: Andrey Panov <rockford@yandex.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* CLK: Add support for composite clock from Linux kernelAndrey Panov2015-03-051-0/+6
| | | | | Signed-off-by: Andrey Panov <rockford@yandex.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: gate: add CLK_GATE_HIWORD_MASK flagBeniamino Galvani2014-04-291-0/+1
| | | | | | | | | Clock gates having the CLK_GATE_HIWORD_MASK flag set use the upper 16 bits of the register as a "write enable" mask for the value in the lower 16 bits. Signed-off-by: Beniamino Galvani <b.galvani@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: gate: add flags argument to clock gate constructorBeniamino Galvani2014-04-291-2/+5
| | | | | | | | This adds a clk_gate_flags argument to clock gate creation functions to allow the introduction of new clock gate modifiers. Signed-off-by: Beniamino Galvani <b.galvani@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: move of_clk_get_parent_name() to common clk codeAntony Pavlov2014-04-291-0/+1
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: Add parent round/set rate for mux and gateSascha Hauer2014-03-281-0/+4
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: clk-divider: sync with kernel codeSascha Hauer2014-03-281-0/+3
| | | | | | | | This updates the clk-divider to Kernel code, but without power-of-two divider support which we do not need yet. This also adds table based divider support to the divider. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: introduce CLK_SET_RATE_PARENT flagSascha Hauer2014-03-281-0/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: clk-divider: pass flags to initializersSascha Hauer2014-03-281-3/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: clk-fixed-factor: pass flags to initializersSascha Hauer2014-03-281-1/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: clk-gate: pass flags to initializersSascha Hauer2014-03-281-3/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: clk-mux: pass clk flags from initializersSascha Hauer2014-03-281-2/+4
| | | | | | | struct clk has a flags field, let the clk-mux initializers set this field. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: add of_clk_init and CLK_OF_DECLARE macroSebastian Hesselbarth2013-11-111-0/+14
| | | | | | | | | | This add barebox versions of of_clk_init for parsing and registering clock providers from DT. Also, a macro CLK_OF_DECLARE is added, that allows to put init callbacks into its own section that can be linked in the binary. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: of: introduce of_clk_src_simple_getSascha Hauer2013-09-231-0/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: provide static inline wrappersSascha Hauer2013-07-231-1/+38
| | | | | | | So that drivers can use clk_* functions without having to ifdef them away. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: allow to instanciate clk mux without registering itLucas Stach2013-07-021-0/+4
| | | | | | | Allows to reuse clk mux code within other clocks. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: allow to instanciate clk gate without registering itLucas Stach2013-07-021-0/+4
| | | | | | | Allows to reuse the clk gate code within other clocks. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: add clock lookup from devicetreeLucas Stach2013-07-021-0/+33
| | | | | | | Taken from the Linuxkernel with some small adjustments for barebox. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: add prototype for clk_is_enabledSascha Hauer2013-06-201-0/+1
| | | | | | | | On MXS we need to poll the busy bit when changing a clock rate, but only when the parent clocks are enabled. This exposes the already present function clk_is_enabled which is suitable for this job. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: gate: Add inverted gate supportSascha Hauer2013-06-201-0/+2
| | | | | | This adds support for gates which need 0 to enable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: divider: Add onebased divider supportSascha Hauer2013-06-201-0/+15
| | | | | | | In some dividers the register value matches the divider value. This patch adds support for them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: Add is_enabled callbackSascha Hauer2013-03-151-2/+2
| | | | | | | | | | | | | | | This allows us to better detect whether a clk is enabled or not. - If we can ask a clk, ask it. If it's enabled, go on and ask parents - If we can't ask it, but it can be enabled, depend on the enable_count. if it's positive, go on and ask parents - If we can't ask it and it cannot be enabled, assume it is enabled and ask parents. This makes the CLK_ALWAYS_ENABLED unnecessary, since the fixed clk now always returns 1 in its is_enabled callback. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'pu/clk' into for-next/clkSascha Hauer2012-12-071-0/+8
|\ | | | | | | | | Conflicts: include/linux/clk.h
| * clk: Add clk table based divider supportSascha Hauer2012-12-061-0/+10
| | | | | | | | | | | | For easy support of table based dividers. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: add always enabled clocksAntony Pavlov2012-12-031-0/+3
|/ | | | | | | | | | | | | Current barebox clk framework allow disable any clock and there is no means to prevent that. But there are the clocks that can't be disabled by software at all. This patch allow registration of a clock immune to clk_disable(). Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: Add clk gate supportSascha Hauer2012-10-101-0/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: initial common clk supportSascha Hauer2012-10-041-0/+42
| | | | | | | | | | | | | | | | | | | | | | This adds barebox common clk support loosely based on the Kernel common clk support. differences are: - barebox does not need prepare/unprepare - no parent rate propagation for set_rate - struct clk is not really encapsulated from the drivers Along with the clk support we have support for some basic clk building blocks: - clk-fixed - clk-fixed-factor - clk-mux - clk-divider clk-fixed and clk-fixed-factor are completely generic, clk-mux and clk-divider are currently the way i.MX muxes/dividers are implemented. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clock: Introduce clock framework from LinuxJean-Christophe PLAGNIOL-VILLARD2010-08-061-0/+158
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>